Solving:
- The GuiTabular dialog has an auto-apply policy. The buttoncontroller however changes the Close button into Cancel, while pressing Cancel does apply the settings. Therefore I added a new ButtonPolicy: AutoApplyPolicy. - When editing the width edit field is not finished by an enter but by tab, a mouseclick or something else, the value is not applied. - The default of valign is TOP and not MIDDLE. This is defined in various constructors in InsetTabular.cpp.

OK to apply in trunk and branch ?

Vincent

Index: src/frontends/qt4/ButtonPolicy.h
===================================================================
--- src/frontends/qt4/ButtonPolicy.h    (revision 27602)
+++ src/frontends/qt4/ButtonPolicy.h    (working copy)
@@ -23,7 +23,7 @@
     dialogs. Only the policy is implemented here.  Separate ButtonController
     classes are needed for each GUI implementation.
 
-               Policy                    | ReadOnly | Apply Button | Repeated 
Apply
+    Policy                    | ReadOnly | Apply Button | Repeated Apply
     ========================================================================
     OkCancel                  |     N    |      N        |      -
     OkCancelReadOnly          |     Y    |      N        |      -
@@ -31,6 +31,7 @@
     OkApplyCancelReadOnly     |     Y    |      Y        |      Y
     NoRepeatedApply           |     N    |      Y        |      N
     NoRepeatedApplyReadOnly   |     Y    |      Y        |      N
+    AutoApply                 |     N    |      N        |      -      
     Preferences               |     N    |      Y        | No (Ok-Close)
     Ignorant                  |    N/A   |     N/A       |     N/A
     ========================================================================
@@ -121,7 +122,7 @@
                OkApplyCancelReadOnlyPolicy,
 
                /** Ok, Apply and Cancel buttons for dialogs where repeated
- *    Apply is allowed.
+                       Apply is allowed.
                        Note: This scheme supports the relabelling of Cancel to 
Close
                        and vice versa.
                        This is based on the value of the bool state of the 
Button::CANCEL.
@@ -137,6 +138,10 @@
                 */
                NoRepeatedApplyPolicy,
 
+               /** Close button for dialogs with auto-Apply.
+                */
+               AutoApplyPolicy,
+
                /** Defines the policy used by the Preferences dialog.
                        Four buttons: Ok (Save), Apply, Cancel/Close, Restore.
                        Note: This scheme supports the relabelling of Cancel to 
Close
Index: src/frontends/qt4/ButtonPolicy.cpp
===================================================================
--- src/frontends/qt4/ButtonPolicy.cpp  (revision 27602)
+++ src/frontends/qt4/ButtonPolicy.cpp  (working copy)
@@ -97,6 +97,8 @@
                        return "NoRepeatedApplyPolicy";
                case ButtonPolicy::NoRepeatedApplyReadOnlyPolicy:
                        return "NoRepeatedApplyReadOnlyPolicy";
+               case ButtonPolicy::AutoApplyPolicy:
+                       return "AutoApplyPolicy";
                case ButtonPolicy::IgnorantPolicy:
                        return "IgnorantPolicy";
                default:
@@ -140,6 +142,7 @@
        void initOkApplyCancelReadOnly();
        void initOkApplyCancel();
        void initNoRepeatedApply();
+       void initAutoApply();
        void initPreferences();
 
 public:
@@ -186,6 +189,9 @@
                case NoRepeatedApplyReadOnlyPolicy:
                        initNoRepeatedApplyReadOnly();
                        break;
+               case AutoApplyPolicy:
+                       initAutoApply();
+                       break;
                case PreferencesPolicy:
                        initPreferences();
                        break;
@@ -575,7 +581,44 @@
        state_machine_[INVALID][SMI_RESTORE] = INITIAL;
 }
 
+void ButtonPolicy::Private::initAutoApply()
+{
+       outputs_ = StateOutputs(INVALID + 1, ButtonPolicy::ALL_BUTTONS);
+       state_machine_ = StateMachine(INVALID + 1,
+                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS));
 
+       // Build the state output map
+       outputs_[INITIAL] = CLOSE;
+       outputs_[VALID] = RESTORE | OKAY | CLOSE;
+       outputs_[INVALID] = RESTORE | CANCEL;
+
+       // Build the state machine one state at a time
+       // NOTE:  Since CANCEL and HIDE always go to INITIAL they are
+       //        left out of the state machine and handled explicitly
+       //        in input()
+       //
+       // State::INITIAL
+       state_machine_[INITIAL][SMI_READ_ONLY] = INITIAL;
+       state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL;
+       state_machine_[INITIAL][SMI_VALID] = VALID;
+       state_machine_[INITIAL][SMI_INVALID] = INVALID;
+       // State::VALID
+       state_machine_[VALID][SMI_VALID] = VALID;
+       state_machine_[VALID][SMI_READ_ONLY] = VALID;
+       state_machine_[VALID][SMI_READ_WRITE] = VALID;
+       state_machine_[VALID][SMI_INVALID] = INVALID;
+       state_machine_[VALID][SMI_OKAY] = INITIAL;
+       state_machine_[VALID][SMI_APPLY] = INITIAL;
+       state_machine_[VALID][SMI_RESTORE] = INITIAL;
+       // State::INVALID
+       state_machine_[INVALID][SMI_INVALID] = INVALID;
+       state_machine_[INVALID][SMI_READ_ONLY] = INVALID;
+       state_machine_[INVALID][SMI_READ_WRITE] = INVALID;
+       state_machine_[INVALID][SMI_VALID] = VALID;
+       state_machine_[INVALID][SMI_RESTORE] = INITIAL;
+}
+
+
 /////////////////////////////////////////////////////////////////////////
 //
 // ButtonPolicy
Index: src/frontends/qt4/GuiTabular.cpp
===================================================================
--- src/frontends/qt4/GuiTabular.cpp    (revision 27602)
+++ src/frontends/qt4/GuiTabular.cpp    (working copy)
@@ -91,7 +91,7 @@
        connect(lastfooterBorderBelowCB, SIGNAL(clicked()), this, 
SLOT(ltLastFooterBorderBelow_clicked()));
        connect(lastfooterNoContentsCB, SIGNAL(clicked()), this, 
SLOT(ltLastFooterEmpty_clicked()));
        connect(specialAlignmentED, SIGNAL(returnPressed()), this, 
SLOT(specialAlignment_changed()));
-       connect(widthED, SIGNAL(returnPressed()), this, SLOT(width_changed()));
+       connect(widthED, SIGNAL(editingFinished()), this, 
SLOT(width_changed()));
        connect(widthUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)), this, 
SLOT(width_changed()));
        connect(closePB, SIGNAL(clicked()), this, SLOT(close_clicked()));
        connect(borders, SIGNAL(topSet(bool)), this, SLOT(topBorder_changed()));
@@ -102,7 +102,7 @@
        connect(rotateCellCB, SIGNAL(clicked()), this, SLOT(rotateCell()));
        connect(longTabularCB, SIGNAL(clicked()), this, SLOT(longTabular()));
 
-       bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
+       bc().setPolicy(ButtonPolicy::AutoApplyPolicy);
        bc().setCancel(closePB);
 
        bc().addReadOnly(topspaceED);
@@ -751,11 +751,11 @@
                valign = 2;
                break;
        default:
-               valign = 1;
+               valign = 0;
                break;
        }
        if (pwidth.zero())
-               valign = 1;
+               valign = 0;
        vAlignCB->setCurrentIndex(valign);
 
        hAlignCB->setEnabled(true);

Reply via email to