]> git.lyx.org Git - features.git/commitdiff
basic context menu for InsetExternal.
authorJürgen Spitzmüller <spitz@lyx.org>
Mon, 28 Apr 2008 05:12:28 +0000 (05:12 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Mon, 28 Apr 2008 05:12:28 +0000 (05:12 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24531 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ui/stdcontext.inc
src/frontends/qt4/GuiExternal.cpp
src/frontends/qt4/GuiExternal.h
src/frontends/qt4/ui/ExternalUi.ui
src/insets/InsetExternal.cpp
src/insets/InsetExternal.h

index 73f79fd93038a17a9a27fe2cb278e2bb79986f8a..69ae783a4b9adb97556a61fe526420c6641ecd74 100644 (file)
@@ -276,6 +276,16 @@ Menuset
                Item "Edit externally...|x" "inset-edit"
        End
 
+#
+# InsetExternal context menu
+#
+
+       Menu "context-external"
+               Item "Settings...|S" "next-inset-toggle"
+               Separator
+               Item "Edit externally...|x" "inset-edit"
+       End
+
 #
 # InsetTabular context menu
 #
index 8bbf4f5313af617c0cfa6506b305c3228960cc47..9bcf779077c4d9abff6d5a2bf576b94ea046c319 100644 (file)
@@ -109,8 +109,6 @@ GuiExternal::GuiExternal(GuiView & lv)
                this, SLOT(change_adaptor()));
        connect(browsePB, SIGNAL(clicked()),
                this, SLOT(browseClicked()));
-       connect(editPB, SIGNAL(clicked()),
-               this, SLOT(editClicked()));
        connect(externalCO, SIGNAL(activated(QString)),
                this, SLOT(templateChanged()));
        connect(extraED, SIGNAL(textChanged(QString)),
@@ -166,7 +164,6 @@ GuiExternal::GuiExternal(GuiView & lv)
 
        bc().addReadOnly(fileED);
        bc().addReadOnly(browsePB);
-       bc().addReadOnly(editPB);
        bc().addReadOnly(externalCO);
        bc().addReadOnly(draftCB);
        bc().addReadOnly(displayscaleED);
@@ -268,12 +265,6 @@ void GuiExternal::change_adaptor()
 }
 
 
-void GuiExternal::editClicked()
-{
-       editExternal();
-}
-
-
 void GuiExternal::extraChanged(const QString & text)
 {
        extra_[extraFormatCO->currentText()] = text;
@@ -698,14 +689,6 @@ void GuiExternal::dispatchParams()
 }
 
 
-void GuiExternal::editExternal()
-{
-       applyView();
-       string const lfun = InsetExternal::params2string(params_, buffer());
-       dispatch(FuncRequest(LFUN_INSET_EDIT, lfun));
-}
-
-
 static QStringList templateFilters(QString const & template_name)
 {
        /// Determine the template file extension
index f7fc31fe2d3c134e56c11dcc6a8643c074031dba..19d730f0bb6bca6f67be6aa5f7af0185a6a65e11 100644 (file)
@@ -35,7 +35,6 @@ private Q_SLOTS:
        void bbChanged();
        void browseClicked();
        void change_adaptor();
-       void editClicked();
        void extraChanged(const QString &);
        void formatChanged(const QString &);
        void getbbClicked();
@@ -65,8 +64,6 @@ private:
        ///
        bool isBufferDependent() const { return true; }
 
-       ///
-       void editExternal();
        ///
        QString browse(QString const & input_file,
                                 QString const & template_name) const;
index 664f9d20d35f47b6e84d8aa61ccf1517d3ccdb72..65788a7c2924dcca4e298b3ed18b6b8532798cbc 100644 (file)
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>390</width>
-    <height>367</height>
+    <height>346</height>
    </rect>
   </property>
   <property name="windowTitle" >
     <number>6</number>
    </property>
    <item row="1" column="0" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Expanding</enum>
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
      </property>
-     <property name="sizeHint" >
-      <size>
-       <width>20</width>
-       <height>20</height>
-      </size>
+     <property name="spacing" >
+      <number>6</number>
      </property>
-    </spacer>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>20</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okPB" >
+       <property name="text" >
+        <string>&amp;OK</string>
+       </property>
+       <property name="default" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="applyPB" >
+       <property name="text" >
+        <string>&amp;Apply</string>
+       </property>
+       <property name="default" >
+        <bool>false</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="closePB" >
+       <property name="text" >
+        <string>&amp;Close</string>
+       </property>
+       <property name="autoDefault" >
+        <bool>false</bool>
+       </property>
+       <property name="default" >
+        <bool>false</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
-   <item row="0" column="0" colspan="4" >
+   <item row="0" column="0" >
     <widget class="QTabWidget" name="tab" >
      <property name="currentIndex" >
-      <number>0</number>
+      <number>2</number>
      </property>
      <widget class="QWidget" name="filetab" >
       <attribute name="title" >
        <property name="spacing" >
         <number>6</number>
        </property>
-       <item row="3" column="0" colspan="3" >
-        <widget class="QCheckBox" name="draftCB" >
-         <property name="text" >
-          <string>&amp;Draft</string>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="2" >
-        <widget class="QPushButton" name="editPB" >
-         <property name="toolTip" >
-          <string>Edit the file externally</string>
-         </property>
-         <property name="text" >
-          <string>&amp;Edit File...</string>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="2" >
-        <widget class="QPushButton" name="browsePB" >
-         <property name="toolTip" >
-          <string>Select a file</string>
-         </property>
-         <property name="text" >
-          <string>&amp;Browse...</string>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="0" >
-        <widget class="QLabel" name="fileLA" >
-         <property name="toolTip" >
-          <string>Filename</string>
-         </property>
-         <property name="text" >
-          <string>&amp;File:</string>
-         </property>
-         <property name="buddy" >
-          <cstring>fileED</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="1" >
-        <widget class="QLineEdit" name="fileED" >
-         <property name="toolTip" >
-          <string>Filename</string>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="0" colspan="3" >
+       <item row="1" column="0" colspan="3" >
         <widget class="QGroupBox" name="GroupBox3" >
          <property name="title" >
           <string>Template</string>
          </layout>
         </widget>
        </item>
+       <item row="0" column="1" >
+        <widget class="QLineEdit" name="fileED" >
+         <property name="toolTip" >
+          <string>Filename</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="0" >
+        <widget class="QLabel" name="fileLA" >
+         <property name="toolTip" >
+          <string>Filename</string>
+         </property>
+         <property name="text" >
+          <string>&amp;File:</string>
+         </property>
+         <property name="buddy" >
+          <cstring>fileED</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="2" >
+        <widget class="QPushButton" name="browsePB" >
+         <property name="toolTip" >
+          <string>Select a file</string>
+         </property>
+         <property name="text" >
+          <string>&amp;Browse...</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="0" colspan="3" >
+        <widget class="QCheckBox" name="draftCB" >
+         <property name="text" >
+          <string>&amp;Draft</string>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="lyxviewtab" >
      </widget>
     </widget>
    </item>
-   <item row="1" column="1" >
-    <widget class="QPushButton" name="okPB" >
-     <property name="text" >
-      <string>&amp;OK</string>
-     </property>
-     <property name="default" >
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="2" >
-    <widget class="QPushButton" name="applyPB" >
-     <property name="text" >
-      <string>&amp;Apply</string>
-     </property>
-     <property name="default" >
-      <bool>false</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="3" >
-    <widget class="QPushButton" name="closePB" >
-     <property name="text" >
-      <string>&amp;Close</string>
-     </property>
-     <property name="autoDefault" >
-      <bool>false</bool>
-     </property>
-     <property name="default" >
-      <bool>false</bool>
-     </property>
-    </widget>
-   </item>
   </layout>
  </widget>
  <customwidgets>
   <tabstop>tab</tabstop>
   <tabstop>fileED</tabstop>
   <tabstop>browsePB</tabstop>
-  <tabstop>editPB</tabstop>
   <tabstop>externalCO</tabstop>
   <tabstop>externalTB</tabstop>
   <tabstop>draftCB</tabstop>
index 29eded4ab9a4f1132d44ac257cdb4fe253fcea2d..63f7b7d96af293a52fd6af7c19f12e1854314e0f 100644 (file)
@@ -840,6 +840,12 @@ void InsetExternal::addPreview(graphics::PreviewLoader & ploader) const
 }
 
 
+docstring InsetExternal::contextMenu(BufferView const &, int, int) const
+{
+       return from_ascii("context-external");
+}
+
+
 void InsetExternal::string2params(string const & in, Buffer const & buffer,
        InsetExternalParams & params)
 {
index 1d1d0d4be5befd068786f07664577ebcf6fbb282..22a9318a47b1e12a606df811d2ae09235af891f1 100644 (file)
@@ -120,6 +120,8 @@ public:
        void setParams(InsetExternalParams const &);
        /// \returns the number of rows (\n's) of generated code.
        int latex(odocstream &, OutputParams const &) const;
+       ///
+       docstring contextMenu(BufferView const & bv, int x, int y) const;
 
 private:
        ///