]> git.lyx.org Git - features.git/commitdiff
simplify some, ws, begin minibuffer simplification
authorLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 6 Apr 2001 12:47:50 +0000 (12:47 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 6 Apr 2001 12:47:50 +0000 (12:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1905 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
po/POTFILES.in
src/BufferView2.C
src/BufferView_pimpl.C
src/ChangeLog
src/insets/ChangeLog
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/minibuffer.C
src/minibuffer.h
src/tabular.C
src/tabular.h

index f94c783564b13e70bf669fbae0e415d0623d4dba..f2125c4e5f397e675b9c6e6d48ec316469234d52 100644 (file)
@@ -10,8 +10,8 @@ src/CutAndPaste.C
 src/debug.C
 src/exporter.C
 src/ext_l10n.h
-src/figureForm.C
 src/figure_form.C
+src/figureForm.C
 src/FontLoader.C
 src/frontends/controllers/ButtonController.h
 src/frontends/controllers/character.C
@@ -90,67 +90,67 @@ src/frontends/qt2/paragraphdlgimpl.C
 src/frontends/qt2/tabularcreatedlgimpl.C
 src/frontends/xforms/combox.C
 src/frontends/xforms/FileDialog.C
-src/frontends/xforms/FormBibitem.C
 src/frontends/xforms/form_bibitem.C
-src/frontends/xforms/FormBibtex.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/FormCharacter.C
 src/frontends/xforms/form_character.C
-src/frontends/xforms/FormCitation.C
+src/frontends/xforms/FormCharacter.C
 src/frontends/xforms/form_citation.C
-src/frontends/xforms/FormCopyright.C
+src/frontends/xforms/FormCitation.C
 src/frontends/xforms/form_copyright.C
-src/frontends/xforms/FormCredits.C
+src/frontends/xforms/FormCopyright.C
 src/frontends/xforms/form_credits.C
-src/frontends/xforms/FormDocument.C
+src/frontends/xforms/FormCredits.C
 src/frontends/xforms/form_document.C
-src/frontends/xforms/FormError.C
+src/frontends/xforms/FormDocument.C
 src/frontends/xforms/form_error.C
-src/frontends/xforms/FormExternal.C
+src/frontends/xforms/FormError.C
 src/frontends/xforms/form_external.C
-src/frontends/xforms/FormFiledialog.C
+src/frontends/xforms/FormExternal.C
 src/frontends/xforms/form_filedialog.C
-src/frontends/xforms/FormGraphics.C
+src/frontends/xforms/FormFiledialog.C
 src/frontends/xforms/form_graphics.C
-src/frontends/xforms/FormInclude.C
+src/frontends/xforms/FormGraphics.C
 src/frontends/xforms/form_include.C
-src/frontends/xforms/FormIndex.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/FormMathsDeco.C
 src/frontends/xforms/form_maths_deco.C
-src/frontends/xforms/FormMathsDelim.C
+src/frontends/xforms/FormMathsDeco.C
 src/frontends/xforms/form_maths_delim.C
-src/frontends/xforms/FormMathsMatrix.C
+src/frontends/xforms/FormMathsDelim.C
 src/frontends/xforms/form_maths_matrix.C
-src/frontends/xforms/FormMathsPanel.C
+src/frontends/xforms/FormMathsMatrix.C
 src/frontends/xforms/form_maths_panel.C
-src/frontends/xforms/FormMathsSpace.C
+src/frontends/xforms/FormMathsPanel.C
 src/frontends/xforms/form_maths_space.C
-src/frontends/xforms/FormMinipage.C
+src/frontends/xforms/FormMathsSpace.C
 src/frontends/xforms/form_minipage.C
-src/frontends/xforms/FormParagraph.C
+src/frontends/xforms/FormMinipage.C
 src/frontends/xforms/form_paragraph.C
-src/frontends/xforms/FormPreamble.C
+src/frontends/xforms/FormParagraph.C
 src/frontends/xforms/form_preamble.C
-src/frontends/xforms/FormPreferences.C
+src/frontends/xforms/FormPreamble.C
 src/frontends/xforms/form_preferences.C
-src/frontends/xforms/FormPrint.C
+src/frontends/xforms/FormPreferences.C
 src/frontends/xforms/form_print.C
-src/frontends/xforms/FormRef.C
+src/frontends/xforms/FormPrint.C
 src/frontends/xforms/form_ref.C
-src/frontends/xforms/FormSearch.C
+src/frontends/xforms/FormRef.C
 src/frontends/xforms/form_search.C
-src/frontends/xforms/FormTabular.C
+src/frontends/xforms/FormSearch.C
 src/frontends/xforms/form_tabular.C
-src/frontends/xforms/FormTabularCreate.C
+src/frontends/xforms/FormTabular.C
 src/frontends/xforms/form_tabular_create.C
-src/frontends/xforms/FormToc.C
+src/frontends/xforms/FormTabularCreate.C
 src/frontends/xforms/form_toc.C
-src/frontends/xforms/FormUrl.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/input_validators.C
 src/frontends/xforms/Menubar_pimpl.C
index eb766c0bcdfffd28f0fc4f127dd2619852e4b488..4d070288fad7f4e7469907bc8800997eab60159a 100644 (file)
@@ -864,9 +864,11 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
                        if (text->UpdateInset(this, inset)) {
                                update();
                                if (mark_dirty) {
+#if 0
                                        if (buffer()->isLyxClean())
                                                owner()->getMiniBuffer()->
                                                        setTimer(4);
+#endif
                                        buffer()->markDirty();
                                }
                                updateScrollbar();
@@ -876,9 +878,11 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
                        if (text->UpdateInset(this, theLockingInset())) {
                                update();
                                if (mark_dirty){
+#if 0
                                        if (buffer()->isLyxClean())
                                                owner()->getMiniBuffer()->
                                                        setTimer(4);
+#endif
                                        buffer()->markDirty();
                                }
                                updateScrollbar();
index 2437438d1aff3ea885ee92edc64306265cb94b2a..5f9ffbed0a55769d6e838539b314bcf8809ab6bb 100644 (file)
@@ -1102,7 +1102,9 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f)
        if ((f & CHANGE)) {
                if (buffer_->isLyxClean()) {
                        buffer_->markDirty();
+#if 0
                        owner_->getMiniBuffer()->setTimer(4);
+#endif
                } else {
                        buffer_->markDirty();
                }
@@ -1217,7 +1219,7 @@ void BufferView::Pimpl::savePosition(unsigned int i)
                                      bv_->text->cursor.par()->id(),
                                      bv_->text->cursor.pos());
        if (i > 0)
-               owner_->getMiniBuffer()->Set(_("Saved bookmark ") + tostr(i));
+               owner_->getMiniBuffer()->Set(_("Saved bookmark"), tostr(i));
 }
 
 
@@ -1250,7 +1252,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
 #endif
        update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
        if (i > 0)
-               owner_->getMiniBuffer()->Set(_("Moved to bookmark ") + tostr(i));
+               owner_->getMiniBuffer()->Set(_("Moved to bookmark"), tostr(i));
 }
 
 
index 3bccc6c6ec9d7dd21da2cbff6459e7c40986b718..727ae6d486fd6e20a2530c36ca985f1a949fc0b2 100644 (file)
@@ -1,3 +1,20 @@
+2001-04-06  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * tabular.[Ch] (getLabelList): implement new method
+
+       * minibuffer.h: comment ouf setTiimer
+
+       * minibuffer.C (ExecutingCB): constify res
+       (peek_event): constify s
+       (Set): constify ntext
+       (Init): constify nicename
+
+       * BufferView2.C (updateInset): comment out Minibuffer::setTimer
+
+       * BufferView_pimpl.C (update): comment out Minibuffer::setTimer
+       (savePosition): use two params to Minibuffer::Set
+       (restorePosition): ditto
+
 2001-04-06  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * lyx_main.C: include language.h
index 97c1fcbce3b7fcffea6cf0f670acf439047e8276..ab6277be8eddd59083a88cb477c2d93434db7a12 100644 (file)
@@ -1,3 +1,12 @@
+2001-04-06  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * insettext.C (InsetText): fix new
+       (InsetText): reindent some, simplify deletion of par list 
+       (clear): simplify deletion of par list, fix new
+       (SetParagraphData): simplify deletion of par list
+
+       * insettabular.[Ch] (getLabelList): implement new method
+
 2001-04-05  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * lyxinset.h: do not include gettext.h...
index be9a89dbd4c33bd9199f8decb6b519193e1d041d..b3436ed22f22194f43b4fc369353e8d72f0dfba9 100644 (file)
@@ -2161,6 +2161,12 @@ LyXFunc::func_status InsetTabular::getStatus(string const & what) const
 }
 
 
+std::vector<string> const InsetTabular::getLabelList() const
+{
+       return tabular->getLabelList();
+}
+
+
 bool InsetTabular::copySelection(BufferView * bv)
 {
        if (!hasSelection())
index 6a0d78fa680736ffa5d92e1a60dc4375f83d8968..39521dbbbaa6d3a61776df2d100e7e834699361d 100644 (file)
@@ -176,7 +176,8 @@ public:
        bool ShowInsetDialog(BufferView *) const;
        ///
        LyXFunc::func_status getStatus(string const & argument) const;
-
+       ///
+       std::vector<string> const getLabelList() const;
        //
        // Public structures and variables
        ///
@@ -188,13 +189,13 @@ public:
 private:
        ///
        bool calculate_dimensions_of_cells(BufferView *, LyXFont const &,
-                                                                          bool = false) const;
+                                          bool = false) const;
        ///
        void DrawCellLines(Painter &, int x, int baseline,
-                                          int row, int cell) const;
+                          int row, int cell) const;
        ///
        void DrawCellSelection(Painter &, int x, int baseline,
-                                                  int row, int column, int cell) const;
+                              int row, int column, int cell) const;
        ///
        void ShowInsetCursor(BufferView *, bool show=true);
        ///
@@ -223,17 +224,19 @@ private:
        void RemoveTabularRow();
        ///
        bool hasSelection() const {
-       return sel_cell_start != sel_cell_end;
+               return sel_cell_start != sel_cell_end;
        }
        ///
        void clearSelection() const {
        sel_cell_start = sel_cell_end = 0;
        }
        ///
-       bool ActivateCellInset(BufferView *, int x = 0, int y = 0, int button = 0,
-                                                  bool behind = false);
+       bool ActivateCellInset(BufferView *, int x = 0, int y = 0,
+                              int button = 0,
+                              bool behind = false);
        ///
-       bool ActivateCellInsetAbs(BufferView *, int x = 0, int y=0, int button=0);
+       bool ActivateCellInsetAbs(BufferView *, int x = 0, int y = 0,
+                                 int button = 0);
        ///
        bool InsetHit(BufferView * bv, int x, int y) const;
        ///
index 3bbcdf9bbfa5691ac2f3510034b0cdbd0af59a2a..c8060e5dea7d398013201dfed65a76dd975ad9c0 100644 (file)
@@ -60,7 +60,7 @@ extern int greek_kb_flag;
 
 InsetText::InsetText()
 {
-       par = new LyXParagraph();
+       par = new LyXParagraph;
        init();
 }
 
@@ -119,25 +119,23 @@ InsetText::~InsetText()
 {
        // delete all instances of LyXText before deleting the paragraps used
        // by it.
-       for (Cache::iterator cit = cache.begin(); cit != cache.end(); ++cit){
-       delete (*cit).second;
-       (*cit).second = 0;
+       for (Cache::iterator cit = cache.begin(); cit != cache.end(); ++cit) {
+               delete (*cit).second;
+               (*cit).second = 0;
        }
 #ifndef NEW_INSETS
        LyXParagraph * p = par->next_;
        delete par;
        while(p) {
-       par = p;
-       p = p->next_;
-       delete par;
+               par = p;
+               p = p->next_;
+               delete par;
        }
 #else
-       LyXParagraph * p = par->next();
-       delete par;
-       while(p) {
-       par = p;
-       p = p->next();
-       delete par;
+       while (par) {
+               LyXParagraph * tmp = par->next();
+               delete par;
+               par = tmp;
        }
 #endif
 }
@@ -160,15 +158,13 @@ void InsetText::clear()
                delete par;
        }
 #else
-       LyXParagraph * p = par->next();
-       delete par;
-       while(p) {
-               par = p;
-               p = p->next();
+       while (par) {
+               LyXParagraph * tmp = par->next();
                delete par;
+               par = tmp;
        }
 #endif
-       par = new LyXParagraph();
+       par = new LyXParagraph;
 }
 
 
@@ -220,12 +216,10 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
                delete par;
        }
 #else
-       LyXParagraph * p = par->next();
-       delete par;
-       while(p) {
-               par = p;
-               p = p->next();
+       while (par) {
+               LyXParagraph * tmp = par->next();
                delete par;
+               par = tmp;
        }
 #endif
        par = new LyXParagraph;
@@ -237,12 +231,12 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
                if (token == "\\end_inset")
                        break;
                if (const_cast<Buffer*>(buf)->
-                       parseSingleLyXformat2Token(lex, par, return_par,token, pos, depth,
-                                                                          font
+                       parseSingleLyXformat2Token(lex, par, return_par,
+                                                  token, pos, depth, font
 #ifndef NEW_INSETS
-                                                                          , footnoteflag, footnotekind
+                                                  , footnoteflag, footnotekind
 #endif
-                                                                          ))
+                               ))
                {
                        // the_end read this should NEVER happen
                        lex.printError("\\the_end read in inset! Error in document!");
@@ -312,9 +306,9 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
        if ((drawFrame == LOCKED) && !locked && !par->size()) {
                if (!cleared && (need_update & CLEAR_FRAME)) {
                        pain.rectangle(top_x + 1, baseline - insetAscent + 1,
-                                                  width(bv, f) - 1,
-                                                  insetAscent + insetDescent - 1,
-                                                  LColor::background);
+                                      width(bv, f) - 1,
+                                      insetAscent + insetDescent - 1,
+                                      LColor::background);
                }
                top_x = int(x);
                top_baseline = baseline;
@@ -333,9 +327,8 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
 
        // if top_x differs we have a rule down and we don't have to clear anything
        if (!cleared && (top_x == int(x)) &&
-               ((need_update==INIT)||(need_update==FULL)||(top_baseline!=baseline) ||
-                (last_drawn_width!=insetWidth)))
-       {
+           ((need_update == INIT) || (need_update == FULL) || (top_baseline != baseline) ||
+                (last_drawn_width!=insetWidth))) {
                int w =  insetWidth;
                int h = insetAscent + insetDescent;
                int ty = baseline - insetAscent;
@@ -381,6 +374,8 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
                return;
        }
        x += TEXT_TO_INSET_OFFSET;
+
+#warning Jürgen, why is this a block of its own? (Lgb)
        {
        int y = 0;
        Row * row = TEXT(bv)->GetRowNearY(y);
@@ -432,12 +427,14 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
                ((drawFrame == ALWAYS) || ((drawFrame == LOCKED) && locked)))
        {
                pain.rectangle(top_x + 1, baseline - insetAscent + 1,
-                                          width(bv, f) - 1, insetAscent + insetDescent - 1,
-                                          frame_color);
+                              width(bv, f) - 1,
+                              insetAscent + insetDescent - 1,
+                              frame_color);
        } else if (need_update & CLEAR_FRAME) {
                pain.rectangle(top_x + 1, baseline - insetAscent + 1,
-                                          width(bv, f) - 1, insetAscent + insetDescent - 1,
-                                          LColor::background);
+                              width(bv, f) - 1,
+                              insetAscent + insetDescent - 1,
+                              LColor::background);
        }
        x += width(bv, f) - TEXT_TO_INSET_OFFSET;
        if (bv->text->status==LyXText::CHANGED_IN_DRAW) {
@@ -484,7 +481,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
                update(bv, font, reinit);
                return;
        }
-       if ((need_update==CURSOR_PAR) && (TEXT(bv)->status==LyXText::UNCHANGED) &&
+       if ((need_update == CURSOR_PAR) && (TEXT(bv)->status == LyXText::UNCHANGED) &&
                the_locking_inset)
        {
                TEXT(bv)->UpdateInset(bv, the_locking_inset);
@@ -500,6 +497,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
                TEXT_TO_INSET_OFFSET;
 }
 
+
 void InsetText::SetUpdateStatus(BufferView * bv, int what)
 {
        need_update |= what;
@@ -513,6 +511,7 @@ void InsetText::SetUpdateStatus(BufferView * bv, int what)
                TEXT(bv)->ClearSelection(bv);
 }
 
+
 void InsetText::UpdateLocal(BufferView * bv, int what, bool mark_dirty)
 {
        TEXT(bv)->FullRebreak(bv);
@@ -550,8 +549,8 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
        inset_par = 0;
        old_par = 0;
        if (!checkAndActivateInset(bv, x, y, button))
-               TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
-                                                                                  y+insetAscent);
+               TEXT(bv)->SetCursorFromCoordinates(bv, x - drawTextXOffset,
+                                                  y + insetAscent);
        TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
        bv->text->FinishUndo();
        ShowInsetCursor(bv);
@@ -584,7 +583,7 @@ void InsetText::InsetUnlock(BufferView * bv)
        UpdateLocal(bv, CLEAR_FRAME|CURSOR, false);
        if (owner())
                bv->owner()->setLayout(owner()->getLyXText(bv)
-                                                          ->cursor.par()->GetLayout());
+                                      ->cursor.par()->GetLayout());
        else
                bv->owner()->setLayout(bv->text->cursor.par()->GetLayout());
 }
@@ -592,7 +591,8 @@ void InsetText::InsetUnlock(BufferView * bv)
 
 bool InsetText::LockInsetInInset(BufferView * bv, UpdatableInset * inset)
 {
-       lyxerr[Debug::INSETS] << "InsetText::LockInsetInInset(" << inset << "): ";
+       lyxerr[Debug::INSETS] << "InsetText::LockInsetInInset("
+                             << inset << "): ";
        if (!inset)
                return false;
        if (inset == cpar(bv)->GetInset(cpos(bv))) {
@@ -629,7 +629,7 @@ bool InsetText::LockInsetInInset(BufferView * bv, UpdatableInset * inset)
 
 
 bool InsetText::UnlockInsetInInset(BufferView * bv, UpdatableInset * inset,
-                                                                  bool lr)
+                                  bool lr)
 {
        if (!the_locking_inset)
                return false;
@@ -707,7 +707,8 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
                        inset_par = cpar(bv);
                        inset_boundary = cboundary(bv);
                        the_locking_inset = uinset;
-                       uinset->InsetButtonPress(bv, x - inset_x, y - inset_y, button);
+                       uinset->InsetButtonPress(bv, x - inset_x, y - inset_y,
+                                                button);
                        uinset->Edit(bv, x - inset_x, y - inset_y, 0);
                        if (the_locking_inset)
                                UpdateLocal(bv, CURSOR, false);
@@ -722,7 +723,7 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
                        paste_internally = true;
                }
                TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
-                                                                                  y + insetAscent);
+                                                  y + insetAscent);
                TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
                UpdateLocal(bv, CURSOR, false);
                bv->owner()->setLayout(cpar(bv)->GetLayout());
@@ -734,7 +735,8 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
                        if (paste_internally)
                                LocalDispatch(bv, LFUN_PASTE, "");
                        else
-                               LocalDispatch(bv, LFUN_PASTESELECTION, "paragraph");
+                               LocalDispatch(bv, LFUN_PASTESELECTION,
+                                             "paragraph");
                }
        }
        ShowInsetCursor(bv);
@@ -748,18 +750,23 @@ void InsetText::InsetButtonRelease(BufferView * bv, int x, int y, int button)
 
        if (the_locking_inset) {
                the_locking_inset->InsetButtonRelease(bv,
-                                                                                         x - inset_x, y - inset_y,
-                                                                                         button);
+                                                     x - inset_x, y - inset_y,
+                                                     button);
        } else {
                if (cpar(bv)->GetChar(cpos(bv)) == LyXParagraph::META_INSET) {
                        inset = static_cast<UpdatableInset*>(cpar(bv)->GetInset(cpos(bv)));
                        if (inset->Editable() == Inset::HIGHLY_EDITABLE) {
-                               inset->InsetButtonRelease(bv, x - inset_x, y - inset_y,button);
+                               inset->InsetButtonRelease(bv,
+                                                         x - inset_x,
+                                                         y - inset_y, button);
                        } else {
                                inset_x = cx(bv) - top_x + drawTextXOffset;
                                inset_y = cy(bv) + drawTextYOffset;
-                               inset->InsetButtonRelease(bv, x - inset_x, y - inset_y,button);
-                               inset->Edit(bv, x - inset_x, y - inset_y, button);
+                               inset->InsetButtonRelease(bv,
+                                                         x - inset_x,
+                                                         y - inset_y, button);
+                               inset->Edit(bv,
+                                           x - inset_x, y - inset_y, button);
                        }
                        UpdateLocal(bv, CURSOR_PAR, false);
                }
@@ -774,12 +781,12 @@ void InsetText::InsetMotionNotify(BufferView * bv, int x, int y, int state)
                return;
        if (the_locking_inset) {
                the_locking_inset->InsetMotionNotify(bv, x - inset_x,
-                                                                                        y - inset_y,state);
+                                                    y - inset_y,state);
                return;
        }
        HideInsetCursor(bv);
-       TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
-                                                                          y+insetAscent);
+       TEXT(bv)->SetCursorFromCoordinates(bv, x - drawTextXOffset,
+                                          y + insetAscent);
        TEXT(bv)->SetSelection(bv);
        if (TEXT(bv)->toggle_cursor.par()!=TEXT(bv)->toggle_end_cursor.par() ||
                TEXT(bv)->toggle_cursor.pos()!=TEXT(bv)->toggle_end_cursor.pos())
@@ -799,7 +806,7 @@ void InsetText::InsetKeyPress(XKeyEvent * xke)
 
 UpdatableInset::RESULT
 InsetText::LocalDispatch(BufferView * bv,
-                                                kb_action action, string const & arg)
+                        kb_action action, string const & arg)
 {
        no_selection = false;
        UpdatableInset::RESULT
@@ -808,7 +815,7 @@ InsetText::LocalDispatch(BufferView * bv,
                return DISPATCHED;
        }
 
-       result=DISPATCHED;
+       result = DISPATCHED;
        if ((action < 0) && arg.empty())
                return FINISHED;
 
@@ -862,13 +869,13 @@ InsetText::LocalDispatch(BufferView * bv,
 
                        bv->text->SetUndo(bv->buffer(), Undo::INSERT,
 #ifndef NEW_INSETS
-                                                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
-                                                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
+                                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
+                                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
 #else
-                                                         bv->text->cursor.par()->previous(),
-                                                         bv->text->cursor.par()->next()
+                                         bv->text->cursor.par()->previous(),
+                                         bv->text->cursor.par()->next()
 #endif
-                                                         );
+                               );
                        bv->setState();
                        if (lyxrc.auto_region_delete) {
                                if (TEXT(bv)->selection){
@@ -892,7 +899,7 @@ InsetText::LocalDispatch(BufferView * bv,
                UpdateLocal(bv, CURSOR_PAR, true);
                result=DISPATCHED_NOUPDATE;
                break;
-               // --- Cursor Movements ---------------------------------------------
+               // --- Cursor Movements -----------------------------------
        case LFUN_RIGHTSEL:
                bv->text->FinishUndo();
                moveRight(bv, false, true);
@@ -949,11 +956,11 @@ InsetText::LocalDispatch(BufferView * bv,
        case LFUN_BACKSPACE:
                bv->text->SetUndo(bv->buffer(), Undo::DELETE,
 #ifndef NEW_INSETS
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
 #else
-                                                 bv->text->cursor.par()->previous(),
-                                                 bv->text->cursor.par()->next()
+                                 bv->text->cursor.par()->previous(),
+                                 bv->text->cursor.par()->next()
 #endif
                                                  );
                if (TEXT(bv)->selection)
@@ -965,11 +972,11 @@ InsetText::LocalDispatch(BufferView * bv,
        case LFUN_DELETE:
                bv->text->SetUndo(bv->buffer(), Undo::DELETE,
 #ifndef NEW_INSETS
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
 #else
-                                                 bv->text->cursor.par()->previous(),
-                                                 bv->text->cursor.par()->next()
+                                 bv->text->cursor.par()->previous(),
+                                 bv->text->cursor.par()->next()
 #endif
                                                  );
                if (TEXT(bv)->selection)
@@ -981,11 +988,11 @@ InsetText::LocalDispatch(BufferView * bv,
        case LFUN_CUT:
                bv->text->SetUndo(bv->buffer(), Undo::DELETE,
 #ifndef NEW_INSETS
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
 #else
-                                                 bv->text->cursor.par()->previous(),
-                                                 bv->text->cursor.par()->next()
+                                 bv->text->cursor.par()->previous(),
+                                 bv->text->cursor.par()->next()
 #endif
                                                  );
                TEXT(bv)->CutSelection(bv);
@@ -1023,11 +1030,11 @@ InsetText::LocalDispatch(BufferView * bv,
                }
                bv->text->SetUndo(bv->buffer(), Undo::INSERT,
 #ifndef NEW_INSETS
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
 #else
-                                                 bv->text->cursor.par()->previous(),
-                                                 bv->text->cursor.par()->next()
+                                 bv->text->cursor.par()->previous(),
+                                 bv->text->cursor.par()->next()
 #endif
                                                  );
                TEXT(bv)->PasteSelection(bv);
@@ -1050,11 +1057,11 @@ InsetText::LocalDispatch(BufferView * bv,
                        return DISPATCHED;
                bv->text->SetUndo(bv->buffer(), Undo::INSERT,
 #ifndef NEW_INSETS
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
 #else
-                                                 bv->text->cursor.par()->previous(),
-                                                 bv->text->cursor.par()->next()
+                                 bv->text->cursor.par()->previous(),
+                                 bv->text->cursor.par()->next()
 #endif
                                                  );
                TEXT(bv)->InsertChar(bv, LyXParagraph::META_NEWLINE);
@@ -1239,7 +1246,7 @@ void InsetText::Validate(LaTeXFeatures & features) const
 int InsetText::BeginningOfMainBody(Buffer const * buf, LyXParagraph * p) const
 {
        if (textclasslist.Style(buf->params.textclass,
-                                                       p->GetLayout()).labeltype != LABEL_MANUAL)
+                               p->GetLayout()).labeltype != LABEL_MANUAL)
                return 0;
        else
                return p->BeginningOfMainBody();
@@ -1247,7 +1254,7 @@ int InsetText::BeginningOfMainBody(Buffer const * buf, LyXParagraph * p) const
 
 
 void InsetText::GetCursorPos(BufferView * bv,
-                                                        int & x, int & y) const
+                            int & x, int & y) const
 {
        x = cx(bv);
        y = cy(bv);
@@ -1336,7 +1343,7 @@ InsetText::moveLeft(BufferView * bv, bool activate_inset, bool selecting)
 
 UpdatableInset::RESULT
 InsetText::moveRightIntern(BufferView * bv, bool behind, 
-                                                  bool activate_inset, bool selecting)
+                          bool activate_inset, bool selecting)
 {
 #ifndef NEW_INSETS
        if (!cpar(bv)->next_ && (cpos(bv) >= cpar(bv)->Last()))
@@ -1355,7 +1362,7 @@ InsetText::moveRightIntern(BufferView * bv, bool behind,
 
 UpdatableInset::RESULT
 InsetText::moveLeftIntern(BufferView * bv, bool behind,
-                                                 bool activate_inset, bool selecting)
+                         bool activate_inset, bool selecting)
 {
 #ifndef NEW_INSETS
        if (!cpar(bv)->previous_ && (cpos(bv) <= 0))
@@ -1401,13 +1408,13 @@ bool InsetText::InsertInset(BufferView * bv, Inset * inset)
        }
        bv->text->SetUndo(bv->buffer(), Undo::INSERT,
 #ifndef NEW_INSETS
-                                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
-                                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
+                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
+                         bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
 #else
-                                         bv->text->cursor.par()->previous(),
-                                         bv->text->cursor.par()->next()
+                         bv->text->cursor.par()->previous(),
+                         bv->text->cursor.par()->next()
 #endif
-                                         );
+               );
        inset->setOwner(this);
        HideInsetCursor(bv);
        TEXT(bv)->InsertInset(bv, inset);
@@ -1470,13 +1477,13 @@ void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall)
        if (TEXT(bv)->selection) {
                bv->text->SetUndo(bv->buffer(), Undo::EDIT,
 #ifndef NEW_INSETS
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
-                                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
+                                 bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
 #else
-                                                 bv->text->cursor.par()->previous(),
-                                                 bv->text->cursor.par()->next()
+                                 bv->text->cursor.par()->previous(),
+                                 bv->text->cursor.par()->next()
 #endif
-                                                 );
+                       );
        }
        TEXT(bv)->SetFont(bv, font, toggleall);
        bv->fitCursor(TEXT(bv));
@@ -1515,7 +1522,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool behind)
 
 
 bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
-                                                                         int button)
+                                     int button)
 {
        int dummyx, dummyy;
 
@@ -1587,20 +1594,16 @@ void InsetText::SetParagraphData(LyXParagraph * p)
                np->SetInsetOwner(this);
        }
 #else
-       LyXParagraph * np;
-       if (par) {
-               np = par->next();
+       while (par) {
+               LyXParagraph * tmp = par->next();
                delete par;
-               while(np) {
-                       par = np;
-                       np = np->next();
-                       delete par;
-               }
+               par = tmp;
        }
+
        par = p->Clone();
        par->SetInsetOwner(this);
-       np = par;
-       while(p->next()) {
+       LyXParagraph * np = par;
+       while (p->next()) {
                p = p->next();
                np->next(p->Clone());
                np->next()->previous(np);
@@ -1616,7 +1619,7 @@ void InsetText::SetText(string const & data)
 {
        clear();
        LyXFont font(LyXFont::ALL_SANE);
-       for(unsigned int i=0; i < data.length(); ++i)
+       for (unsigned int i=0; i < data.length(); ++i)
                par->InsertChar(i, data[i], font);
 }
 
@@ -1658,7 +1661,8 @@ int InsetText::cx(BufferView * bv) const
        int x = text->cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
        if (the_locking_inset) {
                LyXFont font = text->GetFont(bv->buffer(),
-                                                                        text->cursor.par(), text->cursor.pos());
+                                            text->cursor.par(),
+                                            text->cursor.pos());
                if (font.isVisibleRightToLeft())
                        x -= the_locking_inset->width(bv, font);
        }
@@ -1696,7 +1700,8 @@ Row * InsetText::crow(BufferView * bv) const
 }
 
 
-LyXText * InsetText::getLyXText(BufferView const * lbv, bool const recursive) const
+LyXText * InsetText::getLyXText(BufferView const * lbv,
+                               bool const recursive) const
 {
        // Super UGLY! (Lgb)
        BufferView * bv = const_cast<BufferView *>(lbv);
@@ -1786,10 +1791,11 @@ void InsetText::resizeLyXText(BufferView * bv) const
                 * Mechanism when setting the cursor */
                TEXT(bv)->mark_set = mark_set;
                if (selection) {
-                       TEXT(bv)->SetCursor(bv, selstartpar, selstartpos,true, 
-                                                               selstartboundary);
+                       TEXT(bv)->SetCursor(bv, selstartpar, selstartpos,
+                                           true, selstartboundary);
                        TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
-                       TEXT(bv)->SetCursor(bv, selendpar, selendpos, true, selendboundary);
+                       TEXT(bv)->SetCursor(bv, selendpar, selendpos,
+                                           true, selendboundary);
                        TEXT(bv)->SetSelection(bv);
                        TEXT(bv)->SetCursor(bv, lpar, pos);
                } else {
index 9fd95df6a8d11d6753cc7bdaa9fc2e2edd478081..72b0b9d01a7359233814a8e1706a710ae3252f7f 100644 (file)
@@ -62,7 +62,7 @@ void MiniBuffer::ExecutingCB(FL_OBJECT * ob, long)
        obj->addHistory(obj->cur_cmd);
        
        // Dispatch only returns requested data for a few commands (ale)
-       string res = obj->owner->getLyXFunc()->Dispatch(obj->cur_cmd);
+       string const res = obj->owner->getLyXFunc()->Dispatch(obj->cur_cmd);
        lyxerr.debug() << "Minibuffer Res: " << res << endl;
        obj->shows_no_match = false;
 
@@ -70,7 +70,8 @@ void MiniBuffer::ExecutingCB(FL_OBJECT * ob, long)
 }
 
 
-extern "C" void C_MiniBuffer_ExecutingCB(FL_OBJECT * ob, long)
+extern "C"
+void C_MiniBuffer_ExecutingCB(FL_OBJECT * ob, long)
 {
        MiniBuffer * obj = static_cast<MiniBuffer*>(ob->u_vdata);
        obj->Init();
@@ -102,7 +103,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
                case XK_Tab:
                {
                        // complete or increment the command
-                       string s(lyxaction.getApproxFuncName(fl_get_input(ob)));
+                       string const s(lyxaction.getApproxFuncName(fl_get_input(ob)));
                        if (!s.empty())
                                fl_set_input(ob, s.c_str());
                        return 1; 
@@ -139,9 +140,10 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
 }
 
 
-extern "C" int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event, 
-                                      FL_Coord, FL_Coord,
-                                      int key, void * xev)
+extern "C"
+int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event, 
+                           FL_Coord, FL_Coord,
+                           int key, void * xev)
 {
        return MiniBuffer::peek_event(ob, event, 0, 0, key, xev);
 }
@@ -189,7 +191,7 @@ void MiniBuffer::Set(string const& s1, string const& s2,
        else
                timer.stop();
        
-       string ntext = strip(s1 + ' ' + s2 + ' ' + s3);
+       string const ntext = strip(s1 + ' ' + s2 + ' ' + s3);
 
        if (!the_buffer->focus) {
                fl_set_input(the_buffer, ntext.c_str());
@@ -218,25 +220,25 @@ void MiniBuffer::Init()
    
        // Else, show the buffer state.
        else if (owner->view()->available()) {
-                       string nicename = 
-                               MakeDisplayPath(owner->buffer()->
-                                               fileName());
-                       // Should we do this instead? (kindo like emacs)
-                       // leaves more room for other information
-                       text = "LyX: ";
-                       text += nicename;
-                       if (owner->buffer()->lyxvc.inUse()) {
-                               text += " [";
-                               text += owner->buffer()->lyxvc.version();
-                               text += ' ';
-                               text += owner->buffer()->lyxvc.locker();
-                               if (owner->buffer()->isReadonly())
-                                       text += " (RO)";
-                               text += ']';
-                       } else if (owner->buffer()->isReadonly())
-                               text += " [RO]";
-                       if (!owner->buffer()->isLyxClean())
-                               text += _(" (Changed)");
+               string const nicename = 
+                       MakeDisplayPath(owner->buffer()->
+                                       fileName());
+               // Should we do this instead? (kindo like emacs)
+               // leaves more room for other information
+               text = "LyX: ";
+               text += nicename;
+               if (owner->buffer()->lyxvc.inUse()) {
+                       text += " [";
+                       text += owner->buffer()->lyxvc.version();
+                       text += ' ';
+                       text += owner->buffer()->lyxvc.locker();
+                       if (owner->buffer()->isReadonly())
+                               text += " (RO)";
+                       text += ']';
+               } else if (owner->buffer()->isReadonly())
+                       text += " [RO]";
+               if (!owner->buffer()->isLyxClean())
+                       text += _(" (Changed)");
        } else {
                if (text != _("Welcome to LyX!")) // this is a hack
                        text = _("* No document open *");
index 23add6dbb4b15410f159d4fe5f3b8e1210511e2f..d11c9b30b6b54cb754d9102f62185d14866d54b6 100644 (file)
@@ -23,11 +23,13 @@ public:
        ///
        bool shows_no_match;
 
+#if 0
        ///
        void setTimer(unsigned int a) {
                timer.setTimeout(a * 1000);
        }
-
+#endif
+       
        ///
        void Set(string const & = string(),
                 string const & = string(),
index bd751ba08d3d6995839df5f04d89542da8dc0c1f..483670419cfe7db217d48ba785348037dff1885e 100644 (file)
@@ -2544,6 +2544,20 @@ void LyXTabular::Validate(LaTeXFeatures & features) const
 }
 
 
+std::vector<string> const LyXTabular::getLabelList() const
+{
+       std::vector<string> label_list;
+       for (int i = 0; i < rows_; ++i)
+               for (int j = 0; j < columns_; ++j) {
+                       std::vector<string> const l =
+                               GetCellInset(i, j)->getLabelList();
+                       label_list.insert(label_list.end(),
+                                         l.begin(), l.end());
+               }
+       return label_list;
+}
+
+                       
 #ifndef NEW_INSETS
 LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
 {
index 5af58996edc2a3c3448dfc4e3faa8276a46924dc..a04e70714ab1ecbcacfcec891b7040ba91d2affc 100644 (file)
@@ -206,17 +206,19 @@ public:
        /// Returns true if a complete update is necessary, otherwise false
        bool SetAllLines(int cell, bool line);
        /// Returns true if a complete update is necessary, otherwise false
-       bool SetTopLine(int cell, bool line, bool onlycolumn=false);
+       bool SetTopLine(int cell, bool line, bool onlycolumn = false);
        /// Returns true if a complete update is necessary, otherwise false
-       bool SetBottomLine(int cell, bool line, bool onlycolumn=false);
+       bool SetBottomLine(int cell, bool line, bool onlycolumn = false);
        /// Returns true if a complete update is necessary, otherwise false
-       bool SetLeftLine(int cell, bool line, bool onlycolumn=false);
+       bool SetLeftLine(int cell, bool line, bool onlycolumn = false);
        /// Returns true if a complete update is necessary, otherwise false
-       bool SetRightLine(int cell, bool line, bool onlycolumn=false);
+       bool SetRightLine(int cell, bool line, bool onlycolumn = false);
        /// Returns true if a complete update is necessary, otherwise false
-       bool SetAlignment(int cell, LyXAlignment align, bool onlycolumn = false);
+       bool SetAlignment(int cell, LyXAlignment align,
+                         bool onlycolumn = false);
        /// Returns true if a complete update is necessary, otherwise false
-       bool SetVAlignment(int cell, VAlignment align, bool onlycolumn = false);
+       bool SetVAlignment(int cell, VAlignment align,
+                          bool onlycolumn = false);
        ///
        bool SetColumnPWidth(int cell, string const & width);
        ///
@@ -283,13 +285,14 @@ public:
        // helper function for Latex returns number of newlines
        ///
        int AsciiTopHLine(std::ostream &, int row,
-                                         std::vector<unsigned int> const &) const;
+                         std::vector<unsigned int> const &) const;
        ///
        int AsciiBottomHLine(std::ostream &, int row,
-                                                std::vector<unsigned int> const &) const;
+                            std::vector<unsigned int> const &) const;
        ///
-       int AsciiPrintCell(Buffer const *, std::ostream &, int cell, int row,
-                                          int column, std::vector<unsigned int> const &) const;
+       int AsciiPrintCell(Buffer const *, std::ostream &,
+                          int cell, int row, int column,
+                          std::vector<unsigned int> const &) const;
        ///
        int Ascii(Buffer const *, std::ostream &) const;
        ///
@@ -366,8 +369,9 @@ public:
        InsetTabular * owner() const { return owner_; }
        ///
        void Validate(LaTeXFeatures &) const;
-
-private: //////////////////////////////////////////////////////////////////
+       ///
+       std::vector<string> const getLabelList() const;
+private:
        ///
        struct cellstruct {
                ///