lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 53a288a 33/46: Restore "delete_cells" update


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 53a288a 33/46: Restore "delete_cells" update UI handler for CensusDVCView
Date: Wed, 22 Jul 2020 11:05:15 -0400 (EDT)

branch: master
commit 53a288a5860d2b52c29970912a20b52c15129f65
Author: Vadim Zeitlin <vadim@tt-solutions.com>
Commit: Vadim Zeitlin <vadim@tt-solutions.com>

    Restore "delete_cells" update UI handler for CensusDVCView
    
    Keep using the same UponUpdateNonemptySelection() as in master, even if
    it doesn't seem to be really necessary because the selection is actually
    never empty for wxDataViewCtrl -- however this reduces the amount of
    changes with the master version.
---
 census_view.cpp | 21 ++++++++-------------
 census_view.hpp |  4 +---
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/census_view.cpp b/census_view.cpp
index 841f283..51dfcca 100644
--- a/census_view.cpp
+++ b/census_view.cpp
@@ -1803,7 +1803,6 @@ BEGIN_EVENT_TABLE(CensusView, ViewEx)
     EVT_UPDATE_UI(XRCID("copy_census"          
),CensusView::UponUpdateColumnValuesVary )
     EVT_UPDATE_UI(XRCID("paste_census"         
),CensusView::UponUpdateAlwaysEnabled    )
     EVT_UPDATE_UI(XRCID("add_cell"             
),CensusView::UponUpdateAlwaysEnabled    )
-    EVT_UPDATE_UI(XRCID("delete_cells"         
),CensusView::UponUpdateAlwaysEnabled    )
     EVT_UPDATE_UI(XRCID("column_width_varying" 
),CensusView::UponUpdateAlwaysEnabled    )
     EVT_UPDATE_UI(XRCID("column_width_fixed"   
),CensusView::UponUpdateAlwaysEnabled    )
     // Disable these printing commands on the "File" menu: specialized
@@ -1817,12 +1816,13 @@ END_EVENT_TABLE()
 IMPLEMENT_DYNAMIC_CLASS(CensusDVCView, CensusView)
 
 BEGIN_EVENT_TABLE(CensusDVCView, CensusView)
-    EVT_DATAVIEW_ITEM_CONTEXT_MENU (wxID_ANY    ,CensusDVCView::UponRightClick 
          )
-    EVT_DATAVIEW_ITEM_VALUE_CHANGED(wxID_ANY    
,CensusDVCView::UponValueChanged         )
-    EVT_UPDATE_UI(XRCID("edit_cell"            
),CensusDVCView::UponUpdateSingleSelection)
-    EVT_UPDATE_UI(XRCID("edit_class"           
),CensusDVCView::UponUpdateSingleSelection)
-    EVT_UPDATE_UI(XRCID("run_cell"             
),CensusDVCView::UponUpdateSingleSelection)
-    EVT_UPDATE_UI(XRCID("run_class"            
),CensusDVCView::UponUpdateSingleSelection)
+    EVT_DATAVIEW_ITEM_CONTEXT_MENU (wxID_ANY    ,CensusDVCView::UponRightClick 
            )
+    EVT_DATAVIEW_ITEM_VALUE_CHANGED(wxID_ANY    
,CensusDVCView::UponValueChanged           )
+    EVT_UPDATE_UI(XRCID("edit_cell"            
),CensusDVCView::UponUpdateSingleSelection  )
+    EVT_UPDATE_UI(XRCID("edit_class"           
),CensusDVCView::UponUpdateSingleSelection  )
+    EVT_UPDATE_UI(XRCID("run_cell"             
),CensusDVCView::UponUpdateSingleSelection  )
+    EVT_UPDATE_UI(XRCID("run_class"            
),CensusDVCView::UponUpdateSingleSelection  )
+    EVT_UPDATE_UI(XRCID("delete_cells"         
),CensusDVCView::UponUpdateNonemptySelection)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(CensusGridView, CensusView)
@@ -1835,6 +1835,7 @@ BEGIN_EVENT_TABLE(CensusGridView, CensusView)
     EVT_UPDATE_UI(XRCID("edit_class"           
),CensusGridView::UponUpdateAlwaysEnabled)
     EVT_UPDATE_UI(XRCID("run_cell"             
),CensusGridView::UponUpdateAlwaysEnabled)
     EVT_UPDATE_UI(XRCID("run_class"            
),CensusGridView::UponUpdateAlwaysEnabled)
+    EVT_UPDATE_UI(XRCID("delete_cells"         
),CensusGridView::UponUpdateAlwaysEnabled)
 END_EVENT_TABLE()
 
 CensusView::CensusView()
@@ -2467,12 +2468,6 @@ void 
CensusDVCView::UponUpdateNonemptySelection(wxUpdateUIEvent& e)
     e.Enable(0 < list_window_->GetSelections(selection));
 }
 
-void CensusGridView::UponUpdateNonemptySelection(wxUpdateUIEvent& e)
-{
-    auto const& selected_rows = grid_window_->GetSelectedRows();
-    e.Enable(!selected_rows.empty());
-}
-
 /// Conditionally enable copying.
 ///
 /// Copying is forbidden if it would produce only whitespace; i.e.,
diff --git a/census_view.hpp b/census_view.hpp
index 766979b..da39248 100644
--- a/census_view.hpp
+++ b/census_view.hpp
@@ -85,7 +85,6 @@ class CensusView
     virtual void UponColumnWidthFixed       (wxCommandEvent&) = 0;
     void         UponUpdateAlwaysDisabled   (wxUpdateUIEvent&);
     void         UponUpdateAlwaysEnabled    (wxUpdateUIEvent&);
-    virtual void UponUpdateNonemptySelection(wxUpdateUIEvent&) = 0;
     virtual void UponUpdateColumnValuesVary (wxUpdateUIEvent&) = 0;
 
     bool DoAllCells(mcenum_emission);
@@ -159,7 +158,7 @@ class CensusDVCView final
     void UponColumnWidthVarying     (wxCommandEvent&) override;
     void UponColumnWidthFixed       (wxCommandEvent&) override;
     void UponUpdateSingleSelection  (wxUpdateUIEvent&);
-    void UponUpdateNonemptySelection(wxUpdateUIEvent&) override;
+    void UponUpdateNonemptySelection(wxUpdateUIEvent&);
     void UponUpdateColumnValuesVary (wxUpdateUIEvent&) override;
 
     void Update() override;
@@ -200,7 +199,6 @@ class CensusGridView final
     void UponDeleteCells            (wxCommandEvent&) override;
     void UponColumnWidthVarying     (wxCommandEvent&) override;
     void UponColumnWidthFixed       (wxCommandEvent&) override;
-    void UponUpdateNonemptySelection(wxUpdateUIEvent&) override;
     void UponUpdateColumnValuesVary (wxUpdateUIEvent&) override;
 
     void Update() override;



reply via email to

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