mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Add support for column separation in page margins. Fixes bug 3337.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23059 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a97b6295c4
commit
4ab6f265e9
@ -1,6 +1,9 @@
|
||||
LyX file-format changes
|
||||
-----------------------
|
||||
|
||||
2008-02-18 Richard Heck <rgheck@comcast.net>
|
||||
* Format incremented to 315: support for column separation in page margins
|
||||
|
||||
2008-02-03 Uwe Stöhr <uwestoehr@web.de>
|
||||
* Format incremented to 314: adapt scrlttr2 class for serial letters
|
||||
|
||||
|
@ -80,7 +80,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)),
|
||||
("1_3", [221], minor_versions("1.3" , 7)),
|
||||
("1_4", range(222,246), minor_versions("1.4" , 5)),
|
||||
("1_5", range(246,277), minor_versions("1.5" , 2)),
|
||||
("1_6", range(277,315), minor_versions("1.6" , 0))] # Uwe Stöhr: scrlttr2 for serial letters
|
||||
("1_6", range(277,316), minor_versions("1.6" , 0))] # rgh: colsep
|
||||
|
||||
|
||||
def formats_list():
|
||||
|
@ -960,6 +960,24 @@ def revert_module_names(document):
|
||||
document.set_module_list(newmodlist)
|
||||
|
||||
|
||||
def revert_colsep(document):
|
||||
i = find_token(document.header, "\\columnsep", 0)
|
||||
if i == -1:
|
||||
return
|
||||
colsepline = document.header[i]
|
||||
r = re.compile(r'\\columnsep (.*)')
|
||||
m = r.match(colsepline)
|
||||
if not m:
|
||||
document.warning("Malformed column separation line!")
|
||||
return
|
||||
colsep = m.group(1)
|
||||
del document.header[i]
|
||||
#it seems to be safe to add the package even if it is already used
|
||||
pretext = ["\\usepackage{geometry}", "\\geometry{columnsep=" + colsep + "}"]
|
||||
|
||||
add_to_preamble(document, pretext)
|
||||
|
||||
|
||||
def revert_framed_notes(document):
|
||||
"Revert framed boxes to notes. "
|
||||
i = 0
|
||||
@ -1265,10 +1283,12 @@ convert = [[277, [fix_wrong_tables]],
|
||||
[311, [convert_ams_classes]],
|
||||
[312, []],
|
||||
[313, [convert_module_names]],
|
||||
[314, []]
|
||||
[314, []],
|
||||
[315, []]
|
||||
]
|
||||
|
||||
revert = [[313, []],
|
||||
revert = [[314, [revert_colsep]],
|
||||
[313, []],
|
||||
[312, [revert_module_names]],
|
||||
[311, [revert_rotfloat, revert_widesideways]],
|
||||
[310, []],
|
||||
|
@ -113,7 +113,7 @@ namespace os = support::os;
|
||||
|
||||
namespace {
|
||||
|
||||
int const LYX_FORMAT = 314; // Uwe Stöhr: scrlttr2 for serial letters
|
||||
int const LYX_FORMAT = 315; // Richard Heck: column separation
|
||||
|
||||
} // namespace anon
|
||||
|
||||
@ -466,6 +466,7 @@ int Buffer::readHeader(Lexer & lex)
|
||||
params().headheight.erase();
|
||||
params().headsep.erase();
|
||||
params().footskip.erase();
|
||||
params().columnsep.erase();
|
||||
params().listings_params.clear();
|
||||
params().clearLayoutModules();
|
||||
params().pdfoptions().clear();
|
||||
|
@ -619,6 +619,8 @@ string const BufferParams::readToken(Lexer & lex, string const & token,
|
||||
lex >> headsep;
|
||||
} else if (token == "\\footskip") {
|
||||
lex >> footskip;
|
||||
} else if (token == "\\columnsep") {
|
||||
lex >> columnsep;
|
||||
} else if (token == "\\paperfontsize") {
|
||||
lex >> fontsize;
|
||||
} else if (token == "\\papercolumns") {
|
||||
@ -768,6 +770,9 @@ void BufferParams::writeFile(ostream & os) const
|
||||
if (!footskip.empty())
|
||||
os << "\\footskip "
|
||||
<< VSpace(footskip).asLyXCommand() << '\n';
|
||||
if (!columnsep.empty())
|
||||
os << "\\columnsep "
|
||||
<< VSpace(columnsep).asLyXCommand() << '\n';
|
||||
os << "\\secnumdepth " << secnumdepth
|
||||
<< "\n\\tocdepth " << tocdepth
|
||||
<< "\n\\paragraph_separation "
|
||||
@ -1139,6 +1144,8 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
os << ",headsep=" << from_ascii(Length(headsep).asLatexString());
|
||||
if (!footskip.empty())
|
||||
os << ",footskip=" << from_ascii(Length(footskip).asLatexString());
|
||||
if (!columnsep.empty())
|
||||
os << ",columnsep=" << from_ascii(Length(columnsep).asLatexString());
|
||||
os << "}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
|
@ -165,6 +165,8 @@ public:
|
||||
std::string headsep;
|
||||
///
|
||||
std::string footskip;
|
||||
///
|
||||
std::string columnsep;
|
||||
|
||||
/* some LaTeX options */
|
||||
/// The graphics driver
|
||||
|
@ -718,6 +718,10 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(marginsModule->footskipUnit, SIGNAL(activated(int)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(marginsModule->columnsepLE, SIGNAL(textChanged(const QString&)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(marginsModule->columnsepUnit, SIGNAL(activated(int)),
|
||||
this, SLOT(change_adaptor()));
|
||||
marginsModule->topLE->setValidator(unsignedLengthValidator(
|
||||
marginsModule->topLE));
|
||||
marginsModule->bottomLE->setValidator(unsignedLengthValidator(
|
||||
@ -732,6 +736,8 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
marginsModule->headheightLE));
|
||||
marginsModule->footskipLE->setValidator(unsignedLengthValidator(
|
||||
marginsModule->footskipLE));
|
||||
marginsModule->columnsepLE->setValidator(unsignedLengthValidator(
|
||||
marginsModule->columnsepLE));
|
||||
|
||||
bc().addCheckedLineEdit(marginsModule->topLE,
|
||||
marginsModule->topL);
|
||||
@ -747,6 +753,8 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
marginsModule->headheightL);
|
||||
bc().addCheckedLineEdit(marginsModule->footskipLE,
|
||||
marginsModule->footskipL);
|
||||
bc().addCheckedLineEdit(marginsModule->columnsepLE,
|
||||
marginsModule->columnsepL);
|
||||
|
||||
|
||||
langModule = new UiWidget<Ui::LanguageUi>;
|
||||
@ -1111,6 +1119,10 @@ void GuiDocument::setCustomMargins(bool custom)
|
||||
marginsModule->footskipL->setEnabled(!custom);
|
||||
marginsModule->footskipLE->setEnabled(!custom);
|
||||
marginsModule->footskipUnit->setEnabled(!custom);
|
||||
|
||||
marginsModule->columnsepL->setEnabled(!custom);
|
||||
marginsModule->columnsepLE->setEnabled(!custom);
|
||||
marginsModule->columnsepUnit->setEnabled(!custom);
|
||||
}
|
||||
|
||||
|
||||
@ -1600,6 +1612,7 @@ void GuiDocument::apply(BufferParams & params)
|
||||
params.headheight = widgetsToLength(m->headheightLE, m->headheightUnit);
|
||||
params.headsep = widgetsToLength(m->headsepLE, m->headsepUnit);
|
||||
params.footskip = widgetsToLength(m->footskipLE, m->footskipUnit);
|
||||
params.columnsep = widgetsToLength(m->columnsepLE, m->columnsepUnit);
|
||||
|
||||
branchesModule->apply(params);
|
||||
|
||||
@ -1909,6 +1922,9 @@ void GuiDocument::updateParams(BufferParams const & params)
|
||||
lengthToWidgets(m->footskipLE, m->footskipUnit,
|
||||
params.footskip, defaultUnit);
|
||||
|
||||
lengthToWidgets(m->columnsepLE, m->columnsepUnit,
|
||||
params.columnsep, defaultUnit);
|
||||
|
||||
branchesModule->update(params);
|
||||
|
||||
// PDF support
|
||||
|
@ -171,6 +171,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="columnsepL" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Column Sep:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>columnsepLE</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -352,6 +365,30 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="columnsepLE" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LengthCombo" native="1" name="columnsepUnit" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
Reference in New Issue
Block a user