]> git.lyx.org Git - features.git/commitdiff
The command-sequence patch from Andre'; also remove the comment in first
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Nov 1999 14:12:19 +0000 (14:12 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Nov 1999 14:12:19 +0000 (14:12 +0000)
line of .lyx files.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@325 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/LyXAction.C
src/buffer.C
src/commandtags.h
src/lyxfunc.C
src/lyxfunc.h
src/lyxserver.C
src/minibuffer.C

index dfea2b27599fb99784c1a0df632e3dbb66623e70..5e375fc4c05df2a5cbf0a36b4f6f2b19c264139a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>.
index 55b26fde65aa04396561959640073f7c08689d00..acb0edea9771d643227fa15b441e5c2a0439d02e 100644 (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 },
index a252465a3d373255758e1c61985dfc9b5fc6e8ff..2cb09c254d2a4940ec4f010ae4a0b0c0b51e2fa2 100644 (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();
                }
index 9348ca137f9552ba1680d6b1c230a6deee517a5b..cba72f8dc06aea64f6602987abafc75fffd3e621 100644 (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 */
 };
 
index 4a9debb27939ad9339e91f267ab67e7eb340c49d..a5b8cfa3e68cfcc9b0479e50705e50474db8b2ac 100644 (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()) {
index 5228fda0271639cc5f8f452f49e2d6f4155bb869..c5fd86a6c1f2904fd90ae282b0eec8dab46fe79a 100644 (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);
      
index d6c217529dd4156be94d65f928b9af1d293fa809..6e00f3d6576a0121531c2bac843f2f2fa855c375 100644 (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";
                        }
index eea98c940cfc8ad47f3608b499cbf26034f4f6cd..a674f6d37d75f71dbb7e566de04f6100cea69f7c 100644 (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;