]> git.lyx.org Git - lyx.git/commitdiff
Added function firstRow() to LyXText as this function is needed in
authorJürgen Vigna <jug@sad.it>
Thu, 29 Nov 2001 13:43:12 +0000 (13:43 +0000)
committerJürgen Vigna <jug@sad.it>
Thu, 29 Nov 2001 13:43:12 +0000 (13:43 +0000)
various files and as workaround always getRowNearY(dummy_y = 0) was
used.

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

po/POTFILES.in
src/ChangeLog
src/debug.C
src/insets/ChangeLog
src/insets/insettext.C
src/lyxtext.h

index 60d41c124159b8f7051a1773f439093efc496817..43f1bf43df7a7c835b28639680d21db205d500d7 100644 (file)
@@ -1,24 +1,21 @@
+src/buffer.C
+src/bufferlist.C
 src/BufferView2.C
+src/bufferview_funcs.C
 src/BufferView_pimpl.C
 src/Chktex.C
 src/ColorHandler.C
-src/CutAndPaste.C
-src/FontLoader.C
-src/LColor.C
-src/LaTeX.C
-src/LyXAction.C
-src/LyXSendto.C
-src/LyXView.C
-src/MenuBackend.C
-src/buffer.C
-src/bufferlist.C
-src/bufferview_funcs.C
 src/converter.C
+src/CutAndPaste.C
 src/debug.C
 src/exporter.C
-src/figureForm.C
+src/ext_l10n.h
 src/figure_form.C
+src/figureForm.C
+src/FontLoader.C
+src/frontends/controllers/biblio.C
 src/frontends/controllers/ButtonController.h
+src/frontends/controllers/character.C
 src/frontends/controllers/ControlAboutlyx.C
 src/frontends/controllers/ControlBibtex.C
 src/frontends/controllers/ControlCharacter.C
@@ -32,8 +29,6 @@ src/frontends/controllers/ControlSpellchecker.C
 src/frontends/controllers/ControlTexinfo.C
 src/frontends/controllers/ControlThesaurus.C
 src/frontends/controllers/ControlVCLog.C
-src/frontends/controllers/biblio.C
-src/frontends/controllers/character.C
 src/frontends/controllers/helper_funcs.C
 src/frontends/gnome/FormCitation.C
 src/frontends/gnome/FormIndex.C
@@ -42,6 +37,7 @@ src/frontends/gnome/FormRef.C
 src/frontends/gnome/FormToc.C
 src/frontends/gnome/Menubar_pimpl.C
 src/frontends/qt2/FileDialog.C
+src/frontends/qt2/lengthcombo.C
 src/frontends/qt2/QAbout.C
 src/frontends/qt2/QBibitem.C
 src/frontends/qt2/QBibtex.C
@@ -50,8 +46,8 @@ src/frontends/qt2/QCharacter.C
 src/frontends/qt2/QCitation.C
 src/frontends/qt2/QCitationDialog.C
 src/frontends/qt2/QDocument.C
-src/frontends/qt2/QERT.C
 src/frontends/qt2/QError.C
+src/frontends/qt2/QERT.C
 src/frontends/qt2/QExternal.C
 src/frontends/qt2/QExternalDialog.C
 src/frontends/qt2/QGraphics.C
@@ -73,88 +69,87 @@ src/frontends/qt2/QThesaurus.C
 src/frontends/qt2/QToc.C
 src/frontends/qt2/QURL.C
 src/frontends/qt2/QVCLog.C
-src/frontends/qt2/lengthcombo.C
 src/frontends/xforms/Alert_pimpl.C
+src/frontends/xforms/combox.C
 src/frontends/xforms/FileDialog.C
+src/frontends/xforms/form_aboutlyx.C
 src/frontends/xforms/FormAboutlyx.C
+src/frontends/xforms/form_bibitem.C
 src/frontends/xforms/FormBibitem.C
+src/frontends/xforms/form_bibtex.C
 src/frontends/xforms/FormBibtex.C
+src/frontends/xforms/form_browser.C
+src/frontends/xforms/form_character.C
 src/frontends/xforms/FormCharacter.C
+src/frontends/xforms/form_citation.C
 src/frontends/xforms/FormCitation.C
+src/frontends/xforms/form_document.C
 src/frontends/xforms/FormDocument.C
-src/frontends/xforms/FormERT.C
+src/frontends/xforms/form_error.C
 src/frontends/xforms/FormError.C
+src/frontends/xforms/form_ert.C
+src/frontends/xforms/FormERT.C
+src/frontends/xforms/form_external.C
 src/frontends/xforms/FormExternal.C
+src/frontends/xforms/form_filedialog.C
 src/frontends/xforms/FormFiledialog.C
+src/frontends/xforms/form_float.C
 src/frontends/xforms/FormFloat.C
+src/frontends/xforms/form_graphics.C
 src/frontends/xforms/FormGraphics.C
+src/frontends/xforms/form_include.C
 src/frontends/xforms/FormInclude.C
+src/frontends/xforms/form_index.C
 src/frontends/xforms/FormIndex.C
 src/frontends/xforms/FormLog.C
 src/frontends/xforms/FormMathsBitmap.C
+src/frontends/xforms/form_maths_deco.C
 src/frontends/xforms/FormMathsDeco.C
+src/frontends/xforms/form_maths_delim.C
 src/frontends/xforms/FormMathsDelim.C
+src/frontends/xforms/form_maths_matrix.C
 src/frontends/xforms/FormMathsMatrix.C
+src/frontends/xforms/form_maths_panel.C
 src/frontends/xforms/FormMathsPanel.C
+src/frontends/xforms/form_maths_space.C
 src/frontends/xforms/FormMathsSpace.C
+src/frontends/xforms/form_minipage.C
 src/frontends/xforms/FormMinipage.C
+src/frontends/xforms/form_paragraph.C
 src/frontends/xforms/FormParagraph.C
+src/frontends/xforms/form_preamble.C
 src/frontends/xforms/FormPreamble.C
+src/frontends/xforms/form_preferences.C
 src/frontends/xforms/FormPreferences.C
+src/frontends/xforms/form_print.C
 src/frontends/xforms/FormPrint.C
+src/frontends/xforms/form_ref.C
 src/frontends/xforms/FormRef.C
+src/frontends/xforms/form_search.C
 src/frontends/xforms/FormSearch.C
+src/frontends/xforms/form_spellchecker.C
 src/frontends/xforms/FormSpellchecker.C
+src/frontends/xforms/form_tabular.C
 src/frontends/xforms/FormTabular.C
+src/frontends/xforms/form_tabular_create.C
 src/frontends/xforms/FormTabularCreate.C
+src/frontends/xforms/form_texinfo.C
 src/frontends/xforms/FormTexinfo.C
+src/frontends/xforms/form_thesaurus.C
 src/frontends/xforms/FormThesaurus.C
+src/frontends/xforms/form_toc.C
 src/frontends/xforms/FormToc.C
+src/frontends/xforms/form_url.C
 src/frontends/xforms/FormUrl.C
 src/frontends/xforms/FormVCLog.C
-src/frontends/xforms/Menubar_pimpl.C
-src/frontends/xforms/combox.C
-src/frontends/xforms/form_aboutlyx.C
-src/frontends/xforms/form_bibitem.C
-src/frontends/xforms/form_bibtex.C
-src/frontends/xforms/form_browser.C
-src/frontends/xforms/form_character.C
-src/frontends/xforms/form_citation.C
-src/frontends/xforms/form_document.C
-src/frontends/xforms/form_error.C
-src/frontends/xforms/form_ert.C
-src/frontends/xforms/form_external.C
-src/frontends/xforms/form_filedialog.C
-src/frontends/xforms/form_float.C
-src/frontends/xforms/form_graphics.C
-src/frontends/xforms/form_include.C
-src/frontends/xforms/form_index.C
-src/frontends/xforms/form_maths_deco.C
-src/frontends/xforms/form_maths_delim.C
-src/frontends/xforms/form_maths_matrix.C
-src/frontends/xforms/form_maths_panel.C
-src/frontends/xforms/form_maths_space.C
-src/frontends/xforms/form_minipage.C
-src/frontends/xforms/form_paragraph.C
-src/frontends/xforms/form_preamble.C
-src/frontends/xforms/form_preferences.C
-src/frontends/xforms/form_print.C
-src/frontends/xforms/form_ref.C
-src/frontends/xforms/form_search.C
-src/frontends/xforms/form_spellchecker.C
-src/frontends/xforms/form_tabular.C
-src/frontends/xforms/form_tabular_create.C
-src/frontends/xforms/form_texinfo.C
-src/frontends/xforms/form_thesaurus.C
-src/frontends/xforms/form_toc.C
-src/frontends/xforms/form_url.C
 src/frontends/xforms/input_validators.C
+src/frontends/xforms/Menubar_pimpl.C
 src/frontends/xforms/xforms_helpers.C
 src/gettext.h
 src/importer.C
 src/insets/figinset.C
-src/insets/inset.C
 src/insets/insetbib.C
+src/insets/inset.C
 src/insets/insetcaption.C
 src/insets/inseterror.C
 src/insets/insetert.C
@@ -179,18 +174,24 @@ src/insets/insettoc.C
 src/insets/inseturl.C
 src/kbsequence.C
 src/language.C
+src/LaTeX.C
 src/layout.C
+src/LColor.C
+src/LyXAction.C
 src/lyx_cb.C
-src/lyx_main.C
 src/lyxfind.C
 src/lyxfont.C
 src/lyxfunc.C
+src/lyx_main.C
 src/lyxrc.C
+src/LyXSendto.C
 src/lyxvc.C
-src/mathed/formula.C
+src/LyXView.C
 src/mathed/formulabase.C
+src/mathed/formula.C
 src/mathed/formulamacro.C
 src/mathed/math_cursor.C
+src/MenuBackend.C
 src/minibuffer.C
 src/paragraph.C
 src/print_form.C
@@ -199,6 +200,6 @@ src/support/getUserName.C
 src/support/path.C
 src/support/path.h
 src/tabular.C
-src/text.C
 src/text2.C
+src/text.C
 src/ext_l10n.h
index 4a750b28874541673102a960f43aa5130af562b6..9692cc281b2fffab5471f50b82f4e0a666af4783 100644 (file)
@@ -1,5 +1,8 @@
 2001-11-29  Juergen Vigna  <jug@sad.it>
 
+       * lyxtext.h: added helper function firstRow returning firstrow and
+       made firstrow private again.
+
        * BufferView2.C (lockInset): don't relock if we're already locked!
 
        * text2.C (deleteEmptyParagraphMechanism): don't do anything if it's
index d2232904cd79f74af6d5b22c5f5ccc68961f7a75..fcc14891cb03bda5d207dff153776108a9e0a55d 100644 (file)
@@ -69,7 +69,8 @@ Debug::type const Debug::ANY = Debug::type(
        Debug::PARSER | Debug::LYXRC | Debug::KBMAP | Debug::LATEX |
        Debug::MATHED | Debug::FONT | Debug::TCLASS | Debug::LYXVC |
        Debug::LYXSERVER | Debug::ROFF | Debug::ACTION | Debug::LYXLEX |
-       Debug::DEPEND | Debug::INSETS | Debug::FILES | Debug::WORKAREA);
+       Debug::DEPEND | Debug::INSETS | Debug::FILES | Debug::WORKAREA |
+       Debug::INSETTEXT);
 
 
 Debug::type Debug::value(string const & val) 
index 8536c60f2669ce81591389fa183ca3f06da89b51..310c2b173960938f9bf1d18e1f69b1da0a7d376f 100644 (file)
@@ -2,6 +2,7 @@
 
        * insettext.C: inserted a reinitLyXText function everywhere I delete
        the paragraphs! This should fixe the crashes we had.
+       Also use the new function firstRow() instead of getRowNearY(dummy_y)
 
 2001-11-28  André Pönitz <poenitz@gmx.net>
 
index e1737edafd50afda2e0d25345583e7a6ecb5fbec..c85c6be95f6b7667c69f05453e023ce78bb2e8dd 100644 (file)
@@ -291,9 +291,14 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
 
 int InsetText::ascent(BufferView * bv, LyXFont const &) const
 {
-       int y_temp = 0;
-       Row * row = getLyXText(bv)->getRowNearY(y_temp);
-       insetAscent = row->ascent_of_text() + TEXT_TO_INSET_OFFSET;
+       bool clear = false;
+       if (!lt) {
+               lt = getLyXText(bv);
+               clear = true;
+       }
+       insetAscent = lt->firstRow()->ascent_of_text() + TEXT_TO_INSET_OFFSET;
+       if (clear)
+               lt = 0;
        return insetAscent;
 }
 
@@ -305,10 +310,8 @@ int InsetText::descent(BufferView * bv, LyXFont const &) const
                lt = getLyXText(bv);
                clear = true;
        }
-       int y_temp = 0;
-       Row * row = lt->getRowNearY(y_temp);
-       insetDescent = lt->height - row->ascent_of_text() +
-       TEXT_TO_INSET_OFFSET;
+       insetDescent = lt->height - lt->firstRow()->ascent_of_text() +
+               TEXT_TO_INSET_OFFSET;
        if (clear)
                lt = 0;
        return insetDescent;
@@ -440,12 +443,11 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
        }
        x += TEXT_TO_INSET_OFFSET;
 
-       int y = 0;
-       Row * row = lt->getRowNearY(y);
+       Row * row = lt->firstRow();
        int y_offset = baseline - row->ascent_of_text();
        int ph = pain.paperHeight();
        int first = 0;
-       y = y_offset;
+       int y = y_offset;
        while ((row != 0) && ((y+row->height()) <= 0)) {
                y += row->height();
                first += row->height();
@@ -2042,7 +2044,7 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
 {
        if (!recursive && (cached_bview == lbv)) {
                LyXText * lt = cached_text.get();
-               lyx::Assert(lt && lt->firstrow->par() == par);
+               lyx::Assert(lt && lt->firstRow()->par() == par);
                return cached_text.get();
        }
        
@@ -2420,10 +2422,9 @@ void InsetText::toggleSelection(BufferView * bv, bool kill_selection)
 
        int x = top_x + TEXT_TO_INSET_OFFSET;
 
-       int y = 0;
-       Row * row = lt->getRowNearY(y);
+       Row * row = lt->firstRow();
        int y_offset = top_baseline - row->ascent_of_text();
-       y = y_offset;
+       int y = y_offset;
        while ((row != 0) && ((y+row->height()) <= 0)) {
                y += row->height();
                row = row->next();
index 601f7960f1a8562e8f1446ea89e0e5dba1ad04d5..fdc849bfa78f563da504cacc950568111af27076 100644 (file)
@@ -227,7 +227,12 @@ public:
         */
        Row * getRow(Paragraph * par,
                     lyx::pos_type pos, int & y) const;
-
+       /** returns the firstrow, this could be done with the above too but
+           IMO it's stupid to have to allocate a dummy y all the time I need
+           the first row
+       */
+       Row * firstRow() { return firstrow; }
+                       
        /** returns the height of a default row, needed  for scrollbar
         */
        int defaultHeight() const;
@@ -501,10 +506,9 @@ public:
                return bidi_start == -1 ||
                        (bidi_start <= pos && pos <= bidi_end);
        }
-public:
+private:
        ///
        mutable Row * firstrow;
-private:
        ///
        mutable Row * lastrow;