]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormRef.C
try this for distinguishing inner and outer tabs
[lyx.git] / src / frontends / xforms / FormRef.C
index 685f8207ec8549781ecd3ea981017b2f6ce3da56..4cb2bcf60e86867521c3e98f207326d7b351fe0a 100644 (file)
@@ -98,9 +98,12 @@ 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);
        }
 
+       lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_SAVE, "0");
+
        toggle = GOBACK;
        fl_set_object_label(dialog_->button_go, _("Goto reference"));
 
@@ -156,9 +159,10 @@ void FormRef::updateBrowser(vector<string> const & akeys) const
                string ref = fl_get_input(dialog_->ref);
                vector<string>::const_iterator cit =
                        find(keys.begin(), keys.end(), ref);
-               if (cit == keys.end())
+               if (cit == keys.end()) {
                        cit = keys.begin();
-               if (ref.empty())
+                       fl_set_input(dialog_->ref, (*cit).c_str());
+               } else if (ref.empty())
                        fl_set_input(dialog_->ref, (*cit).c_str());
 
                int const i = static_cast<int>(cit - keys.begin());
@@ -174,7 +178,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));
@@ -217,7 +221,7 @@ bool FormRef::input(FL_OBJECT *, long data)
 
                case GOBACK:
                {
-                       lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK);
+                       lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_GOTO, "0");
                        fl_set_object_label(dialog_->button_go,
                                            _("Goto reference"));
                }
@@ -241,7 +245,7 @@ bool FormRef::input(FL_OBJECT *, long data)
                }
 
                toggle = GOBACK;
-               lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK);
+               lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_GOTO, "0");
                fl_set_object_label(dialog_->button_go, _("Goto reference"));
 
                fl_activate_object(dialog_->type);
@@ -267,7 +271,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 +285,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;
-}