From 976b104ffee26b12d3379ad89f39443095b5496c Mon Sep 17 00:00:00 2001 From: Dekel Tsur Date: Fri, 26 Jan 2001 17:11:01 +0000 Subject: [PATCH] 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 --- src/frontends/xforms/FormRef.C | 21 ++++----------------- src/frontends/xforms/FormRef.h | 4 ---- src/insets/ChangeLog | 7 ++++++- src/insets/insetref.C | 15 +++++++++++++++ src/insets/insetref.h | 4 ++++ 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 685f8207ec..702a0a0e7c 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -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; -} diff --git a/src/frontends/xforms/FormRef.h b/src/frontends/xforms/FormRef.h index 3ebc1c89fc..a77b4f4ebd 100644 --- a/src/frontends/xforms/FormRef.h +++ b/src/frontends/xforms/FormRef.h @@ -57,10 +57,6 @@ private: void updateBrowser(std::vector const &) const; /// FD_form_ref * build_ref(); - /// - int getType() const; - /// - string const getName(int type) const; /// Goto toggle; diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 178c006762..40e2ad8bc4 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,6 +1,11 @@ +2001-01-26 Dekel Tsur + + * insetref.C (getType, getName): Move methods from + src/frontends/xforms/FormRef.C. + 2001-01-12 Dekel Tsur - * src/insets/insettabular.C: Various improvements. + * insettabular.C: Various improvements (use only one dummy position). 2001-01-25 Dekel Tsur diff --git a/src/insets/insetref.C b/src/insets/insetref.C index da9df59036..aa43f91640 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -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; +} diff --git a/src/insets/insetref.h b/src/insets/insetref.h index 51f2ffdd59..102371acdb 100644 --- a/src/insets/insetref.h +++ b/src/insets/insetref.h @@ -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 &); -- 2.39.2