mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
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:
parent
24cc3e5be3
commit
3b380bf220
@ -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>
|
||||
|
||||
* 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>
|
||||
|
||||
* 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>
|
||||
|
||||
|
@ -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)
|
||||
{}
|
||||
|
@ -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.
|
||||
|
54
src/frontends/controllers/ControlRef.C
Normal file
54
src/frontends/controllers/ControlRef.C
Normal 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");
|
||||
}
|
||||
|
42
src/frontends/controllers/ControlRef.h
Normal file
42
src/frontends/controllers/ControlRef.h
Normal 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
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
*/
|
||||
class ControlUrl;
|
||||
|
@ -40,6 +40,8 @@ libcontrollers_la_SOURCES=\
|
||||
ControlInset.h \
|
||||
ControlLog.C \
|
||||
ControlLog.h \
|
||||
ControlRef.C \
|
||||
ControlRef.h \
|
||||
ControlUrl.C \
|
||||
ControlUrl.h \
|
||||
ControlVCLog.C \
|
||||
|
@ -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>
|
||||
|
||||
* FormError.[Ch]:
|
||||
|
@ -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<FormError, xformsBC>(*lv, *this));
|
||||
add(new GUIInclude<FormInclude, 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 GUIVCLog<FormVCLog, xformsBC>(*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));
|
||||
|
@ -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 <config.h>
|
||||
|
||||
#include <algorithm>
|
||||
#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;
|
||||
typedef FormCB<ControlRef, FormDB<FD_form_ref> > base_class;
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
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;
|
||||
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<string> const & akeys) const
|
||||
fl_clear_browser(dialog_->browser);
|
||||
for (vector<string>::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<string> 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<int>(cit - keys.begin());
|
||||
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()
|
||||
{
|
||||
if (!lv_->view()->available())
|
||||
return;
|
||||
|
||||
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));
|
||||
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());
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 <boost/smart_ptr.hpp>
|
||||
|
||||
#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<ControlRef, FormDB<FD_form_ref> > {
|
||||
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<string> const &) const;
|
||||
///
|
||||
/// Type definition from the fdesign produced header file.
|
||||
FD_form_ref * build_ref();
|
||||
|
||||
///
|
||||
bool at_ref;
|
||||
bool at_ref_;
|
||||
///
|
||||
std::vector<string> refs;
|
||||
|
||||
/// Real GUI implementation.
|
||||
boost::scoped_ptr<FD_form_ref> dialog_;
|
||||
/// The ButtonController
|
||||
ButtonController<NoRepeatedApplyPolicy, xformsBC> bc_;
|
||||
std::vector<string> refs_;
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
xformsBC & FormRef::bc()
|
||||
{
|
||||
return bc_;
|
||||
}
|
||||
#endif
|
||||
#endif // FORMREF_H
|
||||
|
@ -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
|
||||
*/
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 ****/
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user