]> git.lyx.org Git - features.git/commitdiff
adv search/replace: move insert regexp to context menu
authorEdwin Leuven <e.leuven@gmail.com>
Fri, 26 Mar 2010 14:46:51 +0000 (14:46 +0000)
committerEdwin Leuven <e.leuven@gmail.com>
Fri, 26 Mar 2010 14:46:51 +0000 (14:46 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33871 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ui/stdcontext.inc
src/frontends/qt4/FindAndReplace.cpp
src/frontends/qt4/FindAndReplace.h
src/frontends/qt4/ui/FindAndReplaceUi.ui

index ec3d13836254355610c29a31af196a0c4add3823..8d95099a77d306da0e8c77098f35c8732483324d 100644 (file)
@@ -308,6 +308,7 @@ Menuset
                OptItem "Move Section Down|D" "outline-down"
                OptItem "Move Section Up|U" "outline-up"
                OptItem "Insert Short Title|T" "optional-insert"
+               OptSubMenu "Insert Regular Expression..." "context-edit-regexp"
                Separator
                OptItem "Accept Change|c" "change-accept"
                OptItem "Reject Change|j" "change-reject"
@@ -320,6 +321,19 @@ Menuset
                Item "Fullscreen Mode" "ui-toggle fullscreen"
        End
 
+
+#
+# Regular Expression context menu
+#
+       Menu "context-edit-regexp"
+               Item "Anything|A" "command-sequence regexp-mode; self-insert .*"
+               Item "Anything Non-Empty|o" "command-sequence regexp-mode; self-insert .+"
+               Item "Any Word|W" "command-sequence regexp-mode; self-insert [a-z]+"
+               Item "Any Number|N" "command-sequence regexp-mode; self-insert [0-9]+"
+               Item "User Defined|U" "regexp-mode"
+       End
+
+
 #
 # Math Macro context menu
 #
index bd4bb303c08420e4c4014b6a1430a3f43727a4ad..41356fafbd25e0221659ba2bd9b67e8d50ce44ae 100644 (file)
@@ -62,21 +62,6 @@ FindAndReplaceWidget::FindAndReplaceWidget(GuiView & view)
        replace_work_area_->setFrameStyle(QFrame::StyledPanel);
        // We don't want two cursors blinking.
        replace_work_area_->stopBlinkingCursor();
-       QMenu * menu = new QMenu();
-       QAction * regAny = menu->addAction(qt_("&Anything"));
-       regAny->setData(".*");
-       QAction * regAnyNonEmpty = menu->addAction(qt_("Any non-&empty"));
-       regAnyNonEmpty->setData(".+");
-       QAction * regAnyWord = menu->addAction(qt_("Any &word"));
-       regAnyWord->setData("[a-z]+");
-       QAction * regAnyNumber = menu->addAction(qt_("Any &number"));
-       regAnyNumber->setData("[0-9]+");
-       QAction * regCustom = menu->addAction(qt_("&User-defined"));
-       regCustom->setData("");
-       regexpInsertPB->setMenu(menu);
-
-       connect(menu, SIGNAL(triggered(QAction *)),
-               this, SLOT(insertRegexp(QAction *)));
 }
 
 
@@ -513,18 +498,6 @@ void FindAndReplaceWidget::findAndReplace(bool backwards, bool replace)
 }
 
 
-void FindAndReplaceWidget::insertRegexp(QAction * action)
-{
-       string const regexp = fromqstr(action->data().toString());
-       LYXERR(Debug::FIND, "Regexp: " << regexp);
-       find_work_area_->setFocus();
-       Cursor & cur = find_work_area_->bufferView().cursor();
-       if (!cur.inRegexped())
-               dispatch(FuncRequest(LFUN_REGEXP_MODE));
-       dispatch(FuncRequest(LFUN_SELF_INSERT, regexp));
-}
-
-
 void FindAndReplaceWidget::hideDialog()
 {
        dispatch(FuncRequest(LFUN_DIALOG_TOGGLE, "findreplaceadv"));
index 3bb2b44394a7c95ce43ebc20f74bc1cf64259e84..5b7587e58b288de436adfcea2d5f7690610055f1 100644 (file)
@@ -69,7 +69,6 @@ protected Q_SLOTS:
        void on_findNextPB_clicked();
        void on_replacePB_clicked();
        void on_replaceallPB_clicked();
-       void insertRegexp(QAction *);
 };
 
 
index 457b04f34913c0665f0b71b6394fe1d0be5f467a..926ec2707d7c0ed319608a1f7806f28654ac14e9 100644 (file)
@@ -63,7 +63,7 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="0" colspan="3">
+       <item row="1" column="0" colspan="2">
         <widget class="lyx::frontend::EmbeddedWorkArea" name="find_work_area_">
          <property name="toolTip">
           <string>Enter the text to search for in this full-featured LyX editing area</string>
         </widget>
        </item>
        <item row="2" column="0">
-        <spacer name="horizontalSpacer">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>52</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item row="2" column="1" colspan="2">
-        <widget class="QPushButton" name="regexpInsertPB">
-         <property name="toolTip">
-          <string>Choose one of the pre-arranged regular expressions.</string>
-         </property>
-         <property name="text">
-          <string>Insert Re&amp;gular Expression...</string>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="0" colspan="2">
         <widget class="QLabel" name="label_2">
          <property name="text">
           <string>&amp;Replace with:</string>
          </property>
         </widget>
        </item>
-       <item row="4" column="0" colspan="3">
+       <item row="3" column="0" colspan="2">
         <widget class="lyx::frontend::EmbeddedWorkArea" name="replace_work_area_">
          <property name="toolTip">
           <string>Enter the text to replace in this full-featured LyX editing area</string>
          </widget>
         </widget>
        </item>
-       <item row="5" column="0" colspan="2">
+       <item row="4" column="0">
         <widget class="QCheckBox" name="caseCB">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
          <property name="toolTip">
           <string>Perform a case-sensitive search</string>
          </property>
          </property>
         </widget>
        </item>
-       <item row="5" column="2">
+       <item row="4" column="1">
         <widget class="QPushButton" name="findNextPB">
          <property name="enabled">
           <bool>true</bool>
          </property>
         </widget>
        </item>
-       <item row="6" column="0" colspan="2">
+       <item row="5" column="0">
         <widget class="QCheckBox" name="wordsCB">
          <property name="enabled">
           <bool>true</bool>
          </property>
         </widget>
        </item>
-       <item row="6" column="2">
+       <item row="5" column="1">
         <widget class="QPushButton" name="replacePB">
          <property name="enabled">
           <bool>true</bool>
          </property>
         </widget>
        </item>
-       <item row="7" column="0" colspan="2">
+       <item row="6" column="0">
         <widget class="QCheckBox" name="searchbackCB">
          <property name="text">
           <string>Search backwards</string>
          </property>
         </widget>
        </item>
-       <item row="7" column="2">
+       <item row="6" column="1">
         <widget class="QPushButton" name="replaceallPB">
          <property name="enabled">
           <bool>false</bool>