1999-11-18 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
+ * src/buffer.C (writeFile): Do not add a comment on top of .lyx
+ file saying who created them and when this heppened; this is
+ useless and annoys tools like cvs.
+
* lib/layouts/g-brief-{en,de}.layout,
lib/templates/g-brief-{en,de}.lyx: new versions of the textclass
from Thomas Hartkens <thomas@hartkens.de>.
{ "citation-insert", LFUN_INSERT_CITATION },
{ "command-execute", LFUN_EXEC_COMMAND },
{ "command-prefix", LFUN_PREFIX },
+ { "command-sequence", LFUN_SEQUENCE },
{ "copy", LFUN_COPY },
{ "cut", LFUN_CUT },
{ "delete-backward", LFUN_BACKSPACE },
string userName(getUserName()) ;
// write out a comment in the top of the file
+// We do not print this anymore, since it annoys cvs and is useless
+// anyway. It could even be seen as including private
+// information without telling the user :) -- JMarc
+// fprintf(file,
+// "#This file was created by <%s> %s",
+// userName.c_str(),(char*)date());
fprintf(file,
- "#This file was created by <%s> %s",
- userName.c_str(),(char*)date());
- fprintf(file,
- "#LyX 1.0 (C) 1995-1999 Matthias Ettrich"
+ "#LyX 1.1 (C) 1995-1999 Matthias Ettrich"
" and the LyX Team\n");
// at the very beginning the used lyx format
// Itemize bullet settings need to be last in case the user
// defines their own bullets that use a package included
// in the user-defined preamble -- ARRae
+ // Actually it has to be done much later than that
+ // since some packages like frenchb make modifications
+ // at \begin{document} time -- JMarc
+ string bullets_def;
for (int i = 0; i < 4; ++i) {
if (params.user_defined_bullets[i] != ITEMIZE_DEFAULTS[i]) {
- preamble += "\\renewcommand\\labelitemi";
+ if (bullets_def.empty())
+ bullets_def="\\AtBeginDocument{\n";
+ bullets_def += " \\renewcommand{\\labelitemi";
switch (i) {
- // `i' is one less than the item to modify
+ // `i' is one less than the item to modify
case 0:
break;
case 1:
- preamble += 'i';
+ bullets_def += 'i';
break;
case 2:
- preamble += "ii";
+ bullets_def += "ii";
break;
case 3:
- preamble += 'v';
+ bullets_def += 'v';
break;
}
- preamble += "[0]{" + params.user_defined_bullets[i].getText() + "}\n";
+ bullets_def += "}{" +
+ params.user_defined_bullets[i].getText()
+ + "}\n";
}
}
+ if (!bullets_def.empty())
+ preamble += bullets_def + "}\n\n";
+
for (int j = countChar(preamble, '\n'); j-- ;) {
texrow.newline();
}
LFUN_APPENDIX, // ettrich 980505
LFUN_IMPORT, // Asger 980724
LFUN_MENU_SEPARATOR, // Asger 990220
+ LFUN_SEQUENCE, // Andre' 991111
LFUN_LASTACTION /* this marks the end of the table */
};
}
-string LyXFunc::Dispatch(string const &cmd, string const &arg)
+string LyXFunc::Dispatch(string const& s)
{
- return Dispatch(lyxaction.LookupFunc(cmd.c_str()),
- arg.c_str());
+ // Split command string into command and argument
+ string cmd, line = frontStrip(s);
+ string arg = strip(frontStrip(split(line, cmd, ' ')));
+
+ return Dispatch(lyxaction.LookupFunc(cmd.c_str()), arg.c_str());
}
}
break;
+ case LFUN_SEQUENCE:
+ {
+ // argument contains ';'-terminated commands
+ while (argument.find(';') != string::npos) {
+ string first;
+ argument = split(argument, first, ';');
+ Dispatch(first);
+ }
+ }
+ break;
+
case LFUN_UNKNOWN_ACTION:
{
if (owner->buffer()->isReadonly()) {
string Dispatch(int action, char const* arg = 0);
/// The same but uses the name of a lyx command.
- string Dispatch(string const &cmd, string const &arg = string());
+ string Dispatch(string const &cmd);
-
/// A keyboard event is processed to execute a lyx action.
int processKeyEvent(XEvent *ev);
string rval, buf;
if (action>= 0) {
- rval = serv->func->Dispatch(action, arg.c_str());
+ rval = serv->func->Dispatch(cmd);
} else {
rval = "Unknown command";
}
obj->Set(_("Executing:"), obj->cur_cmd);
obj->addHistory(obj->cur_cmd);
- // Split command into function and argument
- string arg = obj->cur_cmd;
- string function;
- if (contains(arg, " ")) {
- arg = split(arg, function, ' ');
- function = strip(function);
- } else {
- function = arg;
- arg.clear();
- }
- lyxerr.debug() << "Function: " << function
- << "\nArg : " << arg << endl;
-
// Dispatch only returns requested data for a few commands (ale)
- string res = obj->owner->getLyXFunc()->Dispatch(function.c_str(),
- arg.c_str());
+ string res = obj->owner->getLyXFunc()->Dispatch(obj->cur_cmd);
lyxerr.debug() << "Minibuffer Res: " << res << endl;
obj->shows_no_match = false;