mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix bug 886 and others not reported related with the document paper size.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10253 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
868ab452a5
commit
a56bd0b8b1
@ -1,3 +1,12 @@
|
||||
2005-07-16 José Matos <jamatos@fc.up.pt>
|
||||
|
||||
* buffer.C:
|
||||
* converter.C:
|
||||
* lyxrc.C:
|
||||
* paper.h:
|
||||
* bufferparams.[Ch] (setPaperStuff): remove setPaperStuff and use a
|
||||
single papersize variable.
|
||||
|
||||
2005-07-16 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* text3.C (dispatch): honor boundary when checking if a cursor
|
||||
|
@ -684,7 +684,6 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, pit_type const pit)
|
||||
//lyxerr << "removing " << MacroTable::localMacros().size()
|
||||
// << " temporary macro entries" << endl;
|
||||
//MacroTable::localMacros().clear();
|
||||
params().setPaperStuff();
|
||||
|
||||
pimpl_->file_fully_loaded = true;
|
||||
return true;
|
||||
|
@ -125,22 +125,22 @@ QuotesTimesTranslator const & quotestimestranslator()
|
||||
|
||||
|
||||
// Paper size
|
||||
typedef Translator<std::string, VMARGIN_PAPER_TYPE> PaperSizeTranslator;
|
||||
typedef Translator<std::string, PAPER_SIZE> PaperSizeTranslator;
|
||||
|
||||
|
||||
PaperSizeTranslator const init_papersizetranslator()
|
||||
{
|
||||
PaperSizeTranslator translator(string_papersize[0], VM_PAPER_DEFAULT);
|
||||
translator.addPair(string_papersize[1], VM_PAPER_CUSTOM);
|
||||
translator.addPair(string_papersize[2], VM_PAPER_USLETTER);
|
||||
translator.addPair(string_papersize[3], VM_PAPER_USLEGAL);
|
||||
translator.addPair(string_papersize[4], VM_PAPER_USEXECUTIVE);
|
||||
translator.addPair(string_papersize[5], VM_PAPER_A3);
|
||||
translator.addPair(string_papersize[6], VM_PAPER_A4);
|
||||
translator.addPair(string_papersize[7], VM_PAPER_A5);
|
||||
translator.addPair(string_papersize[8], VM_PAPER_B3);
|
||||
translator.addPair(string_papersize[9], VM_PAPER_B4);
|
||||
translator.addPair(string_papersize[10], VM_PAPER_B5);
|
||||
PaperSizeTranslator translator(string_papersize[0], PAPER_DEFAULT);
|
||||
translator.addPair(string_papersize[1], PAPER_CUSTOM);
|
||||
translator.addPair(string_papersize[2], PAPER_USLETTER);
|
||||
translator.addPair(string_papersize[3], PAPER_USLEGAL);
|
||||
translator.addPair(string_papersize[4], PAPER_USEXECUTIVE);
|
||||
translator.addPair(string_papersize[5], PAPER_A3);
|
||||
translator.addPair(string_papersize[6], PAPER_A4);
|
||||
translator.addPair(string_papersize[7], PAPER_A5);
|
||||
translator.addPair(string_papersize[8], PAPER_B3);
|
||||
translator.addPair(string_papersize[9], PAPER_B4);
|
||||
translator.addPair(string_papersize[10], PAPER_B5);
|
||||
return translator;
|
||||
}
|
||||
|
||||
@ -333,7 +333,6 @@ BufferParams::BufferParams()
|
||||
|
||||
/* PaperLayout */
|
||||
papersize = PAPER_DEFAULT;
|
||||
papersize2 = VM_PAPER_DEFAULT; /* DEFAULT */
|
||||
paperpackage = PACKAGE_NONE;
|
||||
orientation = ORIENTATION_PORTRAIT;
|
||||
use_geometry = false;
|
||||
@ -490,7 +489,7 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
|
||||
} else if (token == "\\papersize") {
|
||||
string ppsize;
|
||||
lex >> ppsize;
|
||||
papersize2 = papersizetranslator().find(ppsize);
|
||||
papersize = papersizetranslator().find(ppsize);
|
||||
} else if (token == "\\paperpackage") {
|
||||
string ppackage;
|
||||
lex >> ppackage;
|
||||
@ -639,7 +638,7 @@ void BufferParams::writeFile(ostream & os) const
|
||||
|
||||
spacing().writeFile(os);
|
||||
|
||||
os << "\\papersize " << string_papersize[papersize2]
|
||||
os << "\\papersize " << string_papersize[papersize]
|
||||
<< "\n\\paperpackage " << string_paperpackages[paperpackage]
|
||||
<< "\n\\use_geometry " << convert<string>(use_geometry)
|
||||
<< "\n\\use_amsmath " << use_amsmath
|
||||
@ -741,32 +740,37 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
|
||||
clsoptions << fontsize << "pt,";
|
||||
}
|
||||
|
||||
// custom, A3, B3 and B4 paper sizes need geometry
|
||||
bool nonstandard_papersize = (papersize == PAPER_B3) ||
|
||||
(papersize == PAPER_B4) ||
|
||||
(papersize == PAPER_A3) ||
|
||||
(papersize == PAPER_CUSTOM);
|
||||
|
||||
if (!use_geometry &&
|
||||
(paperpackage == PACKAGE_NONE)) {
|
||||
if (!use_geometry && (paperpackage == PACKAGE_NONE)) {
|
||||
switch (papersize) {
|
||||
case PAPER_A3PAPER:
|
||||
clsoptions << "a3paper,";
|
||||
break;
|
||||
case PAPER_A4PAPER:
|
||||
case PAPER_A4:
|
||||
clsoptions << "a4paper,";
|
||||
break;
|
||||
case PAPER_USLETTER:
|
||||
clsoptions << "letterpaper,";
|
||||
break;
|
||||
case PAPER_A5PAPER:
|
||||
case PAPER_A5:
|
||||
clsoptions << "a5paper,";
|
||||
break;
|
||||
case PAPER_B5PAPER:
|
||||
case PAPER_B5:
|
||||
clsoptions << "b5paper,";
|
||||
break;
|
||||
case PAPER_EXECUTIVEPAPER:
|
||||
case PAPER_USEXECUTIVE:
|
||||
clsoptions << "executivepaper,";
|
||||
break;
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_USLEGAL:
|
||||
clsoptions << "legalpaper,";
|
||||
break;
|
||||
case PAPER_DEFAULT:
|
||||
case PAPER_A3:
|
||||
case PAPER_B3:
|
||||
case PAPER_B4:
|
||||
case PAPER_CUSTOM:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -882,14 +886,15 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (use_geometry) {
|
||||
|
||||
if (use_geometry || nonstandard_papersize) {
|
||||
os << "\\usepackage{geometry}\n";
|
||||
texrow.newline();
|
||||
os << "\\geometry{verbose";
|
||||
if (orientation == ORIENTATION_LANDSCAPE)
|
||||
os << ",landscape";
|
||||
switch (papersize2) {
|
||||
case VM_PAPER_CUSTOM:
|
||||
switch (papersize) {
|
||||
case PAPER_CUSTOM:
|
||||
if (!paperwidth.empty())
|
||||
os << ",paperwidth="
|
||||
<< paperwidth;
|
||||
@ -897,58 +902,62 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
|
||||
os << ",paperheight="
|
||||
<< paperheight;
|
||||
break;
|
||||
case VM_PAPER_USLETTER:
|
||||
case PAPER_USLETTER:
|
||||
os << ",letterpaper";
|
||||
break;
|
||||
case VM_PAPER_USLEGAL:
|
||||
case PAPER_USLEGAL:
|
||||
os << ",legalpaper";
|
||||
break;
|
||||
case VM_PAPER_USEXECUTIVE:
|
||||
case PAPER_USEXECUTIVE:
|
||||
os << ",executivepaper";
|
||||
break;
|
||||
case VM_PAPER_A3:
|
||||
case PAPER_A3:
|
||||
os << ",a3paper";
|
||||
break;
|
||||
case VM_PAPER_A4:
|
||||
case PAPER_A4:
|
||||
os << ",a4paper";
|
||||
break;
|
||||
case VM_PAPER_A5:
|
||||
case PAPER_A5:
|
||||
os << ",a5paper";
|
||||
break;
|
||||
case VM_PAPER_B3:
|
||||
case PAPER_B3:
|
||||
os << ",b3paper";
|
||||
break;
|
||||
case VM_PAPER_B4:
|
||||
case PAPER_B4:
|
||||
os << ",b4paper";
|
||||
break;
|
||||
case VM_PAPER_B5:
|
||||
case PAPER_B5:
|
||||
os << ",b5paper";
|
||||
break;
|
||||
default:
|
||||
// default papersize ie VM_PAPER_DEFAULT
|
||||
// default papersize ie PAPER_DEFAULT
|
||||
switch (lyxrc.default_papersize) {
|
||||
case PAPER_DEFAULT: // keep compiler happy
|
||||
case PAPER_USLETTER:
|
||||
os << ",letterpaper";
|
||||
break;
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_USLEGAL:
|
||||
os << ",legalpaper";
|
||||
break;
|
||||
case PAPER_EXECUTIVEPAPER:
|
||||
case PAPER_USEXECUTIVE:
|
||||
os << ",executivepaper";
|
||||
break;
|
||||
case PAPER_A3PAPER:
|
||||
case PAPER_A3:
|
||||
os << ",a3paper";
|
||||
break;
|
||||
case PAPER_A4PAPER:
|
||||
case PAPER_A4:
|
||||
os << ",a4paper";
|
||||
break;
|
||||
case PAPER_A5PAPER:
|
||||
case PAPER_A5:
|
||||
os << ",a5paper";
|
||||
break;
|
||||
case PAPER_B5PAPER:
|
||||
case PAPER_B5:
|
||||
os << ",b5paper";
|
||||
break;
|
||||
case PAPER_B3:
|
||||
case PAPER_B4:
|
||||
case PAPER_CUSTOM:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!topmargin.empty())
|
||||
@ -1124,33 +1133,6 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
|
||||
}
|
||||
|
||||
|
||||
void BufferParams::setPaperStuff()
|
||||
{
|
||||
papersize = PAPER_DEFAULT;
|
||||
char const c1 = paperpackage;
|
||||
if (c1 == PACKAGE_NONE) {
|
||||
char const c2 = papersize2;
|
||||
if (c2 == VM_PAPER_USLETTER)
|
||||
papersize = PAPER_USLETTER;
|
||||
else if (c2 == VM_PAPER_USLEGAL)
|
||||
papersize = PAPER_LEGALPAPER;
|
||||
else if (c2 == VM_PAPER_USEXECUTIVE)
|
||||
papersize = PAPER_EXECUTIVEPAPER;
|
||||
else if (c2 == VM_PAPER_A3)
|
||||
papersize = PAPER_A3PAPER;
|
||||
else if (c2 == VM_PAPER_A4)
|
||||
papersize = PAPER_A4PAPER;
|
||||
else if (c2 == VM_PAPER_A5)
|
||||
papersize = PAPER_A5PAPER;
|
||||
else if ((c2 == VM_PAPER_B3) || (c2 == VM_PAPER_B4) ||
|
||||
(c2 == VM_PAPER_B5))
|
||||
papersize = PAPER_B5PAPER;
|
||||
} else if ((c1 == PACKAGE_A4) || (c1 == PACKAGE_A4WIDE) ||
|
||||
(c1 == PACKAGE_WIDEMARGINSA4))
|
||||
papersize = PAPER_A4PAPER;
|
||||
}
|
||||
|
||||
|
||||
void BufferParams::useClassDefaults()
|
||||
{
|
||||
LyXTextClass const & tclass = textclasslist[textclass];
|
||||
@ -1273,17 +1255,17 @@ string const BufferParams::paperSizeName() const
|
||||
real_papersize = lyxrc.default_papersize;
|
||||
|
||||
switch (real_papersize) {
|
||||
case PAPER_A3PAPER:
|
||||
case PAPER_A3:
|
||||
return "a3";
|
||||
case PAPER_A4PAPER:
|
||||
case PAPER_A4:
|
||||
return "a4";
|
||||
case PAPER_A5PAPER:
|
||||
case PAPER_A5:
|
||||
return "a5";
|
||||
case PAPER_B5PAPER:
|
||||
case PAPER_B5:
|
||||
return "b5";
|
||||
case PAPER_EXECUTIVEPAPER:
|
||||
case PAPER_USEXECUTIVE:
|
||||
return "foolscap";
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_USLEGAL:
|
||||
return "legal";
|
||||
case PAPER_USLETTER:
|
||||
default:
|
||||
@ -1297,7 +1279,7 @@ string const BufferParams::dvips_options() const
|
||||
string result;
|
||||
|
||||
if (use_geometry
|
||||
&& papersize2 == VM_PAPER_CUSTOM
|
||||
&& papersize == PAPER_CUSTOM
|
||||
&& !lyxrc.print_paper_dimension_flag.empty()
|
||||
&& !paperwidth.empty()
|
||||
&& !paperheight.empty()) {
|
||||
@ -1317,7 +1299,7 @@ string const BufferParams::dvips_options() const
|
||||
}
|
||||
}
|
||||
if (orientation == ORIENTATION_LANDSCAPE &&
|
||||
papersize2 != VM_PAPER_CUSTOM)
|
||||
papersize != PAPER_CUSTOM)
|
||||
result += ' ' + lyxrc.print_landscape_flag;
|
||||
return result;
|
||||
}
|
||||
|
@ -88,9 +88,6 @@ public:
|
||||
*/
|
||||
bool writeLaTeX(std::ostream &, LaTeXFeatures &, TexRow &) const;
|
||||
|
||||
///
|
||||
void setPaperStuff();
|
||||
|
||||
///
|
||||
void useClassDefaults();
|
||||
|
||||
@ -119,15 +116,13 @@ public:
|
||||
LyXTextClass const & getLyXTextClass() const;
|
||||
|
||||
/* this are for the PaperLayout */
|
||||
/// the general papersize (papersize2 or paperpackage
|
||||
/// the papersize
|
||||
PAPER_SIZE papersize;
|
||||
/// the selected Geometry papersize
|
||||
VMARGIN_PAPER_TYPE papersize2;
|
||||
/// a special paperpackage .sty-file
|
||||
PAPER_PACKAGES paperpackage;
|
||||
///
|
||||
PAPER_ORIENTATION orientation;
|
||||
///
|
||||
/// use custom margins
|
||||
bool use_geometry;
|
||||
///
|
||||
std::string paperwidth;
|
||||
|
@ -77,7 +77,7 @@ string const dvipdfm_options(BufferParams const & bp)
|
||||
{
|
||||
string result;
|
||||
|
||||
if (bp.papersize2 != VM_PAPER_CUSTOM) {
|
||||
if (bp.papersize != PAPER_CUSTOM) {
|
||||
string const paper_size = bp.paperSizeName();
|
||||
if (paper_size != "b5" && paper_size != "foolscap")
|
||||
result = "-p "+ paper_size;
|
||||
|
@ -1,3 +1,7 @@
|
||||
2005-07-16 José Matos <jamatos@fc.up.pt>
|
||||
|
||||
* ControlTabular.C (set): use a single papersize variable.
|
||||
|
||||
2005-07-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* ControlChanges.C (getChangeDate): use localized date (from
|
||||
|
@ -79,7 +79,7 @@ void ControlTabular::set(LyXTabular::Feature f, string const & arg)
|
||||
|
||||
bool ControlTabular::useMetricUnits() const
|
||||
{
|
||||
return lyxrc.default_papersize > PAPER_EXECUTIVEPAPER;
|
||||
return lyxrc.default_papersize > PAPER_USEXECUTIVE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
2005-07-16 José Matos <jamatos@fc.up.pt>
|
||||
|
||||
* ghelpers.C:
|
||||
* GDocument.C: remove setPaperStuff and use a
|
||||
single papersize variable.
|
||||
|
||||
2005-07-15 José Matos <jamatos@lyx.org>
|
||||
|
||||
* .cvsignore: add pch.h.gch and pch.h.gch.dep.
|
||||
|
@ -322,7 +322,7 @@ void GDocument::update()
|
||||
// *** End "Document" Page ***
|
||||
|
||||
// *** Begin "Page" Page ***
|
||||
int const psize = params.papersize2;
|
||||
int const psize = params.papersize;
|
||||
pagesizecombo_.set_active(psize);
|
||||
|
||||
setWidgetsFromLength(
|
||||
@ -477,7 +477,7 @@ void GDocument::apply()
|
||||
// *** End "Document" Page ***
|
||||
|
||||
// *** Begin "Page" Page ***
|
||||
params.papersize2 = VMARGIN_PAPER_TYPE(
|
||||
params.papersize = PAPER_SIZE(
|
||||
pagesizecombo_.get_active_row_number());
|
||||
|
||||
params.paperwidth = getLengthFromWidgets(
|
||||
@ -516,8 +516,6 @@ void GDocument::apply()
|
||||
}
|
||||
params.paperpackage = PAPER_PACKAGES(margin);
|
||||
|
||||
params.setPaperStuff();
|
||||
|
||||
params.topmargin = getLengthFromWidgets(
|
||||
*(mtopspin_->get_adjustment()),
|
||||
mtopunitcombo_);
|
||||
@ -667,7 +665,7 @@ void GDocument::populateMargins()
|
||||
papersize = 0;
|
||||
|
||||
bool const a4size = (papersize == 6 || papersize == 0
|
||||
&& lyxrc.default_papersize == PAPER_A4PAPER);
|
||||
&& lyxrc.default_papersize == PAPER_A4);
|
||||
if (a4size && portraitradio_->get_active()) {
|
||||
marginscombo_.append_text(_("Small margins"));
|
||||
marginscombo_.append_text(_("Very small margins"));
|
||||
|
@ -124,12 +124,12 @@ string const getDefaultUnit()
|
||||
switch (lyxrc.default_papersize) {
|
||||
case PAPER_DEFAULT: return "cm";
|
||||
case PAPER_USLETTER:
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_EXECUTIVEPAPER: return "in"; break;
|
||||
case PAPER_A3PAPER:
|
||||
case PAPER_A4PAPER:
|
||||
case PAPER_A5PAPER:
|
||||
case PAPER_B5PAPER: return "cm"; break;
|
||||
case PAPER_USLEGAL:
|
||||
case PAPER_USEXECUTIVE: return "in"; break;
|
||||
case PAPER_A3:
|
||||
case PAPER_A4:
|
||||
case PAPER_A5:
|
||||
case PAPER_B5: return "cm"; break;
|
||||
}
|
||||
// shut up compiler
|
||||
return "cm";
|
||||
|
@ -1,3 +1,11 @@
|
||||
2005-07-16 José Matos <jamatos@fc.up.pt>
|
||||
|
||||
* QDocumentDialog.C:
|
||||
* QExternal.C:
|
||||
* QGraphics.C:
|
||||
* QDocument.C: remove setPaperStuff and use a
|
||||
single papersize variable.
|
||||
|
||||
2005-07-16 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* qfont_loader.C (addToFontPath): remove.
|
||||
|
@ -362,7 +362,7 @@ void QDocument::apply()
|
||||
params.float_placement = dialog_->floatModule->get();
|
||||
|
||||
// paper
|
||||
params.papersize2 = VMARGIN_PAPER_TYPE(
|
||||
params.papersize = PAPER_SIZE(
|
||||
dialog_->pageLayoutModule->papersizeCO->currentItem());
|
||||
|
||||
// custom, A3, B3 and B4 paper sizes need geometry
|
||||
@ -396,10 +396,6 @@ void QDocument::apply()
|
||||
}
|
||||
params.paperpackage = PAPER_PACKAGES(margin);
|
||||
|
||||
// set params.papersize from params.papersize2
|
||||
// and params.paperpackage
|
||||
params.setPaperStuff();
|
||||
|
||||
MarginsModuleBase const * m(dialog_->marginsModule);
|
||||
|
||||
params.leftmargin = widgetsToLength(m->innerLE, m->innerUnit);
|
||||
@ -453,17 +449,21 @@ void QDocument::update_contents()
|
||||
case PAPER_DEFAULT: break;
|
||||
|
||||
case PAPER_USLETTER:
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_EXECUTIVEPAPER:
|
||||
case PAPER_USLEGAL:
|
||||
case PAPER_USEXECUTIVE:
|
||||
defaultUnit = LyXLength::IN;
|
||||
break;
|
||||
|
||||
case PAPER_A3PAPER:
|
||||
case PAPER_A4PAPER:
|
||||
case PAPER_A5PAPER:
|
||||
case PAPER_B5PAPER:
|
||||
case PAPER_A3:
|
||||
case PAPER_A4:
|
||||
case PAPER_A5:
|
||||
case PAPER_B3:
|
||||
case PAPER_B4:
|
||||
case PAPER_B5:
|
||||
defaultUnit = LyXLength::CM;
|
||||
break;
|
||||
case PAPER_CUSTOM:
|
||||
break;
|
||||
}
|
||||
|
||||
// preamble
|
||||
@ -628,7 +628,7 @@ void QDocument::update_contents()
|
||||
dialog_->floatModule->set(params.float_placement);
|
||||
|
||||
// paper
|
||||
int const psize = params.papersize2;
|
||||
int const psize = params.papersize;
|
||||
dialog_->pageLayoutModule->papersizeCO->setCurrentItem(psize);
|
||||
dialog_->setMargins(psize);
|
||||
dialog_->setCustomPapersize(psize);
|
||||
|
@ -273,7 +273,7 @@ void QDocumentDialog::setMargins(int papersize)
|
||||
marginsModule->marginCO->insertItem(qt_("Default"));
|
||||
marginsModule->marginCO->insertItem(qt_("Custom"));
|
||||
bool a4size = (papersize == 6 || papersize == 0
|
||||
&& lyxrc.default_papersize == PAPER_A4PAPER);
|
||||
&& lyxrc.default_papersize == PAPER_A4);
|
||||
if (a4size && pageLayoutModule->portraitRB->isChecked()) {
|
||||
marginsModule->marginCO->insertItem(qt_("Small margins"));
|
||||
marginsModule->marginCO->insertItem(qt_("Very small margins"));
|
||||
|
@ -60,8 +60,8 @@ LyXLength::UNIT defaultUnit()
|
||||
LyXLength::UNIT default_unit = LyXLength::CM;
|
||||
switch (lyxrc.default_papersize) {
|
||||
case PAPER_USLETTER:
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_EXECUTIVEPAPER:
|
||||
case PAPER_USLEGAL:
|
||||
case PAPER_USEXECUTIVE:
|
||||
default_unit = LyXLength::IN;
|
||||
break;
|
||||
default:
|
||||
|
@ -159,15 +159,15 @@ void QGraphics::update_contents()
|
||||
case PAPER_DEFAULT: break;
|
||||
|
||||
case PAPER_USLETTER:
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_EXECUTIVEPAPER:
|
||||
case PAPER_USLEGAL:
|
||||
case PAPER_USEXECUTIVE:
|
||||
unitDefault = LyXLength::IN;
|
||||
break;
|
||||
|
||||
case PAPER_A3PAPER:
|
||||
case PAPER_A4PAPER:
|
||||
case PAPER_A5PAPER:
|
||||
case PAPER_B5PAPER:
|
||||
case PAPER_A3:
|
||||
case PAPER_A4:
|
||||
case PAPER_A5:
|
||||
case PAPER_B5:
|
||||
unitDefault = LyXLength::CM;
|
||||
break;
|
||||
}
|
||||
|
@ -1,3 +1,12 @@
|
||||
2005-07-16 José Matos <jamatos@fc.up.pt>
|
||||
|
||||
* FormParagraphs.C:
|
||||
* FormVSpace.C:
|
||||
* FormsExternal.C:
|
||||
* FormGraphics.C:
|
||||
* FormDocument.C: remove setPaperStuff and use a
|
||||
single papersize variable.
|
||||
|
||||
2005-07-16 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* FormPreferences.h: remove a reLyX reference
|
||||
|
@ -522,7 +522,7 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
|
||||
// Default unit choice is cm if metric, inches if US paper.
|
||||
// If papersize is default, check the lyxrc-settings
|
||||
int const paperchoice = fl_get_choice(paper_->choice_papersize);
|
||||
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|
||||
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_USEXECUTIVE)
|
||||
|| paperchoice == 2 || paperchoice > 5;
|
||||
string const default_unit = metric ? "cm" : "in";
|
||||
if (getString(class_->input_skip).empty())
|
||||
@ -592,7 +592,7 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
|
||||
|
||||
// Default unit choice is cm if metric, inches if US paper.
|
||||
// If papersize is default, use the lyxrc-settings
|
||||
bool const metric = (defsize && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|
||||
bool const metric = (defsize && lyxrc.default_papersize > PAPER_USEXECUTIVE)
|
||||
|| paperchoice == 2 || paperchoice > 5;
|
||||
string const default_unit = metric ? "cm" : "in";
|
||||
if (getString(paper_->input_custom_width).empty())
|
||||
@ -674,7 +674,7 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long)
|
||||
// either default papersize (preferences) or document
|
||||
// papersize has to be A4
|
||||
bool const enable = ( fl_get_choice(paper_->choice_papersize) == 1
|
||||
&& lyxrc.default_papersize == PAPER_A4PAPER )
|
||||
&& lyxrc.default_papersize == PAPER_A4)
|
||||
|| fl_get_choice(paper_->choice_papersize) == 7;
|
||||
if (!enable)
|
||||
fl_set_choice(paper_->choice_paperpackage,
|
||||
@ -917,14 +917,11 @@ bool FormDocument::class_apply(BufferParams ¶ms)
|
||||
|
||||
void FormDocument::paper_apply(BufferParams & params)
|
||||
{
|
||||
params.papersize2 = VMARGIN_PAPER_TYPE(fl_get_choice(paper_->choice_papersize) - 1);
|
||||
params.papersize = PAPER_SIZE(fl_get_choice(paper_->choice_papersize) - 1);
|
||||
|
||||
params.paperpackage =
|
||||
PAPER_PACKAGES(fl_get_choice(paper_->choice_paperpackage) - 1);
|
||||
|
||||
// set params.papersize from params.papersize2 and params.paperpackage
|
||||
params.setPaperStuff();
|
||||
|
||||
params.use_geometry = fl_get_button(paper_->check_use_geometry);
|
||||
|
||||
if (fl_get_button(paper_->radio_landscape))
|
||||
@ -1128,7 +1125,7 @@ void FormDocument::class_update(BufferParams const & params)
|
||||
bool const length_input = pos == 4;
|
||||
if (length_input) {
|
||||
int const paperchoice = fl_get_choice(paper_->choice_papersize);
|
||||
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|
||||
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_USEXECUTIVE)
|
||||
|| paperchoice == 2 || paperchoice > 5;
|
||||
string const default_unit = metric ? "cm" : "in";
|
||||
string const length = params.getDefSkip().asLyXCommand();
|
||||
@ -1233,7 +1230,7 @@ void FormDocument::paper_update(BufferParams const & params)
|
||||
if (!paper_.get())
|
||||
return;
|
||||
|
||||
fl_set_choice(paper_->choice_papersize, params.papersize2 + 1);
|
||||
fl_set_choice(paper_->choice_papersize, params.papersize + 1);
|
||||
fl_set_choice(paper_->choice_paperpackage, params.paperpackage + 1);
|
||||
fl_set_button(paper_->check_use_geometry, params.use_geometry);
|
||||
|
||||
@ -1254,11 +1251,11 @@ void FormDocument::paper_update(BufferParams const & params)
|
||||
//either default papersize (preferences)
|
||||
//or document papersize has to be A4
|
||||
(paperchoice == 7
|
||||
|| paperchoice == 1 && lyxrc.default_papersize == PAPER_A4PAPER)
|
||||
|| paperchoice == 1 && lyxrc.default_papersize == PAPER_A4)
|
||||
&& fl_get_button(paper_->radio_portrait));
|
||||
|
||||
// Default unit choice is cm if metric, inches if US paper.
|
||||
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|
||||
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_USEXECUTIVE)
|
||||
|| paperchoice == 2 || paperchoice > 5;
|
||||
string const default_unit = metric ? "cm" : "in";
|
||||
updateWidgetsFromLengthString(paper_->input_custom_width,
|
||||
|
@ -59,8 +59,8 @@ LyXLength::UNIT defaultUnit()
|
||||
LyXLength::UNIT default_unit = LyXLength::CM;
|
||||
switch (lyxrc.default_papersize) {
|
||||
case PAPER_USLETTER:
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_EXECUTIVEPAPER:
|
||||
case PAPER_USLEGAL:
|
||||
case PAPER_USEXECUTIVE:
|
||||
default_unit = LyXLength::IN;
|
||||
break;
|
||||
default:
|
||||
|
@ -288,12 +288,12 @@ void FormGraphics::build()
|
||||
switch (lyxrc.default_papersize) {
|
||||
case PAPER_DEFAULT: break;
|
||||
case PAPER_USLETTER:
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_EXECUTIVEPAPER: defaultUnit = "in"; break;
|
||||
case PAPER_A3PAPER:
|
||||
case PAPER_A4PAPER:
|
||||
case PAPER_A5PAPER:
|
||||
case PAPER_B5PAPER: defaultUnit = "cm"; break;
|
||||
case PAPER_USLEGAL:
|
||||
case PAPER_USEXECUTIVE: defaultUnit = "in"; break;
|
||||
case PAPER_A3:
|
||||
case PAPER_A4:
|
||||
case PAPER_A5:
|
||||
case PAPER_B5: defaultUnit = "cm"; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,14 +111,14 @@ void FormParagraph::build()
|
||||
switch (lyxrc.default_papersize) {
|
||||
case PAPER_DEFAULT:
|
||||
case PAPER_USLETTER:
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_EXECUTIVEPAPER:
|
||||
case PAPER_USLEGAL:
|
||||
case PAPER_USEXECUTIVE:
|
||||
defaultUnit = "in";
|
||||
break;
|
||||
case PAPER_A3PAPER:
|
||||
case PAPER_A4PAPER:
|
||||
case PAPER_A5PAPER:
|
||||
case PAPER_B5PAPER:
|
||||
case PAPER_A3:
|
||||
case PAPER_A4:
|
||||
case PAPER_A5:
|
||||
case PAPER_B5:
|
||||
defaultUnit = "cm";
|
||||
break;
|
||||
}
|
||||
|
@ -216,14 +216,14 @@ void FormVSpace::build()
|
||||
switch (lyxrc.default_papersize) {
|
||||
case PAPER_DEFAULT:
|
||||
case PAPER_USLETTER:
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_EXECUTIVEPAPER:
|
||||
case PAPER_USLEGAL:
|
||||
case PAPER_USEXECUTIVE:
|
||||
defaultUnit = "in";
|
||||
break;
|
||||
case PAPER_A3PAPER:
|
||||
case PAPER_A4PAPER:
|
||||
case PAPER_A5PAPER:
|
||||
case PAPER_B5PAPER:
|
||||
case PAPER_A3:
|
||||
case PAPER_A4:
|
||||
case PAPER_A5:
|
||||
case PAPER_B5:
|
||||
defaultUnit = "cm";
|
||||
break;
|
||||
}
|
||||
|
24
src/lyxrc.C
24
src/lyxrc.C
@ -570,22 +570,22 @@ int LyXRC::read(LyXLex & lexrc)
|
||||
PAPER_USLETTER;
|
||||
else if (size == "legal")
|
||||
default_papersize =
|
||||
PAPER_LEGALPAPER;
|
||||
PAPER_USLEGAL;
|
||||
else if (size == "executive")
|
||||
default_papersize =
|
||||
PAPER_EXECUTIVEPAPER;
|
||||
PAPER_USEXECUTIVE;
|
||||
else if (size == "a3")
|
||||
default_papersize =
|
||||
PAPER_A3PAPER;
|
||||
PAPER_A3;
|
||||
else if (size == "a4")
|
||||
default_papersize =
|
||||
PAPER_A4PAPER;
|
||||
PAPER_A4;
|
||||
else if (size == "a5")
|
||||
default_papersize =
|
||||
PAPER_A5PAPER;
|
||||
PAPER_A5;
|
||||
else if (size == "b5")
|
||||
default_papersize =
|
||||
PAPER_B5PAPER;
|
||||
PAPER_B5;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1299,17 +1299,17 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
|
||||
switch (default_papersize) {
|
||||
case PAPER_USLETTER:
|
||||
os << "usletter"; break;
|
||||
case PAPER_LEGALPAPER:
|
||||
case PAPER_USLEGAL:
|
||||
os << "legal"; break;
|
||||
case PAPER_EXECUTIVEPAPER:
|
||||
case PAPER_USEXECUTIVE:
|
||||
os << "executive"; break;
|
||||
case PAPER_A3PAPER:
|
||||
case PAPER_A3:
|
||||
os << "a3"; break;
|
||||
case PAPER_A4PAPER:
|
||||
case PAPER_A4:
|
||||
os << "a4"; break;
|
||||
case PAPER_A5PAPER:
|
||||
case PAPER_A5:
|
||||
os << "a5"; break;
|
||||
case PAPER_B5PAPER:
|
||||
case PAPER_B5:
|
||||
os << "b5"; break;
|
||||
case PAPER_DEFAULT: break;
|
||||
}
|
||||
|
44
src/paper.h
44
src/paper.h
@ -15,26 +15,6 @@
|
||||
#ifndef PAPER_H
|
||||
#define PAPER_H
|
||||
|
||||
///
|
||||
enum PAPER_SIZE {
|
||||
///
|
||||
PAPER_DEFAULT,
|
||||
///
|
||||
PAPER_USLETTER,
|
||||
///
|
||||
PAPER_LEGALPAPER,
|
||||
///
|
||||
PAPER_EXECUTIVEPAPER,
|
||||
///
|
||||
PAPER_A3PAPER,
|
||||
///
|
||||
PAPER_A4PAPER,
|
||||
///
|
||||
PAPER_A5PAPER,
|
||||
///
|
||||
PAPER_B5PAPER
|
||||
};
|
||||
|
||||
///
|
||||
enum PAPER_PACKAGES {
|
||||
///
|
||||
@ -48,29 +28,29 @@ enum PAPER_PACKAGES {
|
||||
};
|
||||
|
||||
///
|
||||
enum VMARGIN_PAPER_TYPE {
|
||||
enum PAPER_SIZE {
|
||||
///
|
||||
VM_PAPER_DEFAULT,
|
||||
PAPER_DEFAULT,
|
||||
///
|
||||
VM_PAPER_CUSTOM,
|
||||
PAPER_CUSTOM,
|
||||
///
|
||||
VM_PAPER_USLETTER,
|
||||
PAPER_USLETTER,
|
||||
///
|
||||
VM_PAPER_USLEGAL,
|
||||
PAPER_USLEGAL,
|
||||
///
|
||||
VM_PAPER_USEXECUTIVE,
|
||||
PAPER_USEXECUTIVE,
|
||||
///
|
||||
VM_PAPER_A3,
|
||||
PAPER_A3,
|
||||
///
|
||||
VM_PAPER_A4,
|
||||
PAPER_A4,
|
||||
///
|
||||
VM_PAPER_A5,
|
||||
PAPER_A5,
|
||||
///
|
||||
VM_PAPER_B3,
|
||||
PAPER_B3,
|
||||
///
|
||||
VM_PAPER_B4,
|
||||
PAPER_B4,
|
||||
///
|
||||
VM_PAPER_B5
|
||||
PAPER_B5
|
||||
};
|
||||
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user