]> git.lyx.org Git - lyx.git/commitdiff
some sun compile fixes the need clipboard code patch from Dekel ans some other fixes
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 20 May 2000 21:37:05 +0000 (21:37 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 20 May 2000 21:37:05 +0000 (21:37 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@753 a592a061-630c-0410-9148-cb99ea01b6c8

40 files changed:
ChangeLog
acinclude.m4
config/lyxinclude.m4
forms/lyx.fd
src/BufferView.C
src/BufferView.h
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/LColor.C
src/LyXAction.C
src/WorkArea.C
src/buffer.C
src/buffer.h
src/commandtags.h
src/insets/figinset.C
src/insets/insetgraphics.C
src/insets/insetlatexaccent.C
src/insets/insetloa.C
src/insets/insetloa.h
src/insets/insetlof.C
src/insets/insetlof.h
src/insets/insetlot.C
src/insets/insetlot.h
src/insets/insettext.h
src/insets/insettoc.C
src/lyx.C
src/lyx.h
src/lyx_cb.C
src/lyx_gui.C
src/lyx_main.C
src/lyxfont.C
src/lyxfunc.C
src/lyxlookup.C
src/lyxparagraph.h
src/lyxtext.h
src/menus.C
src/paragraph.C
src/screen.C
src/text.C
src/text2.C

index c97732eeadd3553cd239a9c186fc2e5a3bf248e2..6f79e4c08264359f020b1fe0835714ab49f60078 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,32 @@
 2000-05-20  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
+       * src/WorkArea.C (request_clipboard_cb): give "C" linkage.
+
+2000-05-19  Dekel Tsur  <dekel@math.tau.ac.il>
+
+       * src/commandtags.h
+               
+       * src/LyXAction.C
+       
+       * src/lyxfunc.C (Dispatch): Added LFUN_LOFVIEW, LFUN_LOTVIEW
+       and LFUN_LOAVIEW
+       
+       * src/insets/insetlo*.[Ch]: Made editable
+
+2000-05-20  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/text2.C (SetSelection): call BufferView::stuffClipboard with
+       the current selection.
+
+       * src/BufferView_pimpl.C (stuffClipboard): new method
+
+       * src/BufferView.C (stuffClipboard): new method
+
+       * src/paragraph.C (String): new method
+
+       * src/LColor.C (getFromLyXName): return LColor::inherit instead of
+       LColor::ignore when lyxname is not found.
+
        * src/BufferView.C (pasteSelection): new method
 
        * src/BufferView_pimpl.C (pasteSelection): new method
index 611315ae9b445fdfc26466360fdd30f5b224b273..cac10cb462fbcf6123fd9d6a8bba9455959ff376 100644 (file)
@@ -185,7 +185,7 @@ dnl Check the version of g++
     case $gxx_version in
       2.95.1)  CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti -fno-exceptions";;
       2.95.*)  CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
-      2.96*)   CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
+      2.96*)   CXXFLAGS="-g $lyx_opt -fhonor-std";;
       *2.91.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
       *)       CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
     esac
@@ -195,7 +195,7 @@ dnl Check the version of g++
   if test x$with_warnings = xyes ; then
     case $gxx_version in
        2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
-       2.96*)  CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";;
+       2.96*)  CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
        *)      CXXFLAGS="$CXXFLAGS -ansi -W -Wall -Wno-return-type";;
     esac
     if test $lyx_devel_version = yes ; then
index 53c6b05d96a16b94332c1fa430a88b10c934e8f4..4d40f0b1ea0728cb212f516e7c6fa8c9fb409522 100644 (file)
@@ -185,7 +185,7 @@ dnl Check the version of g++
     case $gxx_version in
       2.95.1)  CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti -fno-exceptions";;
       2.95.*)  CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
-      2.96*)   CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
+      2.96*)   CXXFLAGS="-g $lyx_opt -fhonor-std";;
       *2.91.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
       *)       CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
     esac
@@ -195,7 +195,7 @@ dnl Check the version of g++
   if test x$with_warnings = xyes ; then
     case $gxx_version in
        2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
-       2.96*)  CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";;
+       2.96*)  CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
        *)      CXXFLAGS="$CXXFLAGS -ansi -W -Wall -Wno-return-type";;
     esac
     if test $lyx_devel_version = yes ; then
index f783f0021394223d513199870c8c23c586b84d3b..db766115466c761f9dcf994865dd1256b60fbbed 100644 (file)
@@ -406,7 +406,7 @@ argument: 0
 Name: form_toc
 Width: 420
 Height: 340
-Number of Objects: 4
+Number of Objects: 5
 
 --------------------
 class: FL_BOX
@@ -480,6 +480,24 @@ name:
 callback: TocUpdateCB
 argument: 0
 
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 60 300 130 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: Type|Tt#t
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: toctype
+callback: TocUpdateCB
+argument: 0
+
 =============== FORM ===============
 Name: form_ref
 Width: 590
index bfe5dc237b9f02d9af0200f66733648179031b72..8fe15ff5eecdbe2e452ae84a8abfbe3311c03298 100644 (file)
@@ -328,8 +328,14 @@ void BufferView::center()
 
 
 #ifdef XFORMS_CLIPBOARD
-void BufferView::pasteSelection(bool asPara)
+void BufferView::pasteClipboard(bool asPara)
 {
-       pimpl_->pasteSelection(asPara);
+       pimpl_->pasteClipboard(asPara);
+}
+
+
+void BufferView::stuffClipboard(string const & stuff) const
+{
+       pimpl_->stuffClipboard(stuff);
 }
 #endif
index 9c16d916e1cd5329a2fa74f6087fa89fcb013574..4d85b4008c3f3f431baa449838e483ccb1f734fb 100644 (file)
@@ -226,7 +226,9 @@ public:
        bool ChangeRefs(string const & from, string const & to);
 #ifdef XFORMS_CLIPBOARD
        ///
-       void pasteSelection(bool asPara);
+       void pasteClipboard(bool asPara);
+       ///
+       void stuffClipboard(string const &) const;
 #endif
 private:
        struct Pimpl;
index b28da354b1f511140d692034797cd42059799cab..5b627e50e9262f0c30d4f33587c66492f54823a7 100644 (file)
@@ -160,6 +160,7 @@ void BufferView::Pimpl::buffer(Buffer * b)
        owner_->updateWindowTitle();
 }
 
+
 void BufferView::Pimpl::resize(int xpos, int ypos, int width, int height)
 {
        workarea->resize(xpos, ypos, width, height);
@@ -497,11 +498,11 @@ int BufferView::Pimpl::scrollDown(long time)
 
 void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
 {
-       if (buffer_ == 0 || !screen) return;
-
        // Only use motion with button 1
-       if (!state & Button1MotionMask)
-               return; 
+       if (!(state & Button1MotionMask))
+               return;
+
+       if (buffer_ == 0 || !screen) return;
 
        // Check for inset locking
        if (bv_->the_locking_inset) {
@@ -844,7 +845,6 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
        // Do we want to close a float? (click on the float-label)
        if (bv_->text->cursor.row->par->footnoteflag == 
            LyXParagraph::OPEN_FOOTNOTE
-           //&& text->cursor.pos == 0
            && bv_->text->cursor.row->previous &&
            bv_->text->cursor.row->previous->par->
            footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
@@ -1493,7 +1493,7 @@ void BufferView::Pimpl::center()
 
 
 #ifdef XFORMS_CLIPBOARD
-void BufferView::Pimpl::pasteSelection(bool asPara) 
+void BufferView::Pimpl::pasteClipboard(bool asPara) 
 {
        if (buffer_ == 0) return;
 
@@ -1511,4 +1511,10 @@ void BufferView::Pimpl::pasteSelection(bool asPara)
        }
        update(1);
 }
+
+
+void BufferView::Pimpl::stuffClipboard(string const & stuff) const
+{
+       workarea->putClipboard(stuff);
+}
 #endif
index 5049d0851f46204f62b9b5eaa16c060f8aa20d2e..68c6b8b89f4f01f6fa1c1c334186cc6c276188f8 100644 (file)
@@ -142,7 +142,9 @@ struct BufferView::Pimpl {
        UpdateInset updatelist;
 #ifdef XFORMS_CLIPBOARD
        ///
-       void pasteSelection(bool asPara);
+       void pasteClipboard(bool asPara);
+       ///
+       void stuffClipboard(string const &) const;
 #endif
 private:
        bool using_xterm_cursor;
index 0ac92f520de3420ddf8e77e658ec804129da8977..6e6fe8e74e1665c78d2fbadda70d29f70fe42620 100644 (file)
@@ -165,12 +165,13 @@ LColor::color LColor::getFromGUIName(string const & guiname) const
 
 LColor::color LColor::getFromLyXName(string const & lyxname) const
 {
+       
        InfoTab::const_iterator ici = infotab.begin();
        for (; ici != infotab.end(); ++ici) {
                if (!compare_no_case((*ici).second.lyxname, lyxname))
                        return (*ici).first;
        }
-       return LColor::ignore;
+       return LColor::inherit;
 }
 
 // The evil global LColor instance
index 46d250c00dc6078a9b058b575076c9e44feb5371..aabe0801ebb886671ac8ef1af0bdc44a90639ce4 100644 (file)
@@ -262,10 +262,16 @@ void LyXAction::init()
                  N_("Select to end of line"), ReadOnly },
                { LFUN_LOA_INSERT, "loa-insert",
                  N_("Insert list of algorithms"), Noop },
+               { LFUN_LOAVIEW, "loa-view",
+                 N_("View list of algorithms"), ReadOnly },
                { LFUN_LOF_INSERT, "lof-insert",
                  N_("Insert list of figures"), Noop },
+               { LFUN_LOFVIEW, "lof-view",
+                 N_("View list of figures"), ReadOnly },
                { LFUN_LOT_INSERT, "lot-insert",
                  N_("Insert list of tables"), Noop },
+               { LFUN_LOTVIEW, "lot-view",
+                 N_("View list of tables"), ReadOnly },
                { LFUN_QUIT, "lyx-quit", N_("Exit"), NoBuffer },
                { LFUN_MARGINMELT, "marginpar-insert",
                  N_("Insert Margin note"), Noop },
index 1e6604ff1a880905f4ece5f7fdafd8ff37f9a5dd..5a5917b4e77ce8febf02547c828147b90a3f14c3 100644 (file)
@@ -363,7 +363,8 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
 static string clipboard_selection;
 static bool clipboard_read = false;
 
-static
+extern "C" {
+       static
 int request_clipboard_cb(FL_OBJECT * /*ob*/, long /*type*/,
                        void const * data, long size) 
 {
@@ -372,12 +373,12 @@ int request_clipboard_cb(FL_OBJECT * /*ob*/, long /*type*/,
         
        clipboard_selection.reserve(size);
        for (int i = 0; i < size; ++i) {
-               clipboard_selection.push_back(static_cast<char*>(data)[i]);
+               clipboard_selection += static_cast<char const *>(data)[i];
        }
        clipboard_read = true;
        return 0;
 }
-
+}
 
 string WorkArea::getClipboard() const 
 {
index fe29ec7faf4602977ff7ab6aaa10ad496b2db5cd..c170b1c9790e8dc8fc4ae28beaa8d2fc1a13b909 100644 (file)
@@ -3797,14 +3797,14 @@ vector<vector<Buffer::TocItem> > Buffer::getTocList()
                                switch (par->footnotekind) {
                                case LyXParagraph::FIG:
                                case LyXParagraph::WIDE_FIG:
-                                       l[1].push_back(tmp);
+                                       l[TOC_LOF].push_back(tmp);
                                        break;
                                case LyXParagraph::TAB:
                                case LyXParagraph::WIDE_TAB:
-                                       l[2].push_back(tmp);
+                                       l[TOC_LOT].push_back(tmp);
                                        break;
                                case LyXParagraph::ALGORITHM:
-                                       l[3].push_back(tmp);
+                                       l[TOC_LOA].push_back(tmp);
                                        break;
                                case LyXParagraph::FOOTNOTE:
                                case LyXParagraph::MARGIN:
@@ -3824,7 +3824,7 @@ vector<vector<Buffer::TocItem> > Buffer::getTocList()
                                                labeltype - 
                                                textclasslist.TextClass(params.textclass).maxcounter());
                                tmp.str =  par->String(true);
-                               l[0].push_back(tmp);
+                               l[TOC_TOC].push_back(tmp);
                        }
                }
                par = par->next;
@@ -3980,4 +3980,5 @@ void Buffer::inset_iterator::SetParagraph() {
                par = par->next;
        }
        //it = 0;
+       // We maintain an invariant that whenever par = 0 then it = 0
 }
index 52c692206540eb6970ffb11c49fa4ffca1c50a01..7446bd3b5a472b1e5f4ecc87958e0cee5c44e9a5 100644 (file)
@@ -299,6 +299,17 @@ public:
                string str;
        };
        ///
+       enum TocType {
+               ///
+               TOC_TOC = 0,
+               ///
+               TOC_LOF,
+               ///
+               TOC_LOT,
+               ///
+               TOC_LOA
+       };
+       ///
        std::vector<std::vector<TocItem> > getTocList();
        ///
        std::vector<string> getLabelList();
@@ -420,6 +431,7 @@ private:
        */
        BufferView * users;
 
+public:
        class inset_iterator {
        public:
                inset_iterator() : par(0) /*, it(0)*/ {}
@@ -440,18 +452,23 @@ private:
                Inset * operator*() {return *it; }
                LyXParagraph * getPar() { return par; }
                LyXParagraph::size_type getPos() {return it.getPos(); }
-               bool operator==(inset_iterator const & iter) const {
-                       return it == iter.it && par == iter.par;
+               friend
+               bool operator==(inset_iterator const & iter1,
+                               inset_iterator const & iter2) {
+                       return iter1.par == iter2.par
+                               && (iter1.par == 0 || iter1.it == iter2.it);
                }
-               bool operator!=(inset_iterator const & iter) const {
-                       return it != iter.it || par != iter.par;
+               friend
+               bool operator!=(inset_iterator const & iter1,
+                               inset_iterator const & iter2) {
+                       return !(iter1 == iter2);
                }
        private:
                void SetParagraph();
                LyXParagraph * par;
                LyXParagraph::inset_iterator it;
        };
-public:
+
        ///
        inset_iterator inset_iterator_begin() {
                return inset_iterator(paragraph);
index 231710e401e19073cc5b5f4cf254f85618992ecc..4bada1ca452897e29f1fe9e11d0de141f141e355 100644 (file)
@@ -247,6 +247,9 @@ enum kb_action {
        LFUN_INSET_NUMBER,              // Dekel 20000402
        LFUN_PARAGRAPH_SPACING,         // Lgb 20000411
        LFUN_INSET_TABULAR,             // Jug 20000412
+       LFUN_LOFVIEW,                   // Dekel 20000519       
+       LFUN_LOTVIEW,                   // Dekel 20000519
+       LFUN_LOAVIEW,                   // Dekel 20000519
        LFUN_LASTACTION  /* this marks the end of the table */
 };
 
index 7fe8f386fd1e368736b0d943fa95f9a01323356d..f24394db7edd902ebfe797b9dc90984e296affa3 100644 (file)
@@ -1058,7 +1058,7 @@ void InsetFig::draw(Painter & pain, LyXFont const & f,
        } else {
                char * msg = 0;
                // draw frame
-               pain.rectangle(x, baseline - hgh - 1, wid + 1, hgh + 1);
+               pain.rectangle(int(x), baseline - hgh - 1, wid + 1, hgh + 1);
 
                if (figure && figure->data) {
                        if (figure->data->broken)  msg = _("[render error]");
index dd591b24522174529acae38fb4a273736b386f04..088de19ed8e6e914b74e24a913b9eeac65ec982c 100644 (file)
@@ -138,7 +138,7 @@ void InsetGraphics::draw(Painter & pain, LyXFont const & font,
 {
        // This will draw the graphics. As for now we only draw a
        // placeholder rectangele.
-       pain.rectangle(x, baseline - ascent(pain, font),
+       pain.rectangle(int(x), baseline - ascent(pain, font),
                       width(pain, font),
                       ascent(pain, font) + descent(pain, font));
 }
index 01bd28aea7d8ace358914129450bdbf70593b221..62141dbfb73d10f7786c1a38b2ef1c00855e909a 100644 (file)
@@ -345,7 +345,7 @@ bool InsetLatexAccent::DisplayISO8859_9(Painter & pain, LyXFont const & font,
        }
        if (tmpic != ic) {
                char ch = char(tmpic);
-               pain.text(x, baseline, ch, font);
+               pain.text(int(x), baseline, ch, font);
                x += width(pain, font);
                return true;
        }
@@ -417,56 +417,56 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
                switch (modtype) {
                case ACUTE:     // acute 0xB4
                {
-                       pain.text(x2 - (lyxfont::rbearing(0xB4, font) - lyxfont::lbearing(0xB4, font)) / 2,
+                       pain.text(int(x2 - (lyxfont::rbearing(0xB4, font) - lyxfont::lbearing(0xB4, font)) / 2),
                                  baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB4, font) - (lyxfont::ascent(0xB4, font) + lyxfont::descent(0xB4, font)) / 2,
                                  char(0xB4), font);
                        break;
                }
                case GRAVE:     // grave 0x60
                {
-                       pain.text(x2 - (lyxfont::rbearing(0x60, font) - lyxfont::lbearing(0x60, font)) / 2,
-                                 baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0x60, font) - (lyxfont::ascent(0x60, font) + lyxfont::descent(0x60, font)) / 2.0,
+                       pain.text(int(x2 - (lyxfont::rbearing(0x60, font) - lyxfont::lbearing(0x60, font)) / 2),
+                                 int(baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0x60, font) - (lyxfont::ascent(0x60, font) + lyxfont::descent(0x60, font)) / 2.0),
                                  char(0x60), font);
                        break;
                }
                case MACRON:     // macron
                {
-                       pain.text(x2 - (lyxfont::rbearing(0xAF, font) - lyxfont::lbearing(0xAF, font)) / 2,
+                       pain.text(int(x2 - (lyxfont::rbearing(0xAF, font) - lyxfont::lbearing(0xAF, font)) / 2),
                                  baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xAF, font) - (lyxfont::ascent(0xAF, font) + lyxfont::descent(0xAF, font)),
                                  char(0xAF), font);
                        break;
                }
                case TILDE:     // tilde
                {
-                       pain.text(x2 - (lyxfont::rbearing('~', font) - lyxfont::lbearing('~', font)) / 2,
+                       pain.text(int(x2 - (lyxfont::rbearing('~', font) - lyxfont::lbearing('~', font)) / 2),
                                  baseline - lyxfont::ascent(ic, font) - lyxfont::descent('~', font) - (lyxfont::ascent('~', font) + lyxfont::descent('~', font)) / 2,
                                  '~', font);
                        break;
                }
                case UNDERBAR:     // underbar 0x5F
                {
-                       pain.text(x2 - (lyxfont::rbearing(0x5F, font) - lyxfont::lbearing(0x5F, font)) / 2, baseline,
+                       pain.text(int(x2 - (lyxfont::rbearing(0x5F, font) - lyxfont::lbearing(0x5F, font)) / 2), baseline,
                                  char(0x5F), font);
                        break;
                }
                case CEDILLA:     // cedilla
                {
-                       pain.text(x2 - (lyxfont::rbearing(0xB8, font) - lyxfont::lbearing(0xB8, font)) / 2, baseline,
+                       pain.text(int(x2 - (lyxfont::rbearing(0xB8, font) - lyxfont::lbearing(0xB8, font)) / 2), baseline,
                                  char(0xB8), font);
                        
                        break;
                }
                case UNDERDOT:     // underdot
                {
-                       pain.text(x2 - (lyxfont::rbearing('.', font) - lyxfont::lbearing('.', font)) / 2.0,
-                                 baseline + 3.0 / 2.0 * (lyxfont::ascent('.', font) + lyxfont::descent('.', font)),
+                       pain.text(int(x2 - (lyxfont::rbearing('.', font) - lyxfont::lbearing('.', font)) / 2.0),
+                                 int(baseline + 3.0 / 2.0 * (lyxfont::ascent('.', font) + lyxfont::descent('.', font))),
                                  '.', font);
                        break;
                }
 
                case DOT:    // dot
                {
-                       pain.text(x2 - (lyxfont::rbearing('.', font) - lyxfont::lbearing('.', font)) / 2.0,
+                       pain.text(int(x2 - (lyxfont::rbearing('.', font) - lyxfont::lbearing('.', font)) / 2.0),
                                  baseline - lyxfont::ascent(ic, font) - lyxfont::descent('.', font) - (lyxfont::ascent('.', font) + lyxfont::descent('.', font)) / 2,
                                  '.', font);
                        break;
@@ -476,21 +476,21 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
                {
                        LyXFont tmpf(font);
                        tmpf.decSize().decSize();
-                       pain.text(x2 - (lyxfont::rbearing(0xB0, tmpf) - lyxfont::lbearing(0xB0, tmpf)) / 2.0,
-                                 baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB0, tmpf) - (lyxfont::ascent(0xB0, tmpf) + lyxfont::descent(0xB0, tmpf)) / 3.0,
+                       pain.text(int(x2 - (lyxfont::rbearing(0xB0, tmpf) - lyxfont::lbearing(0xB0, tmpf)) / 2.0),
+                                 int(baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB0, tmpf) - (lyxfont::ascent(0xB0, tmpf) + lyxfont::descent(0xB0, tmpf)) / 3.0),
                                  char(0xB0), tmpf);
                        break;
                }
                case TIE:     // tie
                {
-                       pain.arc(int(x2 + hg35), y + hg / 2.0,
-                                2 * hg, hg, 0, 360 * 32);
+                       pain.arc(int(x2 + hg35), int(y + hg / 2.0),
+                                int(2 * hg), int(hg), 0, 360 * 32);
                        break;
                }
                case BREVE:     // breve
                {
                        pain.arc(int(x2 - (hg / 2.0)), y,
-                                hg, hg, 0, -360*32);
+                                int(hg), int(hg), 0, -360*32);
                        break;
                }
                case CARON:    // caron
@@ -524,17 +524,17 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
                }
                case HUNGARIAN_UMLAUT:    // hung. umlaut
                {
-                       pain.text(x2 - (lyxfont::rbearing('´', font) - lyxfont::lbearing('´', font)),
+                       pain.text(int(x2 - (lyxfont::rbearing('´', font) - lyxfont::lbearing('´', font))),
                                  baseline - lyxfont::ascent(ic, font) - lyxfont::descent('´', font) - (lyxfont::ascent('´', font) + lyxfont::descent('´', font)) / 2,
                                  '´', font);
-                       pain.text(x2,
+                       pain.text(int(x2),
                                  baseline - lyxfont::ascent(ic, font) - lyxfont::descent('´', font) - (lyxfont::ascent('´', font) + lyxfont::descent('´', font)) / 2,
                                  '´', font);
                        break;
                }
                case UMLAUT:    // umlaut
                {
-                       pain.text(x2 - (lyxfont::rbearing('¨', font) - lyxfont::lbearing('¨', font)) / 2,
+                       pain.text(int(x2 - (lyxfont::rbearing('¨', font) - lyxfont::lbearing('¨', font)) / 2),
                                  baseline - lyxfont::ascent(ic, font) - lyxfont::descent('¨', font) - ( lyxfont::ascent('¨', font) + lyxfont::descent('¨', font)) / 2,
                                  '¨', font);
                        break;
@@ -543,8 +543,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
                {
                        LyXFont tmpf(font);
                        tmpf.decSize().decSize().decSize();
-                       pain.text(x2 - (lyxfont::rbearing(0x5E, tmpf) - lyxfont::lbearing(0x5E, tmpf)) / 2,
-                                 baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0x5E, tmpf) - (lyxfont::ascent(0x5E, tmpf) + lyxfont::descent(0x5E, tmpf)) / 3.0,
+                       pain.text(int(x2 - (lyxfont::rbearing(0x5E, tmpf) - lyxfont::lbearing(0x5E, tmpf)) / 2),
+                                 int(baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0x5E, tmpf) - (lyxfont::ascent(0x5E, tmpf) + lyxfont::descent(0x5E, tmpf)) / 3.0),
                                  char(0x5E), tmpf);
                        break;
                }
index d11997c873972de74b6c690593c4957080724874..bb3ef255bd2f9c67a210e797c439cfd630c7b76e 100644 (file)
 
 #include "insetloa.h"
 #include "LaTeXFeatures.h"
+#include "BufferView.h"
+#include "LyXView.h"
+#include "lyxfunc.h"
+#include "commandtags.h"
 
 void InsetLOA::Validate(LaTeXFeatures & features) const 
 {
@@ -30,3 +34,8 @@ string InsetLOA::getScreenLabel() const
 {
        return _("List of Algorithms");
 }
+
+void InsetLOA::Edit(BufferView * bv, int, int, unsigned int)
+{
+       bv->owner()->getLyXFunc()->Dispatch(LFUN_LOAVIEW);
+}
index 0a4254a2832f5419fceca5a98e714b06caf47770..48617ea2963033c66ad7ec265428d171ce949340 100644 (file)
@@ -36,10 +36,11 @@ public:
         Inset * Clone() const { return new InsetLOA(owner); }
        ///
        string getScreenLabel() const;
-
+       ///
+       void Edit(BufferView * bv, int, int, unsigned int);
         ///
        EDITABLE Editable() const {
-               return NOT_EDITABLE; // not yet
+               return IS_EDITABLE; // not yet
        }
        ///
        bool display() const { return true; }
index 36b488d3398445af724fe2a30d40785496b48a8f..d3555ca8af4d3a30daf33a4e6400f705bcea63b6 100644 (file)
@@ -4,10 +4,18 @@
 #pragma implementation
 #endif
 
-
 #include "insetlof.h"
+#include "BufferView.h"
+#include "LyXView.h"
+#include "lyxfunc.h"
+#include "commandtags.h"
 
 string InsetLOF::getScreenLabel() const 
 {
        return _("List of Figures");
 }
+
+void InsetLOF::Edit(BufferView * bv, int, int, unsigned int)
+{
+       bv->owner()->getLyXFunc()->Dispatch(LFUN_LOFVIEW);
+}
index 40a7107268049af1860e3df34acda92d2f5d2496..e4b19888f94517cf824156fcd07f7cafc4522d80 100644 (file)
@@ -21,7 +21,7 @@
 #pragma interface
 #endif
 
-class Buffer;
+class Buffer; 
 
 /** Used to insert table of contents
  */
@@ -36,10 +36,11 @@ public:
         Inset * Clone() const { return new InsetLOF(owner); }
        ///
        string getScreenLabel() const;
-        
+       ///
+       void Edit(BufferView * bv, int, int, unsigned int);
         ///
        EDITABLE Editable() const {
-               return NOT_EDITABLE; // not yet
+               return IS_EDITABLE; // Finally!
        }
        ///
        bool display() const { return true; }
index 61d179311a5a0657c490da060e08daa7f9147eb2..d683ead381a2b9d380b828edb1fc188b629ef8df 100644 (file)
@@ -4,11 +4,19 @@
 #pragma implementation
 #endif
 
-
 #include "insetlot.h"
+#include "BufferView.h"
+#include "LyXView.h"
+#include "lyxfunc.h"
+#include "commandtags.h"
+
 
 string InsetLOT::getScreenLabel() const 
 {
        return _("List of Tables");
 }
 
+void InsetLOT::Edit(BufferView * bv, int, int, unsigned int)
+{
+       bv->owner()->getLyXFunc()->Dispatch(LFUN_LOTVIEW);
+}
index 1d13914f425b5aa77617e2340d6ed452ce1f4c46..7b48da75773a6750452e66a5d16b117503f92325 100644 (file)
@@ -36,10 +36,11 @@ public:
         Inset * Clone() const { return new InsetLOT(owner); }
        ///
        string getScreenLabel() const;
-        
+       ///
+       void Edit(BufferView * bv, int, int, unsigned int);
         ///
        EDITABLE Editable() const {
-               return NOT_EDITABLE; // not yet
+               return IS_EDITABLE; // not yet
        }
        ///
        bool display() const { return true; }
index af481dec57d6900dcfab1bb3ab4dc81a1fb8b86a..8107cba39e9413af33a4008dcdfca27da18d0818 100644 (file)
@@ -184,12 +184,19 @@ private:
     void setPos(Painter &, int x, int y) const;
     ///
     UpdatableInset::RESULT moveRight(BufferView *, bool activate_inset = true);
+       ///
     UpdatableInset::RESULT moveLeft(BufferView *, bool activate_inset = true);
+       ///
     UpdatableInset::RESULT moveUp(BufferView *);
+       ///
     UpdatableInset::RESULT moveDown(BufferView *);
+       ///
     bool Delete();
+       ///
     bool cutSelection();
+       ///
     bool copySelection();
+       ///
     bool pasteSelection();
     ///
     bool hasSelection() const
@@ -246,6 +253,7 @@ private:
     typedef std::vector<row_struct> RowList;
     ///
     mutable RowList rows;
+       ///
     InsetText & operator = (InsetText const & it) {
        par = it.par;
        buffer = it.buffer; // suspect
index 88a46f1ea52b7545d63eb9359a5471cf9e329dfa..4c09831aeb630128c0fc44d65eea05bc1a7946cb 100644 (file)
@@ -5,8 +5,6 @@
 #endif
 
 #include "insettoc.h"
-#include "buffer.h"
-#include "bufferlist.h"
 #include "commandtags.h"
 #include "lyxfunc.h"
 #include "LyXView.h"
index 0799aa8862219f019b5f1f4037878b09a9853fd8..6af592d34525bcc2eec967eff6db8fd276a33a02 100644 (file)
--- a/src/lyx.C
+++ b/src/lyx.C
@@ -130,6 +130,9 @@ FD_form_toc *create_form_form_toc(void)
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
     fl_set_object_callback(obj, TocUpdateCB, 0);
+  fdui->toctype = obj = fl_add_choice(FL_NORMAL_CHOICE, 60, 300, 130, 30, idex(_("Type|Tt#t")));fl_set_button_shortcut(obj,scex(_("Type|Tt#t")),1);
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
+    fl_set_object_callback(obj, TocUpdateCB, 0);
   fl_end_form();
 
   //fdui->form_toc->fdui = fdui;
index 7426edf78c54d9ae7c0ddb815d9c3a1e80386ed6..45961281646b26648e1be75734b5a0c9d6ae467d 100644 (file)
--- a/src/lyx.h
+++ b/src/lyx.h
@@ -63,6 +63,7 @@ typedef struct {
        char *cdata;
        long  ldata;
        FL_OBJECT *browser_toc;
+       FL_OBJECT *toctype;
 } FD_form_toc;
 
 extern FD_form_toc * create_form_form_toc(void);
index ccc8ce3ca2fd74a7ea1c33a6f010ffda370fb3b7..26acf58a6a50492ad5325e5fea557bf85795d18b 100644 (file)
@@ -57,6 +57,7 @@ using std::istream_iterator;
 using std::pair;
 using std::vector;
 using std::sort;
+using std::equal;
 
 extern Combox * combo_language;
 extern Combox * combo_language2;
@@ -3134,7 +3135,8 @@ extern "C" void TocCancelCB(FL_OBJECT *, long)
 }
 
 
-extern "C" void TocUpdateCB(FL_OBJECT *, long)
+extern "C"
+void TocUpdateCB(FL_OBJECT *, long)
 {
        if (!current_view->available()) {
                toclist.clear();
@@ -3146,9 +3148,14 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
 
        vector<vector<Buffer::TocItem> > tmp =
                current_view->buffer()->getTocList();
-       if (toclist == tmp[0])
+       int type = fl_get_choice(fd_form_toc->toctype)-1;
+       //if (toclist == tmp[type])
+       //      return;
+       if (toclist.size() == tmp[type].size()
+           && equal(toclist.begin(), toclist.end(), tmp[type].begin()))
                return;
-       toclist = tmp[0];
+
+       toclist = tmp[type];
 
        static Buffer * buffer = 0;
        int topline = 0;
index 4a67a760a8c6e2d262d6fa1c9e79e19d16d124fc..7d491397a94de77d066da50aca261ccb8f32495b 100644 (file)
@@ -558,6 +558,8 @@ void LyXGUI::create_forms()
 
        // the toc form
        fd_form_toc = create_form_form_toc();
+       fl_addto_choice(fd_form_toc->toctype,
+                       _(" TOC | LOF | LOT | LOA "));
        fl_set_form_atclose(fd_form_toc->form_toc, CancelCloseBoxCB, 0);
 
        // the ref form
index 54755e728a551e1eed50f74218dc27e61c4819b9..e5033e777c79b08b207969ecbd486666f6f2baac 100644 (file)
@@ -161,11 +161,11 @@ extern "C" void error_handler(int err_sig);
 void LyX::init(int */*argc*/, char **argv, bool gui)
 {
        // Install the signal handlers
-       ::signal(SIGHUP, error_handler);
-       ::signal(SIGFPE, error_handler);
-       ::signal(SIGSEGV, error_handler);
-       ::signal(SIGINT, error_handler);
-       ::signal(SIGTERM, error_handler);
+       std::signal(SIGHUP, error_handler);
+       std::signal(SIGFPE, error_handler);
+       std::signal(SIGSEGV, error_handler);
+       std::signal(SIGINT, error_handler);
+       std::signal(SIGTERM, error_handler);
 
        //
        // Determine path of binary
index 07dca6dcac5021a66f7aa27ffde78b8034c966b4..19b6ee727c2a8e8ae1932b069ea64a534705c478 100644 (file)
@@ -657,7 +657,7 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, ostream & os) const
        if (orgfont.color() != color()) {
                // To make us file compatible with older
                // lyx versions we emit "default" instead
-               // of "ignore"
+               // of "inherit"
                string col_str(lcolor.getLyXName(color()));
                if (col_str == "inherit") col_str = "default";
                os << "\\color " << col_str << "\n";
index cad7b6ac4cf42c2b8917df24426161db8e26aae0..83e446dc4a0b013774e65d6b5e61d0910fbb48fe 100644 (file)
@@ -811,6 +811,18 @@ string LyXFunc::Dispatch(int ac,
                break;
                
        case LFUN_TOCVIEW:
+       case LFUN_LOFVIEW:
+       case LFUN_LOTVIEW:
+       case LFUN_LOAVIEW:
+       {
+               Buffer::TocType type = Buffer::TOC_TOC;
+               if (action == LFUN_LOFVIEW)
+                       type = Buffer::TOC_LOF;
+               else if (action == LFUN_LOTVIEW)
+                       type = Buffer::TOC_LOT;
+               else if (action == LFUN_LOAVIEW)
+                       type = Buffer::TOC_LOA;
+               fl_set_choice(fd_form_toc->toctype,type + 1);
                TocUpdateCB(0, 0);
                if (fd_form_toc->form_toc->visible) {
                        fl_raise_form(fd_form_toc->form_toc);
@@ -827,7 +839,7 @@ string LyXFunc::Dispatch(int ac,
                        fl_set_form_minsize(fd_form_toc->form_toc, ow, oh);
                }
                break;
-               
+       }       
        case LFUN_TOC_INSERT:
        {
                Inset * new_inset = new InsetTOC(owner->buffer());
@@ -908,7 +920,7 @@ string LyXFunc::Dispatch(int ac,
                bool asPara = false;
                if (argument == "paragraph") asPara = true;
 #ifdef XFORMS_CLIPBOARD
-               owner->view()->pasteSelection(asPara);
+               owner->view()->pasteClipboard(asPara);
 #else
                MenuPasteSelection(asPara);
 #endif
index 03e4dc87e0423000c9abee01669893858d0355e9..2a9c0778a1933b8c3a4572e131c38ff24896422d 100644 (file)
@@ -167,7 +167,7 @@ int LyXLookupString(XEvent * event,
                if (event->type != KeyPress)
                        lyxerr << "LyXLookupString: wrong event type" 
                               <<  event->type << endl;
-               Status status_return;
+               Status status_return = 0;
                
                result =  XmbLookupString(xic, &event->xkey, buffer_return,
                                       bytes_buffer, keysym_return,
index 7852ca9dd5f6a111617ec412af1f86b1d93a311f..d7054fdc1692bae44db7ee053ab6a04c38ba82be 100644 (file)
@@ -134,6 +134,8 @@ public:
        bool isMultiLingual();
        ///
        string String(bool label);
+       ///
+       string String(size_type beg, size_type end);
        
        ///
        void writeFile(std::ostream &, BufferParams const &, char, char) const;
index 96f16b0fc6ac80d8af390f3b30af708b18e10d76..4b5627e771e18d904751abc6548fe23f4f61dd51 100644 (file)
@@ -227,7 +227,9 @@ public:
        void SetSelection();
        ///
        void ClearSelection() const;
-
+       ///
+       string selectionAsString() const;
+       
        /// just selects the word the cursor is in
        void SelectWord();
 
index 9cb9b14c797699610344cc7528bef91127a6504e..b9b4fa3c9c7dd8ea6665f13c1733a74d0b31053c 100644 (file)
@@ -1133,7 +1133,10 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
                                  "|Table%m"
                                  "|Spellchecker...."
                                  "|Check TeX"
-                                 "|Table of Contents...%l"
+                                 "|Table of Contents..."
+                                 "|List of Figures..."
+                                 "|List of Tables..."
+                                 "|List of Algorithms...%l"
                                  "|Version Control%m%l"
                                  "|View LaTeX log file%l"
                                  "|Paste Primary Selection as Lines"
@@ -1149,14 +1152,17 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
        fl_setpup_shortcut(EditMenu, 7, scex(_("EM|Ee#e#E")));
        fl_setpup_shortcut(EditMenu, 8, scex(_("EM|Nn#n#N")));
        fl_setpup_shortcut(EditMenu, 9, scex(_("EM|Ii#i#I")));
-       fl_setpup_shortcut(EditMenu, 10, scex(_("EM|Tt#t#T")));
+       //fl_setpup_shortcut(EditMenu, 10, scex(_("EM|Tt#t#T")));
        fl_setpup_shortcut(EditMenu, 11, scex(_("EM|Ss#s#S")));
        fl_setpup_shortcut(EditMenu, 12, scex(_("EM|hH#h#H")));
-       fl_setpup_shortcut(EditMenu, 13, scex(_("EM|aA#a#A")));
-       fl_setpup_shortcut(EditMenu, 14, scex(_("EM|Vv#v#V")));
-       fl_setpup_shortcut(EditMenu, 15, scex(_("EM|wW#w#W")));
-       fl_setpup_shortcut(EditMenu, 16, scex(_("EM|Ll#l#L")));
-       fl_setpup_shortcut(EditMenu, 17, scex(_("EM|gG#g#G")));
+       fl_setpup_shortcut(EditMenu, 13, scex(_("EM|Tt#t#T")));
+       //fl_setpup_shortcut(EditMenu, 14, scex(_("EM|Ff#f#F")));
+       //fl_setpup_shortcut(EditMenu, 15, scex(_("EM|bB#b#B")));
+       //fl_setpup_shortcut(EditMenu, 16, scex(_("EM|mM#m#M")));
+       fl_setpup_shortcut(EditMenu, 17, scex(_("EM|Vv#v#V")));
+       fl_setpup_shortcut(EditMenu, 18, scex(_("EM|wW#w#W")));
+       fl_setpup_shortcut(EditMenu, 19, scex(_("EM|Ll#l#L")));
+       fl_setpup_shortcut(EditMenu, 20, scex(_("EM|gG#g#G")));
       
        // disable unavailable entries.
        if(tmpbuffer->undostack.empty())
@@ -1173,8 +1179,8 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
                 fl_setpup_mode(EditMenu, 2, FL_PUP_GREY); 
                 fl_setpup_mode(EditMenu, 3, FL_PUP_GREY); 
                 fl_setpup_mode(EditMenu, 5, FL_PUP_GREY); 
-                fl_setpup_mode(EditMenu, 16, FL_PUP_GREY); 
-                fl_setpup_mode(EditMenu, 17, FL_PUP_GREY);
+                fl_setpup_mode(EditMenu, 19, FL_PUP_GREY); 
+                fl_setpup_mode(EditMenu, 20, FL_PUP_GREY);
        }
        
        fl_setpup_position(men->_view->getForm()->x + ob->x,
@@ -1203,11 +1209,14 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
        case 11: tmpfunc->Dispatch(LFUN_SPELLCHECK); break;
        case 12: tmpfunc->Dispatch(LFUN_RUNCHKTEX); break;
        case 13: tmpfunc->Dispatch(LFUN_TOCVIEW); break;
-       case 14: // version control
+       case 14: tmpfunc->Dispatch(LFUN_LOFVIEW); break;
+       case 15: tmpfunc->Dispatch(LFUN_LOTVIEW); break;
+       case 16: tmpfunc->Dispatch(LFUN_LOAVIEW); break;
+       case 17: // version control
                break;
-       case 15: tmpfunc->Dispatch(LFUN_LATEX_LOG); break;
-       case 16: tmpfunc->Dispatch(LFUN_PASTESELECTION, "line"); break;
-       case 17: tmpfunc->Dispatch(LFUN_PASTESELECTION, "paragraph"); break;
+       case 18: tmpfunc->Dispatch(LFUN_LATEX_LOG); break;
+       case 19: tmpfunc->Dispatch(LFUN_PASTESELECTION, "line"); break;
+       case 20: tmpfunc->Dispatch(LFUN_PASTESELECTION, "paragraph"); break;
 
                // floats & insets sub-menu
        case 21: men->currentView()->toggleFloat(); break;
@@ -1442,10 +1451,9 @@ void Menus::ShowRefsMenu(FL_OBJECT * ob, long)
        fl_addtopup(RefsMenu, _("Insert Reference:%d%x0"));
        Add_to_refs_menu(label_list, 1, RefsMenu, menus, ob);
 
-       if (label_list.empty()) {
-               fl_setpup_mode(RefsMenu, 1, FL_PUP_GREY);
-               fl_setpup_mode(RefsMenu, 2, FL_PUP_GREY);
-       }
+       if (label_list.empty())
+               for (int j = 1; j <= 5; ++j)
+                       fl_setpup_mode(RefsMenu, j, FL_PUP_GREY);
 
        fl_setpup_position(
                men->_view->getForm()->x + ob->x,
index 6464dfe2d90a44c3e53e6ea998593981fba833e4..1fcb14900b94186fd74f9067027addde282f606b 100644 (file)
@@ -40,6 +40,7 @@ using std::fstream;
 using std::ios;
 using std::lower_bound;
 using std::upper_bound;
+using std::reverse;
 
 int tex_code_break_column = 72;  // needs non-zero initialization. set later.
 // this is a bad idea, but how can LyXParagraph find its buffer to get
@@ -4268,7 +4269,7 @@ string LyXParagraph::String(bool label)
                s += labelstring + ' ';
        string::size_type len = s.size();
 
-       for (LyXParagraph::size_type i = 0;i < size(); ++i) {
+       for (LyXParagraph::size_type i = 0; i < size(); ++i) {
                unsigned char c = GetChar(i);
                if (IsPrintable(c))
                        s += c;
@@ -4295,3 +4296,36 @@ string LyXParagraph::String(bool label)
        }
        return s;
 }
+
+
+string LyXParagraph::String(LyXParagraph::size_type beg,
+                           LyXParagraph::size_type end)
+{
+       string s;
+
+       for (LyXParagraph::size_type i = beg; i < end; ++i) {
+               unsigned char c = GetChar(i);
+               if (IsPrintable(c))
+                       s += c;
+               else if (c == META_INSET) {
+#ifdef HAVE_SSTREAM
+                       std::ostringstream ost;
+                       GetInset(i)->Ascii(ost);
+#else
+                       ostrstream ost;
+                       GetInset(i)->Ascii(ost);
+                       ost << '\0';
+#endif
+                       s += subst(ost.str(),'\n',' ');
+               }
+       }
+
+       if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
+               s += NextAfterFootnote()->String(false);
+
+       if (!IsDummy()) {
+               if (isRightToLeftPar())
+                       reverse(s.begin(), s.end());
+       }
+       return s;
+}
index 6b61b9228e9f08331b7128b240aeb51f6f89747a..0a22e4370eb3fc2ca30496a6e86f55ba68d70d34 100644 (file)
@@ -50,7 +50,7 @@ LyXScreen::LyXScreen(WorkArea & o, LyXText * text_ptr)
 {
        first = 0;
    
-       /* the cursor isnt yet visible */ 
+       // the cursor isnt yet visible
        cursor_visible = false;
        cursor_pixmap = 0;
        cursor_pixmap_x = 0;
@@ -91,12 +91,12 @@ void LyXScreen::DrawFromTo(int y1, int y2)
 {
        long y_text = first + y1;
    
-       /* get the first needed row */ 
+       // get the first needed row 
        Row * row = text->GetRowNearY(y_text);
-       /* y_text is now the real beginning of the row */
+       // y_text is now the real beginning of the row
    
        long y = y_text - first;
-       /* y1 is now the real beginning of row on the screen */
+       // y1 is now the real beginning of row on the screen
        
        while (row != 0 && y < y2) {
                text->GetVisibleRow(y, row, y + first);
@@ -104,7 +104,7 @@ void LyXScreen::DrawFromTo(int y1, int y2)
                row = row->next;
        }
    
-       /* maybe we have to clear the screen at the bottom */ 
+       // maybe we have to clear the screen at the bottom
        if (y < y2) {
                owner.getPainter().fillRectangle(0, y,
                                                 owner.workWidth(),
@@ -131,11 +131,10 @@ void LyXScreen::Draw(unsigned long y)
 {
        if (cursor_visible) HideCursor();
 
-       //if (y < 0) y = 0;
        unsigned long old_first = first;
        first = y;
 
-       /* is any optimiziation possible? */ 
+       // is any optimiziation possible?
        if ((y - old_first) < owner.height()
            && (old_first - y) < owner.height()) {
                if (first < old_first) {
@@ -174,7 +173,7 @@ void LyXScreen::Draw(unsigned long y)
                               owner.workWidth(), first - old_first);
                }
        } else {
-               /* make a dumb new-draw */ 
+               // make a dumb new-draw 
                DrawFromTo(0, owner.height());
                expose(0, 0, owner.workWidth(), owner.height());
        }
@@ -205,12 +204,12 @@ bool LyXScreen::FitManualCursor(long /*x*/, long y, int asc, int desc)
        long newtop = first;
   
        if (y + desc - first >= owner.height())
-               newtop = y - 3 * owner.height() / 4;   /* the scroll region must be so big!! */
+               newtop = y - 3 * owner.height() / 4;  // the scroll region must be so big!!
        else if (y - asc < long(first)
                && first > 0) {
                newtop = y - owner.height() / 4;
        }
-       //if (newtop < 0)
+
        newtop = max(newtop, 0L); // can newtop ever be < 0? (Lgb)
   
        if (newtop != long(first)) {
@@ -231,7 +230,6 @@ void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc,
        unsigned long y2 = min(y - first + desc, ulong(owner.height()));
 
        // Secure against very strange situations
-       //if (y2 < y1) y2 = y1;
        y2 = max(y2, y1);
        
        if (cursor_pixmap){
@@ -351,12 +349,10 @@ unsigned long LyXScreen::TopCursorVisible()
                        newtop = text->cursor.y - text->cursor.row->baseline;
                else {
                        newtop = text->cursor.y - owner.height() / 4;
-                       //if (newtop > long(first))
                        newtop = min(newtop, long(first));
                }
        }
-       //if (newtop < 0)
-       //      newtop = 0;
+
        newtop = max(newtop, 0L);
 
        return newtop;
@@ -392,7 +388,7 @@ void LyXScreen::Update()
        break;
        case LyXText::NEED_VERY_LITTLE_REFRESH:
        {
-               /* ok I will update the current cursor row */
+               // ok I will update the current cursor row
                DrawOneRow(text->refresh_row, text->refresh_y);
                text->status = LyXText::UNCHANGED;
                expose(0, text->refresh_y - first,
@@ -408,20 +404,9 @@ void LyXScreen::Update()
 
 void LyXScreen::ToggleSelection(bool kill_selection)
 {
-       /* only if there is a selection */ 
+       // only if there is a selection
        if (!text->selection) return;
 
-       //long top = text->sel_start_cursor.y
-       //      - text->sel_start_cursor.row->baseline;
-       //long bottom = text->sel_end_cursor.y
-       //      - text->sel_end_cursor.row->baseline 
-       //      + text->sel_end_cursor.row->height;
-
-       //top = max(top, first);
-       //bottom = max(bottom, first);
-       
-       //bottom = min(max(bottom, first), first + owner.height());
-       //top = min(max(top, first), first + owner.height());
        long bottom = min(max(text->sel_end_cursor.y
                              - text->sel_end_cursor.row->baseline
                              + text->sel_end_cursor.row->height, first),
@@ -451,8 +436,6 @@ void LyXScreen::ToggleToggle()
                - text->toggle_end_cursor.row->baseline 
                + text->toggle_end_cursor.row->height;
        
-       //top = max(top, first);
-       //bottom = max(bottom, first);
        typedef unsigned long ulong;
        
        bottom = min(max(ulong(bottom), first), first + owner.height());
index 8feb545ea61eea70a3c20f7e68e7321e29ac70e0..4c33dc9e41de33dc454f0b4071e1b163e27632df 100644 (file)
@@ -594,8 +594,8 @@ void LyXText::draw(Row const * row,
        
        // what about underbars?
        if (font.underbar() == LyXFont::ON && font.latex() != LyXFont::ON) {
-               pain.line(tmpx, offset + row->baseline + 2,
-                         x, offset + row->baseline + 2);
+               pain.line(int(tmpx), offset + row->baseline + 2,
+                         int(x), offset + row->baseline + 2);
                
        }
 
@@ -2998,13 +2998,13 @@ void LyXText::CursorLeftOneWord()  const
 
 void LyXText::SelectWord() 
 {
-       /* Move cursor to the beginning, when not already there. */
+       // Move cursor to the beginning, when not already there.
        if ( cursor.pos
             && !cursor.par->IsSeparator(cursor.pos-1)
             && !cursor.par->IsKomma(cursor.pos-1) )
                CursorLeftOneWord();
 
-       /* set the sel cursor */
+       // set the sel cursor
        sel_cursor = cursor;
 
        while ( cursor.pos < cursor.par->Last()
@@ -3013,7 +3013,7 @@ void LyXText::SelectWord()
                cursor.pos++;
        SetCursor( cursor.par, cursor.pos );
        
-       /* finally set the selection */ 
+       // finally set the selection
        SetSelection();
 }
 
@@ -3702,7 +3702,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                        if ( (sel_start_cursor.row != row_ptr && !is_rtl) ||
                             (sel_end_cursor.row != row_ptr && is_rtl))
                                pain.fillRectangle(0, offset,
-                                                  tmpx, row_ptr->height,
+                                                  int(tmpx), row_ptr->height,
                                                   LColor::selection);
                        if (row_ptr->par->table) {
                                float x_old = x;
@@ -3721,8 +3721,8 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                                              sel_start_cursor.pos <= pos) &&
                                             (sel_end_cursor.row != row_ptr ||
                                              pos < sel_end_cursor.pos) )
-                                               pain.fillRectangle(old_tmpx, offset,
-                                                                  tmpx - old_tmpx + 1,
+                                               pain.fillRectangle(int(old_tmpx), offset,
+                                                                  int(tmpx - old_tmpx + 1),
                                                                   row_ptr->height,
                                                                   LColor::selection);
                                }
@@ -3759,16 +3759,16 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                                              sel_start_cursor.pos <= pos) &&
                                             (sel_end_cursor.row != row_ptr ||
                                              pos < sel_end_cursor.pos) )
-                                               pain.fillRectangle(old_tmpx, offset,
-                                                                  tmpx - old_tmpx + 1,
+                                               pain.fillRectangle(int(old_tmpx), offset,
+                                                                  int(tmpx - old_tmpx + 1),
                                                                   row_ptr->height,
                                                           LColor::selection);
                                }
                        }
                        if ( (sel_start_cursor.row != row_ptr && is_rtl) ||
                             (sel_end_cursor.row != row_ptr && !is_rtl) )
-                               pain.fillRectangle(tmpx, offset,
-                                                  paperwidth - tmpx,
+                               pain.fillRectangle(int(tmpx), offset,
+                                                  int(paperwidth - tmpx),
                                                   row_ptr->height,
                                                   LColor::selection);
                }
index d0d758faaf11a94dc28099f77638d09b04abe1e5..026eae8427b5bf2196ebd04b5d97b1e5d0e9ce9a 100644 (file)
@@ -1006,8 +1006,8 @@ bool LyXText::FullRebreak()
 
 
 /* the cursor set functions have a special mechanism. When they
-* realize, that you left an empty paragraph, they will delete it.
-* They also delet the corresponding row */
+ * realize, that you left an empty paragraph, they will delete it.
+ * They also delete the corresponding row */
    
 // need the selection cursor:
 void LyXText::SetSelection()
@@ -1021,12 +1021,12 @@ void LyXText::SetSelection()
        selection = true;
    
        // first the toggling area
-       if (cursor.y < last_sel_cursor.y ||
-           (cursor.y == last_sel_cursor.y && cursor.x < last_sel_cursor.x)) {
+       if (cursor.y < last_sel_cursor.y
+           || (cursor.y == last_sel_cursor.y
+            && cursor.x < last_sel_cursor.x)) {
                toggle_end_cursor = last_sel_cursor;
                toggle_cursor = cursor;
-       }
-       else {
+       } else {
                toggle_end_cursor = cursor;
                toggle_cursor = last_sel_cursor;
        }
@@ -1057,6 +1057,49 @@ void LyXText::SetSelection()
        if (sel_start_cursor.x == sel_end_cursor.x && 
            sel_start_cursor.y == sel_end_cursor.y)
                selection = false;
+
+       // Stuff what we got on the clipboard. Even if there is no selection.
+
+       // There is a problem with having the stuffing here in that the
+       // larger the selection the slower LyX will get. This can be
+       // solved by running the line below only when the selection has
+       // finished. The solution used currently just works, to make it
+       // faster we need to be more clever and probably also have more
+       // calls to stuffClipboard. (Lgb)
+       owner_->stuffClipboard(selectionAsString());
+}
+
+
+string LyXText::selectionAsString() const
+{
+       if (!selection) return string();
+       string result;
+       
+       // Special handling if the whole selection is within one paragraph
+       if (sel_start_cursor.par == sel_end_cursor.par) {
+               result += sel_start_cursor.par->String(sel_start_cursor.pos,
+                                                      sel_end_cursor.pos);
+               return result;
+       }
+       
+       // The selection spans more than one paragraph
+
+       // First paragraph in selection
+       result += sel_start_cursor.par->String(sel_start_cursor.pos,
+                                              sel_start_cursor.par->Last());
+       
+       // The paragraphs in between (if any)
+       LyXCursor tmpcur(sel_start_cursor);
+       tmpcur.par = tmpcur.par->Next();
+       while (tmpcur.par != sel_end_cursor.par) {
+               result += tmpcur.par->String(false);
+               tmpcur.par = tmpcur.par->Next(); // Or NextAfterFootnote??
+       }
+
+       // Last paragraph in selection
+       result += sel_end_cursor.par->String(0, sel_end_cursor.pos);
+       
+       return result;
 }