The command-sequence patch from Andre'; also remove the comment in first

line of .lyx files.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@325 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 1999-11-18 14:12:19 +00:00
parent cd0e4f1bd4
commit 90ef01a0ed
8 changed files with 50 additions and 31 deletions

View File

@ -1,5 +1,9 @@
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>.

View File

@ -112,6 +112,7 @@ kb_func_table const lyx_func_table[] = {
{ "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 },

View File

@ -1201,11 +1201,14 @@ bool Buffer::writeFile(string const & filename, bool flag)
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
@ -1946,27 +1949,38 @@ void Buffer::makeLaTeXFile(string const & filename,
// 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();
}

View File

@ -240,6 +240,7 @@ enum kb_action {
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 */
};

View File

@ -311,10 +311,13 @@ int LyXFunc::processKeyEvent(XEvent *ev)
}
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());
}
@ -2364,6 +2367,17 @@ string LyXFunc::Dispatch(int ac,
}
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()) {

View File

@ -31,9 +31,8 @@ public:
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);

View File

@ -525,7 +525,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
string rval, buf;
if (action>= 0) {
rval = serv->func->Dispatch(action, arg.c_str());
rval = serv->func->Dispatch(cmd);
} else {
rval = "Unknown command";
}

View File

@ -54,22 +54,8 @@ void MiniBuffer::ExecutingCB(FL_OBJECT * ob, long)
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;