- ExternalTemplate const & et = getTemplate(templatename);
- return doSubstitution(0, et.guiName).c_str();
-}
-
-
-void InsetExternal::Edit(BufferView * bv,
- int /*x*/, int /*y*/, unsigned int /*button*/)
-{
- static int ow = -1, oh;
-
- if (bv->buffer()->isReadonly())
- WarnReadonly(bv->buffer()->fileName());
-
- if (!form_external) {
- form_external = create_form_form_external();
- holder.inset = this;
- // form_external->ok->u_vdata = &holder;
- form_external->form_external->u_vdata = &holder;
- fl_set_form_atclose(form_external->form_external,
- CancelCloseBoxCB, 0);
- }
- holder.view = bv;
- fl_addto_choice(form_external->templatechoice, getTemplateString().c_str());
- fl_set_input(form_external->filename, filename.c_str());
- fl_set_input(form_external->parameters, parameters.c_str());
- if (!templatename.empty()) {
- fl_set_choice(form_external->templatechoice, getTemplateNumber(templatename));
- }
- // Update the help text
- templateCB(form_external->templatechoice, 0);
-
- ExternalTemplate const & et = getTemplate(templatename);
- if (et.automaticProduction) {
- fl_deactivate_object(form_external->update);
- fl_set_object_lcol(form_external->update, FL_INACTIVE);
- } else {
- fl_activate_object(form_external->update);
- fl_set_object_lcol(form_external->update, FL_BLACK);
- }
-
- if (form_external->form_external->visible) {
- fl_raise_form(form_external->form_external);
- } else {
- fl_show_form(form_external->form_external,
- FL_PLACE_MOUSE | FL_FREE_SIZE,
- FL_FULLBORDER, _("Insert external inset"));
- if (ow < 0) {
- ow = form_external->form_external->w;
- oh = form_external->form_external->h;
- }
- fl_set_form_minsize(form_external->form_external, ow, oh);
- }
-}
-
-
-void InsetExternal::Write(Buffer const *, std::ostream & os) const
-{
- os << "External " << templatename << ",\"" << filename
- << "\",\"" << parameters << "\"\n";
-}
-
-
-void InsetExternal::Read(Buffer const *, LyXLex & lex)
-{
- lex.EatLine();
- string format = lex.GetString();
- int pos1 = format.find(",");
- templatename = format.substr(0, pos1);
- int pos2 = format.find("\",\"", pos1);
- filename = format.substr(pos1 + 2, pos2 - (pos1 + 2));
- parameters = format.substr(pos2 + 3, format.length() - (pos2 + 4));
-
- lyxerr << templatename << " " << filename << " " << parameters << endl;
-}
-
-int InsetExternal::write(string const & format, Buffer const * buf,
- std::ostream & os) const {
- ExternalTemplate const & et = getTemplate(templatename);