lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [5823] Process pending events more cautiously during a pau


From: Greg Chicares
Subject: [lmi-commits] [5823] Process pending events more cautiously during a pause
Date: Sat, 09 Nov 2013 00:29:18 +0000

Revision: 5823
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5823
Author:   chicares
Date:     2013-11-09 00:29:18 +0000 (Sat, 09 Nov 2013)
Log Message:
-----------
Process pending events more cautiously during a pause

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/progress_meter.cpp
    lmi/trunk/progress_meter.hpp
    lmi/trunk/progress_meter_wx.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2013-11-08 23:28:19 UTC (rev 5822)
+++ lmi/trunk/ChangeLog 2013-11-09 00:29:18 UTC (rev 5823)
@@ -32868,3 +32868,11 @@
 Sleep wakefully between printouts. See:
   http://lists.nongnu.org/archive/html/lmi/2013-11/msg00005.html
 
+20131109T0029Z <address@hidden> [542]
+
+  progress_meter.cpp
+  progress_meter.hpp
+  progress_meter_wx.cpp
+Process pending events more cautiously during a pause. See:
+  http://lists.nongnu.org/archive/html/lmi/2013-11/msg00006.html
+

Modified: lmi/trunk/progress_meter.cpp
===================================================================
--- lmi/trunk/progress_meter.cpp        2013-11-08 23:28:19 UTC (rev 5822)
+++ lmi/trunk/progress_meter.cpp        2013-11-09 00:29:18 UTC (rev 5823)
@@ -86,7 +86,7 @@
 {
 }
 
-void progress_meter::dawdle(int seconds) const
+void progress_meter::dawdle(int seconds)
 {
     do_dawdle(seconds);
 }
@@ -137,7 +137,7 @@
 /// implementation for a GUI library would naturally use a more
 /// sophisticated technique.
 
-void progress_meter::do_dawdle(int seconds) const
+void progress_meter::do_dawdle(int seconds)
 {
     lmi_sleep(seconds);
 }

Modified: lmi/trunk/progress_meter.hpp
===================================================================
--- lmi/trunk/progress_meter.hpp        2013-11-08 23:28:19 UTC (rev 5822)
+++ lmi/trunk/progress_meter.hpp        2013-11-09 00:29:18 UTC (rev 5823)
@@ -120,9 +120,12 @@
 ///     reflect_progress(seconds_to_dawdle);
 /// because no pause is wanted when the condition is false. It cannot
 /// be static, because it must call virtual do_dawdle() to distinguish
-/// behavior by user interface. It's a member of this class only for
-/// convenience; if it turns out to be useful outside this context,
-/// then it should become a standalone function in a different module.
+/// behavior by user interface. It's a member of this class because
+/// the motivating use case involves a progress meter--so, for the wx
+/// interface, do_dawdle() should call wxProgressDialog::Update(),
+/// as explained here:
+///   http://lists.nongnu.org/archive/html/lmi/2013-11/msg00006.html
+/// It is not const because wxProgressDialog::Update() is not.
 ///
 /// reflect_progress() throws an exception if the iteration counter
 /// equals or exceeds its maximum. This condition is tested before
@@ -207,7 +210,7 @@
         ,e_unit_test_mode
         };
 
-    void dawdle(int seconds) const;
+    void dawdle(int seconds);
     bool reflect_progress();
     void culminate();
 
@@ -223,7 +226,7 @@
     int count() const;
     int max_count() const;
 
-    virtual void        do_dawdle(int seconds)  const    ;
+    virtual void        do_dawdle            (int seconds);
     virtual std::string progress_message     () const = 0;
     virtual bool        show_progress_message()       = 0;
     virtual void        culminate_ui         ()       = 0;

Modified: lmi/trunk/progress_meter_wx.cpp
===================================================================
--- lmi/trunk/progress_meter_wx.cpp     2013-11-08 23:28:19 UTC (rev 5822)
+++ lmi/trunk/progress_meter_wx.cpp     2013-11-09 00:29:18 UTC (rev 5823)
@@ -28,9 +28,8 @@
 
 #include "progress_meter.hpp"
 
-#include "wx_utility.hpp"               // TheApp(), TopWindow()
+#include "wx_utility.hpp"               // TopWindow()
 
-#include <wx/app.h>                     // Required for TheApp().
 #include <wx/progdlg.h>
 #include <wx/utils.h>                   // wxMilliSleep()
 
@@ -69,7 +68,7 @@
 
   private:
     // progress_meter overrides.
-    virtual void do_dawdle(int seconds) const;
+    virtual void do_dawdle(int seconds);
     // progress_meter required implementation.
     virtual std::string progress_message() const;
     virtual bool show_progress_message();
@@ -108,12 +107,12 @@
 {
 }
 
-void concrete_progress_meter::do_dawdle(int seconds) const
+void concrete_progress_meter::do_dawdle(int seconds)
 {
     for(int i = 0; i < 10 * seconds; ++i)
         {
         wxMilliSleep(100);
-        TheApp().Yield(true);
+        progress_dialog_.Update(count());
         }
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]