mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-19 22:40:26 +00:00
Angus's FormInset work; Dekel's languages patch; my reworking of Angus's stuff + other xforms cleanup; No guarantee I got the kde or gnome stuff right wrt updateBufferDependent
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1110 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cff99d6de1
commit
ba01a232ea
126
ChangeLog
126
ChangeLog
@ -1,3 +1,129 @@
|
||||
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
|
||||
|
@ -583,8 +583,8 @@
|
||||
#\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.
|
||||
|
@ -109,12 +109,12 @@ $(srcdir)/stamp-cat-id: $(PACKAGE).pot
|
||||
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:
|
||||
|
@ -48,6 +48,7 @@ src/frontends/xforms/FormGraphics.C
|
||||
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
|
||||
|
@ -164,7 +164,7 @@ void BufferView::Pimpl::buffer(Buffer * b)
|
||||
// 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 {
|
||||
|
@ -179,7 +179,7 @@ void Buffer::setReadonly(bool flag)
|
||||
if (read_only != flag) {
|
||||
read_only = flag;
|
||||
updateTitles();
|
||||
users->owner()->getDialogs()->updateBufferDependent();
|
||||
users->owner()->getDialogs()->updateBufferDependent(false);
|
||||
}
|
||||
if (read_only) {
|
||||
WarnReadonly(filename);
|
||||
|
@ -333,6 +333,8 @@ void Encodings::read(string const & filename)
|
||||
case et_end:
|
||||
lex.printError("Encodings::read: Misplaced end");
|
||||
break;
|
||||
case LyXLex::LEX_FEOF:
|
||||
break;
|
||||
default:
|
||||
lex.printError("Encodings::read: "
|
||||
"Unknown tag: `$$Token'");
|
||||
|
@ -38,6 +38,7 @@
|
||||
NoRepeatedApply | N | Y | N
|
||||
NoRepeatedApplyReadOnly | Y | Y | N
|
||||
Preferences | N | Y | No (Ok-Close)
|
||||
Ignorant | N/A | N/A | N/A
|
||||
========================================================================
|
||||
|
||||
Policy
|
||||
@ -61,6 +62,8 @@
|
||||
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:
|
||||
@ -417,4 +420,27 @@ private:
|
||||
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
|
||||
|
@ -50,19 +50,9 @@ public:
|
||||
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
|
||||
|
@ -65,11 +65,14 @@ public:
|
||||
/// 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.
|
||||
|
@ -94,6 +94,9 @@ void FormCitation::showInset( InsetCommand * const inset )
|
||||
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));
|
||||
|
||||
|
@ -46,7 +46,7 @@ private:
|
||||
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() { }
|
||||
|
||||
|
@ -36,7 +36,7 @@ private:
|
||||
/// 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_;
|
||||
|
@ -102,7 +102,7 @@ void FormError::show()
|
||||
}
|
||||
}
|
||||
|
||||
void FormError::update()
|
||||
void FormError::update(bool)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ private:
|
||||
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.
|
||||
|
@ -138,8 +138,13 @@ void FormIndex::show()
|
||||
}
|
||||
}
|
||||
|
||||
void FormIndex::update()
|
||||
void FormIndex::update(bool switched)
|
||||
{
|
||||
if (switched) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (dialog_ != NULL &&
|
||||
lv_->view()->available())
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ private:
|
||||
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.
|
||||
|
@ -169,7 +169,8 @@ void FormPrint::apply()
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::update()
|
||||
// we can safely ignore the parameter because we can always update
|
||||
void FormPrint::update(bool)
|
||||
{
|
||||
if (dialog_ != NULL &&
|
||||
lv_->view()->available())
|
||||
|
@ -58,7 +58,7 @@ private:
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Update the dialog.
|
||||
void update();
|
||||
void update(bool = false);
|
||||
/// Free memory
|
||||
void free();
|
||||
//@}
|
||||
|
@ -72,7 +72,7 @@ private:
|
||||
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.
|
||||
|
@ -136,7 +136,8 @@ void FormToc::show()
|
||||
}
|
||||
|
||||
|
||||
void FormToc::update()
|
||||
// we can safely ignore the parameter because we can always update
|
||||
void FormToc::update(bool)
|
||||
{
|
||||
Buffer::TocType type;
|
||||
string wintitle;
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
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.
|
||||
|
@ -150,8 +150,13 @@ void FormUrl::show()
|
||||
}
|
||||
}
|
||||
|
||||
void FormUrl::update()
|
||||
void FormUrl::update(bool switched)
|
||||
{
|
||||
if (switched) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (dialog_ != NULL &&
|
||||
lv_->view()->available())
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
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.
|
||||
|
@ -109,7 +109,9 @@ void FormCitation::updateAvailableList()
|
||||
dialog_->keys->update();
|
||||
}
|
||||
|
||||
void FormCitation::update()
|
||||
|
||||
// we can safely ignore the parameter because we can always update
|
||||
void FormCitation::update(bool)
|
||||
{
|
||||
keys.clear();
|
||||
|
||||
|
@ -61,7 +61,7 @@ private:
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Update the dialog.
|
||||
void update();
|
||||
void update(bool switched = false);
|
||||
|
||||
/// create a Citation inset
|
||||
void createCitation(string const &);
|
||||
|
@ -39,7 +39,7 @@ private:
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Not used but we've got to implement it.
|
||||
void update() {}
|
||||
void update(bool) {}
|
||||
|
||||
/// Real GUI implementation.
|
||||
FormCopyrightDialog * dialog_;
|
||||
|
@ -63,8 +63,13 @@ void FormIndex::createIndex(string const & arg)
|
||||
show();
|
||||
}
|
||||
|
||||
void FormIndex::update()
|
||||
void FormIndex::update(bool switched)
|
||||
{
|
||||
if (switched) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
dialog_->setIndexText(params.getContents().c_str());
|
||||
// dialog_->setReadOnly(readonly);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Update the dialog.
|
||||
void update();
|
||||
void update(bool = false);
|
||||
|
||||
/// create an Index inset
|
||||
void createIndex(string const &);
|
||||
|
@ -52,7 +52,8 @@ FormPrint::~FormPrint()
|
||||
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;
|
||||
|
@ -43,7 +43,7 @@ private:
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Update the dialog.
|
||||
void update();
|
||||
void update(bool = false);
|
||||
|
||||
/// Real GUI implementation.
|
||||
FormPrintDialog * dialog_;
|
||||
|
@ -154,8 +154,13 @@ void FormRef::do_ref_update()
|
||||
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());
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
/// 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
|
||||
|
@ -190,7 +190,8 @@ void FormToc::set_depth(int newdepth)
|
||||
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);
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
/// 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
|
||||
|
@ -63,8 +63,14 @@ void FormUrl::createUrl(string const & arg)
|
||||
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());
|
||||
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Update the dialog.
|
||||
void update();
|
||||
void update(bool switched = false);
|
||||
|
||||
/// create a URL inset
|
||||
void createUrl(string const &);
|
||||
|
@ -31,10 +31,8 @@ C_GENERICCB(FormBase, RestoreCB)
|
||||
|
||||
|
||||
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)
|
||||
{}
|
||||
|
||||
|
||||
@ -52,13 +50,10 @@ void FormBase::show()
|
||||
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 {
|
||||
@ -74,48 +69,11 @@ void FormBase::show()
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@ -167,3 +125,46 @@ void FormBase::RestoreCB(FL_OBJECT * ob, long)
|
||||
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();
|
||||
}
|
||||
|
@ -27,34 +27,17 @@ class LyXView;
|
||||
#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();
|
||||
|
||||
@ -76,10 +59,12 @@ protected: // methods
|
||||
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
|
||||
@ -88,8 +73,6 @@ protected: // methods
|
||||
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
|
||||
@ -105,18 +88,10 @@ protected: // methods
|
||||
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.
|
||||
@ -124,18 +99,8 @@ protected: // data
|
||||
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.
|
||||
@ -144,4 +109,46 @@ private: // data
|
||||
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
|
||||
|
@ -37,7 +37,7 @@ using std::find;
|
||||
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
|
||||
@ -60,11 +60,13 @@ FL_FORM * FormCitation::form() const
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::clearStore()
|
||||
void FormCitation::disconnect()
|
||||
{
|
||||
citekeys.clear();
|
||||
bibkeys.clear();
|
||||
bibkeysInfo.clear();
|
||||
|
||||
FormCommand::disconnect();
|
||||
}
|
||||
|
||||
|
||||
@ -75,8 +77,13 @@ void FormCitation::build()
|
||||
}
|
||||
|
||||
|
||||
void FormCitation::update()
|
||||
void FormCitation::update(bool switched)
|
||||
{
|
||||
if (switched) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
bibkeys.clear();
|
||||
bibkeysInfo.clear();
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "FormCommand.h"
|
||||
#include "FormInset.h"
|
||||
struct FD_form_citation;
|
||||
|
||||
/** This class provides an XForms implementation of the FormCitation Dialog.
|
||||
@ -47,16 +47,17 @@ private:
|
||||
///
|
||||
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;
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
// -*- 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();
|
||||
}
|
@ -16,8 +16,7 @@
|
||||
#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
|
||||
|
@ -27,7 +27,7 @@ struct FD_form_copyright;
|
||||
|
||||
/** 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 *);
|
||||
|
@ -45,8 +45,8 @@ using Liason::setMinibuffer;
|
||||
#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)
|
||||
@ -299,7 +299,8 @@ void FormDocument::cancel()
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::update()
|
||||
// we can safely ignore the parameter because we can always update
|
||||
void FormDocument::update(bool)
|
||||
{
|
||||
if (!dialog_)
|
||||
return;
|
||||
|
@ -34,8 +34,9 @@ struct FD_form_doc_bullet;
|
||||
|
||||
/** 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 *);
|
||||
@ -83,15 +84,11 @@ private:
|
||||
/// 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;
|
||||
|
@ -23,8 +23,8 @@
|
||||
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
|
||||
@ -46,26 +46,35 @@ FL_FORM * FormError::form() const
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
|
@ -16,28 +16,29 @@
|
||||
#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
|
||||
@ -45,8 +46,8 @@ private:
|
||||
|
||||
/// 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_;
|
||||
};
|
||||
|
@ -288,8 +288,17 @@ void FormGraphics::apply()
|
||||
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
|
||||
|
@ -88,7 +88,7 @@ private:
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Update the dialog
|
||||
void update();
|
||||
void update(bool switched = false);
|
||||
|
||||
/// Apply the changes to the inset.
|
||||
void apply();
|
||||
|
@ -26,7 +26,7 @@
|
||||
#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
|
||||
@ -53,14 +53,22 @@ void FormIndex::build()
|
||||
{
|
||||
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);
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "FormCommand.h"
|
||||
#include "FormInset.h"
|
||||
struct FD_form_index;
|
||||
|
||||
/** This class provides an XForms implementation of the FormIndex Dialog.
|
||||
@ -31,7 +31,7 @@ private:
|
||||
/// 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
|
||||
|
88
src/frontends/xforms/FormInset.C
Normal file
88
src/frontends/xforms/FormInset.C
Normal file
@ -0,0 +1,88 @@
|
||||
// -*- 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();
|
||||
}
|
@ -19,28 +19,53 @@
|
||||
#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 FormBase {
|
||||
class FormCommand : public FormInset {
|
||||
public:
|
||||
/// Constructor
|
||||
FormCommand( LyXView *, Dialogs *, string const &,
|
||||
ChangedBufferAction,
|
||||
ButtonPolicy * bp = new OkCancelReadOnlyPolicy );
|
||||
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 (if any)
|
||||
/// pointer to the inset passed through showInset
|
||||
InsetCommand * inset_;
|
||||
/// the nitty-griity. What is modified and passed back
|
||||
InsetCommandParams params;
|
||||
/// inset::hide connection.
|
||||
Connection ih_;
|
||||
};
|
||||
|
||||
#endif
|
@ -30,8 +30,8 @@ using Liason::setMinibuffer;
|
||||
#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
|
||||
@ -88,6 +88,8 @@ void FormParagraph::build()
|
||||
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);
|
||||
@ -106,6 +108,8 @@ void FormParagraph::build()
|
||||
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);
|
||||
@ -128,13 +132,15 @@ void FormParagraph::apply()
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
@ -183,7 +189,8 @@ void FormParagraph::general_apply()
|
||||
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))
|
||||
@ -208,7 +215,8 @@ void FormParagraph::general_apply()
|
||||
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))
|
||||
|
@ -25,8 +25,9 @@ struct FD_form_paragraph_general;
|
||||
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 *);
|
||||
@ -35,11 +36,11 @@ public:
|
||||
|
||||
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);
|
||||
|
||||
|
@ -28,8 +28,7 @@ using SigC::slot;
|
||||
|
||||
|
||||
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)
|
||||
@ -156,6 +155,7 @@ void FormPreferences::build()
|
||||
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);
|
||||
@ -206,6 +206,7 @@ void FormPreferences::build()
|
||||
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);
|
||||
@ -213,6 +214,7 @@ void FormPreferences::build()
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -225,7 +227,7 @@ FL_FORM * FormPreferences::form() const
|
||||
|
||||
void FormPreferences::connect()
|
||||
{
|
||||
FormBase::connect();
|
||||
FormBaseBI::connect();
|
||||
fl_set_form_minsize(dialog_->form,
|
||||
minw_,
|
||||
minh_);
|
||||
@ -266,6 +268,8 @@ void FormPreferences::apply()
|
||||
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) ||
|
||||
@ -370,13 +374,15 @@ void FormPreferences::apply()
|
||||
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
|
||||
@ -441,6 +447,8 @@ void FormPreferences::update()
|
||||
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);
|
||||
@ -497,6 +505,7 @@ void FormPreferences::update()
|
||||
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);
|
||||
@ -511,37 +520,86 @@ bool FormPreferences::input(FL_OBJECT *, long)
|
||||
//
|
||||
// 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: Path is wrong\n";
|
||||
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: 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.
|
||||
|
@ -38,7 +38,7 @@ struct FD_form_outputs_general;
|
||||
/** 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 *);
|
||||
@ -48,7 +48,7 @@ private:
|
||||
///
|
||||
virtual void connect();
|
||||
/// Update the dialog.
|
||||
virtual void update();
|
||||
virtual void update(bool = false);
|
||||
///
|
||||
virtual void hide();
|
||||
/// OK from dialog
|
||||
|
@ -34,8 +34,7 @@ using Liason::getPrinterParams;
|
||||
|
||||
|
||||
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
|
||||
@ -110,7 +109,7 @@ void FormPrint::build()
|
||||
|
||||
void FormPrint::connect()
|
||||
{
|
||||
FormBase::connect();
|
||||
FormBaseBD::connect();
|
||||
fl_set_form_minsize(dialog_->form,
|
||||
dialog_->form->w,
|
||||
dialog_->form->h);
|
||||
@ -164,7 +163,8 @@ void FormPrint::apply()
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::update()
|
||||
// we can safely ignore the parameter because we can always update
|
||||
void FormPrint::update(bool)
|
||||
{
|
||||
if (dialog_
|
||||
&& lv_->view()->available()) {
|
||||
|
@ -31,7 +31,7 @@ struct FD_form_print;
|
||||
/** 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 *);
|
||||
@ -40,7 +40,7 @@ public:
|
||||
|
||||
private:
|
||||
/// Update the dialog.
|
||||
virtual void update();
|
||||
virtual void update(bool switched = false);
|
||||
/// Apply from dialog
|
||||
virtual void apply();
|
||||
/// Filter the inputs
|
||||
|
@ -34,7 +34,7 @@ static int formw;
|
||||
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
|
||||
@ -57,9 +57,10 @@ FL_FORM * FormRef::form() const
|
||||
}
|
||||
|
||||
|
||||
void FormRef::clearStore()
|
||||
void FormRef::disconnect()
|
||||
{
|
||||
refs.clear();
|
||||
FormCommand::disconnect();
|
||||
}
|
||||
|
||||
|
||||
@ -90,8 +91,13 @@ void FormRef::build()
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
|
||||
@ -272,7 +278,8 @@ bool FormRef::input( FL_OBJECT *, long data )
|
||||
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;
|
||||
|
||||
@ -316,7 +323,8 @@ bool FormRef::input( FL_OBJECT *, long data )
|
||||
// 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;
|
||||
|
@ -16,7 +16,7 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "FormCommand.h"
|
||||
#include "FormInset.h"
|
||||
struct FD_form_ref;
|
||||
|
||||
/** This class provides an XForms implementation of the FormRef Dialog.
|
||||
@ -51,16 +51,17 @@ private:
|
||||
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;
|
||||
|
||||
|
@ -150,7 +150,7 @@ void FormTabular::hideInset(InsetTabular * ti)
|
||||
}
|
||||
|
||||
|
||||
void FormTabular::update()
|
||||
void FormTabular::update(bool)
|
||||
{
|
||||
if (dialog_) {
|
||||
local_update(true);
|
||||
|
@ -7,8 +7,6 @@
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file copyright 1999-2000
|
||||
* Allan Rae
|
||||
*======================================================*/
|
||||
/* FormTabular.h
|
||||
* FormTabular Interface Class
|
||||
@ -70,7 +68,7 @@ private:
|
||||
///
|
||||
void hideInset(InsetTabular *);
|
||||
/// Update the dialog.
|
||||
void update();
|
||||
void update(bool = false);
|
||||
///
|
||||
void updateInset(InsetTabular *);
|
||||
///
|
||||
|
@ -27,8 +27,13 @@
|
||||
#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
|
||||
@ -51,9 +56,10 @@ FL_FORM * FormToc::form() const
|
||||
}
|
||||
|
||||
|
||||
void FormToc::clearStore()
|
||||
void FormToc::disconnect()
|
||||
{
|
||||
toclist.clear();
|
||||
FormCommand::disconnect();
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +73,8 @@ void FormToc::build()
|
||||
}
|
||||
|
||||
|
||||
void FormToc::update()
|
||||
// we can safely ignore the parameter because we can always update
|
||||
void FormToc::update(bool)
|
||||
{
|
||||
Buffer::TocType type;
|
||||
|
||||
@ -94,7 +101,8 @@ void FormToc::updateToc()
|
||||
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;
|
||||
}
|
||||
|
||||
@ -129,7 +137,8 @@ void FormToc::updateToc()
|
||||
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 );
|
||||
|
@ -16,7 +16,7 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "FormCommand.h"
|
||||
#include "FormInset.h"
|
||||
#include "buffer.h"
|
||||
struct FD_form_toc;
|
||||
|
||||
@ -29,14 +29,15 @@ public:
|
||||
///
|
||||
~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;
|
||||
///
|
||||
|
@ -26,7 +26,7 @@
|
||||
#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
|
||||
@ -53,14 +53,23 @@ void FormUrl::build()
|
||||
{
|
||||
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);
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "FormCommand.h"
|
||||
#include "FormInset.h"
|
||||
struct FD_form_url;
|
||||
|
||||
/** This class provides an XForms implementation of the FormUrl Dialog.
|
||||
@ -31,7 +31,7 @@ private:
|
||||
/// 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
|
||||
|
@ -21,8 +21,6 @@ libxforms_la_SOURCES = \
|
||||
FormCitation.h \
|
||||
form_citation.C \
|
||||
form_citation.h \
|
||||
FormCommand.C \
|
||||
FormCommand.h \
|
||||
FormCopyright.C \
|
||||
FormCopyright.h \
|
||||
form_copyright.C \
|
||||
@ -43,6 +41,8 @@ libxforms_la_SOURCES = \
|
||||
FormIndex.h \
|
||||
form_index.C \
|
||||
form_index.h \
|
||||
FormInset.C \
|
||||
FormInset.h \
|
||||
FormParagraph.C \
|
||||
FormParagraph.h \
|
||||
form_paragraph.C \
|
||||
|
@ -170,27 +170,32 @@ FD_form_interface * FormPreferences::build_interface()
|
||||
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;
|
||||
@ -339,6 +344,11 @@ FD_form_paths * FormPreferences::build_paths()
|
||||
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;
|
||||
@ -427,9 +437,9 @@ FD_form_outputs_general * FormPreferences::build_outputs_general()
|
||||
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);
|
||||
|
@ -70,6 +70,7 @@ struct FD_form_interface {
|
||||
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();
|
||||
@ -112,6 +113,8 @@ struct FD_form_paths {
|
||||
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();
|
||||
|
@ -510,7 +510,7 @@ argument: 0
|
||||
Name: form_interface
|
||||
Width: 450
|
||||
Height: 320
|
||||
Number of Objects: 8
|
||||
Number of Objects: 9
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
@ -533,7 +533,7 @@ argument:
|
||||
--------------------
|
||||
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
|
||||
@ -551,7 +551,7 @@ argument: 0
|
||||
--------------------
|
||||
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
|
||||
@ -569,7 +569,7 @@ argument: 0
|
||||
--------------------
|
||||
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
|
||||
@ -587,7 +587,7 @@ argument: 0
|
||||
--------------------
|
||||
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
|
||||
@ -605,7 +605,7 @@ argument: 0
|
||||
--------------------
|
||||
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
|
||||
@ -623,7 +623,7 @@ argument:
|
||||
--------------------
|
||||
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
|
||||
@ -641,7 +641,7 @@ argument: 0
|
||||
--------------------
|
||||
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
|
||||
@ -656,6 +656,25 @@ name: button_ui_file_browse
|
||||
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
|
||||
@ -1026,7 +1045,7 @@ argument:
|
||||
Name: form_paths
|
||||
Width: 450
|
||||
Height: 320
|
||||
Number of Objects: 15
|
||||
Number of Objects: 17
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
@ -1305,6 +1324,42 @@ name: button_backup_path_browse
|
||||
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
|
||||
@ -1499,14 +1554,14 @@ argument:
|
||||
|
||||
=============== 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
|
||||
|
@ -143,7 +143,7 @@ void CloseAllBufferRelatedDialogs()
|
||||
|
||||
// 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();
|
||||
|
@ -33,7 +33,7 @@ extern "C" int IgnoreCloseBoxCB(FL_FORM *, void *);
|
||||
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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user