mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
Move the include dialog to the new scheme
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6353 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5f850b5cab
commit
61419611a0
@ -2,6 +2,7 @@
|
||||
|
||||
* ui/default.ui: use 'dialog-show-new-inset "external"' instead
|
||||
of 'external-insert'.
|
||||
use "dialog-show-new-inset include" instead of "buffer-child-insert".
|
||||
|
||||
2003-03-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
|
@ -213,7 +213,7 @@ Menuset
|
||||
Item "Tabular Material...|b" "tabular-insert"
|
||||
Submenu "Floats|a" "insert_floats"
|
||||
Separator
|
||||
Item "Include File...|d" "buffer-child-insert"
|
||||
Item "Include File...|d" "dialog-show-new-inset include"
|
||||
Submenu "Insert File|e" "insert_file"
|
||||
Item "External Material...|x" "dialog-show-new-inset external"
|
||||
End
|
||||
|
@ -1204,23 +1204,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_CHILD_INSERT:
|
||||
{
|
||||
InsetInclude::Params p;
|
||||
if (!ev.argument.empty())
|
||||
p.cparams.setFromString(ev.argument);
|
||||
p.masterFilename_ = buffer_->fileName();
|
||||
|
||||
InsetInclude * inset = new InsetInclude(p);
|
||||
if (!insertInset(inset))
|
||||
delete inset;
|
||||
else {
|
||||
updateInset(inset, true);
|
||||
bv_->owner()->getDialogs().showInclude(inset);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_FLOAT_LIST:
|
||||
if (tclass.floats().typeExist(ev.argument)) {
|
||||
Inset * inset = new InsetFloatList(ev.argument);
|
||||
|
@ -1,3 +1,13 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* commandtags.h:
|
||||
* LyXAction.C (init):
|
||||
* BufferView_pimpl.C (dispatch):
|
||||
* lyxfunc.C (getStatus):
|
||||
remove LFUN_CHILD_INSERT.
|
||||
|
||||
* factory.C (createInset): add "include" to LFUN_INSET_APPLY.
|
||||
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* commandtags.h:
|
||||
|
@ -114,7 +114,6 @@ void LyXAction::init()
|
||||
N_("Go to beginning of document"), ReadOnly },
|
||||
{ LFUN_BEGINNINGBUFSEL, "buffer-begin-select",
|
||||
N_("Select to beginning of document"), ReadOnly },
|
||||
{ LFUN_CHILD_INSERT, "buffer-child-insert", "", Noop },
|
||||
{ LFUN_CHILDOPEN, "buffer-child-open", "", ReadOnly },
|
||||
{ LFUN_RUNCHKTEX, "buffer-chktex", N_("Check TeX"), ReadOnly },
|
||||
{ LFUN_CLOSEBUFFER, "buffer-close", N_("Close"), ReadOnly },
|
||||
|
@ -196,7 +196,6 @@ enum kb_action {
|
||||
LFUN_LAYOUT_COPY, // Asger 1997-05-04
|
||||
LFUN_LAYOUT_PASTE, // Asger 1997-05-04
|
||||
LFUN_TABINSERT, // 180 // Ale 970515
|
||||
LFUN_CHILD_INSERT, // Ale 970521
|
||||
LFUN_CHILDOPEN, // Ale 970528
|
||||
LFUN_TOC_INSERT, // Lgb 97-05-27
|
||||
LFUN_FLOAT_LIST, // Lgb 20010503
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "insets/insetexternal.h"
|
||||
#include "insets/insetfloat.h"
|
||||
#include "insets/insetfoot.h"
|
||||
#include "insets/insetinclude.h"
|
||||
#include "insets/insetindex.h"
|
||||
#include "insets/insetlabel.h"
|
||||
#include "insets/insetmarginal.h"
|
||||
@ -191,6 +192,11 @@ Inset * createInset(FuncRequest const & cmd)
|
||||
inset->setFromParams(iep);
|
||||
return inset;
|
||||
|
||||
} else if (name == "include") {
|
||||
InsetInclude::Params iip;
|
||||
InsetIncludeMailer::string2params(cmd.argument, iip);
|
||||
return new InsetInclude(iip);
|
||||
|
||||
} else if (name == "index") {
|
||||
InsetCommandParams icp;
|
||||
InsetCommandMailer::string2params(cmd.argument, icp);
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.h: remove showInclude.
|
||||
* guiapi.[Ch]: remove gui_ShowInclude.
|
||||
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.h: remove showExternal.
|
||||
|
@ -26,7 +26,6 @@ class LyXView;
|
||||
class InsetFloat;
|
||||
class InsetWrap;
|
||||
class InsetGraphics;
|
||||
class InsetInclude;
|
||||
class InsetInfo;
|
||||
class InsetMinipage;
|
||||
class Paragraph;
|
||||
@ -96,8 +95,6 @@ public:
|
||||
void showForks();
|
||||
///
|
||||
void showGraphics(InsetGraphics *);
|
||||
/// show the details of a LyX file include inset
|
||||
void showInclude(InsetInclude *);
|
||||
/// show the LaTeX log or build file
|
||||
void showLogFile();
|
||||
/// display the top-level maths panel
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlInclude.[Ch]: rewrite to use the Dialog-based scheme.
|
||||
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlExternal.[Ch]: rewrite to use the Dialog-based scheme.
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlInclude.h"
|
||||
|
||||
#include "helper_funcs.h"
|
||||
@ -32,18 +31,38 @@
|
||||
using std::pair;
|
||||
|
||||
|
||||
ControlInclude::ControlInclude(LyXView & lv, Dialogs & d)
|
||||
: ControlInset<InsetInclude, InsetInclude::Params>(lv, d)
|
||||
ControlInclude::ControlInclude(Dialog & parent)
|
||||
: Dialog::Controller(parent)
|
||||
{}
|
||||
|
||||
|
||||
void ControlInclude::applyParamsToInset()
|
||||
void ControlInclude::initialiseParams(string const & data)
|
||||
{
|
||||
inset()->set(params());
|
||||
bufferview()->updateInset(inset(), true);
|
||||
InsetInclude::Params params;
|
||||
InsetIncludeMailer::string2params(data, params);
|
||||
inset_.reset(new InsetInclude(params));
|
||||
}
|
||||
|
||||
|
||||
void ControlInclude::clearParams()
|
||||
{
|
||||
inset_.reset();
|
||||
}
|
||||
|
||||
|
||||
void ControlInclude::dispatchParams()
|
||||
{
|
||||
InsetInclude::Params p = params();
|
||||
string const lfun = InsetIncludeMailer::params2string("include", p);
|
||||
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
|
||||
}
|
||||
|
||||
|
||||
void ControlInclude::setParams(InsetInclude::Params const & params)
|
||||
{
|
||||
inset_->set(params);
|
||||
}
|
||||
|
||||
string const ControlInclude::Browse(string const & in_name, Type in_type)
|
||||
{
|
||||
string const title = _("Select document to include");
|
||||
@ -75,7 +94,7 @@ string const ControlInclude::Browse(string const & in_name, Type in_type)
|
||||
|
||||
void ControlInclude::load(string const & file)
|
||||
{
|
||||
lyxfunc().dispatch(FuncRequest(LFUN_CHILDOPEN, file));
|
||||
kernel().dispatch(FuncRequest(LFUN_CHILDOPEN, file));
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,14 +15,13 @@
|
||||
#define CONTROLINCLUDE_H
|
||||
|
||||
|
||||
#include "ControlInset.h"
|
||||
#include "Dialog.h"
|
||||
#include "insets/insetinclude.h" // InsetIncludeParams
|
||||
|
||||
|
||||
/** A controller for the Include file dialog.
|
||||
*/
|
||||
class ControlInclude
|
||||
: public ControlInset<InsetInclude, InsetInclude::Params>
|
||||
{
|
||||
class ControlInclude : public Dialog::Controller {
|
||||
public:
|
||||
///
|
||||
enum Type {
|
||||
@ -34,7 +33,22 @@ public:
|
||||
INCLUDE
|
||||
};
|
||||
///
|
||||
ControlInclude(LyXView &, Dialogs &);
|
||||
ControlInclude(Dialog &);
|
||||
|
||||
///
|
||||
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; }
|
||||
|
||||
///
|
||||
InsetInclude::Params const & params() const
|
||||
{ return inset_->params(); }
|
||||
///
|
||||
void setParams(InsetInclude::Params const &);
|
||||
|
||||
/// Browse for a file
|
||||
string const Browse(string const &, Type);
|
||||
@ -45,17 +59,8 @@ public:
|
||||
/// test if file exist
|
||||
bool fileExists(string const & file);
|
||||
private:
|
||||
/// Dispatch the changed parameters to the kernel.
|
||||
virtual void applyParamsToInset();
|
||||
/// Should be used but currently isn't
|
||||
virtual void applyParamsNoInset() {}
|
||||
/// get the parameters from the string passed to createInset.
|
||||
virtual InsetInclude::Params const getParams(string const &)
|
||||
{ return InsetInclude::Params(); }
|
||||
/// get the parameters from the inset passed to showInset.
|
||||
virtual InsetInclude::Params const
|
||||
getParams(InsetInclude const & inset) {
|
||||
return inset.params();
|
||||
}
|
||||
///
|
||||
boost::scoped_ptr<InsetInclude> inset_;
|
||||
};
|
||||
|
||||
#endif // CONTROLINCLUDE_H
|
||||
|
@ -74,12 +74,6 @@ void gui_ShowGraphics(InsetGraphics * ig, Dialogs & d)
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowInclude(InsetInclude * ii, Dialogs & d)
|
||||
{
|
||||
d.showInclude(ii);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowLogFile(Dialogs & d)
|
||||
{
|
||||
d.showLogFile();
|
||||
|
@ -19,7 +19,6 @@ class Dialogs;
|
||||
class InsetFloat;
|
||||
class InsetWrap;
|
||||
class InsetGraphics;
|
||||
class InsetInclude;
|
||||
class InsetMinipage;
|
||||
class InsetTabular;
|
||||
|
||||
@ -35,7 +34,6 @@ void gui_ShowFile(string const &, Dialogs &);
|
||||
void gui_ShowFloat(InsetFloat *, Dialogs &);
|
||||
void gui_ShowForks(Dialogs &);
|
||||
void gui_ShowGraphics(InsetGraphics *, Dialogs &);
|
||||
void gui_ShowInclude(InsetInclude *, Dialogs &);
|
||||
void gui_ShowLogFile(Dialogs &);
|
||||
void gui_ShowMathPanel(Dialogs &);
|
||||
void gui_ShowMinipage(InsetMinipage *, Dialogs &);
|
||||
|
@ -1,3 +1,13 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* QInclude.[Ch]: changes to use the new Dialog-based scheme.
|
||||
|
||||
* Dialogs.C:
|
||||
* Dialogs2.C:
|
||||
* Dialogs_impl.h: remove include dialog.
|
||||
|
||||
* Dialogs3.C: add include dialog.
|
||||
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* QExternal.[Ch]: changes to use the new Dialog-based scheme.
|
||||
|
@ -33,7 +33,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
file(lv, d),
|
||||
floats(lv, d),
|
||||
graphics(lv, d),
|
||||
include(lv, d),
|
||||
logfile(lv, d),
|
||||
minipage(lv, d),
|
||||
paragraph(lv, d),
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "Dialogs_impl.h"
|
||||
|
||||
|
||||
@ -68,12 +67,6 @@ void Dialogs::showGraphics(InsetGraphics * ig)
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showInclude(InsetInclude * ii)
|
||||
{
|
||||
pimpl_->include.controller().showInset(ii);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showLogFile()
|
||||
{
|
||||
pimpl_->logfile.controller().show();
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ControlError.h"
|
||||
#include "ControlERT.h"
|
||||
#include "ControlExternal.h"
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlIndex.h"
|
||||
#include "ControlLabel.h"
|
||||
#include "ControlRef.h"
|
||||
@ -41,6 +42,8 @@
|
||||
// of the Qt headers, those most fucked up of disgusting ratholes.
|
||||
// But I won't.
|
||||
#undef signals
|
||||
#include "QInclude.h"
|
||||
#include "QIncludeDialog.h"
|
||||
#include "QIndex.h"
|
||||
#include "QIndexDialog.h"
|
||||
#include "QRef.h"
|
||||
@ -67,12 +70,11 @@ typedef ButtonController<OkApplyCancelReadOnlyPolicy, Qt2BC>
|
||||
typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
NoRepeatedApplyReadOnlyBC;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
"error", "ert", "external", "index",
|
||||
"label", "ref", "toc", "url" };
|
||||
"error", "ert", "external", "include",
|
||||
"index", "label", "ref", "toc", "url" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
@ -128,6 +130,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlExternal(*dialog));
|
||||
dialog->setView(new QExternal(*dialog));
|
||||
dialog->setButtonController(new OkApplyCancelReadOnlyBC);
|
||||
} else if (name == "include") {
|
||||
dialog->setController(new ControlInclude(*dialog));
|
||||
dialog->setView(new QInclude(*dialog));
|
||||
dialog->setButtonController(new OkApplyCancelReadOnlyBC);
|
||||
} else if (name == "index") {
|
||||
dialog->setController(new ControlIndex(*dialog));
|
||||
dialog->setView(new QIndex(*dialog,
|
||||
|
@ -11,7 +11,6 @@
|
||||
#ifndef DIALOGS_IMPL_H
|
||||
#define DIALOGS_IMP_H
|
||||
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "controllers/GUI.h"
|
||||
|
||||
@ -23,7 +22,6 @@
|
||||
#include "ControlForks.h"
|
||||
#include "ControlGraphics.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlLog.h"
|
||||
#include "ControlMinipage.h"
|
||||
#include "ControlParagraph.h"
|
||||
@ -56,8 +54,6 @@
|
||||
#undef signals
|
||||
#include "QGraphics.h"
|
||||
#include "QGraphicsDialog.h"
|
||||
#include "QInclude.h"
|
||||
#include "QIncludeDialog.h"
|
||||
#include "QLog.h"
|
||||
#include "QLogDialog.h"
|
||||
#include "QMinipage.h"
|
||||
@ -119,9 +115,6 @@ FloatDialog;
|
||||
typedef GUI<ControlGraphics, QGraphics, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
GraphicsDialog;
|
||||
|
||||
typedef GUI<ControlInclude, QInclude, OkCancelReadOnlyPolicy, Qt2BC>
|
||||
IncludeDialog;
|
||||
|
||||
typedef GUI<ControlLog, QLog, OkCancelPolicy, Qt2BC>
|
||||
LogFileDialog;
|
||||
|
||||
@ -177,7 +170,6 @@ struct Dialogs::Impl {
|
||||
FileDialog file;
|
||||
FloatDialog floats;
|
||||
GraphicsDialog graphics;
|
||||
IncludeDialog include;
|
||||
LogFileDialog logfile;
|
||||
MinipageDialog minipage;
|
||||
ParagraphDialog paragraph;
|
||||
|
@ -25,13 +25,12 @@
|
||||
#include <qcombobox.h>
|
||||
|
||||
|
||||
typedef Qt2CB<ControlInclude, Qt2DB<QIncludeDialog> > base_class;
|
||||
typedef QController<ControlInclude, QView<QIncludeDialog> > base_class;
|
||||
|
||||
|
||||
QInclude::QInclude()
|
||||
: base_class(qt_("LyX: Include File"))
|
||||
{
|
||||
}
|
||||
QInclude::QInclude(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: Include File"))
|
||||
{}
|
||||
|
||||
|
||||
void QInclude::build_dialog()
|
||||
@ -82,7 +81,7 @@ void QInclude::update_contents()
|
||||
|
||||
void QInclude::apply()
|
||||
{
|
||||
InsetInclude::Params & params = controller().params();
|
||||
InsetInclude::Params params = controller().params();
|
||||
|
||||
params.cparams.setContents(fromqstr(dialog_->filenameED->text()));
|
||||
params.cparams.preview(dialog_->previewCB->isChecked());
|
||||
@ -98,6 +97,7 @@ void QInclude::apply()
|
||||
else
|
||||
params.flag = InsetInclude::VERB;
|
||||
}
|
||||
controller().setParams(params);
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,20 +13,20 @@
|
||||
#define QINCLUDE_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
|
||||
class ControlInclude;
|
||||
class QIncludeDialog;
|
||||
|
||||
///
|
||||
class QInclude
|
||||
: public Qt2CB<ControlInclude, Qt2DB<QIncludeDialog> >
|
||||
class QInclude : public QController<ControlInclude, QView<QIncludeDialog> >
|
||||
{
|
||||
public:
|
||||
///
|
||||
friend class QIncludeDialog;
|
||||
///
|
||||
QInclude();
|
||||
QInclude(Dialog &);
|
||||
protected:
|
||||
virtual bool isValid();
|
||||
private:
|
||||
|
@ -1,3 +1,14 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormInclude.[Ch]:
|
||||
* forms/form_include.fd: changes to use the new Dialog-based scheme.
|
||||
|
||||
* Dialogs.C:
|
||||
* Dialogs2.C:
|
||||
* Dialogs_impl.h: remove include dialog.
|
||||
|
||||
* Dialogs3.C: add include dialog.
|
||||
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormExternal.[Ch]:
|
||||
|
@ -34,7 +34,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
floats(lv, d),
|
||||
forks(lv, d),
|
||||
graphics(lv, d),
|
||||
include(lv, d),
|
||||
logfile(lv, d),
|
||||
mathpanel(lv, d),
|
||||
minipage(lv, d),
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "Dialogs_impl.h"
|
||||
|
||||
|
||||
@ -70,12 +69,6 @@ void Dialogs::showGraphics(InsetGraphics * ig)
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showInclude(InsetInclude * ii)
|
||||
{
|
||||
pimpl_->include.controller().showInset(ii);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showLogFile()
|
||||
{
|
||||
pimpl_->logfile.controller().show();
|
||||
|
@ -39,6 +39,10 @@
|
||||
#include "FormExternal.h"
|
||||
#include "forms/form_external.h"
|
||||
|
||||
#include "ControlInclude.h"
|
||||
#include "FormInclude.h"
|
||||
#include "forms/form_include.h"
|
||||
|
||||
#include "ControlIndex.h"
|
||||
#include "ControlLabel.h"
|
||||
|
||||
@ -73,6 +77,7 @@ typedef ButtonController<OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
NoRepeatedApplyReadOnlyBC;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
// char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
@ -81,8 +86,8 @@ namespace {
|
||||
// "minipage", "ref", "tabular", "toc",
|
||||
// "url", "wrap" };
|
||||
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
"error", "ert", "external", "index",
|
||||
"label", "ref", "toc", "url" };
|
||||
"error", "ert", "external", "include",
|
||||
"index", "label", "ref", "toc", "url" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
@ -138,6 +143,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlExternal(*dialog));
|
||||
dialog->setView(new FormExternal(*dialog));
|
||||
dialog->setButtonController(new OkApplyCancelReadOnlyBC);
|
||||
} else if (name == "include") {
|
||||
dialog->setController(new ControlInclude(*dialog));
|
||||
dialog->setView(new FormInclude(*dialog));
|
||||
dialog->setButtonController(new OkApplyCancelReadOnlyBC);
|
||||
} else if (name == "index") {
|
||||
dialog->setController(new ControlIndex(*dialog));
|
||||
dialog->setView(new FormText(*dialog,
|
||||
|
@ -11,7 +11,6 @@
|
||||
#ifndef DIALOGS_IMPL_H
|
||||
#define DIALOGS_IMP_H
|
||||
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "controllers/GUI.h"
|
||||
|
||||
@ -50,10 +49,6 @@
|
||||
#include "FormGraphics.h"
|
||||
#include "forms/form_graphics.h"
|
||||
|
||||
#include "ControlInclude.h"
|
||||
#include "FormInclude.h"
|
||||
#include "forms/form_include.h"
|
||||
|
||||
#include "ControlLog.h"
|
||||
#include "FormLog.h"
|
||||
|
||||
@ -146,9 +141,6 @@ ForksDialog;
|
||||
typedef GUI<ControlGraphics, FormGraphics, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
GraphicsDialog;
|
||||
|
||||
typedef GUI<ControlInclude, FormInclude, OkCancelReadOnlyPolicy, xformsBC>
|
||||
IncludeDialog;
|
||||
|
||||
typedef GUI<ControlLog, FormLog, OkCancelPolicy, xformsBC>
|
||||
LogFileDialog;
|
||||
|
||||
@ -210,7 +202,6 @@ struct Dialogs::Impl {
|
||||
FloatDialog floats;
|
||||
ForksDialog forks;
|
||||
GraphicsDialog graphics;
|
||||
IncludeDialog include;
|
||||
LogFileDialog logfile;
|
||||
MathPanelDialog mathpanel;
|
||||
MinipageDialog minipage;
|
||||
|
@ -26,10 +26,10 @@
|
||||
#include "support/lstrings.h" // strip
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
typedef FormCB<ControlInclude, FormDB<FD_include> > base_class;
|
||||
typedef FormController<ControlInclude, FormView<FD_include> > base_class;
|
||||
|
||||
FormInclude::FormInclude()
|
||||
: base_class(_("Include file"))
|
||||
FormInclude::FormInclude(Dialog & parent)
|
||||
: base_class(parent, _("Include file"))
|
||||
{}
|
||||
|
||||
|
||||
@ -113,26 +113,29 @@ void FormInclude::update()
|
||||
|
||||
void FormInclude::apply()
|
||||
{
|
||||
controller().params().cparams
|
||||
.preview(fl_get_button(dialog_->check_preview));
|
||||
InsetInclude::Params params = controller().params();
|
||||
|
||||
params.cparams.preview(fl_get_button(dialog_->check_preview));
|
||||
|
||||
string const file = fl_get_input(dialog_->input_filename);
|
||||
if (controller().fileExists(file))
|
||||
controller().params().cparams.setContents(file);
|
||||
params.cparams.setContents(file);
|
||||
else
|
||||
controller().params().cparams.setContents("");
|
||||
params.cparams.setContents("");
|
||||
|
||||
ControlInclude::Type const type = ControlInclude::Type(type_.get());
|
||||
if (type == ControlInclude::INPUT)
|
||||
controller().params().flag = InsetInclude::INPUT;
|
||||
params.flag = InsetInclude::INPUT;
|
||||
else if (type == ControlInclude::INCLUDE)
|
||||
controller().params().flag = InsetInclude::INCLUDE;
|
||||
params.flag = InsetInclude::INCLUDE;
|
||||
else if (type == ControlInclude::VERBATIM) {
|
||||
if (fl_get_button(dialog_->check_visiblespace))
|
||||
controller().params().flag = InsetInclude::VERBAST;
|
||||
params.flag = InsetInclude::VERBAST;
|
||||
else
|
||||
controller().params().flag = InsetInclude::VERB;
|
||||
params.flag = InsetInclude::VERB;
|
||||
}
|
||||
|
||||
controller().setParams(params);
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +154,7 @@ ButtonPolicy::SMInput FormInclude::input(FL_OBJECT * ob, long)
|
||||
} else if (ob == dialog_->button_load) {
|
||||
string const in_name = fl_get_input(dialog_->input_filename);
|
||||
if (!rtrim(in_name).empty() && controller().fileExists(in_name)) {
|
||||
controller().OKButton();
|
||||
dialog().OKButton();
|
||||
controller().load(rtrim(in_name));
|
||||
action = ButtonPolicy::SMI_NOOP;
|
||||
}
|
||||
|
@ -14,18 +14,20 @@
|
||||
#define FORMINCLUDE_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
#include "RadioButtonGroup.h"
|
||||
|
||||
|
||||
class ControlInclude;
|
||||
struct FD_include;
|
||||
|
||||
/** This class provides an XForms implementation of the Include Dialog.
|
||||
*/
|
||||
class FormInclude : public FormCB<ControlInclude, FormDB<FD_include> > {
|
||||
class FormInclude
|
||||
: public FormController<ControlInclude, FormView<FD_include> > {
|
||||
public:
|
||||
///
|
||||
FormInclude();
|
||||
FormInclude(Dialog &);
|
||||
private:
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply();
|
||||
|
@ -64,7 +64,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthEast FL_NorthEast
|
||||
name: button_browse
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -82,7 +82,7 @@ shortcut: ^M
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_ok
|
||||
callback: C_FormBaseOKCB
|
||||
callback: C_FormDialogView_OKCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -100,7 +100,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_close
|
||||
callback: C_FormBaseCancelCB
|
||||
callback: C_FormDialogView_CancelCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -118,7 +118,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthWest FL_North
|
||||
name: button_load
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -136,7 +136,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: input_filename
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -154,7 +154,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthWest FL_North
|
||||
name: check_visiblespace
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -190,7 +190,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthWest FL_NorthWest
|
||||
name: radio_verbatim
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -208,7 +208,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthWest FL_NorthWest
|
||||
name: radio_useinput
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
value: 1
|
||||
|
||||
@ -227,7 +227,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthWest FL_NorthWest
|
||||
name: radio_useinclude
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -263,7 +263,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthWest FL_North
|
||||
name: check_preview
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
==============================
|
||||
|
@ -1,3 +1,10 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetcommandparams.[Ch] (getAsString, setFromString): remove.
|
||||
|
||||
* insetinclude.[Ch]: define a new class InsetIncludeMailer and use
|
||||
it to communicate with the frontend dialogs.
|
||||
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetexternal.[Ch]: define a new class InsetExternalMailer and use
|
||||
|
@ -32,36 +32,6 @@ InsetCommandParams::InsetCommandParams(string const & n,
|
||||
{}
|
||||
|
||||
|
||||
string const InsetCommandParams::getAsString() const
|
||||
{
|
||||
return cmdname + "|++|" + contents + "|++|" + options;
|
||||
}
|
||||
|
||||
|
||||
void InsetCommandParams::setFromString(string const & b)
|
||||
{
|
||||
string::size_type idx = b.find("|++|");
|
||||
if (idx == string::npos) {
|
||||
cmdname = b;
|
||||
contents = "";
|
||||
options = "";
|
||||
return;
|
||||
}
|
||||
|
||||
cmdname = b.substr(0, idx);
|
||||
string tmp = b.substr(idx+4);
|
||||
|
||||
idx = tmp.find("|++|");
|
||||
if (idx == string::npos) {
|
||||
contents = tmp;
|
||||
options = "";
|
||||
} else {
|
||||
contents = tmp.substr(0, idx);
|
||||
options = tmp.substr(idx+4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetCommandParams::scanCommand(string const & cmd)
|
||||
{
|
||||
string tcmdname, toptions, tcontents;
|
||||
|
@ -51,10 +51,6 @@ public:
|
||||
///
|
||||
void setContents(string const & c) { contents = c; }
|
||||
///
|
||||
string const getAsString() const;
|
||||
///
|
||||
void setFromString(string const &);
|
||||
///
|
||||
bool preview() const { return preview_; }
|
||||
///
|
||||
void preview(bool p) { preview_ = p; }
|
||||
|
@ -176,5 +176,4 @@ private:
|
||||
InsetERT & inset_;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -15,9 +15,11 @@
|
||||
#include "bufferlist.h"
|
||||
#include "BufferView.h"
|
||||
#include "debug.h"
|
||||
#include "lyxrc.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "funcrequest.h"
|
||||
#include "gettext.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "lyxlex.h"
|
||||
#include "lyxrc.h"
|
||||
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/LyXView.h"
|
||||
@ -106,7 +108,26 @@ InsetInclude::InsetInclude(InsetCommandParams const & p, Buffer const & b)
|
||||
|
||||
InsetInclude::~InsetInclude()
|
||||
{
|
||||
hideDialog();
|
||||
InsetIncludeMailer mailer(*this);
|
||||
mailer.hideDialog();
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetInclude::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
if (cmd.action != LFUN_INSET_MODIFY)
|
||||
return UNDISPATCHED;
|
||||
|
||||
InsetInclude::Params p;
|
||||
InsetIncludeMailer::string2params(cmd.argument, p);
|
||||
if (p.cparams.getCmdName().empty())
|
||||
return UNDISPATCHED;
|
||||
|
||||
set(p);
|
||||
params_.masterFilename_ = cmd.view()->buffer()->fileName();
|
||||
|
||||
cmd.view()->updateInset(this, true);
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
|
||||
@ -172,9 +193,10 @@ Inset * InsetInclude::clone(Buffer const & buffer, bool) const
|
||||
}
|
||||
|
||||
|
||||
void InsetInclude::edit(BufferView * bv, int, int, mouse_button::state)
|
||||
void InsetInclude::edit(BufferView *, int, int, mouse_button::state)
|
||||
{
|
||||
bv->owner()->getDialogs().showInclude(this);
|
||||
InsetIncludeMailer mailer(*this);
|
||||
mailer.showDialog();
|
||||
}
|
||||
|
||||
|
||||
@ -586,3 +608,57 @@ void InsetInclude::PreviewImpl::restartLoading()
|
||||
view()->updateInset(&parent(), false);
|
||||
generatePreview();
|
||||
}
|
||||
|
||||
|
||||
InsetIncludeMailer::InsetIncludeMailer(InsetInclude & inset)
|
||||
: name_("include"), inset_(inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetIncludeMailer::inset2string() const
|
||||
{
|
||||
return params2string(name(), inset_.params());
|
||||
}
|
||||
|
||||
|
||||
void InsetIncludeMailer::string2params(string const & in,
|
||||
InsetInclude::Params & params)
|
||||
{
|
||||
params = InsetInclude::Params();
|
||||
|
||||
string name;
|
||||
string body = split(in, name, ' ');
|
||||
|
||||
if (name != "include" || body.empty())
|
||||
return;
|
||||
|
||||
// This is part of the inset proper that is usually swallowed
|
||||
// by Buffer::readInset
|
||||
body = split(body, name, ' ');
|
||||
if (name != "Include")
|
||||
return;
|
||||
|
||||
istringstream data(body);
|
||||
LyXLex lex(0,0);
|
||||
lex.setStream(data);
|
||||
|
||||
InsetInclude inset(params);
|
||||
inset.read(0, lex);
|
||||
params = inset.params();
|
||||
}
|
||||
|
||||
|
||||
string const
|
||||
InsetIncludeMailer::params2string(string const & name,
|
||||
InsetInclude::Params const & params)
|
||||
{
|
||||
InsetInclude inset(params);
|
||||
inset.set(params);
|
||||
ostringstream data;
|
||||
data << name << ' ';
|
||||
inset.write(0, data);
|
||||
data << "\\end_inset\n";
|
||||
|
||||
return data.str();
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "insetcommand.h"
|
||||
|
||||
#include <boost/signals/signal0.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
class Buffer;
|
||||
@ -58,6 +57,9 @@ public:
|
||||
|
||||
~InsetInclude();
|
||||
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
|
||||
/// Override these InsetButton methods if Previewing
|
||||
int ascent(BufferView *, LyXFont const &) const;
|
||||
///
|
||||
@ -119,8 +121,6 @@ public:
|
||||
///
|
||||
void addPreview(grfx::PreviewLoader &) const;
|
||||
|
||||
/// hide a dialog if about
|
||||
boost::signal0<void> hideDialog;
|
||||
private:
|
||||
/// get the text displayed on the button
|
||||
string const getScreenLabel(Buffer const *) const;
|
||||
@ -149,4 +149,28 @@ inline bool InsetInclude::isVerbatim() const
|
||||
return params_.flag == VERB || params_.flag == VERBAST;
|
||||
}
|
||||
|
||||
#include "mailinset.h"
|
||||
|
||||
class InsetIncludeMailer : public MailInset {
|
||||
public:
|
||||
///
|
||||
InsetIncludeMailer(InsetInclude & inset);
|
||||
///
|
||||
virtual Inset & inset() const { return inset_; }
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
///
|
||||
static void string2params(string const &, InsetInclude::Params &);
|
||||
///
|
||||
static string const params2string(string const & name,
|
||||
InsetInclude::Params const &);
|
||||
private:
|
||||
///
|
||||
string const name_;
|
||||
///
|
||||
InsetInclude & inset_;
|
||||
};
|
||||
|
||||
#endif // INSETINCLUDE_H
|
||||
|
@ -564,9 +564,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
|
||||
case LFUN_INDEX_PRINT:
|
||||
code = Inset::INDEX_PRINT_CODE;
|
||||
break;
|
||||
case LFUN_CHILD_INSERT:
|
||||
code = Inset::INCLUDE_CODE;
|
||||
break;
|
||||
case LFUN_TOC_INSERT:
|
||||
code = Inset::TOC_CODE;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user