>>>>> "Ing" == Ing Roland Krause <[EMAIL PROTECTED]> writes:

Ing> This is a multi-part message in MIME format.
Ing> --------------71C85E59F99D511FBDE72691 Content-Type: text/plain;
Ing> charset=us-ascii Content-Transfer-Encoding: 7bit

Ing> Hi guys, here is the promised patch that does two things.

Ing> 1 It allows for $$FName in \view_dvi_command and \view_ps_command
Ing> so that on NT/95 you can put \view_dvi_command "yap `cygpath -w
Ing> $$FName`" and resp. \view_ps_command "gsview32 `cygpath -w
Ing> $$FName`" in your lyxrc file. This removes the need for a startup
Ing> script dvi.bat and gv.bat on windows platforms. 

That's good indeed. You could probably habve used LSubString to do the
replace, but I'm disgressing...

\begin{disgression}
It seems to me that you can do something like
  LSubString foo(command,"$$FNAME");
  foo = QuoteName(name);
which is much funnier, or even (does C++ allows this?)
  LSubString(command,"$$FNAME") = QuoteName(name);

However, it is not clear to me whether it is legal to call
LSubString::operator=, when the substring has not been found in the
original string (i.e. no $$FName here).

Lars, do you know whether it would work? If not, could this be changed?
\end{disgression}

Ing> 2 It introduces
Ing> \view_dvi_paper_option "" also in lyxrc. With this option you can
Ing> overwrite the papersize that is specified when viewing a dvi
Ing> file. yap (the MikTeX dvi viewer) doesnt have a paper option at
Ing> all, so you get an error message when viewing a dvi file. When
Ing> this option is set to blank, i.e. "", no paper size is specified
Ing> when yap is called. If this command is not given at all nothing
Ing> is changed.

I do not understand what the semantics of this command is (are?). What
is its default value? 

Ing> I hope that this can be include in the 1.1.4 release and that I
Ing> didnt introduce side effects because I had to rearrange the dvi
Ing> preview method a bit. Let me know it this can go in or if I need
Ing> to change something.

I'd like to include it too, but it depends on Lars' timing. It would
be a mistake to apply this one or two days before release (OK, I know,
you already sent it and I did not answer, sorry). You will need to
send also a short description for lyxrc.example, and example of
invokation, so that the automatic configure script can try to do some
magic.

JMarc

Ing> Roland

Ing> --------------71C85E59F99D511FBDE72691 Content-Type: text/plain;
Ing> charset=us-ascii; name="lyx_cb.patch.1"
Ing> Content-Transfer-Encoding: 7bit Content-Disposition: inline;
Ing> filename="lyx_cb.patch.1"

Ing> Index: lyx-devel/src/lyx_cb.C
Ing> ===================================================================
Ing> RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_cb.C,v
Ing> retrieving revision 1.38 diff -u -r1.38 lyx_cb.C ---
Ing> lyx-devel/src/lyx_cb.C 2000/01/11 01:59:00 1.38 +++
Ing> lyx-devel/src/lyx_cb.C 2000/01/21 19:10:52 @@ -514,8 +514,20 @@
Ing> path = buffer->tmppath; } Path p(path); - - cmd = command + ' ' +
Ing> QuoteName(name); + /* + * At this point we check whether the
Ing> command contains the filename parameter + * $$FName and if that's
Ing> the case we substitute the real file name otherwise + * the
Ing> filename is simply appended. + * rokrau 1/12/00 + */ + cmd =
Ing> command; + std::string::size_type i; + if (
Ing> (i=command.find("$$FName")) != std::string::npos) + { +
Ing> cmd.replace(i,7,QuoteName(name)); + } + else + cmd = command + '
Ing> ' + QuoteName(name);

Ing>    Systemcalls one;

Ing> @@ -712,59 +724,58 @@ // Who cares? //if (!bv->text) // return
Ing> false; - - string paper; - - // wrong type - char real_papersize
Ing> = buffer->params.papersize; - if (real_papersize ==
Ing> BufferParams::PAPER_DEFAULT) - real_papersize =
Ing> lyxrc->default_papersize; - - switch (real_papersize) { - case
Ing> BufferParams::PAPER_USLETTER: - paper = "us"; - break; - case
Ing> BufferParams::PAPER_A3PAPER: - paper = "a3"; - break; - case
Ing> BufferParams::PAPER_A4PAPER: - paper = "a4"; - break; - case
Ing> BufferParams::PAPER_A5PAPER: - paper = "a5"; - break; - case
Ing> BufferParams::PAPER_B5PAPER: - paper = "b5"; - break; - case
Ing> BufferParams::PAPER_EXECUTIVEPAPER: - paper = "foolscap"; -
Ing> break; - case BufferParams::PAPER_LEGALPAPER: - paper = "legal";
Ing> - break; - default: /* If nothing else fits, keep the empty value
Ing> */ - break; - } + string paper = lyxrc->view_dvi_paper_option; +
Ing> if (!paper.empty()) { + // wrong type + char real_papersize =
Ing> buffer->params.papersize; + if (real_papersize ==
Ing> BufferParams::PAPER_DEFAULT) + real_papersize =
Ing> lyxrc->default_papersize;

Ing> - if (paper.empty()) { - if (buffer->params.orientation ==
Ing> BufferParams::ORIENTATION_LANDSCAPE) - // we HAVE to give a size
Ing> when the page is in - // landscape, so use USletter. - paper = "
Ing> -paper usr"; - } else { - paper = " -paper " + paper; - if
Ing> (buffer->params.orientation ==
Ing> BufferParams::ORIENTATION_LANDSCAPE) - paper+= 'r'; + switch
Ing> (real_papersize) { + case BufferParams::PAPER_USLETTER: + paper
Ing> += " us"; + break; + case BufferParams::PAPER_A3PAPER: + paper +=
Ing> " a3"; + break; + case BufferParams::PAPER_A4PAPER: + paper += "
Ing> a4"; + break; + case BufferParams::PAPER_A5PAPER: + paper += "
Ing> a5"; + break; + case BufferParams::PAPER_B5PAPER: + paper += "
Ing> b5"; + break; + case BufferParams::PAPER_EXECUTIVEPAPER: + paper
Ing> += " foolscap"; + break; + case BufferParams::PAPER_LEGALPAPER: +
Ing> paper += " legal"; + break; + default: /* If nothing else fits,
Ing> keep the empty value */ + break; + } + if (real_papersize==' ') {
Ing> + // if (paper.empty()) { + if (buffer->params.orientation ==
Ing> BufferParams::ORIENTATION_LANDSCAPE) + // we HAVE to give a size
Ing> when the page is in + // landscape, so use USletter. + paper = "
Ing> -paper usr"; + } else { + // paper = " -paper " + paper; + if
Ing> (buffer->params.orientation ==
Ing> BufferParams::ORIENTATION_LANDSCAPE) + paper+= 'r'; + } } - //
Ing> push directorypath, if necessary - string path =
Ing> OnlyPath(buffer->fileName()); - if (lyxrc->use_tempdir ||
Ing> (IsDirWriteable(path) < 1)){ + string path =
Ing> OnlyPath(buffer->fileName()); + if (lyxrc->use_tempdir ||
Ing> (IsDirWriteable(path) < 1)) { path = buffer->tmppath; - } - Path
Ing> p(path); + } + Path p(path); // Run dvi-viewer - string command =
Ing> lyxrc->view_dvi_command + paper ; + string command =
Ing> lyxrc->view_dvi_command + " " + paper; bool ret =
Ing> RunScript(buffer, false, command); return ret; } Index:
Ing> lyx-devel/src/lyxrc.C
Ing> ===================================================================
Ing> RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrc.C,v
Ing> retrieving revision 1.15 diff -u -r1.15 lyxrc.C ---
Ing> lyx-devel/src/lyxrc.C 2000/01/13 16:28:53 1.15 +++
Ing> lyx-devel/src/lyxrc.C 2000/01/21 19:10:58 @@ -107,6 +107,7 @@
Ing> RC_NUMLASTFILES, RC_CHECKLASTFILES, RC_VIEWDVI_COMMAND, +
Ing> RC_VIEWDVI_PAPEROPTION, RC_DEFAULT_PAPERSIZE, RC_PS_COMMAND,
Ing> RC_VIEWPS_COMMAND, @@ -224,6 +225,7 @@ {
Ing> "\\use_personal_dictionary", RC_USE_PERS_DICT }, {
Ing> "\\use_tempdir", RC_USETEMPDIR }, { "\\view_dvi_command",
Ing> RC_VIEWDVI_COMMAND }, + { "\\view_dvi_paper_option",
Ing> RC_VIEWDVI_PAPEROPTION }, { "\\view_pdf_command",
Ing> RC_VIEWPDF_COMMAND }, { "\\view_ps_command", RC_VIEWPS_COMMAND },
Ing> { "\\view_pspic_command", RC_VIEWPSPIC_COMMAND } @@ -277,6 +279,7
Ing> @@ view_ps_command = "ghostview -swap"; view_pspic_command =
Ing> "ghostview"; view_dvi_command = "xdvi"; + view_dvi_paper_option =
Ing> "-paper"; view_pdf_command = "xpdf"; default_papersize =
Ing> BufferParams::PAPER_USLETTER; custom_export_format = "ps"; @@
Ing> -608,6 +611,13 @@ view_dvi_command = lexrc.GetString(); break;

Ing> + case RC_VIEWDVI_PAPEROPTION: + if (lexrc.next()) +
Ing> view_dvi_paper_option = lexrc.GetString(); + else +
Ing> view_dvi_paper_option = ""; + break; + case RC_VIEWPDF_COMMAND:
Ing> if (lexrc.next()) view_pdf_command = lexrc.GetString(); @@
Ing> -1072,6 +1082,8 @@ << "\n"; case RC_VIEWDVI_COMMAND: os <<
Ing> "\\view_dvi_command \"" << view_dvi_command << "\"\n"; + case
Ing> RC_VIEWDVI_PAPEROPTION: + os << "\\view_dvi_paper_option \"" <<
Ing> view_dvi_paper_option << "\"\n"; case RC_VIEWPDF_COMMAND: os <<
Ing> "\\view_pdf_command \"" << view_pdf_command << "\"\n"; case
Ing> RC_DEFAULT_PAPERSIZE: Index: lyx-devel/src/lyxrc.h
Ing> ===================================================================
Ing> RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrc.h,v
Ing> retrieving revision 1.9 diff -u -r1.9 lyxrc.h ---
Ing> lyx-devel/src/lyxrc.h 2000/01/11 01:59:00 1.9 +++
Ing> lyx-devel/src/lyxrc.h 2000/01/21 19:10:58 @@ -105,6 +105,8 @@
Ing> string view_pspic_command; /// program for viewing dvi output
Ing> (default "xdvi") string view_dvi_command; + /// option for
Ing> telling the dvi viewer about the paper size + string
Ing> view_dvi_paper_option; /// program for viewing pdf output
Ing> (default "xpdf") string view_pdf_command; /// default paper size
Ing> for local xdvi/dvips/ghostview/whatever

Ing> --------------71C85E59F99D511FBDE72691--

Reply via email to