]> git.lyx.org Git - features.git/commitdiff
fix the reformat bug, some small things
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 3 Feb 2000 17:09:33 +0000 (17:09 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 3 Feb 2000 17:09:33 +0000 (17:09 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@521 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
acinclude.m4
config/lyxinclude.m4
src/BufferView.C
src/bufferlist.C
src/bufferlist.h
src/lyxrc.C
src/mathed/math_iter.C
src/support/lyxsum.C

index 7ef80a9ea1f7e25597ae73a4df03d00245e76e4d..c20585cd470b4e3255a9bcf4ba7031a2c0774675 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2000-02-03  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/lyxrc.C (output): added case RC_DATE_INSERT_FORMAT. Jug
+       forgot this when applying the patch. Please heed the warnings.
+
+       * src/BufferView.C (buffer): a fix for the buffer-reload problem
+       (aka. reformat problem)
+
+       * src/bufferlist.C (exists): made const, and use const_iterator
+       (isLoaded): new func.
+       (release): use std::find to find the correct buffer.
+
+       * src/bufferlist.h: made getState a const func.
+       made empty a const func.
+       made exists a const func.
+       new func: isLoaded
+
 2000-02-01  Juergen Vigna  <jug@sad.it>
 
        * src/lyxfunc.C lyxrc.C: changed from insert-date to date-insert
index 00ad1f508ea3be410750a50a1f955c2f1204395e..5a04deef980ab62e5a094a1af3bde6df4aa8aa77 100644 (file)
@@ -186,6 +186,7 @@ dnl Check the version of g++
       2.7*) CXXFLAGS="$lyx_opt";;
       2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
       2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
+      *2.91.*) CXXFLAGS="-g $lyx_opt -Wno-return-type -fno-exceptions -fno-rtti";;
       *)    CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
     esac
   else
index 2638e3b88fdd5cd52cd417ca92a08babbf1d6734..7209fa1b7a1d35c4eb55db98cc538cca0de784b2 100644 (file)
@@ -186,6 +186,7 @@ dnl Check the version of g++
       2.7*) CXXFLAGS="$lyx_opt";;
       2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
       2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
+      *2.91.*) CXXFLAGS="-g $lyx_opt -Wno-return-type -fno-exceptions -fno-rtti";;
       *)    CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
     esac
   else
index b89f9711c1e0375e0e60ec6384ccc1b745b8d7bf..994e28c095d91357938768cca192d20b4d0965e5 100644 (file)
@@ -211,10 +211,12 @@ void BufferView::buffer(Buffer * b)
                insetSleep();
                buffer_->delUser(this);
                // Put the old text into the TextCache.
-               textcache.push_back(text);
+               if (bufferlist.isLoaded(buffer_))
+                       textcache.push_back(text);
+               else
+                       delete text;
                if (lyxerr.debugging())
                        showTextCache("buffer");
-               // delete text;
                text = 0;
        }
 
index 5fdc5cd158cf7b41c0481f1c322b073602bedb79..03bbaeea256b53f8d5c4b866c792d50c42e896df 100644 (file)
@@ -4,9 +4,9 @@
  *           LyX, The Document Word Processor
  *
  *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-1999 The LyX Team. 
+ *          Copyright 1995-2000 The LyX Team. 
  *
- *           This file is Copyright 1996-1999
+ *           This file is Copyright 1996-2000
  *           Lars Gullik Bjønnes
  *
  * ====================================================== 
@@ -19,6 +19,8 @@
 #include <config.h>
 
 #include <fstream>
+#include <algorithm>
+
 #include <sys/types.h>
 #include <utime.h>
 
@@ -44,21 +46,18 @@ extern int RunLinuxDoc(int, string const &);
 using std::ifstream;
 using std::ofstream;
 using std::ios;
-
+using std::find;
 //
 // Class BufferStorage
 //
 
 void BufferStorage::release(Buffer * buf)
 {
-       for(Container::iterator it = container.begin();
-           it != container.end(); ++it) {
-               if ((*it) == buf) {
-                       Buffer * tmpbuf = (*it);
-                       container.erase(it);
-                       delete tmpbuf;
-                       break;
-               }
+       Container::iterator it = find(container.begin(), container.end(), buf);
+       if (it != container.end()) {
+               Buffer * tmp = (*it);
+               container.erase(it);
+               delete tmp;
        }
 }
 
@@ -85,7 +84,7 @@ BufferList::BufferList()
 {}
 
 
-bool BufferList::empty()
+bool BufferList::empty() const
 {
        return bstore.empty();
 }
@@ -476,17 +475,25 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
 }
 
 
-bool BufferList::exists(string const & s)
+bool BufferList::exists(string const & s) const
 {
-       for (BufferStorage::iterator it = bstore.begin();
-            it != bstore.end(); ++it) {
-               if ((*it)->fileName() == s)
+       for (BufferStorage::const_iterator cit = bstore.begin();
+            cit != bstore.end(); ++cit) {
+               if ((*cit)->fileName() == s)
                        return true;
        }
        return false;
 }
 
 
+bool BufferList::isLoaded(Buffer const * b) const
+{
+       BufferStorage::const_iterator cit =
+               find(bstore.begin(), bstore.end(), b);
+       return cit != bstore.end();
+}
+
+
 Buffer * BufferList::getBuffer(string const & s)
 {
        for(BufferStorage::iterator it = bstore.begin();
index 1c59ea8c3a5585c2bc731049f21ea900fb93d2fa..4c293af4d603a809dd316026f67f86dd5cade8a3 100644 (file)
@@ -4,9 +4,9 @@
  * 
  *           LyX, The Document Processor        
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-1999 The LyX Team
+ *           Copyright 1995-2000 The LyX Team
  *
- *           This file is Copyright 1996
+ *           This file is Copyright 1996-2000
  *           Lars Gullik Bjønnes
  *
  * ====================================================== */
@@ -82,7 +82,7 @@ public:
        };
 
        /// returns the state of the bufferlist
-       list_state getState() { return state_; }
+       list_state getState() const { return state_; }
        
        /** loads a LyX file or...
            If the optional argument tolastfiles is false (default is
@@ -93,7 +93,7 @@ public:
                             bool tolastfiles = true);
        
        ///
-       bool empty();
+       bool empty() const;
 
        /// Saves buffer. Returns false if unsuccesful.
        bool write(Buffer *, bool makeBackup);
@@ -136,7 +136,10 @@ public:
        Buffer * first();
        
        /// returns true if the buffer exists already
-       bool exists(string const &);
+       bool exists(string const &) const;
+
+       /// returns true if the buffer is loaded
+       bool isLoaded(Buffer const * b) const;
 
        /// returns a pointer to the buffer with the given name.
        Buffer * getBuffer(string const &);
index 0d4dc23cd71081245f93bda253ffd90b92e584be..b30469c415fb7da2036f2942862b2f4e05b96d60 100644 (file)
@@ -1201,6 +1201,9 @@ void LyXRC::output(ostream & os) const
                os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
        case RC_MAKE_BACKUP:
                os << "\\make_backup " << tostr(make_backup) << "\n";
+       case RC_DATE_INSERT_FORMAT:
+               os << "\\date_insert_format \"" << date_insert_format
+                  << "\"\n"; 
        }
        os.flush();
 }
index f1f2f1c2ce8795a28d8284d82459d55aa5a0026e..5c400a21979e25e77296f01fe3d7e19be674ee05 100644 (file)
@@ -591,25 +591,25 @@ bool MathedXIter::Next()
 {  
 //    lyxerr << "Ne[" << pos << "]";
    if (!OK()) return false;
-   int w= 0;
+   int w = 0;
 //   lyxerr << "xt ";
    if (IsInset()) {
-      MathedInset* px = GetInset();
+      MathedInset * px = GetInset();
       w = px->Width();
       if (px->GetType() == LM_OT_SCRIPT) {
-        if (w>sw) sw = w;
+        if (w > sw) sw = w;
         w = 0;
       } else
-       sx = (px->GetLimits()) ? w: 0;
+       sx = (px->GetLimits()) ? w : 0;
    } else {  
       byte c = GetChar();
-      if (c>= ' ') {
+      if (c >= ' ') {
 //       lyxerr << "WD[" << fcode << " " << size << " " << c << endl;
          w = mathed_char_width(fcode, size, c);
       } else
       if (c == LM_TC_TAB && p) {
 //      w = p->GetTab(col+1);
-         w = (crow) ? crow->getTab(col+1): 0;
+         w = (crow) ? crow->getTab(col + 1) : 0;
         //lyxerr << "WW[" << w << "]";
       } else
       if (c == LM_TC_CR && p) {
@@ -627,9 +627,9 @@ bool MathedXIter::Next()
 //       lyxerr <<"LNX " << pos << endl;
 //       if (sw>0 && GetChar()!= LM_TC_UP && GetChar()!= LM_TC_DOWN) {
 //        w = (sx>sw) ? 0: sw-sx;
-      if ((sw>0 || sx>0) && GetChar()!= LM_TC_UP && GetChar()!= LM_TC_DOWN) {
-         if (sw>0)
-           w = (sx>sw) ? 0: sw-sx;
+      if ((sw > 0 || sx > 0) && GetChar() != LM_TC_UP && GetChar() != LM_TC_DOWN) {
+         if (sw > 0)
+           w = (sx > sw) ? 0 : sw - sx;
          sx = sw = 0;
       }
       x += w;
index aa0c71ac225fb1d4f4530a9177d86ceef19fddf5..6c497e303d04c9198f6b063ac7813d42d4376d3b 100644 (file)
 
 
 #include <config.h>
+
+// For 1.1.4 we disable the new code:
+#ifdef MODERN_STL_STREAMS
+#undef MODERN_STL_STREAMS
+// It seems that some systems have buggy istream::readsome(...)
+#endif
+
 #ifdef MODERN_STL_STREAMS
 #include <fstream>
 using std::ifstream;