Remove the prefence default_papersize

- This preference was used for specifying the papersize to xdvi, dvipdfm,
  dvips. However, I can't seem to see any effect on the result.

- The papersize should instead be defined in the document settings.

- The global papersize default was misused to also change the tex
  output by specifying the papersize as if it was specified in the
  document settings. This caused the same lyx document to be outputted
  differently on different pcs.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40028 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2011-10-27 11:48:16 +00:00
parent 2a9f282cc4
commit 269695aa5f
7 changed files with 17 additions and 217 deletions

View File

@ -25,6 +25,9 @@
# We must add the flag zipped=native to formats that
# were previously hardcoded in the C++ source: dia.
# Incremented to format 4, r40028 by vfr
# Remove support for default paper size.
import re
@ -118,6 +121,12 @@ def zipped_native(line):
return (True,
"\\Format %s \"%s,zipped=native\"" % (fmat, opts))
def remove_default_papersize(line):
if not line.startswith("\\default_papersize"):
return no_match
return (True, "")
########################
@ -131,4 +140,5 @@ conversions = [
]],
[ 2, []],
[ 3, [ zipped_native ]],
[ 4, [ remove_default_papersize ]],
]

View File

@ -1560,59 +1560,8 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
case PAPER_JISB6:
ods << ",b6j";
break;
default:
// default papersize ie PAPER_DEFAULT
switch (lyxrc.default_papersize) {
case PAPER_DEFAULT: // keep compiler happy
break;
case PAPER_USLETTER:
ods << ",letterpaper";
break;
case PAPER_USLEGAL:
ods << ",legalpaper";
break;
case PAPER_USEXECUTIVE:
ods << ",executivepaper";
break;
case PAPER_A3:
ods << ",a3paper";
break;
case PAPER_A4:
ods << ",a4paper";
break;
case PAPER_A5:
ods << ",a5paper";
break;
case PAPER_B5:
ods << ",b5paper";
break;
case PAPER_A0:
case PAPER_A1:
case PAPER_A2:
case PAPER_A6:
case PAPER_B0:
case PAPER_B1:
case PAPER_B2:
case PAPER_B3:
case PAPER_B4:
case PAPER_B6:
case PAPER_C0:
case PAPER_C1:
case PAPER_C2:
case PAPER_C3:
case PAPER_C4:
case PAPER_C5:
case PAPER_C6:
case PAPER_JISB0:
case PAPER_JISB1:
case PAPER_JISB2:
case PAPER_JISB3:
case PAPER_JISB4:
case PAPER_JISB5:
case PAPER_JISB6:
case PAPER_CUSTOM:
break;
}
case PAPER_DEFAULT:
break;
}
docstring const g_options = trim(ods.str(), ",");
os << "\\usepackage";
@ -2405,11 +2354,7 @@ void BufferParams::readIncludeonly(Lexer & lex)
string BufferParams::paperSizeName(PapersizePurpose purpose) const
{
char real_papersize = papersize;
if (real_papersize == PAPER_DEFAULT)
real_papersize = lyxrc.default_papersize;
switch (real_papersize) {
switch (papersize) {
case PAPER_DEFAULT:
// could be anything, so don't guess
return string();

View File

@ -320,20 +320,8 @@ int Length::inBP() const
Length::UNIT Length::defaultUnit()
{
// FIXME user a proper pref, since we should get rid of
// default_papersize in lyxrc.
UNIT u = Length::CM;
switch (lyxrc.default_papersize) {
case PAPER_USLETTER:
case PAPER_USLEGAL:
case PAPER_USEXECUTIVE:
u = Length::IN;
break;
default:
break;
}
return u;
// FIXME: use a preference
return Length::CM;
}

View File

@ -55,7 +55,7 @@ namespace os = support::os;
namespace {
static unsigned int const LYXRC_FILEFORMAT = 3;
static unsigned int const LYXRC_FILEFORMAT = 4; // vfr: remove default paper size
// when adding something to this array keep it sorted!
LexerKeyword lyxrcTags[] = {
@ -91,7 +91,6 @@ LexerKeyword lyxrcTags[] = {
{ "\\def_file", LyXRC::RC_DEFFILE },
{ "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
{ "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
{ "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
{ "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
{ "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
{ "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
@ -250,7 +249,6 @@ void LyXRC::setDefaults()
print_paper_dimension_flag = "-T";
document_path.erase();
view_dvi_paper_option.erase();
default_papersize = PAPER_DEFAULT;
default_view_format = "pdf2";
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
bibtex_command = "bibtex";
@ -625,28 +623,6 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
lexrc >> print_paper_flag;
break;
case RC_DEFAULT_PAPERSIZE:
if (lexrc.next()) {
string const size = ascii_lowercase(lexrc.getString());
if (size == "usletter")
default_papersize = PAPER_USLETTER;
else if (size == "legal")
default_papersize = PAPER_USLEGAL;
else if (size == "executive")
default_papersize = PAPER_USEXECUTIVE;
else if (size == "a3")
default_papersize = PAPER_A3;
else if (size == "a4")
default_papersize = PAPER_A4;
else if (size == "a5")
default_papersize = PAPER_A5;
else if (size == "b5")
default_papersize = PAPER_B5;
else if (size == "default")
default_papersize = PAPER_DEFAULT;
}
break;
case RC_VIEWDVI_PAPEROPTION:
if (lexrc.next())
view_dvi_paper_option = lexrc.getString();
@ -1493,58 +1469,6 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
}
if (tag != RC_LAST)
break;
case RC_DEFAULT_PAPERSIZE:
if (ignore_system_lyxrc ||
default_papersize != system_lyxrc.default_papersize) {
os << "# The default papersize to use.\n"
<< "\\default_papersize \"";
switch (default_papersize) {
case PAPER_DEFAULT:
os << "default"; break;
case PAPER_USLETTER:
os << "usletter"; break;
case PAPER_USLEGAL:
os << "legal"; break;
case PAPER_USEXECUTIVE:
os << "executive"; break;
case PAPER_A3:
os << "a3"; break;
case PAPER_A4:
os << "a4"; break;
case PAPER_A5:
os << "a5"; break;
case PAPER_B5:
os << "b5"; break;
case PAPER_CUSTOM:
case PAPER_A0:
case PAPER_A1:
case PAPER_A2:
case PAPER_A6:
case PAPER_B0:
case PAPER_B1:
case PAPER_B2:
case PAPER_B3:
case PAPER_B4:
case PAPER_B6:
case PAPER_C0:
case PAPER_C1:
case PAPER_C2:
case PAPER_C3:
case PAPER_C4:
case PAPER_C5:
case PAPER_C6:
case PAPER_JISB0:
case PAPER_JISB1:
case PAPER_JISB2:
case PAPER_JISB3:
case PAPER_JISB4:
case PAPER_JISB5:
case PAPER_JISB6: break;
}
os << "\"\n";
}
if (tag != RC_LAST)
break;
case RC_CHKTEX_COMMAND:
if (ignore_system_lyxrc ||
chktex_command != system_lyxrc.chktex_command) {
@ -2946,7 +2870,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
case LyXRC::RC_DATE_INSERT_FORMAT:
case LyXRC::RC_DEFAULT_LANGUAGE:
case LyXRC::RC_GUI_LANGUAGE:
case LyXRC::RC_DEFAULT_PAPERSIZE:
case LyXRC::RC_DEFAULT_VIEW_FORMAT:
case LyXRC::RC_DEFFILE:
case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
@ -3184,10 +3107,6 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("New documents will be assigned this language.");
break;
case RC_DEFAULT_PAPERSIZE:
str = _("Specify the default paper size.");
break;
case RC_DIALOGS_ICONIFY_WITH_MAIN:
str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
break;

View File

@ -70,7 +70,6 @@ public:
RC_DEFAULT_DECIMAL_POINT,
RC_DEFAULT_LANGUAGE,
RC_DEFAULT_VIEW_FORMAT,
RC_DEFAULT_PAPERSIZE,
RC_DEFFILE,
RC_DIALOGS_ICONIFY_WITH_MAIN,
RC_DISPLAY_GRAPHICS,
@ -271,7 +270,6 @@ public:
/// option for telling the dvi viewer about the paper size
std::string view_dvi_paper_option;
/// default paper size for local xdvi/dvips/ghostview/whatever
PAPER_SIZE default_papersize;
/// command to run chktex incl. options
std::string chktex_command;
/// all available commands to run bibtex incl. options

View File

@ -728,8 +728,6 @@ PrefLatex::PrefLatex(GuiPreferences * form)
this, SIGNAL(changed()));
connect(latexDviPaperED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(latexPaperSizeCO, SIGNAL(activated(int)),
this, SIGNAL(changed()));
connect(latexNomenclED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
@ -835,8 +833,6 @@ void PrefLatex::apply(LyXRC & rc) const
rc.nomencl_command = fromqstr(latexNomenclED->text());
rc.auto_reset_options = latexAutoresetCB->isChecked();
rc.view_dvi_paper_option = fromqstr(latexDviPaperED->text());
rc.default_papersize =
form_->toPaperSize(latexPaperSizeCO->currentIndex());
#if defined(__CYGWIN__) || defined(_WIN32)
rc.windows_style_tex_paths = pathCB->isChecked();
#endif
@ -913,8 +909,6 @@ void PrefLatex::update(LyXRC const & rc)
latexNomenclED->setText(toqstr(rc.nomencl_command));
latexAutoresetCB->setChecked(rc.auto_reset_options);
latexDviPaperED->setText(toqstr(rc.view_dvi_paper_option));
latexPaperSizeCO->setCurrentIndex(
form_->fromPaperSize(rc.default_papersize));
#if defined(__CYGWIN__) || defined(_WIN32)
pathCB->setChecked(rc.windows_style_tex_paths);
#endif

View File

@ -36,60 +36,6 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="latexPaperSizeLA">
<property name="text">
<string>Default paper si&amp;ze:</string>
</property>
<property name="buddy">
<cstring>latexPaperSizeCO</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="latexPaperSizeCO">
<item>
<property name="text">
<string>Default</string>
</property>
</item>
<item>
<property name="text">
<string>US letter</string>
</property>
</item>
<item>
<property name="text">
<string>US legal</string>
</property>
</item>
<item>
<property name="text">
<string>US executive</string>
</property>
</item>
<item>
<property name="text">
<string>A3</string>
</property>
</item>
<item>
<property name="text">
<string>A4</string>
</property>
</item>
<item>
<property name="text">
<string>A5</string>
</property>
</item>
<item>
<property name="text">
<string>B5</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="latexDviPaperLA">
<property name="text">
<string>&amp;DVI viewer paper size options:</string>
@ -99,7 +45,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="1">
<widget class="QLineEdit" name="latexDviPaperED">
<property name="toolTip">
<string>Optional paper size flag (-paper) for some DVI viewers</string>