mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
support for \pagebreak:
- rename former "pagebreak" to "newpage" since it produces a \newpage - new LFUN - menu entry - tex2lyx support - fileformat change git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21732 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
eca6ca3798
commit
97aa558cac
@ -1,6 +1,9 @@
|
||||
LyX file-format changes
|
||||
-----------------------
|
||||
|
||||
2007-11-23 Uwe Stöhr <uwestoehr@web.de>
|
||||
* Format incremented to 300: support for \pagebreak
|
||||
|
||||
2007-11-01 Uwe Stöhr <uwestoehr@web.de>
|
||||
* Format incremented to 299: support for hyperlink types
|
||||
|
||||
|
@ -1012,10 +1012,10 @@ src_insets_header_files = Split('''
|
||||
InsetListingsParams.h
|
||||
InsetMarginal.h
|
||||
InsetNewline.h
|
||||
InsetNewpage.h
|
||||
InsetNomencl.h
|
||||
InsetNote.h
|
||||
InsetOptArg.h
|
||||
InsetPagebreak.h
|
||||
InsetQuotes.h
|
||||
InsetRef.h
|
||||
InsetSpace.h
|
||||
@ -1068,10 +1068,10 @@ src_insets_files = Split('''
|
||||
InsetListingsParams.cpp
|
||||
InsetMarginal.cpp
|
||||
InsetNewline.cpp
|
||||
InsetNewpage.cpp
|
||||
InsetNomencl.cpp
|
||||
InsetNote.cpp
|
||||
InsetOptArg.cpp
|
||||
InsetPagebreak.cpp
|
||||
InsetQuotes.cpp
|
||||
InsetRef.cpp
|
||||
InsetSpace.cpp
|
||||
|
@ -198,17 +198,14 @@ def checkDTLtools():
|
||||
|
||||
def checkLatex(dtl_tools):
|
||||
''' Check latex, return lyx_check_config '''
|
||||
path, LATEX = checkProg('a Latex2e program', ['platex $$i', 'latex $$i', 'latex2e $$i'])
|
||||
path, PPLATEX = checkProg('a DVI postprocessing program', ['pplatex $$i'])
|
||||
# use LATEX to convert from latex to dvi if PPLATEX is not available
|
||||
if PPLATEX == '':
|
||||
PPLATEX = LATEX
|
||||
if dtl_tools:
|
||||
# Windows only: DraftDVI
|
||||
addToRC(r'''\converter latex dvi2 "%s" "latex"
|
||||
\converter dvi2 dvi "python -tt $$s/scripts/clean_dvi.py $$i $$o" ""''' % PPLATEX)
|
||||
converter_entry = r'''\converter latex dvi2 "%%" "latex"
|
||||
\converter dvi2 dvi "python -tt $$s/scripts/clean_dvi.py $$i $$o" ""'''
|
||||
else:
|
||||
addToRC(r'\converter latex dvi "%s" "latex"' % PPLATEX)
|
||||
converter_entry = r'\converter latex dvi "%%" "latex"'
|
||||
path, LATEX = checkProg('a Latex2e program', ['pplatex $$i', 'platex $$i', 'latex $$i', 'latex2e $$i'],
|
||||
rc_entry = [converter_entry])
|
||||
# no latex
|
||||
if LATEX != '':
|
||||
# Check if latex is usable
|
||||
@ -854,7 +851,4 @@ Options:
|
||||
bool_docbook, bool_linuxdoc)
|
||||
checkModulesConfig() #lyx_check_config and LATEX != '')
|
||||
removeTempFiles()
|
||||
# The return error code can be 256. Because most systems expect an error code
|
||||
# in the range 0-127, 256 can be interpretted as 'success'. Because we expect
|
||||
# a None for success, 'ret is not None' is used to exit.
|
||||
sys.exit(ret is not None)
|
||||
sys.exit(ret)
|
||||
|
@ -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,300), minor_versions("1.6" , 0))] # Uwe: Hyperlink types
|
||||
("1_6", range(277,301), minor_versions("1.6" , 0))] # Uwe: \pagebreak
|
||||
|
||||
|
||||
def formats_list():
|
||||
|
@ -788,6 +788,17 @@ def revert_hyperlinktype(document):
|
||||
i = i + 1
|
||||
|
||||
|
||||
def revert_pagebreak(document):
|
||||
'Reverts pagebreak to newpage'
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, "\\pagebreak", i)
|
||||
if i == -1:
|
||||
return
|
||||
document.body[i] = document.body[i].replace("\\pagebreak", "\\newpage")
|
||||
i = i + 1
|
||||
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
#
|
||||
@ -815,10 +826,12 @@ convert = [[277, [fix_wrong_tables]],
|
||||
[296, [convert_include]],
|
||||
[297, [convert_usorbian]],
|
||||
[298, []],
|
||||
[299, []]
|
||||
[299, []],
|
||||
[300, []]
|
||||
]
|
||||
|
||||
revert = [[298, [revert_hyperlinktype]],
|
||||
revert = [[299, [revert_pagebreak]],
|
||||
[298, [revert_hyperlinktype]],
|
||||
[297, [revert_macro_optional_params]],
|
||||
[296, [revert_albanian, revert_lowersorbian, revert_uppersorbian]],
|
||||
[295, [revert_include]],
|
||||
|
@ -362,6 +362,7 @@ Menuset
|
||||
Item "Ligature Break|k" "ligature-break-insert"
|
||||
Item "Line Break|B" "break-line"
|
||||
Separator
|
||||
Item "New Page|N" "newpage-insert"
|
||||
Item "Page Break|a" "pagebreak-insert"
|
||||
Item "Clear Page|C" "clearpage-insert"
|
||||
Item "Clear Double Page|D" "cleardoublepage-insert"
|
||||
|
@ -153,7 +153,7 @@ namespace os = support::os;
|
||||
|
||||
namespace {
|
||||
|
||||
int const LYX_FORMAT = 299; // Uwe: Hyperlink types
|
||||
int const LYX_FORMAT = 300; // Uwe: \pagebreak
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
@ -206,6 +206,7 @@ void LyXAction::init()
|
||||
{ LFUN_BIBTEX_DATABASE_ADD, "bibtex-database-add", Noop, Edit },
|
||||
{ LFUN_BIBTEX_DATABASE_DEL, "bibtex-database-del", Noop, Edit },
|
||||
{ LFUN_LINE_INSERT, "line-insert", Noop, Edit },
|
||||
{ LFUN_NEWPAGE_INSERT, "newpage-insert", Noop, Edit },
|
||||
{ LFUN_PAGEBREAK_INSERT, "pagebreak-insert", Noop, Edit },
|
||||
{ LFUN_LANGUAGE, "language", Noop, Edit },
|
||||
{ LFUN_LAYOUT, "layout", Noop, Layout },
|
||||
|
@ -525,10 +525,10 @@ SOURCEFILESINSETS = \
|
||||
insets/InsetListingsParams.cpp \
|
||||
insets/InsetMarginal.cpp \
|
||||
insets/InsetNewline.cpp \
|
||||
insets/InsetNewpage.cpp \
|
||||
insets/InsetNomencl.cpp \
|
||||
insets/InsetNote.cpp \
|
||||
insets/InsetOptArg.cpp \
|
||||
insets/InsetPagebreak.cpp \
|
||||
insets/InsetQuotes.cpp \
|
||||
insets/InsetRef.cpp \
|
||||
insets/InsetSpace.cpp \
|
||||
@ -581,10 +581,10 @@ HEADERFILESINSETS = \
|
||||
insets/InsetListingsParams.h \
|
||||
insets/InsetMarginal.h \
|
||||
insets/InsetNewline.h \
|
||||
insets/InsetNewpage.h \
|
||||
insets/InsetNomencl.h \
|
||||
insets/InsetNote.h \
|
||||
insets/InsetOptArg.h \
|
||||
insets/InsetPagebreak.h \
|
||||
insets/InsetQuotes.h \
|
||||
insets/InsetRef.h \
|
||||
insets/InsetSpace.h \
|
||||
|
@ -58,7 +58,7 @@
|
||||
#include "insets/InsetHFill.h"
|
||||
#include "insets/InsetLine.h"
|
||||
#include "insets/InsetNewline.h"
|
||||
#include "insets/InsetPagebreak.h"
|
||||
#include "insets/InsetNewpage.h"
|
||||
#include "insets/InsetOptArg.h"
|
||||
#include "insets/InsetSpace.h"
|
||||
#include "insets/InsetSpecialChar.h"
|
||||
@ -245,6 +245,8 @@ void readParToken(Buffer const & buf, Paragraph & par, Lexer & lex,
|
||||
} else if (token == "\\lyxline") {
|
||||
par.insertInset(par.size(), new InsetLine, font, change);
|
||||
} else if (token == "\\newpage") {
|
||||
par.insertInset(par.size(), new InsetNewpage, font, change);
|
||||
} else if (token == "\\pagebreak") {
|
||||
par.insertInset(par.size(), new InsetPagebreak, font, change);
|
||||
} else if (token == "\\clearpage") {
|
||||
par.insertInset(par.size(), new InsetClearPage, font, change);
|
||||
|
@ -1384,6 +1384,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
case LFUN_TOC_INSERT:
|
||||
case LFUN_HFILL_INSERT:
|
||||
case LFUN_LINE_INSERT:
|
||||
case LFUN_NEWPAGE_INSERT:
|
||||
case LFUN_PAGEBREAK_INSERT:
|
||||
case LFUN_CLEARPAGE_INSERT:
|
||||
case LFUN_CLEARDOUBLEPAGE_INSERT:
|
||||
@ -2110,6 +2111,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_DATE_INSERT:
|
||||
case LFUN_SELF_INSERT:
|
||||
case LFUN_LINE_INSERT:
|
||||
case LFUN_NEWPAGE_INSERT:
|
||||
case LFUN_PAGEBREAK_INSERT:
|
||||
case LFUN_CLEARPAGE_INSERT:
|
||||
case LFUN_CLEARDOUBLEPAGE_INSERT:
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include "insets/InsetBox.h"
|
||||
#include "insets/InsetBranch.h"
|
||||
#include "insets/InsetOptArg.h"
|
||||
#include "insets/InsetPagebreak.h"
|
||||
#include "insets/InsetNewpage.h"
|
||||
#include "insets/InsetRef.h"
|
||||
#include "insets/InsetSpace.h"
|
||||
#include "insets/InsetTabular.h"
|
||||
@ -93,6 +93,9 @@ Inset * createInset(Buffer & buf, FuncRequest const & cmd)
|
||||
case LFUN_LINE_INSERT:
|
||||
return new InsetLine;
|
||||
|
||||
case LFUN_NEWPAGE_INSERT:
|
||||
return new InsetNewpage;
|
||||
|
||||
case LFUN_PAGEBREAK_INSERT:
|
||||
return new InsetPagebreak;
|
||||
|
||||
|
@ -105,7 +105,7 @@ static TranslatorMap const build_translator()
|
||||
InsetName("listings", LISTINGS_CODE),
|
||||
InsetName("info", INFO_CODE),
|
||||
InsetName("collapsable", COLLAPSABLE_CODE),
|
||||
InsetName("pagebreak", PAGEBREAK_CODE),
|
||||
InsetName("newpage", NEWPAGE_CODE),
|
||||
};
|
||||
|
||||
std::size_t const insetnames_size =
|
||||
|
@ -186,7 +186,7 @@ bool InsetCaption::insetAllowed(InsetCode code) const
|
||||
case TABULAR_CODE:
|
||||
case WRAP_CODE:
|
||||
case CAPTION_CODE:
|
||||
case PAGEBREAK_CODE:
|
||||
case NEWPAGE_CODE:
|
||||
return false;
|
||||
default:
|
||||
return InsetText::insetAllowed(code);
|
||||
|
@ -118,7 +118,7 @@ enum InsetCode {
|
||||
///
|
||||
NOMENCL_PRINT_CODE,
|
||||
///
|
||||
PAGEBREAK_CODE,
|
||||
NEWPAGE_CODE,
|
||||
///
|
||||
LISTINGS_CODE,
|
||||
///
|
||||
|
@ -691,6 +691,7 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_LABEL_INSERT:
|
||||
case LFUN_LIGATURE_BREAK_INSERT:
|
||||
case LFUN_LINE_INSERT:
|
||||
case LFUN_NEWPAGE_INSERT:
|
||||
case LFUN_PAGEBREAK_INSERT:
|
||||
case LFUN_LAYOUT:
|
||||
case LFUN_LAYOUT_PARAGRAPH:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* \file InsetPagebreak.cpp
|
||||
* \file InsetNewpage.cpp
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "InsetPagebreak.h"
|
||||
#include "InsetNewpage.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
@ -30,19 +30,19 @@ namespace lyx {
|
||||
using frontend::Painter;
|
||||
|
||||
|
||||
void InsetPagebreak::read(Buffer const &, Lexer &)
|
||||
void InsetNewpage::read(Buffer const &, Lexer &)
|
||||
{
|
||||
/* Nothing to read */
|
||||
}
|
||||
|
||||
|
||||
void InsetPagebreak::write(Buffer const &, std::ostream & os) const
|
||||
void InsetNewpage::write(Buffer const &, std::ostream & os) const
|
||||
{
|
||||
os << "\n" << getCmdName() << '\n';
|
||||
}
|
||||
|
||||
|
||||
void InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
void InsetNewpage::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
dim.asc = defaultRowHeight();
|
||||
dim.des = defaultRowHeight();
|
||||
@ -52,7 +52,7 @@ void InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
}
|
||||
|
||||
|
||||
void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
|
||||
void InsetNewpage::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
FontInfo font;
|
||||
font.setColor(Color_pagebreak);
|
||||
@ -78,7 +78,7 @@ void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
int InsetPagebreak::latex(Buffer const &, odocstream & os,
|
||||
int InsetNewpage::latex(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << from_ascii(getCmdName()) << "{}";
|
||||
@ -86,7 +86,7 @@ int InsetPagebreak::latex(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetPagebreak::plaintext(Buffer const &, odocstream & os,
|
||||
int InsetNewpage::plaintext(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
@ -94,7 +94,7 @@ int InsetPagebreak::plaintext(Buffer const &, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetPagebreak::docbook(Buffer const &, odocstream & os,
|
||||
int InsetNewpage::docbook(Buffer const &, odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '\n';
|
@ -1,6 +1,6 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file InsetPagebreak.h
|
||||
* \file InsetNewpage.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
@ -9,8 +9,8 @@
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef INSET_PAGEBREAK_H
|
||||
#define INSET_PAGEBREAK_H
|
||||
#ifndef INSET_NEWPAGE_H
|
||||
#define INSET_NEWPAGE_H
|
||||
|
||||
|
||||
#include "Inset.h"
|
||||
@ -19,11 +19,11 @@
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class InsetPagebreak : public Inset {
|
||||
class InsetNewpage : public Inset {
|
||||
public:
|
||||
InsetPagebreak() {}
|
||||
InsetNewpage() {}
|
||||
|
||||
InsetCode lyxCode() const { return PAGEBREAK_CODE; }
|
||||
InsetCode lyxCode() const { return NEWPAGE_CODE; }
|
||||
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
|
||||
@ -46,10 +46,26 @@ public:
|
||||
|
||||
DisplayType display() const { return AlignCenter; }
|
||||
|
||||
virtual docstring insetLabel() const { return _("Page Break"); }
|
||||
virtual docstring insetLabel() const { return _("New Page"); }
|
||||
|
||||
virtual std::string getCmdName() const { return "\\newpage"; }
|
||||
|
||||
private:
|
||||
virtual Inset * clone() const
|
||||
{
|
||||
return new InsetNewpage;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class InsetPagebreak : public InsetNewpage {
|
||||
public:
|
||||
InsetPagebreak() {}
|
||||
|
||||
docstring insetLabel() const { return _("Page Break"); }
|
||||
|
||||
std::string getCmdName() const { return "\\pagebreak"; }
|
||||
|
||||
private:
|
||||
virtual Inset * clone() const
|
||||
{
|
||||
@ -58,7 +74,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class InsetClearPage : public InsetPagebreak {
|
||||
class InsetClearPage : public InsetNewpage {
|
||||
public:
|
||||
InsetClearPage() {}
|
||||
|
||||
@ -74,7 +90,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class InsetClearDoublePage : public InsetPagebreak {
|
||||
class InsetClearDoublePage : public InsetNewpage {
|
||||
public:
|
||||
InsetClearDoublePage() {}
|
||||
|
||||
@ -91,4 +107,4 @@ private:
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif // INSET_PAGEBREAK_H
|
||||
#endif // INSET_NEWPAGE_H
|
@ -539,7 +539,7 @@ public:
|
||||
bool endfoot;
|
||||
/// row of endlastfoot
|
||||
bool endlastfoot;
|
||||
/// row for a pagebreak
|
||||
/// row for a newpage
|
||||
bool newpage;
|
||||
};
|
||||
///
|
||||
|
@ -339,6 +339,7 @@ enum kb_action {
|
||||
LFUN_BOX_INSERT,
|
||||
LFUN_LINE_INSERT,
|
||||
// 240
|
||||
LFUN_NEWPAGE_INSERT, // uwestoehr 20071124
|
||||
LFUN_PAGEBREAK_INSERT,
|
||||
LFUN_REPEAT,
|
||||
LFUN_FINISHED_LEFT,
|
||||
|
@ -86,7 +86,7 @@ InsetMathGrid::CellInfo::CellInfo()
|
||||
|
||||
|
||||
InsetMathGrid::RowInfo::RowInfo()
|
||||
: lines_(0), skip_(0), allow_pagebreak_(true)
|
||||
: lines_(0), skip_(0), allow_newpage_(true)
|
||||
{}
|
||||
|
||||
|
||||
@ -649,7 +649,7 @@ docstring InsetMathGrid::eolString(row_type row, bool emptyline, bool fragile) c
|
||||
|
||||
if (!rowinfo_[row].crskip_.zero())
|
||||
eol += '[' + from_utf8(rowinfo_[row].crskip_.asLatexString()) + ']';
|
||||
else if(!rowinfo_[row].allow_pagebreak_)
|
||||
else if(!rowinfo_[row].allow_newpage_)
|
||||
eol += '*';
|
||||
|
||||
// make sure an upcoming '[' does not break anything
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
/// extra distance between lines
|
||||
int skip_;
|
||||
/// Is a page break allowed after this row?
|
||||
bool allow_pagebreak_;
|
||||
bool allow_newpage_;
|
||||
};
|
||||
|
||||
// additional per-row information
|
||||
|
@ -112,7 +112,7 @@ bool stared(docstring const & s)
|
||||
* environments like "equation" that have a fixed number of rows.
|
||||
*/
|
||||
bool addRow(InsetMathGrid & grid, InsetMathGrid::row_type & cellrow,
|
||||
docstring const & vskip, bool allow_pagebreak = true)
|
||||
docstring const & vskip, bool allow_newpage_ = true)
|
||||
{
|
||||
++cellrow;
|
||||
if (cellrow == grid.nrows()) {
|
||||
@ -129,14 +129,14 @@ bool addRow(InsetMathGrid & grid, InsetMathGrid::row_type & cellrow,
|
||||
lyxerr << "ignoring extra row";
|
||||
if (!vskip.empty())
|
||||
lyxerr << " with extra space " << to_utf8(vskip);
|
||||
if (!allow_pagebreak)
|
||||
if (!allow_newpage_)
|
||||
lyxerr << " with no page break allowed";
|
||||
lyxerr << '.' << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
grid.vcrskip(Length(to_utf8(vskip)), cellrow - 1);
|
||||
grid.rowinfo(cellrow - 1).allow_pagebreak_ = allow_pagebreak;
|
||||
grid.rowinfo(cellrow - 1).allow_newpage_ = allow_newpage_;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
/// These are for longtabulars only
|
||||
/// row type (head, foot, firsthead etc.)
|
||||
LTRowType type;
|
||||
/// row for a pagebreak
|
||||
/// row for a newpage
|
||||
bool newpage;
|
||||
};
|
||||
|
||||
|
@ -2290,10 +2290,10 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
}
|
||||
|
||||
else if (t.cs() == "newpage" ||
|
||||
t.cs() == "clearpage" ||
|
||||
t.cs() == "cleardoublepage") {
|
||||
t.cs() == "pagebreak" ||
|
||||
t.cs() == "clearpage" ||
|
||||
t.cs() == "cleardoublepage") {
|
||||
context.check_layout(os);
|
||||
// FIXME: what about \\pagebreak?
|
||||
os << "\n\\" << t.cs() << "\n";
|
||||
skip_braces(p); // eat {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user