]> git.lyx.org Git - features.git/commitdiff
Fix for float dialog bug
authorAngus Leeming <leeming@lyx.org>
Tue, 11 Sep 2001 17:27:28 +0000 (17:27 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 11 Sep 2001 17:27:28 +0000 (17:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2728 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/ChangeLog
src/frontends/xforms/FormFloat.C
src/frontends/xforms/FormFloat.h
src/frontends/xforms/form_float.C
src/frontends/xforms/form_float.h
src/frontends/xforms/forms/form_float.fd

index 146c2684f2eaa528fa6c0b984e81fb06218e0337..41fae88b09ca9609e6a3c6721a87e758d4d9f45d 100644 (file)
@@ -4,6 +4,10 @@
        Author-Year/Numerical citation choice only if the natbib checkbox is
        active.
 
+       * FormFloat.[Ch]: added new method input() to control the behaviour of
+       the buttons better.
+       * forms/form_float.fd: renamed Here as button_here_definitely.
+
        * FormGraphics.C:
        * forms/form_graphics.fd: add callbacks to a few widgets that didn't
        have them, so enabling the Ok, Apply buttons appropriately.
index f8446144db21a8173bd57327f6af2d69caa7a627..588932d162243180e583ac16d65555872781245e 100644 (file)
@@ -32,9 +32,6 @@ FormFloat::FormFloat(ControlFloat & c)
 // FIX: Needs to be implemented. (Lgb)
 // A way to set to float default is missing.
 // A way to set "force[!]" is missing.
-// Also there are two groups of buttons [Here] and [top,bottom,page,here],
-// is is not really possible to choose from both groups. So this should
-// be disallowed by the dialog too.
 
 void FormFloat::build()
 {
@@ -50,14 +47,14 @@ void FormFloat::build()
        bc().addReadOnly(dialog_->radio_bottom);
        bc().addReadOnly(dialog_->radio_page);
        bc().addReadOnly(dialog_->radio_here);
-       bc().addReadOnly(dialog_->Here);
+       bc().addReadOnly(dialog_->button_here_definitely);
 }
 
 
 void FormFloat::apply()
 {
        string placement;
-       if (fl_get_button(dialog_->Here)) {
+       if (fl_get_button(dialog_->button_here_definitely)) {
                placement += "H";
        } else {
                if (fl_get_button(dialog_->radio_top)) {
@@ -83,12 +80,13 @@ void FormFloat::update()
        bool bottom = false;
        bool page = false;
        bool here = false;
-       bool Here = false;
+       bool here_definitely = false;
 
        string placement(controller().params().placement);
+       std::cerr << "FormFloat::update() " << placement << std::endl;
        
        if (contains(placement, "H")) {
-               Here = true;
+               here_definitely = true;
        } else {
                if (contains(placement, "t")) {
                        top = true;
@@ -107,7 +105,22 @@ void FormFloat::update()
        fl_set_button(dialog_->radio_bottom, bottom);
        fl_set_button(dialog_->radio_page, page);
        fl_set_button(dialog_->radio_here, here);
-       fl_set_button(dialog_->Here, Here);
-
+       fl_set_button(dialog_->button_here_definitely, here_definitely);
 }
 
+
+ButtonPolicy::SMInput FormFloat::input(FL_OBJECT * ob, long)
+{
+       if (ob == dialog_->button_here_definitely) {
+               if (fl_get_button(dialog_->button_here_definitely)) {
+                       fl_set_button(dialog_->radio_top,    false);
+                       fl_set_button(dialog_->radio_bottom, false);
+                       fl_set_button(dialog_->radio_page,   false);
+                       fl_set_button(dialog_->radio_here,   false);
+               }
+       } else {
+               if (fl_get_button(dialog_->button_here_definitely)) {
+                       fl_set_button(dialog_->button_here_definitely, false);
+               }
+       }
+}
index 2263ebb529b79cdb55c2028f083b202e1bfe0543..e07b4e2eaea8fa7004535d697fae9ddea558536f 100644 (file)
@@ -38,6 +38,8 @@ private:
        virtual void build();
        /// Update dialog before/whilst showing it.
        virtual void update();
+       /// Filter the inputs on callback from xforms
+       virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
 
        /// Fdesign generated method
        FD_form_float * build_float();
index 3fd8c3117caf48c3b4f3d8a13354378cc1ba79c9..342dbca0d5577ff86d75b606c063d55bf846bbc7 100644 (file)
@@ -50,6 +50,20 @@ FD_form_float * FormFloat::build_float()
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+  {
+    char const * const dummy = N_("Here, if possible|#i");
+    fdui->radio_here = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 190, 60, 152, 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_("Here, definitely|#H");
+    fdui->button_here_definitely = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 110, 152, 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_("Cancel|^[");
     fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 160, 70, 30, idex(_(dummy)));
@@ -74,20 +88,6 @@ FD_form_float * FormFloat::build_float()
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_callback(obj, C_FormBaseRestoreCB, 0);
-  {
-    char const * const dummy = N_("Here, if possible|#i");
-    fdui->radio_here = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 190, 60, 152, 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_("Here, definitely|#H");
-    fdui->Here = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 110, 152, 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);
   fl_end_form();
 
   fdui->form->fdui = fdui;
index 5033b13fbc42fb241b4647a9cb616a7b8c85eec0..97820f09f7483d289e82238dfff73fecd7aa7b49 100644 (file)
@@ -20,12 +20,12 @@ struct FD_form_float {
        FL_OBJECT *radio_top;
        FL_OBJECT *radio_bottom;
        FL_OBJECT *radio_page;
+       FL_OBJECT *radio_here;
+       FL_OBJECT *button_here_definitely;
        FL_OBJECT *button_cancel;
        FL_OBJECT *button_apply;
        FL_OBJECT *button_ok;
        FL_OBJECT *button_restore;
-       FL_OBJECT *radio_here;
-       FL_OBJECT *Here;
 };
 
 #endif /* FD_form_float_h_ */
index 88aa4b1610fa0687958607ecdd584a5a8f27570b..41db4109174c3b06c747952f509d7f33eebf6be4 100644 (file)
@@ -120,6 +120,42 @@ name: radio_page
 callback: C_FormBaseInputCB
 argument: 0
 
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 190 60 152 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Here, if possible|#i
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: radio_here
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 20 110 152 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Here, definitely|#H
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_here_definitely
+callback: C_FormBaseInputCB
+argument: 0
+
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
@@ -192,41 +228,5 @@ name: button_restore
 callback: C_FormBaseRestoreCB
 argument: 0
 
---------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 190 60 152 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Here, if possible|#i
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_here
-callback: C_FormBaseInputCB
-argument: 0
-
---------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 20 110 152 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Here, definitely|#H
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: Here
-callback: C_FormBaseInputCB
-argument: 0
-
 ==============================
 create_the_forms