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

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

View 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.

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[] = {
"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;
}

View 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 \

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>