From 8a0d98e67ee8d395e52c6f254db64a44d610e46a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Thu, 5 Feb 2009 18:09:36 +0000 Subject: [PATCH] - stdmenus.inc: Phantom can contain other things as well, not only text - 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 | 3 + lib/ui/stdmenus.inc | 3 +- src/LyXAction.cpp | 28 ++++---- src/frontends/qt4/GuiPhantom.cpp | 100 ++++++++++++++++++++++++++ src/frontends/qt4/GuiPhantom.h | 50 +++++++++++++ src/frontends/qt4/GuiView.cpp | 24 ++++--- src/frontends/qt4/Makefile.am | 3 + src/frontends/qt4/ui/PhantomUi.ui | 104 ++++++++++++++++++++++++++++ 8 files changed, 290 insertions(+), 25 deletions(-) create mode 100644 src/frontends/qt4/GuiPhantom.cpp create mode 100644 src/frontends/qt4/GuiPhantom.h create mode 100644 src/frontends/qt4/ui/PhantomUi.ui diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index 5fd443009e..bb701d71a1 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -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 diff --git a/lib/ui/stdmenus.inc b/lib/ui/stdmenus.inc index f557167b0e..12638f885f 100644 --- a/lib/ui/stdmenus.inc +++ b/lib/ui/stdmenus.inc @@ -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" diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 59ab3ab147..959a9ed1ab 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -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 * \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 * \li Syntax: next-inset-modify changetype * \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 - * \li Params: : + * \li Params: : * \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 * \li Params: : 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 [] * \li Params: : 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| \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| \n : latexlog|vclog \n : 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 index 0000000000..14dffea059 --- /dev/null +++ b/src/frontends/qt4/GuiPhantom.cpp @@ -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 + +#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 index 0000000000..d28a7a1493 --- /dev/null +++ b/src/frontends/qt4/GuiPhantom.h @@ -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 diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index b28eb0cd39..bb2f0eef8b 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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; } diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index a9e328dd94..13391190fd 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -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 index 0000000000..fedd4090c7 --- /dev/null +++ b/src/frontends/qt4/ui/PhantomUi.ui @@ -0,0 +1,104 @@ + + PhantomUi + + + + 0 + 0 + 202 + 184 + + + + + + + true + + + + 9 + + + 6 + + + + + Close + + + true + + + + + + + &OK + + + false + + + + + + + Type + + + + 11 + + + 6 + + + + + Horizontal and vertical space of the phantom content + + + &Phantom + + + + + + + Horizontal space of the phantom content + + + &Horiz. Phantom + + + + + + + Vertical space of the phantom content + + + &Vert. Phantom + + + + + + + + + + phantomRB + vphantomRB + vphantomRB + okPB + closePB + + + qt_i18n.h + + + + -- 2.39.2