lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] (no subject)


From: Greg Chicares
Subject: [lmi-commits] (no subject)
Date: Thu, 2 Jun 2016 21:43:12 +0000 (UTC)

branch: master
commit 5b6a7e3cce734bae90af07c57c8f6f2dcbd47a8c
Author: Gregory W. Chicares <address@hidden>
Date:   Thu Jun 2 21:42:33 2016 +0000

    Add more fields to "Preferences" dialog
    
    See the contemporaneous discussion on the mailing list, e.g.:
      http://lists.nongnu.org/archive/html/lmi/2016-05/msg00113.html
    
    Alphabetize data members for concinnity with class configurable_settings
    now that the number of parallel members is significant.
    
    Set the pause-between-printouts range in PreferencesModel::DoHarmonize()
    because a distinct UDT seems unwarranted for this purpose. The maximum
    is arbitrarily set at sixty seconds; in practice, fifteen has always
    seemed sufficient.
    
    Incidentally make column-selection comboboxes growable horizontally.
---
 preferences_model.cpp |   56 ++++++++++++++++++++--------------
 preferences_model.hpp |   43 +++++++++++++++-----------
 preferences_view.xrc  |   80 ++++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 136 insertions(+), 43 deletions(-)

diff --git a/preferences_model.cpp b/preferences_model.cpp
index 8f09d7e..e534caf 100644
--- a/preferences_model.cpp
+++ b/preferences_model.cpp
@@ -76,20 +76,24 @@ PreferencesModel::~PreferencesModel()
 
 void PreferencesModel::AscribeMembers()
 {
-    ascribe("UseBuiltinCalculationSummary", 
&PreferencesModel::UseBuiltinCalculationSummary);
-    ascribe("CalculationSummaryColumn00"  , 
&PreferencesModel::CalculationSummaryColumn00);
-    ascribe("CalculationSummaryColumn01"  , 
&PreferencesModel::CalculationSummaryColumn01);
-    ascribe("CalculationSummaryColumn02"  , 
&PreferencesModel::CalculationSummaryColumn02);
-    ascribe("CalculationSummaryColumn03"  , 
&PreferencesModel::CalculationSummaryColumn03);
-    ascribe("CalculationSummaryColumn04"  , 
&PreferencesModel::CalculationSummaryColumn04);
-    ascribe("CalculationSummaryColumn05"  , 
&PreferencesModel::CalculationSummaryColumn05);
-    ascribe("CalculationSummaryColumn06"  , 
&PreferencesModel::CalculationSummaryColumn06);
-    ascribe("CalculationSummaryColumn07"  , 
&PreferencesModel::CalculationSummaryColumn07);
-    ascribe("CalculationSummaryColumn08"  , 
&PreferencesModel::CalculationSummaryColumn08);
-    ascribe("CalculationSummaryColumn09"  , 
&PreferencesModel::CalculationSummaryColumn09);
-    ascribe("CalculationSummaryColumn10"  , 
&PreferencesModel::CalculationSummaryColumn10);
-    ascribe("CalculationSummaryColumn11"  , 
&PreferencesModel::CalculationSummaryColumn11);
-    ascribe("SkinFileName"                , &PreferencesModel::SkinFileName);
+    ascribe("CalculationSummaryColumn00"    , 
&PreferencesModel::CalculationSummaryColumn00    );
+    ascribe("CalculationSummaryColumn01"    , 
&PreferencesModel::CalculationSummaryColumn01    );
+    ascribe("CalculationSummaryColumn02"    , 
&PreferencesModel::CalculationSummaryColumn02    );
+    ascribe("CalculationSummaryColumn03"    , 
&PreferencesModel::CalculationSummaryColumn03    );
+    ascribe("CalculationSummaryColumn04"    , 
&PreferencesModel::CalculationSummaryColumn04    );
+    ascribe("CalculationSummaryColumn05"    , 
&PreferencesModel::CalculationSummaryColumn05    );
+    ascribe("CalculationSummaryColumn06"    , 
&PreferencesModel::CalculationSummaryColumn06    );
+    ascribe("CalculationSummaryColumn07"    , 
&PreferencesModel::CalculationSummaryColumn07    );
+    ascribe("CalculationSummaryColumn08"    , 
&PreferencesModel::CalculationSummaryColumn08    );
+    ascribe("CalculationSummaryColumn09"    , 
&PreferencesModel::CalculationSummaryColumn09    );
+    ascribe("CalculationSummaryColumn10"    , 
&PreferencesModel::CalculationSummaryColumn10    );
+    ascribe("CalculationSummaryColumn11"    , 
&PreferencesModel::CalculationSummaryColumn11    );
+    ascribe("DefaultInputFilename"          , 
&PreferencesModel::DefaultInputFilename          );
+    ascribe("PrintDirectory"                , 
&PreferencesModel::PrintDirectory                );
+    ascribe("SecondsToPauseBetweenPrintouts", 
&PreferencesModel::SecondsToPauseBetweenPrintouts);
+    ascribe("SkinFileName"                  , &PreferencesModel::SkinFileName  
                );
+    ascribe("SpreadsheetFileExtension"      , 
&PreferencesModel::SpreadsheetFileExtension      );
+    ascribe("UseBuiltinCalculationSummary"  , 
&PreferencesModel::UseBuiltinCalculationSummary  );
 }
 
 void PreferencesModel::DoAdaptExternalities()
@@ -137,6 +141,8 @@ void PreferencesModel::DoEnforceProscription(std::string 
const&)
 
 void PreferencesModel::DoHarmonize()
 {
+    SecondsToPauseBetweenPrintouts.minimum_and_maximum(0, 60);
+
     bool do_not_use_builtin_defaults = "No" == UseBuiltinCalculationSummary;
     CalculationSummaryColumn00.enable(do_not_use_builtin_defaults);
     CalculationSummaryColumn01.enable(do_not_use_builtin_defaults);
@@ -218,12 +224,9 @@ bool PreferencesModel::IsModified() const
 
 void PreferencesModel::Load()
 {
-    std::vector<std::string> columns(input_calculation_summary_columns());
-
     configurable_settings const& z = configurable_settings::instance();
-    bool b = z.use_builtin_calculation_summary();
-    UseBuiltinCalculationSummary = b ? "Yes" : "No";
 
+    std::vector<std::string> columns(input_calculation_summary_columns());
     for(std::size_t i = 0; i < member_names().size(); ++i)
         {
         std::string const& name = member_names()[i];
@@ -241,7 +244,12 @@ void PreferencesModel::Load()
             }
         }
 
-    SkinFileName = z.skin_filename();
+    DefaultInputFilename           = z.default_input_filename();
+    PrintDirectory                 = z.print_directory();
+    SecondsToPauseBetweenPrintouts = z.seconds_to_pause_between_printouts();
+    SkinFileName                   = z.skin_filename();
+    SpreadsheetFileExtension       = z.spreadsheet_file_extension();
+    UseBuiltinCalculationSummary   = z.use_builtin_calculation_summary() ? 
"Yes" : "No";
 }
 
 std::string PreferencesModel::string_of_column_names() const
@@ -267,8 +275,12 @@ void PreferencesModel::Save() const
 {
     configurable_settings& z = configurable_settings::instance();
 
-    z["calculation_summary_columns"    ] = string_of_column_names();
-    z["use_builtin_calculation_summary"] = value_cast<std::string>("Yes" == 
UseBuiltinCalculationSummary);
-    z["skin_filename"                  ] = SkinFileName.value();
+    z["calculation_summary_columns"       ] = string_of_column_names();
+    z["default_input_filename"            ] = DefaultInputFilename    .value();
+    z["print_directory"                   ] = PrintDirectory          .value();
+    z["seconds_to_pause_between_printouts"] = 
value_cast<std::string>(SecondsToPauseBetweenPrintouts.value());
+    z["skin_filename"                     ] = SkinFileName            .value();
+    z["spreadsheet_file_extension"        ] = SpreadsheetFileExtension.value();
+    z["use_builtin_calculation_summary"   ] = value_cast<std::string>("Yes" == 
UseBuiltinCalculationSummary);
 }
 
diff --git a/preferences_model.hpp b/preferences_model.hpp
index 7c64ed0..a6685f9 100644
--- a/preferences_model.hpp
+++ b/preferences_model.hpp
@@ -28,10 +28,13 @@
 
 #include "any_member.hpp"
 #include "ce_skin_name.hpp"
+#include "datum_string.hpp"
 #include "mc_enum.hpp"
 #include "mc_enum_types.hpp"
 #include "obstruct_slicing.hpp"
 #include "so_attributes.hpp"
+#include "tn_range.hpp"
+#include "tn_range_types.hpp"
 
 #include <string>
 
@@ -68,20 +71,24 @@ class LMI_SO PreferencesModel
     virtual void DoHarmonize();
     virtual void DoTransmogrify();
 
-    mce_yes_or_no     UseBuiltinCalculationSummary;
-    mce_report_column CalculationSummaryColumn00;
-    mce_report_column CalculationSummaryColumn01;
-    mce_report_column CalculationSummaryColumn02;
-    mce_report_column CalculationSummaryColumn03;
-    mce_report_column CalculationSummaryColumn04;
-    mce_report_column CalculationSummaryColumn05;
-    mce_report_column CalculationSummaryColumn06;
-    mce_report_column CalculationSummaryColumn07;
-    mce_report_column CalculationSummaryColumn08;
-    mce_report_column CalculationSummaryColumn09;
-    mce_report_column CalculationSummaryColumn10;
-    mce_report_column CalculationSummaryColumn11;
-    ce_skin_name      SkinFileName;
+    mce_report_column       CalculationSummaryColumn00;
+    mce_report_column       CalculationSummaryColumn01;
+    mce_report_column       CalculationSummaryColumn02;
+    mce_report_column       CalculationSummaryColumn03;
+    mce_report_column       CalculationSummaryColumn04;
+    mce_report_column       CalculationSummaryColumn05;
+    mce_report_column       CalculationSummaryColumn06;
+    mce_report_column       CalculationSummaryColumn07;
+    mce_report_column       CalculationSummaryColumn08;
+    mce_report_column       CalculationSummaryColumn09;
+    mce_report_column       CalculationSummaryColumn10;
+    mce_report_column       CalculationSummaryColumn11;
+    datum_string            DefaultInputFilename;
+    datum_string            PrintDirectory;
+    tnr_nonnegative_integer SecondsToPauseBetweenPrintouts;
+    ce_skin_name            SkinFileName;
+    datum_string            SpreadsheetFileExtension;
+    mce_yes_or_no           UseBuiltinCalculationSummary;
 };
 
 /// Specialization of struct template reconstitutor for this Model
@@ -93,9 +100,11 @@ template<> struct reconstitutor<datum_base, 
PreferencesModel>
     static DesiredType* reconstitute(any_member<PreferencesModel>& m)
         {
         DesiredType* z = 0;
-        z = exact_cast<ce_skin_name     >(m); if(z) return z;
-        z = exact_cast<mce_report_column>(m); if(z) return z;
-        z = exact_cast<mce_yes_or_no    >(m); if(z) return z;
+        z = exact_cast<ce_skin_name            >(m); if(z) return z;
+        z = exact_cast<datum_string            >(m); if(z) return z;
+        z = exact_cast<mce_report_column       >(m); if(z) return z;
+        z = exact_cast<mce_yes_or_no           >(m); if(z) return z;
+        z = exact_cast<tnr_nonnegative_integer >(m); if(z) return z;
         return z;
         }
 };
diff --git a/preferences_view.xrc b/preferences_view.xrc
index 73afbbc..e7b6697 100644
--- a/preferences_view.xrc
+++ b/preferences_view.xrc
@@ -29,11 +29,13 @@
     <object class="wxFlexGridSizer">
         <cols>1</cols>
         <growablerows>1</growablerows>
+        <growablecols>0</growablecols>
         <object class="sizeritem">
             <flag>wxALIGN_LEFT</flag>
             <border>4</border>
             <object class="wxCheckBox" name="UseBuiltinCalculationSummary">
                 <label>Use default calculation summary columns</label>
+                <help>Use builtin default columns instead of custom 
selections</help>
             </object>
         </object>
         <object class="sizeritem">
@@ -41,7 +43,7 @@
             <border>4</border>
             <object class="wxFlexGridSizer">
                 <cols>2</cols>
-                <growablecols>0,1</growablecols>
+                <growablecols>1</growablecols>
                 <object class="sizeritem">
                     <flag>wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL</flag>
                     <border>4</border>
@@ -215,7 +217,7 @@
     </object>
 </object>
 
-<object class="wxPanel" name="input_configuration_panel">
+<object class="wxPanel" name="general_configuration_panel">
     <object class="wxBoxSizer">
         <orient>wxVERTICAL</orient>
         <object class="sizeritem">
@@ -231,6 +233,76 @@
             <border>4</border>
             <object class="wxListBox" name="SkinFileName">
                 <style>wxLB_SINGLE</style>
+                <help>Skins show different sets of input fields, tailored to 
various lines of business</help>
+            </object>
+        </object>
+        <object class="sizeritem">
+            <flag>wxGROW|wxALL</flag>
+            <border>4</border>
+            <object class="wxFlexGridSizer">
+                <cols>2</cols>
+                <growablecols>1</growablecols>
+                <growablerows>0</growablerows>
+                <object class="sizeritem">
+                    <flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT</flag>
+                    <border>4</border>
+                    <object class="wxStaticText">
+                        <label>Input defaults</label>
+                    </object>
+                </object>
+                <object class="sizeritem">
+                    <flag>wxGROW</flag>
+                    <object class="wxTextCtrl" name="DefaultInputFilename">
+<!-- change soon to:
+                    <object class="wxFilePickerCtrl" 
name="DefaultInputFilename">
+-->
+                        <help>Name of file with customized input values that 
are used as defaults for new illustrations and censuses</help>
+                        <size>180,-1</size>
+                    </object>
+                </object>
+                <object class="sizeritem">
+                    <flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT</flag>
+                    <border>4</border>
+                    <object class="wxStaticText">
+                        <label>Printout directory</label>
+                    </object>
+                </object>
+                <object class="sizeritem">
+                    <flag>wxGROW</flag>
+                    <object class="wxTextCtrl" name="PrintDirectory">
+<!-- change soon to:
+                    <object class="wxDirPickerCtrl" name="PrintDirectory">
+-->
+                        <help>Location where PDF files are written</help>
+                        <size>180,-1</size>
+                    </object>
+                </object>
+                <object class="sizeritem">
+                    <flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT</flag>
+                    <border>4</border>
+                    <object class="wxStaticText">
+                        <label>Seconds to pause between printouts</label>
+                    </object>
+                </object>
+                <object class="sizeritem">
+                    <flag>wxGROW</flag>
+                    <object class="wxSpinCtrl" 
name="SecondsToPauseBetweenPrintouts">
+                        <help>Number of seconds to pause between batched 
printouts, to prevent the printer from scrambling their order</help>
+                    </object>
+                </object>
+                <object class="sizeritem">
+                    <flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT</flag>
+                    <border>4</border>
+                    <object class="wxStaticText">
+                        <label>Spreadsheet file extension</label>
+                    </object>
+                </object>
+                <object class="sizeritem">
+                    <flag>wxGROW</flag>
+                    <object class="wxTextCtrl" name="SpreadsheetFileExtension">
+                        <help>File extension for spreadsheet output</help>
+                    </object>
+                </object>
             </object>
         </object>
     </object>
@@ -253,8 +325,8 @@
             <border>4</border>
             <object class="wxNotebook" name="preferences_notebook">
                 <object class="notebookpage">
-                    <label>Input</label>
-                    <object_ref ref="input_configuration_panel"/>
+                    <label>General</label>
+                    <object_ref ref="general_configuration_panel"/>
                 </object>
                 <object class="notebookpage">
                     <label>View</label>



reply via email to

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