John's external material patch

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1909 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-04-11 17:14:20 +00:00
parent fc87f21ac1
commit 87998757a9
7 changed files with 40 additions and 26 deletions

View File

@ -1,3 +1,8 @@
2001-04-06 John Levon <moz@compsoc.man.ac.uk>
* ControlExternal.C: from Angus, clone the new InsetExternal
before acting on it
2001-04-09 Angus Leeming <a.leeming@ic.ac.uk> 2001-04-09 Angus Leeming <a.leeming@ic.ac.uk>
* helper_funcs.C (getStringFromVector, getVectorFromString): fixed bugs * helper_funcs.C (getStringFromVector, getVectorFromString): fixed bugs

View File

@ -9,7 +9,7 @@
* *
* \file ControlExternal.C * \file ControlExternal.C
* \author Asger Alstrup * \author Asger Alstrup
* \author John Levon * \author John Levon, moz@compsoc.man.ac.uk
* \author Angus Leeming, a.leeming@ic.ac.uk * \author Angus Leeming, a.leeming@ic.ac.uk
*/ */
@ -68,30 +68,33 @@ void ControlExternal::editExternal()
// Create a local copy of the inset and initialise it with this // Create a local copy of the inset and initialise it with this
// params struct. // params struct.
InsetExternal ie; boost::scoped_ptr<InsetExternal> ie;
ie.setFromParams(params()); ie.reset(static_cast<InsetExternal *>(inset()->Clone(*lv_.buffer())));
ie->setFromParams(params());
ie.editExternal(); ie->editExternal();
} }
void ControlExternal::viewExternal() void ControlExternal::viewExternal()
{ {
view().apply(); view().apply();
InsetExternal ie; boost::scoped_ptr<InsetExternal> ie;
ie.setFromParams(params()); ie.reset(static_cast<InsetExternal *>(inset()->Clone(*lv_.buffer())));
ie->setFromParams(params());
ie.viewExternal(); ie->viewExternal();
} }
void ControlExternal::updateExternal() void ControlExternal::updateExternal()
{ {
view().apply(); view().apply();
InsetExternal ie; boost::scoped_ptr<InsetExternal> ie;
ie.setFromParams(params()); ie.reset(static_cast<InsetExternal *>(inset()->Clone(*lv_.buffer())));
ie->setFromParams(params());
ie.updateExternal(); ie->updateExternal();
} }
vector<string> const ControlExternal::getTemplates() const vector<string> const ControlExternal::getTemplates() const

View File

@ -1,3 +1,7 @@
2001-04-06 John Levon <moz@compsoc.man.ac.uk>
* forms/form_external.fd: make params update state (from Angus)
2001-04-05 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2001-04-05 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* Menubar_pimpl.C: include gettext.h * Menubar_pimpl.C: include gettext.h

View File

@ -60,6 +60,7 @@ FD_form_external * FormExternal::build_external()
} }
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast); fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{ {
char const * const dummy = N_("Edit file|#E"); char const * const dummy = N_("Edit file|#E");
fdui->button_edit = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 50, 110, 30, idex(_(dummy))); fdui->button_edit = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 50, 110, 30, idex(_(dummy)));

View File

@ -117,8 +117,8 @@ shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_SouthWest FL_SouthEast gravity: FL_SouthWest FL_SouthEast
name: input_parameters name: input_parameters
callback: callback: C_FormBaseInputCB
argument: argument: 0
-------------------- --------------------
class: FL_BUTTON class: FL_BUTTON

View File

@ -34,9 +34,9 @@
using std::endl; using std::endl;
InsetExternal::InsetExternal() InsetExternal::InsetExternal()
: view(0) : view_(0)
{ {
tempname = lyx::tempName(string(), "lyxext"); tempname_ = lyx::tempName(string(), "lyxext");
//ExternalTemplateManager::Templates::const_iterator i1; //ExternalTemplateManager::Templates::const_iterator i1;
params_.templ = ExternalTemplateManager::get().getTemplates().begin()->second; params_.templ = ExternalTemplateManager::get().getTemplates().begin()->second;
} }
@ -44,7 +44,7 @@ InsetExternal::InsetExternal()
InsetExternal::~InsetExternal() InsetExternal::~InsetExternal()
{ {
lyx::unlink(tempname); lyx::unlink(tempname_);
hideDialog(); hideDialog();
} }
@ -72,8 +72,8 @@ string const InsetExternal::EditMessage() const
void InsetExternal::Edit(BufferView * bv, void InsetExternal::Edit(BufferView * bv,
int /*x*/, int /*y*/, unsigned int /*button*/) int /*x*/, int /*y*/, unsigned int /*button*/)
{ {
view = bv; view_ = bv;
view->owner()->getDialogs()->showExternal(this); view_->owner()->getDialogs()->showExternal(this);
} }
@ -189,6 +189,7 @@ Inset * InsetExternal::Clone(Buffer const &) const
{ {
InsetExternal * inset = new InsetExternal(); InsetExternal * inset = new InsetExternal();
inset->params_ = params_; inset->params_ = params_;
inset->view_ = view_;
return inset; return inset;
} }
@ -227,7 +228,7 @@ string const InsetExternal::doSubstitution(Buffer const * buffer,
result = subst(result, "$$Basename", basename); result = subst(result, "$$Basename", basename);
result = subst(result, "$$Parameters", params_.parameters); result = subst(result, "$$Parameters", params_.parameters);
result = ReplaceEnvironmentPath(result); result = ReplaceEnvironmentPath(result);
result = subst(result, "$$Tempname", tempname); result = subst(result, "$$Tempname", tempname_);
result = subst(result, "$$Sysdir", system_lyxdir); result = subst(result, "$$Sysdir", system_lyxdir);
// Handle the $$Contents(filename) syntax // Handle the $$Contents(filename) syntax
@ -263,9 +264,9 @@ void InsetExternal::updateExternal() const
if (cit == et.formats.end()) if (cit == et.formats.end())
return; return;
executeCommand(doSubstitution(view->buffer(), executeCommand(doSubstitution(view_->buffer(),
(*cit).second.updateCommand), (*cit).second.updateCommand),
view->buffer()); view_->buffer());
} }
@ -275,9 +276,9 @@ void InsetExternal::viewExternal() const
if (et.automaticProduction) if (et.automaticProduction)
updateExternal(); updateExternal();
executeCommand(doSubstitution(view->buffer(), executeCommand(doSubstitution(view_->buffer(),
et.viewCommand), et.viewCommand),
view->buffer()); view_->buffer());
} }
@ -287,9 +288,9 @@ void InsetExternal::editExternal() const
if (et.automaticProduction) if (et.automaticProduction)
updateExternal(); updateExternal();
executeCommand(doSubstitution(view->buffer(), executeCommand(doSubstitution(view_->buffer(),
et.editCommand), et.editCommand),
view->buffer()); view_->buffer());
} }

View File

@ -111,13 +111,13 @@ private:
string const doSubstitution(Buffer const *, string const & s) const; string const doSubstitution(Buffer const *, string const & s) const;
/// our owning view /// our owning view
BufferView * view; BufferView * view_;
/// the current params /// the current params
Params params_; Params params_;
/// A temp filename /// A temp filename
string tempname; string tempname_;
}; };
/// ///