+2000-10-12 Dekel Tsur <dekelts@tau.ac.il>
+
+ * src/encoding.C (read): Fixed bug that caused an error message at
+ the end of the file.
+
+ * po/Makefile.in.in: Fixed rule for ext_l10n.h
+
+ * lib/lyxrc.example: Fixed hebrew example.
+
+2000-10-13 Allan Rae <rae@lyx.org>
+
+ * src/frontends/xforms/FormPreferences.C (input): reworking the checking
+ (build, update, apply): New inputs in various tabfolders
+
+ * src/frontends/xforms/FormToc.C: use new button policy.
+ * src/frontends/ButtonPolicies.h (class IgnorantPolicy): for dialogs that
+ either can't use any existing policy or where it just doesn't care.
+
+ * src/frontends/xforms/FormTabular.h: removed copyright notice that
+ said it was mine.
+
+ * src/lyx_gui_misc.[Ch] (updateAllVisibleBufferRelatedDialogs): added a
+ bool parameter which is ignored.
+
+ * src/buffer.C (setReadonly):
+ * src/BufferView_pimpl.C (buffer):
+ * src/frontends/kde/FormCopyright.h (update):
+ * src/frontends/kde/FormCitation.[Ch] (update):
+ * src/frontends/kde/FormIndex.[Ch] (update):
+ * src/frontends/kde/FormPrint.[Ch] (update):
+ * src/frontends/kde/FormRef.[Ch] (update):
+ * src/frontends/kde/FormToc.[Ch] (update):
+ * src/frontends/kde/FormUrl.[Ch] (update):
+ * src/frontends/gnome/FormCopyright.h (update):
+ * src/frontends/gnome/FormCitation.[Ch] (update):
+ * src/frontends/gnome/FormError.[Ch] (update):
+ * src/frontends/gnome/FormIndex.[Ch] (update):
+ * src/frontends/gnome/FormPrint.[Ch] (update):
+ * src/frontends/gnome/FormRef.h (update):
+ * src/frontends/gnome/FormToc.[Ch] (update):
+ * src/frontends/gnome/FormUrl.[Ch] (update):
+ * src/frontends/xforms/FormGraphics.[Ch] (update): reflect new changes
+ to updateBufferDependent and DialogBase
+
+ * src/frontends/xforms/FormCitation.[hC]:
+ * src/frontends/xforms/FormDocument.[hC]: also removed restore()
+ * src/frontends/xforms/FormError.[Ch]:
+ * src/frontends/xforms/FormGraphics.[Ch]:
+ * src/frontends/xforms/FormIndex.[Ch]:
+ * src/frontends/xforms/FormParagraph.[Ch]: also added missing "virtual"s
+ and fixed readOnly handling.
+ * src/frontends/xforms/FormPrint.[Ch]:
+ * src/frontends/xforms/FormRef.[Ch]:
+ * src/frontends/xforms/FormTabular.[Ch]:
+ * src/frontends/xforms/FormToc.[Ch]:
+ * src/frontends/xforms/FormUrl.[Ch]:
+ * src/frontends/xforms/FormInset.[Ch]:
+ * src/frontends/xforms/FormBase.[hC]: modifications to use the new
+ form of updateBufferDependent.
+
+ * src/frontends/xforms/FormBase.C (hide): only call disconnect()
+ if form()->visible just in case someone does stuff to the form in a
+ derived class.
+
+ * src/frontends/DialogBase.h (enum): removed enum since we can now use
+ the buttoncontroller for everything the enum used to be used for.
+ (update) It would seem we need to force all dialogs to use a bool
+ parameter or have two update functions. I chose to go with one.
+ I did try removing update() from here and FormBase and defining the
+ appropriate update signatures in FormBaseB[DI] but then ran into the
+ problem of the update() call in FormBase::show(). Whatever I did to get
+ around that would require another function and that just got more
+ confusing. Hence the decision to make everyone have an update(bool).
+ An alternative might have been to override show() in FormBaseB[DI] and
+ that would allow the different and appropriate update signatures.
+
+ * src/frontends/Dialogs.h (updateBufferDependent): now takes a bool.
+ true == buffer change occurred. I decided against using a default
+ template parameter since not all compilers support that at present.
+
+2000-10-11 Angus Leeming <a.leeming@ic.ac.uk>
+
+ * src/frontends/xforms/FormBase.[Ch] (FormBase) : made less of a "swiss
+ army knife" by removing functionality.
+ (clearStore): removed. All such housekeeping on hide()ing the dialog
+ is to be carried out by overloaded disconnect() methods.
+ (dialogIsOpen): removed. Relevant only to Inset dialogs anyway, but
+ superceded by Baruch's neat test (FormGraphics) to update an existing
+ dialog if a new signal is recieved rather than block all new signals
+ until it is closed.
+ (cba_, parent_, updateOrHide): removed to new FormInset class. Relevant
+ only to Inset dialogs.
+ (FormBaseBI, FormBaseBD): new classes derived from FormBase for
+ "Buffer Independent" and "Buffer Dependent" dialogs respectively.
+
+ * src/frontends/xforms/FormCommand.[Ch]: renamed as FormInset.[Ch]
+
+ * src/frontends/xforms/FormInset.[Ch] (FormInset): New class, defined
+ as a base class to all inset dialogs. Used solely to connect/disconnect
+ the Inset::hide signal and to define what action to take on receipt of
+ a UpdateBufferDependent signal.
+ (FormCommand): now derived from FormInset.
+
+ * src/frontends/xforms/FormCitation.[Ch] (clearStore): reworked as
+ disconnect().
+
+ * src/frontends/xforms/FormCopyright.[Ch]:
+ * src/frontends/xforms/FormPreferences.[Ch]:
+ now derived from FormBaseBI.
+
+ * src/frontends/xforms/FormDocument.[Ch]:
+ * src/frontends/xforms/FormParagraph.[Ch]:
+ * src/frontends/xforms/FormPrint.[Ch]:
+ now derived from FormBaseBD.
+
+ * src/frontends/xforms/FormError.[Ch]: now derived from FormInset.
+
+ * src/frontends/xforms/FormCitation.[Ch]:
+ * src/frontends/xforms/FormError.[Ch]:
+ * src/frontends/xforms/FormRef.[Ch]:
+ * src/frontends/xforms/FormToc.[Ch]:
+ (clearStore): reworked as disconnect().
+
+ * src/frontends/xforms/Makefile.am: removed FormCommand.[Ch], adding
+ FormInset.[Ch].
+
2000-10-12 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/converter.C (runLaTeX): constify buffer argument
#\kbmap true
#\kbmap_primary null
#\kbmap_secondary hebrew
-#\converter tex dvi elatex
-#\converter tex pdf pdfelatex
+#\converter tex dvi elatex ""
+#\converter tex pdf pdfelatex ""
#\font_encoding default
# You also need to bind a key for switching between Hebrew and English.
fi
cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
-$(top_srcdir)/src/ext_l10n.h: $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc $(top_srcdir)/lib/ui/default.ui
+$(top_srcdir)/src/ext_l10n.h: $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc $(top_srcdir)/lib/ui/default.ui $(top_srcdir)/lib/languages
grep -i -E "submenu|item|optitem" < $(top_srcdir)/lib/ui/default.ui | cut -d '"' -f 2 | \
awk '{printf "_(\"%s\");\n", $$0}' > $@
cat $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc | grep -i -E "[ ]*style .+$$" | \
cut -d ' ' -f 2 | sort | uniq | awk '{printf "_(\"%s\");\n", $$0}' >> $@
- awk -F '"' '$2 {printf "_(\"%s\");\n", $2}' < $(top_srcdir)/lib/languages >> $@
+ awk -F '"' '$$2 {printf "_(\"%s\");\n", $$2}' < $(top_srcdir)/lib/languages >> $@
install: install-exec install-data
install-exec:
src/frontends/xforms/form_graphics.C
src/frontends/xforms/FormIndex.C
src/frontends/xforms/form_index.C
+src/frontends/xforms/FormInset.h
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/form_paragraph.C
src/frontends/xforms/FormPreferences.C
// Similarly, buffer-dependent dialogs should be updated or
// hidden. This should go here because some dialogs (eg ToC)
// require bv_->text.
- owner_->getDialogs()->updateBufferDependent();
+ owner_->getDialogs()->updateBufferDependent(true);
redraw();
bv_->insetWakeup();
} else {
if (read_only != flag) {
read_only = flag;
updateTitles();
- users->owner()->getDialogs()->updateBufferDependent();
+ users->owner()->getDialogs()->updateBufferDependent(false);
}
if (read_only) {
WarnReadonly(filename);
case et_end:
lex.printError("Encodings::read: Misplaced end");
break;
+ case LyXLex::LEX_FEOF:
+ break;
default:
lex.printError("Encodings::read: "
"Unknown tag: `$$Token'");
NoRepeatedApply | N | Y | N
NoRepeatedApplyReadOnly | Y | Y | N
Preferences | N | Y | No (Ok-Close)
+ Ignorant | N/A | N/A | N/A
========================================================================
Policy
has its own special version of repeated apply handling because its Ok
button is actually a Save button -- its always reasonable to Save the
preferences if the dialog has changed since the last save.
+
+ The IgnorantPolicy is a special case that allows anything.
*/
class ButtonPolicy : public noncopyable {
public:
StateMachine state_machine_;
};
+
+/** Defines the policy used by dialogs that are forced to support a button
+ controller when they either don't have a use for one or are not ready to
+ use one. This may be useful when testing a new button policy but wishing
+ to minimise problems to users by supplying an anything-goes policy via a
+ preprocessor directive.
+ */
+class IgnorantPolicy : public ButtonPolicy {
+public:
+ virtual ~IgnorantPolicy() {}
+
+ /// Trigger a transition with this input.
+ virtual void input(SMInput) {}
+ /// Activation status of a button.
+ virtual bool buttonStatus(Button) const {
+ return true;
+ }
+ /// Are we in a read-only state?
+ virtual bool isReadOnly() const {
+ return false;
+ }
+};
+
#endif
virtual void show() = 0;
///
virtual void hide() = 0;
- ///
- virtual void update() = 0;
+ /// Parameter defines if a buffer switch occurred
+ virtual void update(bool = false) = 0;
//@}
-
- ///
- enum EnumDialogStatus {
- ///
- DIALOG_UNMODIFIED,
- ///
- DIALOG_MODIFIED,
- ///
- DIALOG_READONLY
- };
};
#endif // DIALOGBASE_H
/// Hide all visible popups
Signal0<void> hideAll;
- /// Hide any popups that require a buffer for them to operate
+ /// Hide any dialogs that require a buffer for them to operate
Signal0<void> hideBufferDependent;
- /// Update visible, buffer-dependent popups
- Signal0<void> updateBufferDependent;
+ /** Update visible, buffer-dependent dialogs
+ If the bool is true then a buffer change has occurred
+ else its still the same buffer.
+ */
+ Signal1<void, bool> updateBufferDependent;
//@}
/**@name Dialog Access Signals.
inset_ = inset;
ih_ = inset_->hide.connect(slot(this, &FormCitation::hide));
+#ifdef WITH_WARNINGS
+#warning This connection to update will do nothing!
+#endif
u_ = d_->updateBufferDependent.connect(slot(this, &FormCitation::update));
h_ = d_->hideBufferDependent.connect(slot(this, &FormCitation::hide));
void showInset( InsetCommand * const );
/// The following three methods do nothing in this implementation
- virtual void update() { }
+ virtual void update(bool = false) { }
virtual void apply() { }
void show() { }
/// Hide the dialog.
void hide();
/// Not used but we've got to implement it.
- void update() {}
+ void update(bool) {}
/// Real GUI implementation.
Gnome::About * dialog_;
}
}
-void FormError::update()
+void FormError::update(bool)
{
}
void showInset( InsetError * const );
/// Update dialog before showing it
- virtual void update();
+ virtual void update(bool = false);
/// Apply from dialog (modify or create inset)
virtual void apply();
/// Explicitly free the dialog.
}
}
-void FormIndex::update()
+void FormIndex::update(bool switched)
{
+ if (switched) {
+ hide();
+ return;
+ }
+
if (dialog_ != NULL &&
lv_->view()->available())
{
void showInset( InsetCommand * const );
/// Update dialog before showing it
- virtual void update();
+ virtual void update(bool = false);
/// Apply from dialog (modify or create inset)
virtual void apply();
/// Explicitly free the dialog.
}
-void FormPrint::update()
+// we can safely ignore the parameter because we can always update
+void FormPrint::update(bool)
{
if (dialog_ != NULL &&
lv_->view()->available())
/// Hide the dialog.
void hide();
/// Update the dialog.
- void update();
+ void update(bool = false);
/// Free memory
void free();
//@}
void showInset( InsetCommand * const );
/// Update dialog before showing it (not used in this implementation)
- virtual void update() { hide(); }
+ virtual void update(bool = false) { hide(); }
/// Apply from dialog (modify or create inset)
virtual void apply();
/// Explicitly free the dialog.
}
-void FormToc::update()
+// we can safely ignore the parameter because we can always update
+void FormToc::update(bool)
{
Buffer::TocType type;
string wintitle;
void showInset( InsetCommand * const );
/// Update dialog before showing it
- virtual void update();
+ virtual void update(bool = false);
/// Explicitly free the dialog.
void free();
/// Create the dialog if necessary, update it and display it.
}
}
-void FormUrl::update()
+void FormUrl::update(bool switched)
{
+ if (switched) {
+ hide();
+ return;
+ }
+
if (dialog_ != NULL &&
lv_->view()->available())
{
void showInset( InsetCommand * const );
/// Update dialog before showing it
- virtual void update();
+ virtual void update(bool = false);
/// Apply from dialog (modify or create inset)
virtual void apply();
/// Explicitly free the dialog.
dialog_->keys->update();
}
-void FormCitation::update()
+
+// we can safely ignore the parameter because we can always update
+void FormCitation::update(bool)
{
keys.clear();
/// Hide the dialog.
void hide();
/// Update the dialog.
- void update();
+ void update(bool switched = false);
/// create a Citation inset
void createCitation(string const &);
/// Hide the dialog.
void hide();
/// Not used but we've got to implement it.
- void update() {}
+ void update(bool) {}
/// Real GUI implementation.
FormCopyrightDialog * dialog_;
show();
}
-void FormIndex::update()
+void FormIndex::update(bool switched)
{
+ if (switched) {
+ hide();
+ return;
+ }
+
dialog_->setIndexText(params.getContents().c_str());
// dialog_->setReadOnly(readonly);
}
/// Hide the dialog.
void hide();
/// Update the dialog.
- void update();
+ void update(bool = false);
/// create an Index inset
void createIndex(string const &);
delete dialog_;
}
-void FormPrint::update()
+// we can safely ignore the parameter because we can always update
+void FormPrint::update(bool)
{
if (!lv_->view()->available())
return;
/// Hide the dialog.
void hide();
/// Update the dialog.
- void update();
+ void update(bool = false);
/// Real GUI implementation.
FormPrintDialog * dialog_;
updateRefs();
}
-void FormRef::update()
+void FormRef::update(bool switched)
{
+ if (switched) {
+ hide();
+ return;
+ }
+
dialog_->reference->setText(params.getContents().c_str());
dialog_->refname->setText(params.getOptions().c_str());
/// goto a ref (or back)
void goto_ref();
/// update dialog
- void update();
+ void update(bool = false);
/// update just the refs
void do_ref_update();
/// Apply changes
updateToc(newdepth);
}
-void FormToc::update()
+// we can safely ignore the parameter because we can always update
+void FormToc::update(bool)
{
if (params.getCmdName()=="tableofcontents") {
setType(Buffer::TOC_TOC);
/// Choose which type
void set_type(Buffer::TocType);
/// Update the dialog.
- void update();
+ void update(bool = false);
/// change the depth shown
void set_depth(int);
/// close the connections
show();
}
-void FormUrl::update()
+void FormUrl::update(bool switched)
{
+ if (switched) {
+ // I suspect a buffer switch should cause hide() here. ARRae
+ hide();
+ return;
+ }
+
dialog_->url->setText(params.getContents().c_str());
dialog_->urlname->setText(params.getOptions().c_str());
/// Hide the dialog.
void hide();
/// Update the dialog.
- void update();
+ void update(bool switched = false);
/// create a URL inset
void createUrl(string const &);
FormBase::FormBase(LyXView * lv, Dialogs * d, string const & t,
- BufferDependency bd, ChangedBufferAction cba,
ButtonPolicy * bp, char const * close, char const * cancel)
- : dialogIsOpen(false), lv_(lv), bc_(bp, cancel, close),
- d_(d), bd_(bd), cba_(cba), parent_(0), u_(0), h_(0), title(t), bp_(bp)
+ : lv_(lv), bc_(bp, cancel, close), d_(d), h_(0), title(t), bp_(bp)
{}
C_FormBaseWMHideCB, 0);
}
- parent_ = lv_->buffer();
-
fl_freeze_form( form() );
update(); // make sure its up-to-date
fl_unfreeze_form( form() );
- dialogIsOpen = true;
if (form()->visible) {
fl_raise_form(form());
} else {
void FormBase::hide()
{
if (form() && form()->visible) {
- fl_hide_form(form());
+ // some dialogs might do things to the form first
+ // such as the nested tabfolder problem in Preferences
disconnect();
+ fl_hide_form(form());
}
-
- // free up the dialog for another inset
- dialogIsOpen = false;
- parent_ = 0;
- clearStore();
-}
-
-
-void FormBase::connect()
-{
- switch( bd_ ) {
- case BUFFER_DEPENDENT:
- u_ = d_->updateBufferDependent.
- connect(slot(this, &FormBase::updateOrHide));
- h_ = d_->hideBufferDependent.
- connect(slot(this, &FormBase::hide));
- break;
- case BUFFER_INDEPENDENT:
- h_ = d_->hideAll.connect(slot(this, &FormBase::hide));
- break;
- }
-}
-
-
-void FormBase::disconnect()
-{
- u_.disconnect();
- h_.disconnect();
-}
-
-
-void FormBase::updateOrHide()
-{
- if( cba_ == UPDATE )
- update();
- else if( parent_ == lv_->buffer() )
- update();
- else
- hide();
}
pre->restore();
pre->bc_.undoAll();
}
+
+
+FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t,
+ ButtonPolicy * bp,
+ char const * close, char const * cancel)
+ : FormBase( lv, d, t, bp, close, cancel )
+{}
+
+
+void FormBaseBI::connect()
+{
+ h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide));
+}
+
+
+void FormBaseBI::disconnect()
+{
+ h_.disconnect();
+}
+
+
+FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t,
+ ButtonPolicy * bp,
+ char const * close, char const * cancel)
+ : FormBase( lv, d, t, bp, close, cancel ),
+ u_(0)
+{}
+
+
+void FormBaseBD::connect()
+{
+ u_ = d_->updateBufferDependent.
+ connect(slot(this, &FormBaseBD::update));
+ h_ = d_->hideBufferDependent.
+ connect(slot(this, &FormBaseBD::hide));
+}
+
+
+void FormBaseBD::disconnect()
+{
+ u_.disconnect();
+ h_.disconnect();
+}
#pragma interface
#endif
-/** This class is an XForms GUI base class
+/** This class is an XForms GUI base class.
+ It is meant to be used solely as the parent class to FormBaseBI and FormBaseBD
@author Angus Leeming
*/
class FormBase : public DialogBase, public noncopyable {
public:
- ///
- enum BufferDependency {
- ///
- BUFFER_DEPENDENT,
- ///
- BUFFER_INDEPENDENT
- };
- ///
- enum ChangedBufferAction {
- ///
- UPDATE,
- ///
- HIDE
- };
-
/** Constructor.
#FormBase(lv, d, _("DialogName"), BUFFER_DEPENDENT, new ButtonPolicy)#
*/
FormBase(LyXView *, Dialogs *, string const &,
- BufferDependency, ChangedBufferAction,
- ButtonPolicy * bp = new OkApplyCancelReadOnlyPolicy,
- char const * close = N_("Close"),
- char const * cancel = N_("Cancel"));
+ ButtonPolicy *, char const *, char const *);
///
virtual ~FormBase();
void show();
/// Hide the dialog.
virtual void hide();
- /// Connect signals
- virtual void connect();
- /// Disconnect signals
- virtual void disconnect();
+ /// bool indicates if a buffer switch took place
+ virtual void update(bool = false) {}
+ /// Connect signals. Also perform any necessary initialisation.
+ virtual void connect() = 0;
+ /// Disconnect signals. Also perform any necessary housekeeping.
+ virtual void disconnect() = 0;
/// Build the dialog
virtual void build() = 0;
/** Filter the inputs on callback from xforms
virtual bool input( FL_OBJECT *, long ) {
return true;
}
- /// Update dialog before showing it
- virtual void update() {}
/// Apply from dialog (modify or create inset)
virtual void apply() {}
/// OK from dialog
virtual void restore() {
update();
}
- /// delete derived class variables when hide()ing
- virtual void clearStore() {}
/// Pointer to the actual instantiation of xform's form
virtual FL_FORM * form() const = 0;
-private: // methods
- /// method connected to updateBufferDependent signal.
- void updateOrHide();
-
protected: // data
- /// block opening of form twice at the same time.
- bool dialogIsOpen;
/** Which LyXFunc do we use?
We could modify Dialogs to have a visible LyXFunc* instead and
save a couple of bytes per dialog.
LyXView * lv_;
/// Useable even in derived-class's const functions.
mutable ButtonController bc_;
-
-private: // data
/// Used so we can get at the signals we have to connect to.
Dialogs * d_;
- /// flag whether dialog is buffer dependent or not.
- BufferDependency const bd_;
- /// flag whether to hide or update on updateBufferDependent signal.
- ChangedBufferAction const cba_;
- /// stores parent buffer when popup was launched.
- Buffer * parent_;
- /// Update connection.
- Connection u_;
/// Hide connection.
Connection h_;
/// dialog title, displayed by WM.
ButtonPolicy * bp_;
};
+
+/** This class is an XForms GUI base class for Buffer Independent dialogs.
+ Such dialogs do not require an update Connection although they may use
+ an update() function which is also supported by restore().
+ */
+class FormBaseBI : public FormBase {
+public:
+ /// Constructor
+ FormBaseBI(LyXView *, Dialogs *, string const &,
+ ButtonPolicy * bp = new OkApplyCancelPolicy,
+ char const * close = N_("Close"),
+ char const * cancel = N_("Cancel"));
+
+protected:
+ /// Connect signals
+ virtual void connect();
+ /// Disconnect signals
+ virtual void disconnect();
+};
+
+
+/** This class is an XForms GUI base class for Buffer Dependent dialogs
+ */
+class FormBaseBD : public FormBase {
+public:
+ /// Constructor
+ FormBaseBD(LyXView *, Dialogs *, string const &,
+ ButtonPolicy * bp = new OkApplyCancelReadOnlyPolicy,
+ char const * close = N_("Close"),
+ char const * cancel = N_("Cancel"));
+
+protected:
+ /// Connect signals
+ virtual void connect();
+ /// Disconnect signals
+ virtual void disconnect();
+
+ /// Update connection.
+ Connection u_;
+};
+
+
#endif
static int min_wform;
FormCitation::FormCitation(LyXView * lv, Dialogs * d)
- : FormCommand(lv, d, _("Citation"), HIDE), dialog_(0)
+ : FormCommand(lv, d, _("Citation")), dialog_(0)
{
// let the dialog be shown
// These are permanent connections so we won't bother
}
-void FormCitation::clearStore()
+void FormCitation::disconnect()
{
citekeys.clear();
bibkeys.clear();
bibkeysInfo.clear();
+
+ FormCommand::disconnect();
}
}
-void FormCitation::update()
+void FormCitation::update(bool switched)
{
+ if (switched) {
+ hide();
+ return;
+ }
+
bibkeys.clear();
bibkeysInfo.clear();
#pragma interface
#endif
-#include "FormCommand.h"
+#include "FormInset.h"
struct FD_form_citation;
/** This class provides an XForms implementation of the FormCitation Dialog.
///
OFF
};
+ /// Disconnect signals. Also perform any necessary housekeeping.
+ virtual void disconnect();
+
/// Build the dialog
virtual void build();
/// Filter the inputs
virtual bool input( FL_OBJECT *, long );
/// Update dialog before showing it
- virtual void update();
+ virtual void update(bool switched = false);
/// Apply from dialog (modify or create inset)
virtual void apply();
- /// delete derived class variables from hide()
- virtual void clearStore();
/// Pointer to the actual instantiation of the xform's form
virtual FL_FORM * form() const;
+++ /dev/null
-// -*- C++ -*-
-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 2000 The LyX Team.
- *
- * ======================================================
- */
-
-#include <config.h>
-
-#include FORMS_H_LOCATION
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-
-#include "Dialogs.h"
-#include "FormCommand.h"
-
-FormCommand::FormCommand( LyXView * lv, Dialogs * d, string const & t,
- ChangedBufferAction cba, ButtonPolicy * bp )
- : FormBase( lv, d, t, BUFFER_DEPENDENT, cba, bp ),
- inset_(0), ih_(0)
-{}
-
-
-void FormCommand::showInset( InsetCommand * inset )
-{
- if ( dialogIsOpen || inset == 0 ) return;
-
- inset_ = inset;
- ih_ = inset_->hide.connect(slot(this, &FormCommand::hide));
-
- params = inset->params();
- show();
-}
-
-
-void FormCommand::createInset( string const & arg )
-{
- if ( dialogIsOpen ) return;
-
- params.setFromString( arg );
- show();
-}
+++ /dev/null
-// -*- C++ -*-
-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 2000 The LyX Team.
- *
- * ======================================================
- */
-
-#ifndef FORMCOMMAND_H
-#define FORMCOMMAND_H
-
-#include "FormBase.h"
-#include "insets/insetcommand.h"
-
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-/** This class is an XForms GUI base class to insets derived from
- InsetCommand
- */
-class FormCommand : public FormBase {
-public:
- /// Constructor
- FormCommand( LyXView *, Dialogs *, string const &,
- ChangedBufferAction,
- ButtonPolicy * bp = new OkCancelReadOnlyPolicy );
-
-protected:
- /// Slot launching dialog to (possibly) create a new inset
- void createInset( string const & );
- /// Slot launching dialog to an existing inset
- void showInset( InsetCommand * );
-
- /// pointer to the inset passed through showInset (if any)
- InsetCommand * inset_;
- /// the nitty-griity. What is modified and passed back
- InsetCommandParams params;
- /// inset::hide connection.
- Connection ih_;
-};
-
-#endif
#include "FormCopyright.h"
FormCopyright::FormCopyright( LyXView * lv, Dialogs * d )
- : FormBase( lv, d, _("Copyright and Warranty"),
- BUFFER_INDEPENDENT, HIDE ),
+ : FormBaseBI( lv, d, _("Copyright and Warranty") ),
dialog_(0)
{
// let the dialog be shown
/** This class provides an XForms implementation of the FormCopyright Dialog.
*/
-class FormCopyright : public FormBase {
+class FormCopyright : public FormBaseBI {
public:
/// #FormCopyright x(LyXFunc ..., Dialogs ...);#
FormCopyright(LyXView *, Dialogs *);
#define USE_CLASS_COMBO 1
FormDocument::FormDocument(LyXView * lv, Dialogs * d)
- : FormBase(lv, d, _("Document Layout"), BUFFER_DEPENDENT, UPDATE,
- new NoRepeatedApplyReadOnlyPolicy),
+ : FormBaseBD(lv, d, _("Document Layout"),
+ new NoRepeatedApplyReadOnlyPolicy),
dialog_(0), paper_(0), class_(0), language_(0), options_(0),
bullets_(0), current_bullet_panel(0), current_bullet_depth(0),
fbullet(0), combo_language(0), combo_doc_class(0)
}
-void FormDocument::update()
+// we can safely ignore the parameter because we can always update
+void FormDocument::update(bool)
{
if (!dialog_)
return;
/** This class provides an XForms implementation of the FormDocument Popup.
The table-layout-form here changes values for latex-tabulars
+ @author Jürgen Vigna
*/
-class FormDocument : public FormBase {
+class FormDocument : public FormBaseBD {
public:
/// #FormDocument x(Communicator ..., Popups ...);#
FormDocument(LyXView *, Dialogs *);
/// Filter the inputs
virtual bool input( FL_OBJECT *, long );
/// Update the popup.
- virtual void update();
+ virtual void update(bool switched = false);
/// Apply from popup
virtual void apply();
/// Cancel from popup
virtual void cancel();
- ///
- virtual void restore() {
- update();
- }
///
virtual FL_FORM * form() const;
static int minh, minw;
FormError::FormError( LyXView * lv, Dialogs * d )
- : FormBase( lv, d, _("LaTeX Error"), BUFFER_DEPENDENT, HIDE ),
- dialog_(0), ih_(0), message_("")
+ : FormInset( lv, d, _("LaTeX Error") ),
+ dialog_(0), inset_(0), message_("")
{
// let the dialog be shown
// This is a permanent connection so we won't bother
}
-void FormError::clearStore()
+void FormError::disconnect()
{
- ih_.disconnect();
+ inset_ = 0;
message_.empty();
+ FormInset::disconnect();
}
void FormError::showInset( InsetError * inset )
{
- if ( dialogIsOpen || inset == 0 ) return;
+ if (inset == 0) return;
- ih_ = inset->hide.connect(slot(this, &FormError::hide));
+ // If connected to another inset, disconnect from it.
+ if (inset_)
+ ih_.disconnect();
- message_ = inset->getContents();
+ inset_ = inset;
+ message_ = inset->getContents();
show();
}
-void FormError::update()
+void FormError::update(bool switched)
{
+ if (switched) {
+ hide();
+ return;
+ }
+
fl_set_form_minsize(form(), minw, minh);
fl_set_object_label(dialog_->message, message_.c_str());
}
#pragma interface
#endif
-#include "FormBase.h"
+#include "FormInset.h"
class InsetError;
struct FD_form_error;
/** This class provides an XForms implementation of the FormError Dialog.
*/
-class FormError : public FormBase {
+class FormError : public FormInset {
public:
/// Constructor
FormError(LyXView *, Dialogs *);
///
~FormError();
private:
+ /// Disconnect signals. Also perform any necessary housekeeping.
+ virtual void disconnect();
+
/// Slot launching dialog to an existing inset
void showInset( InsetError * );
/// Update dialog before showing it
- virtual void update();
+ virtual void update(bool switched = false);
/// Build the dialog
virtual void build();
- /// Reset data when hide() is called
- virtual void clearStore();
/// Pointer to the actual instantiation of the xform's form
virtual FL_FORM * form() const;
/// Fdesign generated method
/// Real GUI implementation.
FD_form_error * dialog_;
- /// inset::hide connection.
- Connection ih_;
+ /// pointer to the inset passed through showInset
+ InsetError * inset_;
/// the error message
string message_;
};
lv_->view()->updateInset(inset_, changed);
}
-void FormGraphics::update()
+
+// it doesn't look this is capable of updating on a buffer switch
+// inset_ would be accessible but it's not in the new buffer so
+// ok or apply will call something that won't like it. ARRae.
+void FormGraphics::update(bool switched)
{
+ if (switched) {
+ hide();
+ return;
+ }
+
Assert(inset_ != 0);
// Update dialog with details from inset
/// Hide the dialog.
void hide();
/// Update the dialog
- void update();
+ void update(bool switched = false);
/// Apply the changes to the inset.
void apply();
#include "lyxfunc.h"
FormIndex::FormIndex(LyXView * lv, Dialogs * d)
- : FormCommand(lv, d, _("Index"), HIDE), minh(0), minw(0), dialog_(0)
+ : FormCommand(lv, d, _("Index")), minh(0), minw(0), dialog_(0)
{
// let the dialog be shown
// These are permanent connections so we won't bother
{
dialog_ = build_index();
+#ifdef WITH_WARNINGS
+#warning use the buttoncontroller
+#endif
// XFORMS bug workaround
// Define the min/max dimensions. Actually applied in update()
minw = form()->w; minh = form()->h;
}
-void FormIndex::update()
+void FormIndex::update(bool switched)
{
+ if (switched) {
+ hide();
+ return;
+ }
+
fl_set_form_minsize(form(), minw, minh);
fl_set_form_maxsize(form(), 2*minw, minh);
#pragma interface
#endif
-#include "FormCommand.h"
+#include "FormInset.h"
struct FD_form_index;
/** This class provides an XForms implementation of the FormIndex Dialog.
/// Build the dialog
virtual void build();
/// Update dialog before showing it
- virtual void update();
+ virtual void update(bool switched = false);
/// Apply from dialog (modify or create inset)
virtual void apply();
/// Pointer to the actual instantiation of the xform's form
--- /dev/null
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#include <config.h>
+
+#include FORMS_H_LOCATION
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+
+#include "Dialogs.h"
+#include "LyXView.h"
+#include "FormInset.h"
+
+FormInset::FormInset(LyXView * lv, Dialogs * d, string const & t,
+ ButtonPolicy * bp,
+ char const * close, char const * cancel)
+ : FormBaseBD( lv, d, t, bp, close, cancel ), ih_(0)
+{}
+
+
+void FormInset::connect()
+{
+ u_ = d_->updateBufferDependent.
+ connect(slot(this, &FormInset::update));
+ h_ = d_->hideBufferDependent.
+ connect(slot(this, &FormInset::hide));
+}
+
+
+void FormInset::disconnect()
+{
+ ih_.disconnect();
+ FormBaseBD::disconnect();
+}
+
+
+FormCommand::FormCommand( LyXView * lv, Dialogs * d, string const & t,
+ ButtonPolicy * bp,
+ char const * close, char const * cancel)
+ : FormInset( lv, d, t, bp, close, cancel ),
+ inset_(0)
+{}
+
+
+void FormCommand::disconnect()
+{
+ inset_ = 0;
+ params = InsetCommandParams( string() );
+ FormInset::disconnect();
+}
+
+
+void FormCommand::showInset( InsetCommand * inset )
+{
+ if (inset == 0) return; // maybe we should Assert this?
+
+ // If connected to another inset, disconnect from it.
+ if (inset_)
+ ih_.disconnect();
+
+ inset_ = inset;
+ params = inset->params();
+ ih_ = inset->hide.connect(slot(this, &FormInset::hide));
+ show();
+}
+
+
+void FormCommand::createInset( string const & arg )
+{
+ if (inset_) {
+ ih_.disconnect();
+ inset_ = 0;
+ }
+
+ params.setFromString( arg );
+ show();
+}
--- /dev/null
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+
+#ifndef FORMCOMMAND_H
+#define FORMCOMMAND_H
+
+#include "FormBase.h"
+#include "insets/insetcommand.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+
+/** This class is an XForms GUI base class to insets
+ */
+class FormInset : public FormBaseBD {
+public:
+ /// Constructor
+ FormInset( LyXView *, Dialogs *, string const &,
+ ButtonPolicy * bp = new OkCancelReadOnlyPolicy,
+ char const * close = N_("Close"),
+ char const * cancel = N_("Cancel"));
+
+protected: // methods
+ /// Connect signals. Also perform any necessary initialisation.
+ virtual void connect();
+ /// Disconnect signals. Also perform any necessary housekeeping.
+ virtual void disconnect();
+
+protected: // data
+ /// inset::hide connection.
+ Connection ih_;
+};
+
+
+/** This class is an XForms GUI base class to insets derived from
+ InsetCommand
+ */
+class FormCommand : public FormInset {
+public:
+ /// Constructor
+ FormCommand( LyXView *, Dialogs *, string const &,
+ ButtonPolicy * = new OkCancelReadOnlyPolicy,
+ char const * close = N_("Close"),
+ char const * cancel = N_("Cancel"));
+
+protected:
+ /// Disconnect signals. Also perform any necessary housekeeping.
+ virtual void disconnect();
+
+ /// Slot launching dialog to (possibly) create a new inset
+ void createInset( string const & );
+ /// Slot launching dialog to an existing inset
+ void showInset( InsetCommand * );
+
+ /// pointer to the inset passed through showInset
+ InsetCommand * inset_;
+ /// the nitty-griity. What is modified and passed back
+ InsetCommandParams params;
+};
+
+#endif
#endif
FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
- : FormBase(lv, d, _("Paragraph Layout"), BUFFER_DEPENDENT, UPDATE,
- new NoRepeatedApplyReadOnlyPolicy),
+ : FormBaseBD(lv, d, _("Paragraph Layout"),
+ new NoRepeatedApplyReadOnlyPolicy),
dialog_(0), general_(0), extra_(0)
{
// let the popup be shown
bc_.addReadOnly (general_->radio_align_center);
bc_.addReadOnly (general_->check_lines_top);
bc_.addReadOnly (general_->check_lines_bottom);
+ bc_.addReadOnly (general_->check_pagebreaks_top);
+ bc_.addReadOnly (general_->check_pagebreaks_bottom);
bc_.addReadOnly (general_->choice_space_above);
bc_.addReadOnly (general_->input_space_above);
bc_.addReadOnly (general_->check_space_above);
bc_.addReadOnly (extra_->radio_pextra_indent);
bc_.addReadOnly (extra_->radio_pextra_minipage);
bc_.addReadOnly (extra_->radio_pextra_floatflt);
+ bc_.addReadOnly (extra_->radio_pextra_hfill);
+ bc_.addReadOnly (extra_->radio_pextra_startmp);
// now make them fit together
fl_addto_tabfolder(dialog_->tabbed_folder,_("General"), general_->form);
}
-void FormParagraph::update()
+// we can safely ignore the parameter because we can always update
+void FormParagraph::update(bool)
{
if (!dialog_)
return;
general_update();
extra_update();
+ bc_.readOnly(lv_->buffer()->isReadonly());
}
space_top = VSpace(VSpace::VFILL);
break;
case 7:
- space_top = VSpace(LyXGlueLength(fl_get_input(general_->input_space_above)));
+ space_top =
+ VSpace(LyXGlueLength(fl_get_input(general_->input_space_above)));
break;
}
if (fl_get_button (general_->check_space_above))
space_bottom = VSpace(VSpace::VFILL);
break;
case 7:
- space_bottom = VSpace(LyXGlueLength(fl_get_input(general_->input_space_below)));
+ space_bottom =
+ VSpace(LyXGlueLength(fl_get_input(general_->input_space_below)));
break;
}
if (fl_get_button (general_->check_space_below))
struct FD_form_paragraph_extra;
/** This class provides an XForms implementation of the FormParagraph Popup.
+ * @author Jürgen Vigna
*/
-class FormParagraph : public FormBase {
+class FormParagraph : public FormBaseBD {
public:
///
FormParagraph(LyXView *, Dialogs *);
private:
/// Build the popup
- void build();
+ virtual void build();
/// Apply from popup
- void apply();
+ virtual void apply();
/// Update the popup.
- void update();
+ virtual void update(bool);
/// Filter the inputs on callback from xforms
virtual bool input(FL_OBJECT * ob, long);
FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
- : FormBase(lv, d, _("Preferences"),
- BUFFER_INDEPENDENT, HIDE, new PreferencesPolicy),
+ : FormBaseBI(lv, d, _("Preferences"), new PreferencesPolicy),
dialog_(0), outputs_tab_(0), look_n_feel_tab_(0), inputs_tab_(0),
lnf_general_(0), screen_fonts_(0), interface_(0),
printer_(0), paths_(0), outputs_general_(0), minw_(0), minh_(0)
fl_set_input_return(paths_->input_lastfiles, FL_RETURN_CHANGED);
fl_set_input_return(paths_->input_backup_path, FL_RETURN_CHANGED);
fl_set_counter_return(paths_->counter_lastfiles, FL_RETURN_CHANGED);
+ fl_set_input_return(paths_->input_serverpipe, FL_RETURN_CHANGED);
// outputs general
fl_set_counter_return(outputs_general_->counter_line_len,
FL_RETURN_CHANGED);
fl_deactivate_object(paths_->button_temp_dir_browse);
fl_deactivate_object(paths_->button_lastfiles_browse);
fl_deactivate_object(paths_->button_backup_path_browse);
+ fl_deactivate_object(paths_->button_serverpipe_browse);
fl_set_object_lcol(interface_->button_bind_file_browse, FL_INACTIVE);
fl_set_object_lcol(interface_->button_ui_file_browse, FL_INACTIVE);
fl_set_object_lcol(paths_->button_document_browse, FL_INACTIVE);
fl_set_object_lcol(paths_->button_temp_dir_browse, FL_INACTIVE);
fl_set_object_lcol(paths_->button_lastfiles_browse, FL_INACTIVE);
fl_set_object_lcol(paths_->button_backup_path_browse, FL_INACTIVE);
+ fl_set_object_lcol(paths_->button_serverpipe_browse, FL_INACTIVE);
}
void FormPreferences::connect()
{
- FormBase::connect();
+ FormBaseBI::connect();
fl_set_form_minsize(dialog_->form,
minw_,
minh_);
fl_get_input(interface_->input_popup_encoding);
lyxrc.bind_file = fl_get_input(interface_->input_bind_file);
lyxrc.ui_file = fl_get_input(interface_->input_ui_file);
+ lyxrc.override_x_deadkeys =
+ fl_get_button(interface_->check_override_x_dead_keys);
// Screen fonts
if (lyxrc.roman_font_name !=
fl_get_input(screen_fonts_->input_roman) ||
lyxrc.make_backup = fl_get_button(paths_->check_make_backups);
lyxrc.num_lastfiles = static_cast<unsigned int>
(fl_get_counter_value(paths_->counter_lastfiles));
+ lyxrc.lyxpipes = fl_get_input(paths_->input_serverpipe);
// outputs general
lyxrc.ascii_linelen = static_cast<unsigned int>
(fl_get_counter_value(outputs_general_->counter_line_len));
}
-void FormPreferences::update()
+// we can safely ignore the parameter because we can always update
+void FormPreferences::update(bool)
{
if (dialog_) {
// read lyxrc entries
lyxrc.bind_file.c_str());
fl_set_input(interface_->input_ui_file,
lyxrc.ui_file.c_str());
+ fl_set_button(interface_->check_override_x_dead_keys,
+ lyxrc.override_x_deadkeys);
// printer
fl_set_button(printer_->check_adapt_output,
lyxrc.print_adapt_output);
lyxrc.make_backup);
fl_set_counter_value(paths_->counter_lastfiles,
lyxrc.num_lastfiles);
+ fl_set_input(paths_->input_serverpipe, lyxrc.lyxpipes.c_str());
// outputs general
fl_set_counter_value(outputs_general_->counter_line_len,
lyxrc.ascii_linelen);
//
// whatever checks you need to ensure the user hasn't entered
// some totally ridiculous value somewhere. Change activate to suit.
- //
- // Examples:
- // paths -- all dirs in the path should exist, be writable & absolute
+ // comments before each test describe what is _valid_
+
+ // input path -- dir should exist, be writable & absolute
if (!AbsolutePath(fl_get_input(paths_->input_default_path))
- || 1 != IsDirWriteable(fl_get_input(paths_->input_default_path))
- // template_path should be a readable directory
- || !AbsolutePath(fl_get_input(paths_->input_template_path))
- || 1 != FileInfo(fl_get_input(paths_->input_template_path)).isDir()
- || 1 != FileInfo(fl_get_input(paths_->input_template_path)).readable()
- // lastfiles: exists && writeable || non-existent && isn't a dir
- // NOTE: assumes IsFileWriteable == -1 means non-existent hence
- // the extra check to see if its a directory
- || !AbsolutePath(fl_get_input(paths_->input_lastfiles))
- || 1 != IsDirWriteable(OnlyPath(fl_get_input(paths_->
- input_lastfiles)))
- || 0 == IsFileWriteable(OnlyPath(fl_get_input(paths_->
- input_lastfiles)))
- || FileInfo(fl_get_input(paths_->input_lastfiles)).isDir()
- // tmpdir: only check if we are using it
- || (fl_get_button(paths_->check_use_temp_dir)
- && (1 != IsDirWriteable(fl_get_input(paths_->input_temp_dir))
- || !AbsolutePath(fl_get_input(paths_->input_temp_dir))))
- // backupdir: can safely be left empty
- || (fl_get_button(paths_->check_make_backups)
- && (!string(fl_get_input(paths_->input_backup_path)).empty()
- && (1 != IsDirWriteable(fl_get_input(paths_->
- input_backup_path))
- || !AbsolutePath(fl_get_input(paths_->
- input_backup_path)))))) {
+ || 1 != IsDirWriteable(fl_get_input(paths_->input_default_path))) {
+ activate = false;
+ lyxerr[Debug::GUI] << "Preferences: input path is wrong\n";
+ }
+
+ {
+ // template_path should be a readable directory
+ string temp(fl_get_input(paths_->input_template_path));
+ FileInfo tp(temp);
+ if (!AbsolutePath(temp)
+ || !tp.isDir()
+ || !tp.readable()) {
+ activate = false;
+ lyxerr[Debug::GUI] << "Preferences: template path is wrong\n";
+ }
+ }
+
+ // tmpdir: not used
+ // || writable directory
+ if (fl_get_button(paths_->check_use_temp_dir)
+ && (1 != IsDirWriteable(fl_get_input(paths_->input_temp_dir))
+ || !AbsolutePath(fl_get_input(paths_->input_temp_dir)))) {
activate = false;
- lyxerr[Debug::GUI] << "Preferences: Path is wrong\n";
+ lyxerr[Debug::GUI] << "Preferences: tmpdir is wrong\n";
+ }
+
+ // backupdir: not used
+ // || empty
+ // || writable dir
+ if (fl_get_button(paths_->check_make_backups)
+ && (!string(fl_get_input(paths_->input_backup_path)).empty()
+ && (1 != IsDirWriteable(fl_get_input(paths_->
+ input_backup_path))
+ || !AbsolutePath(fl_get_input(paths_->
+ input_backup_path))))) {
+ activate = false;
+ lyxerr[Debug::GUI] << "Preferences: backupdir is wrong\n";
+ }
+
+ // lastfiles: exists && writeable
+ // || non-existent && isn't a dir
+#ifdef WITH_WARNINGS
+#warning incorrectly allows files in /, other tests might also do this
+#endif
+ {
+ string lastfiles(fl_get_input(paths_->input_lastfiles));
+ FileInfo lf(lastfiles);
+ if (!AbsolutePath(lastfiles)
+ || 1 != IsDirWriteable(OnlyPath(lastfiles))
+ || (lf.exist()
+ && (lf.isDir()
+ || !lf.writable()))) {
+ activate = false;
+ lyxerr[Debug::GUI] << "Preferences: lastfiles is wrong\n";
+ }
+ }
+
+ // serverpipe: empty
+ // || non-existent && isn't a dir
+ // || exists && writeable
+ // remember we append .in and .out later
+ if (!string(fl_get_input(paths_->input_serverpipe)).empty()) {
+ string pipe(fl_get_input(paths_->input_serverpipe));
+ FileInfo sp_in(pipe + ".in");
+ FileInfo sp_out(pipe + ".out");
+ if (!AbsolutePath(pipe)
+ || 1 != IsDirWriteable(OnlyPath(pipe))
+ || (sp_in.exist()
+ && (!sp_in.writable()
+ || sp_in.isDir()))
+ || (sp_out.exist()
+ && (!sp_out.writable()
+ || sp_out.isDir()))) {
+ activate = false;
+ lyxerr[Debug::GUI] << "Preferences: Serverpipe is wrong\n";
+ }
}
// fontsizes -- tiny < script < footnote etc.
/** This class provides an XForms implementation of the FormPreferences Dialog.
The preferences dialog allows users to set/save their preferences.
*/
-class FormPreferences : public FormBase {
+class FormPreferences : public FormBaseBI {
public:
/// #FormPreferences x(LyXFunc ..., Dialogs ...);#
FormPreferences(LyXView *, Dialogs *);
///
virtual void connect();
/// Update the dialog.
- virtual void update();
+ virtual void update(bool = false);
///
virtual void hide();
/// OK from dialog
FormPrint::FormPrint(LyXView * lv, Dialogs * d)
- : FormBase(lv, d, _("Print"),
- BUFFER_DEPENDENT, HIDE, new OkApplyCancelPolicy),
+ : FormBaseBD(lv, d, _("Print"), new OkApplyCancelPolicy),
dialog_(0), target_(2), order_(2), which_(3)
{
// let the dialog be shown
void FormPrint::connect()
{
- FormBase::connect();
+ FormBaseBD::connect();
fl_set_form_minsize(dialog_->form,
dialog_->form->w,
dialog_->form->h);
}
-void FormPrint::update()
+// we can safely ignore the parameter because we can always update
+void FormPrint::update(bool)
{
if (dialog_
&& lv_->view()->available()) {
/** This class provides an XForms implementation of the FormPrint Dialog.
The print dialog allows users to print their documents.
*/
-class FormPrint : public FormBase {
+class FormPrint : public FormBaseBD {
public:
/// #FormPrint x(LyXView ..., Dialogs ...);#
FormPrint(LyXView *, Dialogs *);
private:
/// Update the dialog.
- virtual void update();
+ virtual void update(bool switched = false);
/// Apply from dialog
virtual void apply();
/// Filter the inputs
static int formh;
FormRef::FormRef(LyXView * lv, Dialogs * d)
- : FormCommand(lv, d, _("Reference"), HIDE), toggle(GOBACK), dialog_(0)
+ : FormCommand(lv, d, _("Reference")), toggle(GOBACK), dialog_(0)
{
// let the dialog be shown
// These are permanent connections so we won't bother
}
-void FormRef::clearStore()
+void FormRef::disconnect()
{
refs.clear();
+ FormCommand::disconnect();
}
}
-void FormRef::update()
+void FormRef::update(bool switched)
{
+ if (switched) {
+ hide();
+ return;
+ }
+
fl_set_input(dialog_->ref, params.getContents().c_str());
fl_set_input(dialog_->name, params.getOptions().c_str());
case GOBACK:
{
lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK);
- fl_set_object_label(dialog_->button_go, _("Goto reference"));
+ fl_set_object_label(dialog_->button_go,
+ _("Goto reference"));
}
break;
// changed reference type
case 4:
{
- Type type = static_cast<Type>( fl_get_choice(dialog_->type)-1 );
+ Type type = static_cast<Type>(
+ fl_get_choice(dialog_->type) - 1 );
if ( params.getCmdName() == getName( type )
&& inset_ ) {
activate = false;
#pragma interface
#endif
-#include "FormCommand.h"
+#include "FormInset.h"
struct FD_form_ref;
/** This class provides an XForms implementation of the FormRef Dialog.
GOFIRST
};
+ /// Disconnect signals. Also perform any necessary housekeeping.
+ virtual void disconnect();
+
/// Build the dialog
virtual void build();
/// Filter the input
virtual bool input( FL_OBJECT *, long );
/// Update dialog before showing it
- virtual void update();
+ virtual void update(bool switched = false);
/// Not used but must be instantiated
virtual void apply();
- /// delete derived class variables from hide()
- virtual void clearStore();
/// Pointer to the actual instantiation of the xform's form
virtual FL_FORM * form() const;
}
-void FormTabular::update()
+void FormTabular::update(bool)
{
if (dialog_) {
local_update(true);
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 The LyX Team.
*
- * This file copyright 1999-2000
- * Allan Rae
*======================================================*/
/* FormTabular.h
* FormTabular Interface Class
///
void hideInset(InsetTabular *);
/// Update the dialog.
- void update();
+ void update(bool = false);
///
void updateInset(InsetTabular *);
///
#include "lyxfunc.h"
#include "support/lstrings.h"
+// The current code uses the apply() for handling the Update button and the
+// type-of-table selection and cancel() for the close button. This is a little
+// confusing to the button controller so I've made an IgnorantPolicy to cover
+// this situation since the dialog doesn't care about buttons. ARRae 20001013
FormToc::FormToc(LyXView * lv, Dialogs * d)
- : FormCommand(lv, d, _("Table of Contents"), UPDATE), dialog_(0)
+ : FormCommand(lv, d, _("Table of Contents"), new IgnorantPolicy),
+ dialog_(0)
{
// let the dialog be shown
// These are permanent connections so we won't bother
}
-void FormToc::clearStore()
+void FormToc::disconnect()
{
toclist.clear();
+ FormCommand::disconnect();
}
}
-void FormToc::update()
+// we can safely ignore the parameter because we can always update
+void FormToc::update(bool)
{
Buffer::TocType type;
if (!lv_->view()->available()) {
toclist.clear();
fl_clear_browser( dialog_->browser );
- fl_add_browser_line( dialog_->browser, _("*** No Document ***"));
+ fl_add_browser_line( dialog_->browser,
+ _("*** No Document ***"));
return;
}
for (vector<Buffer::TocItem>::const_iterator it = toclist.begin();
it != toclist.end(); ++it)
fl_add_browser_line( dialog_->browser,
- (string(4*(*it).depth,' ')+(*it).str).c_str());
+ (string(4 * (*it).depth, ' ')
+ + (*it).str).c_str());
fl_set_browser_topline( dialog_->browser, topline );
fl_select_browser_line( dialog_->browser, line );
#pragma interface
#endif
-#include "FormCommand.h"
+#include "FormInset.h"
#include "buffer.h"
struct FD_form_toc;
///
~FormToc();
private:
+ /// Disconnect signals. Also perform any necessary housekeeping.
+ virtual void disconnect();
+
/// Build the dialog
virtual void build();
/// Update dialog before showing it
- virtual void update();
+ virtual void update(bool switched = false);
/// Apply from dialog (modify or create inset)
virtual void apply();
- /// delete derived class variables from hide()
- virtual void clearStore();
/// Pointer to the actual instantiation of the xform's form
virtual FL_FORM * form() const;
///
#include "lyxfunc.h"
FormUrl::FormUrl(LyXView * lv, Dialogs * d)
- : FormCommand(lv, d, _("Url"), HIDE), minh(0), minw(0), dialog_(0)
+ : FormCommand(lv, d, _("Url")), minh(0), minw(0), dialog_(0)
{
// let the dialog be shown
// These are permanent connections so we won't bother
{
dialog_ = build_url();
+#ifdef WITH_WARNINGS
+#warning use the buttoncontroller
+#endif
// XFORMS bug workaround
// Define the min/max dimensions. Actually applied in update()
- minw = form()->w; minh = form()->h;
+ minw = form()->w;
+ minh = form()->h;
}
-void FormUrl::update()
+void FormUrl::update(bool switched)
{
+ if (switched) {
+ hide();
+ return;
+ }
+
fl_set_form_minsize(form(), minw, minh);
fl_set_form_maxsize(form(), 2*minw, minh);
#pragma interface
#endif
-#include "FormCommand.h"
+#include "FormInset.h"
struct FD_form_url;
/** This class provides an XForms implementation of the FormUrl Dialog.
/// Build the dialog
virtual void build();
/// Update dialog before showing it
- virtual void update();
+ virtual void update(bool switched = false);
/// Apply from dialog (modify or create inset)
virtual void apply();
/// Pointer to the actual instantiation of the xform's form
FormCitation.h \
form_citation.C \
form_citation.h \
- FormCommand.C \
- FormCommand.h \
FormCopyright.C \
FormCopyright.h \
form_copyright.C \
FormIndex.h \
form_index.C \
form_index.h \
+ FormInset.C \
+ FormInset.h \
FormParagraph.C \
FormParagraph.h \
form_paragraph.C \
fdui->form = fl_bgn_form(FL_NO_BOX, 450, 320);
fdui->form->u_vdata = this;
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 320, "");
- fdui->input_popup_font = obj = fl_add_input(FL_NORMAL_INPUT, 230, 50, 200, 30, _("Popup Font"));
+ fdui->input_popup_font = obj = fl_add_input(FL_NORMAL_INPUT, 230, 30, 200, 30, _("Popup Font"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- fdui->input_menu_font = obj = fl_add_input(FL_NORMAL_INPUT, 230, 80, 200, 30, _("Menu Font"));
+ fdui->input_menu_font = obj = fl_add_input(FL_NORMAL_INPUT, 230, 60, 200, 30, _("Menu Font"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- fdui->input_popup_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 230, 110, 200, 30, _("Popup Encoding"));
+ fdui->input_popup_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 230, 90, 200, 30, _("Popup Encoding"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- fdui->input_bind_file = obj = fl_add_input(FL_NORMAL_INPUT, 160, 210, 190, 30, idex(_("Bind file|#B")));
+ fdui->input_bind_file = obj = fl_add_input(FL_NORMAL_INPUT, 160, 178, 190, 30, idex(_("Bind file|#B")));
fl_set_button_shortcut(obj, scex(_("Bind file|#B")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- fdui->button_bind_file_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 210, 80, 30, _("Browse..."));
+ fdui->button_bind_file_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 178, 80, 30, _("Browse..."));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fdui->input_ui_file = obj = fl_add_input(FL_NORMAL_INPUT, 160, 180, 190, 30, idex(_("User Interface file|#U")));
+ fdui->input_ui_file = obj = fl_add_input(FL_NORMAL_INPUT, 160, 148, 190, 30, idex(_("User Interface file|#U")));
fl_set_button_shortcut(obj, scex(_("User Interface file|#U")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- fdui->button_ui_file_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 180, 80, 30, _("Browse..."));
+ fdui->button_ui_file_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 148, 80, 30, _("Browse..."));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fdui->check_override_x_dead_keys = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 24, 230, 310, 30, idex(_("Override X-Windows dead-keys|#O")));
+ fl_set_button_shortcut(obj, scex(_("Override X-Windows dead-keys|#O")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fl_set_button(obj, 1);
fl_end_form();
fdui->form->fdui = fdui;
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->button_backup_path_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 170, 90, 30, _("Browse..."));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fdui->input_serverpipe = obj = fl_add_input(FL_NORMAL_INPUT, 169, 217, 170, 30, _("LyXServer pipe"));
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->button_serverpipe_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 339, 217, 90, 30, _("Browse..."));
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_end_form();
fdui->form->fdui = fdui;
FL_OBJECT *obj;
FD_form_outputs_general *fdui = new FD_form_outputs_general;
- fdui->form = fl_bgn_form(FL_NO_BOX, 450, 320);
+ fdui->form = fl_bgn_form(FL_NO_BOX, 455, 345);
fdui->form->u_vdata = this;
- obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 320, "");
+ obj = fl_add_box(FL_FLAT_BOX, 0, 0, 455, 345, "");
fdui->counter_line_len = obj = fl_add_counter(FL_SIMPLE_COUNTER, 295, 50, 120, 30, idex(_("Ascii line length|#A")));
fl_set_button_shortcut(obj, scex(_("Ascii line length|#A")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
FL_OBJECT *button_bind_file_browse;
FL_OBJECT *input_ui_file;
FL_OBJECT *button_ui_file_browse;
+ FL_OBJECT *check_override_x_dead_keys;
};
struct FD_form_printer {
~FD_form_printer();
FL_OBJECT *check_make_backups;
FL_OBJECT *input_backup_path;
FL_OBJECT *button_backup_path_browse;
+ FL_OBJECT *input_serverpipe;
+ FL_OBJECT *button_serverpipe_browse;
};
struct FD_form_preferences {
~FD_form_preferences();
Name: form_interface
Width: 450
Height: 320
-Number of Objects: 8
+Number of Objects: 9
--------------------
class: FL_BOX
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 230 50 200 30
+box: 230 30 200 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 230 80 200 30
+box: 230 60 200 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 230 110 200 30
+box: 230 90 200 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 160 210 190 30
+box: 160 178 190 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 350 210 80 30
+box: 350 178 80 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 160 180 190 30
+box: 160 148 190 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 350 180 80 30
+box: 350 148 80 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
callback:
argument:
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 24 230 310 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Override X-Windows dead-keys|#O
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: check_override_x_dead_keys
+callback: C_FormBaseInputCB
+argument: 0
+ value: 1
+
=============== FORM ===============
Name: form_printer
Width: 450
Name: form_paths
Width: 450
Height: 320
-Number of Objects: 15
+Number of Objects: 17
--------------------
class: FL_BOX
callback:
argument:
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 169 217 170 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: LyXServer pipe
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_serverpipe
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 339 217 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Browse...
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_serverpipe_browse
+callback:
+argument:
+
=============== FORM ===============
Name: form_preferences
Width: 470
=============== FORM ===============
Name: form_outputs_general
-Width: 450
-Height: 320
+Width: 455
+Height: 345
Number of Objects: 2
--------------------
class: FL_BOX
type: FLAT_BOX
-box: 0 0 450 320
+box: 0 0 455 345
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
// This is another function we really don't want.
// Again the Signal/Slot mechanism is tailor made for this task.
-void updateAllVisibleBufferRelatedDialogs()
+void updateAllVisibleBufferRelatedDialogs(bool)
{
if (fd_form_preamble->form_preamble->visible) {
UpdateLayoutPreamble();
void CloseAllBufferRelatedDialogs();
/// Ensures info in visible popups are always correct.
-void updateAllVisibleBufferRelatedDialogs();
+void updateAllVisibleBufferRelatedDialogs(bool switched = false);
/* These shortcut extractors should be shifted to frontends/xforms/ eventually */