- 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
This commit is contained in:
Uwe Stöhr 2009-02-05 18:09:36 +00:00
parent 4b1d73775c
commit 8a0d98e67e
8 changed files with 290 additions and 25 deletions

View File

@ -732,6 +732,7 @@ src_frontends_qt4_header_files = Split('''
GuiNote.h GuiNote.h
GuiPainter.h GuiPainter.h
GuiParagraph.h GuiParagraph.h
GuiPhantom.h
GuiPrefs.h GuiPrefs.h
GuiPrint.h GuiPrint.h
GuiRef.h GuiRef.h
@ -823,6 +824,7 @@ src_frontends_qt4_files = Split('''
GuiNote.cpp GuiNote.cpp
GuiPainter.cpp GuiPainter.cpp
GuiParagraph.cpp GuiParagraph.cpp
GuiPhantom.cpp
GuiPrefs.cpp GuiPrefs.cpp
GuiPrint.cpp GuiPrint.cpp
GuiRef.cpp GuiRef.cpp
@ -911,6 +913,7 @@ src_frontends_qt4_ui_files = Split('''
PageLayoutUi.ui PageLayoutUi.ui
ParagraphUi.ui ParagraphUi.ui
PDFSupportUi.ui PDFSupportUi.ui
PhantomUi.ui
PreambleUi.ui PreambleUi.ui
PrefColorsUi.ui PrefColorsUi.ui
PrefCompletionUi.ui PrefCompletionUi.ui

View File

@ -120,6 +120,7 @@ Menuset
OptItem "Float Settings...|a" "inset-settings float" OptItem "Float Settings...|a" "inset-settings float"
OptItem "Text Wrap Settings...|W" "inset-settings wrap" OptItem "Text Wrap Settings...|W" "inset-settings wrap"
OptItem "Note Settings...|N" "inset-settings note" OptItem "Note Settings...|N" "inset-settings note"
OptItem "Phantom Settings...|h" "inset-settings phantom"
OptItem "Branch Settings...|B" "inset-settings branch" OptItem "Branch Settings...|B" "inset-settings branch"
OptItem "Box Settings...|x" "inset-settings box" OptItem "Box Settings...|x" "inset-settings box"
OptItem "Listings Settings...|g" "inset-settings listings" OptItem "Listings Settings...|g" "inset-settings listings"
@ -375,7 +376,7 @@ Menuset
Item "Horizontal Space...|o" "dialog-show-new-inset space" Item "Horizontal Space...|o" "dialog-show-new-inset space"
Item "Horizontal Line|L" "line-insert" Item "Horizontal Line|L" "line-insert"
Item "Vertical Space...|V" "dialog-show-new-inset vspace" Item "Vertical Space...|V" "dialog-show-new-inset vspace"
Submenu "Phantom Text" "insert_phantom" Submenu "Phantom" "insert_phantom"
Separator Separator
Item "Hyphenation Point|H" "specialchar-insert hyphenation" Item "Hyphenation Point|H" "specialchar-insert hyphenation"
Item "Ligature Break|k" "specialchar-insert ligature-break" Item "Ligature Break|k" "specialchar-insert ligature-break"

View File

@ -2146,9 +2146,9 @@ void LyXAction::init()
/*! /*!
* \var lyx::FuncCode lyx::LFUN_INSET_MODIFY * \var lyx::FuncCode lyx::LFUN_INSET_MODIFY
* \li Action: Modify existing inset. * \li Action: Modify existing inset.
* \li Notion: Used for label, floats, listings, box, branch, external, wrap * \li Notion: Used for bibitem, bibtex, box, branch, command, ert, external,
bibtex, ert, command, graphics, note, space, vspace, tabular, floats, graphics, include, label, listings, note,
bibitem, inlude, ref insets. phantom, ref, space, tabular, vspace, wrap insets.
* \li Syntax: inset-modify <INSET> <ARGS> * \li Syntax: inset-modify <INSET> <ARGS>
* \li Params: See #LFUN_INSET_INSERT for further details. * \li Params: See #LFUN_INSET_INSERT for further details.
* \endvar * \endvar
@ -2157,9 +2157,9 @@ void LyXAction::init()
/*! /*!
* \var lyx::FuncCode lyx::LFUN_NEXT_INSET_MODIFY * \var lyx::FuncCode lyx::LFUN_NEXT_INSET_MODIFY
* \li Action: Modify the inset at cursor position, if there is one. * \li Action: Modify the inset at cursor position, if there is one.
* \li Notion: Used for label, floats, listings, box, branch, external, wrap * \li Notion: Used for bibitem, bibtex, box, branch, command, ert, external,
bibtex, ert, command, graphics, note, space, vspace, tabular, floats, graphics, include, label, listings, note,
bibitem, inlude, ref insets. phantom, ref, space, tabular, vspace, wrap insets.
* \li Syntax: next-inset-modify <INSET> <ARGS> * \li Syntax: next-inset-modify <INSET> <ARGS>
* \li Syntax: next-inset-modify changetype <TYPE> * \li Syntax: next-inset-modify changetype <TYPE>
* \li Params: See #LFUN_INSET_INSERT for further details. * \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 Action: Open the inset's properties dialog.
* \li Notion: Used for box, branch, ert, float, listings, note, tabular, wrap insets. * \li Notion: Used for box, branch, ert, float, listings, note, tabular, wrap insets.
* \li Syntax: inset-settings <INSET> * \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 * \endvar
*/ */
{ LFUN_INSET_SETTINGS, "inset-settings", ReadOnly, Edit }, { 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 * \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 (un-)collapsed, in case of other insets, the editing widget (dialog) will
be entered. Also cf. #LFUN_INSET_SETTINGS. be entered. Also cf. #LFUN_INSET_SETTINGS.
* \li Notion: Used for label, floats, listings, box, branch, external, wrap * \li Notion: Used for bibitem, bibtex, box, branch, command, ert, external,
bibtex, ert, command, graphics, note, space, vspace, tabular, floats, graphics, include, label, listings, note,
bibitem, inlude, ref insets. phantom, ref, space, tabular, vspace, wrap insets.
* \li Syntax: next-inset-toggle <ARG> * \li Syntax: next-inset-toggle <ARG>
* \li Params: <ARG>: these are passed as arguments to #LFUN_INSET_TOGGLE . * \li Params: <ARG>: these are passed as arguments to #LFUN_INSET_TOGGLE .
* \li Origin: leeming, 30 Mar 2004 * \li Origin: leeming, 30 Mar 2004
@ -2442,10 +2442,10 @@ void LyXAction::init()
* \li Syntax: dialog-show <NAME> [<DATA>] * \li Syntax: dialog-show <NAME> [<DATA>]
* \li Params: <NAME>: aboutlyx|bibitem|bibtex|box|branch|changes|character|citation|\n * \li Params: <NAME>: aboutlyx|bibitem|bibtex|box|branch|changes|character|citation|\n
document|errorlist|ert|external|file|findreplace|float|graphics|\n document|errorlist|ert|external|file|findreplace|float|graphics|\n
include|index|info|nomenclature|label|log|mathdelimiter|mathmatrix|\n include|index|info|nomenclature|label|listings|log|mathdelimiter|\n
note|paragraph|prefs|print|ref|sendto|space|spellchecker|symbols|\n mathmatrix|note|paragraph|phantom|prefs|print|ref|sendto|space|\n
tabular|tabularcreate|thesaurus|texinfo|toc|href|view-source|vspace\n spellchecker|symbols|tabular|tabularcreate|thesaurus|texinfo|toc|href|\n
wrap|listings|<SPECIAL> \n view-source|vspace|wrap|<SPECIAL> \n
<SPECIAL>: latexlog|vclog \n <SPECIAL>: latexlog|vclog \n
<DATA>: data, usually settings for the given dialog. Use debug mode for the <DATA>: data, usually settings for the given dialog. Use debug mode for the
details. details.

View File

@ -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"

View File

@ -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

View File

@ -2297,10 +2297,11 @@ namespace {
char const * const dialognames[] = { char const * const dialognames[] = {
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character", "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
"citation", "document", "errorlist", "ert", "external", "file", "citation", "document", "errorlist", "ert", "external", "file", "findreplace",
"findreplace", "float", "graphics", "include", "index", "info", "nomenclature", "label", "log", "float", "graphics", "include", "index", "info", "nomenclature", "label",
"mathdelimiter", "mathmatrix", "mathspace", "note", "paragraph", "prefs", "print", "log", "mathdelimiter", "mathmatrix", "mathspace", "note", "paragraph",
"ref", "sendto", "space", "spellchecker", "symbols", "tabular", "tabularcreate", "phantom", "prefs", "print", "ref", "sendto", "space", "spellchecker",
"symbols", "tabular", "tabularcreate",
#ifdef HAVE_LIBAIKSAURUS #ifdef HAVE_LIBAIKSAURUS
"thesaurus", "thesaurus",
@ -2490,6 +2491,7 @@ Dialog * createGuiMathMatrix(GuiView & lv);
Dialog * createGuiNomenclature(GuiView & lv); Dialog * createGuiNomenclature(GuiView & lv);
Dialog * createGuiNote(GuiView & lv); Dialog * createGuiNote(GuiView & lv);
Dialog * createGuiParagraph(GuiView & lv); Dialog * createGuiParagraph(GuiView & lv);
Dialog * createGuiPhantom(GuiView & lv);
Dialog * createGuiPreferences(GuiView & lv); Dialog * createGuiPreferences(GuiView & lv);
Dialog * createGuiPrint(GuiView & lv); Dialog * createGuiPrint(GuiView & lv);
Dialog * createGuiRef(GuiView & lv); Dialog * createGuiRef(GuiView & lv);
@ -2559,8 +2561,6 @@ Dialog * GuiView::build(string const & name)
return createGuiLabel(*this); return createGuiLabel(*this);
if (name == "log") if (name == "log")
return createGuiLog(*this); return createGuiLog(*this);
if (name == "view-source")
return createGuiViewSource(*this);
if (name == "mathdelimiter") if (name == "mathdelimiter")
return createGuiDelimiter(*this); return createGuiDelimiter(*this);
if (name == "mathspace") if (name == "mathspace")
@ -2571,6 +2571,8 @@ Dialog * GuiView::build(string const & name)
return createGuiNote(*this); return createGuiNote(*this);
if (name == "paragraph") if (name == "paragraph")
return createGuiParagraph(*this); return createGuiParagraph(*this);
if (name == "phantom")
return createGuiPhantom(*this);
if (name == "prefs") if (name == "prefs")
return createGuiPreferences(*this); return createGuiPreferences(*this);
if (name == "print") if (name == "print")
@ -2591,20 +2593,22 @@ Dialog * GuiView::build(string const & name)
return createGuiTabularCreate(*this); return createGuiTabularCreate(*this);
if (name == "texinfo") if (name == "texinfo")
return createGuiTexInfo(*this); return createGuiTexInfo(*this);
if (name == "view-source")
return createGuiViewSource(*this);
#ifdef HAVE_LIBAIKSAURUS #ifdef HAVE_LIBAIKSAURUS
if (name == "thesaurus") if (name == "thesaurus")
return createGuiThesaurus(*this); return createGuiThesaurus(*this);
#endif #endif
if (name == "toc")
return createGuiToc(*this);
if (name == "href") if (name == "href")
return createGuiHyperlink(*this); return createGuiHyperlink(*this);
if (name == "listings")
return createGuiListings(*this);
if (name == "toc")
return createGuiToc(*this);
if (name == "vspace") if (name == "vspace")
return createGuiVSpace(*this); return createGuiVSpace(*this);
if (name == "wrap") if (name == "wrap")
return createGuiWrap(*this); return createGuiWrap(*this);
if (name == "listings")
return createGuiListings(*this);
return 0; return 0;
} }

View File

@ -100,6 +100,7 @@ SOURCEFILES = \
GuiNote.cpp \ GuiNote.cpp \
GuiPainter.cpp \ GuiPainter.cpp \
GuiParagraph.cpp \ GuiParagraph.cpp \
GuiPhantom.cpp \
GuiPrefs.cpp \ GuiPrefs.cpp \
GuiPrint.cpp \ GuiPrint.cpp \
GuiRef.cpp \ GuiRef.cpp \
@ -193,6 +194,7 @@ MOCHEADER = \
GuiNomencl.h \ GuiNomencl.h \
GuiNote.h \ GuiNote.h \
GuiParagraph.h \ GuiParagraph.h \
GuiPhantom.h \
GuiPrefs.h \ GuiPrefs.h \
GuiPrint.h \ GuiPrint.h \
GuiRef.h \ GuiRef.h \
@ -268,6 +270,7 @@ UIFILES = \
PageLayoutUi.ui \ PageLayoutUi.ui \
ParagraphUi.ui \ ParagraphUi.ui \
PDFSupportUi.ui \ PDFSupportUi.ui \
PhantomUi.ui \
PreambleUi.ui \ PreambleUi.ui \
PrefColorsUi.ui \ PrefColorsUi.ui \
PrefCompletionUi.ui \ PrefCompletionUi.ui \

View File

@ -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>