* possibility to disable the completion cursor in text. All those

"*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
This commit is contained in:
Stefan Schimanski 2008-03-16 17:07:10 +00:00
parent a015e133ab
commit 9e499117e3
11 changed files with 59 additions and 2 deletions

View 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:

View 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;

View 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;

View 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);
}

View 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) {

View File

@ -142,6 +142,16 @@
</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>
@ -180,7 +190,7 @@
<item>
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<string>General[[PrefInput]]</string>
<string>General</string>
</property>
<layout class="QVBoxLayout" >
<item>

View 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!

View 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;

View 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;

View 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;

View 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;