+2003-07-26 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * ui/stdmenus.ui: fix mnemonic for "Display Tooltips"
+
2003-07-27 José Matos <jamatos@fep.up.pt>
- * layouts/linuxdoc.layout: add support for tables and figures (linuxdoc).
+ * layouts/linuxdoc.layout: add support for tables and figures
+ (linuxdoc).
2003-07-22 John Levon <levon@movementarian.org>
# A common feature request JMarc wants to see
# Item "Open All Footnotes|F" "open-footnotes"
# Item "Close All Footnotes|C" "close-footnotes"
- Item "Display Tooltips|D" "toggle-tooltips"
+ Item "Display Tooltips|i" "toggle-tooltips"
Separator
Submenu "Update|U" "document_update"
ViewFormats
+2003-07-27 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * ispell.C:
+ * encoding.h: add includes
+
+ * lyxrc.C: remove reading of bind files
+
+ * lyx_main.C (init): setup bindings and menus only if we have a
+ gui.
+
+ * kbmap.C (read): new method. Do the actual reading of bind
+ files.
+
+ * converter.C (dvipdfm_options):
+ * bufferparams.C:
+ * lyxrc.C (read):
+ (output): adapt PAPER_* enums.
+
+ * lyxrc.h: include paper.h instead of bufferparams.h (mucho lighter)
+
+ * bufferparams.h: remove paper-related enums from there
+
+ * paper.h: New file. A trivial header file to hold paper-related
+ enums. It should later expand to contain many paper-related
+ horrors access.
+
+ * lyxrc.C: declare extern displayTranslator
+
2003-07-27 José Matos <jamatos@fep.up.pt>
- * tabular.[Ch] (linuxdoc): add support for tables and figures (linuxdoc).
+ * tabular.[Ch] (linuxdoc): add support for tables and figures
+ (linuxdoc).
2003-07-27 José Matos <jamatos@fep.up.pt>
#include "graphics/Previews.h"
+#include "support/LAssert.h"
#include "support/textutils.h"
#include "support/filetools.h"
#include "support/path.h"
if (tmpret == -1)
++tmpret;
paragraph_separation =
- static_cast<BufferParams::PARSEP>(tmpret);
+ static_cast<PARSEP>(tmpret);
} else if (token == "\\defskip") {
lex.nextToken();
defskip = VSpace(lex.getString());
int tmpret = lex.findToken(string_paperpackages);
if (tmpret == -1) {
++tmpret;
- paperpackage = BufferParams::PACKAGE_NONE;
+ paperpackage = PACKAGE_NONE;
} else
paperpackage = PAPER_PACKAGES(tmpret);
} else if (token == "\\use_geometry") {
use_geometry = lex.getInteger();
} else if (token == "\\use_amsmath") {
lex.nextToken();
- use_amsmath = static_cast<BufferParams::AMS>(
+ use_amsmath = static_cast<AMS>(
lex.getInteger());
} else if (token == "\\use_natbib") {
lex.nextToken();
if (tmpret == -1)
++tmpret;
orientation =
- static_cast<BufferParams::PAPER_ORIENTATION>(tmpret);
+ static_cast<PAPER_ORIENTATION>(tmpret);
} else if (token == "\\paperwidth") {
lex.next();
paperwidth = lex.getString();
#include "LaTeXFeatures.h"
#include "texrow.h"
#include "author.h"
+#include "paper.h"
#include "insets/insetquotes.h"
*/
class BufferParams {
public:
- ///
- enum PAPER_SIZE {
- ///
- PAPER_DEFAULT,
- ///
- PAPER_USLETTER,
- ///
- PAPER_LEGALPAPER,
- ///
- PAPER_EXECUTIVEPAPER,
- ///
- PAPER_A3PAPER,
- ///
- PAPER_A4PAPER,
- ///
- PAPER_A5PAPER,
- ///
- PAPER_B5PAPER
- };
- ///
- enum PAPER_PACKAGES {
- ///
- PACKAGE_NONE,
- ///
- PACKAGE_A4,
- ///
- PACKAGE_A4WIDE,
- ///
- PACKAGE_WIDEMARGINSA4
- };
- ///
- enum VMARGIN_PAPER_TYPE {
- ///
- VM_PAPER_DEFAULT,
- ///
- VM_PAPER_CUSTOM,
- ///
- VM_PAPER_USLETTER,
- ///
- VM_PAPER_USLEGAL,
- ///
- VM_PAPER_USEXECUTIVE,
- ///
- VM_PAPER_A3,
- ///
- VM_PAPER_A4,
- ///
- VM_PAPER_A5,
- ///
- VM_PAPER_B3,
- ///
- VM_PAPER_B4,
- ///
- VM_PAPER_B5
- };
///
enum PARSEP {
///
PARSEP_SKIP
};
///
- enum PAPER_ORIENTATION {
- ///
- ORIENTATION_PORTRAIT,
- ///
- ORIENTATION_LANDSCAPE
- };
- ///
BufferParams();
/// read a header token, if unrecognised, return it or an unknown class name
{
string result;
- if (bp.papersize2 != BufferParams::VM_PAPER_CUSTOM) {
+ if (bp.papersize2 != VM_PAPER_CUSTOM) {
string const paper_size = bp.paperSizeName();
if (paper_size != "b5" && paper_size != "foolscap")
result = "-p "+ paper_size;
- if (bp.orientation == BufferParams::ORIENTATION_LANDSCAPE)
+ if (bp.orientation == ORIENTATION_LANDSCAPE)
result += " -l";
}
#include "LString.h"
#include "lyxrc.h"
+#include <map>
+
///
typedef unsigned short int Uchar;
paper_size = "us";
command += ' ' + paper_size;
if (buffer->params.orientation
- == BufferParams::ORIENTATION_LANDSCAPE)
+ == ORIENTATION_LANDSCAPE)
command += 'r';
}
+2003-07-26 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * ControlTabular.C (useMetricUnits): adapt PAPER_* enums
+
2003-07-23 Angus Leeming <leeming@lyx.org>
* ControlExternal.C: pass a Buffer const & rather than a Buffer const *
bool ControlTabular::useMetricUnits() const
{
- return lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER;
+ return lyxrc.default_papersize > PAPER_EXECUTIVEPAPER;
}
+2003-07-26 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * QPrefs.C:
+ * QDocumentDialog.C:
+ * QDocument.C:
+ * QGraphics.C: adapt PAPER_* enums
+
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* QLMenubar.h:
params.float_placement = dialog_->floatModule->get();
// paper
- params.papersize2 = BufferParams::VMARGIN_PAPER_TYPE(
+ params.papersize2 = VMARGIN_PAPER_TYPE(
dialog_->pageLayoutModule->papersizeCO->currentItem());
params.paperwidth = widgetsToLength(dialog_->pageLayoutModule->paperwidthLE,
params.sides = LyXTextClass::OneSide;
if (dialog_->pageLayoutModule->landscapeRB->isChecked())
- params.orientation = BufferParams::ORIENTATION_LANDSCAPE;
+ params.orientation = ORIENTATION_LANDSCAPE;
else
- params.orientation = BufferParams::ORIENTATION_PORTRAIT;
+ params.orientation = ORIENTATION_PORTRAIT;
// margins
params.use_geometry =
if (margin > 0) {
margin = margin - 1;
}
- params.paperpackage = BufferParams::PAPER_PACKAGES(margin);
+ params.paperpackage = PAPER_PACKAGES(margin);
// set params.papersize from params.papersize2
// and params.paperpackage
// FIXME: move to controller
LyXLength::UNIT defaultUnit = LyXLength::CM;
switch (lyxrc.default_papersize) {
- case BufferParams::PAPER_DEFAULT: break;
+ case PAPER_DEFAULT: break;
- case BufferParams::PAPER_USLETTER:
- case BufferParams::PAPER_LEGALPAPER:
- case BufferParams::PAPER_EXECUTIVEPAPER:
+ case PAPER_USLETTER:
+ case PAPER_LEGALPAPER:
+ case PAPER_EXECUTIVEPAPER:
defaultUnit = LyXLength::IN;
break;
- case BufferParams::PAPER_A3PAPER:
- case BufferParams::PAPER_A4PAPER:
- case BufferParams::PAPER_A5PAPER:
- case BufferParams::PAPER_B5PAPER:
+ case PAPER_A3PAPER:
+ case PAPER_A4PAPER:
+ case PAPER_A5PAPER:
+ case PAPER_B5PAPER:
defaultUnit = LyXLength::CM;
break;
}
dialog_->setCustomPapersize(psize);
bool const landscape =
- params.orientation == BufferParams::ORIENTATION_LANDSCAPE;
+ params.orientation == ORIENTATION_LANDSCAPE;
dialog_->pageLayoutModule->landscapeRB->setChecked(landscape);
dialog_->pageLayoutModule->portraitRB->setChecked(!landscape);
marginsModule->marginCO->insertItem(qt_("Default"));
marginsModule->marginCO->insertItem(qt_("Custom"));
bool a4size = (papersize == 6 || papersize == 0
- && lyxrc.default_papersize == BufferParams::PAPER_A4PAPER);
+ && lyxrc.default_papersize == PAPER_A4PAPER);
if (a4size && pageLayoutModule->portraitRB->isChecked()) {
marginsModule->marginCO->insertItem(qt_("Small margins"));
marginsModule->marginCO->insertItem(qt_("Very small margins"));
#include "support/filetools.h"
#include "support/lyxlib.h"
#include "insets/insetgraphicsParams.h"
-#include "bufferparams.h"
+//#include "bufferparams.h"
#include "lyxrc.h"
#include "lengthcombo.h"
#include "qt_helpers.h"
// set the right default unit
LyXLength::UNIT unitDefault = LyXLength::CM;
switch (lyxrc.default_papersize) {
- case BufferParams::PAPER_DEFAULT: break;
+ case PAPER_DEFAULT: break;
- case BufferParams::PAPER_USLETTER:
- case BufferParams::PAPER_LEGALPAPER:
- case BufferParams::PAPER_EXECUTIVEPAPER:
+ case PAPER_USLETTER:
+ case PAPER_LEGALPAPER:
+ case PAPER_EXECUTIVEPAPER:
unitDefault = LyXLength::IN;
break;
- case BufferParams::PAPER_A3PAPER:
- case BufferParams::PAPER_A4PAPER:
- case BufferParams::PAPER_A5PAPER:
- case BufferParams::PAPER_B5PAPER:
+ case PAPER_A3PAPER:
+ case PAPER_A4PAPER:
+ case PAPER_A5PAPER:
+ case PAPER_B5PAPER:
unitDefault = LyXLength::CM;
break;
}
#include "QPrefs.h"
#include "Qt2BC.h"
#include "lyxrc.h"
+#include "lyxfont.h"
#include "frnt_lang.h"
#include "helper_funcs.h"
#include "qt_helpers.h"
rc.auto_reset_options = latexmod->latexAutoresetCB->isChecked();
rc.view_dvi_paper_option = fromqstr(latexmod->latexDviPaperED->text());
rc.default_papersize =
- static_cast<BufferParams::PAPER_SIZE>(latexmod->latexPaperSizeCO->currentItem());
-
+ static_cast<PAPER_SIZE>(latexmod->latexPaperSizeCO->currentItem());
QPrefDisplayModule * displaymod(dialog_->displayModule);
+2003-07-27 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * XPainter.C: include lyxfont.h
+
+ * FormParagraph.C:
+ * FormGraphics.C:
+ * FormDocument.C: adapt PAPER_* enums
+
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* XFormsMenubar.h:
// 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 > BufferParams::PAPER_EXECUTIVEPAPER)
+ bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|| paperchoice == 2 || paperchoice > 5;
string const default_unit = metric ? "cm" : "in";
if (getString(class_->input_skip).empty())
} else if (ob == paper_->radio_landscape) {
fl_set_choice(paper_->choice_paperpackage,
- BufferParams::PACKAGE_NONE + 1);
+ PACKAGE_NONE + 1);
} else if (ob == paper_->choice_papersize) {
int const paperchoice = fl_get_choice(paper_->choice_papersize);
// 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 > BufferParams::PAPER_EXECUTIVEPAPER)
+ bool const metric = (defsize && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|| paperchoice == 2 || paperchoice > 5;
string const default_unit = metric ? "cm" : "in";
if (getString(paper_->input_custom_width).empty())
fl_set_button(paper_->check_use_geometry, 1);
fl_set_choice(paper_->choice_paperpackage,
- BufferParams::PACKAGE_NONE + 1);
+ PACKAGE_NONE + 1);
bool const use_geom = fl_get_button(paper_->check_use_geometry);
setEnabled(paper_->input_top_margin, use_geom);
// either default papersize (preferences) or document
// papersize has to be A4
bool const enable = ( fl_get_choice(paper_->choice_papersize) == 1
- && lyxrc.default_papersize == BufferParams::PAPER_A4PAPER )
+ && lyxrc.default_papersize == PAPER_A4PAPER )
|| fl_get_choice(paper_->choice_papersize) == 7;
if (!enable)
fl_set_choice(paper_->choice_paperpackage,
- BufferParams::PACKAGE_NONE + 1);
+ PACKAGE_NONE + 1);
setEnabled(paper_->choice_paperpackage,
enable && fl_get_button(paper_->radio_portrait));
}
void FormDocument::paper_apply(BufferParams & params)
{
- params.papersize2 = BufferParams::VMARGIN_PAPER_TYPE(fl_get_choice(paper_->choice_papersize) - 1);
+ params.papersize2 = VMARGIN_PAPER_TYPE(fl_get_choice(paper_->choice_papersize) - 1);
params.paperpackage =
- BufferParams::PAPER_PACKAGES(fl_get_choice(paper_->choice_paperpackage) - 1);
+ 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))
- params.orientation = BufferParams::ORIENTATION_LANDSCAPE;
+ params.orientation = ORIENTATION_LANDSCAPE;
else
- params.orientation = BufferParams::ORIENTATION_PORTRAIT;
+ params.orientation = ORIENTATION_PORTRAIT;
params.paperwidth =
getLengthFromWidgets(paper_->input_custom_width,
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 > BufferParams::PAPER_EXECUTIVEPAPER)
+ bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|| paperchoice == 2 || paperchoice > 5;
string const default_unit = metric ? "cm" : "in";
string const length = params.getDefSkip().asLyXCommand();
fl_set_button(paper_->radio_landscape, 0);
setEnabled(paper_->radio_landscape, !useCustom);
- if (params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
+ if (params.orientation == ORIENTATION_LANDSCAPE)
fl_set_button(paper_->radio_landscape, 1);
else
fl_set_button(paper_->radio_portrait, 1);
//either default papersize (preferences)
//or document papersize has to be A4
(paperchoice == 7
- || paperchoice == 1 && lyxrc.default_papersize == BufferParams::PAPER_A4PAPER)
+ || paperchoice == 1 && lyxrc.default_papersize == PAPER_A4PAPER)
&& 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 > BufferParams::PAPER_EXECUTIVEPAPER)
+ bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER)
|| paperchoice == 2 || paperchoice > 5;
string const default_unit = metric ? "cm" : "in";
updateWidgetsFromLengthString(paper_->input_custom_width,
// set the right default unit
switch (lyxrc.default_papersize) {
- case BufferParams::PAPER_DEFAULT: break;
- case BufferParams::PAPER_USLETTER:
- case BufferParams::PAPER_LEGALPAPER:
- case BufferParams::PAPER_EXECUTIVEPAPER: defaultUnit = "in"; break;
- case BufferParams::PAPER_A3PAPER:
- case BufferParams::PAPER_A4PAPER:
- case BufferParams::PAPER_A5PAPER:
- case BufferParams::PAPER_B5PAPER: defaultUnit = "cm"; break;
+ 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;
}
}
// set default unit for custom length
switch (lyxrc.default_papersize) {
- case BufferParams::PAPER_DEFAULT:
- case BufferParams::PAPER_USLETTER:
- case BufferParams::PAPER_LEGALPAPER:
- case BufferParams::PAPER_EXECUTIVEPAPER:
+ case PAPER_DEFAULT:
+ case PAPER_USLETTER:
+ case PAPER_LEGALPAPER:
+ case PAPER_EXECUTIVEPAPER:
defaultUnit = "in";
break;
- case BufferParams::PAPER_A3PAPER:
- case BufferParams::PAPER_A4PAPER:
- case BufferParams::PAPER_A5PAPER:
- case BufferParams::PAPER_B5PAPER:
+ case PAPER_A3PAPER:
+ case PAPER_A4PAPER:
+ case PAPER_A5PAPER:
+ case PAPER_B5PAPER:
defaultUnit = "cm";
break;
}
int const choice =
fl_get_choice(dialog_->choice_default_papersize) - 1;
- rc.default_papersize = static_cast<BufferParams::PAPER_SIZE>(choice);
+ rc.default_papersize = static_cast<PAPER_SIZE>(choice);
rc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff);
rc.chktex_command = fl_get_input(dialog_->input_checktex);
#include "debug.h"
#include "XWorkArea.h"
#include "xfont_metrics.h"
+#include "lyxfont.h"
#include "ColorHandler.h"
#include "lyxrc.h"
#include "encoding.h"
+2003-07-26 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * GraphicsTypes.h: do not declare displayTranstor here (and remove
+ extra include)
+
2003-07-27 José Matos <jamatos@fep.up.pt>
* PreviewLoader.C (Impl::dumpPreamble): comply with makeLaTeXFile
#include <config.h>
#include "graphics/GraphicsTypes.h"
-
+#include "support/translator.h"
namespace lyx {
namespace graphics {
#define GRAPHICSTYPES_H
#include "LString.h"
-#include "support/translator.h"
namespace lyx {
namespace graphics {
NoDisplay
};
-/// The translator between the DisplayType and the corresponding lyx string.
-extern Translator<DisplayType, string> displayTranslator;
///
void setDisplayTranslator();
+2003-07-26 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * insetgraphicsParams.C:
+ * insetexternal.C: declare extern displayTranslator
+
+ * insetexternal.C:
+ * renderers.C: add #include "support/LAssert.h"
+
2003-07-27 José Matos <jamatos@fep.up.pt>
* insetfloat.[Ch] (linuxdoc):
* insetgraphics.C (linuxdoc):
* insettabular.C (linuxdoc):
- * insettext.[Ch] (linuxdoc): add support for tables and figures (linuxdoc).
+ * insettext.[Ch] (linuxdoc): add support for tables and figures
+ (linuxdoc).
2003-07-27 José Matos <jamatos@fep.up.pt>
#include "support/lyxalgo.h"
#include "support/path.h"
#include "support/tostr.h"
+#include "support/LAssert.h"
+#include "support/translator.h"
#include <boost/bind.hpp>
using std::endl;
using std::auto_ptr;
+namespace lyx {
+namespace graphics {
+/// The translator between the DisplayType and the corresponding lyx string.
+extern Translator<DisplayType, string> displayTranslator;
+}
+}
+
namespace {
lyx::graphics::DisplayType const defaultDisplayType = lyx::graphics::NoDisplay;
#include "support/LOstream.h"
#include "support/LAssert.h"
#include "support/lstrings.h"
+#include "support/translator.h"
#include "lyxrc.h"
#include "debug.h"
#include "lyxlex.h"
using std::ostream;
+namespace lyx {
+namespace graphics {
+/// The translator between the DisplayType and the corresponding lyx string.
+extern Translator<DisplayType, string> displayTranslator;
+}
+}
+
InsetGraphicsParams::InsetGraphicsParams()
{
#include "graphics/GraphicsImage.h"
#include "support/filetools.h"
-
+#include "support/LAssert.h"
using namespace lyx::support;
#include "ispell.h"
#include "WordLangTuple.h"
#include "gettext.h"
+#include "bufferparams.h"
#include "support/forkedcall.h"
#include "support/lstrings.h"
#include "kbmap.h"
#include "lfuns.h"
#include "kbsequence.h"
+#include "LyXAction.h"
+#include "support/filetools.h"
+#include "lyxlex.h"
#include "debug.h"
using std::endl;
+using lyx::support::i18nLibFileSearch;
string const kb_keymap::printKeysym(LyXKeySymPtr key,
key_modifier::state mod)
}
+namespace {
+
+enum BindTags {
+ BN_BIND,
+ BN_BINDFILE
+};
+
+keyword_item bindTags[] = {
+ { "\\bind", BN_BIND },
+ { "\\bind_file", BN_BINDFILE }
+};
+
+}
+
+
+bool kb_keymap::read(string const & bind_file)
+{
+ const int bindCount = sizeof(bindTags) / sizeof(keyword_item);
+
+ LyXLex lexrc(bindTags, bindCount);
+ if (lyxerr.debugging(Debug::PARSER))
+ lexrc.printTable(lyxerr);
+
+ string const tmp = i18nLibFileSearch("bind", bind_file, "bind");
+ lexrc.setFile(tmp);
+ if (!lexrc.isOK()) return false;
+
+ lyxerr[Debug::KBMAP] << "Reading bindfile:" << tmp << endl;
+
+ bool error = false;
+ while (lexrc.isOK()) {
+ switch (lexrc.lex()) {
+ case LyXLex::LEX_UNDEF:
+ lexrc.printError("Unknown tag `$$Token'");
+ continue;
+ case LyXLex::LEX_FEOF:
+ continue;
+ case BN_BIND:
+ {
+ string seq, cmd;
+
+ if (lexrc.next()) {
+ seq = lexrc.getString();
+ } else {
+ lexrc.printError("BN_BIND: Missing key sequence");
+ break;
+ }
+
+ if (lexrc.next(true)) {
+ cmd = lexrc.getString();
+ } else {
+ lexrc.printError("BN_BIND: missing command");
+ break;
+ }
+
+ int action = lyxaction.LookupFunc(cmd);
+ if (!action == LFUN_UNKNOWN_ACTION) {
+ lexrc.printError("BN_BIND: Unknown LyX"
+ " function `$$Token'");
+ break;
+ }
+
+ error = (bind(seq, kb_action(action)) != string::npos);
+ break;
+ }
+ case BN_BINDFILE:
+ if (lexrc.next()) {
+ string const tmp(lexrc.getString());
+ error = read(tmp);
+ } else {
+ lexrc.printError("BN_BINDFILE: Missing file name");
+ error = true;
+ break;
+
+ }
+ break;
+ }
+ }
+
+ if (error) {
+ lyxerr << "Error reading bind file: " << tmp << endl;
+ }
+
+ return error;
+}
+
+
int kb_keymap::lookup(LyXKeySymPtr key,
key_modifier::state mod, kb_sequence * seq) const
{
*/
string::size_type bind(string const & seq, int action);
+ // Parse a bind file
+ bool kb_keymap::read(string const & bind_file);
+
/// print all available keysyms
string const print() const;
// we need to parse for "-dbg" and "-help"
bool const want_gui = easyParse(argc, argv);
- // Global bindings (this must be done as early as possible.) (Lgb)
- toplevel_keymap.reset(new kb_keymap);
- defaultKeyBindings(toplevel_keymap.get());
-
// set the DisplayTranslator only once; should that be done here??
// if this should not be in this file, please also remove
// #include "graphics/GraphicsTypes.h" at the top -- Rob Lahaye.
lyxerr[Debug::INIT] << "Reading layouts..." << endl;
LyXSetStyle();
- // Ensure that we have really read a bind file, so that LyX is
- // usable.
- lyxrc.readBindFileIfNeeded();
+ if (gui) {
+ // Set up bindings
+ toplevel_keymap.reset(new kb_keymap);
+ defaultKeyBindings(toplevel_keymap.get());
+ toplevel_keymap->read(lyxrc.bind_file);
- // Read menus
- readUIFile(lyxrc.ui_file);
+ // Read menus
+ readUIFile(lyxrc.ui_file);
+ }
if (lyxerr.debugging(Debug::LYXRC))
lyxrc.print();
#include "lyxrc.h"
#include "debug.h"
-#include "kbmap.h"
-#include "LyXAction.h"
#include "intl.h"
#include "converter.h"
#include "format.h"
#include "gettext.h"
#include "lyxlex.h"
+#include "lyxfont.h"
#include "support/path.h"
#include "support/tostr.h"
#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/userinfo.h"
+#include "support/translator.h"
using namespace lyx::support;
using std::endl;
using std::vector;
-class kb_keymap;
-
-extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
+namespace lyx {
+namespace graphics {
+/// The translator between the DisplayType and the corresponding lyx string.
+extern Translator<DisplayType, string> displayTranslator;
+}
+}
namespace {
{ "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
{ "\\autosave", LyXRC::RC_AUTOSAVE },
{ "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
- { "\\bind", LyXRC::RC_BIND },
{ "\\bind_file", LyXRC::RC_BINDFILE },
{ "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
{ "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
void LyXRC::setDefaults() {
bind_file = "cua";
- hasBindFile = false;
ui_file = "default";
// Get printer from the environment. If fail, use default "",
// assuming that everything is set up correctly.
use_tempdir = true;
ps_command = "gs";
view_dvi_paper_option.erase();
- default_papersize = BufferParams::PAPER_USLETTER;
+ default_papersize = PAPER_USLETTER;
custom_export_format = "ps";
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
fontenc = "default";
}
-int LyXRC::ReadBindFile(string const & name)
-{
- hasBindFile = true;
- string const tmp = i18nLibFileSearch("bind", name, "bind");
- lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
- int const result = read(tmp);
- if (result) {
- lyxerr << "Error reading bind file: " << tmp << endl;
- }
- return result;
-}
-
-void LyXRC::readBindFileIfNeeded()
-{
- if (!hasBindFile)
- ReadBindFile(bind_file);
-}
-
-
namespace {
void oldFontFormat(string & family, string & foundry)
break;
case RC_BINDFILE: // RVDK_PATCH_5
if (lexrc.next()) {
- string const tmp(lexrc.getString());
- if (hasBindFile) {
- // We are already in the
- // "actually read bind file"
- // mode.
- ReadBindFile(tmp);
- } else {
- // We are still in the "just
- // remember the name of the
- // bind file" mode.
- bind_file = tmp;
- }
+ bind_file = lexrc.getString();
}
break;
ascii_lowercase(lexrc.getString());
if (size == "usletter")
default_papersize =
- BufferParams::PAPER_USLETTER;
+ PAPER_USLETTER;
else if (size == "legal")
default_papersize =
- BufferParams::PAPER_LEGALPAPER;
+ PAPER_LEGALPAPER;
else if (size == "executive")
- default_papersize =
- BufferParams::PAPER_EXECUTIVEPAPER;
+ default_papersize =
+ PAPER_EXECUTIVEPAPER;
else if (size == "a3")
default_papersize =
- BufferParams::PAPER_A3PAPER;
+ PAPER_A3PAPER;
else if (size == "a4")
default_papersize =
- BufferParams::PAPER_A4PAPER;
+ PAPER_A4PAPER;
else if (size == "a5")
default_papersize =
- BufferParams::PAPER_A5PAPER;
+ PAPER_A5PAPER;
else if (size == "b5")
default_papersize =
- BufferParams::PAPER_B5PAPER;
+ PAPER_B5PAPER;
}
break;
}
break;
- case RC_BIND:
- {
- // we should not do an explicit binding before
- // loading a bind file. So, in this case, load
- // the default bind file.
- readBindFileIfNeeded();
-
- // !!!chb, dynamic key binding...
- int action = 0;
- string::size_type res = 0;
- string seq, cmd;
-
- if (lexrc.next()) {
- seq = lexrc.getString();
- } else {
- lexrc.printError("RC_BIND: Missing key sequence");
- break;
- }
-
- if (lexrc.next(true)) {
- cmd = lexrc.getString();
- } else {
- lexrc.printError("RC_BIND: missing command");
- break;
- }
-
- if ((action = lyxaction.LookupFunc(cmd)) >= 0) {
- if (lyxerr.debugging(Debug::LYXRC)) {
- lyxerr << "RC_BIND: Sequence `"
- << seq << "' Command `"
- << cmd << "' Action `"
- << action << '\'' << endl;
- }
- res = toplevel_keymap->bind(seq, kb_action(action));
- if (res != string::npos
- && lyxerr.debugging(Debug::LYXRC)) {
- lexrc.printError(
- "RC_BIND: "
- "Invalid key sequence `"
- + seq + '\'');
- }
- } else {// cmd is the last token read.
- lexrc.printError(
- "Unknown LyX function `$$Token'");
- }
- break;
- }
case RC_SERVERPIPE:
if (lexrc.next()) {
lyxpipes = ExpandPath(lexrc.getString());
case RC_LAST:
case RC_INPUT:
// input/include files are not done here
- case RC_BIND:
- // bindings is not written to the preferences file.
case RC_BINDFILE:
if (bind_file != system_lyxrc.bind_file) {
os << "\\bind_file " << bind_file << "\n";
os << "# The default papersize to use.\n"
<< "\\default_papersize \"";
switch (default_papersize) {
- case BufferParams::PAPER_USLETTER:
+ case PAPER_USLETTER:
os << "usletter"; break;
- case BufferParams::PAPER_LEGALPAPER:
+ case PAPER_LEGALPAPER:
os << "legal"; break;
- case BufferParams::PAPER_EXECUTIVEPAPER:
+ case PAPER_EXECUTIVEPAPER:
os << "executive"; break;
- case BufferParams::PAPER_A3PAPER:
+ case PAPER_A3PAPER:
os << "a3"; break;
- case BufferParams::PAPER_A4PAPER:
+ case PAPER_A4PAPER:
os << "a4"; break;
- case BufferParams::PAPER_A5PAPER:
+ case PAPER_A5PAPER:
os << "a5"; break;
- case BufferParams::PAPER_B5PAPER:
+ case PAPER_B5PAPER:
os << "b5"; break;
- case BufferParams::PAPER_DEFAULT: break;
+ case PAPER_DEFAULT: break;
}
os << "\"\n";
}
#ifndef LYXRC_H
#define LYXRC_H
-#include "bufferparams.h" // Just to get the enum BufferParams::PAPER_SIZE (sic)
+#include "paper.h"
#include "graphics/GraphicsTypes.h"
// #include <boost/utility.hpp>
RC_LASTFILES,
RC_AUTOREGIONDELETE,
RC_AUTORESET_OPTIONS,
- RC_BIND,
RC_SERVERPIPE,
RC_INPUT,
RC_BINDFILE,
///
int read(string const & filename);
///
- void readBindFileIfNeeded();
- ///
void write(string const & filename) const;
///
void print() const;
/// option for telling the dvi viewer about the paper size
string view_dvi_paper_option;
/// default paper size for local xdvi/dvips/ghostview/whatever
- BufferParams::PAPER_SIZE default_papersize;
+ PAPER_SIZE default_papersize;
/// command to run chktex incl. options
string chktex_command;
///
string user_name;
/// user email
string user_email;
-
-private:
- /// Is a bind file already (or currently) read?
- bool hasBindFile;
- ///
- int ReadBindFile(string const & name);
};
///
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file paper.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Jean-Marc Lasgouttes
+ *
+ * Full author contact details are available in file CREDITS
+ *
+ * A trivial header file to hold paper-related enums. It should later
+ * expand to contain many paper-related horrors access.
+ */
+
+#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 {
+ ///
+ PACKAGE_NONE,
+ ///
+ PACKAGE_A4,
+ ///
+ PACKAGE_A4WIDE,
+ ///
+ PACKAGE_WIDEMARGINSA4
+};
+
+///
+enum VMARGIN_PAPER_TYPE {
+ ///
+ VM_PAPER_DEFAULT,
+ ///
+ VM_PAPER_CUSTOM,
+ ///
+ VM_PAPER_USLETTER,
+ ///
+ VM_PAPER_USLEGAL,
+ ///
+ VM_PAPER_USEXECUTIVE,
+ ///
+ VM_PAPER_A3,
+ ///
+ VM_PAPER_A4,
+ ///
+ VM_PAPER_A5,
+ ///
+ VM_PAPER_B3,
+ ///
+ VM_PAPER_B4,
+ ///
+ VM_PAPER_B5
+};
+
+///
+enum PAPER_ORIENTATION {
+ ///
+ ORIENTATION_PORTRAIT,
+ ///
+ ORIENTATION_LANDSCAPE
+};
+#endif
+2003-07-26 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * text.C (parse_text): fix handling of \LaTeXe macro
+
2003-07-26 Angus Leeming <leeming@lyx.org>
* Spacing.h:
os << "\n\\size " << known_coded_sizes[where - known_sizes] << "\n";
}
- else if (t.cs() == "LyX" || t.cs() == "TeX"
- || t.cs() == "LaTeX" || t.cs() == "LaTeXe") {
+ else if (t.cs() == "LyX" || t.cs() == "TeX"
+ || t.cs() == "LaTeX") {
os << t.cs();
skip_braces(p); // eat {}
}
+ else if (t.cs() == "LaTeXe") {
+ os << "LaTeX2e";
+ skip_braces(p); // eat {}
+ }
+
else if (t.cs() == "lyxarrow") {
os << "\\SpecialChar \\menuseparator\n";
skip_braces(p);
#include "language.h"
#include "support/tostr.h"
#include "support/lstrings.h"
+#include "support/LAssert.h"
#include "frontends/LyXView.h"
#include "frontends/screen.h"
#include "frontends/Dialogs.h"