]> git.lyx.org Git - features.git/commitdiff
A real, LyX label dialog. Part 2: xforms.
authorAngus Leeming <leeming@lyx.org>
Thu, 27 Feb 2003 16:29:28 +0000 (16:29 +0000)
committerAngus Leeming <leeming@lyx.org>
Thu, 27 Feb 2003 16:29:28 +0000 (16:29 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6302 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/Dialogs3.C
src/frontends/xforms/FormIndex.C [deleted file]
src/frontends/xforms/FormIndex.h [deleted file]
src/frontends/xforms/FormText.C [new file with mode: 0644]
src/frontends/xforms/FormText.h [new file with mode: 0644]
src/frontends/xforms/Makefile.am
src/frontends/xforms/forms/Makefile.am
src/frontends/xforms/forms/form_index.fd [deleted file]
src/frontends/xforms/forms/form_text.fd [new file with mode: 0644]

index 0e826a1cf07af2412e5f497a200bb56f604a27da..95499c023989692d85c5a5619a7c2195ef841f45 100644 (file)
 #include "forms/form_ert.h"
 
 #include "ControlIndex.h"
-#include "FormIndex.h"
-#include "forms/form_index.h"
+#include "ControlLabel.h"
+
+#include "FormText.h"
+#include "forms/form_text.h"
 
 #include "ControlRef.h"
 #include "FormRef.h"
@@ -73,7 +75,7 @@ namespace {
 //                                  "minipage", "ref", "tabular", "toc",
 //                                  "url", "wrap" };
 char const * const dialognames[] = { "bibitem", "bibtex", "citation",
-                                    "error", "ert", "index", "ref",
+                                    "error", "ert", "index", "label", "ref",
                                     "toc", "url" };
 
 char const * const * const end_dialognames =
@@ -128,7 +130,11 @@ Dialog * Dialogs::build(string const & name)
                dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
        } else if (name == "index") {
                dialog->setController(new ControlIndex(*dialog));
-               dialog->setView(new FormIndex(*dialog));
+               dialog->setView(new FormText(*dialog, _("Index")));
+               dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
+       } else if (name == "label") {
+               dialog->setController(new ControlLabel(*dialog));
+               dialog->setView(new FormText(*dialog, _("Label")));
                dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
        } else if (name == "ref") {
                dialog->setController(new ControlRef(*dialog));
diff --git a/src/frontends/xforms/FormIndex.C b/src/frontends/xforms/FormIndex.C
deleted file mode 100644 (file)
index 99ef7d6..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * \file xforms/FormIndex.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS
- */
-
-#include <config.h>
-
-
-#include "xformsBC.h"
-#include "ControlIndex.h"
-#include "FormIndex.h"
-#include "forms/form_index.h"
-
-#include "support/lstrings.h"
-
-#include FORMS_H_LOCATION
-
-typedef FormController<ControlIndex, FormView<FD_index> > base_class;
-
-FormIndex::FormIndex(Dialog & parent)
-       : base_class(parent, _("Index"))
-{}
-
-
-void FormIndex::build()
-{
-       dialog_.reset(build_index(this));
-
-       fl_set_input_return(dialog_->input_key, FL_RETURN_CHANGED);
-       setPrehandler(dialog_->input_key);
-
-       // Manage the ok, apply, restore and cancel/close buttons
-       bc().setOK(dialog_->button_ok);
-       bc().setApply(dialog_->button_apply);
-       bc().setCancel(dialog_->button_close);
-       bc().setRestore(dialog_->button_restore);
-
-       bc().addReadOnly(dialog_->input_key);
-}
-
-
-void FormIndex::update()
-{
-       string const contents = trim(controller().params().getContents());
-       fl_set_input(dialog_->input_key, contents.c_str());
-
-       bc().valid(!contents.empty());
-}
-
-
-void FormIndex::apply()
-{
-       controller().params().setContents(fl_get_input(dialog_->input_key));
-}
diff --git a/src/frontends/xforms/FormIndex.h b/src/frontends/xforms/FormIndex.h
deleted file mode 100644 (file)
index c1b2d29..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// -*- C++ -*-
-/**
- * \file xforms/FormIndex.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS
- */
-
-#ifndef FORMINDEX_H
-#define FORMINDEX_H
-
-
-#include "FormDialogView.h"
-
-class ControlIndex;
-struct FD_index;
-
-/** This class provides an XForms implementation of the Index Dialog.
- */
-class FormIndex : public FormController<ControlIndex, FormView<FD_index> > {
-public:
-       ///
-       FormIndex(Dialog &);
-private:
-       /// Set the Params variable for the Controller.
-       virtual void apply();
-       /// Build the dialog.
-       virtual void build();
-       /// Update dialog before/whilst showing it.
-       virtual void update();
-};
-
-#endif // FORMINDEX_H
diff --git a/src/frontends/xforms/FormText.C b/src/frontends/xforms/FormText.C
new file mode 100644 (file)
index 0000000..29487d2
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+ * \file FormText.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#include <config.h>
+
+#include "xformsBC.h"
+#include "ControlCommand.h"
+#include "FormText.h"
+#include "forms/form_text.h"
+
+#include "support/lstrings.h"
+
+#include FORMS_H_LOCATION
+
+typedef FormController<ControlCommand, FormView<FD_text> > base_class;
+
+FormText::FormText(Dialog & parent, string const & title)
+       : base_class(parent, title)
+{}
+
+
+void FormText::build()
+{
+       dialog_.reset(build_text(this));
+
+       fl_set_input_return(dialog_->input_text, FL_RETURN_CHANGED);
+       setPrehandler(dialog_->input_text);
+
+       // Manage the ok, apply, restore and cancel/close buttons
+       bc().setOK(dialog_->button_ok);
+       bc().setApply(dialog_->button_apply);
+       bc().setCancel(dialog_->button_close);
+       bc().setRestore(dialog_->button_restore);
+
+       bc().addReadOnly(dialog_->input_text);
+}
+
+
+void FormText::update()
+{
+       string const contents = trim(controller().params().getContents());
+       fl_set_input(dialog_->input_text, contents.c_str());
+
+       bc().valid(!contents.empty());
+}
+
+
+void FormText::apply()
+{
+       controller().params().setContents(fl_get_input(dialog_->input_text));
+}
diff --git a/src/frontends/xforms/FormText.h b/src/frontends/xforms/FormText.h
new file mode 100644 (file)
index 0000000..94cd5b8
--- /dev/null
@@ -0,0 +1,35 @@
+// -*- C++ -*-
+/**
+ * \file FormText.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#ifndef FORMTEXT_H
+#define FORMTEXT_H
+
+
+#include "FormDialogView.h"
+
+class ControlCommand;
+struct FD_text;
+
+
+class FormText : public FormController<ControlCommand, FormView<FD_text> > {
+public:
+       ///
+       FormText(Dialog &, string const & title);
+private:
+       /// Set the Params variable for the Controller.
+       virtual void apply();
+       /// Build the dialog.
+       virtual void build();
+       /// Update dialog before/whilst showing it.
+       virtual void update();
+};
+
+#endif // FORMTEXT_H
index 3ac9282f94420162eded02603870083c04048884..094f1e7950a85a5c76ba517b8c8746c8b3bdc42c 100644 (file)
@@ -91,8 +91,6 @@ libxforms_la_SOURCES = \
        FormGraphics.h \
        FormInclude.C \
        FormInclude.h \
-       FormIndex.C \
-       FormIndex.h \
        FormLog.C \
        FormLog.h \
        FormMathsBitmap.C \
@@ -133,6 +131,8 @@ libxforms_la_SOURCES = \
        FormTabularCreate.h \
        FormTexinfo.C \
        FormTexinfo.h \
+       FormText.C \
+       FormText.h \
        FormThesaurus.C \
        FormThesaurus.h \
        FormToc.C \
index 615ad924f00d1f20de55e12736ad2098c2c96f0f..88828676654b0d5606c57e3f5e863d292ed8f7aa 100644 (file)
@@ -23,7 +23,6 @@ SRCS =  form_aboutlyx.fd \
        form_forks.fd \
        form_graphics.fd \
        form_include.fd \
-       form_index.fd \
        form_maths_delim.fd \
        form_maths_matrix.fd \
        form_maths_panel.fd \
@@ -41,6 +40,7 @@ SRCS =  form_aboutlyx.fd \
        form_tabular.fd \
        form_tabular_create.fd \
        form_texinfo.fd \
+       form_text.fd \
        form_thesaurus.fd \
        form_toc.fd \
        form_url.fd \
diff --git a/src/frontends/xforms/forms/form_index.fd b/src/frontends/xforms/forms/form_index.fd
deleted file mode 100644 (file)
index 72d4c05..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-Magic: 13000
-
-Internal Form Definition File
-    (do not change)
-
-Number of forms: 1
-Unit of measure: FL_COORD_PIXEL
-
-=============== FORM ===============
-Name: form_index
-Width: 520
-Height: 100
-Number of Objects: 6
-
---------------------
-class: FL_BOX
-type: UP_BOX
-box: 0 0 520 100
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 90 10 420 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Keyword:|#K
-shortcut:
-resize: FL_RESIZE_X
-gravity: FL_NoGravity FL_NoGravity
-name: input_key
-callback: C_FormDialogView_InputCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 10 60 100 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Restore|#R
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_SouthWest FL_SouthWest
-name: button_restore
-callback: C_FormDialogView_RestoreCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: RETURN_BUTTON
-box: 190 60 100 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: OK
-shortcut: ^M
-resize: FL_RESIZE_NONE
-gravity: FL_SouthEast FL_SouthEast
-name: button_ok
-callback: C_FormDialogView_OKCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 300 60 100 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Apply|#A
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_SouthEast FL_SouthEast
-name: button_apply
-callback: C_FormDialogView_ApplyCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 410 60 100 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Cancel|^[
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_SouthEast FL_SouthEast
-name: button_close
-callback: C_FormDialogView_CancelCB
-argument: 0
-
-==============================
-create_the_forms
diff --git a/src/frontends/xforms/forms/form_text.fd b/src/frontends/xforms/forms/form_text.fd
new file mode 100644 (file)
index 0000000..66c9de6
--- /dev/null
@@ -0,0 +1,124 @@
+Magic: 13000
+
+Internal Form Definition File
+    (do not change)
+
+Number of forms: 1
+Unit of measure: FL_COORD_PIXEL
+
+=============== FORM ===============
+Name: form_text
+Width: 520
+Height: 100
+Number of Objects: 6
+
+--------------------
+class: FL_BOX
+type: UP_BOX
+box: 0 0 520 100
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 90 10 420 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Keyword:|#K
+shortcut:
+resize: FL_RESIZE_X
+gravity: FL_NoGravity FL_NoGravity
+name: input_text
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 10 60 100 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Restore|#R
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_SouthWest FL_SouthWest
+name: button_restore
+callback: C_FormDialogView_RestoreCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: RETURN_BUTTON
+box: 190 60 100 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: OK
+shortcut: ^M
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
+name: button_ok
+callback: C_FormDialogView_OKCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 300 60 100 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Apply|#A
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
+name: button_apply
+callback: C_FormDialogView_ApplyCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 410 60 100 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Cancel|^[
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
+name: button_close
+callback: C_FormDialogView_CancelCB
+argument: 0
+
+==============================
+create_the_forms