From 697939d6097d88d6be77ef581ec7172381c8842b Mon Sep 17 00:00:00 2001 From: Dekel Tsur Date: Tue, 27 Feb 2001 12:32:01 +0000 Subject: [PATCH] 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 --- src/frontends/xforms/FormRef.C | 34 +++++++++++----------------------- src/frontends/xforms/FormRef.h | 12 +----------- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 56e2b7458e..3e079088c6 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -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(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); diff --git a/src/frontends/xforms/FormRef.h b/src/frontends/xforms/FormRef.h index a77b4f4ebd..4716b9610d 100644 --- a/src/frontends/xforms/FormRef.h +++ b/src/frontends/xforms/FormRef.h @@ -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 refs;