]> git.lyx.org Git - features.git/commitdiff
Squashed bugs in Citation and (I hope) External Material popups. Could
authorAngus Leeming <leeming@lyx.org>
Fri, 30 Mar 2001 13:47:39 +0000 (13:47 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 30 Mar 2001 13:47:39 +0000 (13:47 +0000)
people please check this one more time...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1860 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlExternal.C
src/frontends/controllers/ControlExternal.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormExternal.C
src/frontends/xforms/form_citation.C
src/frontends/xforms/form_external.C
src/frontends/xforms/form_external.h
src/frontends/xforms/forms/form_citation.fd
src/frontends/xforms/forms/form_external.fd
src/insets/insetexternal.C

index 110e0821e55311ecd8ed2abe416d7186df16a62d..d0f779f39f880e92af522cb3a594134af7ab0109 100644 (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]
index 2b6e832b5e6161be90cc4d3ba5ceb0cfe8f5fed3..09bffe7da3e1f5ecf688fd5e2a3d9ce1d8f1c2bb 100644 (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
index b8d48f951cdf0481170531aa8f65f76b5e2cc46a..cb486061e62e6e0c2fe068e628955a39fa129277 100644 (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 &);
index aa687420d3f6c750c1e11984a42b37970b0c2d5d..d2d8bd097a8f6117e53ef55aeebf070c05f6dc2d 100644 (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]:
index fe8fa9eacfdc7be9625c8f47e0beb3146c7d18cd..415387cf359405a5c76d982eb6581d1e4c61f35f 100644 (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());
        }
 }
 
index 596ddaa1a6394ed16a73d3b737ed022a68df3291..41bb9fa289a4cfa01f1d2a8486f3bbdd4e651aef 100644 (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();
        }
 
index b28173ebb7a99cb48a68dd7655400a12025f9bef..a81eb484bffd723e9ae46d5c11ac66a095c84ad8 100644 (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);
   {
index 62b949b4d1f8998ceff86d3d54fa4d3c5dce38ca..73b6c3d0959772669acfb0e468d219842fa46336 100644 (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;
index 8cddeb634dc1601b0ca88ecf02d4d5a23572240d..aa475eb307be0ba2bcbe8a1674503de8a47d537a 100644 (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_ */
index 9e4100cdf91798be5c54a0da330551474ce92837..d765b77b4dc55fcb525a1236459ff726ec32f539 100644 (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
index 228758e0fb50da359e0416d52cd5862f5ecf3210..8061433accded451da13bc09462d52276a915fba 100644 (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,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
index 513eeeb65a1a59e9fbd2efd887e838ffd2388cc5..881c9d4068f410effcabd939d01b147ace0d70e4 100644 (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());
 }