]> git.lyx.org Git - features.git/commitdiff
keep selection after font change (John), fix positionning of error insets after envir...
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 11 Dec 2001 14:33:52 +0000 (14:33 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 11 Dec 2001 14:33:52 +0000 (14:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3188 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/buffer.C
src/paragraph.C
src/text.C
src/text2.C

index 0a46dbf5be32156f489d1b26706af6d82fb07c1f..d564c506b7c84df475267a7c15bd1ea74ab11772 100644 (file)
@@ -1,3 +1,19 @@
+2001-12-11  Ben Stanley <bds02@uow.edu.au>
+
+       * paragraph.C: fixed missing line number count when exporting
+       Environments to LaTeX file
+
+       * buffer.C: added informational message for checking line numbers.
+
+2001-12-11  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
+
+       * text2.C (deleteEmptyParagraphMechanism): if there is only one
+       paragraph, do the 'double space' part, but not the 'empty
+       paragraph' one.
+
+       * text.C (workWidth): small optimization
+       (getLengthMarkerHeight): use minimal size for negative lengths. 
+
 2001-12-11  Dekel Tsur  <dekelts@tau.ac.il>
 
        * lyxfont.C (GUIFamilyNames): Fix GUIFamilyNames array
@@ -9,6 +25,10 @@
        * FontLoader.C:
        * lyxfont.[Ch]: support for fraktur font used by \mathfrak
 
+2001-12-06  John Levon  <moz@compsoc.man.ac.uk>
+
+       * text2.C: keep selection on a setFont()
 2001-12-06  John Levon  <moz@compsoc.man.ac.uk>
 
        * lyx_cb.C: another bv->text misuse, from insert label
index 48b3a755c0d1da2fb0a4dab7ed73f602d9ad166d..95de936940f74141e3899f667d8c0874de543dca 100644 (file)
@@ -2449,6 +2449,7 @@ void Buffer::makeLaTeXFile(string const & fname,
        }
        
        lyxerr[Debug::INFO] << "Finished making latex file." << endl;
+       lyxerr[Debug::INFO] << "Row count was " << texrow.rows()-1 << "." << endl;
 }
 
 
index 2a414c3134688d6c5ce35df87363b886f23a0ae5..94662b1424b4f10a2372d4af80c0b68f4c31e026 100644 (file)
@@ -1830,6 +1830,7 @@ Paragraph * Paragraph::TeXEnvironment(Buffer const * buf,
  
        if (style.isEnvironment()) {
                os << "\\end{" << style.latexname() << "}\n";
+               texrow.newline();
        }
 
        lyxerr[Debug::LATEX] << "TeXEnvironment...done " << par << endl;
index 3ff2676f674c226e2328ae22d3af720f9291db10..059ed2f8b04aedbc92cc58b0477081694ebb5e15 100644 (file)
@@ -72,8 +72,8 @@ int LyXText::workWidth(BufferView * bview, Inset * inset) const
        pos_type pos = 0;
 
        Buffer::inset_iterator it = bview->buffer()->inset_iterator_begin();
-
-       for (; it != bview->buffer()->inset_iterator_end(); ++it) {
+       Buffer::inset_iterator end = bview->buffer()->inset_iterator_end();
+       for ( ; it != end; ++it) {
                if (*it == inset) {
                        par = it.getPar();
                        pos = it.getPos();
@@ -3160,12 +3160,12 @@ void LyXText::paintRowDepthBar(DrawRowParams & p)
 
 int LyXText::getLengthMarkerHeight(BufferView * bv, VSpace const & vsp) const
 {
+       int const arrow_size = 4;
+       int const space_size = int(vsp.inPixels(bv));
+
        if (vsp.kind() != VSpace::LENGTH) {
-               return int(vsp.inPixels(bv));
+               return space_size;
        }
-
-       int const space_size = int(vsp.inPixels(bv));
-       int const arrow_size = 4;
  
        LyXFont font;
        font.decSize();
@@ -3173,7 +3173,10 @@ int LyXText::getLengthMarkerHeight(BufferView * bv, VSpace const & vsp) const
                                      lyxfont::maxAscent(font)
                                      + lyxfont::maxDescent(font));
 
-       return std::max(min_size, space_size);
+       if (vsp.length().len().value() < 0.0)
+               return min_size;
+       else 
+               return std::max(min_size, space_size);
 }
 
  
index 4ddf68cae9e2b6fe881073596a901347c4e79ba8..4ddfcffa2c8338d78cc66421514e8675b604b019 100644 (file)
@@ -790,11 +790,11 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall)
        redoParagraphs(bview, selection.start, selection.end.par()->next());
    
        // we have to reset the selection, because the
-       // geometry could have changed
+       // geometry could have changed, but we keep
+       // it for user convenience
        setCursor(bview, selection.start.par(), selection.start.pos());
        selection.cursor = cursor;
        setCursor(bview, selection.end.par(), selection.end.pos());
-       clearSelection();
        setSelection(bview);
        setCursor(bview, tmpcursor.par(), tmpcursor.pos(), true,
                  tmpcursor.boundary());
@@ -874,7 +874,7 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
                        y -= tmprow->height();
                }
        }
-       
+
        // we can set the refreshing parameters now
        status(bview, LyXText::NEED_MORE_REFRESH);
        refresh_y = y;
@@ -888,11 +888,12 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
                tmppar = 0;
        while (tmppar != endpar) {
                removeRow(tmprow->next());
-               if (tmprow->next())
+               if (tmprow->next()) {
                        tmppar = tmprow->next()->par();
-               else
+               } else {
                        tmppar = 0;
-       }  
+               }
+       }
    
        // remove the first one
        tmprow2 = tmprow;     /* this is because tmprow->previous()
@@ -2369,17 +2370,13 @@ void LyXText::fixCursorAfterDelete(BufferView * bview,
 void LyXText::deleteEmptyParagraphMechanism(BufferView * bview,
                                            LyXCursor const & old_cursor) const
 {
-       // don't delete anything if this is the ONLY paragraph!
-       if (!old_cursor.par()->next() && !old_cursor.par()->previous())
-               return;
-       
        // Would be wrong to delete anything if we have a selection.
        if (selection.set()) return;
 
        // We allow all kinds of "mumbo-jumbo" when freespacing.
        if (textclasslist.Style(bview->buffer()->params.textclass,
-                                                       old_cursor.par()->getLayout()).free_spacing ||
-               old_cursor.par()->isFreeSpacing())
+                               old_cursor.par()->getLayout()).free_spacing
+           || old_cursor.par()->isFreeSpacing())
        {
                return;
        }
@@ -2410,7 +2407,8 @@ void LyXText::deleteEmptyParagraphMechanism(BufferView * bview,
        // MISSING
 
        // If the pos around the old_cursor were spaces, delete one of them.
-       if (old_cursor.par() != cursor.par() || old_cursor.pos() != cursor.pos()) { 
+       if (old_cursor.par() != cursor.par()
+           || old_cursor.pos() != cursor.pos()) { 
                // Only if the cursor has really moved
                
                if (old_cursor.pos() > 0
@@ -2442,6 +2440,10 @@ void LyXText::deleteEmptyParagraphMechanism(BufferView * bview,
                }
        }
 
+       // don't delete anything if this is the ONLY paragraph!
+       if (!old_cursor.par()->next() && !old_cursor.par()->previous())
+               return;
+       
        // Do not delete empty paragraphs with keepempty set.
        if ((textclasslist.Style(bview->buffer()->params.textclass,
                                 old_cursor.par()->getLayout())).keepempty)