mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Move the float dialog to the new scheme.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6355 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cba75d4489
commit
5449effb05
@ -1,3 +1,8 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.h: remove showFloat.
|
||||
* guiapi.[Ch]: remove gui_ShowFloat.
|
||||
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.h: remove showInclude.
|
||||
|
@ -23,7 +23,6 @@ class Dialog;
|
||||
class InsetBase;
|
||||
class LyXView;
|
||||
|
||||
class InsetFloat;
|
||||
class InsetWrap;
|
||||
class InsetGraphics;
|
||||
class InsetInfo;
|
||||
@ -88,8 +87,6 @@ public:
|
||||
/// show the contents of a file.
|
||||
void showFile(string const &);
|
||||
///
|
||||
void showFloat(InsetFloat *);
|
||||
///
|
||||
void showWrap(InsetWrap *);
|
||||
/// show all forked child processes
|
||||
void showForks();
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlFloat.[Ch]: rewrite to use the Dialog-based scheme.
|
||||
* ControlInclude.C: remove unneeded header files.
|
||||
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlFloat.[Ch]: replace FloatParams with InsetFloatParams.
|
||||
|
@ -10,31 +10,31 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlFloat.h"
|
||||
#include "BufferView.h"
|
||||
#include "buffer.h"
|
||||
#include "funcrequest.h"
|
||||
|
||||
|
||||
ControlFloat::ControlFloat(LyXView & lv, Dialogs & d)
|
||||
: ControlInset<InsetFloat, InsetFloatParams>(lv, d)
|
||||
ControlFloat::ControlFloat(Dialog & parent)
|
||||
: Dialog::Controller(parent)
|
||||
{}
|
||||
|
||||
|
||||
void ControlFloat::applyParamsToInset()
|
||||
void ControlFloat::initialiseParams(string const & data)
|
||||
{
|
||||
inset()->placement(params().placement);
|
||||
inset()->wide(params().wide, bufferview()->buffer()->params);
|
||||
bufferview()->updateInset(inset(), true);
|
||||
|
||||
InsetFloatParams params;
|
||||
InsetFloatMailer::string2params(data, params);
|
||||
params_.reset(new InsetFloatParams(params));
|
||||
}
|
||||
|
||||
|
||||
void ControlFloat::applyParamsNoInset()
|
||||
{}
|
||||
|
||||
|
||||
InsetFloatParams const ControlFloat::getParams(InsetFloat const & inset)
|
||||
void ControlFloat::clearParams()
|
||||
{
|
||||
return inset.params();
|
||||
params_.reset();
|
||||
}
|
||||
|
||||
|
||||
void ControlFloat::dispatchParams()
|
||||
{
|
||||
string const lfun = InsetFloatMailer::params2string("float", params());
|
||||
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
|
||||
}
|
||||
|
@ -13,39 +13,31 @@
|
||||
#define CONTROLFLOAT_H
|
||||
|
||||
|
||||
#include "ControlInset.h"
|
||||
#include "Dialog.h"
|
||||
#include "insets/insetfloat.h"
|
||||
|
||||
inline
|
||||
bool operator==(InsetFloatParams const & p1, InsetFloatParams const & p2)
|
||||
{
|
||||
return p1.placement == p2.placement && p1.wide == p2.wide;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
bool operator!=(InsetFloatParams const & p1, InsetFloatParams const & p2)
|
||||
{
|
||||
return !(p1 == p2);
|
||||
}
|
||||
|
||||
|
||||
/** A controller for Minipage dialogs.
|
||||
*/
|
||||
class ControlFloat : public ControlInset<InsetFloat, InsetFloatParams> {
|
||||
class ControlFloat : public Dialog::Controller {
|
||||
public:
|
||||
///
|
||||
ControlFloat(LyXView &, Dialogs &);
|
||||
private:
|
||||
/// Dispatch the changed parameters to the kernel.
|
||||
virtual void applyParamsToInset();
|
||||
ControlFloat(Dialog &);
|
||||
///
|
||||
virtual void applyParamsNoInset();
|
||||
/// get the parameters from the string passed to createInset.
|
||||
virtual InsetFloatParams const getParams(string const &)
|
||||
{ return InsetFloatParams(); }
|
||||
/// get the parameters from the inset passed to showInset.
|
||||
virtual InsetFloatParams const getParams(InsetFloat const &);
|
||||
virtual void initialiseParams(string const & data);
|
||||
/// clean-up on hide.
|
||||
virtual void clearParams();
|
||||
/// clean-up on hide.
|
||||
virtual void dispatchParams();
|
||||
///
|
||||
virtual bool isBufferDependent() const { return true; }
|
||||
///
|
||||
InsetFloatParams & params() { return *params_.get(); }
|
||||
///
|
||||
InsetFloatParams const & params() const { return *params_.get(); }
|
||||
private:
|
||||
///
|
||||
boost::scoped_ptr<InsetFloatParams> params_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -13,17 +13,12 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "ControlInclude.h"
|
||||
|
||||
#include "helper_funcs.h"
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "funcrequest.h"
|
||||
#include "gettext.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "lyxrc.h"
|
||||
|
||||
#include "frontends/Alert.h"
|
||||
|
||||
#include "support/filetools.h"
|
||||
|
||||
#include <utility>
|
||||
|
@ -51,17 +51,12 @@ void gui_ShowFile(string const & f, Dialogs & d)
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowFloat(InsetFloat * ifl, Dialogs & d)
|
||||
{
|
||||
d.showFloat(ifl);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowWrap(InsetWrap * iw, Dialogs & d)
|
||||
{
|
||||
d.showWrap(iw);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowForks(Dialogs & d)
|
||||
{
|
||||
d.showForks();
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "LString.h"
|
||||
|
||||
class Dialogs;
|
||||
class InsetFloat;
|
||||
class InsetWrap;
|
||||
class InsetGraphics;
|
||||
class InsetMinipage;
|
||||
@ -31,7 +30,6 @@ void gui_ShowCharacter(Dialogs &);
|
||||
void gui_SetUserFreeFont(Dialogs &);
|
||||
void gui_ShowDocument(Dialogs &);
|
||||
void gui_ShowFile(string const &, Dialogs &);
|
||||
void gui_ShowFloat(InsetFloat *, Dialogs &);
|
||||
void gui_ShowForks(Dialogs &);
|
||||
void gui_ShowGraphics(InsetGraphics *, Dialogs &);
|
||||
void gui_ShowLogFile(Dialogs &);
|
||||
|
@ -1,3 +1,13 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* QFloat.[Ch]: changes to use the new Dialog-based scheme.
|
||||
|
||||
* Dialogs.C:
|
||||
* Dialogs2.C:
|
||||
* Dialogs_impl.h: remove float dialog.
|
||||
|
||||
* Dialogs3.C: add float dialog.
|
||||
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* QFloat.C (update_contents): rename FloatParams as InsetFloatParams.
|
||||
|
@ -31,7 +31,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
character(lv, d),
|
||||
document(lv, d),
|
||||
file(lv, d),
|
||||
floats(lv, d),
|
||||
graphics(lv, d),
|
||||
logfile(lv, d),
|
||||
minipage(lv, d),
|
||||
|
@ -51,12 +51,6 @@ void Dialogs::showFile(string const & f)
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showFloat(InsetFloat * ifl)
|
||||
{
|
||||
pimpl_->floats.controller().showInset(ifl);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showForks()
|
||||
{}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ControlError.h"
|
||||
#include "ControlERT.h"
|
||||
#include "ControlExternal.h"
|
||||
#include "ControlFloat.h"
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlIndex.h"
|
||||
#include "ControlLabel.h"
|
||||
@ -38,6 +39,8 @@
|
||||
#include "QERTDialog.h"
|
||||
#include "QExternal.h"
|
||||
#include "QExternalDialog.h"
|
||||
#include "QFloat.h"
|
||||
#include "QFloatDialog.h"
|
||||
// Here would be an appropriate point to lecture on the evils
|
||||
// of the Qt headers, those most fucked up of disgusting ratholes.
|
||||
// But I won't.
|
||||
@ -73,8 +76,9 @@ typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
namespace {
|
||||
|
||||
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
"error", "ert", "external", "include",
|
||||
"index", "label", "ref", "toc", "url" };
|
||||
"error", "ert", "external", "float",
|
||||
"include", "index", "label", "ref",
|
||||
"toc", "url" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
@ -130,6 +134,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlExternal(*dialog));
|
||||
dialog->setView(new QExternal(*dialog));
|
||||
dialog->setButtonController(new OkApplyCancelReadOnlyBC);
|
||||
} else if (name == "float") {
|
||||
dialog->setController(new ControlFloat(*dialog));
|
||||
dialog->setView(new QFloat(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "include") {
|
||||
dialog->setController(new ControlInclude(*dialog));
|
||||
dialog->setView(new QInclude(*dialog));
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "ControlChanges.h"
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlDocument.h"
|
||||
#include "ControlFloat.h"
|
||||
#include "ControlForks.h"
|
||||
#include "ControlGraphics.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
@ -45,8 +44,6 @@
|
||||
#include "QCharacterDialog.h"
|
||||
#include "QDocument.h"
|
||||
#include "QDocumentDialog.h"
|
||||
#include "QFloat.h"
|
||||
#include "QFloatDialog.h"
|
||||
//#include "QForks.h"
|
||||
// Here would be an appropriate point to lecture on the evils
|
||||
// of the Qt headers, those most fucked up of disgusting ratholes.
|
||||
@ -109,9 +106,6 @@ DocumentDialog;
|
||||
typedef GUI<ControlShowFile, QShowFile, OkCancelPolicy, Qt2BC>
|
||||
FileDialog;
|
||||
|
||||
typedef GUI<ControlFloat, QFloat, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
FloatDialog;
|
||||
|
||||
typedef GUI<ControlGraphics, QGraphics, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
GraphicsDialog;
|
||||
|
||||
@ -168,7 +162,6 @@ struct Dialogs::Impl {
|
||||
CharacterDialog character;
|
||||
DocumentDialog document;
|
||||
FileDialog file;
|
||||
FloatDialog floats;
|
||||
GraphicsDialog graphics;
|
||||
LogFileDialog logfile;
|
||||
MinipageDialog minipage;
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlFloat.h"
|
||||
#include "QFloatDialog.h"
|
||||
#include "QFloat.h"
|
||||
@ -22,11 +21,11 @@
|
||||
#include <qpushbutton.h>
|
||||
#include <qcheckbox.h>
|
||||
|
||||
typedef Qt2CB<ControlFloat, Qt2DB<QFloatDialog> > base_class;
|
||||
typedef QController<ControlFloat, QView<QFloatDialog> > base_class;
|
||||
|
||||
|
||||
QFloat::QFloat()
|
||||
: base_class(qt_("LyX: Float Settings"))
|
||||
QFloat::QFloat(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: Float Settings"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -13,20 +13,19 @@
|
||||
#define QFLOAT_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
|
||||
class ControlFloat;
|
||||
class QFloatDialog;
|
||||
|
||||
///
|
||||
class QFloat
|
||||
: public Qt2CB<ControlFloat, Qt2DB<QFloatDialog> >
|
||||
{
|
||||
class QFloat : public QController<ControlFloat, QView<QFloatDialog> > {
|
||||
public:
|
||||
///
|
||||
friend class QFloatDialog;
|
||||
///
|
||||
QFloat();
|
||||
QFloat(Dialog &);
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply();
|
||||
|
@ -1,3 +1,14 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormFloat.[Ch]:
|
||||
* forms/form_float.fd: changes to use the new Dialog-based scheme.
|
||||
|
||||
* Dialogs.C:
|
||||
* Dialogs2.C:
|
||||
* Dialogs_impl.h: remove float dialog.
|
||||
|
||||
* Dialogs3.C: add float dialog.
|
||||
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormInclude.[Ch]:
|
||||
|
@ -31,7 +31,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
character(lv, d),
|
||||
document(lv, d),
|
||||
file(lv, d),
|
||||
floats(lv, d),
|
||||
forks(lv, d),
|
||||
graphics(lv, d),
|
||||
logfile(lv, d),
|
||||
|
@ -51,12 +51,6 @@ void Dialogs::showFile(string const & f)
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showFloat(InsetFloat * ifl)
|
||||
{
|
||||
pimpl_->floats.controller().showInset(ifl);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showForks()
|
||||
{
|
||||
pimpl_->forks.controller().show();
|
||||
|
@ -39,6 +39,10 @@
|
||||
#include "FormExternal.h"
|
||||
#include "forms/form_external.h"
|
||||
|
||||
#include "ControlFloat.h"
|
||||
#include "FormFloat.h"
|
||||
#include "forms/form_float.h"
|
||||
|
||||
#include "ControlInclude.h"
|
||||
#include "FormInclude.h"
|
||||
#include "forms/form_include.h"
|
||||
@ -86,8 +90,9 @@ namespace {
|
||||
// "minipage", "ref", "tabular", "toc",
|
||||
// "url", "wrap" };
|
||||
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
"error", "ert", "external", "include",
|
||||
"index", "label", "ref", "toc", "url" };
|
||||
"error", "ert", "external", "float",
|
||||
"include", "index", "label", "ref",
|
||||
"toc", "url" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
@ -143,6 +148,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlExternal(*dialog));
|
||||
dialog->setView(new FormExternal(*dialog));
|
||||
dialog->setButtonController(new OkApplyCancelReadOnlyBC);
|
||||
} else if (name == "float") {
|
||||
dialog->setController(new ControlFloat(*dialog));
|
||||
dialog->setView(new FormFloat(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "include") {
|
||||
dialog->setController(new ControlInclude(*dialog));
|
||||
dialog->setView(new FormInclude(*dialog));
|
||||
|
@ -37,10 +37,6 @@
|
||||
#include "FormDocument.h"
|
||||
#include "forms/form_document.h"
|
||||
|
||||
#include "ControlFloat.h"
|
||||
#include "FormFloat.h"
|
||||
#include "forms/form_float.h"
|
||||
|
||||
#include "ControlForks.h"
|
||||
#include "FormForks.h"
|
||||
#include "forms/form_forks.h"
|
||||
@ -132,9 +128,6 @@ DocumentDialog;
|
||||
typedef GUI<ControlShowFile, FormShowFile, OkCancelPolicy, xformsBC>
|
||||
FileDialog;
|
||||
|
||||
typedef GUI<ControlFloat, FormFloat, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
FloatDialog;
|
||||
|
||||
typedef GUI<ControlForks, FormForks, OkApplyCancelPolicy, xformsBC>
|
||||
ForksDialog;
|
||||
|
||||
@ -199,7 +192,6 @@ struct Dialogs::Impl {
|
||||
CharacterDialog character;
|
||||
DocumentDialog document;
|
||||
FileDialog file;
|
||||
FloatDialog floats;
|
||||
ForksDialog forks;
|
||||
GraphicsDialog graphics;
|
||||
LogFileDialog logfile;
|
||||
|
@ -33,10 +33,10 @@ enum {
|
||||
} // namespace anon
|
||||
|
||||
|
||||
typedef FormCB<ControlFloat, FormDB<FD_float> > base_class;
|
||||
typedef FormController<ControlFloat, FormView<FD_float> > base_class;
|
||||
|
||||
FormFloat::FormFloat()
|
||||
: base_class(_("Float Options"))
|
||||
FormFloat::FormFloat(Dialog & parent)
|
||||
: base_class(parent, _("Float Options"))
|
||||
{}
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define FORMFLOAT_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
#include "RadioButtonGroup.h"
|
||||
|
||||
class ControlFloat;
|
||||
@ -22,10 +22,10 @@ struct FD_float;
|
||||
/** This class provides an XForms implementation of the Float
|
||||
Dialog.
|
||||
*/
|
||||
class FormFloat : public FormCB<ControlFloat, FormDB<FD_float> > {
|
||||
class FormFloat : public FormController<ControlFloat, FormView<FD_float> > {
|
||||
public:
|
||||
///
|
||||
FormFloat();
|
||||
FormFloat(Dialog &);
|
||||
private:
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply();
|
||||
|
@ -64,7 +64,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_East FL_NoGravity
|
||||
name: check_page
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -82,7 +82,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_West FL_NoGravity
|
||||
name: check_bottom
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -100,7 +100,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_West FL_NoGravity
|
||||
name: check_top
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -118,7 +118,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_East FL_NoGravity
|
||||
name: check_here
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -136,7 +136,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthWest FL_SouthWest
|
||||
name: button_restore
|
||||
callback: C_FormBaseRestoreCB
|
||||
callback: C_FormDialogView_RestoreCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -154,7 +154,7 @@ shortcut: ^M
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_ok
|
||||
callback: C_FormBaseOKCB
|
||||
callback: C_FormDialogView_OKCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -172,7 +172,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_apply
|
||||
callback: C_FormBaseApplyCB
|
||||
callback: C_FormDialogView_ApplyCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -190,7 +190,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_close
|
||||
callback: C_FormBaseCancelCB
|
||||
callback: C_FormDialogView_CancelCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -208,7 +208,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthWest FL_SouthWest
|
||||
name: check_wide
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -226,7 +226,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_force
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -262,7 +262,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_West FL_NoGravity
|
||||
name: radio_alternatives
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -280,7 +280,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_West FL_NoGravity
|
||||
name: radio_here_definitely
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -298,7 +298,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_West FL_NoGravity
|
||||
name: radio_default
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
value: 1
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetcollapsable.C (draw): cache the BufferView.
|
||||
|
||||
* insetfloat.[Ch]: define a new class InsetFloatMailer and use
|
||||
it to communicate with the frontend dialogs.
|
||||
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetfloat.[Ch]: move the params into a separate InsetFloatParams
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "frontends/Painter.h"
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
#include "support/LAssert.h"
|
||||
#include "support/LOstream.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
@ -184,6 +185,9 @@ void InsetCollapsable::draw_collapsed(Painter & pain,
|
||||
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
||||
int baseline, float & x, bool cleared) const
|
||||
{
|
||||
lyx::Assert(bv);
|
||||
cache(bv);
|
||||
|
||||
if (need_update != NONE) {
|
||||
const_cast<InsetText *>(&inset)->update(bv, f, true);
|
||||
bv->text->status(bv, LyXText::CHANGED_IN_DRAW);
|
||||
|
@ -12,22 +12,26 @@
|
||||
|
||||
|
||||
#include "insetfloat.h"
|
||||
#include "gettext.h"
|
||||
#include "lyxfont.h"
|
||||
#include "insettext.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "lyxtext.h"
|
||||
#include "insets/insettext.h"
|
||||
#include "support/LOstream.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "FloatList.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "debug.h"
|
||||
#include "Floating.h"
|
||||
#include "buffer.h"
|
||||
#include "FloatList.h"
|
||||
#include "funcrequest.h"
|
||||
#include "gettext.h"
|
||||
#include "iterators.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "lyxfont.h"
|
||||
#include "lyxlex.h"
|
||||
#include "lyxtext.h"
|
||||
|
||||
#include "support/LOstream.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "lyxlex.h"
|
||||
#include "iterators.h"
|
||||
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
@ -144,19 +148,44 @@ InsetFloat::InsetFloat(InsetFloat const & in, bool same_id)
|
||||
|
||||
InsetFloat::~InsetFloat()
|
||||
{
|
||||
hideDialog();
|
||||
InsetFloatMailer mailer(*this);
|
||||
mailer.hideDialog();
|
||||
}
|
||||
|
||||
|
||||
void InsetFloat::writeParams(ostream & os) const
|
||||
dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
Inset::RESULT result = UNDISPATCHED;
|
||||
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetFloatParams params;
|
||||
InsetFloatMailer::string2params(cmd.argument, params);
|
||||
|
||||
params_.placement = params.placement;
|
||||
params_.wide = params.wide;
|
||||
|
||||
cmd.view()->updateInset(this, true);
|
||||
result = DISPATCHED;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = InsetCollapsable::localDispatch(cmd);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void InsetFloatParams::write(ostream & os) const
|
||||
{
|
||||
os << "Float " // getInsetName()
|
||||
<< params_.type << '\n';
|
||||
<< type << '\n';
|
||||
|
||||
if (!params_.placement.empty()) {
|
||||
os << "placement " << params_.placement << "\n";
|
||||
if (!placement.empty()) {
|
||||
os << "placement " << placement << "\n";
|
||||
}
|
||||
if (params_.wide) {
|
||||
if (wide) {
|
||||
os << "wide true\n";
|
||||
} else {
|
||||
os << "wide false\n";
|
||||
@ -164,21 +193,14 @@ void InsetFloat::writeParams(ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetFloat::write(Buffer const * buf, ostream & os) const
|
||||
{
|
||||
writeParams(os);
|
||||
InsetCollapsable::write(buf, os);
|
||||
}
|
||||
|
||||
|
||||
void InsetFloat::readParams(Buffer const * buf, LyXLex & lex)
|
||||
void InsetFloatParams::read(LyXLex & lex)
|
||||
{
|
||||
if (lex.isOK()) {
|
||||
lex.next();
|
||||
string token = lex.getString();
|
||||
if (token == "placement") {
|
||||
lex.next();
|
||||
params_.placement = lex.getString();
|
||||
placement = lex.getString();
|
||||
} else {
|
||||
// take countermeasures
|
||||
lex.pushToken(token);
|
||||
@ -188,10 +210,7 @@ void InsetFloat::readParams(Buffer const * buf, LyXLex & lex)
|
||||
if (token == "wide") {
|
||||
lex.next();
|
||||
string const tmptoken = lex.getString();
|
||||
if (tmptoken == "true")
|
||||
wide(true, buf->params);
|
||||
else
|
||||
wide(false, buf->params);
|
||||
wide = (tmptoken == "true");
|
||||
} else {
|
||||
lyxerr << "InsetFloat::Read:: Missing wide!"
|
||||
<< endl;
|
||||
@ -202,9 +221,17 @@ void InsetFloat::readParams(Buffer const * buf, LyXLex & lex)
|
||||
}
|
||||
|
||||
|
||||
void InsetFloat::write(Buffer const * buf, ostream & os) const
|
||||
{
|
||||
params_.write(os);
|
||||
InsetCollapsable::write(buf, os);
|
||||
}
|
||||
|
||||
|
||||
void InsetFloat::read(Buffer const * buf, LyXLex & lex)
|
||||
{
|
||||
readParams(buf, lex);
|
||||
params_.read(lex);
|
||||
wide(params_.wide, buf->params);
|
||||
InsetCollapsable::read(buf, lex);
|
||||
}
|
||||
|
||||
@ -299,7 +326,9 @@ bool InsetFloat::insetAllowed(Inset::Code code) const
|
||||
bool InsetFloat::showInsetDialog(BufferView * bv) const
|
||||
{
|
||||
if (!inset.showInsetDialog(bv)) {
|
||||
bv->owner()->getDialogs().showFloat(const_cast<InsetFloat *>(this));
|
||||
InsetFloat * tmp = const_cast<InsetFloat *>(this);
|
||||
InsetFloatMailer mailer(*tmp);
|
||||
mailer.showDialog();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -364,3 +393,51 @@ void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
InsetFloatMailer::InsetFloatMailer(InsetFloat & inset)
|
||||
: name_("float"), inset_(inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetFloatMailer::inset2string() const
|
||||
{
|
||||
return params2string(name(), inset_.params());
|
||||
}
|
||||
|
||||
|
||||
void InsetFloatMailer::string2params(string const & in,
|
||||
InsetFloatParams & params)
|
||||
{
|
||||
params = InsetFloatParams();
|
||||
|
||||
string name;
|
||||
string body = split(in, name, ' ');
|
||||
|
||||
if (name != "float" || body.empty())
|
||||
return;
|
||||
|
||||
// This is part of the inset proper that is usually swallowed
|
||||
// by Buffer::readInset
|
||||
body = split(body, name, '\n');
|
||||
if (!prefixIs(name, "Float "))
|
||||
return;
|
||||
|
||||
istringstream data(body);
|
||||
LyXLex lex(0,0);
|
||||
lex.setStream(data);
|
||||
|
||||
params.read(lex);
|
||||
}
|
||||
|
||||
|
||||
string const
|
||||
InsetFloatMailer::params2string(string const & name,
|
||||
InsetFloatParams const & params)
|
||||
{
|
||||
ostringstream data;
|
||||
data << name << ' ';
|
||||
params.write(data);
|
||||
|
||||
return data.str();
|
||||
}
|
||||
|
@ -17,14 +17,16 @@
|
||||
#include "insetcollapsable.h"
|
||||
#include "toc.h"
|
||||
|
||||
#include <boost/signals/signal0.hpp>
|
||||
|
||||
class Painter;
|
||||
|
||||
struct InsetFloatParams {
|
||||
///
|
||||
InsetFloatParams() : placement("htbp"), wide(false) {}
|
||||
///
|
||||
void write(std::ostream & os) const;
|
||||
///
|
||||
void read(LyXLex & lex);
|
||||
///
|
||||
string type;
|
||||
///
|
||||
string placement;
|
||||
@ -44,6 +46,10 @@ public:
|
||||
InsetFloat(InsetFloat const &, bool same_id = false);
|
||||
///
|
||||
~InsetFloat();
|
||||
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
|
||||
///
|
||||
void write(Buffer const * buf, std::ostream & os) const;
|
||||
///
|
||||
@ -81,17 +87,37 @@ public:
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
boost::signal0<void> hideDialog;
|
||||
///
|
||||
InsetFloatParams const & params() const { return params_; }
|
||||
///
|
||||
void writeParams(std::ostream & os) const;
|
||||
///
|
||||
void readParams(Buffer const * buf, LyXLex & lex);
|
||||
|
||||
private:
|
||||
///
|
||||
InsetFloatParams params_;
|
||||
};
|
||||
|
||||
|
||||
#include "mailinset.h"
|
||||
|
||||
|
||||
class InsetFloatMailer : public MailInset {
|
||||
public:
|
||||
///
|
||||
InsetFloatMailer(InsetFloat & inset);
|
||||
///
|
||||
virtual Inset & inset() const { return inset_; }
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
///
|
||||
static void string2params(string const &, InsetFloatParams &);
|
||||
///
|
||||
static string const params2string(string const & name,
|
||||
InsetFloatParams const &);
|
||||
private:
|
||||
///
|
||||
string const name_;
|
||||
///
|
||||
InsetFloat & inset_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -661,4 +661,3 @@ InsetIncludeMailer::params2string(string const & name,
|
||||
|
||||
return data.str();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user