]> git.lyx.org Git - features.git/commitdiff
* possibility to disable the completion cursor in text. All those
authorStefan Schimanski <sts@lyx.org>
Sun, 16 Mar 2008 17:07:10 +0000 (17:07 +0000)
committerStefan Schimanski <sts@lyx.org>
Sun, 16 Mar 2008 17:07:10 +0000 (17:07 +0000)
  "*supported" methods maybe should be merged with a bit-enum as return value.

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

src/LyXFunc.cpp
src/LyXRC.cpp
src/LyXRC.h
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/GuiWorkArea.cpp
src/frontends/qt4/ui/PrefInputUi.ui
src/insets/Inset.h
src/insets/InsetTabular.cpp
src/insets/InsetTabular.h
src/insets/InsetText.cpp
src/insets/InsetText.h

index 8ef6ceca17184e2595365bba7e61b1a724c9e4f3..2bf6e8334a892a59c4321664a4b462b6d6404b2d 100644 (file)
@@ -1882,6 +1882,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_BIBTEX_COMMAND:
        case LyXRC::RC_BINDFILE:
        case LyXRC::RC_CHECKLASTFILES:
+       case LyXRC::RC_COMPLETION_CURSOR_TEXT:
        case LyXRC::RC_COMPLETION_INLINE_DELAY:
        case LyXRC::RC_COMPLETION_INLINE_DOTS:
        case LyXRC::RC_COMPLETION_INLINE_MATH:
index 484edb42207211e7c2e9c3e6b430b428d21ed221..92c95b0d1e5736981178ae0947990edd840e507f 100644 (file)
@@ -63,6 +63,7 @@ keyword_item lyxrcTags[] = {
        { "\\bind_file", LyXRC::RC_BINDFILE },
        { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
        { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
+       { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT },
        { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY },
        { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
        { "\\completion_inline_math", LyXRC::RC_COMPLETION_INLINE_MATH },
@@ -308,6 +309,7 @@ void LyXRC::setDefaults() {
        full_screen_scrollbar = true;
        full_screen_width = 700;
 
+       completion_cursor_text = true;
        completion_popup_math = true;
        completion_popup_text = false;
        completion_popup_delay = 2.0;
@@ -823,6 +825,12 @@ int LyXRC::read(Lexer & lexrc)
                        }
                        break;
 
+               case RC_COMPLETION_CURSOR_TEXT:
+                       if (lexrc.next()) {
+                               completion_cursor_text = lexrc.getBool();
+                       }
+                       break;
+
                case RC_COMPLETION_POPUP_AFTER_COMPLETE:
                        if (lexrc.next()) {
                                completion_popup_after_complete = lexrc.getBool();
@@ -2206,6 +2214,14 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                }
                if (tag != RC_LAST)
                        break;
+       case RC_COMPLETION_CURSOR_TEXT:
+               if (ignore_system_lyxrc ||
+                   completion_cursor_text != system_lyxrc.completion_cursor_text) {
+                       os << "\\completion_cursor_text "
+                          << convert<string>(completion_cursor_text) << '\n';
+               }
+               if (tag != RC_LAST)
+                       break;
        case RC_COMPLETION_POPUP_AFTER_COMPLETE:
                if (ignore_system_lyxrc ||
                    completion_popup_after_complete
@@ -2831,6 +2847,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("Show the completion popup without delay after non-unique completion attempt.");
                break;
 
+       case RC_COMPLETION_POPUP_TEXT:
+               str = _("Show a small triangle on the cursor to indicate that a completion is available.");
+               break;
+
        case RC_COMPLETION_POPUP_DELAY:
                str = _("The inline completion delay.");
                break;
index 68dcdfba607ec242424c0a15b53c690cb698455d..3b5daaedbe664b7c3d221f498ece02e6c3efb63c 100644 (file)
@@ -49,6 +49,7 @@ public:
                RC_BINDFILE,
                RC_CHECKLASTFILES,
                RC_CHKTEX_COMMAND,
+               RC_COMPLETION_CURSOR_TEXT,
                RC_COMPLETION_INLINE_DELAY,
                RC_COMPLETION_INLINE_MATH,
                RC_COMPLETION_INLINE_TEXT,
@@ -423,6 +424,8 @@ public:
        /// Width of limited screen (in pixels) in fullscreen mode
        int full_screen_width;
        ///
+       bool completion_cursor_text;
+       ///
        double completion_inline_delay;
        ///
        bool completion_inline_math;
index 47a9c5a2c4a1be41d9de66563dfbe19e92378c04..6bf30bc31bf5714f4137db03f573ad3e61a2ab0b 100644 (file)
@@ -406,6 +406,8 @@ PrefInput::PrefInput(GuiPreferences * form, QWidget * parent)
                this, SIGNAL(changed()));
        connect(popupAfterCompleteCB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
+       connect(cursorTextCB, SIGNAL(clicked()),
+               this, SIGNAL(changed()));
        connect(mouseWheelSpeedSB, SIGNAL(valueChanged(double)),
                this, SIGNAL(changed()));
 }
@@ -424,6 +426,7 @@ void PrefInput::apply(LyXRC & rc) const
        rc.completion_popup_delay = popupDelaySB->value();
        rc.completion_popup_math = popupMathCB->isChecked();
        rc.completion_popup_text = popupTextCB->isChecked();
+       rc.completion_cursor_text = cursorTextCB->isChecked();
        rc.completion_popup_after_complete
        = popupAfterCompleteCB->isChecked();
        rc.mouse_wheel_speed = mouseWheelSpeedSB->value();
@@ -443,6 +446,7 @@ void PrefInput::update(LyXRC const & rc)
        popupDelaySB->setValue(rc.completion_popup_delay);
        popupMathCB->setChecked(rc.completion_popup_math);
        popupTextCB->setChecked(rc.completion_popup_text);
+       cursorTextCB->setChecked(rc.completion_cursor_text);
        popupAfterCompleteCB->setChecked(rc.completion_popup_after_complete);
        mouseWheelSpeedSB->setValue(rc.mouse_wheel_speed);
 }
index 16f2135a1fa6da2e689377bdd0222e4bc3248543..0ea217d1127bb9b0e4a3221ddaf582c888b1b439 100644 (file)
@@ -505,7 +505,8 @@ void GuiWorkArea::showCursor()
                cursorInView = false;
 
        // show cursor on screen
-       bool completable = completer_.completionAvailable()
+       bool completable = cur.inset().showCompletionCursor()
+               && completer_.completionAvailable()
                && !completer_.popupVisible()
                && !completer_.inlineVisible();
        if (cursorInView) {
index aeed705c2a87dd88eb4c83422be732d100c96938..3d525662f23498eebb56f2994e48e3b0add3795a 100644 (file)
            </property>
           </widget>
          </item>
+         <item>
+          <widget class="QCheckBox" name="cursorTextCB" >
+           <property name="toolTip" >
+            <string>Show a small triangle on the cursor if a completion is available in text mode.</string>
+           </property>
+           <property name="text" >
+            <string>Cursor indicator</string>
+           </property>
+          </widget>
+         </item>
         </layout>
        </widget>
       </item>
       <item>
        <widget class="QGroupBox" name="groupBox_4" >
         <property name="title" >
-         <string>General[[PrefInput]]</string>
+         <string>General</string>
         </property>
         <layout class="QVBoxLayout" >
          <item>
index 1b50280be5ade37ae3d5d21b5c2c4b8888c2d89f..fb9c03710d0b2adae0f6a422f975705e2f2f6db5 100644 (file)
@@ -322,6 +322,8 @@ public:
        virtual bool automaticInlineCompletion() const { return true; }
        /// Return true if the popup completion should be automatic.
        virtual bool automaticPopupCompletion() const { return true; }
+       /// Return true if the cursor should indicate a completion.
+       virtual bool showCompletionCursor() const { return true; }
        /// Returns completion suggestions at cursor position. Return an
        /// null pointer if no completion is a available or possible.
        /// The caller is responsible to free the returned object!
index 6e16f2d516014dd94833dfd5cbe1307d6735f3d7..5207a74df78ec49459f9307a772e9ec0dd22894c 100644 (file)
@@ -4822,6 +4822,12 @@ bool InsetTabular::automaticPopupCompletion() const
 }
 
 
+bool InsetTabular::showCompletionCursor() const
+{
+       return lyxrc.completion_cursor_text;
+}
+
+
 CompletionList const * InsetTabular::createCompletionList(Cursor const & cur) const
 {
        return completionSupported(cur) ? cur.text()->createCompletionList(cur) : 0;
index c5af279f35a950225ce0cfc0a89e8008e726026e..a4ec860ba4a73ef275c12c7c0d90eb95a559f37d 100644 (file)
@@ -760,6 +760,8 @@ public:
        ///
        bool automaticPopupCompletion() const;
        ///
+       bool showCompletionCursor() const;
+       ///
        CompletionList const * createCompletionList(Cursor const & cur) const;
        ///
        docstring completionPrefix(Cursor const & cur) const;
index 1b0435b0a0b3fcf73ba2082043d30152dbe1630d..d556b2898d5ecb6af48063898e3d4405fae32470 100644 (file)
@@ -495,6 +495,12 @@ bool InsetText::automaticPopupCompletion() const
 }
 
 
+bool InsetText::showCompletionCursor() const
+{
+       return lyxrc.completion_cursor_text;
+}
+
+
 CompletionList const * InsetText::createCompletionList(Cursor const & cur) const
 {
        return completionSupported(cur) ? text_.createCompletionList(cur) : 0;
index 5bb93e3e7cf7ddb5d52223afccd834a21cce8002..8168a71f5d40b6205877a2408a4d733d9e561d32 100644 (file)
@@ -154,6 +154,8 @@ public:
        ///
        bool automaticPopupCompletion() const;
        ///
+       bool showCompletionCursor() const;
+       ///
        CompletionList const * createCompletionList(Cursor const & cur) const;
        ///
        docstring completionPrefix(Cursor const & cur) const;