From 3b380bf220040189ba9b6de275b98e72eefd4e19 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 26 Mar 2001 13:16:57 +0000 Subject: [PATCH] Controller-view split for Ref popup. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1826 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ChangeLog | 12 +- .../controllers/ControlConnections.C | 16 ++ .../controllers/ControlConnections.h | 13 ++ src/frontends/controllers/ControlRef.C | 54 +++++ src/frontends/controllers/ControlRef.h | 42 ++++ src/frontends/controllers/ControlUrl.h | 2 +- src/frontends/controllers/GUI.h | 14 ++ src/frontends/controllers/Makefile.am | 2 + src/frontends/xforms/ChangeLog | 5 + src/frontends/xforms/Dialogs.C | 6 +- src/frontends/xforms/FormRef.C | 197 +++++++----------- src/frontends/xforms/FormRef.h | 50 ++--- src/frontends/xforms/FormUrl.C | 4 +- src/frontends/xforms/FormUrl.h | 4 +- src/frontends/xforms/form_ref.C | 18 +- src/frontends/xforms/form_ref.h | 10 +- src/frontends/xforms/forms/form_ref.fd | 36 ++-- 17 files changed, 291 insertions(+), 194 deletions(-) create mode 100644 src/frontends/controllers/ControlRef.C create mode 100644 src/frontends/controllers/ControlRef.h diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index aac6150072..94ffd17afc 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,13 @@ +2001-03-26 Angus Leeming + + * ControlConnections.[Ch]: (docType): new method; returns the type + of the buffer, LaTeX, Literate, LinuxDoc or DocBook. + + * ControlRef.[Ch]: new files; controller for the Ref popup. + + * GUI.h: + * Makefile.am: associated changes. + 2001-03-26 Angus Leeming * ControlCitation.C (getBibkeyInfo): get nasty and assert the info map @@ -51,7 +61,7 @@ 2001-03-22 Lars Gullik Bjønnes * ControlCredits.C: remove using that is only used once, use - std::ios instead of std::iosbase, add som annoying comments. + std::ios instead of std::iosbase, add some annoying comments. 2001-03-22 Angus Leeming diff --git a/src/frontends/controllers/ControlConnections.C b/src/frontends/controllers/ControlConnections.C index 050a00d9c8..2446320a75 100644 --- a/src/frontends/controllers/ControlConnections.C +++ b/src/frontends/controllers/ControlConnections.C @@ -58,6 +58,22 @@ bool ControlConnectBase::isReadonly() const } +ControlConnectBase::DocTypes ControlConnectBase::docType() const +{ + if (!lv_.buffer()) + return LATEX; + + if (lv_.buffer()->isLatex()) + return LATEX; + else if (lv_.buffer()->isLiterate()) + return LITERATE; + else if (lv_.buffer()->isLinuxDoc()) + return LINUXDOC; + /* else if (lv_.buffer()->isDocBook()) */ + return DOCBOOK; +} + + ControlConnectBI::ControlConnectBI(LyXView & lv, Dialogs & d) : ControlConnectBase(lv, d) {} diff --git a/src/frontends/controllers/ControlConnections.h b/src/frontends/controllers/ControlConnections.h index ff8a805a09..f3401af66c 100644 --- a/src/frontends/controllers/ControlConnections.h +++ b/src/frontends/controllers/ControlConnections.h @@ -46,10 +46,23 @@ class LyXView; class ControlConnectBase : public ControlBase { public: + /// + enum DocTypes { + /// + LATEX, + /// + LITERATE, + /// + LINUXDOC, + /// + DOCBOOK + }; /// ControlConnectBase(LyXView &, Dialogs &); /// The View may need to know if the buffer is read-only. bool isReadonly() const; + /// + DocTypes docType() const; protected: /// True if the dialog depends on the buffer, else false. diff --git a/src/frontends/controllers/ControlRef.C b/src/frontends/controllers/ControlRef.C new file mode 100644 index 0000000000..6b8b854596 --- /dev/null +++ b/src/frontends/controllers/ControlRef.C @@ -0,0 +1,54 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2001 The LyX Team. + * + * ====================================================== + * + * \file ControlRef.C + * \author Angus Leeming + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "Dialogs.h" +#include "ControlRef.h" +#include "Dialogs.h" +#include "LyXView.h" +#include "buffer.h" +#include "lyxfunc.h" + +using SigC::slot; + +ControlRef::ControlRef(LyXView & lv, Dialogs & d) + : ControlCommand(lv, d, LFUN_REF_INSERT) +{ + d_.showRef.connect(slot(this, &ControlRef::showInset)); + d_.createRef.connect(slot(this, &ControlRef::createInset)); +} + + +std::vector const ControlRef::getLabelList() const +{ + return lv_.buffer()->getLabelList(); +} + + +void ControlRef::gotoRef(string const & ref) const +{ + lv_.getLyXFunc()->Dispatch(LFUN_BOOKMARK_SAVE, "0"); + lv_.getLyXFunc()->Dispatch(LFUN_REF_GOTO, ref); +} + + +void ControlRef::gotoBookmark() const +{ + lv_.getLyXFunc()->Dispatch(LFUN_BOOKMARK_GOTO, "0"); +} + diff --git a/src/frontends/controllers/ControlRef.h b/src/frontends/controllers/ControlRef.h new file mode 100644 index 0000000000..0a125fbe8d --- /dev/null +++ b/src/frontends/controllers/ControlRef.h @@ -0,0 +1,42 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2001 The LyX Team. + * + * ====================================================== + * + * \file ControlRef.h + * \author Angus Leeming + */ + +#ifndef CONTROLREF_H +#define CONTROLREF_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "ControlCommand.h" + +/** A controller for the Ref Dialog. + */ +class ControlRef : public ControlCommand { +public: + /// + ControlRef(LyXView &, Dialogs &); + + /// + std::vector const getLabelList() const; + /// + void gotoRef(string const &) const; + /// + void gotoBookmark() const; + +private: + /// not needed. + virtual void clearDaughterParams() {} +}; + +#endif // CONTROLREF_H diff --git a/src/frontends/controllers/ControlUrl.h b/src/frontends/controllers/ControlUrl.h index de6eebc67a..6041f021de 100644 --- a/src/frontends/controllers/ControlUrl.h +++ b/src/frontends/controllers/ControlUrl.h @@ -20,7 +20,7 @@ #include "ControlCommand.h" -/** This class provides an XForms implementation of the FormUrl Dialog. +/** A controller for the Url Dialog. */ class ControlUrl : public ControlCommand { diff --git a/src/frontends/controllers/GUI.h b/src/frontends/controllers/GUI.h index 5e966a7a9a..10ef6529bf 100644 --- a/src/frontends/controllers/GUI.h +++ b/src/frontends/controllers/GUI.h @@ -151,6 +151,20 @@ public: }; +/** Specialization for Ref dialog + */ +class ControlRef; + +template +class GUIRef : + public GUI { +public: + /// + GUIRef(LyXView & lv, Dialogs & d) + : GUI(lv, d) {} +}; + + /** Specialization for Url dialog */ class ControlUrl; diff --git a/src/frontends/controllers/Makefile.am b/src/frontends/controllers/Makefile.am index 4fe9c841ba..853a71c3c6 100644 --- a/src/frontends/controllers/Makefile.am +++ b/src/frontends/controllers/Makefile.am @@ -40,6 +40,8 @@ libcontrollers_la_SOURCES=\ ControlInset.h \ ControlLog.C \ ControlLog.h \ + ControlRef.C \ + ControlRef.h \ ControlUrl.C \ ControlUrl.h \ ControlVCLog.C \ diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 9d5a69da4b..9947e2d20d 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2001-03-26 Angus Leeming + + * FormRef.[Ch]: + * forms/form_ref.fd: implemented controller-view split. + 2001-03-23 Angus Leeming * FormError.[Ch]: diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index b6a691f996..b8b0cc80f4 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -29,6 +29,7 @@ #include "ControlInclude.h" #include "ControlLog.h" #include "ControlUrl.h" +#include "ControlRef.h" #include "ControlVCLog.h" #include "GUI.h" @@ -43,6 +44,7 @@ #include "form_credits.h" #include "form_error.h" #include "form_include.h" +#include "form_ref.h" #include "form_url.h" #include "FormBibitem.h" @@ -54,6 +56,7 @@ #include "FormError.h" #include "FormInclude.h" #include "FormLog.h" +#include "FormRef.h" #include "FormUrl.h" #include "FormVCLog.h" @@ -66,7 +69,6 @@ #include "FormPreamble.h" #include "FormPreferences.h" #include "FormPrint.h" -#include "FormRef.h" #include "FormSearch.h" #include "FormSplash.h" #include "FormTabular.h" @@ -91,6 +93,7 @@ Dialogs::Dialogs(LyXView * lv) add(new GUIError(*lv, *this)); add(new GUIInclude(*lv, *this)); add(new GUILog(*lv, *this)); + add(new GUIRef(*lv, *this)); add(new GUIUrl(*lv, *this)); add(new GUIVCLog(*lv, *this)); @@ -103,7 +106,6 @@ Dialogs::Dialogs(LyXView * lv) add(new FormPreamble(lv, this)); add(new FormPreferences(lv, this)); add(new FormPrint(lv, this)); - add(new FormRef(lv, this)); add(new FormSearch(lv, this)); add(new FormSplash(lv, this)); add(new FormTabular(lv, this)); diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 184bd2ac51..7e245bb14f 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -1,65 +1,50 @@ -// -*- C++ -*- /* This file is part of * ====================================================== * * LyX, The Document Processor * - * Copyright 2000 The LyX Team. + * Copyright 2000-2001 The LyX Team. * * ====================================================== + * + * \file FormRef.C + * \author Angus Leeming, a.leeming@ic.ac.uk */ #include - #include -#include FORMS_H_LOCATION #ifdef __GNUG__ #pragma implementation #endif +#include "xformsBC.h" +#include "ControlRef.h" +#include "FormRef.h" +#include "form_ref.h" +#include "xforms_helpers.h" +#include "insets/insetref.h" + +/* #include "Dialogs.h" #include "FormRef.h" #include "LyXView.h" #include "buffer.h" #include "form_ref.h" #include "lyxfunc.h" -#include "insets/insetref.h" -#include "xforms_helpers.h" +*/ using std::find; using std::max; using std::sort; using std::vector; -using SigC::slot; - -bool saved_position; -FormRef::FormRef(LyXView * lv, Dialogs * d) - : FormCommand(lv, d, _("Reference")), - at_ref(false) -{ - // let the dialog be shown - // These are permanent connections so we won't bother - // storing a copy because we won't be disconnecting. - d->showRef.connect(slot(this, &FormRef::showInset)); - d->createRef.connect(slot(this, &FormRef::createInset)); -} +typedef FormCB > base_class; - -FL_FORM * FormRef::form() const -{ - if (dialog_.get()) - return dialog_->form; - return 0; -} - - -void FormRef::disconnect() -{ - refs.clear(); - FormCommand::disconnect(); -} +FormRef::FormRef(ControlRef & c) + : base_class(c, _("Reference")), + at_ref_(false) +{} void FormRef::build() @@ -79,41 +64,40 @@ void FormRef::build() bc().setCancel(dialog_->button_cancel); bc().setUndoAll(dialog_->button_restore); bc().refresh(); - -#warning I had to uncomment this so the buttons could be disabled in update() (dekel) - //bc().addReadOnly(dialog_->type); - //bc().addReadOnly(dialog_->name); } 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, - InsetRef::getType(params.getCmdName()) + 1); - } - - at_ref = false; + fl_set_input(dialog_->ref, + controller().params().getContents().c_str()); + fl_set_input(dialog_->name, + controller().params().getOptions().c_str()); + fl_set_choice(dialog_->type, + InsetRef::getType(controller().params().getCmdName()) + 1); + + at_ref_ = false; fl_set_object_label(dialog_->button_go, _("Goto reference")); - // Name is irrelevant to LaTeX/Literate documents, while - // type is irrelevant to LinuxDoc/DocBook. - if (lv_->buffer()->isLatex() || lv_->buffer()->isLatex()) { + // Name is irrelevant to LaTeX/Literate documents + if (controller().docType() == ControlRef::LATEX || + controller().docType() == ControlRef::LITERATE) { setEnabled(dialog_->name, false); - setEnabled(dialog_->type, true); } else { - fl_set_choice(dialog_->type, 1); - setEnabled(dialog_->name, true); - setEnabled(dialog_->type, false); } - refs = lv_->buffer()->getLabelList(); - updateBrowser(refs); + // type is irrelevant to LinuxDoc/DocBook. + if (controller().docType() == ControlRef::LINUXDOC || + controller().docType() == ControlRef::DOCBOOK) { + fl_set_choice(dialog_->type, 1); + setEnabled(dialog_->type, false); + } else { + setEnabled(dialog_->type, true); + } - bc().readOnly(lv_->buffer()->isReadonly()); + refs_ = controller().getLabelList(); + updateBrowser(refs_); } @@ -126,7 +110,7 @@ void FormRef::updateBrowser(vector const & akeys) const fl_clear_browser(dialog_->browser); for (vector::const_iterator it = keys.begin(); it != keys.end(); ++it) - fl_add_browser_line(dialog_->browser, (*it).c_str()); + fl_add_browser_line(dialog_->browser, it->c_str()); if (keys.empty()) { fl_add_browser_line(dialog_->browser, @@ -145,9 +129,9 @@ void FormRef::updateBrowser(vector const & akeys) const find(keys.begin(), keys.end(), ref); if (cit == keys.end()) { cit = keys.begin(); - fl_set_input(dialog_->ref, (*cit).c_str()); + fl_set_input(dialog_->ref, cit->c_str()); } else if (ref.empty()) - fl_set_input(dialog_->ref, (*cit).c_str()); + fl_set_input(dialog_->ref, cit->c_str()); int const i = static_cast(cit - keys.begin()); fl_set_browser_topline(dialog_->browser, max(i-5, 1)); @@ -158,101 +142,72 @@ void FormRef::updateBrowser(vector const & akeys) const void FormRef::apply() { - if (!lv_->view()->available()) - return; - int const type = fl_get_choice(dialog_->type) - 1; - params.setCmdName(InsetRef::getName(type)); - - params.setOptions(fl_get_input(dialog_->name)); - params.setContents(fl_get_input(dialog_->ref)); + controller().params().setCmdName(InsetRef::getName(type)); - if (inset_ != 0) { - // Only update if contents have changed - if (params != inset_->params()) { - inset_->setParams(params); - lv_->view()->updateInset(inset_, true); - } - } else { - lv_->getLyXFunc()->Dispatch(LFUN_REF_INSERT, - params.getAsString()); - } + controller().params().setOptions(fl_get_input(dialog_->name)); + controller().params().setContents(fl_get_input(dialog_->ref)); } -bool FormRef::input(FL_OBJECT *, long data) +ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long) { - bool activate(true); - switch (data) { - // goto reference / go back - case 1: - { + ButtonPolicy::SMInput activate(ButtonPolicy::SMI_VALID); + + if (ob == dialog_->button_go) { + // goto reference / go back + // No change to data - activate = false; - - 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)); + activate = ButtonPolicy::SMI_NOOP; + + at_ref_ = !at_ref_; + if (at_ref_) { + controller().gotoRef(fl_get_input(dialog_->ref)); fl_set_object_label(dialog_->button_go, _("Go back")); } else { - lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_GOTO, "0"); + controller().gotoBookmark(); fl_set_object_label(dialog_->button_go, _("Goto reference")); } - } - break; - // choose browser key - case 2: - { + } else if (ob == dialog_->browser) { + unsigned int sel = fl_get_browser(dialog_->browser); - if (sel < 1 || sel > refs.size()) break; + if (sel < 1 || sel > refs_.size()) + return ButtonPolicy::SMI_NOOP; - if (!lv_->buffer()->isReadonly()) { + if (!controller().isReadonly()) { string s = fl_get_browser_line(dialog_->browser, sel); fl_set_input(dialog_->ref, s.c_str()); } - if (at_ref) - lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_GOTO, "0"); - at_ref = false; + if (at_ref_) + controller().gotoBookmark(); + at_ref_ = false; fl_set_object_label(dialog_->button_go, _("Goto reference")); setEnabled(dialog_->type, true); setEnabled(dialog_->button_go, true); fl_set_object_lcol(dialog_->ref, FL_BLACK); - } - break; - // update or sort - case 3: - refs = lv_->buffer()->getLabelList(); + } else if (ob == dialog_->button_update || + ob == dialog_->sort) { + + if (ob == dialog_->button_update) + refs_ = controller().getLabelList(); - // fall through to... - case 4: fl_freeze_form(form()); - updateBrowser(refs); + updateBrowser(refs_); fl_unfreeze_form(form()); - break; - // changed reference type - case 5: - { + } else if (ob == dialog_->type) { + int const type = fl_get_choice(dialog_->type) - 1; - if (params.getCmdName() == InsetRef::getName(type) && inset_) { - activate = false; + if (controller().params().getCmdName() == + InsetRef::getName(type)) { + activate = ButtonPolicy::SMI_NOOP; } } - break; - - default: - break; - } return activate; } - - diff --git a/src/frontends/xforms/FormRef.h b/src/frontends/xforms/FormRef.h index 85c8146cf1..bd6a84b2f3 100644 --- a/src/frontends/xforms/FormRef.h +++ b/src/frontends/xforms/FormRef.h @@ -1,70 +1,54 @@ -// -*- C++ -*- /* This file is part of * ====================================================== * * LyX, The Document Processor * - * Copyright 2000 The LyX Team. + * Copyright 2000-2001 The LyX Team. * * ====================================================== + * + * \file FormRef.h + * \author Angus Leeming, a.leeming@.ac.uk */ #ifndef FORMREF_H #define FORMREF_H -#include - #ifdef __GNUG__ #pragma interface #endif -#include "FormInset.h" +#include "FormBase.h" +class ControlRef; struct FD_form_ref; /** This class provides an XForms implementation of the FormRef Dialog. */ -class FormRef : public FormCommand { +class FormRef : public FormCB > { public: /// - FormRef(LyXView *, Dialogs *); -private: - /// Pointer to the actual instantiation of the ButtonController. - virtual xformsBC & bc(); - /// Disconnect signals. Also perform any necessary housekeeping. - virtual void disconnect(); + FormRef(ControlRef &); +private: + /// Set the Params variable for the Controller. + virtual void apply(); /// Build the dialog virtual void build(); - /// Filter the input - virtual bool input(FL_OBJECT *, long); + /// Filter the inputs on callback from xforms + virtual ButtonPolicy::SMInput input(FL_OBJECT *, long); /// Update dialog before showing it virtual void update(); - /// Not used but must be instantiated - virtual void apply(); - /// Pointer to the actual instantiation of the xforms form - virtual FL_FORM * form() const; /// void updateBrowser(std::vector const &) const; - /// + /// Type definition from the fdesign produced header file. FD_form_ref * build_ref(); /// - bool at_ref; + bool at_ref_; /// - std::vector refs; - - /// Real GUI implementation. - boost::scoped_ptr dialog_; - /// The ButtonController - ButtonController bc_; + std::vector refs_; }; - -inline -xformsBC & FormRef::bc() -{ - return bc_; -} -#endif +#endif // FORMREF_H diff --git a/src/frontends/xforms/FormUrl.C b/src/frontends/xforms/FormUrl.C index bcea437694..62ef744794 100644 --- a/src/frontends/xforms/FormUrl.C +++ b/src/frontends/xforms/FormUrl.C @@ -1,5 +1,4 @@ -/* \file FormUrl.C - * This file is part of +/* This file is part of * ====================================================== * * LyX, The Document Processor @@ -8,6 +7,7 @@ * * ====================================================== * + * \file FormUrl.C * \author Angus Leeming, a.leeming@ic.ac.uk */ diff --git a/src/frontends/xforms/FormUrl.h b/src/frontends/xforms/FormUrl.h index 951ab9070b..d9d44f6953 100644 --- a/src/frontends/xforms/FormUrl.h +++ b/src/frontends/xforms/FormUrl.h @@ -1,5 +1,4 @@ -/* \file FormUrl.h - * This file is part of +/* This file is part of * ====================================================== * * LyX, The Document Processor @@ -8,6 +7,7 @@ * * ====================================================== * + * \file FormUrl.h * \author Angus Leeming, a.leeming@.ac.uk */ diff --git a/src/frontends/xforms/form_ref.C b/src/frontends/xforms/form_ref.C index 651284a1c4..486b6e7f2e 100644 --- a/src/frontends/xforms/form_ref.C +++ b/src/frontends/xforms/form_ref.C @@ -28,14 +28,14 @@ FD_form_ref * FormRef::build_ref() fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 270, 240, ""); fl_set_object_lalign(obj, FL_ALIGN_TOP); fl_set_object_gravity(obj, FL_NorthWest, FL_South); - fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 2); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); { char const * const dummy = N_("Update|#U"); fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 40, 260, 90, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); - fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 3); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); { char const * const dummy = N_("Sort|#S"); fdui->sort = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 170, 260, 30, 30, idex(_(dummy))); @@ -43,7 +43,7 @@ FD_form_ref * FormRef::build_ref() } fl_set_object_lalign(obj, FL_ALIGN_RIGHT); fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); - fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 4); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); { char const * const dummy = N_("Name:|#N"); fdui->name = obj = fl_add_input(FL_NORMAL_INPUT, 370, 10, 150, 40, idex(_(dummy))); @@ -60,38 +60,38 @@ FD_form_ref * FormRef::build_ref() fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_lalign(obj, FL_ALIGN_TOP); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 5); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); { char const * const dummy = N_("Goto reference|#G"); fdui->button_go = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 200, 140, 40, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 1); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 230, 300, 90, 30, _("OK")); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, C_FormBaseDeprecatedOKCB, 0); + fl_set_object_callback(obj, C_FormBaseOKCB, 0); { char const * const dummy = N_("Cancel|^["); fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 430, 300, 90, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, C_FormBaseDeprecatedCancelCB, 0); + fl_set_object_callback(obj, C_FormBaseCancelCB, 0); { char const * const dummy = N_("Apply|#A"); fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 300, 90, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, C_FormBaseDeprecatedApplyCB, 0); + fl_set_object_callback(obj, C_FormBaseApplyCB, 0); { char const * const dummy = N_("Restore|#R"); fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 300, 90, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, C_FormBaseDeprecatedRestoreCB, 0); + fl_set_object_callback(obj, C_FormBaseRestoreCB, 0); fl_end_form(); fdui->form->fdui = fdui; diff --git a/src/frontends/xforms/form_ref.h b/src/frontends/xforms/form_ref.h index 2ebce3212d..e37f57ff18 100644 --- a/src/frontends/xforms/form_ref.h +++ b/src/frontends/xforms/form_ref.h @@ -5,11 +5,11 @@ #define FD_form_ref_h_ /** Callbacks, globals and object handlers **/ -extern "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT *, long); -extern "C" void C_FormBaseDeprecatedOKCB(FL_OBJECT *, long); -extern "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT *, long); -extern "C" void C_FormBaseDeprecatedApplyCB(FL_OBJECT *, long); -extern "C" void C_FormBaseDeprecatedRestoreCB(FL_OBJECT *, long); +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); +extern "C" void C_FormBaseOKCB(FL_OBJECT *, long); +extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long); +extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long); +extern "C" void C_FormBaseRestoreCB(FL_OBJECT *, long); /**** Forms and Objects ****/ diff --git a/src/frontends/xforms/forms/form_ref.fd b/src/frontends/xforms/forms/form_ref.fd index be0b7dcc5c..5fe3646b04 100644 --- a/src/frontends/xforms/forms/form_ref.fd +++ b/src/frontends/xforms/forms/form_ref.fd @@ -45,8 +45,8 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NorthWest FL_South name: browser -callback: C_FormBaseDeprecatedInputCB -argument: 2 +callback: C_FormBaseInputCB +argument: -------------------- class: FL_BUTTON @@ -63,8 +63,8 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthWest FL_SouthWest name: button_update -callback: C_FormBaseDeprecatedInputCB -argument: 3 +callback: C_FormBaseInputCB +argument: -------------------- class: FL_CHECKBUTTON @@ -81,8 +81,8 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthWest FL_SouthWest name: sort -callback: C_FormBaseDeprecatedInputCB -argument: 4 +callback: C_FormBaseInputCB +argument: -------------------- class: FL_INPUT @@ -135,8 +135,8 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: type -callback: C_FormBaseDeprecatedInputCB -argument: 5 +callback: C_FormBaseInputCB +argument: -------------------- class: FL_BUTTON @@ -153,8 +153,8 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_go -callback: C_FormBaseDeprecatedInputCB -argument: 1 +callback: C_FormBaseInputCB +argument: -------------------- class: FL_BUTTON @@ -171,8 +171,8 @@ shortcut: ^M resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_ok -callback: C_FormBaseDeprecatedOKCB -argument: 0 +callback: C_FormBaseOKCB +argument: -------------------- class: FL_BUTTON @@ -189,8 +189,8 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_cancel -callback: C_FormBaseDeprecatedCancelCB -argument: 0 +callback: C_FormBaseCancelCB +argument: -------------------- class: FL_BUTTON @@ -207,8 +207,8 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_apply -callback: C_FormBaseDeprecatedApplyCB -argument: 0 +callback: C_FormBaseApplyCB +argument: -------------------- class: FL_BUTTON @@ -225,8 +225,8 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_restore -callback: C_FormBaseDeprecatedRestoreCB -argument: 0 +callback: C_FormBaseRestoreCB +argument: ============================== create_the_forms -- 2.39.2