]> git.lyx.org Git - features.git/commitdiff
fix the deadkey bug and a patch from Dekel
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sun, 17 Dec 2000 06:09:35 +0000 (06:09 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sun, 17 Dec 2000 06:09:35 +0000 (06:09 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1280 a592a061-630c-0410-9148-cb99ea01b6c8

21 files changed:
ChangeLog
po/POTFILES.in
src/BufferView.h
src/BufferView2.C
src/BufferView_pimpl.C
src/WorkArea.C
src/bufferview_funcs.C
src/insets/inset.C
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insetexternal.C
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/insets/lyxinset.h
src/kbmap.C
src/kbsequence.C
src/lyxfunc.C
src/support/lyxfunctional.h
src/text2.C

index b15533e9f3134e0eb69efbf4ab02f693dcaac369..dbdf020ed23c4c28fd5ae887127fb7181e1d0fc0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2000-12-17  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/kbsequence.C (addkey): also clear sequence and modifiers if
+       length == 0
+
+       * src/BufferView2.C (theLockingInset): return 0 if text is 0
+
+2000-12-17  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * Many files: Fix RTL support for insettext.
+
 2000-12-11  John Levon  <moz@compsoc.man.ac.uk>
 
        * README: add mention of broken ghostscript versions, remove
@@ -10,6 +21,9 @@
 
 2000-12-11  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
+       * src/insets/insetexternal.C (getScreenLabel): Return a default
+       value if the template label is empty.
+
        * src/lyxlookup.C: do not condition on FL_REVISION.
 
        * forms/sp_form.fd:
index 59c622c5603bf49229119b68e9af317e5922d8d6..6bbe76c9238b543b588a1d074c3a5eb31ac3312f 100644 (file)
@@ -53,35 +53,35 @@ src/frontends/kde/refdlg.C
 src/frontends/kde/tocdlg.C
 src/frontends/kde/urldlg.C
 src/frontends/xforms/FormBase.h
-src/frontends/xforms/FormCitation.C
 src/frontends/xforms/form_citation.C
-src/frontends/xforms/FormCopyright.C
+src/frontends/xforms/FormCitation.C
 src/frontends/xforms/form_copyright.C
-src/frontends/xforms/FormDocument.C
+src/frontends/xforms/FormCopyright.C
 src/frontends/xforms/form_document.C
-src/frontends/xforms/FormError.C
+src/frontends/xforms/FormDocument.C
 src/frontends/xforms/form_error.C
-src/frontends/xforms/FormGraphics.C
+src/frontends/xforms/FormError.C
 src/frontends/xforms/form_graphics.C
-src/frontends/xforms/FormIndex.C
+src/frontends/xforms/FormGraphics.C
 src/frontends/xforms/form_index.C
+src/frontends/xforms/FormIndex.C
 src/frontends/xforms/FormInset.h
-src/frontends/xforms/FormParagraph.C
 src/frontends/xforms/form_paragraph.C
-src/frontends/xforms/FormPreferences.C
+src/frontends/xforms/FormParagraph.C
 src/frontends/xforms/form_preferences.C
-src/frontends/xforms/FormPrint.C
+src/frontends/xforms/FormPreferences.C
 src/frontends/xforms/form_print.C
-src/frontends/xforms/FormRef.C
+src/frontends/xforms/FormPrint.C
 src/frontends/xforms/form_ref.C
-src/frontends/xforms/FormTabular.C
+src/frontends/xforms/FormRef.C
 src/frontends/xforms/form_tabular.C
-src/frontends/xforms/FormTabularCreate.C
+src/frontends/xforms/FormTabular.C
 src/frontends/xforms/form_tabular_create.C
-src/frontends/xforms/FormToc.C
+src/frontends/xforms/FormTabularCreate.C
 src/frontends/xforms/form_toc.C
-src/frontends/xforms/FormUrl.C
+src/frontends/xforms/FormToc.C
 src/frontends/xforms/form_url.C
+src/frontends/xforms/FormUrl.C
 src/frontends/xforms/input_validators.C
 src/frontends/xforms/Menubar_pimpl.C
 src/frontends/xforms/xform_helpers.C
index fbe29d70d2e32117a6a5e591d07c67c33670e6e2..47deee2bfd57af7b0c6a3ec68c5bc8bda97768d9 100644 (file)
@@ -100,6 +100,8 @@ public:
        */
        LyXText * text;
        ///
+       LyXText * getLyXText() const;
+       ///
        int workWidth() const;
        ///
        UpdatableInset * theLockingInset() const;
index 2f90faa7533577e1e248cf0a0ab9e2bc461c19dc..b1a13b1097ade11635499792fdeda31724c6e368 100644 (file)
@@ -741,9 +741,20 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
                     theLockingInset()->GetLockingInset()))
                        text->SetCursor(this, cursor,
                                        cursor.par(), cursor.pos() - 1);
+               LyXScreen::Cursor_Shape shape = LyXScreen::BAR_SHAPE;
+               LyXText * txt = getLyXText();
+               if (theLockingInset()->GetLockingInset()->LyxCode() ==
+                   Inset::TEXT_CODE &&
+                   (txt->real_current_font.language() !=
+                    buffer()->params.language
+                    || txt->real_current_font.isVisibleRightToLeft()
+                    != buffer()->params.language->RightToLeft()))
+                       shape = (txt->real_current_font.isVisibleRightToLeft())
+                               ? LyXScreen::REVERSED_L_SHAPE
+                               : LyXScreen::L_SHAPE;
                y += cursor.y() + theLockingInset()->InsetInInsetY();
                pimpl_->screen_->ShowManualCursor(text, x, y, asc, desc,
-                                                 LyXScreen::BAR_SHAPE);
+                                                 shape);
        }
 }
 
@@ -910,7 +921,10 @@ bool BufferView::ChangeRefsIfUnique(string const & from, string const & to)
 
 UpdatableInset * BufferView::theLockingInset() const
 {
-    return text->the_locking_inset;
+       // If NULL is not allowed we should put an Assert here. (Lgb)
+       if (text)
+               return text->the_locking_inset;
+       return 0;
 }
 
 
@@ -918,3 +932,15 @@ void BufferView::theLockingInset(UpdatableInset * inset)
 {
     text->the_locking_inset = inset;
 }
+
+
+LyXText * BufferView::getLyXText() const
+{
+       if (theLockingInset()) {
+               LyXText * txt = theLockingInset()->getLyXText(this);
+               if (txt)
+                       return txt;
+       }
+       return text;
+}
+
index 855c71926116df11cd1e26bc31796106ac4707fb..6d6c98fe8f523af2108e8795e2ea92a48b2f7c98 100644 (file)
@@ -1237,8 +1237,9 @@ void BufferView::Pimpl::setState()
        if (!lyxrc.rtl_support)
                return;
 
-       if (bv_->text->real_current_font.isRightToLeft() &&
-           bv_->text->real_current_font.latex() != LyXFont::ON) {
+       LyXText * text = bv_->getLyXText();
+       if (text->real_current_font.isRightToLeft() &&
+           text->real_current_font.latex() != LyXFont::ON) {
                if (owner_->getIntl()->primarykeymap)
                        owner_->getIntl()->KeyMapSec();
        } else {
index 5735d381f36a22e5892f3a0905bff10f5a31b567..57e8e01f1842ee08eddb1cd8c7d6da38df377295 100644 (file)
@@ -346,8 +346,8 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                if (lyxerr.debugging(Debug::KEY)) {
                        char const * tmp = XKeysymToString(key);
                        char const * tmp2 = XKeysymToString(keysym);
-                       string stm = (tmp ? tmp : "");
-                       string stm2 = (tmp2 ? tmp2 : "");
+                       string const stm = (tmp ? tmp : "");
+                       string const stm2 = (tmp2 ? tmp2 : "");
                        
                        lyxerr << "WorkArea: Key is `" << stm << "' ["
                               << key << "]" << endl;
@@ -387,7 +387,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                }
                
 #endif 
-               unsigned int ret_state = xke->state;
+               unsigned int const ret_state = xke->state;
 
                // If you have a better way to handle "wild-output" of
                // characters after the key has been released than the one
@@ -399,7 +399,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                                   << xke->time - last_time_pressed
                                   << endl;
                if (xke->time - last_time_pressed < 35 // should perhaps be tunable
-                   && xke->state == last_state_pressed
+                   && ret_state == last_state_pressed
                    && xke->keycode == last_key_pressed) {
                        lyxerr[Debug::KEY]
                                << "Workarea: Purging X events." << endl;
@@ -417,7 +417,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                }
                last_time_pressed = xke->time;
                last_key_pressed = xke->keycode;
-               last_state_pressed = xke->state;
+               last_state_pressed = ret_state;
                
                area->workAreaKeyPress(ret_key, ret_state);
        }
index bcdf2cc0c6fb77514a5cfda56e0fe68f292eb6e7..a68acf56c069943f5c72bf1d9266e7d32e3f7689 100644 (file)
@@ -253,13 +253,7 @@ string const CurrentState(BufferView * bv)
        if (bv->available()) { 
                // I think we should only show changes from the default
                // font. (Asger)
-               LyXText *text = 0;
-
-               if (bv->theLockingInset())
-                   text = bv->theLockingInset()->getLyXText(bv);
-               if (!text)
-                   text = bv->text;
-
+               LyXText * text = bv->getLyXText();
                Buffer * buffer = bv->buffer();
                LyXFont font = text->real_current_font;
                LyXFont const & defaultfont =
@@ -320,7 +314,7 @@ void ToggleAndShow(BufferView * bv, LyXFont const & font)
                if (font.language() != ignore_language ||
                    font.latex() != LyXFont::IGNORE ||
                    font.number() != LyXFont::IGNORE) {
-                       LyXText * text = bv->text;
+                       LyXText * text = bv->getLyXText();
                        LyXCursor & cursor = text->cursor;
                        text->ComputeBidiTables(bv->buffer(), cursor.row());
                        if (cursor.boundary() != 
index c5526aa723fd0b909c94bad24e276512901be91d..fa361c96fc992b502587a6f75b1bbe6117afdbde 100644 (file)
@@ -76,7 +76,7 @@ string const Inset::EditMessage() const
 }
 
 
-LyXText * Inset::getLyXText(BufferView * bv) const
+LyXText * Inset::getLyXText(BufferView const * bv) const
 {
     if (owner())
            return owner()->getLyXText(bv);
index ca8f71d31c6bb15cbbcda4fa2f195c25ebcab8ef..8698182c10301675dea3a30a0320643d87c332a0 100644 (file)
@@ -435,7 +435,7 @@ bool InsetCollapsable::doClearArea() const
 }
 
 
-LyXText * InsetCollapsable::getLyXText(BufferView * bv) const
+LyXText * InsetCollapsable::getLyXText(BufferView const * bv) const
 {
     return inset->getLyXText(bv);
 }
index 87b89ffbe9cb6622c1a514db576ac60200db2372..f8a3b69688ec51ab0af1a6a3ac58b5711696ddb3 100644 (file)
@@ -120,7 +120,7 @@ public:
     ///
     int getMaxWidth(Painter & pain, UpdatableInset const *) const;
     ///
-    LyXText * getLyXText(BufferView *) const;
+    LyXText * getLyXText(BufferView const *) const;
     ///
     void deleteLyXText(BufferView *, bool recursive=true) const;
     ///
index d1f7fd49be43504b9192db21e59a89eea71eda14..13cee12c2bf32414bcbebde4073d5976c60d7104 100644 (file)
@@ -420,7 +420,10 @@ string const InsetExternal::getScreenLabel() const
                return _("External");
        } else {
                ExternalTemplate const & et = getTemplate(templatename);
-               return doSubstitution(0, et.guiName);
+               if (et.guiName.empty())
+                       return "ext: ???";
+               else
+                       return doSubstitution(0, et.guiName);
        }
 }
 
@@ -550,7 +553,9 @@ int InsetExternal::getTemplateNumber(string const & name) const
                ++i;
        }
        // This should never happen
-       Assert(false);
+       ///  This can happen if someone sends you a lyx file that uses
+       ///  external templates that are defined only on his machine
+       //Assert(false);
        return 0;
 }
 
index 3636d99d7903110856b04d8374fcddc573840b5c..0563397d6c10a2e5a7847f0b0885dc7b897e7289 100644 (file)
@@ -1724,7 +1724,7 @@ void InsetTabular::resizeLyXText(BufferView *) const
 }
 
 
-LyXText * InsetTabular::getLyXText(BufferView * bv) const
+LyXText * InsetTabular::getLyXText(BufferView const * bv) const
 {
     if (the_locking_inset)
        return the_locking_inset->getLyXText(bv);
index f9d8396978d1e247f87babad3462af72dc0c0b95..c9af4cd409f663147279234e6848738d231e0eba 100644 (file)
@@ -166,7 +166,7 @@ public:
     ///
     Buffer * BufferOwner() const { return const_cast<Buffer *>(buffer); }
     ///
-    LyXText * getLyXText(BufferView *) const;
+    LyXText * getLyXText(BufferView const *) const;
     ///
     void resizeLyXText(BufferView *) const;
     ///
index 2d5f381ea49d296b8d43e21465bd0f7ffe737c1c..f3edf42778347bf1fb81271c272b8a91d6939bf8 100644 (file)
@@ -480,6 +480,7 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
     locked = true;
     the_locking_inset = 0;
     inset_pos = inset_x = inset_y = 0;
+    inset_boundary = false;
     inset_par = 0;
     old_par = 0;
     if (!checkAndActivateInset(bv, x, y, button))
@@ -523,6 +524,7 @@ bool InsetText::LockInsetInInset(BufferView * bv, UpdatableInset * inset)
        inset_y = cy(bv) + drawTextYOffset;
        inset_pos = cpos(bv);
        inset_par = cpar(bv);
+       inset_boundary = cboundary(bv);
        TEXT(bv)->UpdateInset(bv, the_locking_inset);
        return true;
     } else if (the_locking_inset && (the_locking_inset == inset)) {
@@ -618,6 +620,7 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
            inset_y = cy(bv) + drawTextYOffset;
            inset_pos = cpos(bv);
            inset_par = cpar(bv);
+           inset_boundary = cboundary(bv);
            the_locking_inset = uinset;
            uinset->InsetButtonPress(bv, x - inset_x, y - inset_y, button);
            uinset->Edit(bv, x - inset_x, y - inset_y, 0);
@@ -749,7 +752,7 @@ InsetText::LocalDispatch(BufferView * bv,
     HideInsetCursor(bv);
     switch (action) {
        // Normal chars
-    case -1:
+    case LFUN_UNKNOWN_ACTION:
        if (bv->buffer()->isReadonly()) {
            LyXBell();
 //         setErrorMessage(N_("Document is read only"));
@@ -788,6 +791,7 @@ InsetText::LocalDispatch(BufferView * bv,
                font.setLanguage(text->cursor.par()->getParLanguage(bv->buffer()->params));
                SetFont(bv, font, false);
            }
+           bv->setState();
            if (lyxrc.auto_region_delete) {
                if (TEXT(bv)->selection){
                    TEXT(bv)->CutSelection(bv, false);
@@ -1480,6 +1484,11 @@ LyXParagraph * InsetText::cpar(BufferView * bv) const
     return TEXT(bv)->cursor.par();
 }
 
+bool InsetText::cboundary(BufferView * bv) const
+{
+    return TEXT(bv)->cursor.boundary();
+}
+
 
 Row * InsetText::crow(BufferView * bv) const
 {
@@ -1487,15 +1496,18 @@ Row * InsetText::crow(BufferView * bv) const
 }
 
 
-LyXText * InsetText::getLyXText(BufferView bv) const
+LyXText * InsetText::getLyXText(BufferView const * lbv) const
 {
+    // Super UGLY! (Lgb)
+    BufferView * bv = const_cast<BufferView *>(lbv);
+       
     if ((cache.find(bv) != cache.end()) && cache[bv])
        return cache[bv];
     LyXText * lt = new LyXText(const_cast<InsetText *>(this));
     lt->init(bv);
     cache[bv] = lt;
     if (the_locking_inset) {
-       lt->SetCursor(bv, inset_par, inset_pos);
+       lt->SetCursor(bv, inset_par, inset_pos, true, inset_boundary);
     }
     return lt;
 }
@@ -1530,6 +1542,9 @@ void InsetText::resizeLyXText(BufferView * bv) const
     LyXParagraph::size_type pos = 0;
     LyXParagraph::size_type selstartpos = 0;
     LyXParagraph::size_type selendpos = 0;
+    bool boundary = false;
+    bool selstartboundary = false;
+    bool selendboundary = false;
     int selection = 0;
     int mark_set = 0;
 
@@ -1538,10 +1553,13 @@ void InsetText::resizeLyXText(BufferView * bv) const
     if (locked) {
        lpar = TEXT(bv)->cursor.par();
        pos = TEXT(bv)->cursor.pos();
+       boundary = TEXT(bv)->cursor.boundary();
        selstartpar = TEXT(bv)->sel_start_cursor.par();
        selstartpos = TEXT(bv)->sel_start_cursor.pos();
+       selstartboundary = TEXT(bv)->sel_start_cursor.boundary();
        selendpar = TEXT(bv)->sel_end_cursor.par();
        selendpos = TEXT(bv)->sel_end_cursor.pos();
+       selendboundary = TEXT(bv)->sel_end_cursor.boundary();
        selection = TEXT(bv)->selection;
        mark_set = TEXT(bv)->mark_set;
     }
@@ -1553,13 +1571,14 @@ void InsetText::resizeLyXText(BufferView * bv) const
         * Mechanism when setting the cursor */
        TEXT(bv)->mark_set = mark_set;
        if (selection) {
-           TEXT(bv)->SetCursor(bv, selstartpar, selstartpos);
+           TEXT(bv)->SetCursor(bv, selstartpar, selstartpos,true, 
+                               selstartboundary);
            TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
-           TEXT(bv)->SetCursor(bv, selendpar, selendpos);
+           TEXT(bv)->SetCursor(bv, selendpar, selendpos, true, selendboundary);
            TEXT(bv)->SetSelection();
            TEXT(bv)->SetCursor(bv, lpar, pos);
        } else {
-           TEXT(bv)->SetCursor(bv, lpar, pos);
+           TEXT(bv)->SetCursor(bv, lpar, pos, true, boundary);
            TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
            TEXT(bv)->selection = false;
        }
index cfa525aea591a4ad1f26d9108da1a97ee8e1527e..d7b1e9757af3e4379a80756ee2be78d9ea48241b 100644 (file)
@@ -164,7 +164,7 @@ public:
     ///
     void SetFrameColor(BufferView *, LColor::color);
     ///
-    LyXText * getLyXText(BufferView *) const;
+    LyXText * getLyXText(BufferView const *) const;
     ///
     void deleteLyXText(BufferView *, bool recursive=true) const;
     ///
@@ -229,6 +229,8 @@ private:
     ///
     LyXParagraph * cpar(BufferView *) const;
     ///
+    bool cboundary(BufferView *) const;
+    ///
     Row * crow(BufferView *) const;
 
     /// This instead of a macro
@@ -256,6 +258,8 @@ private:
     ///
     LyXParagraph::size_type inset_pos;
     ///
+    bool inset_boundary;
+    ///
     mutable int inset_x;
     ///
     mutable int inset_y;
index da544af9be8ef8a69550b5836c5b1829ccce3b2c..146741299b6a8d4d0a296e5ae7f569cdfd5cd0d6 100644 (file)
@@ -223,7 +223,7 @@ public:
        // because we could have fake text insets and have to call this
        // inside them without cast!!!
        ///
-       virtual LyXText * getLyXText(BufferView *) const;
+       virtual LyXText * getLyXText(BufferView const *) const;
        ///
        virtual void deleteLyXText(BufferView *, bool = true) const {}
        ///
index 13f19e224d4fb751629fc6c67242700f70e7bf6c..00462974adf3b83bf228a08f4f945b323642fb2b 100644 (file)
@@ -73,6 +73,12 @@ void kb_keymap::printKey(kb_key const & key, string & buf)
 // This binds a key to an action
 int kb_keymap::bind(string const & seq, int action)
 {
+       if (lyxerr.debugging(Debug::KBMAP)) {
+               lyxerr << "BIND: Sequence `"
+                      << seq << "' Action `"
+                      << action << "'" << endl;
+       }
+       
        kb_sequence k;
 
        int const res = k.parse(seq);
index d429f710e875babd291f8a3b2800f15b4b70d80c..9289bf60a208497db25abf468eafb1a3f509694b 100644 (file)
@@ -61,7 +61,11 @@ void printKeysym(unsigned int key, unsigned int mod, string & buf);
 int kb_sequence::addkey(unsigned int key,
                        unsigned int mod, unsigned int nmod /*= 0*/)
 {
-       if (length < 0) {
+       //lyxerr << "kb_sequence::addkey: length is [" << length << "]\n"
+       //       << "kb_sequence::addkey::key == [" << key << "]\n"
+       //       << "kb_sequence::addkey::mod == [" << mod << "]" << endl;
+       
+       if (length <= 0) {
                length = 0;
                sequence.clear();
                modifiers.clear();
@@ -162,13 +166,14 @@ int kb_sequence::parse(string const & s)
     Called by : [user]
     Purpose   : print the currently defined sequence into a string
     Parameters: buf           - string where the result goes
-                maxlen        - length of string (including '\0')
                 when_defined  - only  print when sequence is real: length > 0.
     Returns   : 0, if ok, -1 if string too long
 \* ---F------------------------------------------------------------------- */
 
 int kb_sequence::print(string & buf, bool when_defined) const
 {
+       //lyxerr << "kb_sequence::print: length is [" << length << "]" << endl;
+       
        KeySym key;
        unsigned int mod;
        int l = length;
@@ -177,6 +182,9 @@ int kb_sequence::print(string & buf, bool when_defined) const
        for (int i = 0; i < l; ++i) {
                key = sequence[i];
                mod = modifiers[i] & 0xffff;
+               //lyxerr << "kb_sequence::sequence[" << i << "] == [" << key << "]\n"
+               //       << "kb_sequence::modifiers[" << i << "] == [" << mod << "]"
+               //       << endl;
 
                printKeysym(key, mod, buf);  // RVDK_PATCH_5
 
index c08c037b3169f6ae3aefe9996796e5c402e2b177..ac9c22fbb9a089ff491032ab3c7f5200675ac01e 100644 (file)
@@ -156,11 +156,12 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
        
        if (lyxerr.debugging(Debug::KEY)) {
                char * tmp = XKeysymToString(keysym);
-               string stm = (tmp ? tmp : "");
+               string const stm = (tmp ? tmp : "");
                lyxerr << "KeySym is "
                       << stm
                       << "["
-                      << keysym << "]"
+                      << keysym << "] State is ["
+                      << state << "]"
                       << endl;
        }
        // Do nothing if we have nothing (JMarc)
@@ -204,17 +205,25 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
        int action = cancel_meta_seq.addkey(keysym, state
                                            &(ShiftMask|ControlMask
                                              |Mod1Mask)); 
-
+       if (lyxerr.debugging(Debug::KEY)) {
+               lyxerr << "action first set to [" << action << "]" << endl;
+       }
+       
        // When not cancel or meta-fake, do the normal lookup. 
        // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
        // Mostly, meta_fake_bit = 0. RVDK_PATCH_5.
        if ((action != LFUN_CANCEL) && (action != LFUN_META_FAKE)) {
-
+               if (lyxerr.debugging(Debug::KEY)) {
+                       lyxerr << "meta_fake_bit is [" << meta_fake_bit << "]" << endl;
+               }
                // remove Caps Lock and Mod2 as a modifiers
                action = keyseq.addkey(keysym,
                                       (state | meta_fake_bit)
                                       &(ShiftMask|ControlMask
-                                        |Mod1Mask));      
+                                        |Mod1Mask));
+               if (lyxerr.debugging(Debug::KEY)) {
+                       lyxerr << "action now set to [" << action << "]" << endl;
+               }
        }
        // Dont remove this unless you know what you are doing.
        meta_fake_bit = 0;
@@ -249,7 +258,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
                        return 0;
                }
        
-               char isochar = keyseq.getiso();
+               char const isochar = keyseq.getiso();
                if (!(state & ControlMask) &&
                    !(state & Mod1Mask) &&
                    (isochar && keysym < 0xF000)) {
@@ -418,13 +427,8 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
 
        if (buf) {
                func_status box = LyXFunc::ToggleOff;
-               LyXFont font;
-               if (owner->view()->theLockingInset() &&
-                   owner->view()->theLockingInset()->getLyXText(owner->view()))
-                   font = owner->view()->theLockingInset()->
-                       getLyXText(owner->view())->real_current_font;
-               else
-                   font = owner->view()->text->real_current_font;
+               LyXFont const & font =
+                       owner->view()->getLyXText()->real_current_font;
                switch (action) {
                case LFUN_EMPH:
                        if (font.emph() == LyXFont::ON)
@@ -472,7 +476,6 @@ string const LyXFunc::Dispatch(int ac,
        
        string argument;
        kb_action action;
-       LyXText * text = 0;
         
         // we have not done anything wrong yet.
         errorstat = false;
@@ -496,6 +499,9 @@ string const LyXFunc::Dispatch(int ac,
        if (owner->view()->available())
                owner->view()->hideCursor();
 
+       // We have to do this heare because of te goto below. (Lgb)
+       LyXText * text = owner->view()->getLyXText();
+
        // We cannot use this function here
        if (getStatus(ac) & Disabled)
                goto exit_with_message;
@@ -526,7 +532,8 @@ string const LyXFunc::Dispatch(int ac,
                                }
                        }
 
-                       string shortcuts = toplevel_keymap->findbinding(pseudoaction);
+                       string const shortcuts =
+                               toplevel_keymap->findbinding(pseudoaction);
 
                        if (!shortcuts.empty()) {
                                comname += ": " + shortcuts;
@@ -632,14 +639,8 @@ string const LyXFunc::Dispatch(int ac,
                                }
                        }
                }
-               if (owner->view()->theLockingInset())
-                       text = owner->view()->theLockingInset()->
-                               getLyXText(owner->view());
        }
 
-       if (!text)
-           text = owner->view()->text;
-
        switch (action) {
                // --- Misc -------------------------------------------
        case LFUN_WORDFINDFORWARD  : 
index 50d7ed22432d9fb0a6f806f3e9d513786c168847..19e15c20e8ee079c8ecce3afccc2c134c7dd141f 100644 (file)
@@ -3,10 +3,17 @@
 #ifndef LYX_FUNCTIONAL_H
 #define LYX_FUNCTIONAL_H
 
+/** \file lyxfunctional.h
+    \brief Convenient function objects for use with LyX
+    This is currently a small collection of small function objects for use
+    together with std::algorithms.
+**/
+
 #include <iterator>
 
 //namespace lyx {
 
+
 template<class R, class C, class A>
 class class_fun_t {
 public:
@@ -34,7 +41,16 @@ private:
        void(C::*cmf)(A);
 };
 
-       
+
+/// Use to call a class method with a container element.
+/** Most easily used as a functor to std::algoritms.
+    Small example:
+    \verbatim
+    A a; // class that have a int print(string const &) method
+    vector<string> vs;
+    for_each(vs.begin(), vs.end(), class_fun(int, vs, &A::print);
+    \endverbatim
+**/
 template <class R, class C, class A> class_fun_t<R, C, A>
 class_fun(C & c, R(C::*f)(A))
 {
index 6636883fe874dbe74f961a52a9406d19fb2fbba9..3acc851c45d04bb64c9231a82a330a17e32244fa 100644 (file)
@@ -2674,7 +2674,8 @@ void LyXText::CheckParagraph(BufferView * bview, LyXParagraph * par,
                        
                        // set the cursor again. Otherwise
                        // dangling pointers are possible
-                       SetCursor(bview, cursor.par(), cursor.pos());
+                       SetCursor(bview, cursor.par(), cursor.pos(),
+                                 false, cursor.boundary());
                        sel_cursor = cursor;
                        return;
                }
@@ -2709,20 +2710,25 @@ void LyXText::CheckParagraph(BufferView * bview, LyXParagraph * par,
    
        if (selection) {
                tmpcursor = cursor;
-               SetCursorIntern(bview, sel_cursor.par(), sel_cursor.pos());
+               SetCursorIntern(bview, sel_cursor.par(), sel_cursor.pos(),
+                               false, sel_cursor.boundary());
                sel_cursor = cursor; 
                SetCursorIntern(bview, sel_start_cursor.par(),
-                               sel_start_cursor.pos());
+                               sel_start_cursor.pos(),
+                               false, sel_start_cursor.boundary());
                sel_start_cursor = cursor; 
                SetCursorIntern(bview, sel_end_cursor.par(),
-                               sel_end_cursor.pos());
+                               sel_end_cursor.pos(),
+                               false, sel_end_cursor.boundary());
                sel_end_cursor = cursor; 
                SetCursorIntern(bview, last_sel_cursor.par(),
-                               last_sel_cursor.pos());
+                               last_sel_cursor.pos(),
+                               false, last_sel_cursor.boundary());
                last_sel_cursor = cursor; 
                cursor = tmpcursor;
        }
-       SetCursorIntern(bview, cursor.par(), cursor.pos());
+       SetCursorIntern(bview, cursor.par(), cursor.pos(),
+                       false, cursor.boundary());
 }