]> git.lyx.org Git - features.git/commitdiff
- stdmenus.inc: Phantom can contain other things as well, not only text
authorUwe Stöhr <uwestoehr@web.de>
Thu, 5 Feb 2009 18:09:36 +0000 (18:09 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Thu, 5 Feb 2009 18:09:36 +0000 (18:09 +0000)
- LyXAction.cpp: updates and sorting
- GuiPhantom: a dialog to set the different phantom types (stolen from GuiNote)

The Phantom feature should now be complete. Thanks to all who contributed and helped.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28364 a592a061-630c-0410-9148-cb99ea01b6c8

development/scons/scons_manifest.py
lib/ui/stdmenus.inc
src/LyXAction.cpp
src/frontends/qt4/GuiPhantom.cpp [new file with mode: 0644]
src/frontends/qt4/GuiPhantom.h [new file with mode: 0644]
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/Makefile.am
src/frontends/qt4/ui/PhantomUi.ui [new file with mode: 0644]

index 5fd443009e7963c124653949edaa26de02cbd2e5..bb701d71a1f60e2b5b23007fda73d221e3f2af31 100644 (file)
@@ -732,6 +732,7 @@ src_frontends_qt4_header_files = Split('''
     GuiNote.h
     GuiPainter.h
     GuiParagraph.h
+    GuiPhantom.h
     GuiPrefs.h
     GuiPrint.h
     GuiRef.h
@@ -823,6 +824,7 @@ src_frontends_qt4_files = Split('''
     GuiNote.cpp
     GuiPainter.cpp
     GuiParagraph.cpp
+    GuiPhantom.cpp
     GuiPrefs.cpp
     GuiPrint.cpp
     GuiRef.cpp
@@ -911,6 +913,7 @@ src_frontends_qt4_ui_files = Split('''
     PageLayoutUi.ui
     ParagraphUi.ui
     PDFSupportUi.ui
+    PhantomUi.ui
     PreambleUi.ui
     PrefColorsUi.ui
     PrefCompletionUi.ui
index f557167b0e92614deb142f9194791a7ac81ca2d7..12638f885ff636e0ee1ccb227616acaf8dfbd245 100644 (file)
@@ -120,6 +120,7 @@ Menuset
                OptItem "Float Settings...|a" "inset-settings float"
                OptItem "Text Wrap Settings...|W" "inset-settings wrap"
                OptItem "Note Settings...|N" "inset-settings note"
+               OptItem "Phantom Settings...|h" "inset-settings phantom"
                OptItem "Branch Settings...|B" "inset-settings branch"
                OptItem "Box Settings...|x" "inset-settings box"
                OptItem "Listings Settings...|g" "inset-settings listings"
@@ -375,7 +376,7 @@ Menuset
                Item "Horizontal Space...|o" "dialog-show-new-inset space"
                Item "Horizontal Line|L" "line-insert"
                Item "Vertical Space...|V" "dialog-show-new-inset vspace"
-               Submenu "Phantom Text" "insert_phantom"
+               Submenu "Phantom" "insert_phantom"
                Separator
                Item "Hyphenation Point|H" "specialchar-insert hyphenation"
                Item "Ligature Break|k" "specialchar-insert ligature-break"
index 59ab3ab147cf5a7e28c30446c27077029eccee45..959a9ed1ab43f2bd3c044a98438334b6a2e76c74 100644 (file)
@@ -2146,9 +2146,9 @@ void LyXAction::init()
 /*!
  * \var lyx::FuncCode lyx::LFUN_INSET_MODIFY
  * \li Action: Modify existing inset.
- * \li Notion: Used for label, floats, listings, box, branch, external, wrap
-               bibtex, ert, command, graphics, note, space, vspace, tabular,
-               bibitem, inlude, ref insets.
+ * \li Notion: Used for bibitem, bibtex, box, branch, command, ert, external,
+                        floats, graphics, include, label, listings, note,
+                        phantom, ref, space, tabular, vspace, wrap insets.
  * \li Syntax: inset-modify <INSET> <ARGS>
  * \li Params: See #LFUN_INSET_INSERT for further details.
  * \endvar
@@ -2157,9 +2157,9 @@ void LyXAction::init()
 /*!
  * \var lyx::FuncCode lyx::LFUN_NEXT_INSET_MODIFY
  * \li Action: Modify the inset at cursor position, if there is one.
- * \li Notion: Used for label, floats, listings, box, branch, external, wrap
-               bibtex, ert, command, graphics, note, space, vspace, tabular,
-               bibitem, inlude, ref insets.
+ * \li Notion: Used for bibitem, bibtex, box, branch, command, ert, external,
+                        floats, graphics, include, label, listings, note,
+                        phantom, ref, space, tabular, vspace, wrap insets.
  * \li Syntax: next-inset-modify <INSET> <ARGS>
  * \li Syntax: next-inset-modify changetype <TYPE>
  * \li Params: See #LFUN_INSET_INSERT for further details.
@@ -2182,7 +2182,7 @@ void LyXAction::init()
  * \li Action: Open the inset's properties dialog.
  * \li Notion: Used for box, branch, ert, float, listings, note, tabular, wrap insets.
  * \li Syntax: inset-settings <INSET>
- * \li Params: <INSET>: <box|branch|ert|float|listings|note|tabular|wrap>
+ * \li Params: <INSET>: <box|branch|ert|float|listings|note|phantom|tabular|wrap>
  * \endvar
  */
                { LFUN_INSET_SETTINGS, "inset-settings", ReadOnly, Edit },
@@ -2191,9 +2191,9 @@ void LyXAction::init()
  * \li Action: Toggles the inset at cursor position. For collapsables, this means it will
                be (un-)collapsed, in case of other insets, the editing widget (dialog) will
                be entered. Also cf. #LFUN_INSET_SETTINGS.
- * \li Notion: Used for label, floats, listings, box, branch, external, wrap
-               bibtex, ert, command, graphics, note, space, vspace, tabular,
-               bibitem, inlude, ref insets.
+ * \li Notion: Used for bibitem, bibtex, box, branch, command, ert, external,
+                        floats, graphics, include, label, listings, note,
+                        phantom, ref, space, tabular, vspace, wrap insets.
  * \li Syntax: next-inset-toggle <ARG>
  * \li Params: <ARG>: these are passed as arguments to #LFUN_INSET_TOGGLE .
  * \li Origin: leeming, 30 Mar 2004
@@ -2442,10 +2442,10 @@ void LyXAction::init()
  * \li Syntax: dialog-show <NAME> [<DATA>]
  * \li Params: <NAME>: aboutlyx|bibitem|bibtex|box|branch|changes|character|citation|\n
                document|errorlist|ert|external|file|findreplace|float|graphics|\n
-               include|index|info|nomenclature|label|log|mathdelimiter|mathmatrix|\n
-               note|paragraph|prefs|print|ref|sendto|space|spellchecker|symbols|\n
-               tabular|tabularcreate|thesaurus|texinfo|toc|href|view-source|vspace\n
-               wrap|listings|<SPECIAL> \n
+               include|index|info|nomenclature|label|listings|log|mathdelimiter|\n
+               mathmatrix|note|paragraph|phantom|prefs|print|ref|sendto|space|\n
+               spellchecker|symbols|tabular|tabularcreate|thesaurus|texinfo|toc|href|\n
+               view-source|vspace|wrap|<SPECIAL> \n
                <SPECIAL>: latexlog|vclog \n
                <DATA>: data, usually settings for the given dialog. Use debug mode for the
                        details.
diff --git a/src/frontends/qt4/GuiPhantom.cpp b/src/frontends/qt4/GuiPhantom.cpp
new file mode 100644 (file)
index 0000000..14dffea
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+ * \file GuiPhantom.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Uwe Stöhr
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "GuiPhantom.h"
+#include "FuncRequest.h"
+#include "support/gettext.h"
+
+#include "insets/InsetPhantom.h"
+
+using namespace std;
+
+namespace lyx {
+namespace frontend {
+
+GuiPhantom::GuiPhantom(GuiView & lv)
+       : GuiDialog(lv, "phantom", qt_("Phantom Settings"))
+{
+       setupUi(this);
+
+       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
+       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
+
+       connect(phantomRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
+       connect(hphantomRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
+       connect(vphantomRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
+
+       bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
+       bc().setOK(okPB);
+       bc().setCancel(closePB);
+}
+
+
+void GuiPhantom::change_adaptor()
+{
+       changed();
+}
+
+
+void GuiPhantom::updateContents()
+{
+       switch (params_.type) {
+       case InsetPhantomParams::Phantom:
+               phantomRB->setChecked(true);
+               break;
+       case InsetPhantomParams::HPhantom:
+               hphantomRB->setChecked(true);
+               break;
+       case InsetPhantomParams::VPhantom:
+               vphantomRB->setChecked(true);
+               break;
+       }
+}
+
+
+void GuiPhantom::applyView()
+{
+       if (vphantomRB->isChecked())
+               params_.type = InsetPhantomParams::VPhantom;
+       else if (hphantomRB->isChecked())
+               params_.type = InsetPhantomParams::HPhantom;
+       else
+               params_.type = InsetPhantomParams::Phantom;
+}
+
+
+bool GuiPhantom::initialiseParams(string const & data)
+{
+       InsetPhantom::string2params(data, params_);
+       return true;
+}
+
+
+void GuiPhantom::clearParams()
+{
+       params_ = InsetPhantomParams();
+}
+
+
+void GuiPhantom::dispatchParams()
+{
+       dispatch(FuncRequest(getLfun(), InsetPhantom::params2string(params_)));
+}
+
+
+Dialog * createGuiPhantom(GuiView & lv) { return new GuiPhantom(lv); }
+
+
+} // namespace frontend
+} // namespace lyx
+
+#include "moc_GuiPhantom.cpp"
diff --git a/src/frontends/qt4/GuiPhantom.h b/src/frontends/qt4/GuiPhantom.h
new file mode 100644 (file)
index 0000000..d28a7a1
--- /dev/null
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+/**
+ * \file GuiPhantom.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Uwe Stöhr
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GUIPHANTOM_H
+#define GUIPHANTOM_H
+
+#include "GuiDialog.h"
+#include "insets/InsetPhantom.h"
+#include "ui_PhantomUi.h"
+
+namespace lyx {
+namespace frontend {
+
+class GuiPhantom : public GuiDialog, public Ui::PhantomUi
+{
+       Q_OBJECT
+public:
+       GuiPhantom(GuiView & lv);
+private Q_SLOTS:
+       void change_adaptor();
+private:
+       /// Apply changes
+       void applyView();
+       /// Update dialog before showing it
+       void updateContents();
+       ///
+       bool initialiseParams(std::string const & data);
+       ///
+       void clearParams();
+       ///
+       void dispatchParams();
+       ///
+       bool isBufferDependent() const { return true; }
+private:
+       ///
+       InsetPhantomParams params_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GUIPHANTOM_H
index b28eb0cd39b1ba5457dc00a0ba9838b935c2d481..bb2f0eef8b583aef110aa5b4581754d0b12d63b3 100644 (file)
@@ -2297,10 +2297,11 @@ namespace {
 
 char const * const dialognames[] = {
 "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
-"citation", "document", "errorlist", "ert", "external", "file",
-"findreplace", "float", "graphics", "include", "index", "info", "nomenclature", "label", "log",
-"mathdelimiter", "mathmatrix", "mathspace", "note", "paragraph", "prefs", "print", 
-"ref", "sendto", "space", "spellchecker", "symbols", "tabular", "tabularcreate",
+"citation", "document", "errorlist", "ert", "external", "file", "findreplace",
+"float", "graphics", "include", "index", "info", "nomenclature", "label",
+"log", "mathdelimiter", "mathmatrix", "mathspace", "note", "paragraph",
+"phantom", "prefs", "print", "ref", "sendto", "space", "spellchecker",
+"symbols", "tabular", "tabularcreate",
 
 #ifdef HAVE_LIBAIKSAURUS
 "thesaurus",
@@ -2490,6 +2491,7 @@ Dialog * createGuiMathMatrix(GuiView & lv);
 Dialog * createGuiNomenclature(GuiView & lv);
 Dialog * createGuiNote(GuiView & lv);
 Dialog * createGuiParagraph(GuiView & lv);
+Dialog * createGuiPhantom(GuiView & lv);
 Dialog * createGuiPreferences(GuiView & lv);
 Dialog * createGuiPrint(GuiView & lv);
 Dialog * createGuiRef(GuiView & lv);
@@ -2559,8 +2561,6 @@ Dialog * GuiView::build(string const & name)
                return createGuiLabel(*this);
        if (name == "log")
                return createGuiLog(*this);
-       if (name == "view-source")
-               return createGuiViewSource(*this);
        if (name == "mathdelimiter")
                return createGuiDelimiter(*this);
        if (name == "mathspace")
@@ -2571,6 +2571,8 @@ Dialog * GuiView::build(string const & name)
                return createGuiNote(*this);
        if (name == "paragraph")
                return createGuiParagraph(*this);
+       if (name == "phantom")
+               return createGuiPhantom(*this);
        if (name == "prefs")
                return createGuiPreferences(*this);
        if (name == "print")
@@ -2591,20 +2593,22 @@ Dialog * GuiView::build(string const & name)
                return createGuiTabularCreate(*this);
        if (name == "texinfo")
                return createGuiTexInfo(*this);
+       if (name == "view-source")
+               return createGuiViewSource(*this);
 #ifdef HAVE_LIBAIKSAURUS
        if (name == "thesaurus")
                return createGuiThesaurus(*this);
 #endif
-       if (name == "toc")
-               return createGuiToc(*this);
        if (name == "href")
                return createGuiHyperlink(*this);
+       if (name == "listings")
+               return createGuiListings(*this);
+       if (name == "toc")
+               return createGuiToc(*this);
        if (name == "vspace")
                return createGuiVSpace(*this);
        if (name == "wrap")
                return createGuiWrap(*this);
-       if (name == "listings")
-               return createGuiListings(*this);
 
        return 0;
 }
index a9e328dd94374db5a636cdce64bb3de44054828a..13391190fdfdc4927a70d04498f5c310c50f3bfb 100644 (file)
@@ -100,6 +100,7 @@ SOURCEFILES = \
        GuiNote.cpp \
        GuiPainter.cpp \
        GuiParagraph.cpp \
+       GuiPhantom.cpp \
        GuiPrefs.cpp \
        GuiPrint.cpp \
        GuiRef.cpp \
@@ -193,6 +194,7 @@ MOCHEADER = \
        GuiNomencl.h \
        GuiNote.h \
        GuiParagraph.h \
+       GuiPhantom.h \
        GuiPrefs.h \
        GuiPrint.h \
        GuiRef.h \
@@ -268,6 +270,7 @@ UIFILES = \
        PageLayoutUi.ui \
        ParagraphUi.ui \
        PDFSupportUi.ui \
+       PhantomUi.ui \
        PreambleUi.ui \
        PrefColorsUi.ui \
        PrefCompletionUi.ui \
diff --git a/src/frontends/qt4/ui/PhantomUi.ui b/src/frontends/qt4/ui/PhantomUi.ui
new file mode 100644 (file)
index 0000000..fedd409
--- /dev/null
@@ -0,0 +1,104 @@
+<ui version="4.0" >
+ <class>PhantomUi</class>
+ <widget class="QDialog" name="PhantomUi" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>202</width>
+    <height>184</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string/>
+  </property>
+  <property name="sizeGripEnabled" >
+   <bool>true</bool>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="1" column="1" >
+    <widget class="QPushButton" name="closePB" >
+     <property name="text" >
+      <string>Close</string>
+     </property>
+     <property name="default" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0" >
+    <widget class="QPushButton" name="okPB" >
+     <property name="text" >
+      <string>&amp;OK</string>
+     </property>
+     <property name="default" >
+      <bool>false</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0" colspan="2" >
+    <widget class="QGroupBox" name="PhantomBG" >
+     <property name="title" >
+      <string>Type</string>
+     </property>
+     <layout class="QVBoxLayout" >
+      <property name="margin" >
+       <number>11</number>
+      </property>
+      <property name="spacing" >
+       <number>6</number>
+      </property>
+      <item>
+       <widget class="QRadioButton" name="phantomRB" >
+        <property name="toolTip" >
+         <string>Horizontal and vertical space of the phantom content</string>
+        </property>
+        <property name="text" >
+         <string>&amp;Phantom</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="hphantomRB" >
+        <property name="toolTip" >
+         <string>Horizontal space of the phantom content</string>
+        </property>
+        <property name="text" >
+         <string>&amp;Horiz. Phantom</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="vphantomRB" >
+        <property name="toolTip" >
+         <string>Vertical space of the phantom content</string>
+        </property>
+        <property name="text" >
+         <string>&amp;Vert. Phantom</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <tabstops>
+  <tabstop>phantomRB</tabstop>
+  <tabstop>vphantomRB</tabstop>
+  <tabstop>vphantomRB</tabstop>
+  <tabstop>okPB</tabstop>
+  <tabstop>closePB</tabstop>
+ </tabstops>
+ <includes>
+  <include location="local" >qt_i18n.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>