Fixed the behaviour of Goto-Ref (?)

Needs to be ported to the other frontends!


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1634 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2001-02-27 12:32:01 +00:00
parent 53675c6ce8
commit 697939d609
2 changed files with 12 additions and 34 deletions

View File

@ -33,9 +33,11 @@ using std::max;
using std::sort;
using std::vector;
bool saved_position;
FormRef::FormRef(LyXView * lv, Dialogs * d)
: FormCommand(lv, d, _("Reference"), new NoRepeatedApplyPolicy),
toggle(GOBACK), dialog_(0)
at_ref(false), dialog_(0)
{
// let the dialog be shown
// These are permanent connections so we won't bother
@ -102,9 +104,7 @@ void FormRef::update()
InsetRef::getType(params.getCmdName()) + 1);
}
lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_SAVE, "0");
toggle = GOBACK;
at_ref = false;
fl_set_object_label(dialog_->button_go, _("Goto reference"));
// Name is irrelevant to LaTeX/Literate documents, while
@ -192,7 +192,6 @@ void FormRef::apply()
} else {
lv_->getLyXFunc()->Dispatch(LFUN_REF_INSERT,
params.getAsString());
lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_SAVE, "0");
}
}
@ -207,30 +206,18 @@ bool FormRef::input(FL_OBJECT *, long data)
// No change to data
activate = false;
toggle = static_cast<Goto>(toggle + 1);
if (toggle == GOFIRST ) toggle = GOREF;
switch (toggle) {
case GOREF:
{
at_ref = !at_ref;
if (at_ref) {
lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_SAVE, "0");
lv_->getLyXFunc()->
Dispatch(LFUN_REF_GOTO,
fl_get_input(dialog_->ref));
fl_set_object_label(dialog_->button_go, _("Go back"));
}
break;
case GOBACK:
{
} else {
lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_GOTO, "0");
fl_set_object_label(dialog_->button_go,
_("Goto reference"));
}
break;
default:
break;
}
}
break;
@ -245,8 +232,9 @@ bool FormRef::input(FL_OBJECT *, long data)
fl_set_input(dialog_->ref, s.c_str());
}
toggle = GOBACK;
lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_GOTO, "0");
if (at_ref)
lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_GOTO, "0");
at_ref = false;
fl_set_object_label(dialog_->button_go, _("Goto reference"));
fl_activate_object(dialog_->type);

View File

@ -29,16 +29,6 @@ public:
~FormRef();
///
private:
///
enum Goto {
///
GOREF,
///
GOBACK,
///
GOFIRST
};
/// Disconnect signals. Also perform any necessary housekeeping.
virtual void disconnect();
@ -59,7 +49,7 @@ private:
FD_form_ref * build_ref();
///
Goto toggle;
bool at_ref;
///
std::vector<string> refs;