A real, LyX label dialog. Part 2: xforms.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6302 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-02-27 16:29:28 +00:00
parent 05a4c4d79f
commit 1eeff87e19
6 changed files with 40 additions and 36 deletions

View File

@ -36,8 +36,10 @@
#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));

View File

@ -1,5 +1,5 @@
/**
* \file xforms/FormIndex.C
* \file FormText.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -10,29 +10,28 @@
#include <config.h>
#include "xformsBC.h"
#include "ControlIndex.h"
#include "FormIndex.h"
#include "forms/form_index.h"
#include "ControlCommand.h"
#include "FormText.h"
#include "forms/form_text.h"
#include "support/lstrings.h"
#include FORMS_H_LOCATION
typedef FormController<ControlIndex, FormView<FD_index> > base_class;
typedef FormController<ControlCommand, FormView<FD_text> > base_class;
FormIndex::FormIndex(Dialog & parent)
: base_class(parent, _("Index"))
FormText::FormText(Dialog & parent, string const & title)
: base_class(parent, title)
{}
void FormIndex::build()
void FormText::build()
{
dialog_.reset(build_index(this));
dialog_.reset(build_text(this));
fl_set_input_return(dialog_->input_key, FL_RETURN_CHANGED);
setPrehandler(dialog_->input_key);
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);
@ -40,20 +39,20 @@ void FormIndex::build()
bc().setCancel(dialog_->button_close);
bc().setRestore(dialog_->button_restore);
bc().addReadOnly(dialog_->input_key);
bc().addReadOnly(dialog_->input_text);
}
void FormIndex::update()
void FormText::update()
{
string const contents = trim(controller().params().getContents());
fl_set_input(dialog_->input_key, contents.c_str());
fl_set_input(dialog_->input_text, contents.c_str());
bc().valid(!contents.empty());
}
void FormIndex::apply()
void FormText::apply()
{
controller().params().setContents(fl_get_input(dialog_->input_key));
controller().params().setContents(fl_get_input(dialog_->input_text));
}

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
/**
* \file xforms/FormIndex.h
* \file FormText.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -9,21 +9,20 @@
* Full author contact details are available in file CREDITS
*/
#ifndef FORMINDEX_H
#define FORMINDEX_H
#ifndef FORMTEXT_H
#define FORMTEXT_H
#include "FormDialogView.h"
class ControlIndex;
struct FD_index;
class ControlCommand;
struct FD_text;
/** This class provides an XForms implementation of the Index Dialog.
*/
class FormIndex : public FormController<ControlIndex, FormView<FD_index> > {
class FormText : public FormController<ControlCommand, FormView<FD_text> > {
public:
///
FormIndex(Dialog &);
FormText(Dialog &, string const & title);
private:
/// Set the Params variable for the Controller.
virtual void apply();
@ -33,4 +32,4 @@ private:
virtual void update();
};
#endif // FORMINDEX_H
#endif // FORMTEXT_H

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

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

View File

@ -7,7 +7,7 @@ Number of forms: 1
Unit of measure: FL_COORD_PIXEL
=============== FORM ===============
Name: form_index
Name: form_text
Width: 520
Height: 100
Number of Objects: 6
@ -44,7 +44,7 @@ label: Keyword:|#K
shortcut:
resize: FL_RESIZE_X
gravity: FL_NoGravity FL_NoGravity
name: input_key
name: input_text
callback: C_FormDialogView_InputCB
argument: 0