lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [6544] Don't count all children just to see if there are m


From: Greg Chicares
Subject: [lmi-commits] [6544] Don't count all children just to see if there are more than one (VZ)
Date: Wed, 30 Mar 2016 23:44:18 +0000

Revision: 6544
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6544
Author:   chicares
Date:     2016-03-30 23:44:17 +0000 (Wed, 30 Mar 2016)
Log Message:
-----------
Don't count all children just to see if there are more than one (VZ)

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/skeleton.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2016-03-30 22:24:11 UTC (rev 6543)
+++ lmi/trunk/ChangeLog 2016-03-30 23:44:17 UTC (rev 6544)
@@ -38859,3 +38859,8 @@
   
https://github.com/vadz/lmi/commit/6355bb270241826fa32e151eb197a4b1f5cd5c12.patch
   http://lists.nongnu.org/archive/html/lmi/2014-11/msg00062.html
 
+20160330T2344Z <address@hidden> [454]
+
+  skeleton.cpp
+Don't count all children just to see if there are more than one (VZ).
+

Modified: lmi/trunk/skeleton.cpp
===================================================================
--- lmi/trunk/skeleton.cpp      2016-03-30 22:24:11 UTC (rev 6543)
+++ lmi/trunk/skeleton.cpp      2016-03-30 23:44:17 UTC (rev 6544)
@@ -849,22 +849,27 @@
 {
     event.Skip();
 
-    int child_frame_count = 0;
-    wxWindowList const& wl = frame_->GetChildren();
-    for(wxWindowList::const_iterator i = wl.begin(); i != wl.end(); ++i)
+    wxMDIChildFrame* child_frame = frame_->GetActiveChild();
+    if(dynamic_cast<wxMDIChildFrame*>(child_frame))
         {
-        child_frame_count += !!dynamic_cast<wxMDIChildFrame*>(*i);
-        }
+        bool has_multiple_mdi_children = false;
+        wxWindowList const& wl = frame_->GetChildren();
+        for(wxWindowList::const_iterator i = wl.begin(); i != wl.end(); ++i)
+            {
+            wxMDIChildFrame const*const child = 
dynamic_cast<wxMDIChildFrame*>(*i);
+            if(child && child != child_frame)
+                {
+                has_multiple_mdi_children = true;
+                break;
+                }
+            }
 
-    wxMDIChildFrame* child_frame = frame_->GetActiveChild();
-    if(child_frame)
-        {
         wxMenuItem* window_next = child_frame->GetMenuBar()->FindItem
             (XRCID("window_next")
             );
         if(window_next)
             {
-            window_next->Enable(1 < child_frame_count);
+            window_next->Enable(has_multiple_mdi_children);
             }
 
         wxMenuItem* window_previous = child_frame->GetMenuBar()->FindItem
@@ -872,7 +877,7 @@
             );
         if(window_previous)
             {
-            window_previous->Enable(1 < child_frame_count);
+            window_previous->Enable(has_multiple_mdi_children);
             }
         }
     // (else) Parent menu enablement could be handled here, but, for




reply via email to

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