lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [6013] Remove dead code and markers as explained 20141101T


From: Greg Chicares
Subject: [lmi-commits] [6013] Remove dead code and markers as explained 20141101T1219Z
Date: Sat, 01 Nov 2014 12:37:27 +0000

Revision: 6013
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6013
Author:   chicares
Date:     2014-11-01 12:37:26 +0000 (Sat, 01 Nov 2014)
Log Message:
-----------
Remove dead code and markers as explained 20141101T1219Z

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/census_view.cpp
    lmi/trunk/census_view.hpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-11-01 12:19:17 UTC (rev 6012)
+++ lmi/trunk/ChangeLog 2014-11-01 12:37:26 UTC (rev 6013)
@@ -34477,3 +34477,20 @@
 the lmi epoch: unable to rename employee class. See:
   http://lists.nongnu.org/archive/html/lmi/2014-10/msg00117.html
 
+20141031T1249Z <address@hidden> [528]
+
+  census_view.cpp
+Improve documentation.
+
+20141101T1219Z <address@hidden> [528]
+
+  census_view.cpp
+  census_view.hpp
+Explain why some code and certain defect markers will soon be removed.
+
+20141101T1237Z <address@hidden> [522]
+
+  census_view.cpp
+  census_view.hpp
+Remove dead code and markers as explained 20141101T1219Z.
+

Modified: lmi/trunk/census_view.cpp
===================================================================
--- lmi/trunk/census_view.cpp   2014-11-01 12:19:17 UTC (rev 6012)
+++ lmi/trunk/census_view.cpp   2014-11-01 12:37:26 UTC (rev 6013)
@@ -67,11 +67,6 @@
 
 namespace
 {
-// TODO ?? Add description and unit tests; consider relocating,
-// and include "miscellany.hpp" only in ultimate location.
-// ^ Remove comment. The function name is already descriptive enough,
-// and there's no good reason to move it to a "library" because it's
-// wanted only in this TU.
 std::string insert_spaces_between_words(std::string const& s)
 {
     std::string r;
@@ -845,10 +840,7 @@
 
 CensusView::CensusView()
     :ViewEx                          ()
-    ,all_changes_have_been_validated_(true)
     ,autosize_columns_               (false)
-    ,composite_is_available_         (false)
-    ,was_cancelled_                  (false)
     ,list_window_                    (0)
     ,list_model_                     (new(wx) CensusViewDataViewModel(*this))
 {
@@ -923,10 +915,6 @@
     std::vector<Input>::iterator i = class_parms().begin();
     while(i != class_parms().end())
         {
-        // TODO ?? Add an any_member operator== instead.
-// ^ Remove comment. At one time, adding operator==(std::string)
-// seemed like a good idea, but that suggestion was discarded here:
-//   
http://svn.savannah.nongnu.org/viewvc/lmi/trunk/any_member.hpp?root=lmi&r1=1593&r2=1758
         if(class_name == (*i)["EmployeeClass"].str())
             {
             return &*i;
@@ -990,11 +978,6 @@
     ,std::string const& title
     )
 {
-    if(is_invalid())
-        {
-        return oe_mvc_dv_cancelled;
-        }
-
     return edit_mvc_docview_parameters<DefaultView>
         (parameters
         ,document()
@@ -1003,31 +986,6 @@
         );
 }
 
-bool CensusView::is_invalid()
-{
-    if(!all_changes_have_been_validated_)
-        {
-        int z = wxMessageBox
-            ("Cannot proceed without first validating changes."
-            ,"Validate changes now?"
-            ,wxYES_NO | wxICON_QUESTION
-            );
-        if(wxYES == z)
-            {
-            // TODO ?? Reserved for grid implementation.
-// ^ Remove comment. See header: this whole function will be removed.
-            }
-        }
-    return false;
-}
-
-// TODO ?? Reserved for a grid implementation.
-// ^ Remove comment. See header.
-int CensusView::selected_column()
-{
-    return 0;
-}
-
 int CensusView::selected_row()
 {
     int row = list_model_->GetRow(list_window_->GetSelection());
@@ -1140,13 +1098,6 @@
     //   if case  defaults changed: all cells and all class defaults;
     //   if class defaults changed: all cells in the class.
 
-    // TODO ?? temp string for new value, eeclass?
-// ^ Remove comment. This is a dubious micro-optimization.
-    // TODO ?? combine class and indv vectors for case changes?
-// ^ Remove comment. Merging those two vectors might make a small part
-// of the code more concise, but would cost too much, and there's no
-// convenient way to merge their iterators.
-
     std::vector<std::string> headers_of_changed_parameters;
     std::vector<std::string> const& 
all_headers(case_parms()[0].member_names());
     std::vector<std::string>::const_iterator i;
@@ -1221,7 +1172,6 @@
         {
         j->Reconcile();
         }
-    composite_is_available_ = false;
 }
 
 void CensusView::update_visible_columns()
@@ -1429,9 +1379,6 @@
 
     update_class_names();
     update_visible_columns();
-
-    // All displayed data is valid when this function ends.
-    all_changes_have_been_validated_ = true;
 }
 
 void CensusView::UponPrintCase(wxCommandEvent&)
@@ -1446,21 +1393,11 @@
 
 void CensusView::UponRunCase(wxCommandEvent&)
 {
-    if(is_invalid())
-        {
-        return;
-        }
-
     ViewComposite();
 }
 
 void CensusView::UponRunCell(wxCommandEvent&)
 {
-    if(is_invalid())
-        {
-        return;
-        }
-
     int cell_number = selected_row();
     ViewOneCell(cell_number);
 }
@@ -1477,28 +1414,21 @@
 
 void CensusView::ViewComposite()
 {
-    // Run all cells if necessary to (re)generate composite numbers.
-    if(!composite_is_available_)
+    if(!DoAllCells(mce_emit_nothing))
         {
-        if(!DoAllCells(mce_emit_nothing))
-            {
-            return;
-            }
+        return;
         }
 
-    if(!was_cancelled_)
-        {
-        std::string const name("composite");
-        IllustrationView& illview = MakeNewIllustrationDocAndView
-            (document().GetDocumentManager()
-            ,serial_file_path(base_filename(), name, -1, 
"ill").string().c_str()
-            );
+    std::string const name("composite");
+    IllustrationView& illview = MakeNewIllustrationDocAndView
+        (document().GetDocumentManager()
+        ,serial_file_path(base_filename(), name, -1, "ill").string().c_str()
+        );
 
-        // This is necessary for the view to be able to print.
-        illview.SetLedger(composite_ledger_);
+    // This is necessary for the view to be able to print.
+    illview.SetLedger(composite_ledger_);
 
-        illview.DisplaySelectedValuesAsHtml();
-        }
+    illview.DisplaySelectedValuesAsHtml();
 }
 
 bool CensusView::DoAllCells(mcenum_emission emission)
@@ -1518,11 +1448,6 @@
 
 void CensusView::UponAddCell(wxCommandEvent&)
 {
-    if(is_invalid())
-        {
-        return;
-        }
-
     cell_parms().push_back(case_parms()[0]);
     list_model_->RowAppended();
 
@@ -1537,11 +1462,6 @@
 
 void CensusView::UponDeleteCells(wxCommandEvent&)
 {
-    if(is_invalid())
-        {
-        return;
-        }
-
     unsigned int n_items = list_model_->GetCount();
     wxDataViewItemArray selection;
     unsigned int n_sel_items = list_window_->GetSelections(selection);

Modified: lmi/trunk/census_view.hpp
===================================================================
--- lmi/trunk/census_view.hpp   2014-11-01 12:19:17 UTC (rev 6012)
+++ lmi/trunk/census_view.hpp   2014-11-01 12:37:26 UTC (rev 6013)
@@ -123,40 +123,14 @@
         ,std::string const& title
         );
 
-    bool is_invalid();
-// ^ Remove. Purpose was to prevent operations that shouldn't be
-// allowed when all_changes_have_been_validated_ (q.v.) is false.
-
-    int selected_column();
-// ^ Remove. Might have been useful for a grid implementation, but
-// the dataview implementation does not provide column editing.
     int selected_row();
 
     void update_class_names();
 
-    bool all_changes_have_been_validated_;
-// ^ Remove. While lmi uses MVC, its predecessor used doc-view, which
-// didn't distinguish View from Controller; worse, it performed
-// validation in the View when it should have been done in the Model.
-// Even worse, validation only occurred in a tabbed dialog akin to
-// lmi's IllustrationView--but direct drill-down editing was provided
-// in an interface similar to lmi's CensusView, where validation was
-// performed only by opening a tabbed dialog for each cell and cycling
-// through its tabs, after which this flag was set.
-
     bool autosize_columns_;
 
-    bool composite_is_available_;
-// ^ Remove. Purpose was to cache composite result so that it would
-// be cheap to view. However, it is produced exactly when it is to be
-// viewed; and there's no reason to create an identical second view.
-
     boost::shared_ptr<Ledger const> composite_ledger_;
 
-    bool was_cancelled_;
-// ^ Remove. Always false. Purpose was to prevent showing composite if
-// composite run had been cancelled.
-
     wxDataViewCtrl* list_window_;
     wxObjectDataPtr<CensusViewDataViewModel> list_model_;
 




reply via email to

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