- if (update) {
- // The text might have change,
- // so we should update the button look
- bufview->updateInset(this, true);
- }
-}
-
-
-void InsetExternal::cancelCB(FL_OBJECT * ob, long)
-{
- Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
-
- InsetExternal * inset = holder->inset;
- // BufferView * bv = holder->view;
-
- if (inset->form_external) {
- fl_hide_form(inset->form_external->form_external);
- fl_free_form(inset->form_external->form_external);
- inset->form_external = 0;
- }
-}
-
-
-string const InsetExternal::EditMessage() const
-{
- ExternalTemplate const & et = getTemplate(templatename);
- return doSubstitution(0, et.guiName);
-}
-
-
-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 const format = lex.GetString();