Squashed bugs in Citation and (I hope) External Material popups. Could

people please check this one more time...


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1860 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-03-30 13:47:39 +00:00
parent 58d99b4a97
commit 79a7f6b162
12 changed files with 122 additions and 82 deletions

View File

@ -1,3 +1,8 @@
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]

View File

@ -53,22 +53,44 @@ ControlExternal::getParams(InsetExternal const & inset)
}
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
@ -155,14 +177,14 @@ string const ControlExternal::Browse(string const & input) 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

View File

@ -48,9 +48,9 @@ public:
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 &);

View File

@ -1,3 +1,14 @@
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]:

View File

@ -70,7 +70,6 @@ void FormCitation::build()
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);
@ -228,23 +227,6 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
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) {
@ -337,7 +319,8 @@ void FormCitation::updateBrowser(FL_OBJECT * browser,
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());
}
}

View File

@ -55,6 +55,7 @@ void FormExternal::build()
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();
@ -99,18 +100,12 @@ ButtonPolicy::SMInput FormExternal::input(FL_OBJECT * ob, long)
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();
}

View File

@ -73,9 +73,8 @@ FD_form_citation * FormCitation::build_citation()
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);
{

View File

@ -34,9 +34,12 @@ FD_form_external * FormExternal::build_external()
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);
@ -44,7 +47,7 @@ FD_form_external * FormExternal::build_external()
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);
@ -84,22 +87,24 @@ FD_form_external * FormExternal::build_external()
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;

View File

@ -7,6 +7,7 @@
/** 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);
@ -16,6 +17,7 @@ struct FD_form_external {
FL_FORM *form;
FL_OBJECT *choice_template;
FL_OBJECT *browser_helptext;
FL_OBJECT *input_filename;
FL_OBJECT *button_filenamebrowse;
FL_OBJECT *input_parameters;
@ -23,8 +25,8 @@ struct FD_form_external {
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_ */

View File

@ -202,13 +202,13 @@ alignment: FL_ALIGN_CENTER
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

View File

@ -10,7 +10,7 @@ Unit of measure: FL_COORD_PIXEL
Name: form_external
Width: 560
Height: 310
Number of Objects: 11
Number of Objects: 12
--------------------
class: FL_BOX
@ -48,10 +48,28 @@ name: choice_template
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
@ -69,7 +87,7 @@ argument: 0
--------------------
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
@ -99,7 +117,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_SouthWest FL_SouthEast
name: input_parameters
callback:
callback:
argument:
--------------------
@ -159,7 +177,7 @@ argument: 0
--------------------
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
@ -177,7 +195,25 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 435 270 110 30
box: 355 270 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Apply
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast
name: button_apply
callback: C_FormBaseApplyCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 455 270 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -192,23 +228,5 @@ name: button_cancel
callback: C_FormBaseCancelCB
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:
==============================
create_the_forms

View File

@ -263,8 +263,8 @@ void InsetExternal::updateExternal() const
return;
executeCommand(doSubstitution(view->buffer(),
(*cit).second.updateCommand),
view->buffer());
(*cit).second.updateCommand),
view->buffer());
}
@ -275,8 +275,8 @@ void InsetExternal::viewExternal() const
updateExternal();
executeCommand(doSubstitution(view->buffer(),
et.viewCommand),
view->buffer());
et.viewCommand),
view->buffer());
}
@ -287,8 +287,8 @@ void InsetExternal::editExternal() const
updateExternal();
executeCommand(doSubstitution(view->buffer(),
et.editCommand),
view->buffer());
et.editCommand),
view->buffer());
}