Controller-view split for Ref popup.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1826 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-03-26 13:16:57 +00:00
parent 24cc3e5be3
commit 3b380bf220
17 changed files with 290 additions and 193 deletions

View File

@ -1,3 +1,13 @@
2001-03-26 Angus Leeming <a.leeming@ic.ac.uk>
* 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 <a.leeming@ic.ac.uk> 2001-03-26 Angus Leeming <a.leeming@ic.ac.uk>
* ControlCitation.C (getBibkeyInfo): get nasty and assert the info map * ControlCitation.C (getBibkeyInfo): get nasty and assert the info map
@ -51,7 +61,7 @@
2001-03-22 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com> 2001-03-22 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* ControlCredits.C: remove using that is only used once, use * 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 <a.leeming@ic.ac.uk> 2001-03-22 Angus Leeming <a.leeming@ic.ac.uk>

View File

@ -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) ControlConnectBI::ControlConnectBI(LyXView & lv, Dialogs & d)
: ControlConnectBase(lv, d) : ControlConnectBase(lv, d)
{} {}

View File

@ -46,10 +46,23 @@ class LyXView;
class ControlConnectBase : public ControlBase class ControlConnectBase : public ControlBase
{ {
public: public:
///
enum DocTypes {
///
LATEX,
///
LITERATE,
///
LINUXDOC,
///
DOCBOOK
};
/// ///
ControlConnectBase(LyXView &, Dialogs &); ControlConnectBase(LyXView &, Dialogs &);
/// The View may need to know if the buffer is read-only. /// The View may need to know if the buffer is read-only.
bool isReadonly() const; bool isReadonly() const;
///
DocTypes docType() const;
protected: protected:
/// True if the dialog depends on the buffer, else false. /// True if the dialog depends on the buffer, else false.

View File

@ -0,0 +1,54 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2001 The LyX Team.
*
* ======================================================
*
* \file ControlRef.C
* \author Angus Leeming <a.leeming@ic.ac.uk>
*/
#include <config.h>
#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<string> 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");
}

View File

@ -0,0 +1,42 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2001 The LyX Team.
*
* ======================================================
*
* \file ControlRef.h
* \author Angus Leeming <a.leeming@ic.ac.uk>
*/
#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<string> const getLabelList() const;
///
void gotoRef(string const &) const;
///
void gotoBookmark() const;
private:
/// not needed.
virtual void clearDaughterParams() {}
};
#endif // CONTROLREF_H

View File

@ -20,7 +20,7 @@
#include "ControlCommand.h" #include "ControlCommand.h"
/** This class provides an XForms implementation of the FormUrl Dialog. /** A controller for the Url Dialog.
*/ */
class ControlUrl : public ControlCommand class ControlUrl : public ControlCommand
{ {

View File

@ -151,6 +151,20 @@ public:
}; };
/** Specialization for Ref dialog
*/
class ControlRef;
template <class GUIview, class GUIbc>
class GUIRef :
public GUI<ControlRef, GUIview, NoRepeatedApplyPolicy, GUIbc> {
public:
///
GUIRef(LyXView & lv, Dialogs & d)
: GUI<ControlRef, GUIview, NoRepeatedApplyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Url dialog /** Specialization for Url dialog
*/ */
class ControlUrl; class ControlUrl;

View File

@ -40,6 +40,8 @@ libcontrollers_la_SOURCES=\
ControlInset.h \ ControlInset.h \
ControlLog.C \ ControlLog.C \
ControlLog.h \ ControlLog.h \
ControlRef.C \
ControlRef.h \
ControlUrl.C \ ControlUrl.C \
ControlUrl.h \ ControlUrl.h \
ControlVCLog.C \ ControlVCLog.C \

View File

@ -1,3 +1,8 @@
2001-03-26 Angus Leeming <a.leeming@ic.ac.uk>
* FormRef.[Ch]:
* forms/form_ref.fd: implemented controller-view split.
2001-03-23 Angus Leeming <a.leeming@ic.ac.uk> 2001-03-23 Angus Leeming <a.leeming@ic.ac.uk>
* FormError.[Ch]: * FormError.[Ch]:

View File

@ -29,6 +29,7 @@
#include "ControlInclude.h" #include "ControlInclude.h"
#include "ControlLog.h" #include "ControlLog.h"
#include "ControlUrl.h" #include "ControlUrl.h"
#include "ControlRef.h"
#include "ControlVCLog.h" #include "ControlVCLog.h"
#include "GUI.h" #include "GUI.h"
@ -43,6 +44,7 @@
#include "form_credits.h" #include "form_credits.h"
#include "form_error.h" #include "form_error.h"
#include "form_include.h" #include "form_include.h"
#include "form_ref.h"
#include "form_url.h" #include "form_url.h"
#include "FormBibitem.h" #include "FormBibitem.h"
@ -54,6 +56,7 @@
#include "FormError.h" #include "FormError.h"
#include "FormInclude.h" #include "FormInclude.h"
#include "FormLog.h" #include "FormLog.h"
#include "FormRef.h"
#include "FormUrl.h" #include "FormUrl.h"
#include "FormVCLog.h" #include "FormVCLog.h"
@ -66,7 +69,6 @@
#include "FormPreamble.h" #include "FormPreamble.h"
#include "FormPreferences.h" #include "FormPreferences.h"
#include "FormPrint.h" #include "FormPrint.h"
#include "FormRef.h"
#include "FormSearch.h" #include "FormSearch.h"
#include "FormSplash.h" #include "FormSplash.h"
#include "FormTabular.h" #include "FormTabular.h"
@ -91,6 +93,7 @@ Dialogs::Dialogs(LyXView * lv)
add(new GUIError<FormError, xformsBC>(*lv, *this)); add(new GUIError<FormError, xformsBC>(*lv, *this));
add(new GUIInclude<FormInclude, xformsBC>(*lv, *this)); add(new GUIInclude<FormInclude, xformsBC>(*lv, *this));
add(new GUILog<FormLog, xformsBC>(*lv, *this)); add(new GUILog<FormLog, xformsBC>(*lv, *this));
add(new GUIRef<FormRef, xformsBC>(*lv, *this));
add(new GUIUrl<FormUrl, xformsBC>(*lv, *this)); add(new GUIUrl<FormUrl, xformsBC>(*lv, *this));
add(new GUIVCLog<FormVCLog, xformsBC>(*lv, *this)); add(new GUIVCLog<FormVCLog, xformsBC>(*lv, *this));
@ -103,7 +106,6 @@ Dialogs::Dialogs(LyXView * lv)
add(new FormPreamble(lv, this)); add(new FormPreamble(lv, this));
add(new FormPreferences(lv, this)); add(new FormPreferences(lv, this));
add(new FormPrint(lv, this)); add(new FormPrint(lv, this));
add(new FormRef(lv, this));
add(new FormSearch(lv, this)); add(new FormSearch(lv, this));
add(new FormSplash(lv, this)); add(new FormSplash(lv, this));
add(new FormTabular(lv, this)); add(new FormTabular(lv, this));

View File

@ -1,65 +1,50 @@
// -*- C++ -*-
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * 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 <config.h> #include <config.h>
#include <algorithm> #include <algorithm>
#include FORMS_H_LOCATION
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #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 "Dialogs.h"
#include "FormRef.h" #include "FormRef.h"
#include "LyXView.h" #include "LyXView.h"
#include "buffer.h" #include "buffer.h"
#include "form_ref.h" #include "form_ref.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "insets/insetref.h" */
#include "xforms_helpers.h"
using std::find; using std::find;
using std::max; using std::max;
using std::sort; using std::sort;
using std::vector; using std::vector;
using SigC::slot;
bool saved_position; typedef FormCB<ControlRef, FormDB<FD_form_ref> > base_class;
FormRef::FormRef(LyXView * lv, Dialogs * d) FormRef::FormRef(ControlRef & c)
: FormCommand(lv, d, _("Reference")), : base_class(c, _("Reference")),
at_ref(false) 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));
}
FL_FORM * FormRef::form() const
{
if (dialog_.get())
return dialog_->form;
return 0;
}
void FormRef::disconnect()
{
refs.clear();
FormCommand::disconnect();
}
void FormRef::build() void FormRef::build()
@ -79,41 +64,40 @@ void FormRef::build()
bc().setCancel(dialog_->button_cancel); bc().setCancel(dialog_->button_cancel);
bc().setUndoAll(dialog_->button_restore); bc().setUndoAll(dialog_->button_restore);
bc().refresh(); 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() void FormRef::update()
{ {
if (inset_) { fl_set_input(dialog_->ref,
fl_set_input(dialog_->ref, params.getContents().c_str()); controller().params().getContents().c_str());
fl_set_input(dialog_->name, params.getOptions().c_str()); fl_set_input(dialog_->name,
fl_set_choice(dialog_->type, controller().params().getOptions().c_str());
InsetRef::getType(params.getCmdName()) + 1); fl_set_choice(dialog_->type,
} InsetRef::getType(controller().params().getCmdName()) + 1);
at_ref = false; at_ref_ = false;
fl_set_object_label(dialog_->button_go, _("Goto reference")); fl_set_object_label(dialog_->button_go, _("Goto reference"));
// Name is irrelevant to LaTeX/Literate documents, while // Name is irrelevant to LaTeX/Literate documents
// type is irrelevant to LinuxDoc/DocBook. if (controller().docType() == ControlRef::LATEX ||
if (lv_->buffer()->isLatex() || lv_->buffer()->isLatex()) { controller().docType() == ControlRef::LITERATE) {
setEnabled(dialog_->name, false); setEnabled(dialog_->name, false);
setEnabled(dialog_->type, true);
} else { } else {
fl_set_choice(dialog_->type, 1);
setEnabled(dialog_->name, true); setEnabled(dialog_->name, true);
setEnabled(dialog_->type, false);
} }
refs = lv_->buffer()->getLabelList(); // type is irrelevant to LinuxDoc/DocBook.
updateBrowser(refs); 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<string> const & akeys) const
fl_clear_browser(dialog_->browser); fl_clear_browser(dialog_->browser);
for (vector<string>::const_iterator it = keys.begin(); for (vector<string>::const_iterator it = keys.begin();
it != keys.end(); ++it) 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()) { if (keys.empty()) {
fl_add_browser_line(dialog_->browser, fl_add_browser_line(dialog_->browser,
@ -145,9 +129,9 @@ void FormRef::updateBrowser(vector<string> const & akeys) const
find(keys.begin(), keys.end(), ref); find(keys.begin(), keys.end(), ref);
if (cit == keys.end()) { if (cit == keys.end()) {
cit = keys.begin(); cit = keys.begin();
fl_set_input(dialog_->ref, (*cit).c_str()); fl_set_input(dialog_->ref, cit->c_str());
} else if (ref.empty()) } 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<int>(cit - keys.begin()); int const i = static_cast<int>(cit - keys.begin());
fl_set_browser_topline(dialog_->browser, max(i-5, 1)); fl_set_browser_topline(dialog_->browser, max(i-5, 1));
@ -158,101 +142,72 @@ void FormRef::updateBrowser(vector<string> const & akeys) const
void FormRef::apply() void FormRef::apply()
{ {
if (!lv_->view()->available())
return;
int const type = fl_get_choice(dialog_->type) - 1; int const type = fl_get_choice(dialog_->type) - 1;
params.setCmdName(InsetRef::getName(type)); controller().params().setCmdName(InsetRef::getName(type));
params.setOptions(fl_get_input(dialog_->name)); controller().params().setOptions(fl_get_input(dialog_->name));
params.setContents(fl_get_input(dialog_->ref)); controller().params().setContents(fl_get_input(dialog_->ref));
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());
}
} }
bool FormRef::input(FL_OBJECT *, long data) ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long)
{ {
bool activate(true); ButtonPolicy::SMInput activate(ButtonPolicy::SMI_VALID);
switch (data) {
// goto reference / go back if (ob == dialog_->button_go) {
case 1: // goto reference / go back
{
// No change to data // No change to data
activate = false; activate = ButtonPolicy::SMI_NOOP;
at_ref = !at_ref; at_ref_ = !at_ref_;
if (at_ref) { if (at_ref_) {
lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_SAVE, "0"); controller().gotoRef(fl_get_input(dialog_->ref));
lv_->getLyXFunc()->
Dispatch(LFUN_REF_GOTO,
fl_get_input(dialog_->ref));
fl_set_object_label(dialog_->button_go, _("Go back")); fl_set_object_label(dialog_->button_go, _("Go back"));
} else { } else {
lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_GOTO, "0"); controller().gotoBookmark();
fl_set_object_label(dialog_->button_go, fl_set_object_label(dialog_->button_go,
_("Goto reference")); _("Goto reference"));
} }
}
break;
// choose browser key } else if (ob == dialog_->browser) {
case 2:
{
unsigned int sel = fl_get_browser(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); string s = fl_get_browser_line(dialog_->browser, sel);
fl_set_input(dialog_->ref, s.c_str()); fl_set_input(dialog_->ref, s.c_str());
} }
if (at_ref) if (at_ref_)
lv_->getLyXFunc()->Dispatch(LFUN_BOOKMARK_GOTO, "0"); controller().gotoBookmark();
at_ref = false; at_ref_ = false;
fl_set_object_label(dialog_->button_go, _("Goto reference")); fl_set_object_label(dialog_->button_go, _("Goto reference"));
setEnabled(dialog_->type, true); setEnabled(dialog_->type, true);
setEnabled(dialog_->button_go, true); setEnabled(dialog_->button_go, true);
fl_set_object_lcol(dialog_->ref, FL_BLACK); fl_set_object_lcol(dialog_->ref, FL_BLACK);
}
break;
// update or sort } else if (ob == dialog_->button_update ||
case 3: ob == dialog_->sort) {
refs = lv_->buffer()->getLabelList();
if (ob == dialog_->button_update)
refs_ = controller().getLabelList();
// fall through to...
case 4:
fl_freeze_form(form()); fl_freeze_form(form());
updateBrowser(refs); updateBrowser(refs_);
fl_unfreeze_form(form()); fl_unfreeze_form(form());
break;
// changed reference type } else if (ob == dialog_->type) {
case 5:
{
int const type = fl_get_choice(dialog_->type) - 1; int const type = fl_get_choice(dialog_->type) - 1;
if (params.getCmdName() == InsetRef::getName(type) && inset_) { if (controller().params().getCmdName() ==
activate = false; InsetRef::getName(type)) {
activate = ButtonPolicy::SMI_NOOP;
} }
} }
break;
default:
break;
}
return activate; return activate;
} }

View File

@ -1,70 +1,54 @@
// -*- C++ -*-
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * 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 #ifndef FORMREF_H
#define FORMREF_H #define FORMREF_H
#include <boost/smart_ptr.hpp>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
#include "FormInset.h" #include "FormBase.h"
class ControlRef;
struct FD_form_ref; struct FD_form_ref;
/** This class provides an XForms implementation of the FormRef Dialog. /** This class provides an XForms implementation of the FormRef Dialog.
*/ */
class FormRef : public FormCommand { class FormRef : public FormCB<ControlRef, FormDB<FD_form_ref> > {
public: public:
/// ///
FormRef(LyXView *, Dialogs *); FormRef(ControlRef &);
private:
/// Pointer to the actual instantiation of the ButtonController.
virtual xformsBC & bc();
/// Disconnect signals. Also perform any necessary housekeeping.
virtual void disconnect();
private:
/// Set the Params variable for the Controller.
virtual void apply();
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();
/// Filter the input /// Filter the inputs on callback from xforms
virtual bool input(FL_OBJECT *, long); virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
/// Update dialog before showing it /// Update dialog before showing it
virtual void update(); 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<string> const &) const; void updateBrowser(std::vector<string> const &) const;
/// /// Type definition from the fdesign produced header file.
FD_form_ref * build_ref(); FD_form_ref * build_ref();
/// ///
bool at_ref; bool at_ref_;
/// ///
std::vector<string> refs; std::vector<string> refs_;
/// Real GUI implementation.
boost::scoped_ptr<FD_form_ref> dialog_;
/// The ButtonController
ButtonController<NoRepeatedApplyPolicy, xformsBC> bc_;
}; };
#endif // FORMREF_H
inline
xformsBC & FormRef::bc()
{
return bc_;
}
#endif

View File

@ -1,5 +1,4 @@
/* \file FormUrl.C /* This file is part of
* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
@ -8,6 +7,7 @@
* *
* ====================================================== * ======================================================
* *
* \file FormUrl.C
* \author Angus Leeming, a.leeming@ic.ac.uk * \author Angus Leeming, a.leeming@ic.ac.uk
*/ */

View File

@ -1,5 +1,4 @@
/* \file FormUrl.h /* This file is part of
* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
@ -8,6 +7,7 @@
* *
* ====================================================== * ======================================================
* *
* \file FormUrl.h
* \author Angus Leeming, a.leeming@.ac.uk * \author Angus Leeming, a.leeming@.ac.uk
*/ */

View File

@ -28,14 +28,14 @@ FD_form_ref * FormRef::build_ref()
fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 270, 240, ""); fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 270, 240, "");
fl_set_object_lalign(obj, FL_ALIGN_TOP); fl_set_object_lalign(obj, FL_ALIGN_TOP);
fl_set_object_gravity(obj, FL_NorthWest, FL_South); 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"); char const * const dummy = N_("Update|#U");
fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 40, 260, 90, 30, idex(_(dummy))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); 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"); char const * const dummy = N_("Sort|#S");
fdui->sort = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 170, 260, 30, 30, idex(_(dummy))); 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_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); 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"); char const * const dummy = N_("Name:|#N");
fdui->name = obj = fl_add_input(FL_NORMAL_INPUT, 370, 10, 150, 40, idex(_(dummy))); 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_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lalign(obj, FL_ALIGN_TOP); fl_set_object_lalign(obj, FL_ALIGN_TOP);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); 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"); char const * const dummy = N_("Goto reference|#G");
fdui->button_go = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 200, 140, 40, idex(_(dummy))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); 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")); 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_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|^["); char const * const dummy = N_("Cancel|^[");
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 430, 300, 90, 30, idex(_(dummy))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); 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"); char const * const dummy = N_("Apply|#A");
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 300, 90, 30, idex(_(dummy))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); 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"); char const * const dummy = N_("Restore|#R");
fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 300, 90, 30, idex(_(dummy))); 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_button_shortcut(obj, scex(_(dummy)), 1);
} }
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); 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(); fl_end_form();
fdui->form->fdui = fdui; fdui->form->fdui = fdui;

View File

@ -5,11 +5,11 @@
#define FD_form_ref_h_ #define FD_form_ref_h_
/** Callbacks, globals and object handlers **/ /** Callbacks, globals and object handlers **/
extern "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT *, long); extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
extern "C" void C_FormBaseDeprecatedOKCB(FL_OBJECT *, long); extern "C" void C_FormBaseOKCB(FL_OBJECT *, long);
extern "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT *, long); extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
extern "C" void C_FormBaseDeprecatedApplyCB(FL_OBJECT *, long); extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long);
extern "C" void C_FormBaseDeprecatedRestoreCB(FL_OBJECT *, long); extern "C" void C_FormBaseRestoreCB(FL_OBJECT *, long);
/**** Forms and Objects ****/ /**** Forms and Objects ****/

View File

@ -45,8 +45,8 @@ shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NorthWest FL_South gravity: FL_NorthWest FL_South
name: browser name: browser
callback: C_FormBaseDeprecatedInputCB callback: C_FormBaseInputCB
argument: 2 argument:
-------------------- --------------------
class: FL_BUTTON class: FL_BUTTON
@ -63,8 +63,8 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthWest FL_SouthWest gravity: FL_SouthWest FL_SouthWest
name: button_update name: button_update
callback: C_FormBaseDeprecatedInputCB callback: C_FormBaseInputCB
argument: 3 argument:
-------------------- --------------------
class: FL_CHECKBUTTON class: FL_CHECKBUTTON
@ -81,8 +81,8 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthWest FL_SouthWest gravity: FL_SouthWest FL_SouthWest
name: sort name: sort
callback: C_FormBaseDeprecatedInputCB callback: C_FormBaseInputCB
argument: 4 argument:
-------------------- --------------------
class: FL_INPUT class: FL_INPUT
@ -135,8 +135,8 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: type name: type
callback: C_FormBaseDeprecatedInputCB callback: C_FormBaseInputCB
argument: 5 argument:
-------------------- --------------------
class: FL_BUTTON class: FL_BUTTON
@ -153,8 +153,8 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: button_go name: button_go
callback: C_FormBaseDeprecatedInputCB callback: C_FormBaseInputCB
argument: 1 argument:
-------------------- --------------------
class: FL_BUTTON class: FL_BUTTON
@ -171,8 +171,8 @@ shortcut: ^M
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: button_ok name: button_ok
callback: C_FormBaseDeprecatedOKCB callback: C_FormBaseOKCB
argument: 0 argument:
-------------------- --------------------
class: FL_BUTTON class: FL_BUTTON
@ -189,8 +189,8 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: button_cancel name: button_cancel
callback: C_FormBaseDeprecatedCancelCB callback: C_FormBaseCancelCB
argument: 0 argument:
-------------------- --------------------
class: FL_BUTTON class: FL_BUTTON
@ -207,8 +207,8 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: button_apply name: button_apply
callback: C_FormBaseDeprecatedApplyCB callback: C_FormBaseApplyCB
argument: 0 argument:
-------------------- --------------------
class: FL_BUTTON class: FL_BUTTON
@ -225,8 +225,8 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: button_restore name: button_restore
callback: C_FormBaseDeprecatedRestoreCB callback: C_FormBaseRestoreCB
argument: 0 argument:
============================== ==============================
create_the_forms create_the_forms