Move methods from FormRef.C to insetref.C

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1404 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2001-01-26 17:11:01 +00:00
parent 8fa3e54c2a
commit 976b104ffe
5 changed files with 29 additions and 22 deletions

View File

@ -98,7 +98,8 @@ void FormRef::update()
if (inset_) {
fl_set_input(dialog_->ref, params.getContents().c_str());
fl_set_input(dialog_->name, params.getOptions().c_str());
fl_set_choice(dialog_->type, getType()+1);
fl_set_choice(dialog_->type,
InsetRef::getType(params.getCmdName()) + 1);
}
toggle = GOBACK;
@ -174,7 +175,7 @@ void FormRef::apply()
return;
int const type = fl_get_choice(dialog_->type) - 1;
params.setCmdName(getName(type));
params.setCmdName(InsetRef::getName(type));
params.setOptions(fl_get_input(dialog_->name));
params.setContents(fl_get_input(dialog_->ref));
@ -267,7 +268,7 @@ bool FormRef::input(FL_OBJECT *, long data)
case 5:
{
int const type = fl_get_choice(dialog_->type) - 1;
if (params.getCmdName() == getName(type) && inset_) {
if (params.getCmdName() == InsetRef::getName(type) && inset_) {
activate = false;
}
}
@ -281,17 +282,3 @@ bool FormRef::input(FL_OBJECT *, long data)
}
int FormRef::getType() const
{
string const & command = params.getCmdName();
for (int i = 0; !InsetRef::types[i].latex_name.empty(); ++i)
if (command == InsetRef::types[i].latex_name)
return i;
return 0;
}
string const FormRef::getName(int type) const
{
return InsetRef::types[type].latex_name;
}

View File

@ -57,10 +57,6 @@ private:
void updateBrowser(std::vector<string> const &) const;
///
FD_form_ref * build_ref();
///
int getType() const;
///
string const getName(int type) const;
///
Goto toggle;

View File

@ -1,6 +1,11 @@
2001-01-26 Dekel Tsur <dekelts@tau.ac.il>
* insetref.C (getType, getName): Move methods from
src/frontends/xforms/FormRef.C.
2001-01-12 Dekel Tsur <dekelts@tau.ac.il>
* src/insets/insettabular.C: Various improvements.
* insettabular.C: Various improvements (use only one dummy position).
2001-01-25 Dekel Tsur <dekelts@tau.ac.il>

View File

@ -123,3 +123,18 @@ InsetRef::type_info InsetRef::types[] = {
{ "prettyref", N_("PrettyRef"), N_("PrettyRef: ")},
{ "", "", "" }
};
int InsetRef::getType(string const & name)
{
for (int i = 0; !types[i].latex_name.empty(); ++i)
if (name == types[i].latex_name)
return i;
return 0;
}
string const & InsetRef::getName(int type)
{
return types[type].latex_name;
}

View File

@ -32,6 +32,10 @@ public:
string short_gui_name;
};
static type_info types[];
///
static int getType(string const & name);
///
static string const & getName(int type);
///
InsetRef(InsetCommandParams const &, Buffer const &);