]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/ButtonPolicies.C
Move LaTeX and VC logs to GUI-I on xforms
[lyx.git] / src / frontends / ButtonPolicies.C
index 585a5e4270d3a1d5ddc7db6d18fb318e3521237f..3598dcc2062e59d202ae2ff523e18d7feb37d5a0 100644 (file)
@@ -21,6 +21,7 @@
 #include "ButtonPolicies.h"
 #include "debug.h"
 
+using std::endl;
 
 /// Helper function
 static inline
@@ -38,7 +39,7 @@ void nextState(ButtonPolicy::State & state,
                       << in
                       << " from state "
                       << state
-                      << std::endl;
+                      << endl;
        }
 }
 
@@ -48,9 +49,9 @@ void nextState(ButtonPolicy::State & state,
 
 PreferencesPolicy::PreferencesPolicy()
        : state_(INITIAL),
-         outputs_(APPLIED + 1, PreferencesPolicy::AllButtons),
+         outputs_(APPLIED + 1, ButtonPolicy::ALL_BUTTONS),
          state_machine_(APPLIED + 1,
-                        StateArray(SMI_TOTAL, PreferencesPolicy::BOGUS))
+                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
 {
        // Build the state output map
        outputs_[INITIAL] = CLOSE;
@@ -98,6 +99,7 @@ PreferencesPolicy::PreferencesPolicy()
 
 void PreferencesPolicy::input(SMInput input)
 {
+       //lyxerr << "PreferencesPolicy::input" << endl;
        // CANCEL and HIDE always take us to INITIAL for all cases.
        // Note that I didn't put that special case in the helper function
        // because it doesn't belong there.  Some other 
@@ -116,14 +118,33 @@ void PreferencesPolicy::input(SMInput input)
 }
 
 
+/*-------------------------------OkViewPolicy------------------------------*/
+
+
+OkViewPolicy::OkViewPolicy()
+       : state_(INITIAL),
+         outputs_(INVALID + 1, ButtonPolicy::ALL_BUTTONS),
+         state_machine_(INVALID + 1,
+                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
+{
+}
+
+
+
+void OkViewPolicy::input(SMInput)
+{
+       state_ = VALID;
+}
+
+
 /*-------------------------------OkCancelPolicy------------------------------*/
 
 
 OkCancelPolicy::OkCancelPolicy()
        : state_(INITIAL),
-         outputs_(INVALID + 1, PreferencesPolicy::AllButtons),
+         outputs_(INVALID + 1, ButtonPolicy::ALL_BUTTONS),
          state_machine_(INVALID + 1,
-                        StateArray(SMI_TOTAL, PreferencesPolicy::BOGUS))
+                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
 {
        // Build the state output map
        outputs_[INITIAL] = CLOSE;
@@ -159,6 +180,8 @@ OkCancelPolicy::OkCancelPolicy()
 
 void OkCancelPolicy::input(SMInput input)
 {
+       //lyxerr << "OkCancelPolicy::input" << endl;
+       
        // CANCEL and HIDE always take us to INITIAL for all cases
        if (SMI_CANCEL == input
            || SMI_HIDE == input) {
@@ -174,9 +197,9 @@ void OkCancelPolicy::input(SMInput input)
 
 OkCancelReadOnlyPolicy::OkCancelReadOnlyPolicy()
        : state_(INITIAL),
-         outputs_(RO_INVALID + 1, PreferencesPolicy::AllButtons),
+         outputs_(RO_INVALID + 1, ButtonPolicy::ALL_BUTTONS),
          state_machine_(RO_INVALID + 1,
-                        StateArray(SMI_TOTAL, PreferencesPolicy::BOGUS))
+                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
 {
        // Build the state output map
        outputs_[INITIAL] = CLOSE;
@@ -231,6 +254,8 @@ OkCancelReadOnlyPolicy::OkCancelReadOnlyPolicy()
 
 void OkCancelReadOnlyPolicy::input(SMInput input)
 {
+       //lyxerr << "OkCancelReadOnlyPolicy::input" << endl;
+       
        // CANCEL and HIDE always take us to INITIAL for all cases
        if (SMI_CANCEL == input
            || SMI_HIDE == input) {
@@ -249,9 +274,9 @@ void OkCancelReadOnlyPolicy::input(SMInput input)
 
 NoRepeatedApplyReadOnlyPolicy::NoRepeatedApplyReadOnlyPolicy()
        : state_(INITIAL),
-         outputs_(RO_INVALID + 1, PreferencesPolicy::AllButtons),
+         outputs_(RO_INVALID + 1, ButtonPolicy::ALL_BUTTONS),
          state_machine_(RO_INVALID + 1,
-                        StateArray(SMI_TOTAL, PreferencesPolicy::BOGUS))
+                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
 {
        // Build the state output map
        outputs_[INITIAL] = CLOSE;
@@ -307,6 +332,8 @@ NoRepeatedApplyReadOnlyPolicy::NoRepeatedApplyReadOnlyPolicy()
 
 void NoRepeatedApplyReadOnlyPolicy::input(SMInput input)
 {
+       //lyxerr << "NoReapeatedApplyReadOnlyPolicy::input" << endl;
+       
        // CANCEL and HIDE always take us to INITIAL for all cases
        if (SMI_CANCEL == input
            || SMI_HIDE == input) {
@@ -325,9 +352,9 @@ void NoRepeatedApplyReadOnlyPolicy::input(SMInput input)
 
 OkApplyCancelReadOnlyPolicy::OkApplyCancelReadOnlyPolicy()
        : state_(INITIAL),
-         outputs_(RO_APPLIED + 1, PreferencesPolicy::AllButtons),
+         outputs_(RO_APPLIED + 1, ButtonPolicy::ALL_BUTTONS),
          state_machine_(RO_APPLIED + 1,
-                        StateArray(SMI_TOTAL, PreferencesPolicy::BOGUS))
+                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
 {
        // Build the state output map
        outputs_[INITIAL] = CLOSE;
@@ -397,6 +424,8 @@ OkApplyCancelReadOnlyPolicy::OkApplyCancelReadOnlyPolicy()
 
 void OkApplyCancelReadOnlyPolicy::input(SMInput input)
 {
+       //lyxerr << "OkApplyCancelReadOnlyPolicy::input" << endl;
+       
        // CANCEL and HIDE always take us to INITIAL for all cases
        if (SMI_CANCEL == input
            || SMI_HIDE == input) {
@@ -415,9 +444,9 @@ void OkApplyCancelReadOnlyPolicy::input(SMInput input)
 
 OkApplyCancelPolicy::OkApplyCancelPolicy()
        : state_(INITIAL),
-         outputs_(APPLIED + 1, PreferencesPolicy::AllButtons),
+         outputs_(APPLIED + 1, ButtonPolicy::ALL_BUTTONS),
          state_machine_(APPLIED + 1,
-                        StateArray(SMI_TOTAL, PreferencesPolicy::BOGUS))
+                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
 {
        // Build the state output map
        outputs_[INITIAL] = CLOSE;
@@ -461,6 +490,8 @@ OkApplyCancelPolicy::OkApplyCancelPolicy()
 
 void OkApplyCancelPolicy::input(SMInput input)
 {
+       //lyxerr << "OkApplyCancelPolicy::input" << endl;
+       
        // CANCEL and HIDE always take us to INITIAL for all cases
        if (SMI_CANCEL == input
            || SMI_HIDE == input) {
@@ -479,9 +510,9 @@ void OkApplyCancelPolicy::input(SMInput input)
 
 NoRepeatedApplyPolicy::NoRepeatedApplyPolicy()
        : state_(INITIAL),
-         outputs_(INVALID + 1, PreferencesPolicy::AllButtons),
+         outputs_(INVALID + 1, ButtonPolicy::ALL_BUTTONS),
          state_machine_(INVALID + 1,
-                        StateArray(SMI_TOTAL, PreferencesPolicy::BOGUS))
+                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
 {
        // Build the state output map
        outputs_[INITIAL] = CLOSE;
@@ -517,6 +548,8 @@ NoRepeatedApplyPolicy::NoRepeatedApplyPolicy()
 
 void NoRepeatedApplyPolicy::input(SMInput input)
 {
+       //lyxerr << "NoRepeatedApplyPolicy::input" << endl;
+       
        // CANCEL and HIDE always take us to INITIAL for all cases
        if (SMI_CANCEL == input
            || SMI_HIDE == input) {