mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-04 16:42:57 +00:00
Patch from Roland for yap support under NT; fix to LFUN_LAYOUT
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@556 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d6f638ea96
commit
3923262592
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
2000-02-15 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
|
* src/lyxfunc.C (Dispatch): fix LFUN_LAYOUT when giving a
|
||||||
|
nonexisting layout; correctly redirect obsoleted layouts.
|
||||||
|
|
||||||
|
* lib/lyxrc.example: document \view_dvi_paper_option
|
||||||
|
|
||||||
|
* src/lyxrc.[Ch]: add support for the \view_dvi_paper_option
|
||||||
|
variable.
|
||||||
|
|
||||||
|
* src/lyx_cb.C (RunScript): handle $$FName for command names.
|
||||||
|
(PreviewDVI): handle the view_dvi_paper_option variable.
|
||||||
|
[Both from Roland Krause]
|
||||||
|
|
||||||
2000-02-14 Lars Gullik Bjønnes <larsbj@lyx.org>
|
2000-02-14 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
* src/Painter.C (text(int,int,char,LyXFont)): call text(int, int,
|
* src/Painter.C (text(int,int,char,LyXFont)): call text(int, int,
|
||||||
|
@ -80,15 +80,24 @@
|
|||||||
|
|
||||||
# Define which program to use to view dvi files here.
|
# Define which program to use to view dvi files here.
|
||||||
# You can include any options you need by "quoting" the entire command.
|
# You can include any options you need by "quoting" the entire command.
|
||||||
# You don't need to specify the paper-size and orientation, which is done
|
|
||||||
# automatically by LyX (hence, your viewer has to interpret the -paper
|
|
||||||
# option like xdvi does)
|
|
||||||
# The default is "xdvi".
|
# The default is "xdvi".
|
||||||
# Example: the next line would use xdvi and display with shrink 2:
|
# Example: the next line would use xdvi and display with shrink 2:
|
||||||
#\view_dvi_command "xdvi -s 2"
|
#\view_dvi_command "xdvi -s 2"
|
||||||
# It can get more involved. Expert users might prefer something like:
|
# It can get more involved. Expert users might prefer something like:
|
||||||
#\view_dvi_command "xdvi -s 2 -expert -geometry 1014x720+0+0 -keep -margins 1.5"
|
#\view_dvi_command "xdvi -s 2 -expert -geometry 1014x720+0+0 -keep -margins 1.5"
|
||||||
|
|
||||||
|
# \view_dvi_paper_option allows to specify a paper option to the dvi
|
||||||
|
# viewer. By default LyX specifies the paper size of the document to
|
||||||
|
# the dvi viewer via the command line option -paper size, where size
|
||||||
|
# is one of "us","letter","a3","a4" and so on. The command
|
||||||
|
# \view_dvi_paper_option allows the user to overwrite the name of the
|
||||||
|
# command line flag, i.e. replace -paper with something else. If
|
||||||
|
# specified and left empty, i.e. \view_dvi_paper_option "", LyX does
|
||||||
|
# not append the -paper option to the dvi command at all. This case is
|
||||||
|
# especially useful when viewing your documents on Windows with yap,
|
||||||
|
# because yap does not allow a command line option for the paper size.
|
||||||
|
#\view_dvi_paper ""
|
||||||
|
|
||||||
# LyX assumes that the default papersize should be usletter. If this is not
|
# LyX assumes that the default papersize should be usletter. If this is not
|
||||||
# true for your site, use the next line to specify usletter, legal,
|
# true for your site, use the next line to specify usletter, legal,
|
||||||
# executive, a3, a4, a5, or b5 as the default papersize.
|
# executive, a3, a4, a5, or b5 as the default papersize.
|
||||||
|
118
src/lyx_cb.C
118
src/lyx_cb.C
@ -506,8 +506,18 @@ bool RunScript(Buffer * buffer, bool wait,
|
|||||||
path = buffer->tmppath;
|
path = buffer->tmppath;
|
||||||
}
|
}
|
||||||
Path p(path);
|
Path p(path);
|
||||||
|
// At this point we check whether the command contains the
|
||||||
cmd = command + ' ' + QuoteName(name);
|
// filename parameter $$FName and if that's the case we
|
||||||
|
// substitute the real file name otherwise the filename is
|
||||||
|
// simply appended. rokrau 1/12/00
|
||||||
|
cmd = command;
|
||||||
|
std::string::size_type i;
|
||||||
|
if ( (i=command.find("$$FName")) != std::string::npos)
|
||||||
|
{
|
||||||
|
cmd.replace(i,7,QuoteName(name));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
cmd = command + ' ' + QuoteName(name);
|
||||||
|
|
||||||
Systemcalls one;
|
Systemcalls one;
|
||||||
|
|
||||||
@ -705,58 +715,60 @@ bool PreviewDVI(Buffer * buffer)
|
|||||||
//if (!bv->text)
|
//if (!bv->text)
|
||||||
// return false;
|
// return false;
|
||||||
|
|
||||||
string paper;
|
string paper = lyxrc->view_dvi_paper_option;
|
||||||
|
if (!paper.empty()) {
|
||||||
// wrong type
|
// wrong type
|
||||||
char real_papersize = buffer->params.papersize;
|
char real_papersize = buffer->params.papersize;
|
||||||
if (real_papersize == BufferParams::PAPER_DEFAULT)
|
if (real_papersize == BufferParams::PAPER_DEFAULT)
|
||||||
real_papersize = lyxrc->default_papersize;
|
real_papersize = lyxrc->default_papersize;
|
||||||
|
|
||||||
switch (real_papersize) {
|
switch (real_papersize) {
|
||||||
case BufferParams::PAPER_USLETTER:
|
case BufferParams::PAPER_USLETTER:
|
||||||
paper = "us";
|
paper += " us";
|
||||||
break;
|
break;
|
||||||
case BufferParams::PAPER_A3PAPER:
|
case BufferParams::PAPER_A3PAPER:
|
||||||
paper = "a3";
|
paper += " a3";
|
||||||
break;
|
break;
|
||||||
case BufferParams::PAPER_A4PAPER:
|
case BufferParams::PAPER_A4PAPER:
|
||||||
paper = "a4";
|
paper += " a4";
|
||||||
break;
|
break;
|
||||||
case BufferParams::PAPER_A5PAPER:
|
case BufferParams::PAPER_A5PAPER:
|
||||||
paper = "a5";
|
paper += " a5";
|
||||||
break;
|
break;
|
||||||
case BufferParams::PAPER_B5PAPER:
|
case BufferParams::PAPER_B5PAPER:
|
||||||
paper = "b5";
|
paper += " b5";
|
||||||
break;
|
break;
|
||||||
case BufferParams::PAPER_EXECUTIVEPAPER:
|
case BufferParams::PAPER_EXECUTIVEPAPER:
|
||||||
paper = "foolscap";
|
paper += " foolscap";
|
||||||
break;
|
break;
|
||||||
case BufferParams::PAPER_LEGALPAPER:
|
case BufferParams::PAPER_LEGALPAPER:
|
||||||
paper = "legal";
|
paper += " legal";
|
||||||
break;
|
break;
|
||||||
default: /* If nothing else fits, keep the empty value */
|
default: /* If nothing else fits, keep the empty value */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (real_papersize==' ') {
|
||||||
if (paper.empty()) {
|
// if (paper.empty()) {
|
||||||
if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
|
if (buffer->params.orientation
|
||||||
// we HAVE to give a size when the page is in
|
== BufferParams::ORIENTATION_LANDSCAPE)
|
||||||
// landscape, so use USletter.
|
// we HAVE to give a size when the page is in
|
||||||
paper = " -paper usr";
|
// landscape, so use USletter.
|
||||||
} else {
|
paper = " -paper usr";
|
||||||
paper = " -paper " + paper;
|
} else {
|
||||||
if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
|
// paper = " -paper " + paper;
|
||||||
paper+= 'r';
|
if (buffer->params.orientation
|
||||||
}
|
== BufferParams::ORIENTATION_LANDSCAPE)
|
||||||
|
paper+= 'r';
|
||||||
// push directorypath, if necessary
|
}
|
||||||
string path = OnlyPath(buffer->fileName());
|
|
||||||
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){
|
|
||||||
path = buffer->tmppath;
|
|
||||||
}
|
}
|
||||||
Path p(path);
|
// push directorypath, if necessary
|
||||||
// Run dvi-viewer
|
string path = OnlyPath(buffer->fileName());
|
||||||
string command = lyxrc->view_dvi_command + paper ;
|
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
|
||||||
|
path = buffer->tmppath;
|
||||||
|
}
|
||||||
|
Path p(path);
|
||||||
|
// Run dvi-viewer
|
||||||
|
string command = lyxrc->view_dvi_command + " " + paper;
|
||||||
bool ret = RunScript(buffer, false, command);
|
bool ret = RunScript(buffer, false, command);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1082,26 +1082,33 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
|
|
||||||
// Derive layout number from given argument (string)
|
// Derive layout number from given argument (string)
|
||||||
// and current buffer's textclass (number). */
|
// and current buffer's textclass (number). */
|
||||||
int layoutno =
|
LyXTextClassList::ClassList::size_type tclass =
|
||||||
textclasslist.NumberOfLayout(owner->
|
owner->view()->text->parameters->textclass;
|
||||||
view()->
|
pair <bool, int> layout =
|
||||||
text->parameters->
|
textclasslist.NumberOfLayout(tclass, argument);
|
||||||
textclass,
|
|
||||||
argument).second;
|
// If the entry is obsolete, use the new one instead.
|
||||||
|
if (layout.first) {
|
||||||
|
string obs = textclasslist.Style(tclass,layout.second)
|
||||||
|
.obsoleted_by();
|
||||||
|
if (!obs.empty())
|
||||||
|
layout =
|
||||||
|
textclasslist.NumberOfLayout(tclass, obs);
|
||||||
|
}
|
||||||
|
|
||||||
// see if we found the layout number:
|
// see if we found the layout number:
|
||||||
if (layoutno == -1) {
|
if (!layout.first) {
|
||||||
setErrorMessage(string(N_("Layout ")) + argument +
|
setErrorMessage(string(N_("Layout ")) + argument +
|
||||||
N_(" not known"));
|
N_(" not known"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_layout != layoutno) {
|
if (current_layout != layout.second) {
|
||||||
owner->view()->getScreen()->HideCursor();
|
owner->view()->getScreen()->HideCursor();
|
||||||
current_layout = layoutno;
|
current_layout = layout.second;
|
||||||
owner->view()->update(-2);
|
owner->view()->update(-2);
|
||||||
owner->view()->text->
|
owner->view()->text->
|
||||||
SetLayout(layoutno);
|
SetLayout(layout.second);
|
||||||
owner->getToolbar()->combox->
|
owner->getToolbar()->combox->
|
||||||
select(owner->view()->
|
select(owner->view()->
|
||||||
text->cursor.par->
|
text->cursor.par->
|
||||||
|
12
src/lyxrc.C
12
src/lyxrc.C
@ -113,6 +113,7 @@ enum LyXRCTags {
|
|||||||
RC_NUMLASTFILES,
|
RC_NUMLASTFILES,
|
||||||
RC_CHECKLASTFILES,
|
RC_CHECKLASTFILES,
|
||||||
RC_VIEWDVI_COMMAND,
|
RC_VIEWDVI_COMMAND,
|
||||||
|
RC_VIEWDVI_PAPEROPTION,
|
||||||
RC_DEFAULT_PAPERSIZE,
|
RC_DEFAULT_PAPERSIZE,
|
||||||
RC_PS_COMMAND,
|
RC_PS_COMMAND,
|
||||||
RC_VIEWPS_COMMAND,
|
RC_VIEWPS_COMMAND,
|
||||||
@ -236,6 +237,7 @@ static keyword_item lyxrcTags[] = {
|
|||||||
{ "\\use_personal_dictionary", RC_USE_PERS_DICT },
|
{ "\\use_personal_dictionary", RC_USE_PERS_DICT },
|
||||||
{ "\\use_tempdir", RC_USETEMPDIR },
|
{ "\\use_tempdir", RC_USETEMPDIR },
|
||||||
{ "\\view_dvi_command", RC_VIEWDVI_COMMAND },
|
{ "\\view_dvi_command", RC_VIEWDVI_COMMAND },
|
||||||
|
{ "\\view_dvi_paper_option", RC_VIEWDVI_PAPEROPTION },
|
||||||
{ "\\view_pdf_command", RC_VIEWPDF_COMMAND },
|
{ "\\view_pdf_command", RC_VIEWPDF_COMMAND },
|
||||||
{ "\\view_ps_command", RC_VIEWPS_COMMAND },
|
{ "\\view_ps_command", RC_VIEWPS_COMMAND },
|
||||||
{ "\\view_pspic_command", RC_VIEWPSPIC_COMMAND }
|
{ "\\view_pspic_command", RC_VIEWPSPIC_COMMAND }
|
||||||
@ -289,6 +291,7 @@ LyXRC::LyXRC()
|
|||||||
view_ps_command = "ghostview -swap";
|
view_ps_command = "ghostview -swap";
|
||||||
view_pspic_command = "ghostview";
|
view_pspic_command = "ghostview";
|
||||||
view_dvi_command = "xdvi";
|
view_dvi_command = "xdvi";
|
||||||
|
view_dvi_paper_option = "-paper";
|
||||||
view_pdf_command = "xpdf";
|
view_pdf_command = "xpdf";
|
||||||
default_papersize = BufferParams::PAPER_USLETTER;
|
default_papersize = BufferParams::PAPER_USLETTER;
|
||||||
custom_export_format = "ps";
|
custom_export_format = "ps";
|
||||||
@ -623,6 +626,13 @@ int LyXRC::read(string const & filename)
|
|||||||
view_dvi_command = lexrc.GetString();
|
view_dvi_command = lexrc.GetString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RC_VIEWDVI_PAPEROPTION:
|
||||||
|
if (lexrc.next())
|
||||||
|
view_dvi_paper_option = lexrc.GetString();
|
||||||
|
else
|
||||||
|
view_dvi_paper_option = "";
|
||||||
|
break;
|
||||||
|
|
||||||
case RC_VIEWPDF_COMMAND:
|
case RC_VIEWPDF_COMMAND:
|
||||||
if (lexrc.next())
|
if (lexrc.next())
|
||||||
view_pdf_command = lexrc.GetString();
|
view_pdf_command = lexrc.GetString();
|
||||||
@ -1097,6 +1107,8 @@ void LyXRC::output(ostream & os) const
|
|||||||
<< "\n";
|
<< "\n";
|
||||||
case RC_VIEWDVI_COMMAND:
|
case RC_VIEWDVI_COMMAND:
|
||||||
os << "\\view_dvi_command \"" << view_dvi_command << "\"\n";
|
os << "\\view_dvi_command \"" << view_dvi_command << "\"\n";
|
||||||
|
case RC_VIEWDVI_PAPEROPTION:
|
||||||
|
os << "\\view_dvi_paper_option \"" << view_dvi_paper_option << "\"\n";
|
||||||
case RC_VIEWPDF_COMMAND:
|
case RC_VIEWPDF_COMMAND:
|
||||||
os << "\\view_pdf_command \"" << view_pdf_command << "\"\n";
|
os << "\\view_pdf_command \"" << view_pdf_command << "\"\n";
|
||||||
case RC_DEFAULT_PAPERSIZE:
|
case RC_DEFAULT_PAPERSIZE:
|
||||||
|
@ -105,6 +105,8 @@ public:
|
|||||||
string view_pspic_command;
|
string view_pspic_command;
|
||||||
/// program for viewing dvi output (default "xdvi")
|
/// program for viewing dvi output (default "xdvi")
|
||||||
string view_dvi_command;
|
string view_dvi_command;
|
||||||
|
/// option for telling the dvi viewer about the paper size
|
||||||
|
string view_dvi_paper_option;
|
||||||
/// program for viewing pdf output (default "xpdf")
|
/// program for viewing pdf output (default "xpdf")
|
||||||
string view_pdf_command;
|
string view_pdf_command;
|
||||||
/// default paper size for local xdvi/dvips/ghostview/whatever
|
/// default paper size for local xdvi/dvips/ghostview/whatever
|
||||||
|
Loading…
Reference in New Issue
Block a user