From: Angus Leeming Date: Fri, 30 Mar 2001 13:47:39 +0000 (+0000) Subject: Squashed bugs in Citation and (I hope) External Material popups. Could X-Git-Tag: 1.6.10~21368 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=79a7f6b1629d02dbd2653849c56a521ed0b28134;p=features.git 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 --- diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 110e0821e5..d0f779f39f 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,8 @@ +2001-03-30 Angus Leeming + + * 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 * ButtonController.[Ch]: renamed as ButtonControllerBase.[Ch] diff --git a/src/frontends/controllers/ControlExternal.C b/src/frontends/controllers/ControlExternal.C index 2b6e832b5e..09bffe7da3 100644 --- a/src/frontends/controllers/ControlExternal.C +++ b/src/frontends/controllers/ControlExternal.C @@ -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 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 diff --git a/src/frontends/controllers/ControlExternal.h b/src/frontends/controllers/ControlExternal.h index b8d48f951c..cb486061e6 100644 --- a/src/frontends/controllers/ControlExternal.h +++ b/src/frontends/controllers/ControlExternal.h @@ -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 &); diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index aa687420d3..d2d8bd097a 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,14 @@ +2001-03-30 Angus Leeming + + * 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 * FormBase.[Ch]: diff --git a/src/frontends/xforms/FormCitation.C b/src/frontends/xforms/FormCitation.C index fe8fa9eacf..415387cf35 100644 --- a/src/frontends/xforms/FormCitation.C +++ b/src/frontends/xforms/FormCitation.C @@ -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::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()); } } diff --git a/src/frontends/xforms/FormExternal.C b/src/frontends/xforms/FormExternal.C index 596ddaa1a6..41bb9fa289 100644 --- a/src/frontends/xforms/FormExternal.C +++ b/src/frontends/xforms/FormExternal.C @@ -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(); } diff --git a/src/frontends/xforms/form_citation.C b/src/frontends/xforms/form_citation.C index b28173ebb7..a81eb484bf 100644 --- a/src/frontends/xforms/form_citation.C +++ b/src/frontends/xforms/form_citation.C @@ -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); { diff --git a/src/frontends/xforms/form_external.C b/src/frontends/xforms/form_external.C index 62b949b4d1..73b6c3d095 100644 --- a/src/frontends/xforms/form_external.C +++ b/src/frontends/xforms/form_external.C @@ -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; diff --git a/src/frontends/xforms/form_external.h b/src/frontends/xforms/form_external.h index 8cddeb634d..aa475eb307 100644 --- a/src/frontends/xforms/form_external.h +++ b/src/frontends/xforms/form_external.h @@ -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_ */ diff --git a/src/frontends/xforms/forms/form_citation.fd b/src/frontends/xforms/forms/form_citation.fd index 9e4100cdf9..d765b77b4d 100644 --- a/src/frontends/xforms/forms/form_citation.fd +++ b/src/frontends/xforms/forms/form_citation.fd @@ -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 diff --git a/src/frontends/xforms/forms/form_external.fd b/src/frontends/xforms/forms/form_external.fd index 228758e0fb..8061433acc 100644 --- a/src/frontends/xforms/forms/form_external.fd +++ b/src/frontends/xforms/forms/form_external.fd @@ -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,38 +195,38 @@ 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_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 diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index 513eeeb65a..881c9d4068 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -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()); }