Add an RC setting to disable/enable the tooltips in the work area.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22313 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-26 13:52:56 +00:00
parent afc761e17b
commit 33eb188fb6
6 changed files with 218 additions and 155 deletions

View File

@ -2267,6 +2267,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
case LyXRC::RC_USE_ESC_CHARS: case LyXRC::RC_USE_ESC_CHARS:
case LyXRC::RC_USE_INP_ENC: case LyXRC::RC_USE_INP_ENC:
case LyXRC::RC_USE_PERS_DICT: case LyXRC::RC_USE_PERS_DICT:
case LyXRC::RC_USE_TOOLTIP:
case LyXRC::RC_USE_PIXMAP_CACHE: case LyXRC::RC_USE_PIXMAP_CACHE:
case LyXRC::RC_USE_SPELL_LIB: case LyXRC::RC_USE_SPELL_LIB:
case LyXRC::RC_VIEWDVI_PAPEROPTION: case LyXRC::RC_VIEWDVI_PAPEROPTION:

View File

@ -156,6 +156,7 @@ keyword_item lyxrcTags[] = {
{ "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB }, { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
// compatibility with versions older than 1.4.0 only // compatibility with versions older than 1.4.0 only
{ "\\use_tempdir", LyXRC::RC_USETEMPDIR }, { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
{ "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
{ "\\user_email", LyXRC::RC_USER_EMAIL }, { "\\user_email", LyXRC::RC_USER_EMAIL },
{ "\\user_name", LyXRC::RC_USER_NAME }, { "\\user_name", LyXRC::RC_USER_NAME },
{ "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION }, { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
@ -265,6 +266,7 @@ void LyXRC::setDefaults() {
preview_hashed_labels = false; preview_hashed_labels = false;
preview_scale_factor = "0.9"; preview_scale_factor = "0.9";
use_converter_cache = true; use_converter_cache = true;
use_tooltip = true;
use_pixmap_cache = false; use_pixmap_cache = false;
converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
@ -882,6 +884,11 @@ int LyXRC::read(Lexer & lexrc)
isp_use_pers_dict = lexrc.getBool(); isp_use_pers_dict = lexrc.getBool();
} }
break; break;
case RC_USE_TOOLTIP:
if (lexrc.next()) {
use_tooltip = lexrc.getBool();
}
break;
case RC_USE_PIXMAP_CACHE: case RC_USE_PIXMAP_CACHE:
if (lexrc.next()) { if (lexrc.next()) {
use_pixmap_cache = lexrc.getBool(); use_pixmap_cache = lexrc.getBool();
@ -2054,6 +2061,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
} }
if (tag != RC_LAST) if (tag != RC_LAST)
break; break;
case RC_USE_TOOLTIP:
if (ignore_system_lyxrc ||
use_tooltip != system_lyxrc.use_tooltip) {
os << "\\use_tooltip "
<< convert<string>(use_tooltip)
<< '\n';
}
case RC_USE_PIXMAP_CACHE: case RC_USE_PIXMAP_CACHE:
if (ignore_system_lyxrc || if (ignore_system_lyxrc ||
use_pixmap_cache != system_lyxrc.use_pixmap_cache) { use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
@ -2669,6 +2683,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("Specify whether to pass the -T input encoding option to ispell. Enable this if you cannot check the spelling of words containing accented letters. This may not work with all dictionaries."); str = _("Specify whether to pass the -T input encoding option to ispell. Enable this if you cannot check the spelling of words containing accented letters. This may not work with all dictionaries.");
break; break;
case RC_USE_TOOLTIP:
str = _("Enable the automatic appearance of tool tips in the work area.");
break;
case RC_USE_PIXMAP_CACHE: case RC_USE_PIXMAP_CACHE:
str = _("Enable the pixmap cache that might improve performance on Mac and Windows."); str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
break; break;

View File

@ -138,6 +138,7 @@ public:
RC_USE_ESC_CHARS, RC_USE_ESC_CHARS,
RC_USE_INP_ENC, RC_USE_INP_ENC,
RC_USE_PERS_DICT, RC_USE_PERS_DICT,
RC_USE_TOOLTIP,
RC_USE_PIXMAP_CACHE, RC_USE_PIXMAP_CACHE,
RC_USE_SPELL_LIB, RC_USE_SPELL_LIB,
RC_VIEWDVI_PAPEROPTION, RC_VIEWDVI_PAPEROPTION,
@ -291,6 +292,8 @@ public:
bool isp_use_alt_lang; bool isp_use_alt_lang;
/// Use personal dictionary? /// Use personal dictionary?
bool isp_use_pers_dict; bool isp_use_pers_dict;
/// Use tooltips?
bool use_tooltip;
/// Use pixmap cache? /// Use pixmap cache?
bool use_pixmap_cache; bool use_pixmap_cache;
/// Use escape chars? /// Use escape chars?

View File

@ -1627,6 +1627,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form, QWidget * parent)
this, SIGNAL(changed())); this, SIGNAL(changed()));
connect(lastfilesSB, SIGNAL(valueChanged(int)), connect(lastfilesSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed())); this, SIGNAL(changed()));
connect(tooltipCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
connect(pixmapCacheCB, SIGNAL(toggled(bool)), connect(pixmapCacheCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed())); this, SIGNAL(changed()));
lastfilesSB->setMaximum(maxlastfiles); lastfilesSB->setMaximum(maxlastfiles);
@ -1644,6 +1646,7 @@ void PrefUserInterface::apply(LyXRC & rc) const
rc.autosave = autoSaveSB->value() * 60; rc.autosave = autoSaveSB->value() * 60;
rc.make_backup = autoSaveCB->isChecked(); rc.make_backup = autoSaveCB->isChecked();
rc.num_lastfiles = lastfilesSB->value(); rc.num_lastfiles = lastfilesSB->value();
rc.use_tooltip = tooltipCB->isChecked();
rc.use_pixmap_cache = pixmapCacheCB->isChecked(); rc.use_pixmap_cache = pixmapCacheCB->isChecked();
} }
@ -1663,6 +1666,7 @@ void PrefUserInterface::update(LyXRC const & rc)
autoSaveSB->setValue(mins); autoSaveSB->setValue(mins);
autoSaveCB->setChecked(rc.make_backup); autoSaveCB->setChecked(rc.make_backup);
lastfilesSB->setValue(rc.num_lastfiles); lastfilesSB->setValue(rc.num_lastfiles);
tooltipCB->setChecked(rc.use_tooltip);
pixmapCacheCB->setChecked(rc.use_pixmap_cache); pixmapCacheCB->setChecked(rc.use_pixmap_cache);
#if defined(Q_WS_X11) #if defined(Q_WS_X11)
pixmapCacheGB->setEnabled(false); pixmapCacheGB->setEnabled(false);

View File

@ -504,6 +504,8 @@ bool GuiWorkArea::event(QEvent * e)
{ {
if (e->type() == QEvent::ToolTip) { if (e->type() == QEvent::ToolTip) {
QHelpEvent * helpEvent = static_cast<QHelpEvent *>(e); QHelpEvent * helpEvent = static_cast<QHelpEvent *>(e);
if (!lyxrc.use_tooltip)
return QAbstractScrollArea::event(e);
QPoint pos = helpEvent->pos(); QPoint pos = helpEvent->pos();
if (pos.x() < viewport()->width()) { if (pos.x() < viewport()->width()) {
QString s = toqstr(buffer_view_->toolTip(pos.x(), pos.y())); QString s = toqstr(buffer_view_->toolTip(pos.x(), pos.y()));

View File

@ -27,7 +27,197 @@
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<item row="6" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>204</width>
<height>101</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="3" >
<widget class="QGroupBox" name="pixmapCacheGB_2" >
<property name="title" >
<string>Automatic help</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="tooltipCB" >
<property name="toolTip" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">Checking this allow the automatic display of helpful comments for insets in the main work area of an edited document.&lt;/p>
&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="text" >
<string>Enable &amp;tool tips in main work area</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="3" > <item row="2" column="0" colspan="3" >
<widget class="QGroupBox" name="GeometryGB" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Session</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="allowGeometrySessionCB" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="toolTip" >
<string>Restore to cursor position when the file was last closed</string>
</property>
<property name="text" >
<string>Allow saving/restoring of windows geometry</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QCheckBox" name="loadSessionCB" >
<property name="text" >
<string>Load opened files from last session</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="restoreCursorCB" >
<property name="text" >
<string>Restore cursor positions</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0" colspan="3" >
<widget class="QGroupBox" name="pixmapCacheGB" >
<property name="title" >
<string>Pixmap Cache</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="pixmapCacheCB" >
<property name="toolTip" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Checking this improves performance, but might decrease the on-screen quality of fonts.&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="text" >
<string>Enable Pi&amp;xmap Cache</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="uiFileLA" >
<property name="text" >
<string>&amp;User interface file:</string>
</property>
<property name="buddy" >
<cstring>uiFileED</cstring>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="uiFileED" />
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="uiFilePB" >
<property name="text" >
<string>Bro&amp;wse...</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3" >
<widget class="QGroupBox" name="scrollGB" >
<property name="title" >
<string>Editing</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="cursorFollowsCB" >
<property name="text" >
<string>Cursor follows &amp;scrollbar</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="sortEnvironmentsCB" >
<property name="text" >
<string>Sort &amp;Environments alphabetically</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="3" >
<widget class="QGroupBox" name="documentsGB" > <widget class="QGroupBox" name="documentsGB" >
<property name="title" > <property name="title" >
<string>Documents</string> <string>Documents</string>
@ -122,161 +312,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2" >
<widget class="QGroupBox" name="GeometryGB" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Session</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="allowGeometrySessionCB" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="toolTip" >
<string>Restore to cursor position when the file was last closed</string>
</property>
<property name="text" >
<string>Allow saving/restoring of windows geometry</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QCheckBox" name="loadSessionCB" >
<property name="text" >
<string>Load opened files from last session</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="restoreCursorCB" >
<property name="text" >
<string>Restore cursor positions</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0" colspan="3" >
<widget class="QGroupBox" name="pixmapCacheGB" >
<property name="title" >
<string>Pixmap Cache</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="pixmapCacheCB" >
<property name="toolTip" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Checking this improves performance, but might decrease the on-screen quality of fonts.&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="text" >
<string>Enable Pi&amp;xmap Cache</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="3" >
<widget class="QGroupBox" name="scrollGB" >
<property name="title" >
<string>Editing</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QCheckBox" name="cursorFollowsCB" >
<property name="text" >
<string>Cursor follows &amp;scrollbar</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="sortEnvironmentsCB" >
<property name="text" >
<string>Sort &amp;Environments alphabetically</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="uiFilePB" >
<property name="text" >
<string>Bro&amp;wse...</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="uiFileED" />
</item>
<item row="0" column="0" >
<widget class="QLabel" name="uiFileLA" >
<property name="text" >
<string>&amp;User interface file:</string>
</property>
<property name="buddy" >
<cstring>uiFileED</cstring>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>