mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-13 20:09:59 +00:00
John's tiny FormGraphics patch and large GUI-I InsetInclude patch.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1755 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
01e9bd2f39
commit
9356012089
@ -2927,14 +2927,17 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
|
||||
case LFUN_CHILD_INSERT:
|
||||
{
|
||||
InsetCommandParams p;
|
||||
p.setFromString(argument);
|
||||
InsetInclude::InsetIncludeParams p;
|
||||
p.cparams.setFromString(argument);
|
||||
p.buffer = buffer_;
|
||||
|
||||
InsetInclude * inset = new InsetInclude(p, *buffer_);
|
||||
InsetInclude * inset = new InsetInclude(p);
|
||||
if (!bv_->insertInset(inset))
|
||||
delete inset;
|
||||
else
|
||||
else {
|
||||
bv_->updateInset(inset, true);
|
||||
bv_->owner()->getDialogs()->showInclude(inset);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -23,6 +23,14 @@
|
||||
|
||||
* BufferView_pimpl.C: add comment, destroySplash()
|
||||
|
||||
2001-03-12 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* BufferView_pimpl.C:
|
||||
* LyXAction.C:
|
||||
* buffer.C:
|
||||
* commandtags.h:
|
||||
* lyxfunc.C: use re-worked insetinclude
|
||||
|
||||
2001-03-12 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||
|
||||
* buffer.C: add using std::stringstream.
|
||||
|
@ -119,7 +119,7 @@ void LyXAction::init()
|
||||
N_("Go to beginning of document"), ReadOnly },
|
||||
{ LFUN_BEGINNINGBUFSEL, "buffer-begin-select",
|
||||
N_("Select to beginning of document"), ReadOnly },
|
||||
{ LFUN_CHILD_CREATE, "buffer-child-insert", "", Noop },
|
||||
{ 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 },
|
||||
|
@ -3567,11 +3567,10 @@ string const Buffer::getIncludeonlyList(char delim)
|
||||
if ((*it)->LyxCode() == Inset::INCLUDE_CODE) {
|
||||
InsetInclude * insetinc =
|
||||
static_cast<InsetInclude *>(*it);
|
||||
if (insetinc->isInclude()
|
||||
&& insetinc->isNoLoad()) {
|
||||
if (insetinc->isIncludeOnly()) {
|
||||
if (!lst.empty())
|
||||
lst += delim;
|
||||
lst += OnlyFilename(ChangeExtension(insetinc->getContents(), string()));
|
||||
lst += insetinc->getRelFileBaseName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +274,6 @@ enum kb_action {
|
||||
LFUN_REFERENCE_GOTO, // Dekel 20010114
|
||||
LFUN_BOOKMARK_SAVE, // Dekel 20010127
|
||||
LFUN_BOOKMARK_GOTO, // Dekel 20010127
|
||||
LFUN_CHILD_CREATE, // Levon 20010207
|
||||
LFUN_SELECT_FILE_SYNC, // Levon 20010214
|
||||
LFUN_LASTACTION /* this marks the end of the table */
|
||||
};
|
||||
|
@ -8,6 +8,10 @@
|
||||
|
||||
* GUIRunTime.h: minor cleanup
|
||||
|
||||
2001-03-12 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* Dialogs.h: remove createInclude
|
||||
|
||||
2001-02-26 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* Makefile.am
|
||||
|
@ -106,9 +106,7 @@ public:
|
||||
///
|
||||
Signal1<void, InsetGraphics *> showGraphics;
|
||||
/// show the details of a LyX file include inset
|
||||
Signal1<void, InsetCommand *> showInclude;
|
||||
/// create a LyX file include inset
|
||||
Signal1<void, string const &> createInclude;
|
||||
Signal1<void, InsetInclude *> showInclude;
|
||||
///
|
||||
Signal1<void, InsetCommand *> showIndex;
|
||||
///
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-03-13 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* FormGraphics.C: remove unnecessary hack
|
||||
|
||||
2001-03-13 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* FormCitation.C (apply): Do not put space between multiple keys.
|
||||
@ -29,6 +33,14 @@
|
||||
|
||||
* Menubar_pimpl.C: destroy splash on interaction
|
||||
|
||||
2001-03-12 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* FormInclude.h:
|
||||
* FormInclude.C:
|
||||
* form_include.h:
|
||||
* form_include.C:
|
||||
* forms/form_include.fd: rework, clean up
|
||||
|
||||
2001-03-12 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||
|
||||
* FormToc.h: use Buffer::typedef
|
||||
|
@ -358,8 +358,7 @@ void FormGraphics::browse()
|
||||
|
||||
string const title = N_("Graphics");
|
||||
// FIXME: currently we need the second '|' to prevent mis-interpretation
|
||||
// FIXME: rfind() in split() seems to be broken hence the second space
|
||||
string const pattern = "*.(ps|png)| ";
|
||||
string const pattern = "*.(ps|png)|";
|
||||
|
||||
// Does user clipart directory exist?
|
||||
string clipdir = AddName (user_lyxdir, "clipart");
|
||||
|
@ -16,27 +16,26 @@
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "FormInclude.h"
|
||||
#include "insets/insetinclude.h"
|
||||
#include "insets/insetinclude.h"
|
||||
#include "frontends/FileDialog.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "LyXView.h"
|
||||
#include "buffer.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "xforms_helpers.h"
|
||||
|
||||
#include "lyxrc.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "xforms_helpers.h"
|
||||
|
||||
#include "form_include.h"
|
||||
|
||||
using std::make_pair;
|
||||
using std::pair;
|
||||
|
||||
FormInclude::FormInclude(LyXView * lv, Dialogs * d)
|
||||
: FormCommand(lv, d, _("Include file"), new OkCancelPolicy),
|
||||
dialog_(0)
|
||||
: FormBaseBD(lv, d, _("Include file"), new OkCancelPolicy),
|
||||
dialog_(0), ih_(0), inset_(0)
|
||||
{
|
||||
d->showInclude.connect(slot(this, &FormInclude::showInset));
|
||||
d->createInclude.connect(slot(this, &FormInclude::createInset));
|
||||
d->showInclude.connect(slot(this, &FormInclude::showInclude));
|
||||
}
|
||||
|
||||
|
||||
@ -48,12 +47,39 @@ FormInclude::~FormInclude()
|
||||
|
||||
FL_FORM * FormInclude::form() const
|
||||
{
|
||||
if (dialog_)
|
||||
if (dialog_)
|
||||
return dialog_->form;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void FormInclude::connect()
|
||||
{
|
||||
u_ = d_->updateBufferDependent.
|
||||
connect(slot(this, &FormInclude::updateSlot));
|
||||
h_ = d_->hideBufferDependent.
|
||||
connect(slot(this, &FormInclude::hide));
|
||||
FormBase::connect();
|
||||
}
|
||||
|
||||
|
||||
void FormInclude::disconnect()
|
||||
{
|
||||
ih_.disconnect();
|
||||
FormBaseBD::disconnect();
|
||||
inset_ = 0;
|
||||
}
|
||||
|
||||
|
||||
void FormInclude::updateSlot(bool switched)
|
||||
{
|
||||
if (switched)
|
||||
hide();
|
||||
else
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void FormInclude::build()
|
||||
{
|
||||
dialog_ = build_include();
|
||||
@ -67,13 +93,24 @@ void FormInclude::build()
|
||||
bc_.setCancel(dialog_->button_cancel);
|
||||
bc_.refresh();
|
||||
|
||||
bc_.addReadOnly(dialog_->browsebt);
|
||||
bc_.addReadOnly(dialog_->flag1);
|
||||
bc_.addReadOnly(dialog_->flag2);
|
||||
bc_.addReadOnly(dialog_->flag3);
|
||||
bc_.addReadOnly(dialog_->flag4);
|
||||
bc_.addReadOnly(dialog_->filename);
|
||||
bc_.addReadOnly(dialog_->flag41);
|
||||
bc_.addReadOnly(dialog_->button_browse);
|
||||
bc_.addReadOnly(dialog_->check_verbatim);
|
||||
bc_.addReadOnly(dialog_->check_typeset);
|
||||
bc_.addReadOnly(dialog_->check_useinput);
|
||||
bc_.addReadOnly(dialog_->check_useinclude);
|
||||
}
|
||||
|
||||
|
||||
void FormInclude::showInclude(InsetInclude * inset)
|
||||
{
|
||||
// If connected to another inset, disconnect from it.
|
||||
if (inset_)
|
||||
ih_.disconnect();
|
||||
|
||||
inset_ = inset;
|
||||
params = inset->params();
|
||||
ih_ = inset->hideDialog.connect(slot(this, &FormInclude::hide));
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
@ -82,34 +119,36 @@ void FormInclude::update()
|
||||
bc_.readOnly(lv_->buffer()->isReadonly());
|
||||
|
||||
if (!inset_) {
|
||||
fl_set_input(dialog_->filename, "");
|
||||
fl_set_button(dialog_->flag1, 0);
|
||||
fl_set_button(dialog_->flag2, 0);
|
||||
fl_set_button(dialog_->flag3, 1);
|
||||
fl_set_button(dialog_->flag4, 0);
|
||||
fl_set_button(dialog_->flag41, 0);
|
||||
fl_deactivate_object(dialog_->flag41);
|
||||
fl_set_object_lcol(dialog_->flag41, FL_INACTIVE);
|
||||
fl_set_input(dialog_->input_filename, "");
|
||||
fl_set_button(dialog_->check_typeset, 0);
|
||||
fl_set_button(dialog_->check_useinput, 0);
|
||||
fl_set_button(dialog_->check_useinclude, 1);
|
||||
fl_set_button(dialog_->check_verbatim, 0);
|
||||
fl_set_button(dialog_->check_visiblespace, 0);
|
||||
fl_deactivate_object(dialog_->check_visiblespace);
|
||||
fl_set_object_lcol(dialog_->check_visiblespace, FL_INACTIVE);
|
||||
return;
|
||||
}
|
||||
|
||||
fl_set_input(dialog_->filename, params.getContents().c_str());
|
||||
|
||||
string const cmdname = params.getCmdName();
|
||||
|
||||
/* FIXME: what do with Don't typeset here ... */
|
||||
//fl_set_button(dialog_->flag1, int(inset_->isNoLoad()));
|
||||
|
||||
fl_set_button(dialog_->flag2, cmdname == "input");
|
||||
fl_set_button(dialog_->flag3, cmdname == "include");
|
||||
|
||||
fl_set_input(dialog_->input_filename, params.cparams.getContents().c_str());
|
||||
|
||||
string const cmdname = params.cparams.getCmdName();
|
||||
|
||||
fl_set_button(dialog_->check_typeset, int(params.noload));
|
||||
|
||||
fl_set_button(dialog_->check_useinput, cmdname == "input");
|
||||
fl_set_button(dialog_->check_useinclude, cmdname == "include");
|
||||
if (cmdname == "verbatiminput" || cmdname == "verbatiminput*") {
|
||||
fl_set_button(dialog_->flag4, 1);
|
||||
fl_set_button(dialog_->flag41, cmdname == "verbatiminput*");
|
||||
fl_set_button(dialog_->check_verbatim, 1);
|
||||
fl_set_button(dialog_->check_visiblespace, cmdname == "verbatiminput*");
|
||||
setEnabled(dialog_->check_visiblespace, true);
|
||||
} else {
|
||||
fl_set_button(dialog_->flag41, 0);
|
||||
fl_deactivate_object(dialog_->flag41);
|
||||
fl_set_object_lcol(dialog_->flag41, FL_INACTIVE);
|
||||
fl_set_button(dialog_->check_visiblespace, 0);
|
||||
setEnabled(dialog_->check_visiblespace, false);
|
||||
}
|
||||
|
||||
if (cmdname.empty())
|
||||
fl_set_button(dialog_->check_useinclude, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -118,91 +157,83 @@ void FormInclude::apply()
|
||||
if (lv_->buffer()->isReadonly())
|
||||
return;
|
||||
|
||||
/* FIXME: no way to update internal flags of inset ??? */
|
||||
|
||||
//inset_->setNoLoad(fl_get_button(dialog_->flag1));
|
||||
|
||||
params.setContents(fl_get_input(dialog_->filename));
|
||||
params.noload = fl_get_button(dialog_->check_typeset);
|
||||
|
||||
if (fl_get_button(dialog_->flag2))
|
||||
params.setCmdName("input");
|
||||
else if (fl_get_button(dialog_->flag3))
|
||||
params.setCmdName("include");
|
||||
else if (fl_get_button(dialog_->flag4)) {
|
||||
if (fl_get_button(dialog_->flag41))
|
||||
params.setCmdName("verbatiminput*");
|
||||
params.cparams.setContents(fl_get_input(dialog_->input_filename));
|
||||
|
||||
if (fl_get_button(dialog_->check_useinput))
|
||||
params.flag = InsetInclude::INPUT;
|
||||
else if (fl_get_button(dialog_->check_useinclude))
|
||||
params.flag = InsetInclude::INCLUDE;
|
||||
else if (fl_get_button(dialog_->check_verbatim)) {
|
||||
if (fl_get_button(dialog_->check_visiblespace))
|
||||
params.flag = InsetInclude::VERBAST;
|
||||
else
|
||||
params.setCmdName("verbatiminput");
|
||||
params.flag = InsetInclude::VERB;
|
||||
}
|
||||
|
||||
if (inset_) {
|
||||
if (params != inset_->params()) {
|
||||
inset_->setParams(params);
|
||||
lv_->view()->updateInset(inset_, true);
|
||||
}
|
||||
} else
|
||||
lv_->getLyXFunc()->Dispatch(LFUN_CHILD_INSERT, params.getAsString());
|
||||
inset_->setFromParams(params);
|
||||
lv_->view()->updateInset(inset_, true);
|
||||
}
|
||||
|
||||
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning convert this to use the buttoncontroller
|
||||
#endif
|
||||
bool FormInclude::input(FL_OBJECT *, long data)
|
||||
{
|
||||
State state = static_cast<State>(data);
|
||||
|
||||
State state = static_cast<State>(data);
|
||||
|
||||
switch (state) {
|
||||
case BROWSE: {
|
||||
// Should browsing too be disabled in RO-mode?
|
||||
FileDialog fileDlg(lv_, _("Select document to include"),
|
||||
LFUN_SELECT_FILE_SYNC,
|
||||
make_pair(string(_("Documents")), string(lyxrc.document_path)));
|
||||
|
||||
|
||||
string ext;
|
||||
|
||||
|
||||
/* input TeX, verbatim, or LyX file ? */
|
||||
if (fl_get_button(dialog_->flag2))
|
||||
if (fl_get_button(dialog_->check_useinput))
|
||||
ext = _("*.tex| LaTeX Documents (*.tex)");
|
||||
else if (fl_get_button(dialog_->flag4))
|
||||
else if (fl_get_button(dialog_->check_verbatim))
|
||||
ext = _("*| All files ");
|
||||
else
|
||||
ext = _("*.lyx| LyX Documents (*.lyx)");
|
||||
|
||||
|
||||
string mpath;
|
||||
|
||||
/* FIXME: what do I do here ? */
|
||||
//if (inset_)
|
||||
// mpath = OnlyPath(inset_->getMasterFilename());
|
||||
|
||||
FileDialog::Result result = fileDlg.Select(mpath, ext, fl_get_input(dialog_->filename));
|
||||
|
||||
|
||||
mpath = OnlyPath(params.buffer->fileName());
|
||||
|
||||
FileDialog::Result result = fileDlg.Select(mpath, ext, fl_get_input(dialog_->input_filename));
|
||||
|
||||
// check selected filename
|
||||
if (result.second.empty())
|
||||
break;
|
||||
|
||||
|
||||
string const filename2 = MakeRelPath(result.second, mpath);
|
||||
|
||||
|
||||
if (prefixIs(filename2, ".."))
|
||||
fl_set_input(dialog_->filename, result.second.c_str());
|
||||
fl_set_input(dialog_->input_filename, result.second.c_str());
|
||||
else
|
||||
fl_set_input(dialog_->filename, filename2.c_str());
|
||||
|
||||
fl_set_input(dialog_->input_filename, filename2.c_str());
|
||||
|
||||
} break;
|
||||
|
||||
case LOAD:
|
||||
apply();
|
||||
lv_->getLyXFunc()->Dispatch(LFUN_CHILDOPEN, params.getContents());
|
||||
if (compare(fl_get_input(dialog_->input_filename),"")) {
|
||||
apply();
|
||||
lv_->getLyXFunc()->Dispatch(LFUN_CHILDOPEN, params.cparams.getContents());
|
||||
}
|
||||
break;
|
||||
|
||||
case VERBATIM:
|
||||
setEnabled(dialog_->flag41, true);
|
||||
setEnabled(dialog_->check_visiblespace, true);
|
||||
break;
|
||||
|
||||
|
||||
case INPUTINCLUDE:
|
||||
/* FIXME: huh ? why doesn't this work ? */
|
||||
setEnabled(dialog_->flag41, false);
|
||||
fl_set_button(dialog_->flag41, 0);
|
||||
fl_set_button(dialog_->check_visiblespace, 0);
|
||||
setEnabled(dialog_->check_visiblespace, false);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
@ -13,7 +13,8 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "FormInset.h"
|
||||
#include "FormBase.h"
|
||||
#include "insets/insetinclude.h"
|
||||
|
||||
class InsetInclude;
|
||||
|
||||
@ -21,7 +22,7 @@ struct FD_form_include;
|
||||
|
||||
/** This class provides an XForms implementation of the FormInclude Dialog.
|
||||
*/
|
||||
class FormInclude : public FormCommand {
|
||||
class FormInclude : public FormBaseBD {
|
||||
public:
|
||||
///
|
||||
FormInclude(LyXView *, Dialogs *);
|
||||
@ -40,6 +41,14 @@ private:
|
||||
INPUTINCLUDE=11
|
||||
};
|
||||
|
||||
/// Slot launching dialog to an existing inset
|
||||
void showInclude(InsetInclude *);
|
||||
|
||||
/// Connect signals. Also perform any necessary initialisation.
|
||||
virtual void connect();
|
||||
/// Disconnect signals. Also perform any necessary housekeeping.
|
||||
virtual void disconnect();
|
||||
|
||||
/// Build the dialog
|
||||
virtual void build();
|
||||
/// Filter the inputs
|
||||
@ -50,12 +59,23 @@ private:
|
||||
virtual void apply();
|
||||
/// Pointer to the actual instantiation of the xforms form
|
||||
virtual FL_FORM * form() const;
|
||||
/// bool indicates if a buffer switch took place
|
||||
virtual void updateSlot(bool);
|
||||
|
||||
|
||||
/// Type definition from the fdesign produced header file.
|
||||
FD_form_include * build_include();
|
||||
|
||||
/// Real GUI implementation.
|
||||
FD_form_include * dialog_;
|
||||
|
||||
/// inset::hide connection.
|
||||
Connection ih_;
|
||||
|
||||
/// pointer to the inset passed through showInset
|
||||
InsetInclude * inset_;
|
||||
/// the nitty-gritty. What is modified and passed back
|
||||
InsetInclude::InsetIncludeParams params;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -28,14 +28,14 @@ FD_form_include * FormInclude::build_include()
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 70, 160, 90, "");
|
||||
{
|
||||
char const * const dummy = N_("Browse|#B");
|
||||
fdui->browsebt = obj = fl_add_button(FL_NORMAL_BUTTON, 230, 30, 100, 30, idex(_(dummy)));
|
||||
fdui->button_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 230, 30, 100, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Don't typeset|#D");
|
||||
fdui->flag1 = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 180, 70, 150, 30, idex(_(dummy)));
|
||||
fdui->check_typeset = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 180, 70, 150, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
@ -51,21 +51,21 @@ FD_form_include * FormInclude::build_include()
|
||||
fl_set_object_callback(obj, C_FormBaseCancelCB, 2);
|
||||
{
|
||||
char const * const dummy = N_("Load|#L");
|
||||
fdui->loadbt = obj = fl_add_button(FL_NORMAL_BUTTON, 230, 130, 100, 30, idex(_(dummy)));
|
||||
fdui->button_load = obj = fl_add_button(FL_NORMAL_BUTTON, 230, 130, 100, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 5);
|
||||
{
|
||||
char const * const dummy = N_("File name:|#F");
|
||||
fdui->filename = obj = fl_add_input(FL_NORMAL_INPUT, 10, 30, 210, 30, idex(_(dummy)));
|
||||
fdui->input_filename = obj = fl_add_input(FL_NORMAL_INPUT, 10, 30, 210, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
{
|
||||
char const * const dummy = N_("Visible space|#s");
|
||||
fdui->flag41 = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 180, 100, 150, 30, idex(_(dummy)));
|
||||
fdui->check_visiblespace = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 180, 100, 150, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
@ -73,21 +73,21 @@ FD_form_include * FormInclude::build_include()
|
||||
fdui->include_grp = fl_bgn_group();
|
||||
{
|
||||
char const * const dummy = N_("Verbatim|#V");
|
||||
fdui->flag4 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 130, 160, 30, idex(_(dummy)));
|
||||
fdui->check_verbatim = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 130, 160, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 10);
|
||||
{
|
||||
char const * const dummy = N_("Use input|#i");
|
||||
fdui->flag2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 100, 160, 30, idex(_(dummy)));
|
||||
fdui->check_useinput = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 100, 160, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 11);
|
||||
{
|
||||
char const * const dummy = N_("Use include|#U");
|
||||
fdui->flag3 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 70, 160, 30, idex(_(dummy)));
|
||||
fdui->check_useinclude = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 70, 160, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
|
@ -15,17 +15,17 @@ struct FD_form_include {
|
||||
~FD_form_include();
|
||||
|
||||
FL_FORM *form;
|
||||
FL_OBJECT *browsebt;
|
||||
FL_OBJECT *flag1;
|
||||
FL_OBJECT *button_browse;
|
||||
FL_OBJECT *check_typeset;
|
||||
FL_OBJECT *button_ok;
|
||||
FL_OBJECT *button_cancel;
|
||||
FL_OBJECT *loadbt;
|
||||
FL_OBJECT *filename;
|
||||
FL_OBJECT *flag41;
|
||||
FL_OBJECT *button_load;
|
||||
FL_OBJECT *input_filename;
|
||||
FL_OBJECT *check_visiblespace;
|
||||
FL_OBJECT *include_grp;
|
||||
FL_OBJECT *flag4;
|
||||
FL_OBJECT *flag2;
|
||||
FL_OBJECT *flag3;
|
||||
FL_OBJECT *check_verbatim;
|
||||
FL_OBJECT *check_useinput;
|
||||
FL_OBJECT *check_useinclude;
|
||||
};
|
||||
|
||||
#endif /* FD_form_include_h_ */
|
||||
|
@ -62,7 +62,7 @@ label: Browse|#B
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: browsebt
|
||||
name: button_browse
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
@ -80,7 +80,7 @@ label: Don't typeset|#D
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: flag1
|
||||
name: check_typeset
|
||||
callback:
|
||||
argument:
|
||||
|
||||
@ -134,7 +134,7 @@ label: Load|#L
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: loadbt
|
||||
name: button_load
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 5
|
||||
|
||||
@ -152,7 +152,7 @@ label: File name:|#F
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: filename
|
||||
name: input_filename
|
||||
callback:
|
||||
argument:
|
||||
|
||||
@ -170,7 +170,7 @@ label: Visible space|#s
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: flag41
|
||||
name: check_visiblespace
|
||||
callback:
|
||||
argument:
|
||||
|
||||
@ -206,7 +206,7 @@ label: Verbatim|#V
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: flag4
|
||||
name: check_verbatim
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 10
|
||||
|
||||
@ -224,7 +224,7 @@ label: Use input|#i
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: flag2
|
||||
name: check_useinput
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 11
|
||||
|
||||
@ -242,7 +242,7 @@ label: Use include|#U
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: flag3
|
||||
name: check_useinclude
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 11
|
||||
|
||||
|
@ -15,6 +15,12 @@
|
||||
* insetexternal.h:
|
||||
* insetexternal.C: move form to GUII
|
||||
|
||||
2001-03-12 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* insetinclude.h:
|
||||
* insetinclude.C: add InsetIncludeParams, use
|
||||
composition rather than derivation of InsetCommand
|
||||
|
||||
2001-03-12 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||
|
||||
* insettoc.C (Ascii): use the Buffer typedefs
|
||||
|
@ -8,7 +8,7 @@
|
||||
#endif
|
||||
|
||||
#include "frontends/Dialogs.h"
|
||||
|
||||
|
||||
#include "insetinclude.h"
|
||||
#include "buffer.h"
|
||||
#include "bufferlist.h"
|
||||
@ -42,33 +42,70 @@ string unique_id() {
|
||||
}
|
||||
|
||||
|
||||
InsetInclude::InsetInclude(InsetCommandParams const & p, Buffer const & bf)
|
||||
: InsetCommand(p), master(&bf)
|
||||
InsetInclude::InsetInclude(InsetIncludeParams const & p)
|
||||
{
|
||||
flag = InsetInclude::INCLUDE;
|
||||
noload = false;
|
||||
include_label = unique_id();
|
||||
setFromParams(p);
|
||||
params_.buffer = p.buffer;
|
||||
}
|
||||
|
||||
|
||||
InsetInclude::InsetInclude(InsetCommandParams const & p, Buffer const & b)
|
||||
{
|
||||
include_label = unique_id();
|
||||
params_.buffer = &b;
|
||||
setFromParams(p);
|
||||
}
|
||||
|
||||
|
||||
InsetInclude::~InsetInclude()
|
||||
{
|
||||
hideDialog();
|
||||
}
|
||||
|
||||
|
||||
InsetInclude::InsetIncludeParams const & InsetInclude::params() const
|
||||
{
|
||||
return params_;
|
||||
}
|
||||
|
||||
|
||||
void InsetInclude::setFromParams(InsetIncludeParams const & p)
|
||||
{
|
||||
params_.cparams.setContents(p.cparams.getContents());
|
||||
params_.noload = p.noload;
|
||||
if (params_.flag == p.flag)
|
||||
return;
|
||||
|
||||
params_.flag = p.flag;
|
||||
|
||||
string command;
|
||||
|
||||
switch (params_.flag) {
|
||||
case INCLUDE:
|
||||
command="include";
|
||||
break;
|
||||
case VERB:
|
||||
command="verbatiminput";
|
||||
break;
|
||||
case INPUT:
|
||||
command="input";
|
||||
break;
|
||||
case VERBAST:
|
||||
command="verbatiminput*";
|
||||
break;
|
||||
}
|
||||
|
||||
params_.cparams.setCmdName(command);
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetInclude::Clone(Buffer const & buffer) const
|
||||
{
|
||||
InsetInclude * ii = new InsetInclude (params(), buffer);
|
||||
ii->setNoLoad(isNoLoad());
|
||||
// By default, the newly created inset is of `include' type,
|
||||
// so we do not test this case.
|
||||
if (isInput())
|
||||
ii->setInput();
|
||||
else if (isVerb()) {
|
||||
ii->setVerb();
|
||||
ii->setVisibleSpace(isVerbVisibleSpace());
|
||||
}
|
||||
return ii;
|
||||
{
|
||||
InsetIncludeParams p(params_);
|
||||
p.buffer = &buffer;
|
||||
|
||||
return new InsetInclude (p);
|
||||
}
|
||||
|
||||
|
||||
@ -80,71 +117,84 @@ void InsetInclude::Edit(BufferView * bv, int, int, unsigned int)
|
||||
|
||||
void InsetInclude::Write(Buffer const *, ostream & os) const
|
||||
{
|
||||
os << "Include " << getCommand() << "\n";
|
||||
os << "Include " << params_.cparams.getCommand() << "\n";
|
||||
}
|
||||
|
||||
|
||||
void InsetInclude::Read(Buffer const * buf, LyXLex & lex)
|
||||
void InsetInclude::Read(Buffer const *, LyXLex & lex)
|
||||
{
|
||||
InsetCommand::Read(buf, lex);
|
||||
|
||||
if (getCmdName() == "include")
|
||||
setInclude();
|
||||
else if (getCmdName() == "input")
|
||||
setInput();
|
||||
else if (contains(getCmdName(), "verbatim")) {
|
||||
setVerb();
|
||||
if (getCmdName() == "verbatiminput*")
|
||||
setVisibleSpace(true);
|
||||
params_.cparams.Read(lex);
|
||||
|
||||
if (params_.cparams.getCmdName() == "include")
|
||||
params_.flag = INCLUDE;
|
||||
else if (params_.cparams.getCmdName() == "input")
|
||||
params_.flag = INPUT;
|
||||
/* FIXME: is this logic necessary now ? */
|
||||
else if (contains(params_.cparams.getCmdName(), "verbatim")) {
|
||||
params_.flag = VERB;
|
||||
if (params_.cparams.getCmdName() == "verbatiminput*")
|
||||
params_.flag = VERBAST;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool InsetInclude::display() const
|
||||
bool InsetInclude::display() const
|
||||
{
|
||||
return !isInput();
|
||||
return !(params_.flag == INPUT);
|
||||
}
|
||||
|
||||
|
||||
string const InsetInclude::getScreenLabel() const
|
||||
{
|
||||
string temp;
|
||||
if (isInput())
|
||||
temp += _("Input");
|
||||
else if (isVerb()) {
|
||||
temp += _("Verbatim Input");
|
||||
if (isVerbVisibleSpace()) temp += '*';
|
||||
} else temp += _("Include");
|
||||
|
||||
switch (params_.flag) {
|
||||
case INPUT: temp += _("Input"); break;
|
||||
case VERB: temp += _("Verbatim Input"); break;
|
||||
case VERBAST: temp += _("Verbatim Input*"); break;
|
||||
case INCLUDE: temp += _("Include"); break;
|
||||
}
|
||||
|
||||
temp += ": ";
|
||||
|
||||
if (getContents().empty()) {
|
||||
temp+= "???";
|
||||
} else {
|
||||
temp+= getContents();
|
||||
}
|
||||
if (params_.cparams.getContents().empty())
|
||||
temp += "???";
|
||||
else
|
||||
temp += params_.cparams.getContents();
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
string const InsetInclude::getRelFileBaseName() const
|
||||
{
|
||||
return OnlyFilename(ChangeExtension(params_.cparams.getContents(), string()));
|
||||
}
|
||||
|
||||
|
||||
string const InsetInclude::getFileName() const
|
||||
{
|
||||
return MakeAbsPath(getContents(),
|
||||
return MakeAbsPath(params_.cparams.getContents(),
|
||||
OnlyPath(getMasterFilename()));
|
||||
}
|
||||
|
||||
|
||||
string const InsetInclude::getMasterFilename() const
|
||||
{
|
||||
return master->fileName();
|
||||
return params_.buffer->fileName();
|
||||
}
|
||||
|
||||
|
||||
bool InsetInclude::loadIfNeeded() const
|
||||
{
|
||||
if (isNoLoad() || isVerb()) return false;
|
||||
if (!IsLyXFilename(getFileName())) return false;
|
||||
if (params_.noload || isVerbatim())
|
||||
return false;
|
||||
|
||||
if (!IsLyXFilename(getFileName()))
|
||||
return false;
|
||||
|
||||
if (bufferlist.exists(getFileName())) return true;
|
||||
if (bufferlist.exists(getFileName()))
|
||||
return true;
|
||||
|
||||
// the readonly flag can/will be wrong, not anymore I think.
|
||||
FileInfo finfo(getFileName());
|
||||
@ -156,15 +206,16 @@ bool InsetInclude::loadIfNeeded() const
|
||||
int InsetInclude::Latex(Buffer const * buffer, ostream & os,
|
||||
bool /*fragile*/, bool /*fs*/) const
|
||||
{
|
||||
string incfile(getContents());
|
||||
string incfile(params_.cparams.getContents());
|
||||
|
||||
// Do nothing if no file name has been specified
|
||||
if (incfile.empty())
|
||||
return 0;
|
||||
|
||||
|
||||
if (loadIfNeeded()) {
|
||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||
|
||||
// FIXME: this should be a GUI warning
|
||||
if (tmp->params.textclass != buffer->params.textclass) {
|
||||
lyxerr << "WARNING: Included file `"
|
||||
<< MakeDisplayPath(getFileName())
|
||||
@ -178,6 +229,7 @@ int InsetInclude::Latex(Buffer const * buffer, ostream & os,
|
||||
|
||||
// write it to a file (so far the complete file)
|
||||
string writefile = ChangeExtension(getFileName(), ".tex");
|
||||
|
||||
if (!buffer->tmppath.empty()
|
||||
&& !buffer->niceFile) {
|
||||
incfile = subst(incfile, '/','@');
|
||||
@ -194,25 +246,25 @@ int InsetInclude::Latex(Buffer const * buffer, ostream & os,
|
||||
tmp->markDepClean(buffer->tmppath);
|
||||
|
||||
tmp->makeLaTeXFile(writefile,
|
||||
OnlyPath(getMasterFilename()),
|
||||
OnlyPath(getMasterFilename()),
|
||||
buffer->niceFile, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (isVerb()) {
|
||||
os << '\\' << getCmdName() << '{' << incfile << '}';
|
||||
} else if (isInput()) {
|
||||
if (isVerbatim()) {
|
||||
os << '\\' << params_.cparams.getCmdName() << '{' << incfile << '}';
|
||||
} else if (params_.flag == INPUT) {
|
||||
// \input wants file with extension (default is .tex)
|
||||
if (!IsLyXFilename(getFileName())) {
|
||||
os << '\\' << getCmdName() << '{' << incfile << '}';
|
||||
os << '\\' << params_.cparams.getCmdName() << '{' << incfile << '}';
|
||||
} else {
|
||||
os << '\\' << getCmdName() << '{'
|
||||
os << '\\' << params_.cparams.getCmdName() << '{'
|
||||
<< ChangeExtension(incfile, ".tex")
|
||||
<< '}';
|
||||
}
|
||||
} else {
|
||||
// \include don't want extension and demands that the
|
||||
// file really have .tex
|
||||
os << '\\' << getCmdName() << '{'
|
||||
os << '\\' << params_.cparams.getCmdName() << '{'
|
||||
<< ChangeExtension(incfile, string())
|
||||
<< '}';
|
||||
}
|
||||
@ -223,7 +275,7 @@ int InsetInclude::Latex(Buffer const * buffer, ostream & os,
|
||||
|
||||
int InsetInclude::Ascii(Buffer const *, std::ostream & os, int) const
|
||||
{
|
||||
if (isVerb())
|
||||
if (isVerbatim())
|
||||
os << GetFileContents(getFileName());
|
||||
return 0;
|
||||
}
|
||||
@ -231,12 +283,12 @@ int InsetInclude::Ascii(Buffer const *, std::ostream & os, int) const
|
||||
|
||||
int InsetInclude::Linuxdoc(Buffer const * buffer, ostream & os) const
|
||||
{
|
||||
string incfile(getContents());
|
||||
string incfile(params_.cparams.getContents());
|
||||
|
||||
// Do nothing if no file name has been specified
|
||||
if (incfile.empty())
|
||||
return 0;
|
||||
|
||||
|
||||
if (loadIfNeeded()) {
|
||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||
|
||||
@ -255,13 +307,13 @@ int InsetInclude::Linuxdoc(Buffer const * buffer, ostream & os) const
|
||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||
|
||||
tmp->makeLinuxDocFile(writefile, buffer->niceFile, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (isVerb()) {
|
||||
if (isVerbatim()) {
|
||||
os << "<inlinegraphic fileref=\"" << '&' << include_label << ';'
|
||||
<< "\" format=\"linespecific\">"
|
||||
<< "</inlinegraphic>";
|
||||
} else
|
||||
} else
|
||||
os << '&' << include_label << ';';
|
||||
|
||||
return 0;
|
||||
@ -270,12 +322,12 @@ int InsetInclude::Linuxdoc(Buffer const * buffer, ostream & os) const
|
||||
|
||||
int InsetInclude::DocBook(Buffer const * buffer, ostream & os) const
|
||||
{
|
||||
string incfile(getContents());
|
||||
string incfile(params_.cparams.getContents());
|
||||
|
||||
// Do nothing if no file name has been specified
|
||||
if (incfile.empty())
|
||||
return 0;
|
||||
|
||||
|
||||
if (loadIfNeeded()) {
|
||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||
|
||||
@ -293,13 +345,13 @@ int InsetInclude::DocBook(Buffer const * buffer, ostream & os) const
|
||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||
|
||||
tmp->makeDocBookFile(writefile, buffer->niceFile, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (isVerb()) {
|
||||
if (isVerbatim()) {
|
||||
os << "<inlinegraphic fileref=\"" << '&' << include_label << ';'
|
||||
<< "\" format=\"linespecific\">"
|
||||
<< "</inlinegraphic>";
|
||||
} else
|
||||
} else
|
||||
os << '&' << include_label << ';';
|
||||
|
||||
return 0;
|
||||
@ -309,23 +361,23 @@ int InsetInclude::DocBook(Buffer const * buffer, ostream & os) const
|
||||
void InsetInclude::Validate(LaTeXFeatures & features) const
|
||||
{
|
||||
|
||||
string incfile(getContents());
|
||||
string writefile; // = ChangeExtension(getFileName(), ".sgml");
|
||||
string incfile(params_.cparams.getContents());
|
||||
string writefile;
|
||||
|
||||
if (!master->tmppath.empty() && !master->niceFile) {
|
||||
Buffer const & b = *params_.buffer;
|
||||
|
||||
if (!b.tmppath.empty() && b.niceFile) {
|
||||
incfile = subst(incfile, '/','@');
|
||||
writefile = AddName(master->tmppath, incfile);
|
||||
writefile = AddName(b.tmppath, incfile);
|
||||
} else
|
||||
writefile = getFileName();
|
||||
// Use the relative path.
|
||||
//writefile = incfile;
|
||||
|
||||
if (IsLyXFilename(getFileName()))
|
||||
writefile = ChangeExtension(writefile, ".sgml");
|
||||
|
||||
features.IncludedFiles[include_label] = writefile;
|
||||
|
||||
if (isVerb())
|
||||
if (isVerbatim())
|
||||
features.verbatim = true;
|
||||
|
||||
// Here we must do the fun stuff...
|
||||
@ -345,7 +397,7 @@ vector<string> const InsetInclude::getLabelList() const
|
||||
|
||||
if (loadIfNeeded()) {
|
||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||
tmp->setParentName("");
|
||||
tmp->setParentName("");
|
||||
l = tmp->getLabelList();
|
||||
tmp->setParentName(getMasterFilename());
|
||||
}
|
||||
@ -360,7 +412,7 @@ vector<pair<string,string> > const InsetInclude::getKeys() const
|
||||
|
||||
if (loadIfNeeded()) {
|
||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||
tmp->setParentName("");
|
||||
tmp->setParentName("");
|
||||
keys = tmp->getBibkeyList();
|
||||
tmp->setParentName(getMasterFilename());
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
*
|
||||
* Copyright 1997 LyX Team (this file was created this year)
|
||||
*
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
#ifndef INSET_INCLUDE_H
|
||||
@ -24,12 +24,43 @@ struct LaTeXFeatures;
|
||||
|
||||
/** Used to include files
|
||||
*/
|
||||
class InsetInclude: public InsetCommand {
|
||||
class InsetInclude: public InsetButton, public noncopyable {
|
||||
public:
|
||||
/// the type of inclusion
|
||||
enum IncludeFlags {
|
||||
///
|
||||
INCLUDE= 0,
|
||||
///
|
||||
VERB = 1,
|
||||
///
|
||||
INPUT = 2,
|
||||
///
|
||||
VERBAST = 3
|
||||
};
|
||||
|
||||
struct InsetIncludeParams {
|
||||
InsetIncludeParams(InsetCommandParams const & cp = InsetCommandParams(),
|
||||
IncludeFlags f = INCLUDE, bool nl = false, Buffer const * b = 0)
|
||||
: cparams(cp), flag(f), noload(nl), buffer(b) {}
|
||||
InsetCommandParams cparams;
|
||||
IncludeFlags flag;
|
||||
bool noload;
|
||||
Buffer const * buffer;
|
||||
};
|
||||
|
||||
///
|
||||
InsetInclude(InsetIncludeParams const &);
|
||||
///
|
||||
InsetInclude(InsetCommandParams const &, Buffer const &);
|
||||
///
|
||||
~InsetInclude();
|
||||
|
||||
/// get the parameters
|
||||
InsetIncludeParams const & params(void) const;
|
||||
|
||||
/// set the parameters
|
||||
void setFromParams(InsetIncludeParams const & params);
|
||||
|
||||
///
|
||||
Inset * Clone(Buffer const &) const;
|
||||
///
|
||||
@ -49,7 +80,7 @@ public:
|
||||
void Write(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
void Read(Buffer const *, LyXLex &);
|
||||
///
|
||||
///
|
||||
int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
|
||||
///
|
||||
int Ascii(Buffer const *, std::ostream &, int linelen) const;
|
||||
@ -64,117 +95,44 @@ public:
|
||||
Display can give some visual feedback
|
||||
*/
|
||||
bool display() const;
|
||||
///
|
||||
string const getScreenLabel() const;
|
||||
///
|
||||
string const getMasterFilename() const;
|
||||
///
|
||||
string const getFileName() const;
|
||||
|
||||
/// In "input" mode uses \input instead of \include.
|
||||
bool isInput() const { return flag == InsetInclude::INPUT; }
|
||||
/// If this is true, the child file shouldn't be loaded by lyx
|
||||
bool isNoLoad() const { return noload; }
|
||||
/// return the filename stub of the included file
|
||||
string const getRelFileBaseName() const;
|
||||
|
||||
/// return true if the included file is not loaded
|
||||
bool isIncludeOnly() const;
|
||||
|
||||
/** A verbatim file shouldn't be loaded by LyX
|
||||
* No need to generate LaTeX code of a verbatim file
|
||||
*/
|
||||
bool isVerb() const;
|
||||
///
|
||||
bool isVerbVisibleSpace() const {
|
||||
return flag == InsetInclude::VERBAST;
|
||||
}
|
||||
///
|
||||
bool isInclude() const { return flag == InsetInclude::INCLUDE;}
|
||||
///
|
||||
void setInput();
|
||||
///
|
||||
void setNoLoad(bool);
|
||||
///
|
||||
void setInclude();
|
||||
///
|
||||
void setVerb();
|
||||
///
|
||||
void setVisibleSpace(bool b);
|
||||
/// return true if the file is or got loaded.
|
||||
bool loadIfNeeded() const;
|
||||
|
||||
/// hide a dialog if about
|
||||
Signal0<void> hideDialog;
|
||||
private:
|
||||
///
|
||||
enum Include_Flags {
|
||||
///
|
||||
INCLUDE= 0,
|
||||
///
|
||||
VERB = 1,
|
||||
///
|
||||
INPUT = 2,
|
||||
///
|
||||
VERBAST = 3
|
||||
};
|
||||
|
||||
///
|
||||
bool noload;
|
||||
///
|
||||
int flag;
|
||||
///
|
||||
Buffer const * master;
|
||||
/// get the text displayed on the button
|
||||
string const getScreenLabel() const;
|
||||
/// is this a verbatim include ?
|
||||
bool isVerbatim() const;
|
||||
/// get the filename of the master buffer
|
||||
string const getMasterFilename() const;
|
||||
/// get the included file name
|
||||
string const getFileName() const;
|
||||
|
||||
/// the parameters
|
||||
InsetIncludeParams params_;
|
||||
///
|
||||
string include_label;
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
bool InsetInclude::isVerb() const
|
||||
inline bool InsetInclude::isVerbatim() const
|
||||
{
|
||||
return flag == InsetInclude::VERB || flag == InsetInclude::VERBAST;
|
||||
return params_.flag == VERB || params_.flag == VERBAST;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void InsetInclude::setInput()
|
||||
inline bool InsetInclude::isIncludeOnly() const
|
||||
{
|
||||
if (!isInput()) {
|
||||
flag = InsetInclude::INPUT;
|
||||
setCmdName("input");
|
||||
}
|
||||
return params_.flag == INCLUDE && params_.noload;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void InsetInclude::setNoLoad(bool b)
|
||||
{
|
||||
noload = b;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void InsetInclude::setInclude()
|
||||
{
|
||||
if (!isInclude()) {
|
||||
flag = InsetInclude::INCLUDE;
|
||||
setCmdName("include");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void InsetInclude::setVerb()
|
||||
{
|
||||
if (!isVerb()) {
|
||||
flag = InsetInclude::VERB;
|
||||
setCmdName("verbatiminput");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void InsetInclude::setVisibleSpace(bool b)
|
||||
{
|
||||
if (b && flag == InsetInclude::VERB) {
|
||||
setCmdName("verbatiminput*");
|
||||
flag = InsetInclude::VERBAST;
|
||||
} else if (!b && flag == InsetInclude::VERBAST) {
|
||||
setCmdName("verbatiminput");
|
||||
flag = InsetInclude::VERB;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1343,22 +1343,6 @@ string const LyXFunc::Dispatch(int ac,
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_CHILD_CREATE:
|
||||
{
|
||||
InsetCommandParams p("include");
|
||||
|
||||
if (!argument.empty()) {
|
||||
if (contains(argument, "|")) {
|
||||
p.setContents(token(argument, '|', 0));
|
||||
p.setOptions(token(argument, '|', 1));
|
||||
} else
|
||||
p.setContents(argument);
|
||||
Dispatch(LFUN_CHILD_INSERT, p.getAsString());
|
||||
} else
|
||||
owner->getDialogs()->createInclude(p.getAsString());
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_CHILDOPEN:
|
||||
{
|
||||
string const filename =
|
||||
|
Loading…
x
Reference in New Issue
Block a user