]> git.lyx.org Git - features.git/commitdiff
doubleClick, trippleClick, new UpdateInsetList some other small stuff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 23 Feb 2000 16:39:03 +0000 (16:39 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 23 Feb 2000 16:39:03 +0000 (16:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@570 a592a061-630c-0410-9148-cb99ea01b6c8

33 files changed:
ChangeLog
acinclude.m4
intl/finddomain.c
src/BufferView.C
src/BufferView.h
src/BufferView2.C
src/LyXSendto.C
src/Makefile.am
src/UpdateInset.C [new file with mode: 0644]
src/UpdateInset.h [new file with mode: 0644]
src/WorkArea.C
src/WorkArea.h
src/bufferlist.C
src/bufferlist.h
src/insets/figinset.C
src/insets/insetbib.C
src/insets/insetinclude.C
src/insets/insetindex.C
src/insets/inseturl.C
src/lyx_cb.C
src/lyx_cb.h
src/lyx_gui.C
src/lyxfont.C
src/lyxfont.h
src/lyxfunc.C
src/lyxtext.h
src/mathed/formula.C
src/mathed/formulamacro.C
src/menus.C
src/texoptions.C
src/text.C
src/text2.C
src/toolbar.C

index 42a2e7e787359ae7080d2afdfcc15e9255a7c2b3..f83550dca532b5d96e30d62b224dffc61a2bd92c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2000-02-22  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/lyx_cb.C src/UpdateInset.[Ch]: move the updateinsetlist into
+       BufferView and reimplement the list as a queue put inside its own
+       class.
+
+       * src/bufferlist.[Ch] (updateInset): remove func, not needed.
+
+       * several files: use the new interface to the "updateinsetlist"
+       
+       * src/WorkArea.C (work_area_handler): call BufferView::doubleClick
+       on doubleclick.
+       (work_area_handler): call BufferView::trippleClick on trippleclick.
+
+       * src/BufferView.C (doubleClick): new function, selects word on
+       doubleclick. 
+       (trippleClick): new function, selects line on trippleclick.
+
 2000-02-22  Allan Rae  <rae@lyx.org>
 
        * lib/bind/xemacs.bind: buffer-previous not supported
index 2330a68bc0edd4e2de05f560f007042a99be14a5..5a04deef980ab62e5a094a1af3bde6df4aa8aa77 100644 (file)
@@ -185,7 +185,7 @@ dnl Check the version of g++
     case $gxx_version in
       2.7*) CXXFLAGS="$lyx_opt";;
       2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
-      2.95.*) CXXFLAGS="-g $lyx_opt -Woverloaded-virtual -fno-rtti -fno-exceptions";;
+      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
index 81ea29bf4e425fbb3e4ffaec8168134b424b6453..f8ed8da011539b28a2f6c39020080a53005d7ad9 100644 (file)
@@ -63,6 +63,7 @@ void free ();
 
 /* @@ end of prolog @@ */
 /* List of already loaded domains.  */
+
 static struct loaded_l10nfile *_nl_loaded_domains;
 
 
index b3d4ecb98dca53ba0f4e92a7d23b6839dad711b1..94d7e5532db5a55147781d7b374331a58daad9b8 100644 (file)
@@ -61,8 +61,6 @@ extern bool input_prohibited;
 extern bool selection_possible;
 extern char ascii_type;
 extern void MenuPasteSelection(char at);
-extern InsetUpdateStruct * InsetUpdateList;
-extern void UpdateInsetUpdateList();
 extern void FreeUpdateTimer();
 
 BufferView::BufferView(LyXView * o, int xpos, int ypos,
@@ -774,6 +772,41 @@ void BufferView::workAreaButtonPress(int xpos, int ypos, unsigned int button)
 }
 
 
+void BufferView::doubleClick(int /*x*/, int /*y*/, unsigned int button) 
+{
+       // select a word
+       if (buffer_ && !the_locking_inset) {
+               if (screen && button == 1) {
+                       screen->HideCursor();
+                       screen->ToggleSelection();
+                       text->SelectWord();
+                       screen->ToggleSelection(false);
+                       /* This will fit the cursor on the screen
+                        * if necessary */
+                       update(0);
+               }
+       }            
+}
+
+
+void BufferView::trippleClick(int /*x*/, int /*y*/, unsigned int button)
+{
+       // select a line
+       if (buffer_ && screen && button == 1) {
+               screen->HideCursor();
+               screen->ToggleSelection();
+               text->CursorHome();
+               text->sel_cursor = text->cursor;
+               text->CursorEnd();
+               text->SetSelection();
+               screen->ToggleSelection(false);
+               /* This will fit the cursor on the screen
+                * if necessary */
+               update(0);
+       }
+}
+
+
 void BufferView::workAreaButtonRelease(int x, int y, unsigned int button)
 {
        if (buffer_ == 0 || screen == 0) return;
@@ -1097,9 +1130,9 @@ void BufferView::cursorToggleCB(FL_OBJECT * ob, long)
                else if (pid > 0)
                        sigchldhandler(pid, &status);
        }
-       if (InsetUpdateList) 
-               UpdateInsetUpdateList();
 
+       view->updatelist.update(view);
+       
        if (view && !view->screen){
                goto set_timer_and_return;
        }
@@ -1429,6 +1462,12 @@ bool BufferView::active() const
 }
 
 
+bool BufferView::belowMouse() const 
+{
+       return workarea->belowMouse();
+}
+
+
 void BufferView::showCursor()
 {
        if (screen)
index 6b47eda9f5c6fb7368070488c8e671c2a6a2f895..0f43d9fa1416630da974624ed265f7c0617b094c 100644 (file)
@@ -20,6 +20,7 @@
 #include "BackStack.h"
 #include "LaTeX.h"
 #include "undo.h"
+#include "UpdateInset.h"
 
 class LyXView;
 class Buffer;
@@ -210,6 +211,8 @@ public:
        void focus(bool);
        ///
        bool active() const;
+       ///
+       bool belowMouse() const;
        /// A callback for the up arrow in the scrollbar.
        void upCB(long time, int button);
        /// A callback for the slider in the scrollbar.
@@ -233,6 +236,10 @@ private:
        ///
        void workAreaSelectionNotify(Window win, XEvent * event);
        ///
+       void doubleClick(int x, int y, unsigned int button);
+       ///
+       void trippleClick(int x, int y, unsigned int button);
+       ///
        LyXView * owner_;
        ///
        Buffer * buffer_;
@@ -254,6 +261,15 @@ private:
        int last_click_x, last_click_y;
        ///
        WorkArea * workarea;
+       ///
+       UpdateInset updatelist;
+public:
+       ///
+       void updateInset(Inset *, bool);
+       ///
+       void pushIntoUpdateList(Inset * i) {
+               updatelist.push(i);
+       }
 };
 
 #endif
index a7b336747eacf6a081a3c1a08d7ec929ac3736f4..ea2aa084fad2f6cc756eb17ef8c1c5e42fb07ac5 100644 (file)
@@ -748,3 +748,37 @@ void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind)
                      text->cursor.par->
                      ParFromPos(text->cursor.pos)->next);
 }
+
+
+void BufferView::updateInset(Inset * inset, bool mark_dirty)
+{
+       if (!inset)
+               return;
+
+       // first check for locking insets
+       if (the_locking_inset == inset) {
+               if (text->UpdateInset(inset)){
+                       update();
+                       if (mark_dirty){
+                               if (buffer()->isLyxClean())
+                                       owner()->getMiniBuffer()->setTimer(4);
+                               buffer()->markDirty();
+                       }
+                       updateScrollbar();
+                       return;
+               }
+       }
+  
+       // then check the current buffer
+       if (available()) {
+               hideCursor();
+               update(-3);
+               if (text->UpdateInset(inset)){
+                       if (mark_dirty)
+                               update(1);
+                       else 
+                               update(3);
+                       return;
+               }
+       }
+}
index c5134608fce29fa3e3c793e638fcec30a06311fb..43e6a87af2fed901430c97b102aa96242d8282eb 100644 (file)
@@ -44,6 +44,7 @@ void MenuSendto()
     }
 }
 
+
 void SendtoApplyCB(FL_OBJECT *, long)
 {
     if (!current_view->available())
@@ -103,12 +104,14 @@ void SendtoApplyCB(FL_OBJECT *, long)
     Systemcalls one(Systemcalls::System, command);    
 }
 
+
 void SendtoCancelCB(FL_OBJECT *, long)
 {
     fl_hide_form(fd_form_sendto->form_sendto);
 }
 
-void SendtoOKCB(FL_OBJECT *ob, long data)
+
+void SendtoOKCB(FL_OBJECT * ob, long data)
 {
     SendtoCancelCB(ob, data);
     SendtoApplyCB(ob, data);
index 72888381d6bc498d2054b19712c7d1c4e5c78323..6a9afa79c65cec6a59418f1d365add15124925c8 100644 (file)
@@ -55,6 +55,8 @@ lyx_SOURCES = \
        TableLayout.C \
        TextCache.C \
        TextCache.h \
+       UpdateInset.C \
+       UpdateInset.h \
        WorkArea.C \
        WorkArea.h \
        bibforms.h \
diff --git a/src/UpdateInset.C b/src/UpdateInset.C
new file mode 100644 (file)
index 0000000..863229c
--- /dev/null
@@ -0,0 +1,20 @@
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "UpdateInset.h"
+#include "BufferView.h"
+//#include "insets/lyxinset.h"
+
+void UpdateInset::update(BufferView * bv) 
+{
+       while (!insetqueue.empty()) {
+               Inset * inset = insetqueue.front();
+               insetqueue.pop();
+               bv->updateInset(inset, false); // "false" because no document change
+       }
+}
+
+
diff --git a/src/UpdateInset.h b/src/UpdateInset.h
new file mode 100644 (file)
index 0000000..d969884
--- /dev/null
@@ -0,0 +1,35 @@
+// -*- C++ -*-
+
+#ifndef UPDATE_INSET_H
+#define UPDATE_INSET_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <queue>
+#include "support/LAssert.h"
+
+using std::queue;
+
+class Inset;
+class BufferView;
+
+///
+class UpdateInset {
+public:
+       ///
+       void push(Inset * inset) {
+               Assert(inset);
+               insetqueue.push(inset);
+       }
+       ///
+       void update(BufferView *);
+private:
+       ///
+       typedef queue<Inset*> InsetQueue;
+       ///
+       InsetQueue insetqueue;
+};
+
+#endif // UPDATE_INSET_H
index cc409b11e5c718f61c8e2d476a1953620829f575..014f7378adcb92ce170f8d9620a0921f92c754fa 100644 (file)
@@ -394,11 +394,17 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                break;
        case FL_DBLCLICK:
                if (!ev) break;
-               lyxerr.debug() << "Workarea event: DBLCLICK" << endl;;
+               lyxerr.debug() << "Workarea event: DBLCLICK" << endl;
+               area->owner->doubleClick(ev->xbutton.x - ob->x,
+                                        ev->xbutton.y - ob->y,
+                                        ev->xbutton.button);
                break;
        case FL_TRPLCLICK:
                if (!ev) break;
                lyxerr.debug() << "Workarea event: TRPLCLICK" << endl;
+               area->owner->trippleClick(ev->xbutton.x - ob->x,
+                                        ev->xbutton.y - ob->y,
+                                        ev->xbutton.button);
                break;
        case FL_OTHER:
                if (!ev) break;
index e0a4f26e0360162445906673734caf2bcaa54f92..aa700c6df50cfbaa87af0d463a8d299e1aa9d4b0 100644 (file)
@@ -60,6 +60,8 @@ public:
        ///
        bool active() const { return work_area->active; }
        ///
+       bool belowMouse() const { return work_area->belowmouse; }
+       ///
        bool visible() const { return work_area->form->visible; }
        ///
        void greyOut() const;
index deb294cd80b60339397033fd623584f5ccda136a..d1172be6080bbce07bd7a9a6f62ce9189c537d2a 100644 (file)
@@ -3,8 +3,8 @@
  * 
  *           LyX, The Document Word Processor
  *
- *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2000 The LyX Team. 
+ *           Copyright 1995 Matthias Ettrich
+ *           Copyright 1995-2000 The LyX Team. 
  *
  *           This file is Copyright 1996-2000
  *           Lars Gullik Bjønnes
@@ -158,21 +158,12 @@ bool BufferList::close(Buffer * buf)
                                       MakeDisplayPath(buf->fileName(), 50),
                                       _("Save document?"))){
                case 1: // Yes
-#if 0
-                       if (write(buf, lyxrc->make_backup)) {
-                               lastfiles->newFile(buf->fileName());
-                       } else {
-                               AllowInput();
-                               return false;
-                       }
-#else
                        if (buf->save(lyxrc->make_backup)) {
                                lastfiles->newFile(buf->fileName());
                        } else {
                                AllowInput();
                                return false;
                        }
-#endif
                         break;
                case 3: // Cancel
                         AllowInput();
@@ -211,20 +202,6 @@ Buffer * BufferList::getBuffer(int choice)
 }
 
 
-void BufferList::updateInset(Inset * inset, bool mark_dirty)
-{
-       for (BufferStorage::iterator it = bstore.begin();
-            it != bstore.end(); ++it) {
-               if ((*it)->getUser()
-                   && (*it)->getUser()->text->UpdateInset(inset)) {
-                       if (mark_dirty)
-                               (*it)->markDirty();
-                       break;
-               }
-       }
-}
-
-
 int BufferList::unlockInset(UpdatableInset * inset)
 {
        if (!inset) return 1;
index 654b6eba49d7dc2334db798772303a1b3ef2327b..1f756a7a7601566f37665de06ea34a4226ebf8cc 100644 (file)
@@ -95,11 +95,6 @@ public:
        ///
        bool empty() const;
 
-       /// Saves buffer. Returns false if unsuccesful.
-#if 0
-       bool write(Buffer *, bool makeBackup);
-#endif
-
        ///
         bool QwriteAll();
 
@@ -116,9 +111,6 @@ public:
        Buffer * newFile(string const &, string);
        /// returns a vector with all the buffers filenames
        vector<string> getFileNames() const;
-       
-       ///
-       void updateInset(Inset *, bool = true);
 
        ///
        int unlockInset(UpdatableInset *);
index 127963621cc9f9a6bf8264aaba5ae1f01b4a875f..0210ef4511f3acb44a752b76d0527be0750443e0 100644 (file)
@@ -69,9 +69,7 @@ extern BufferView * current_view;
 extern FL_OBJECT * figinset_canvas;
 
 extern char ** environ; // is this only redundtant on linux systems? Lgb.
-extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
-// better for asyncron updating:
-void PutInsetIntoInsetUpdateList(Inset * inset);
+
 extern void ProhibitInput();
 extern void AllowInput();
 
@@ -405,11 +403,6 @@ void InitFigures()
        fl_add_canvas_handler(figinset_canvas, ClientMessage,
                              GhostscriptMsg, current_view->owner()->getMainForm());
 
-#if 0
-       // now we have to init color_map
-       if (!color_map) color_map = DefaultColormap(fl_display,
-                                                   DefaultScreen(fl_display));
-#endif
        // allocate color cube on pseudo-color display
        // first get visual
        gs_color = false;
@@ -451,15 +444,6 @@ void DoneFigures()
 
        fl_remove_canvas_handler(figinset_canvas, ClientMessage,
                                 GhostscriptMsg);
-
-#if 0
-       if (gs_color) {
-               lyxerr.debug() << "Freeing up the colors..." << endl;
-               XFreeColors(fl_display, color_map, gs_pixels,
-                           gs_num_pixels, 0);
-               /******????????????????? what's planes in this case ??????***/
-       }
-#endif
 }
 
 
@@ -805,13 +789,15 @@ static figdata * getfigdata(int wid, int hgh, string const & fname,
 }
 
 
-static void getbitmap(figdata * p)
+static
+void getbitmap(figdata * p)
 {
        p->gspid = -1;
 }
 
 
-static void makeupdatelist(figdata * p)
+static
+void makeupdatelist(figdata * p)
 {
        for (int i = 0; i < figinsref; ++i)
                if (figures[i]->data == p) {
@@ -821,7 +807,9 @@ static void makeupdatelist(figdata * p)
                                       << endl;
                        }
                        // add inset figures[i]->inset into to_update list
-                       PutInsetIntoInsetUpdateList(figures[i]->inset);
+                       current_view->pushIntoUpdateList(figures[i]->inset);
+                       
+                       //PutInsetIntoInsetUpdateList(figures[i]->inset);
                }
 }
 
@@ -1891,7 +1879,7 @@ void InsetFig::CallbackFig(long arg)
                                lyxerr << "Update: ["
                                       << wid << 'x' << hgh << ']' << endl;
                        }
-                       UpdateInset(current_view, this);
+                       current_view->updateInset(this, true);
                        if (arg == 8) {
                                fl_set_focus_object(form->Figure, form->OkBtn);
                                fl_hide_form(form->Figure);
index d8e5c8b15a053ea8400723b7e90cbeee5d10ae10..4898652810f4fe19373f4d06badbb878f1615741 100644 (file)
@@ -27,7 +27,6 @@ FD_citation_form * citation_form = 0;
 FD_bibitem_form * bibitem_form = 0;
 static Combox * bibcombox = 0;
 
-extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
 void BibitemUpdate(Combox *);
 FD_citation_form * create_form_citation_form(void);
 FD_bibitem_form * create_form_bibitem_form(void);
@@ -49,7 +48,7 @@ extern "C" void bibitem_cb(FL_OBJECT *, long data)
                        fl_hide_form(citation_form->citation_form);
                        // shouldn't mark the buffer dirty unless something
                        // was actually altered
-                       UpdateInset(holder->view, inset);
+                       holder->view->updateInset(inset, true);
                        break;
                }
                // fall through to Cancel on RO-mode
index efd90e492d8f065e50a87dffe33cc76b75049245..4a447b29d683060d7b5abca7ec8eb8d451763d8d 100644 (file)
@@ -26,7 +26,6 @@ extern BufferView * current_view;
 
 extern LyXRC * lyxrc;
 extern BufferList bufferlist;
-extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
 
 
 FD_include * create_form_include(void)
@@ -145,7 +144,7 @@ extern "C" void include_cb(FL_OBJECT *, long arg)
                        }
                        
                        fl_hide_form(form->include);
-                       UpdateInset(current_view, inset);
+                       current_view->updateInset(inset, true);
                        break;
                } // fall through
                
@@ -166,7 +165,7 @@ extern "C" void include_cb(FL_OBJECT *, long arg)
                        }
                        
                        fl_hide_form(form->include);
-                       UpdateInset(current_view, inset);
+                       current_view->updateInset(inset, true);
                        current_view->owner()->getLyXFunc()->Dispatch(LFUN_CHILDOPEN, inset->getContents().c_str());
                 }
                 break;
index 3b03bf1bd4384a704e68d9b0a7fc068554bc9a45..dd187d63eba89528375c0544fd4e0f1605477b55 100644 (file)
@@ -16,7 +16,6 @@
 #include "lyx_gui_misc.h" // WarnReadonly
  
 extern BufferView * current_view;
-extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
 
 FD_index_form * index_form = 0;
 
@@ -31,7 +30,7 @@ extern "C" void index_cb(FL_OBJECT *, long data)
                        if(tmp != inset->getContents()) {
                                inset->setContents(tmp);
                                fl_hide_form(index_form->index_form);
-                               UpdateInset(current_view, inset);
+                               current_view->updateInset(inset, true);
                                break;
                        }
                } // fall through to Cancel on RO
index fe01fa9078a0f3d542c6295e93620481b01f1a1d..9367c6f0c64d39c46098ab4a76ec300d3fc3c6b4 100644 (file)
@@ -14,8 +14,6 @@
 #include "LaTeXFeatures.h"
 #include "lyx_gui_misc.h" // CancelCloseBoxCB
 
-extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
-
 
 InsetUrl::InsetUrl(string const & cmd)
        : fd_form_url(0)
@@ -94,7 +92,7 @@ void InsetUrl::CloseUrlCB(FL_OBJECT * ob, long)
                        inset->flag = InsetUrl::URL;
                else
                        inset->flag = InsetUrl::HTML_URL;
-               UpdateInset(bv, inset);
+               bv->updateInset(inset, true);
        }
        
        if (inset->fd_form_url) {
index a70082624edf10f0c9737eabd7a2b2dbd9f70e4d..be514099666c8f901199bd56ae3aeb50d5639d32 100644 (file)
@@ -144,7 +144,8 @@ bool toggleall = true;
                   Matthias
    */
 
-void UpdateInset(BufferView * bv, Inset * inset, bool mark_dirty = true);
+//void UpdateInset(BufferView * bv, Inset * inset, bool mark_dirty = true);
+
 /* these functions return 1 if an error occured, 
    otherwise 0 */
 // Now they work only for updatable insets. [Alejandro 080596]
@@ -156,10 +157,10 @@ void ToggleLockedInsetCursor(long x, long y, int asc, int desc);
 
 /* this is for asyncron updating. UpdateInsetUpdateList will be called
    automatically from LyX. Just insert the Inset into the Updatelist */
-void UpdateInsetUpdateList();
-void PutInsetIntoInsetUpdateList(Inset * inset);
+//void UpdateInsetUpdateList();
+//void PutInsetIntoInsetUpdateList(Inset * inset);
 
-InsetUpdateStruct * InsetUpdateList = 0;
+//InsetUpdateStruct * InsetUpdateList = 0;
 
 
 /*
@@ -242,11 +243,11 @@ void AllowInput()
        if (fd_form_character->form_character->visible)
                XUndefineCursor(fl_display,
                                fd_form_character->form_character->window);
-#if 0
+
        // What to do about this? (Lgb)
-       if (current_view->getWorkArea()->belowmouse)
+       if (current_view->belowMouse())
                SetXtermCursor(current_view->owner()->getForm()->window);
-#endif
+
        XFlush(fl_display);
        fl_activate_all_forms();
 }
@@ -3538,74 +3539,6 @@ extern "C" void RefHideCB(FL_OBJECT *, long)
        fl_hide_form(fd_form_ref->form_ref);
 }
 
-
-// candidate for move to BufferView
-void UpdateInset(BufferView * bv, Inset * inset, bool mark_dirty)
-{
-       if (!inset)
-               return;
-
-       /* very first check for locking insets*/
-       if (bv->the_locking_inset == inset) {
-               if (bv->text->UpdateInset(inset)){
-                       bv->update();
-                       if (mark_dirty){
-                               if (bv->buffer()->isLyxClean())
-                                       bv->owner()->getMiniBuffer()->setTimer(4);
-                               bv->buffer()->markDirty();
-                       }
-                       bv->updateScrollbar();
-                       return;
-               }
-       }
-  
-       /* first check the current buffer */
-       if (bv->available()) {
-               bv->hideCursor();
-               bv->update(-3);
-               if (bv->text->UpdateInset(inset)){
-                       if (mark_dirty)
-                               bv->update(1);
-                       else 
-                               bv->update(3);
-                       return;
-               }
-       }
-  
-       // check all buffers
-       bufferlist.updateInset(inset, mark_dirty);
-
-}
-
-
-void PutInsetIntoInsetUpdateList(Inset * inset)
-{
-       Assert(inset);
-       InsetUpdateStruct * tmp = new InsetUpdateStruct();
-       tmp->inset = inset;
-       tmp->next = InsetUpdateList;
-       InsetUpdateList = tmp;
-}
-
-
-void UpdateInsetUpdateList()
-{
-       InsetUpdateStruct * tmp = InsetUpdateList;
-       while (tmp) {
-               UpdateInset(current_view, tmp->inset, false); // "false" because no document change
-               tmp = tmp->next;
-       }
-  
-       // delete the update list
-       while (InsetUpdateList) {
-               tmp = InsetUpdateList;
-               InsetUpdateList = InsetUpdateList->next;
-               delete tmp;
-       }
-       InsetUpdateList = 0;
-}
-
-
 #ifdef WITH_WARNINGS
 #warning UGLY!!
 #endif
index 3df53458e6a91623070a6c140fdba521699c7065..f4f0b4eb2629e0040c04258f588d2e5559cac067 100644 (file)
@@ -63,12 +63,5 @@ extern string CurrentState();
 ///
 extern void AllowInput();
 
-///
-struct InsetUpdateStruct {
-       ///
-       Inset * inset;
-       ///
-       InsetUpdateStruct * next;
-};
 #endif
 
index dff5b991aa7e5adf14519222e2faf922e3554f58..1d12994f9674d11791d2d886a985dc844d6a9b8a 100644 (file)
@@ -34,7 +34,6 @@
 #include "lyxrc.h"
 #include "gettext.h"
 #include "lyx_gui_misc.h"
-#include "lyx_cb.h"
 #include "lyxlookup.h"
 #include "bufferlist.h"
 
index 7e67c81f0028e0de912629d0e343455b70938b7a..20a991fdd7d2948cd2ab2fec3cf3dfb5ab12745b 100644 (file)
@@ -99,40 +99,43 @@ string const LaTeXSizeNames[14] =
 { "tiny", "scriptsize", "footnotesize", "small", "normalsize", "large",
   "Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" };
 
-#ifdef NEW_BITS
-LyXFont::FontBits LyXFont::sane = { ROMAN_FAMILY,
-                 MEDIUM_SERIES,
-                 UP_SHAPE,
-                 SIZE_NORMAL,
-                 LColor::none,
-                 OFF,
-                 OFF,
-                 OFF,
-                 OFF,
-                 LTR_DIR };
-
-LyXFont::FontBits LyXFont::inherit = { INHERIT_FAMILY, 
-                     INHERIT_SERIES, 
-                     INHERIT_SHAPE, 
-                     INHERIT_SIZE,
-                     LColor::inherit,
-                     INHERIT,
-                     INHERIT,
-                     INHERIT,
-                     INHERIT,
-                     INHERIT_DIR };
-
-LyXFont::FontBits LyXFont::ignore = { IGNORE_FAMILY,
-                    IGNORE_SERIES,
-                    IGNORE_SHAPE,
-                    IGNORE_SIZE,
-                    LColor::ignore,
-                    IGNORE,
-                    IGNORE,
-                    IGNORE,
-                    IGNORE,
-                    IGNORE_DIR };
-#endif
+
+LyXFont::FontBits LyXFont::sane = {
+       ROMAN_FAMILY,
+       MEDIUM_SERIES,
+       UP_SHAPE,
+       SIZE_NORMAL,
+       LColor::none,
+       OFF,
+       OFF,
+       OFF,
+       OFF,
+       LTR_DIR };
+
+LyXFont::FontBits LyXFont::inherit = {
+       INHERIT_FAMILY,
+       INHERIT_SERIES,
+       INHERIT_SHAPE,
+       INHERIT_SIZE,
+       LColor::inherit,
+       INHERIT,
+       INHERIT,
+       INHERIT,
+       INHERIT,
+       INHERIT_DIR };
+
+LyXFont::FontBits LyXFont::ignore = {
+       IGNORE_FAMILY,
+       IGNORE_SERIES,
+       IGNORE_SHAPE,
+       IGNORE_SIZE,
+       LColor::ignore,
+       IGNORE,
+       IGNORE,
+       IGNORE,
+       IGNORE,
+       IGNORE_DIR };
+
 
 /// Decreases font size by one
 LyXFont & LyXFont::decSize() 
@@ -312,8 +315,6 @@ void LyXFont::reduce(LyXFont const & tmplt)
 
 
 /// Realize font from a template
-// This one is not pretty, but it's extremely fast (Asger)
-#ifdef NEW_BITS
 LyXFont & LyXFont::realize(LyXFont const & tmplt)
 {
        if (bits == inherit) {
@@ -354,68 +355,6 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
 
        return *this;
 }
-#else
-LyXFont & LyXFont::realize(LyXFont const & tmplt)
-{
-       if (bits == inherit) {
-               bits = tmplt.bits;
-               return *this;
-       }
-
-       if ((bits & (Fam_Mask<<Fam_Pos)) == (ui32(INHERIT_FAMILY)<<Fam_Pos))
-               {
-                       bits &= ~(Fam_Mask << Fam_Pos);
-                       bits |= (tmplt.bits & Fam_Mask << Fam_Pos);
-               }
-       if ((bits & (Ser_Mask<<Ser_Pos)) == (ui32(INHERIT_SERIES)<<Ser_Pos))
-               {
-                       bits &= ~(Ser_Mask << Ser_Pos);
-                       bits |= (tmplt.bits & Ser_Mask << Ser_Pos);
-               }
-       if ((bits & (Sha_Mask << Sha_Pos)) == ui32(INHERIT_SHAPE) << Sha_Pos)
-               {
-                       bits &= ~(Sha_Mask << Sha_Pos);
-                       bits |= (tmplt.bits & Sha_Mask << Sha_Pos);
-               }
-       if ((bits & (Siz_Mask << Siz_Pos)) == ui32(INHERIT_SIZE) << Siz_Pos)
-               {
-                       bits &= ~(Siz_Mask << Siz_Pos);
-                       bits |= (tmplt.bits & Siz_Mask << Siz_Pos);
-               }
-       if ((bits & (Misc_Mask << Emp_Pos)) == ui32(INHERIT) << Emp_Pos)
-               {
-                       bits &= ~(Misc_Mask << Emp_Pos);
-                       bits |= (tmplt.bits & Misc_Mask << Emp_Pos);
-               }
-       if ((bits & (Misc_Mask << Und_Pos)) == ui32(INHERIT) << Und_Pos)
-               {
-                       bits &= ~(Misc_Mask << Und_Pos);
-                       bits |= (tmplt.bits & Misc_Mask << Und_Pos);
-               }
-       if ((bits & (Misc_Mask << Nou_Pos)) == ui32(INHERIT) << Nou_Pos)
-               {
-                       bits &= ~(Misc_Mask << Nou_Pos);
-                       bits |= (tmplt.bits & Misc_Mask << Nou_Pos);
-               }
-       if ((bits & (Misc_Mask << Lat_Pos)) == ui32(INHERIT) << Lat_Pos)
-               {
-                       bits &= ~(Misc_Mask << Lat_Pos);
-                       bits |= (tmplt.bits & Misc_Mask << Lat_Pos);
-               }
-       if ((bits & (Col_Mask << Col_Pos)) == ui32(LColor::inherit) << Col_Pos)
-               {
-                       bits &= ~(Col_Mask << Col_Pos);
-                       bits |= (tmplt.bits & Col_Mask << Col_Pos);
-               }
-       if ((bits & (Dir_Mask << Dir_Pos)) == ui32(INHERIT_DIR) << Dir_Pos)
-               {
-                       bits &= ~(Dir_Mask << Dir_Pos);
-                       bits |= (tmplt.bits & Dir_Mask << Dir_Pos);
-               }
-
-       return *this;
-}
-#endif
 
 
 /// Is font resolved?
index 0c7c26ec43ac03fb1677b5a3d2c1fdc7cea274d3..816de4753e6b3ff4ed37977a193fb37c40dcd5d0 100644 (file)
@@ -37,8 +37,6 @@
 
 class LyXLex;
 
-#define NEW_BITS 1
-
 ///
 class LyXFont {
 public:
@@ -372,7 +370,6 @@ public:
        bool equalExceptLatex(LyXFont const &) const;
 
 private:
-#ifdef NEW_BITS
        ///
        struct FontBits {
                bool operator==(FontBits const & fb1) const {
@@ -402,89 +399,9 @@ private:
                FONT_MISC_STATE latex;
                FONT_DIRECTION direction;
        };
-#else
-       /// This have to be at least 32 bits, but 64 or more does not hurt
-       typedef unsigned int ui32;
-#endif
-
-       /** Representation: bit table
-           Layout of bit table:
-               11 1111 111 122 222 222 2233
-           Bit 012 34 567 8901 2345 678 901 234 567 8901
-               FFF SS SSS SSSS CCCC EEE UUU NNN LLL
-               aaa ee hhh iiii oooo mmm nnn ooo aaa
-               mmm rr aaa zzzz llll ppp ddd uuu ttt
-
-           Bit 76543210 76543210 76543210 76543210
-                                                --- Fam_Pos
-                                             --    Ser_Pos
-                                          ---      Sha_Pos
-                                     ----          Siz_Pos
-                                 ----              Col_Pos
-                             ---                   Emp_Pos
-                          ---                      Und_Pos
-                      - --                         Nou_Pos
-                   ---                             Lat_Pos
-               ----                                Dir_Pos
-               
-           Some might think this is a dirty representation, but it gives
-           us at least 25% speed-up, so why not? (Asger)
 
-           First of all it is a maintence nightmare...and now that we need
-           to enlarge the Color bits with 2 (from 4 to 6), we have a problem
-           since a 32 bit entity is not large enough... (Lgb)
-       */
-
-#ifdef NEW_BITS
        FontBits bits;
-#else
-       ui32 bits;
-       
-       ///
-       enum FONT_POSITION {
-               ///
-               Fam_Pos =  0,
-               ///
-               Ser_Pos =  3,
-               ///
-               Sha_Pos =  5,
-               ///
-               Siz_Pos =  8,
-               ///
-               Col_Pos = 12,
-               ///
-               Emp_Pos = 16,
-               ///
-               Und_Pos = 19,
-               ///
-               Nou_Pos = 22,
-               ///
-               Lat_Pos = 25,
-               ///
-               Dir_Pos = 28
-       };
-
-       ///
-       enum FONT_MASK {
-               ///
-               Fam_Mask = 0x07,
-               ///
-               Ser_Mask = 0x03,
-               ///
-               Sha_Mask = 0x07,
-               ///
-               Siz_Mask = 0x0f,
-               ///
-               Col_Mask = 0x0f,
-               ///
-               Dir_Mask = 0x07,
-               ///
-               Misc_Mask = 0x07
-       };
-#endif
-
        
-#ifdef NEW_BITS
        /// Sane font
        static FontBits sane;
        
@@ -494,43 +411,6 @@ private:
        /// All ignore font
        static FontBits ignore;
 
-#else
-       /// Sane font
-       enum {  sane = ui32(ROMAN_FAMILY) << Fam_Pos
-               | ui32(MEDIUM_SERIES) << Ser_Pos
-               | ui32(UP_SHAPE) << Sha_Pos
-               | ui32(SIZE_NORMAL) << Siz_Pos
-               | ui32(LColor::none) << Col_Pos
-               | ui32(OFF) << Emp_Pos
-               | ui32(OFF) << Und_Pos
-               | ui32(OFF) << Nou_Pos
-               | ui32(OFF) << Lat_Pos
-               | ui32(LTR_DIR) << Dir_Pos};
-       
-       /// All inherit font
-       enum{ inherit = ui32(INHERIT_FAMILY) << Fam_Pos
-                     | ui32(INHERIT_SERIES) << Ser_Pos
-                     | ui32(INHERIT_SHAPE) << Sha_Pos
-                     | ui32(INHERIT_SIZE) << Siz_Pos
-                     | ui32(LColor::inherit) << Col_Pos
-                     | ui32(INHERIT) << Emp_Pos
-                     | ui32(INHERIT) << Und_Pos
-                     | ui32(INHERIT) << Nou_Pos
-                     | ui32(INHERIT) << Lat_Pos
-                     | ui32(INHERIT_DIR) << Dir_Pos};
-       /// All ignore font
-       enum{ ignore = ui32(IGNORE_FAMILY) << Fam_Pos
-                     | ui32(IGNORE_SERIES) << Ser_Pos
-                     | ui32(IGNORE_SHAPE) << Sha_Pos
-                     | ui32(IGNORE_SIZE) << Siz_Pos
-                     | ui32(LColor::ignore) << Col_Pos
-                     | ui32(IGNORE) << Emp_Pos
-                     | ui32(IGNORE) << Und_Pos
-                     | ui32(IGNORE) << Nou_Pos
-                     | ui32(IGNORE) << Lat_Pos
-                     | ui32(IGNORE_DIR) << Dir_Pos};
-#endif
        /// Updates a misc setting according to request
        LyXFont::FONT_MISC_STATE setMisc(LyXFont::FONT_MISC_STATE newfont,
                                         LyXFont::FONT_MISC_STATE org);
@@ -581,11 +461,6 @@ inline LyXFont & LyXFont::operator=(LyXFont const & x)
 }
 
 
-#ifdef NEW_BITS
-// You don't have to understand the stuff below :-)
-// It works, and it's bloody fast. (Asger)
-// And impossible to work with. (Lgb)
-
 inline
 LyXFont::FONT_FAMILY LyXFont::family() const 
 {
@@ -732,147 +607,5 @@ LyXFont & LyXFont::setDirection(LyXFont::FONT_DIRECTION d)
        bits.direction = d;
        return *this;
 }
-#else
-// You don't have to understand the stuff below :-)
-// It works, and it's bloody fast. (Asger)
-// And impossible to work with. (Lgb)
-
-inline LyXFont::FONT_FAMILY LyXFont::family() const 
-{
-       return LyXFont::FONT_FAMILY((bits >> Fam_Pos) & Fam_Mask);
-}
-
-
-inline LyXFont::FONT_SERIES LyXFont::series() const
-{
-       return LyXFont::FONT_SERIES((bits >> Ser_Pos) & Ser_Mask);
-}
-
-
-inline LyXFont::FONT_SHAPE LyXFont::shape() const
-{
-       return LyXFont::FONT_SHAPE((bits >> Sha_Pos) & Sha_Mask);
-}
-
-
-inline LyXFont::FONT_SIZE LyXFont::size() const
-{
-       return LyXFont::FONT_SIZE((bits >> Siz_Pos) & Siz_Mask);
-}
-
-
-inline LyXFont::FONT_MISC_STATE LyXFont::emph() const
-{
-       return LyXFont::FONT_MISC_STATE((bits >> Emp_Pos) & Misc_Mask);
-}
-
-
-inline LyXFont::FONT_MISC_STATE LyXFont::underbar() const
-{
-       return LyXFont::FONT_MISC_STATE((bits >> Und_Pos) & Misc_Mask);
-}
-
-
-inline LyXFont::FONT_MISC_STATE LyXFont::noun() const
-{
-       return LyXFont::FONT_MISC_STATE((bits >> Nou_Pos) & Misc_Mask);
-}
-
-
-inline LyXFont::FONT_MISC_STATE LyXFont::latex() const 
-{
-       return LyXFont::FONT_MISC_STATE((bits >> Lat_Pos) & Misc_Mask);
-}
-
-
-inline LColor::color LyXFont::color() const 
-{
-       return LColor::color((bits >> Col_Pos) & Col_Mask);
-}
-
-
-inline LyXFont::FONT_DIRECTION LyXFont::direction() const 
-{
-       return LyXFont::FONT_DIRECTION((bits >> Dir_Pos) & Dir_Mask);
-}
-
-inline LyXFont & LyXFont::setFamily(LyXFont::FONT_FAMILY f)
-{
-       bits &= ~(Fam_Mask << Fam_Pos);
-       bits |= ui32(f) << Fam_Pos;
-       return *this;
-}
-
-
-inline LyXFont & LyXFont::setSeries(LyXFont::FONT_SERIES s)
-{
-       bits &= ~(Ser_Mask << Ser_Pos);
-       bits |= ui32(s) << Ser_Pos;
-       return *this;
-}
-
-
-inline LyXFont & LyXFont::setShape(LyXFont::FONT_SHAPE s)
-{
-       bits &= ~(Sha_Mask << Sha_Pos);
-       bits |= ui32(s) << Sha_Pos;
-       return *this;
-}
-
-
-inline LyXFont & LyXFont::setSize(LyXFont::FONT_SIZE s)
-{
-       bits &= ~(Siz_Mask << Siz_Pos);
-       bits |= ui32(s) << Siz_Pos;
-       return *this;
-}
-
-
-inline LyXFont & LyXFont::setEmph(LyXFont::FONT_MISC_STATE e)
-{
-       bits &= ~(Misc_Mask << Emp_Pos);
-       bits |= ui32(e) << Emp_Pos;
-       return *this;
-}
-
-
-inline LyXFont & LyXFont::setUnderbar(LyXFont::FONT_MISC_STATE u)
-{
-       bits &= ~(Misc_Mask << Und_Pos);
-       bits |= ui32(u) << Und_Pos;
-       return *this;
-}
-
-
-inline LyXFont & LyXFont::setNoun(LyXFont::FONT_MISC_STATE n)
-{
-       bits &= ~(Misc_Mask << Nou_Pos);
-       bits |= ui32(n) << Nou_Pos;
-       return *this;
-}
-
-inline LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
-{
-       bits &= ~(Misc_Mask << Lat_Pos);
-       bits |= ui32(l) << Lat_Pos;
-       return *this;
-}
-
-
-inline LyXFont & LyXFont::setColor(LColor::color c)
-{
-       bits &= ~(Col_Mask << Col_Pos);
-       bits |= ui32(c) << Col_Pos;
-       return *this;
-}
-
-
-inline LyXFont & LyXFont::setDirection(LyXFont::FONT_DIRECTION d)
-{
-       bits &= ~(Dir_Mask << Dir_Pos);
-       bits |= ui32(d) << Dir_Pos;
-       return *this;
-}
-#endif
 
 #endif
index b07872687d1ef2ed5aab2deac1380ea03c1e7ae9..3500d05d4929f9594f7d9373ef58aef6df75e986 100644 (file)
@@ -120,8 +120,6 @@ extern int getISOCodeFromLaTeX(char *);
 
 extern void ShowLatexLog();
 
-extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
-
 /* === globals =========================================================== */
 
 bool LyXFunc::show_sc = true;
@@ -660,22 +658,6 @@ string LyXFunc::Dispatch(int ac,
                
        case LFUN_CENTER: // this is center and redraw.
                owner->view()->center();
-#if 0
-               owner->view()->beforeChange();
-               if (owner->view()->text->cursor.y >
-                   owner->view()->getWorkArea()->height() / 2)
-                       {
-                       owner->view()->getScreen()->
-                               Draw(owner->view()->text->cursor.y -
-                                    owner->view()->getWorkArea()->height() / 2
-                                       );
-               } else { // <= 
-                       owner->view()->getScreen()->
-                               Draw(0);
-               }
-               owner->view()->update(0);
-               owner->view()->redraw();
-#endif
                break;
                
        case LFUN_APPENDIX:
@@ -1249,7 +1231,7 @@ string LyXFunc::Dispatch(int ac,
                                inset->setFlag(InsetRef::PAGE_REF);
                        else
                                inset->setFlag(InsetRef::REF);
-                       UpdateInset(owner->view(), inset);
+                       owner->view()->updateInset(inset, true);
                } else {
                        setErrorMessage(N_("No cross-reference to toggle"));
                }
index 4e83c61bffc3ccb2a16acbed262321e00ac93736..75a32c395ef31914a014991b1654615096610ba4 100644 (file)
@@ -487,7 +487,7 @@ private:
        mutable Row * firstrow;
        ///
        mutable Row * lastrow;
-
+       
        /** Copybuffer for copy environment type
          Asger has learned that this should be a buffer-property instead
          Lgb has learned that 'char' is a lousy type for non-characters
@@ -566,6 +566,7 @@ private:
 
        ///
        LyXParagraph::size_type BeginningOfMainBody(LyXParagraph * par) const;
+       
        /** Returns the left beginning of the text.
          This information cannot be taken from the layouts-objekt, because
          in LaTeX the beginning of the text fits in some cases
index a90787fba9d61658a8e860b0908d04590488344b..da0aa2e6529abb717015bc5d78265298a280f7e3 100644 (file)
@@ -27,7 +27,6 @@
 #include "math_cursor.h"
 #include "math_parser.h"
 #include "lyx_main.h"
-#include "lyx_cb.h"
 #include "minibuffer.h"
 #include "BufferView.h"
 #include "lyxtext.h"
@@ -39,8 +38,6 @@
 #include "LyXView.h"
 #include "Painter.h"
 
-extern void UpdateInset(BufferView *, Inset * inset, bool mark_dirty = true);
-
 extern char * mathed_label;
 
 extern char const * latex_special_chars;
@@ -460,7 +457,7 @@ void InsetFormula::Edit(BufferView * bv, int x, int y)
    mathcursor = new MathedCursor(par);
    bv->lockInset(this);
    par->Metrics();
-   UpdateInset(bv, this, false);
+   bv->updateInset(this, false);
    x += par->xo; 
    y += par->yo; 
    mathcursor->SetPos(x, y);
@@ -479,7 +476,7 @@ void InsetFormula::InsetUnlock(BufferView * bv)
      delete mathcursor;
    }
    mathcursor = 0;
-   UpdateInset(bv, this, false);
+   bv->updateInset(this, false);
 }
 
 
@@ -558,7 +555,7 @@ void InsetFormula::ToggleInsetSelection(BufferView * bv)
 //    x -= par->xo; 
 //    y -= par->yo;
 
-    UpdateInset(bv, this, false);
+    bv->updateInset(this, false);
       
 }
 
@@ -637,7 +634,7 @@ void InsetFormula::UpdateLocal(BufferView * bv)
 {
    par->Metrics();  // To inform lyx kernel the exact size 
                   // (there were problems with arrays).
-   UpdateInset(bv, this);
+   bv->updateInset(this, true);
 }
 
 
@@ -652,7 +649,7 @@ void InsetFormula::InsetButtonRelease(BufferView * bv,
     if (sel_flag) {
        sel_flag = false; 
        sel_x = sel_y = 0;
-       UpdateInset(bv, this, false); 
+       bv->updateInset(this, false); 
     }
 }
 
@@ -664,7 +661,7 @@ void InsetFormula::InsetButtonPress(BufferView * bv,
     sel_x = x;  sel_y = y; 
     if (mathcursor->Selection()) {
        mathcursor->SelClear();
-       UpdateInset(bv, this, false); 
+       bv->updateInset(this, false); 
     }
 }
 
@@ -688,7 +685,7 @@ void InsetFormula::InsetMotionNotify(BufferView * bv,
          ShowInsetCursor(bv);
          mathcursor->GetPos(x, y);
          if (sel_x!= x || sel_y!= y)
-           UpdateInset(bv, this, false); 
+           bv->updateInset(this, false); 
          sel_x = x;  sel_y = y;
       }
 }
@@ -788,7 +785,7 @@ bool InsetFormula::LocalDispatch(BufferView * bv, int action, char const * arg)
         break;
        
        if (!mathcursor->InMacroMode() && mathcursor->pullArg()) {       
-          UpdateInset(bv, this);
+          bv->updateInset(this, true);
           break;
        }
       
@@ -796,7 +793,7 @@ bool InsetFormula::LocalDispatch(BufferView * bv, int action, char const * arg)
            //current_view->lockedInsetStoreUndo(Undo::INSERT);
            bv->lockedInsetStoreUndo(Undo::DELETE);
       mathcursor->Delete();       
-      UpdateInset(bv, this);
+      bv->updateInset(this, true);
       break;    
 //    case LFUN_GETXY:
 //      sprintf(dispatch_buffer, "%d %d",);
index eccee860d843c668b50d820460f3fe913b5ee0d5..b735a210546699c890c60be1c0c49c536e10a432 100644 (file)
@@ -26,7 +26,6 @@
 #include "math_parser.h"
 #include "math_macro.h"
 #include "lyx_main.h"
-#include "lyx_cb.h"
 #include "BufferView.h"
 #include "gettext.h"
 #include "Painter.h"
index 3700310c7b876d4b393a1d09f821394c0cdbd6f8..bb615684babd6096c52c6d6b3281db08caca68a2 100644 (file)
@@ -27,7 +27,6 @@
 #endif
 
 #include "menus.h"
-#include "lyx_cb.h"
 #include "version.h"
 #include "lyxfont.h"
 #include "lyx_main.h"
index 0d05813f80b199a7f00cf3338ad09e94656334b5..c54e165ab5a152b94cd391d515d0554eaa8fdab2 100644 (file)
@@ -3,10 +3,10 @@
 * 
 *           LyX, The Document Processor
 *
-*           Copyright (C) 1995 Matthias Ettrich
-*           Copyright (C) 1995-1998 The LyX Team.
+*           Copyright 1995 Matthias Ettrich
+*           Copyright 1995-2000 The LyX Team.
 *
-*           This file is Copyleft (C) 1996-1998
+*           This file is Copyleft 1996-2000
 *           Lars Gullik Bjønnes
 *
 * ====================================================== */
 #include <config.h>
 #include FORMS_H_LOCATION
 #include "latexoptions.h"
-#include "lyx_cb.h"
 #include "lyx_main.h"
 #include "buffer.h"
 #include "BufferView.h"
 
-extern FD_LaTeXOptions *fd_latex_options;
-extern BufferView *current_view;
+extern FD_LaTeXOptions * fd_latex_options;
+extern BufferView * current_view;
 
-void LaTeXOptionsOK(FL_OBJECT *ob, long data)
+void LaTeXOptionsOK(FL_OBJECT * ob, long data)
 {
        LaTeXOptionsApply(ob, data);
        LaTeXOptionsCancel(ob, data);
index a26f5a6f24ef4c4e6b88282add423de6c7919bd7..d21cc00f46bd8ef36fac9451df53a8e2b8e530d0 100644 (file)
@@ -4395,32 +4395,44 @@ Row * LyXText::GetRow(LyXParagraph * par,
                      LyXParagraph::size_type pos, long & y) const
 {
        Row * tmprow;
-       
+
        if (currentrow) {
-               if (par == currentrow->par || par == currentrow->par->Previous()) {
+               if (par == currentrow->par
+                   || par == currentrow->par->Previous()) {
                        // do not dereference par, it may have been deleted
-                       // already! (Matthias) 
-                       while (currentrow->previous && currentrow->previous->par != par) {
+                       // already! (Matthias)
+
+                       // Walk backwards as long as the previous
+                       // rows par is not par
+                       while (currentrow->previous
+                              && currentrow->previous->par != par) {
                                currentrow = currentrow->previous;
                                currentrow_y -= currentrow->height;
                        }
-                       while (currentrow->previous && currentrow->previous->par == par) {
+                       // Walk backwards as long as the previous
+                       // rows par _is_ par
+                       while (currentrow->previous
+                              && currentrow->previous->par == par) {
                                currentrow = currentrow->previous;
                                currentrow_y -= currentrow->height;
                        }
                }
+
                tmprow = currentrow;
                y = currentrow_y;
                // find the first row of the specified paragraph
-               while (tmprow->next && (tmprow->par != par)) {
+               while (tmprow->next
+                      && tmprow->par != par) {
                        y += tmprow->height;
                        tmprow = tmprow->next;
                }
                
                if (tmprow->par == par){
                        // now find the wanted row
-                       while (tmprow->pos < pos && tmprow->next && tmprow->next->par == par && 
-                              tmprow->next->pos <= pos) {
+                       while (tmprow->pos < pos
+                              && tmprow->next
+                              && tmprow->next->par == par
+                              && tmprow->next->pos <= pos) {
                                y += tmprow->height;
                                tmprow = tmprow->next;
                        }
@@ -4429,17 +4441,20 @@ Row * LyXText::GetRow(LyXParagraph * par,
                        return tmprow;
                }
        }
+
        tmprow = firstrow;
        y = 0;
        // find the first row of the specified paragraph
-       while (tmprow->next && (tmprow->par != par)) {
+       while (tmprow->next && tmprow->par != par) {
                y += tmprow->height;
                tmprow = tmprow->next;
        }
        
        // now find the wanted row
-       while (tmprow->pos < pos && tmprow->next && tmprow->next->par == par && 
-              tmprow->next->pos <= pos) {
+       while (tmprow->pos < pos
+              && tmprow->next
+              && tmprow->next->par == par
+              && tmprow->next->pos <= pos) {
                y += tmprow->height;
                tmprow = tmprow->next;
        }
index 8fca8c87af4d4321dbc8d23b01a840901b31ca1b..d951b56c63a4b32992e8ed585d1764b7516125a2 100644 (file)
@@ -25,7 +25,6 @@
 #include "layout.h"
 #include "LyXView.h"
 #include "support/textutils.h"
-#include "lyx_cb.h"
 #include "undo.h"
 #include "minibuffer.h"
 #include "buffer.h"
@@ -58,11 +57,12 @@ LyXText::LyXText(BufferView * bv, int pw, Buffer * p)
        current_font = GetFont(par, 0);
    
        height = 0;
-   
+
        while (par) {
                InsertParagraph(par, lastrow);
                par = par->Next();
        }
+
        // set cursor at the very top position
        selection = true;           /* these setting is necessary 
                                       because of the delete-empty-
@@ -244,8 +244,7 @@ void LyXText::InsertRow(Row * row, LyXParagraph * par,
                tmprow->previous = 0;
                tmprow->next = firstrow;
                firstrow = tmprow;
-       }
-       else {
+       } else {
                tmprow->previous = row;
                tmprow->next = row->next;
                row->next = tmprow;
@@ -260,7 +259,7 @@ void LyXText::InsertRow(Row * row, LyXParagraph * par,
    
        tmprow->par = par;
        tmprow->pos = pos;
-   
+
        if (row == lastrow)
                lastrow = tmprow;
        ++number_of_rows; // one more row
@@ -285,8 +284,7 @@ void LyXText::RemoveRow(Row * row) const
                row->next->previous = row->previous;
        if (!row->previous) {
                firstrow = row->next;
-       }
-       else  {
+       } else  {
                row->previous->next = row->next;
        }
        if (row == lastrow)
@@ -313,7 +311,7 @@ void LyXText::RemoveParagraph(Row * row) const
        }
 }
    
-  
+
 // insert the specified paragraph behind the specified row
 void LyXText::InsertParagraph(LyXParagraph * par, Row * row) const
 {
@@ -326,8 +324,7 @@ void LyXText::InsertParagraph(LyXParagraph * par, Row * row) const
        if (!row) {
                firstrow->height = 0;
                AppendParagraph(firstrow);
-       }
-       else {
+       } else {
                row->next->height = 0;
                AppendParagraph(row->next);
        }
index f63268c3a3fdd394e51d77c4b1c70ec68be36ae5..254b23d23c0997bb8348363c1a56f526319bd0e0 100644 (file)
@@ -27,7 +27,6 @@
 #include "lyxlex.h"
 #include "debug.h"
 #include "combox.h"
-#include "lyx_cb.h"
 #include "LyXView.h"
 #include "LyXAction.h"
 #include "support/lstrings.h"