+2001-03-30 Angus Leeming <a.leeming@ic.ac.uk>
+
+ * ControlExternal.C: bug fixes. Can now apply changes to the inset
+ and edit, view, update the External Material correctly. I hope!
+
2001-03-30 Angus Leeming <a.leeming@ic.ac.uk>
* ButtonController.[Ch]: renamed as ButtonControllerBase.[Ch]
}
-void ControlExternal::editExternal()
+void ControlExternal::applyParamsToInset()
{
inset()->setFromParams(params());
- inset()->editExternal();
+ lv_.view()->updateInset(inset(), true);
+}
+
+void ControlExternal::editExternal()
+{
+ // fill the local, controller's copy of the Params struct with
+ // the contents of the popup's fields.
+ view().apply();
+
+ // Create a local copy of the inset and initialise it with this
+ // params struct.
+ InsetExternal ie;
+ ie.setFromParams(params());
+
+ ie.editExternal();
}
void ControlExternal::viewExternal()
{
- inset()->setFromParams(params());
- inset()->viewExternal();
+ view().apply();
+
+ InsetExternal ie;
+ ie.setFromParams(params());
+
+ ie.viewExternal();
}
void ControlExternal::updateExternal()
{
- inset()->setFromParams(params());
- inset()->updateExternal();
+ view().apply();
+
+ InsetExternal ie;
+ ie.setFromParams(params());
+
+ ie.updateExternal();
}
vector<string> const ControlExternal::getTemplates() const
string p = result.second;
- buf = MakeRelPath(input, buf2);
- current_path = OnlyPath(input);
+ buf = MakeRelPath(p, buf2);
+ current_path = OnlyPath(p);
once = 1;
- if (contains(input, "#") ||
- contains(input, "~") ||
- contains(input, "$") ||
- contains(input, "%")) {
+ if (contains(p, "#") ||
+ contains(p, "~") ||
+ contains(p, "$") ||
+ contains(p, "%")) {
WriteAlert(_("Filename can't contain any "
"of these characters:"),
// xgettext:no-c-format
string const Browse(string const &) const;
private:
- /// not needed.
- virtual void applyParamsToInset() {}
///
+ virtual void applyParamsToInset();
+ /// not needed.
virtual void applyParamsNoInset() {}
/// get the parameters from the string passed to createInset.
virtual InsetExternal::Params const getParams(string const &);
+2001-03-30 Angus Leeming <a.leeming@ic.ac.uk>
+
+ * FormCitation.C:
+ * forms/form_citation.fd: Don't change the name of the button when
+ toggling between regular expression and simple searches.
+ Squashed bug when creating a new inset, the keys field contained
+ one (empty) key. No more; thanks, Dekel.
+
+ * FormExternal.C:
+ * forms/form_external.fd: added Apply button.
+
2001-03-30 Angus Leeming <a.leeming@ic.ac.uk>
* FormBase.[Ch]:
fl_set_button(dialog_->button_search_case, 0);
fl_set_button(dialog_->button_search_type, 0);
- fl_set_object_label(dialog_->button_search_type, _("Simple"));
// Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->button_ok);
setCiteButtons(ON);
activate = ButtonPolicy::SMI_VALID;
- } else if (ob == dialog_->button_search_type) {
- fl_freeze_form(form());
- // Fudge to overcome xforms drawing bug
- fl_hide_object(dialog_->button_search_type);
-
- if (fl_get_button(dialog_->button_search_type))
- fl_set_object_label(dialog_->button_search_type,
- _("Regex"));
- else
- fl_set_object_label(dialog_->button_search_type,
- _("Simple"));
-
- fl_show_object(dialog_->button_search_type);
- fl_unfreeze_form(form());
-
- return ButtonPolicy::SMI_NOOP;
-
} else if (ob == dialog_->button_previous ||
ob == dialog_->button_next) {
for (vector<string>::const_iterator it = keys.begin();
it < keys.end(); ++it) {
string key = frontStrip(strip(*it));
- fl_add_browser_line(browser, key.c_str());
+ if (!key.empty())
+ fl_add_browser_line(browser, key.c_str());
}
}
fl_addto_choice(dialog_->choice_template, choice.c_str());
bc().setOK(dialog_->button_ok);
+ bc().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_cancel);
bc().refresh();
fl_set_input(dialog_->input_filename, out_name.c_str());
} else if (ob == dialog_->button_edit) {
-
- apply();
controller().editExternal();
} else if (ob == dialog_->button_view) {
-
- apply();
controller().viewExternal();
} else if (ob == dialog_->button_update) {
-
- apply();
controller().updateExternal();
}
fl_set_object_lalign(obj, FL_ALIGN_TOP);
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
fl_set_object_resize(obj, FL_RESIZE_NONE);
- fdui->button_search_type = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 25, 525, 30, 30, _("Simple"));
+ fdui->button_search_type = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 25, 525, 30, 30, _("Regular Expression"));
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
- fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->button_search_case = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 25, 560, 30, 30, _("Case sensitive"));
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
{
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->browser_helptext = obj = fl_add_browser(FL_NORMAL_BROWSER, 130, 50, 300, 130, "");
+ fl_set_object_lalign(obj, FL_ALIGN_TOP);
+ fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
{
char const * const dummy = N_("File|#F");
- fdui->input_filename = obj = fl_add_input(FL_NORMAL_INPUT, 130, 190, 190, 30, idex(_(dummy)));
+ fdui->input_filename = obj = fl_add_input(FL_NORMAL_INPUT, 130, 190, 200, 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_("Browse...|#B");
- fdui->button_filenamebrowse = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 190, 100, 30, idex(_(dummy)));
+ fdui->button_filenamebrowse = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 190, 90, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 315, 270, 110, 30, _("OK"));
+ fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 255, 270, 90, 30, _("OK"));
fl_set_object_color(obj, FL_COL1, FL_BLACK);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseOKCB, 0);
+ fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 355, 270, 90, 30, _("Apply"));
+ fl_set_object_color(obj, FL_COL1, FL_BLACK);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
+ fl_set_object_callback(obj, C_FormBaseApplyCB, 0);
{
char const * const dummy = N_("Cancel|#C^[");
- fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 270, 110, 30, idex(_(dummy)));
+ fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 455, 270, 90, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseCancelCB, 0);
- fdui->browser_helptext = obj = fl_add_browser(FL_NORMAL_BROWSER, 130, 50, 300, 130, "");
- fl_set_object_lalign(obj, FL_ALIGN_TOP);
- fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
fl_end_form();
fdui->form->fdui = fdui;
/** Callbacks, globals and object handlers **/
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
extern "C" void C_FormBaseOKCB(FL_OBJECT *, long);
+extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long);
extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
FL_FORM *form;
FL_OBJECT *choice_template;
+ FL_OBJECT *browser_helptext;
FL_OBJECT *input_filename;
FL_OBJECT *button_filenamebrowse;
FL_OBJECT *input_parameters;
FL_OBJECT *button_view;
FL_OBJECT *button_update;
FL_OBJECT *button_ok;
+ FL_OBJECT *button_apply;
FL_OBJECT *button_cancel;
- FL_OBJECT *browser_helptext;
};
#endif /* FD_form_external_h_ */
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
-label: Simple
+label: Regular Expression
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_SouthWest FL_SouthWest
name: button_search_type
-callback: C_FormBaseInputCB
-argument: 0
+callback:
+argument:
--------------------
class: FL_CHECKBUTTON
Name: form_external
Width: 560
Height: 310
-Number of Objects: 11
+Number of Objects: 12
--------------------
class: FL_BOX
callback: C_FormBaseInputCB
argument: 0
+--------------------
+class: FL_BROWSER
+type: NORMAL_BROWSER
+box: 130 50 300 130
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_SouthEast
+name: browser_helptext
+callback:
+argument:
+
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 130 190 190 30
+box: 130 190 200 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 330 190 100 30
+box: 340 190 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
resize: FL_RESIZE_ALL
gravity: FL_SouthWest FL_SouthEast
name: input_parameters
-callback:
+callback:
argument:
--------------------
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
-box: 315 270 110 30
+box: 255 270 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_CENTER
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 435 270 110 30
+box: 355 270 90 30
boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
+colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Cancel|#C^[
+label: Apply
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast
-name: button_cancel
-callback: C_FormBaseCancelCB
+name: button_apply
+callback: C_FormBaseApplyCB
argument: 0
--------------------
-class: FL_BROWSER
-type: NORMAL_BROWSER
-box: 130 50 300 130
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_TOP
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 455 270 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label:
+label: Cancel|#C^[
shortcut:
resize: FL_RESIZE_ALL
-gravity: FL_NorthWest FL_SouthEast
-name: browser_helptext
-callback:
-argument:
+gravity: FL_SouthEast FL_SouthEast
+name: button_cancel
+callback: C_FormBaseCancelCB
+argument: 0
==============================
create_the_forms
return;
executeCommand(doSubstitution(view->buffer(),
- (*cit).second.updateCommand),
- view->buffer());
+ (*cit).second.updateCommand),
+ view->buffer());
}
updateExternal();
executeCommand(doSubstitution(view->buffer(),
- et.viewCommand),
- view->buffer());
+ et.viewCommand),
+ view->buffer());
}
updateExternal();
executeCommand(doSubstitution(view->buffer(),
- et.editCommand),
- view->buffer());
+ et.editCommand),
+ view->buffer());
}