* lots of files. Moved protected stuff into private where possible.
* ControlError.[Ch]:
- * ControlInclude.[Ch]: new files; controllers for the LaTeX error and
- Include popups, respectively.
+ * ControlInclude.[Ch]:
+ * ControlUrl.[Ch]: new files; controllers for the LaTeX error,
+ Include and Url popups, respectively.
* GUI.h:
* Makefile.am: associated changes.
-// -*- C++ -*-
/* This file is part of
* ======================================================
*
-// -*- C++ -*-
/* This file is part of
* ======================================================
*
void ControlCommand::applyParamsNoInset()
{
+ std::cerr << "1" << std::endl;
if (action_ == LFUN_NOACTION) return;
+ std::cerr << "2" << std::endl;
+
lv_.getLyXFunc()->Dispatch(action_, params().getAsString());
+ std::cerr << "3" << std::endl;
}
void show(Params const &);
/// Connect signals
void connectInset(Inset * = 0);
- /// Disconnect signals
- virtual void disconnect();
- ///
- void disconnectInset();
/// pointer to the inset passed through connectInset
Inset * inset_;
delete params_;
params_ = 0;
}
+ inset_ = 0;
clearDaughterParams();
+ ih_.disconnect();
disconnect();
view().hide();
}
view().apply();
- if (inset_ && params() != getParams(*inset_))
- applyParamsToInset();
- else if (!inset_)
+ if (inset_) {
+ if (params() != getParams(*inset_)) applyParamsToInset();
+ } else
applyParamsNoInset();
}
}
-template <class Inset, class Params>
-void ControlInset<Inset, Params>::disconnect()
-{
- inset_ = 0;
- ih_.disconnect();
- ControlConnectBD::disconnect();
-}
-
-
template <class Inset, class Params>
void ControlInset<Inset, Params>::connectInset(Inset * inset)
{
}
connect();
}
-
-
-template <class Inset, class Params>
-void ControlInset<Inset, Params>::disconnectInset()
-{
- ih_.disconnect();
-}
-
-
#endif // CONTROLINSET_H
--- /dev/null
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 2001 The LyX Team.
+ *
+ * ======================================================
+ *
+ * \file ControlUrl.C
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "Dialogs.h"
+#include "ControlUrl.h"
+#include "Dialogs.h"
+#include "LyXView.h"
+#include "buffer.h"
+
+#include "lyxfunc.h"
+
+using SigC::slot;
+
+ControlUrl::ControlUrl(LyXView & lv, Dialogs & d)
+ : ControlCommand(lv, d, LFUN_INSERT_URL)
+{
+ d_.showUrl.connect(slot(this, &ControlUrl::showInset));
+ d_.createUrl.connect(slot(this, &ControlUrl::createInset));
+}
--- /dev/null
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 2001 The LyX Team.
+ *
+ * ======================================================
+ *
+ * \file ControlUrl.h
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
+ */
+
+#ifndef CONTROLURL_H
+#define CONTROLURL_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "ControlCommand.h"
+
+/** This class provides an XForms implementation of the FormUrl Dialog.
+ */
+class ControlUrl : public ControlCommand
+{
+public:
+ ///
+ ControlUrl(LyXView &, Dialogs &);
+
+private:
+ /// not needed.
+ virtual void clearDaughterParams() {}
+};
+
+#endif // CONTROLURL_H
};
+/** Specialization for Url dialog
+ */
+class ControlUrl;
+
+template <class GUIview, class GUIbc>
+class GUIUrl :
+ public GUI<ControlUrl, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc> {
+public:
+ ///
+ GUIUrl(LyXView & lv, Dialogs & d)
+ : GUI<ControlUrl, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
+};
+
+
/** Specialization for VCLog dialog
*/
class ControlVCLog;
ControlInset.h \
ControlLog.C \
ControlLog.h \
+ ControlUrl.C \
+ ControlUrl.h \
ControlVCLog.C \
ControlVCLog.h \
GUI.h \
* FormError.[Ch]:
* form_error.fd:
* FormInclude.[Ch]:
- * form_include.fd: implemented controller-view split.
+ * form_include.fd:
+ * FormUrl.[Ch]:
+ * form_url.fd: implemented controller-view split.
* Dialogs.C: associated changes.
#include "ControlError.h"
#include "ControlInclude.h"
#include "ControlLog.h"
+#include "ControlUrl.h"
#include "ControlVCLog.h"
#include "GUI.h"
#include "form_credits.h"
#include "form_error.h"
#include "form_include.h"
+#include "form_url.h"
#include "FormBibitem.h"
#include "FormBibtex.h"
#include "FormError.h"
#include "FormInclude.h"
#include "FormLog.h"
+#include "FormUrl.h"
#include "FormVCLog.h"
#include "FormDocument.h"
#include "FormTabular.h"
#include "FormTabularCreate.h"
#include "FormToc.h"
-#include "FormUrl.h"
#include "FormMinipage.h"
// Signal enabling all visible popups to be redrawn if so desired.
add(new GUIError<FormError, xformsBC>(*lv, *this));
add(new GUIInclude<FormInclude, xformsBC>(*lv, *this));
add(new GUILog<FormLog, xformsBC>(*lv, *this));
+ add(new GUIUrl<FormUrl, xformsBC>(*lv, *this));
add(new GUIVCLog<FormVCLog, xformsBC>(*lv, *this));
add(new FormDocument(lv, this));
add(new FormTabular(lv, this));
add(new FormTabularCreate(lv, this));
add(new FormToc(lv, this));
- add(new FormUrl(lv, this));
add(new FormMinipage(lv, this));
// reduce the number of connections needed in
* Copyright 2001 the LyX Team
* Read the file COPYING
*
- * \author Angus Leeming
- * \author John Levon
+ * \author Angus Leeming, a.leeming@ic.ac.uk
+ * \author John Levon, moz@compsoc.man.ac.uk
*/
#ifdef __GNUG__
-// -*- C++ -*-
/**
* \file FormBibitem.h
* Copyright 2001 the LyX Team
-// -*- C++ -*-
-/* This file is part of
+/* \file FormUrl.C
+ * This file is part of
* ======================================================
*
* LyX, The Document Processor
*
- * Copyright 2000 The LyX Team.
+ * Copyright 2000-2001 The LyX Team.
*
* ======================================================
+ *
+ * \author Angus Leeming, a.leeming@ic.ac.uk
*/
#include <config.h>
-#include FORMS_H_LOCATION
-
#ifdef __GNUG__
#pragma implementation
#endif
-#include "Dialogs.h"
+#include "xformsBC.h"
+#include "ControlUrl.h"
#include "FormUrl.h"
-#include "LyXView.h"
-#include "buffer.h"
#include "form_url.h"
-#include "lyxfunc.h"
-
-using SigC::slot;
-
-FormUrl::FormUrl(LyXView * lv, Dialogs * d)
- : FormCommand(lv, d, _("Url"))
-{
- // let the dialog be shown
- // These are permanent connections so we won't bother
- // storing a copy because we won't be disconnecting.
- d->showUrl.connect(slot(this, &FormUrl::showInset));
- d->createUrl.connect(slot(this, &FormUrl::createInset));
-}
-
-FL_FORM * FormUrl::form() const
-{
- if (dialog_.get()) return dialog_->form;
- return 0;
-}
+typedef FormCB<ControlUrl, FormDB<FD_form_url> > base_class;
+FormUrl::FormUrl(ControlUrl & c)
+ : base_class(c, _("Url"))
+{}
-void FormUrl::connect()
-{
- fl_set_form_maxsize(form(), 2 * minw_, minh_);
- FormCommand::connect();
-}
-
void FormUrl::build()
{
void FormUrl::update()
{
- fl_set_input(dialog_->url, params.getContents().c_str());
- fl_set_input(dialog_->name, params.getOptions().c_str());
+ fl_set_input(dialog_->url,
+ controller().params().getContents().c_str());
+ fl_set_input(dialog_->name,
+ controller().params().getOptions().c_str());
- if (params.getCmdName() == "url")
+ if (controller().params().getCmdName() == "url")
fl_set_button(dialog_->radio_html, 0);
else
fl_set_button(dialog_->radio_html, 1);
-
- bc().readOnly(lv_->buffer()->isReadonly());
}
void FormUrl::apply()
{
- if (lv_->buffer()->isReadonly()) return;
-
- params.setContents(fl_get_input(dialog_->url));
- params.setOptions(fl_get_input(dialog_->name));
+ controller().params().setContents(fl_get_input(dialog_->url));
+ controller().params().setOptions(fl_get_input(dialog_->name));
if (fl_get_button(dialog_->radio_html))
- params.setCmdName("htmlurl");
+ controller().params().setCmdName("htmlurl");
else
- params.setCmdName("url");
-
- 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_INSERT_URL,
- params.getAsString());
- }
+ controller().params().setCmdName("url");
}
-// -*- C++ -*-
-/* This file is part of
+/* \file FormUrl.h
+ * This file is part of
* ======================================================
*
* LyX, The Document Processor
*
- * Copyright 2000 The LyX Team.
+ * Copyright 2000-2001 The LyX Team.
*
* ======================================================
+ *
+ * \author Angus Leeming, a.leeming@.ac.uk
*/
#ifndef FORMURL_H
#define FORMURL_H
-#include <boost/smart_ptr.hpp>
-
#ifdef __GNUG__
#pragma interface
#endif
-#include "FormInset.h"
+#include "FormBase.h"
+class ControlUrl;
struct FD_form_url;
-/** This class provides an XForms implementation of the FormUrl Dialog.
+/** This class provides an XForms implementation of the Url Dialog.
*/
-class FormUrl : public FormCommand {
+class FormUrl : public FormCB<ControlUrl, FormDB<FD_form_url> > {
public:
///
- FormUrl(LyXView *, Dialogs *);
+ FormUrl(ControlUrl &);
+
private:
- /// Pointer to the actual instantiation of the ButtonController.
- virtual xformsBC & bc();
- /// Connect signals etc. Set form's max size.
- virtual void connect();
+ /// Apply from dialog (modify or create inset)
+ virtual void apply();
/// Build the dialog
virtual void build();
/// Update dialog before showing it
virtual void update();
- /// Apply from dialog (modify or create inset)
- virtual void apply();
- /// Pointer to the actual instantiation of the xforms form
- virtual FL_FORM * form() const;
- ///
+ /// Filter the inputs on callback from xforms
FD_form_url * build_url();
- /// Real GUI implementation.
- boost::scoped_ptr<FD_form_url> dialog_;
- /// The ButtonController
- ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC> bc_;
};
-
-inline
-xformsBC & FormUrl::bc()
-{
- return bc_;
-}
-#endif
+#endif // FORMURL_H
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("Name|#N");
fdui->name = obj = fl_add_input(FL_NORMAL_INPUT, 70, 90, 440, 30, idex(_(dummy)));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("HTML type|#H");
fdui->radio_html = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 480, 10, 30, 30, idex(_(dummy)));
fl_set_object_lalign(obj, FL_ALIGN_LEFT);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("Cancel|^[");
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 410, 130, 100, 30, idex(_(dummy)));
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
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);
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 190, 130, 100, 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_("Apply|#A");
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 300, 130, 100, 30, idex(_(dummy)));
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
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, 130, 100, 30, idex(_(dummy)));
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
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;
#define FD_form_url_h_
/** Callbacks, globals and object handlers **/
-extern "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT *, long);
-extern "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT *, long);
-extern "C" void C_FormBaseDeprecatedOKCB(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_FormBaseCancelCB(FL_OBJECT *, long);
+extern "C" void C_FormBaseOKCB(FL_OBJECT *, long);
+extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long);
+extern "C" void C_FormBaseRestoreCB(FL_OBJECT *, long);
/**** Forms and Objects ****/
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
name: url
-callback: C_FormBaseDeprecatedInputCB
+callback: C_FormBaseInputCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
name: name
-callback: C_FormBaseDeprecatedInputCB
+callback: C_FormBaseInputCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
name: radio_html
-callback: C_FormBaseDeprecatedInputCB
+callback: C_FormBaseInputCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_cancel
-callback: C_FormBaseDeprecatedCancelCB
+callback: C_FormBaseCancelCB
argument: 0
--------------------
resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast
name: button_ok
-callback: C_FormBaseDeprecatedOKCB
+callback: C_FormBaseOKCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_apply
-callback: C_FormBaseDeprecatedApplyCB
+callback: C_FormBaseApplyCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_restore
-callback: C_FormBaseDeprecatedRestoreCB
+callback: C_FormBaseRestoreCB
argument: 0
==============================