]> git.lyx.org Git - features.git/commitdiff
Add an RC setting to disable/enable the tooltips in the work area.
authorAbdelrazak Younes <younes@lyx.org>
Wed, 26 Dec 2007 13:52:56 +0000 (13:52 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 26 Dec 2007 13:52:56 +0000 (13:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22313 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/PrefUi.ui

index 305d0da2149e4c1b956200683d03d49081458a68..31e96db1c62af29a01d704386c5fae3625cd6b5a 100644 (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_INP_ENC:
        case LyXRC::RC_USE_PERS_DICT:
+       case LyXRC::RC_USE_TOOLTIP:
        case LyXRC::RC_USE_PIXMAP_CACHE:
        case LyXRC::RC_USE_SPELL_LIB:
        case LyXRC::RC_VIEWDVI_PAPEROPTION:
index 0cf9f6dd1867934e6fce273c13ccd95b1a9f2cfb..a4520de545474812293b38f58edfb0fc3b621b73 100644 (file)
@@ -156,6 +156,7 @@ keyword_item lyxrcTags[] = {
        { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
        // compatibility with versions older than 1.4.0 only
        { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
+       { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
        { "\\user_email", LyXRC::RC_USER_EMAIL },
        { "\\user_name", LyXRC::RC_USER_NAME },
        { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
@@ -265,6 +266,7 @@ void LyXRC::setDefaults() {
        preview_hashed_labels  = false;
        preview_scale_factor = "0.9";
        use_converter_cache = true;
+       use_tooltip = true;
        use_pixmap_cache = false;
        converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
 
@@ -882,6 +884,11 @@ int LyXRC::read(Lexer & lexrc)
                                isp_use_pers_dict = lexrc.getBool();
                        }
                        break;
+               case RC_USE_TOOLTIP:
+                       if (lexrc.next()) {
+                               use_tooltip = lexrc.getBool();
+                       }
+                       break;
                case RC_USE_PIXMAP_CACHE:
                        if (lexrc.next()) {
                                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)
                        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:
                if (ignore_system_lyxrc ||
                    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.");
                break;
 
+       case RC_USE_TOOLTIP:
+               str = _("Enable the automatic appearance of tool tips in the work area.");
+               break;
+
        case RC_USE_PIXMAP_CACHE:
                str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
                break;
index f348edb2853a6e2cdfb4c88fc601d2940adea471..3bc2465eefa9f688c53ff71007046b37e2d6aa57 100644 (file)
@@ -138,6 +138,7 @@ public:
                RC_USE_ESC_CHARS,
                RC_USE_INP_ENC,
                RC_USE_PERS_DICT,
+               RC_USE_TOOLTIP,
                RC_USE_PIXMAP_CACHE,
                RC_USE_SPELL_LIB,
                RC_VIEWDVI_PAPEROPTION,
@@ -291,6 +292,8 @@ public:
        bool isp_use_alt_lang;
        /// Use personal dictionary?
        bool isp_use_pers_dict;
+       /// Use tooltips?
+       bool use_tooltip;
        /// Use pixmap cache?
        bool use_pixmap_cache;
        /// Use escape chars?
index c6f0645b6ca98ce7f367b87e4e73c77827bef170..4162afbb8499303db9e98a55aa009506731c29c1 100644 (file)
@@ -1627,6 +1627,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form, QWidget * parent)
                this, SIGNAL(changed()));
        connect(lastfilesSB, SIGNAL(valueChanged(int)),
                this, SIGNAL(changed()));
+       connect(tooltipCB, SIGNAL(toggled(bool)),
+               this, SIGNAL(changed()));
        connect(pixmapCacheCB, SIGNAL(toggled(bool)),
                this, SIGNAL(changed()));
        lastfilesSB->setMaximum(maxlastfiles);
@@ -1644,6 +1646,7 @@ void PrefUserInterface::apply(LyXRC & rc) const
        rc.autosave = autoSaveSB->value() * 60;
        rc.make_backup = autoSaveCB->isChecked();
        rc.num_lastfiles = lastfilesSB->value();
+       rc.use_tooltip = tooltipCB->isChecked();
        rc.use_pixmap_cache = pixmapCacheCB->isChecked();
 }
 
@@ -1663,6 +1666,7 @@ void PrefUserInterface::update(LyXRC const & rc)
        autoSaveSB->setValue(mins);
        autoSaveCB->setChecked(rc.make_backup);
        lastfilesSB->setValue(rc.num_lastfiles);
+       tooltipCB->setChecked(rc.use_tooltip);
        pixmapCacheCB->setChecked(rc.use_pixmap_cache);
 #if defined(Q_WS_X11)
        pixmapCacheGB->setEnabled(false);
index 8e21afa7a67960ee87d6526320ceecd539a3242c..f25f2fc4e72b0a6a71ed0734f390d7a9a57f6055 100644 (file)
@@ -504,6 +504,8 @@ bool GuiWorkArea::event(QEvent * e)
 {
     if (e->type() == QEvent::ToolTip) {
          QHelpEvent * helpEvent = static_cast<QHelpEvent *>(e);
+                if (!lyxrc.use_tooltip)
+                        return QAbstractScrollArea::event(e);
                 QPoint pos = helpEvent->pos();
                 if (pos.x() < viewport()->width()) {
                         QString s = toqstr(buffer_view_->toolTip(pos.x(), pos.y()));
index 6747fb3967b6efb099160ea3ada2b4a8371e6060..48ab043738151248fc1475beb364a01dd906d316 100644 (file)
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="2" column="0" colspan="3" >
-    <widget class="QGroupBox" name="documentsGB" >
+   <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>Documents</string>
+      <string>Automatic help</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
      </property>
      <property name="flat" >
       <bool>true</bool>
       <property name="spacing" >
        <number>6</number>
       </property>
-      <item row="0" column="1" >
-       <widget class="QSpinBox" name="autoSaveSB" >
-        <property name="maximum" >
-         <number>300</number>
-        </property>
-        <property name="minimum" >
-         <number>1</number>
-        </property>
-       </widget>
-      </item>
       <item row="0" column="0" >
-       <widget class="QCheckBox" name="autoSaveCB" >
-        <property name="text" >
-         <string>B&amp;ackup documents, every</string>
+       <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>
-       </widget>
-      </item>
-      <item row="0" column="2" >
-       <widget class="QLabel" name="TextLabel1" >
         <property name="text" >
-         <string>minutes</string>
+         <string>Enable &amp;tool tips in main work area</string>
         </property>
        </widget>
       </item>
-      <item row="0" column="3" >
-       <spacer>
-        <property name="orientation" >
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" >
-         <size>
-          <width>40</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-      <item row="1" column="0" colspan="4" >
-       <layout class="QHBoxLayout" >
-        <property name="margin" >
-         <number>0</number>
-        </property>
-        <property name="spacing" >
-         <number>6</number>
-        </property>
-        <item>
-         <widget class="QLabel" name="lastfilesLA" >
-          <property name="text" >
-           <string>&amp;Maximum last files:</string>
-          </property>
-          <property name="buddy" >
-           <cstring>lastfilesSB</cstring>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QSpinBox" name="lastfilesSB" >
-          <property name="maximum" >
-           <number>9</number>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <spacer>
-          <property name="orientation" >
-           <enum>Qt::Horizontal</enum>
-          </property>
-          <property name="sizeHint" >
-           <size>
-            <width>40</width>
-            <height>20</height>
-           </size>
-          </property>
-         </spacer>
-        </item>
-       </layout>
-      </item>
      </layout>
     </widget>
    </item>
-   <item row="1" column="0" colspan="2" >
+   <item row="2" column="0" colspan="3" >
     <widget class="QGroupBox" name="GeometryGB" >
      <property name="sizePolicy" >
       <sizepolicy>
      </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" >
+   <item row="5" column="0" colspan="3" >
     <widget class="QGroupBox" name="pixmapCacheGB" >
      <property name="title" >
       <string>Pixmap Cache</string>
@@ -222,7 +162,27 @@ p, li { white-space: pre-wrap; }
      </layout>
     </widget>
    </item>
-   <item row="3" column="0" colspan="3" >
+   <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>
@@ -257,24 +217,99 @@ p, li { white-space: pre-wrap; }
      </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>
+   <item row="3" column="0" colspan="3" >
+    <widget class="QGroupBox" name="documentsGB" >
+     <property name="title" >
+      <string>Documents</string>
      </property>
-     <property name="buddy" >
-      <cstring>uiFileED</cstring>
+     <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="1" >
+       <widget class="QSpinBox" name="autoSaveSB" >
+        <property name="maximum" >
+         <number>300</number>
+        </property>
+        <property name="minimum" >
+         <number>1</number>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="0" >
+       <widget class="QCheckBox" name="autoSaveCB" >
+        <property name="text" >
+         <string>B&amp;ackup documents, every</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="2" >
+       <widget class="QLabel" name="TextLabel1" >
+        <property name="text" >
+         <string>minutes</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="3" >
+       <spacer>
+        <property name="orientation" >
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" >
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="1" column="0" colspan="4" >
+       <layout class="QHBoxLayout" >
+        <property name="margin" >
+         <number>0</number>
+        </property>
+        <property name="spacing" >
+         <number>6</number>
+        </property>
+        <item>
+         <widget class="QLabel" name="lastfilesLA" >
+          <property name="text" >
+           <string>&amp;Maximum last files:</string>
+          </property>
+          <property name="buddy" >
+           <cstring>lastfilesSB</cstring>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="lastfilesSB" >
+          <property name="maximum" >
+           <number>9</number>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </item>
+     </layout>
     </widget>
    </item>
   </layout>