]> git.lyx.org Git - lyx.git/commitdiff
Backup file patch from Dekel; Update to scr layout files from Hartmut Goebel
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 20 Mar 2000 14:49:54 +0000 (14:49 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 20 Mar 2000 14:49:54 +0000 (14:49 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@621 a592a061-630c-0410-9148-cb99ea01b6c8

25 files changed:
ChangeLog
lib/layouts/IEEEtran.layout
lib/layouts/aapaper.layout
lib/layouts/aastex.layout
lib/layouts/broadway.layout
lib/layouts/foils.layout
lib/layouts/hollywood.layout
lib/layouts/paper.layout
lib/layouts/revtex.layout
lib/layouts/revtex4.layout
lib/layouts/scrclass.inc
lib/layouts/stdclass.inc
lib/layouts/stdstruct.inc
lib/layouts/stdtitle.inc [new file with mode: 0644]
lib/lyxrc.example
po/POTFILES.in
src/LColor.C
src/buffer.C
src/buffer.h
src/bufferlist.C
src/insets/insetbib.C
src/insets/insetbib.h
src/lyx_cb.C
src/lyxrc.C
src/lyxrc.h

index e68528e0959da8ada4198f3454446775b468c85f..cf1f3e095743f4237966e738ab29ceddee483983 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+2000-03-20  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * src/LColor.C: made the command inset background a bit lighter.
+
+2000-03-20  Hartmut Goebel <goebel@noris.net>
+
+       * lib/layouts/stdstruct.inc: split into stdtitle.inc and
+       stdstruct.inc. Koma-Script added some title elements which
+       otherwise have been listed below "bibliography". This split allows
+       adding title elements to where they belong.
+
+       * lib/layouts/scrclass.inc: changed to include stdtitle.inc, then
+       define the additional tilte elements and then include
+       stdstruct.inc. 
+
+       * many other layout files: changed to include stdtitle.inc just
+       before stdstruct.inc.
+
+2000-03-18 Dekel Tsur <dekel@math.tau.ac.il>
+
+       * src/buffer.C: (save) Added the option to store all backup files
+       in a single directory
+
+       * src/lyxrc.[Ch]: Added variable \backupdir_path
+
+       * lib/lyxrc.example: Added descriptions of recently added variables
+
+       * src/insets/insetbib.[Ch]: Fixed few bugs (crash when editing a
+       bibtex inset, not closing the bibtex popup when deleting the inset)
+
+2000-03-17  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * src/lyx_cb.C: add a couple using directives.
+
 2000-03-17 José Abílio Matos <jamatos@lyx.org>
        * src/lyx_cb.C (RunLinuxDoc) Removed the flag==-1 option for linuxdoc 
        import based on the filename.
index e1463a097459a26b3ace89c33f8d33be45151e8c..73d9522a5b8fcf295cc90c070b74cecc32caac03 100644 (file)
@@ -351,6 +351,7 @@ End
 ##
 ## stdstruct
 ##
+Input stdtitle.inc
 Input stdstruct.inc
 
 Style Abstract
index 4336571f90c53884ca97b459d6d467b4a0e7a2b4..b350d0be2c340fcfce9007c06087817a59f0ed42 100644 (file)
@@ -82,6 +82,7 @@ Style Bibliography
 Input stdlists.inc
 Input stdlayouts.inc
 Input stdsections.inc
+Input stdtitle.inc
 Input stdstruct.inc
 
 # Remove unwanted Styles
index 432cba44419f1eb4cd8fa34dc0d96a61dedd41bb..cdd776061c77128e3f0a2e0a97234599b99cff8e 100644 (file)
@@ -121,6 +121,7 @@ Style NoteToEditor
 # First, the standard includes
 
 Input stdsections.inc
+Input stdtitle.inc
 Input stdstruct.inc
 Input stdlists.inc
 
index b69ccbdd293eb01cbd082fd56ac9639ac6c4ce4b..787d9ec2bcb9e510be3e5fcc4378beff0673993c 100644 (file)
@@ -233,6 +233,7 @@ Style Right_Address
   AlignPossible                Left, Right
 End
  
+Input stdtitle.inc
 Input stdstruct.inc
 # Input lyxmacros.inc
 NoStyle Abstract
index f2ac43fd98a0c67e5a946a4edebd2050881dee7a..ed01ff9c10669a3faeb479ffa2655d11736d4d0c 100644 (file)
@@ -131,6 +131,7 @@ Style CrossList
 End
 
 # Then the Titles stuff.
+Input stdtitle.inc
 Input stdstruct.inc
 
 # Title style definition. 
index 6dcd7b5974583c712b519d80e6a3e49989345e58..800ac81bfa5344eb68aef9632ea7e371ceec5d5a 100644 (file)
@@ -257,6 +257,7 @@ Style Title
 
 End
  
+Input stdtitle.inc
 Input stdstruct.inc
 # Input lyxmacros.inc
 NoStyle Abstract
index 905014e1b2b40959437fa80e9d34f44e230a886f..0ae48b75ff41f8f4bd29916fbab350410b80e0fc 100644 (file)
@@ -90,6 +90,7 @@ NoStyle                       Chapter
 NoStyle                        Chapter*
 
 # Some standard layouts 
+Input stdtitle.inc
 Input stdstruct.inc
 Input lyxmacros.inc
 Input stdlayouts.inc
index 5041393b6f54b56d45e88ddecdf66c98362875d8..f908e054acb2f840fe636e3e43e24a980a428cbd 100644 (file)
@@ -97,6 +97,7 @@ Input stdlayouts.inc
 Input stdlists.inc
 
 ################ STRUCTURE OF THE DOCUMENT
+Input stdtitle.inc
 Input stdstruct.inc
 
 # Title style definition
index 5e563dd4c11ab5c357e0f81ce13e330e7beac2ca..e848a70b84f9ea3cc79958cd0670e5160306a561 100644 (file)
@@ -106,6 +106,7 @@ Input stdlayouts.inc
 Input stdlists.inc
 
 ################ STRUCTURE OF THE DOCUMENT
+Input stdtitle.inc
 Input stdstruct.inc
 
 # Preprint style
index de2b3766bea69a270c943f0db030942c99d9c8f6..de195fd96c9be319e2af0287d06231cd63c6d8a4 100644 (file)
@@ -141,7 +141,7 @@ Style Minisec
   EndFont
 End
 
-Input stdstruct.inc
+Input stdtitle.inc
 
 # Modify Title
 Style Title
@@ -165,20 +165,6 @@ Style Date
   EndFont
 End
 
-# Modify Abstract
-Style Abstract
-  LabelFont
-    Family              Sans
-  EndFont
-End
-
-# Modify Bibliography
-Style Bibliography
-  LabelFont
-    Family              Sans
-  EndFont
-End
-
 # Subject style definition
 Style Subject
   CopyStyle             Author
@@ -227,6 +213,22 @@ Style Extratitle
   LatexName             extratitle
 End
 
+Input stdstruct.inc
+
+# Modify Abstract
+Style Abstract
+  LabelFont
+    Family              Sans
+  EndFont
+End
+
+# Modify Bibliography
+Style Bibliography
+  LabelFont
+    Family              Sans
+  EndFont
+End
+
 Input stdlayouts.inc
 Input lyxmacros.inc
 Input scrmacros.inc
index a5609ff8ec22503fe7ee51135f1cba29004ddd2e..06785745dc9063bb4edfb1d5a675b427b11d0b08 100644 (file)
@@ -37,6 +37,7 @@ End
 Input stdlists.inc
 Input stdsections.inc
 Input stdstarsections.inc
+Input stdtitle.inc
 Input stdstruct.inc
 Input lyxmacros.inc
 Input stdlayouts.inc
index cd97f7958bb49da69edac2e2d8438c840dbebd35..864af1efa82a6db23319c4dd2f8ee52173152e88 100644 (file)
@@ -2,76 +2,11 @@
 # Author : Matthias Ettrich <ettrich@informatik.uni-tuebingen.de>
 # Transposed by Pascal André <andre@via.ecp.fr>
 # Heavily modifed and enhanced by several developers.
+# Title definitions moved to stdtitle.inc by HArtmut Goebel <harmut@noris.net>
 
 # This include files contains all layouts that handle the structure of
-# a document, like titles and such.
+# a document, like abstract, bibliography and such.
 
-# Title style definition
-Style Title
-  Margin               Static
-  LatexType            Command
-  InTitle              1
-  LatexName            title
-  ParSkip              0.4
-  ItemSep              0
-  TopSep               0
-  BottomSep            1
-  ParSep               1
-  Align                        Center
-  AlignPossible                Center
-  LabelType            No_Label
-
-  # standard font definition
-  Font 
-    Size               Largest
-  EndFont
-
-End
-
-# Author style definition
-Style Author
-  Margin               Static
-  LatexType            Command
-  InTitle              1
-  LatexName            author
-  LabelSep             xxx
-  ParSkip              0.4
-  TopSep               1.3
-  BottomSep            0.7
-  ParSep               0.7
-  Align                        Center
-  AlignPossible                Center
-  LabelType            No_Label
-
-  # standard font definition
-  Font 
-    Size               Large
-  EndFont
-
-End
-
-# Date style definition
-Style Date
-  Margin               Dynamic
-  LatexType            Command
-  InTitle              1
-  LatexName            date
-  LabelSep             xxx
-  ParSkip              0.4
-  TopSep               0.9
-  BottomSep            0.5
-  ParSep               1
-  Align                        Center
-  AlignPossible                Center
-  LabelType            No_Label
-
-
-  # standard font definition
-  Font 
-    Size               Large
-  EndFont
-
-End
 
 # Abstract style definition
 Style Abstract 
diff --git a/lib/layouts/stdtitle.inc b/lib/layouts/stdtitle.inc
new file mode 100644 (file)
index 0000000..524c1c9
--- /dev/null
@@ -0,0 +1,75 @@
+# Standard textclass definition file. Taken from initial LyX source code
+# Author : Matthias Ettrich <ettrich@informatik.uni-tuebingen.de>
+# Transposed by Pascal André <andre@via.ecp.fr>
+# Heavily modifed and enhanced by several developers.
+# Split from stdstruct.inc by Hartmut Goebel <hartmut@noris.net>
+
+# This include files contains all layouts that handle the title area
+# a document, like title, author and such.
+
+# Title style definition
+Style Title
+  Margin               Static
+  LatexType            Command
+  InTitle              1
+  LatexName            title
+  ParSkip              0.4
+  ItemSep              0
+  TopSep               0
+  BottomSep            1
+  ParSep               1
+  Align                        Center
+  AlignPossible                Center
+  LabelType            No_Label
+
+  # standard font definition
+  Font 
+    Size               Largest
+  EndFont
+
+End
+
+# Author style definition
+Style Author
+  Margin               Static
+  LatexType            Command
+  InTitle              1
+  LatexName            author
+  LabelSep             xxx
+  ParSkip              0.4
+  TopSep               1.3
+  BottomSep            0.7
+  ParSep               0.7
+  Align                        Center
+  AlignPossible                Center
+  LabelType            No_Label
+
+  # standard font definition
+  Font 
+    Size               Large
+  EndFont
+
+End
+
+# Date style definition
+Style Date
+  Margin               Dynamic
+  LatexType            Command
+  InTitle              1
+  LatexName            date
+  LabelSep             xxx
+  ParSkip              0.4
+  TopSep               0.9
+  BottomSep            0.5
+  ParSep               1
+  Align                        Center
+  AlignPossible                Center
+  LabelType            No_Label
+
+
+  # standard font definition
+  Font 
+    Size               Large
+  EndFont
+
+End
index 5f7bfcb5c7970ca9e41e5ff765c34489140fdf76..6bd1f5d26544de410bb3e466d450942c8e7de084 100644 (file)
 # SGML or plain text). Default is 75. 
 #\ascii_linelen 80
 
+# Set to false if you don't want LyX to create backup files.
+# Default is true.
+#\make_backup true
+
+# The path for storing backup files. If it is the empty string, LyX will
+# store the backup file in the same directory of the original file.
+# Default is "".
+#\backupdir_path "~/Desktop/Trash/"
+
 
 #
 # FAX SECTION #############################################################
 #
 #\date_insert_format "%A, %e. %B %Y"
 
+#
+# LANGUAGE SUPPORT SECTION ####################################################
+#
+
+# Set to true to enable support of right-to-left languages (e.g. Hebrew,
+# Arabic). Default is false.
+#\rtl true
+
+# If auto_mathmode is set to "true", each time a digit key is pressed,
+# LyX will automatically enter into math-mode.
+# If auto_mathmode is set to "rtl", the above behavior will take place
+# only when editing right-to-left text.
+# Default is false.
+#\auto_mathmode true
+
+# The latex command for loading the language package.
+# Default is \usepackage{babel}.
+#\language_package "\usepackage{omega}"
+
+# The latex command for changing the from the language of the document
+# to another language. $$lang is substituted by the name of the second
+# language. Default is \selectlanguage{$$lang}.
+#\language_command_begin "\begin{otherlanguage}{$$lang}"
+
+# The latex command for changing back the language to the language of
+# the document. Default is \selectlanguage{$$lang}.
+#\language_command_end "\end{otherlanguage}"
+
+# Set to false if a language switching command is needed at the beginning of
+# the document. Default is true.
+#\language_auto_begin false
+
+# Set to false if a language switching command is needed at the end of
+# the document. Default is true.
+#\language_auto_end false
+
 #
 # HEBREW SUPPORT SECTION ####################################################
 #
index 01a4988ba5efe0885e66a65d5dcf144a732c7c74..d33b423a1928fb8fecc914f82a6301126c3a0bb2 100644 (file)
@@ -28,7 +28,6 @@ src/insets/figinset.h
 src/insets/form_graphics.C
 src/insets/form_url.C
 src/insets/insetbib.C
-src/insets/inseteditor.C
 src/insets/inseterror.C
 src/insets/inseterror.h
 src/insets/insetert.C
index d047a1cdd9abd93b0b5ed3255f7393f85d90954c..9d64bf612256d2a032f64d9b18f874000c2d1a00 100644 (file)
@@ -57,7 +57,7 @@ LColor::LColor()
        fill(notebg, _("note background"), "notebg", "yellow", "notebg");
        fill(noteframe, _("note frame"), "noteframe", "black", "noteframe");
        fill(command, _("command-inset"), "command", "black", "command");
-       fill(commandbg, _("command-inset background"), "commandbg", "grey50", "commandbg");
+       fill(commandbg, _("command-inset background"), "commandbg", "grey80", "commandbg");
        fill(commandframe, _("inset frame"), "commandframe", "black", "commandframe");
        fill(accent, _("accent"), "accent", "black", "accent");
        fill(accentbg, _("accent background"), "accentbg", "offwhite", "accentbg");
index 1826584815c5e583fdfc91b1279ff6f7344ce88f..fc739c412b84e9e1d9eafb2f560d2f76dd79d4d3 100644 (file)
@@ -1093,14 +1093,19 @@ bool Buffer::readFile(LyXLex & lex, LyXParagraph * par)
 
 
 // Should probably be moved to somewhere else: BufferView? LyXView?
-bool Buffer::save(bool makeBackup) const
+bool Buffer::save() const
 {
        // We don't need autosaves in the immediate future. (Asger)
        resetAutosaveTimers();
 
        // make a backup
-       if (makeBackup) {
-               string s = fileName() + '~';
+       string s;
+       if (lyxrc.make_backup) {
+               s = fileName() + '~';
+               if (!lyxrc.backupdir_path.empty())
+                       s = AddName(lyxrc.backupdir_path,
+                                   subst(CleanupPath(s),'/','!'));
+
                // Rename is the wrong way of making a backup,
                // this is the correct way.
                /* truss cp fil fil2:
@@ -1168,8 +1173,7 @@ bool Buffer::save(bool makeBackup) const
                }
        } else {
                // Saving failed, so backup is not backup
-               if (makeBackup) {
-                       string s = fileName() + '~';
+               if (lyxrc.make_backup) {
                        ::rename(s.c_str(), fileName().c_str());
                }
                return false;
index 9a58df3282d83f3b239c921ba2036758398d0d86..0c0262beab4892502c8f3122df3e40c573f60aef 100644 (file)
@@ -143,7 +143,7 @@ public:
            Takes care of auto-save files and backup file if requested.
            Returns true if the save is successful, false otherwise.
        */
-       bool save(bool makeBackup) const;
+       bool save() const;
        
        /// Write file. Returns false if unsuccesful.
        bool writeFile(string const &, bool) const;
index 47f2e9b25805ac28e6f0e739cae43bc0b3028e8b..e47f83ccadb09273c1282a4bb2e9b64ef4dfdd41 100644 (file)
@@ -156,7 +156,7 @@ bool BufferList::close(Buffer * buf)
                                       MakeDisplayPath(buf->fileName(), 50),
                                       _("Save document?"))){
                case 1: // Yes
-                       if (buf->save(lyxrc.make_backup)) {
+                       if (buf->save()) {
                                lastfiles->newFile(buf->fileName());
                        } else {
                                AllowInput();
index b38c864729baf0bd660abddd77918e7e37b7c142..7887b6f6ae4e8a4abeb345a766092c2540f28589 100644 (file)
@@ -220,7 +220,8 @@ InsetBibKey::InsetBibKey(InsetBibKey const * b):
 InsetBibKey::~InsetBibKey()
 {
        if(bibitem_form && bibitem_form->bibitem_form
-          && bibitem_form->bibitem_form->visible)
+          && bibitem_form->bibitem_form->visible
+          && bibitem_form->bibitem_form->u_vdata == &holder)
                fl_hide_form(bibitem_form->bibitem_form);
 }
 
@@ -303,6 +304,14 @@ InsetBibtex::InsetBibtex(string const & dbase, string const & style,
 {
 }
 
+InsetBibtex::~InsetBibtex()
+{
+       if(bibitem_form && bibitem_form->bibitem_form
+          && bibitem_form->bibitem_form->visible
+          && bibitem_form->bibitem_form->u_vdata == &holder)
+               fl_hide_form(bibitem_form->bibitem_form);
+}
+
 
 string InsetBibtex::getScreenLabel() const
 {
@@ -404,7 +413,7 @@ string InsetBibtex::getKeys(char delim)
 
 
 // BibTeX should have its own dialog. This is provisional.
-void InsetBibtex::Edit(BufferView *, int, int, unsigned int)
+void InsetBibtex::Edit(BufferView * bv, int, int, unsigned int)
 {
        if (!bibitem_form) {
                bibitem_form = create_form_bibitem_form();
@@ -412,7 +421,10 @@ void InsetBibtex::Edit(BufferView *, int, int, unsigned int)
                                    CancelCloseBoxCB, 0);
        }
 
-       bibitem_form->bibitem_form->u_vdata = this;
+       holder.inset = this;
+       holder.view = bv;
+       bibitem_form->bibitem_form->u_vdata = &holder;
+
        fl_set_object_label(bibitem_form->key, _("Database:"));
        fl_set_object_label(bibitem_form->label, _("Style:  "));
        fl_set_input(bibitem_form->key, getContents().c_str());
index 5db38469980cb018e35346b2e3b04ebd9d7e9ddd..90bd3dfbcd2e04c9e9cf51a52fd3ecc76a4ed9a1 100644 (file)
@@ -113,6 +113,9 @@ public:
        ///
        InsetBibtex(string const & dbase, string const & style,
                    Buffer *);
+       ///
+       ~InsetBibtex();
+
         ///
        Inset * Clone() const {
                return new InsetBibtex(contents, options, 0);
@@ -139,10 +142,19 @@ public:
         ///
         bool delDatabase(string const &);
        ///
-       bool display() const { return true; }    
+       bool display() const { return true; } 
+
+       struct Holder {
+               InsetBibtex * inset;
+               BufferView * view;
+       };
+
 private:
        ///
        mutable Buffer * owner;
+
+       ///
+       Holder holder;
 };
 
 #endif
index c94abb3c4c4be3d2365324db2e0f08a6b750047d..48ac8b47bb9da79074e077b6120a463f608e5d5c 100644 (file)
@@ -13,6 +13,8 @@
 #include <fstream>
 
 using std::ifstream;
+using std::copy;
+using std::back_inserter;
 
 #include "LString.h"
 #include "support/lstrings.h"
@@ -276,7 +278,7 @@ void SetUpdateTimer(float time)
 void MenuWrite(Buffer * buffer)
 {
        XFlush(fl_display);
-       if (!buffer->save(lyxrc.make_backup)) {
+       if (!buffer->save()) {
                string fname = buffer->fileName();
                string s = MakeAbsPath(fname);
                if (AskQuestion(_("Save failed. Rename and try again?"),
index 92090ce0ea77f9ead69561f6baaebdac36865026..9b71b5f7f206460c95b904468f97296e3cee565f 100644 (file)
@@ -132,6 +132,7 @@ enum LyXRCTags {
        RC_RELYX_COMMAND,
        RC_HTML_COMMAND,
        RC_MAKE_BACKUP,
+       RC_BACKUPDIR_PATH,
        RC_RTL_SUPPORT,
        RC_AUTO_MATHMODE,
        RC_LANGUAGE_PACKAGE,
@@ -160,6 +161,7 @@ keyword_item lyxrcTags[] = {
        { "\\auto_region_delete", RC_AUTOREGIONDELETE },
        { "\\autosave", RC_AUTOSAVE },
        { "\\background_color", RC_BACKGROUND_COLOR },
+       { "\\backupdir_path", RC_BACKUPDIR_PATH },
        { "\\begin_toolbar", RC_BEGINTOOLBAR },
        { "\\bind", RC_BIND },
        { "\\bind_file", RC_BINDFILE },
@@ -334,6 +336,7 @@ void LyXRC::setDefaults() {
        num_lastfiles = 4;
        check_lastfiles = true;
        make_backup = true;
+       backupdir_path = "";
        exit_confirmation = true;
        display_shortcuts = true;
        // Spellchecker settings:
@@ -947,6 +950,10 @@ int LyXRC::read(string const & filename)
                        if (lexrc.next())
                                make_backup = lexrc.GetBool();
                        break;
+               case RC_BACKUPDIR_PATH:
+                       if (lexrc.next())
+                               backupdir_path = ExpandPath(lexrc.GetString());
+                       break;
                case RC_DATE_INSERT_FORMAT:
                        if (lexrc.next())
                                date_insert_format = lexrc.GetString();
@@ -1293,6 +1300,8 @@ void LyXRC::output(ostream & os) const
                   << "\"\n";
        case RC_MAKE_BACKUP:
                os << "\\make_backup " << tostr(make_backup) << "\n";
+       case RC_BACKUPDIR_PATH:
+               os << "\\backupdir_path" << backupdir_path << "\n";
        case RC_DATE_INSERT_FORMAT:
                os << "\\date_insert_format \"" << date_insert_format
                   << "\"\n";
index 9cab1ff5e0fe04c484f5b8a5a960e445256aa257..fffbdccf464ac651101ab511f4135713e4234283 100644 (file)
@@ -140,6 +140,8 @@ public:
        unsigned int num_lastfiles;
        /// shall a backup file be created
        bool make_backup;
+       /// A directory for storing backup files
+       string backupdir_path;
        /// Zoom factor for screen fonts
        unsigned int zoom;
        /// Screen font sizes in points for each font size