Jean-Marc Lasgouttes wrote:
Abdelrazak Younes <[EMAIL PROTECTED]> writes:
see http://bugzilla.lyx.org/show_bug.cgi?id=4647
I begun to create a dialog (see attached). Question to LateX experts:
are those options mutually exclusive? Can you think of other useful
options?
Ideally those options will also be available in a caption context menu.
Such a dialog only makes sense if you have the underlying
LaTeX code at hand. What do you plan to use?
Me? Nothing... should I state again that I am a complete LateX ignorant :-)
I propose for now to drop this idea and make configuration through
inset styles work for now. Each insetcaption could have a name (like
charstyles do) and query its settings by reading entries
InsetLayout Caption:Caption
or
InsetLayout Caption:CaptionBelow
I think just exposing in a clear way what the document class offers is
the simplest thing to do for 1.6.
I am not opposed but the dialog code is very easy, see attached. If
somebody else can do the LateX part (including lyx2lyx?), that would be
fine IMHO. But we can also postpone that to 1.7 or 1.6.1 (if there's no
format change) if you prefer.
Abdel.
Index: lib/ui/stdcontext.inc
===================================================================
--- lib/ui/stdcontext.inc (revision 24409)
+++ lib/ui/stdcontext.inc (working copy)
@@ -98,6 +98,13 @@
End
#
+# InsetCaption context menu
+#
+ Menu "context-caption"
+ Item "Settings...|S" "inset-settings"
+ End
+
+#
# InsetCollapsable context menu
#
Menu "context-collapsable"
Index: src/frontends/qt4/GuiCaption.cpp
===================================================================
--- src/frontends/qt4/GuiCaption.cpp (revision 0)
+++ src/frontends/qt4/GuiCaption.cpp (revision 0)
@@ -0,0 +1,80 @@
+/**
+ * \file GuiCaption.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "GuiCaption.h"
+
+#include "FuncRequest.h"
+#include "qt_helpers.h"
+
+#include "support/debug.h"
+#include "insets/InsetCommand.h"
+
+#include <QLabel>
+#include <QPushButton>
+#include <QLineEdit>
+
+using namespace std;
+
+namespace lyx {
+namespace frontend {
+
+/////////////////////////////////////////////////////////////////
+//
+// GuiCaption
+//
+/////////////////////////////////////////////////////////////////
+
+GuiCaption::GuiCaption(GuiView & lv)
+ : DialogView(lv, "caption", qt_("Caption"))
+{
+ setupUi(this);
+}
+
+void GuiCaption::on_okPB_clicked()
+{
+ applyView();
+ hide();
+}
+
+
+void GuiCaption::on_cancelPB_clicked()
+{
+ hide();
+}
+
+
+void GuiCaption::applyView()
+{
+}
+
+
+void GuiCaption::updateView()
+{
+}
+
+
+void GuiCaption::enableView(bool enable)
+{
+}
+
+void GuiCaption::dispatchParams()
+{
+}
+
+
+Dialog * createGuiCaption(GuiView & lv) { return new GuiCaption(lv); }
+
+
+} // namespace frontend
+} // namespace lyx
+
+#include "GuiCaption_moc.cpp"
Property changes on: src\frontends\qt4\GuiCaption.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Index: src/frontends/qt4/GuiCaption.h
===================================================================
--- src/frontends/qt4/GuiCaption.h (revision 0)
+++ src/frontends/qt4/GuiCaption.h (revision 0)
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+/**
+ * \file GuiCaption.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GUICAPTION_H
+#define GUICAPTION_H
+
+#include "DialogView.h"
+#include "ui_CaptionUi.h"
+
+namespace lyx {
+namespace frontend {
+
+class GuiCaption : public DialogView, public Ui::CaptionUi
+{
+ Q_OBJECT
+
+public:
+ GuiCaption(GuiView & lv);
+
+ /// Dialog inherited methods
+ //@{
+ void applyView();
+ void updateView();
+ void dispatchParams();
+ void enableView(bool enable);
+ bool isBufferDependent() const { return true; }
+ FuncCode getLfun() const { return LFUN_SELF_INSERT; }
+ //@}
+
+public Q_SLOTS:
+ void on_cancelPB_clicked();
+ void on_okPB_clicked();
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GUICAPTION_H
Property changes on: src\frontends\qt4\GuiCaption.h
___________________________________________________________________
Name: svn:eol-style
+ native
Index: src/frontends/qt4/GuiView.cpp
===================================================================
--- src/frontends/qt4/GuiView.cpp (revision 24409)
+++ src/frontends/qt4/GuiView.cpp (working copy)
@@ -2006,8 +2006,8 @@
// dialog should have the same name as the inset.
char const * const dialognames[] = {
-"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
-"citation", "document", "errorlist", "ert", "external", "file",
+"aboutlyx", "bibitem", "bibtex", "box", "branch", "caption", "changes",
+"character", "citation", "document", "errorlist", "ert", "external", "file",
"findreplace", "float", "graphics", "include", "index", "nomenclature",
"label", "log",
"mathdelimiter", "mathmatrix", "note", "paragraph", "prefs", "print",
"ref", "sendto", "space", "spellchecker", "symbols", "tabular",
"tabularcreate",
@@ -2204,6 +2204,7 @@
Dialog * createGuiBibtex(GuiView & lv);
Dialog * createGuiBox(GuiView & lv);
Dialog * createGuiBranch(GuiView & lv);
+Dialog * createGuiCaption(GuiView & lv);
Dialog * createGuiChanges(GuiView & lv);
Dialog * createGuiCharacter(GuiView & lv);
Dialog * createGuiCitation(GuiView & lv);
@@ -2256,6 +2257,8 @@
return createGuiBox(*this);
if (name == "branch")
return createGuiBranch(*this);
+ if (name == "caption")
+ return createGuiCaption(*this);
if (name == "changes")
return createGuiChanges(*this);
if (name == "character")
Index: src/frontends/qt4/Makefile.am
===================================================================
--- src/frontends/qt4/Makefile.am (revision 24409)
+++ src/frontends/qt4/Makefile.am (working copy)
@@ -66,6 +66,7 @@
GuiBox.cpp \
GuiBranch.cpp \
GuiBranches.cpp \
+ GuiCaption.cpp \
GuiChanges.cpp \
GuiCharacter.cpp \
GuiCitation.cpp \
@@ -166,6 +167,7 @@
GuiBox.h \
GuiBranches.h \
GuiBranch.h \
+ GuiCaption.h \
GuiChanges.h \
GuiCharacter.h \
GuiCitation.h \
Index: src/frontends/qt4/ui/CaptionUi.ui
===================================================================
--- src/frontends/qt4/ui/CaptionUi.ui (revision 0)
+++ src/frontends/qt4/ui/CaptionUi.ui (revision 0)
@@ -0,0 +1,79 @@
+<ui version="4.0" >
+ <class>CaptionUi</class>
+ <widget class="QDialog" name="CaptionUi" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>269</width>
+ <height>107</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string/>
+ </property>
+ <property name="sizeGripEnabled" >
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QComboBox" name="captionType" />
+ </item>
+ <item>
+ <widget class="QCheckBox" name="continuedCB" >
+ <property name="text" >
+ <string>&Continued Caption</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" >
+ <spacer name="spacer" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>84</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QPushButton" name="okPB" >
+ <property name="text" >
+ <string>&OK</string>
+ </property>
+ <property name="default" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" >
+ <widget class="QPushButton" name="closePB" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ <property name="autoDefault" >
+ <bool>false</bool>
+ </property>
+ <property name="default" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <includes>
+ <include location="local" >qt_i18n.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
Index: src/insets/InsetCaption.cpp
===================================================================
--- src/insets/InsetCaption.cpp (revision 24409)
+++ src/insets/InsetCaption.cpp (working copy)
@@ -116,6 +116,20 @@
}
+docstring InsetCaption::contextMenu(BufferView const & bv, int x, int y) const
+{
+ return from_ascii("context-caption");
+}
+
+
+bool InsetCaption::showInsetDialog(BufferView * bv) const
+{
+ bv->showDialog("caption", "",
+ const_cast<InsetCaption *>(this));
+ return true;
+}
+
+
void InsetCaption::metrics(MetricsInfo & mi, Dimension & dim) const
{
FontInfo tmpfont = mi.base.font;
Index: src/insets/InsetCaption.h
===================================================================
--- src/insets/InsetCaption.h (revision 24409)
+++ src/insets/InsetCaption.h (working copy)
@@ -30,6 +30,11 @@
int getOptArg(odocstream & os, OutputParams const &) const;
/// return the caption text
int getCaptionText(odocstream & os, OutputParams const &) const;
+ ///
+ docstring contextMenu(BufferView const & bv, int x, int y) const;
+ ///
+ bool showInsetDialog(BufferView *) const;
+
private:
///
void write(std::ostream & os) const;