HatchKeeper  0.90
The Free Open-Source Egg Incubation Software
PrefDialog.cpp
Go to the documentation of this file.
1 /*******************************************************************/
8 #include <wx/wx.h>
9 #include <wx/spinctrl.h>
10 #include <wx/statline.h>
11 #include <wx/clrpicker.h>
12 #include <wx/scrolwin.h>
13 #include <wx/notebook.h>
14 #include <wx/textdlg.h>
15 #include <string>
16 #include <wx/checkbox.h>
17 #include <wx/colour.h>
18 #include <wx/filepicker.h>
19 #include <wx/editlbox.h>
20 
21 #include "../../headers/Declare.h"
22 #include "../../headers/Storage.h"
23 #include "../../headers/File.h"
24 
25 using namespace std;
26 
33 class AddBreedDialog : public wxDialog
34 {
35  private:
36  wxTextCtrl* BreedNameCtrl;
37  wxStaticText* BreedNameStat;
38  wxChoice* BreedTypeChoice;
39  wxStaticText* BreedTypeStat;
40  wxSpinCtrl* BreedDaySpin;
41  wxStaticText* BreedDayText;
42  wxButton* SaveButton;
43  wxButton* CancelButton;
44  void OnBreedType(wxCommandEvent& );
45  void OnSaveButton(wxCommandEvent& );
47  inline void OnCancelButton(wxCommandEvent& ){EndModal(0);}
48  public:
49  AddBreedDialog( wxWindow* parent, wxWindowID id = 500, const wxString& title = wxT(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU );
50 };
51 
53 AddBreedDialog::AddBreedDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
54 {
55  wxTextValidator textVal(wxFILTER_INCLUDE_CHAR_LIST,NULL);
56  textVal.SetCharIncludes(Info.GetValidChars().c_str());
57 
58  this->SetSizeHints( wxDefaultSize, wxDefaultSize );
59 
60  //Colors
61  vector<int> ColorRed = Settings.GetIntArray("ColorRed");
62  vector<int> ColorGreen = Settings.GetIntArray("ColorGreen");
63  vector<int> ColorBlue = Settings.GetIntArray("ColorBlue");
64 
65  this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
66  this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
67 
68  wxBoxSizer* bSizer3;
69  bSizer3 = new wxBoxSizer( wxVERTICAL );
70 
71  wxGridSizer* gSizer2;
72  gSizer2 = new wxGridSizer( 4, 2, 0, 0 );
73 
74  BreedNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 , textVal);
75  gSizer2->Add( BreedNameCtrl, 0, wxALL|wxEXPAND, 5 );
76 
77  BreedNameStat = new wxStaticText( this, wxID_ANY, l("Breed Name"), wxDefaultPosition, wxDefaultSize, 0 );
78  BreedNameStat->Wrap( -1 );
79  gSizer2->Add( BreedNameStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
80 
81  wxArrayString BreedTypeChoiceChoices;
82  BreedTypeChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, BreedTypeChoiceChoices, 0 );
83  BreedTypeChoice->SetSelection( 0 );
84  gSizer2->Add( BreedTypeChoice, 0, wxALL|wxEXPAND, 5 );
85 
86  BreedTypeStat = new wxStaticText( this, wxID_ANY, l("Breed Type"), wxDefaultPosition, wxDefaultSize, 0 );
87  BreedTypeStat->Wrap( -1 );
88  gSizer2->Add( BreedTypeStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
89 
90  BreedDaySpin = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 );
91  gSizer2->Add( BreedDaySpin, 0, wxALL|wxEXPAND, 5 );
92  BreedDaySpin->SetForegroundColour( wxColor(0,0,0) );
93 
94  BreedDayText = new wxStaticText( this, wxID_ANY, l("Incubation Days"), wxDefaultPosition, wxDefaultSize, 0 );
95  BreedDayText->Wrap( -1 );
96  gSizer2->Add( BreedDayText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
97 
98  CancelButton = new wxButton( this, wxID_ANY, l("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
99  gSizer2->Add( CancelButton, 0, wxALL|wxEXPAND, 5 );
100 
101  SaveButton = new wxButton( this, wxID_ANY, l("Save"), wxDefaultPosition, wxDefaultSize, 0 );
102  gSizer2->Add( SaveButton, 0, wxALL|wxEXPAND, 5 );
103 
104  bSizer3->Add( gSizer2, 0, wxEXPAND, 5 );
105 
106  bSizer3->SetSizeHints(this);
107 
108  SaveButton->Bind(wxEVT_BUTTON, &AddBreedDialog::OnSaveButton, this );
109  CancelButton->Bind(wxEVT_BUTTON, &AddBreedDialog::OnCancelButton, this );
110  BreedTypeChoice->Bind(wxEVT_CHOICE, &AddBreedDialog::OnBreedType, this);
111 
112  BreedTypeChoice->Append(l("Select Type"));
113 
114  for(int A = 0; A < Types.GetCount(); A++)
115  BreedTypeChoice->Append(Types.GetName(A).c_str());
116  BreedTypeChoice->SetSelection(0);
117 
118  this->SetSizer( bSizer3 );
119  this->Layout();
120 }
121 
123 void AddBreedDialog::OnSaveButton(wxCommandEvent& )
124 {
125  if (BreedNameCtrl->GetLineLength(0) == 0 || BreedTypeChoice->GetSelection() <= 0) {
126  wxMessageDialog dialog(this,
127  l("Please Enter A Breed Name\nAnd Select A Type!"));
128  dialog.ShowModal();
129  return;
130  }
131 
132  string breedHold = BreedNameCtrl->GetLineText(0).ToStdString();
133  if(!Breeds.IsValidName(breedHold)) {
134  wxMessageDialog dialog(this,
135  l("Breed Name Exists!\nPlease Enter A New\nBreed Name!"));
136  dialog.ShowModal();
137  return;
138  }
139 
140  string SQL = "INSERT INTO Breeds VALUES(" + to_string(Breeds.GetValidID()) + ", \'";
141  SQL += breedHold + "\',\'" + Types.GetName(BreedTypeChoice->GetSelection() - 1) + "\'";
142  SQL += "," + to_string(BreedDaySpin->GetValue()) + ");";
143 
144  if(!Database.Execute(SQL)) {
145  wxMessageDialog* dialog = new wxMessageDialog(this,"Sqlite Error: " + Database.GetErrors());
146  dialog->ShowModal();
147  dialog->Destroy();
148  return;
149  }
150  EndModal(0);
151 }
152 
154 void AddBreedDialog::OnBreedType(wxCommandEvent& )
155 {
156  if(BreedTypeChoice->GetSelection() <= 0)
157  return;
158 
159  BreedDaySpin->SetValue(Types.GetNumber(BreedTypeChoice->GetSelection() - 1));
160 }
161 
162 
169 class AddTypeDialog : public wxDialog
170 {
171  private:
172  wxTextCtrl* TypeNameCtrl;
173  wxStaticText* TypeNameText;
174  wxSpinCtrl* TypeDaySpin;
175  wxStaticText* TypeDayText;
176  wxButton* SaveButton;
177  wxButton* CancelButton;
178 
179  void OnSaveButton(wxCommandEvent& );
181  inline void OnCancelButton(wxCommandEvent& ){EndModal(0);}
182  public:
183  AddTypeDialog( wxWindow* parent, wxWindowID id = 500, const wxString& title = wxT(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU );
184 };
185 
187 AddTypeDialog::AddTypeDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
188 {
189  wxTextValidator textVal(wxFILTER_INCLUDE_CHAR_LIST,NULL);
190  textVal.SetCharIncludes(Info.GetValidChars().c_str());
191 
192  this->SetSizeHints( wxDefaultSize, wxDefaultSize );
193 
194  //Colors
195  vector<int> ColorRed = Settings.GetIntArray("ColorRed");
196  vector<int> ColorGreen = Settings.GetIntArray("ColorGreen");
197  vector<int> ColorBlue = Settings.GetIntArray("ColorBlue");
198 
199  this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
200  this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
201 
202  wxBoxSizer* bSizer3;
203  bSizer3 = new wxBoxSizer( wxVERTICAL );
204 
205  wxGridSizer* gSizer2;
206  gSizer2 = new wxGridSizer( 3, 2, 0, 0 );
207 
208  TypeNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0,textVal );
209  gSizer2->Add( TypeNameCtrl, 0, wxALL|wxEXPAND, 5 );
210 
211  TypeNameText = new wxStaticText( this, wxID_ANY, l("Type Name"), wxDefaultPosition, wxDefaultSize, 0 );
212  TypeNameText->Wrap( -1 );
213  gSizer2->Add( TypeNameText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
214 
215  TypeDaySpin = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 );
216  gSizer2->Add( TypeDaySpin, 0, wxALL|wxEXPAND, 5 );
217  TypeDaySpin->SetForegroundColour( wxColor(0,0,0) );
218 
219  TypeDayText = new wxStaticText( this, wxID_ANY, l("Incubation Days"), wxDefaultPosition, wxDefaultSize, 0 );
220  TypeDayText->Wrap( -1 );
221  gSizer2->Add( TypeDayText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
222 
223  CancelButton = new wxButton( this, wxID_ANY, l("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
224  gSizer2->Add( CancelButton, 0, wxALL|wxEXPAND, 5 );
225 
226  SaveButton = new wxButton( this, wxID_ANY, l("Save"), wxDefaultPosition, wxDefaultSize, 0 );
227  gSizer2->Add( SaveButton, 0, wxALL|wxEXPAND, 5 );
228 
229  bSizer3->Add( gSizer2, 0, wxEXPAND, 5 );
230 
231  bSizer3->SetSizeHints(this);
232 
233  SaveButton->Bind(wxEVT_BUTTON, &AddTypeDialog::OnSaveButton, this );
234  CancelButton->Bind(wxEVT_BUTTON, &AddTypeDialog::OnCancelButton, this );
235 
236  this->SetSizer( bSizer3 );
237  this->Layout();
238 }
239 
241 void AddTypeDialog::OnSaveButton(wxCommandEvent& )
242 {
243  string typeHold = TypeNameCtrl->GetLineText(0).ToStdString();
244  int typeDayHold = TypeDaySpin->GetValue();
245 
246  if (TypeNameCtrl->GetLineLength(0) == 0 || typeDayHold == 0) {
247  wxMessageDialog dialog(this,
248  l("Please Enter A Type Name\nAnd Total Incubation Days!"));
249  dialog.ShowModal();
250  return;
251  }
252 
253  if(!Types.IsValidName(typeHold)) {
254  wxMessageDialog dialog(this,
255  l("Type Exists!\nPlease Enter A New\nType Name!"));
256  dialog.ShowModal();
257  return;
258  }
259 
260  string SQL = "INSERT INTO Types VALUES(" + to_string(Types.GetValidID()) + ", \'" ;
261  SQL += typeHold + "\'," + to_string(typeDayHold) + ");";
262 
263  if(!Database.Execute(SQL)) {
264  wxMessageDialog* dialog = new wxMessageDialog(this,
265  "Sqlite Error: " + Database.GetErrors());
266  dialog->ShowModal();
267  dialog->Destroy();
268  return;
269  }
270  EndModal(0);
271 }
272 
280 class CSVManagerDialog : public wxDialog
281 {
282  protected:
283  wxStaticText* NameText;
284  wxTextCtrl* NameCtrl;
285  wxEditableListBox* CsvList;
286  wxButton* SaveButton;
287  string CsvString;
288  public:
289  void OnSave(wxCommandEvent& );
290  inline string GetCsvString() {return CsvString;}
291 
292  CSVManagerDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxSYSTEM_MENU );
293 };
294 
296 CSVManagerDialog::CSVManagerDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
297 {
298  this->SetSizeHints( wxDefaultSize, wxDefaultSize );
299 
300  //Colors
301  vector<int> ColorRed = Settings.GetIntArray("ColorRed");
302  vector<int> ColorGreen = Settings.GetIntArray("ColorGreen");
303  vector<int> ColorBlue = Settings.GetIntArray("ColorBlue");
304  this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
305  this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
306 
307  wxBoxSizer* bSizer1;
308  bSizer1 = new wxBoxSizer( wxVERTICAL );
309 
310  vector<string> Items;
311  wxArrayString Choices;
312 
313  if(this->GetLabel() != l("Incubators"))
314  {
315  if(this->GetLabel() == l("Tag 1"))
316  Items = Settings.GetArray("Tag1");
317  else if(this->GetLabel() == l("Tag 2"))
318  Items = Settings.GetArray("Tag2");
319  else
320  Items = Settings.GetArray("Tag3");
321 
322 
323  wxGridSizer* gSizer2;
324  gSizer2 = new wxGridSizer( 0, 2, 0, 0 );
325 
326  wxTextValidator textVal(wxFILTER_INCLUDE_CHAR_LIST,NULL);
327  textVal.SetCharIncludes(Info.GetValidChars().c_str());
328 
329  NameCtrl = new wxTextCtrl( this, wxID_ANY, Items[0], wxDefaultPosition, wxDefaultSize, 0 ,textVal);
330  gSizer2->Add( NameCtrl, 0, wxALL|wxEXPAND, 5 );
331 
332  NameText = new wxStaticText( this, wxID_ANY, l("Name"), wxDefaultPosition, wxDefaultSize, 0 );
333  NameText->Wrap( -1 );
334  gSizer2->Add( NameText, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
335 
336  bSizer1->Add( gSizer2, 0, wxEXPAND, 5 );
337  }
338  else {
339  Items = Settings.GetArray("Incubators");
340  Choices.Add(Items[0]);
341  }
342 
343  for(int a = 1; a < Items.size();a++)
344  Choices.Add(Items[a]);
345 
346 
347  CsvList = new wxEditableListBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxEL_DEFAULT_STYLE);
348  CsvList->SetStrings(Choices);
349 
350  bSizer1->Add( CsvList, 2, wxALL|wxEXPAND, 5 );
351 
352  SaveButton = new wxButton( this,wxID_ANY, l("Save"), wxDefaultPosition, wxDefaultSize, 0 );
353  bSizer1->Add( SaveButton, 0, wxALL|wxEXPAND, 5 );
354 
355  bSizer1->SetSizeHints(this);
356 
357  this->SetSizer( bSizer1 );
358  this->Layout();
359 
360  this->Centre( wxBOTH );
361 
362  SaveButton->Bind(wxEVT_BUTTON, &CSVManagerDialog::OnSave, this);
363 }
364 
366 void CSVManagerDialog::OnSave(wxCommandEvent&)
367 {
368  wxArrayString Data;
369  CsvList->GetStrings(Data);
370 
371  if(this->GetLabel() == l("Incubators"))
372  {
373  Data[0].Replace(" ","_");
374  CsvString = Data[0].c_str();
375  for(int a = 1; a < Data.GetCount(); a++) {
376  Data[a].Replace(" ","_");
377  CsvString += "," + Data[a].c_str();
378  }
379  }
380  else {
381  CsvString = NameCtrl->GetLineText(0);
382 
383  for(int a = 0; a < Data.GetCount(); a++) {
384  Data[a].Replace(" ","_");
385  CsvString += "," + Data[a].c_str();
386  }
387  }
388 
389  EndModal(0);
390 }
391 
392 
399 class PrefDialog : public wxDialog
400 {
401  protected:
402  wxNotebook* GuiPanel;
403  wxPanel* GeneralPanel;
404  wxSpinCtrl* tillCandleSpinner;
405  wxStaticText* tillCandleStat;
406  wxSpinCtrl* lockdownSpinner;
407  wxStaticText* lockdownStat;
408  wxCheckBox* showSplashCheckbox;
409  wxCheckBox* genNotifyCheckbox;
410  wxCheckBox* clickNotifyCheckbox;
412  wxChoice* weightUnitChoice;
413  wxStaticText* weightUnitStat;
414  wxStaticLine* GenStatLine;
415  wxStaticText* IncuStat;
416  wxListView* IncubatorList;
417  wxButton* IncubatorButton;
418  wxButton* Tag1Button;
419  wxButton* Tag2Button;
420  wxButton* Tag3Button;
421  wxStaticText* TagStat;
422  wxListView* EggTagList;
423 
424  wxPanel* BirdTypePanel;
425  wxButton* TypeAddButton;
426  wxButton* TypeRemoveButton;
427  wxListView* TypeList;
428  wxPanel* BreedPanel;
429  wxButton* BreedAddButton;
430  wxButton* BreedRemoveButton;
431  wxListView* BreedList;
432 
433  wxScrolledWindow* m_scrolledWindow1;
434  wxStaticText* m_staticText33;
435  wxStaticLine* m_staticline1;
436  wxFilePickerCtrl* LangImport;
437  wxStaticText* LangImportStat;
438  wxChoice* DateFormat;
439  wxStaticText* DateFormatStat;
440  wxSpinCtrl* CalTextSizeSpin;
441  wxStaticText* CalTextSizeStat;
442 
443  wxColourPickerCtrl* MainColorPick;
444  wxColourPickerCtrl* CalBackPick;
445  wxColourPickerCtrl* CalTextPick;
446  wxColourPickerCtrl* ListBackPick;
447  wxColourPickerCtrl* ListTextPick;
448  wxColourPickerCtrl* StatisticsBackPick;
449  wxColourPickerCtrl* StatisticsTextPick;
450  wxColourPickerCtrl* DialogsBackPick;
451  wxColourPickerCtrl* DialogsTextPick;
452  wxColourPickerCtrl* remindBackPick;
453  wxColourPickerCtrl* remindTextPick;
454 
455  wxStaticText* DialogsTextStat;
456  wxStaticText* CalBackStat;
457  wxStaticText* MainBackStat;
458  wxStaticText* CalTextStat;
459  wxStaticText* ListBackStat;
460  wxStaticText* ListTextStat;
461  wxStaticText* StatisticsBackStat;
462  wxStaticText* StatisticsTextStat;
463  wxStaticText* DialogsBackStat;
464  wxStaticText* remindBackStat;
465  wxStaticText* remindTextStat;
466  wxButton* PrefCloseButton;
467 
468  wxPanel* DBPanel;
469  wxButton* ExportDataButton;
470  wxStaticText* ExportDataStat;
471  wxButton* ExportDBButton;
472  wxButton* ImportDBButton;
473  wxButton* DeleteDBButton;
474  wxButton* RunDBButton;
475 
476  void OnEditIncubators(wxCommandEvent&);
477  void OnEditTag1(wxCommandEvent&);
478  void OnEditTag2(wxCommandEvent&);
479  void OnEditTag3(wxCommandEvent&);
480  void OnSaver(wxCommandEvent&);
481 
482  void OnBreedSelect(wxListEvent& evt);
483  void OnBreedUnselect(wxListEvent& evt);
484  void OnAddBreed(wxCommandEvent&);
485  void OnRemvBreed(wxCommandEvent&);
486  void ShowBreeds(bool Scan);
487 
488  void OnTypeSelect(wxListEvent& evt);
489  void OnTypeUnselect(wxListEvent& evt);
490  void OnAddTypeButton(wxCommandEvent&);
491  void OnRemvTypeButton(wxCommandEvent&);
492  void ShowTypes(bool Scan);
493 
494  void ExportHatchKeeperData(wxCommandEvent&);
495  void ExportDB(wxCommandEvent&);
496  void ImportDB(wxCommandEvent&);
497  void DeleteDB(wxCommandEvent&);
498  void RunDB(wxCommandEvent&);
499  void ShowBackups(void);
500  void OnLangPath(wxFileDirPickerEvent&);
501  public:
502  PrefDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Preferences"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(550,550), long style = wxRESIZE_BORDER|wxCAPTION|wxSYSTEM_MENU );
503 };
504 
506 PrefDialog::PrefDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
507 {
508  wxTextValidator textVal(wxFILTER_INCLUDE_CHAR_LIST,NULL);
509  textVal.SetCharIncludes(Info.GetValidChars().c_str());
510 
511  this->SetSizeHints( wxDefaultSize, wxDefaultSize );
512 
513  //Colors
514  vector<int> ColorRed = Settings.GetIntArray("ColorRed");
515  vector<int> ColorGreen = Settings.GetIntArray("ColorGreen");
516  vector<int> ColorBlue = Settings.GetIntArray("ColorBlue");
517  this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
518  this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
519 
520  wxBoxSizer* bSizer1;
521  bSizer1 = new wxBoxSizer( wxVERTICAL );
522 
523  GuiPanel = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
524  GuiPanel->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
525  GuiPanel->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
526 
527  GeneralPanel = new wxPanel( GuiPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
528  GeneralPanel->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
529  GeneralPanel->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
530 
531  wxBoxSizer* GenBSizer1;
532  GenBSizer1 = new wxBoxSizer( wxVERTICAL );
533 
534  wxGridSizer* GenGSizer1;
535  GenGSizer1 = new wxGridSizer( 0, 2, 0, 0 );
536 
537 
538  showSplashCheckbox = new wxCheckBox( GeneralPanel, wxID_ANY, l("Show Splash-Screen At Startup"), wxDefaultPosition, wxDefaultSize, 0 );
539  GenGSizer1->Add( showSplashCheckbox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
540  if (Settings.GetInt("ShowSplash") == 0)
541  showSplashCheckbox->SetValue(true);
542  else
543  showSplashCheckbox->SetValue(false);
544 
545  genNotifyCheckbox = new wxCheckBox( GeneralPanel, wxID_ANY, l("Use Generic Notifications"), wxDefaultPosition, wxDefaultSize, 0 );
546  GenGSizer1->Add( genNotifyCheckbox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
547  if (Settings.GetInt("UseGenNotify") == 0)
548  genNotifyCheckbox ->SetValue(true);
549  else
550  genNotifyCheckbox ->SetValue(false);
551 
552  clickNotifyCheckbox = new wxCheckBox( GeneralPanel, wxID_ANY, l("Open If Notification Clicked"), wxDefaultPosition, wxDefaultSize, 0 );
553  GenGSizer1->Add( clickNotifyCheckbox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
554  if (Settings.GetInt("OpenOnClick") == 0)
555  clickNotifyCheckbox ->SetValue(true);
556  else
557  clickNotifyCheckbox ->SetValue(false);
558 
559  dismissNotifyCheckbox = new wxCheckBox( GeneralPanel, wxID_ANY, l("Open If Notification Dismissed"), wxDefaultPosition, wxDefaultSize, 0 );
560  GenGSizer1->Add( dismissNotifyCheckbox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
561  if (Settings.GetInt("OpenOnDismiss") == 0)
562  dismissNotifyCheckbox ->SetValue(true);
563  else
564  dismissNotifyCheckbox ->SetValue(false);
565 
566  wxString weightUnitChoiceChoices[] = { l("Ounce"), l("Gram") };
567  int weightUnitChoiceNChoices = sizeof( weightUnitChoiceChoices ) / sizeof( wxString );
568  weightUnitChoice = new wxChoice( GeneralPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, weightUnitChoiceNChoices, weightUnitChoiceChoices, 0 );
569 
570  if (Settings.GetInt("WeightUnit") == 0)
571  weightUnitChoice->SetSelection( 0 );
572  else
573  weightUnitChoice->SetSelection( 1 );
574 
575  GenGSizer1->Add( weightUnitChoice, 0, wxALL|wxEXPAND, 5 );
576 
577  weightUnitStat = new wxStaticText( GeneralPanel, wxID_ANY, l("Default Weight Unit"), wxDefaultPosition, wxDefaultSize, 0 );
578  weightUnitStat->Wrap( 250 );
579  GenGSizer1->Add( weightUnitStat, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
580 
581  tillCandleSpinner = new wxSpinCtrl( GeneralPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxSP_ARROW_KEYS, 0, 30, Settings.GetInt("TillCandle") );
582  GenGSizer1->Add( tillCandleSpinner, 0, wxALL|wxEXPAND, 5 );
583 
584  tillCandleStat = new wxStaticText( GeneralPanel, wxID_ANY, l("Default Days Till Candle"), wxDefaultPosition, wxDefaultSize, 0 );
585  tillCandleStat->Wrap( 250 );
586  GenGSizer1->Add( tillCandleStat, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
587 
588  lockdownSpinner = new wxSpinCtrl( GeneralPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxSP_ARROW_KEYS, 0, 10, Settings.GetInt("BeforeHatch") );
589  GenGSizer1->Add( lockdownSpinner, 0, wxALL|wxEXPAND, 5 );
590 
591  lockdownStat = new wxStaticText( GeneralPanel, wxID_ANY, l("Default Days Before Hatch For Lockdown"), wxDefaultPosition, wxDefaultSize, 0 );
592  lockdownStat->Wrap( 250 );
593  GenGSizer1->Add( lockdownStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
594 
595  IncubatorButton = new wxButton( GeneralPanel,wxID_ANY, l("Edit Incubators"), wxDefaultPosition, wxDefaultSize, 0 );
596  GenGSizer1->Add( IncubatorButton, 0, wxALL|wxEXPAND, 5 );
597 
598  Tag1Button = new wxButton( GeneralPanel,wxID_ANY, l("Edit Tag 1"), wxDefaultPosition, wxDefaultSize, 0 );
599  GenGSizer1->Add( Tag1Button, 0, wxALL|wxEXPAND, 5 );
600 
601  Tag2Button = new wxButton( GeneralPanel,wxID_ANY, l("Edit Tag 2"), wxDefaultPosition, wxDefaultSize, 0 );
602  GenGSizer1->Add( Tag2Button, 0, wxALL|wxEXPAND, 5 );
603 
604  Tag3Button = new wxButton( GeneralPanel,wxID_ANY, l("Edit Tag 3"), wxDefaultPosition, wxDefaultSize, 0 );
605  GenGSizer1->Add( Tag3Button, 0, wxALL|wxEXPAND, 5 );
606 
607  GenBSizer1->Add( GenGSizer1, 0, wxEXPAND, 5 );
608 
609  GeneralPanel->SetSizer( GenBSizer1 );
610  GeneralPanel->Layout();
611  GenBSizer1->Fit( GeneralPanel );
612  GuiPanel->AddPage( GeneralPanel, l("General"), true );
613 
614 
615  BirdTypePanel = new wxPanel( GuiPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
616  BirdTypePanel->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
617  BirdTypePanel->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
618  wxBoxSizer* bSizer3;
619  bSizer3 = new wxBoxSizer( wxVERTICAL );
620 
621  TypeList = new wxListView( BirdTypePanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
622  bSizer3->Add( TypeList, 1, wxALL|wxEXPAND, 5 );
623 
624  wxGridSizer* gSizer4;
625  gSizer4 = new wxGridSizer( 1, 2, 0, 0 );
626 
627  TypeRemoveButton = new wxButton( BirdTypePanel,wxID_ANY, l("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
628  gSizer4->Add( TypeRemoveButton, 0, wxALL|wxEXPAND, 5 );
629 
630  TypeAddButton = new wxButton( BirdTypePanel,wxID_ANY, l("Add"), wxDefaultPosition, wxDefaultSize, 0 );
631  gSizer4->Add( TypeAddButton, 0, wxALL|wxEXPAND, 5 );
632 
633 
634  bSizer3->Add( gSizer4, 0, wxEXPAND, 5 );
635 
636  BirdTypePanel->SetSizer( bSizer3 );
637  BirdTypePanel->Layout();
638  bSizer3->Fit( BirdTypePanel );
639  GuiPanel->AddPage( BirdTypePanel, l("Types"), false );
640 
641  BreedPanel = new wxPanel( GuiPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
642  BreedPanel->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
643  BreedPanel->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
644  wxBoxSizer* bSizer4;
645  bSizer4 = new wxBoxSizer( wxVERTICAL );
646 
647  BreedList = new wxListView( BreedPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
648  bSizer4->Add( BreedList, 1, wxALL|wxEXPAND, 5 );
649 
650  wxGridSizer* gSizer7;
651  gSizer7 = new wxGridSizer( 0, 2, 0, 0 );
652 
653  BreedRemoveButton = new wxButton( BreedPanel, wxID_ANY, l("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
654  gSizer7->Add( BreedRemoveButton, 0, wxALL|wxEXPAND, 5 );
655 
656  BreedAddButton = new wxButton( BreedPanel, wxID_ANY, l("Add"), wxDefaultPosition, wxDefaultSize, 0 );
657  gSizer7->Add( BreedAddButton, 0, wxALL|wxEXPAND, 5 );
658 
659  bSizer4->Add( gSizer7, 0, wxEXPAND, 5 );
660 
661  BreedPanel->SetSizer( bSizer4 );
662  BreedPanel->Layout();
663  bSizer4->Fit( BreedPanel );
664  GuiPanel->AddPage( BreedPanel, l("Breeds"), false );
665  m_scrolledWindow1 = new wxScrolledWindow( GuiPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
666  m_scrolledWindow1->SetScrollRate( 5, 5 );
667  m_scrolledWindow1->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
668  m_scrolledWindow1->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
669  wxBoxSizer* bSizer8;
670  bSizer8 = new wxBoxSizer( wxVERTICAL );
671 
672  m_staticText33 = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("Settings for various different GUI parts of HatchKeeper. Restart needed for some changes to take affect."), wxDefaultPosition, wxDefaultSize, 0 );
673  m_staticText33->Wrap( 250 );
674  bSizer8->Add( m_staticText33, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
675 
676  m_staticline1 = new wxStaticLine( m_scrolledWindow1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
677  bSizer8->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
678 
679  wxGridSizer* gSizer8;
680  gSizer8 = new wxGridSizer( 0, 2, 0, 0 );
681 
682  LangImport = new wxFilePickerCtrl ( m_scrolledWindow1, wxID_ANY, "", l("Select Language"),"xml files (*.xml)|*.xml", wxDefaultPosition, wxDefaultSize, wxFLP_OPEN|wxFLP_FILE_MUST_EXIST);
683  LangImport->SetInitialDirectory(HATCHKEEPER_DATA+"Languages/");
684 
685  gSizer8->Add( LangImport, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
686 
687  LangImportStat = new wxStaticText( m_scrolledWindow1, wxID_ANY,l("Select Language"), wxDefaultPosition, wxDefaultSize, 0 );
688  LangImportStat->Wrap( -1 );
689  gSizer8->Add( LangImportStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
690 
691  wxArrayString DateFormatChoices;
692  DateFormat = new wxChoice ( m_scrolledWindow1, wxID_ANY, wxDefaultPosition, wxDefaultSize, DateFormatChoices, 0);
693  DateFormat->Append("MM/DD/YYYY");
694  DateFormat->Append("YYYY/MM/DD");
695  DateFormat->Append("DD/MM/YYYY");
696  DateFormat->SetSelection(Settings.GetInt("DateMode"));
697  gSizer8->Add( DateFormat, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
698 
699  DateFormatStat = new wxStaticText( m_scrolledWindow1, wxID_ANY,l("Select Report Date Format"), wxDefaultPosition, wxDefaultSize, 0 );
700  DateFormatStat->Wrap( -1 );
701  gSizer8->Add( DateFormatStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
702 
703 
704  CalTextSizeSpin = new wxSpinCtrl( m_scrolledWindow1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 5, 50, Settings.GetInt("CalTextSize") );
705  gSizer8->Add( CalTextSizeSpin, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
706 
707  CalTextSizeStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("Main Calendar Text Size"), wxDefaultPosition, wxDefaultSize, 0 );
708  CalTextSizeStat->Wrap( -1 );
709  gSizer8->Add( CalTextSizeStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
710 
711  MainColorPick = new wxColourPickerCtrl( m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[0],ColorGreen[0],ColorBlue[0],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
712  gSizer8->Add( MainColorPick, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
713 
714  MainBackStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("Main Window Background Color"), wxDefaultPosition, wxDefaultSize, 0 );
715  MainBackStat->Wrap( 150 );
716  gSizer8->Add( MainBackStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
717 
718  CalBackPick = new wxColourPickerCtrl( m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[1],ColorGreen[1],ColorBlue[1],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
719  gSizer8->Add( CalBackPick, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
720 
721  CalBackStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("Calendar Background Color"), wxDefaultPosition, wxDefaultSize, 0 );
722  CalBackStat->Wrap( 150 );
723  gSizer8->Add( CalBackStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
724 
725  CalTextPick = new wxColourPickerCtrl( m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[2],ColorGreen[2],ColorBlue[2],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
726  gSizer8->Add( CalTextPick, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
727 
728  CalTextStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("Calendar Text Color"), wxDefaultPosition, wxDefaultSize, 0 );
729  CalTextStat->Wrap( 150 );
730  gSizer8->Add( CalTextStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
731 
732  ListBackPick = new wxColourPickerCtrl( m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[3],ColorGreen[3],ColorBlue[3],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
733  gSizer8->Add( ListBackPick, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
734 
735  ListBackStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("Batch List Background Color"), wxDefaultPosition, wxDefaultSize, 0 );
736  ListBackStat->Wrap( 150 );
737  gSizer8->Add( ListBackStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
738 
739  ListTextPick = new wxColourPickerCtrl( m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[4],ColorGreen[4],ColorBlue[4],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
740  gSizer8->Add( ListTextPick, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
741 
742  ListTextStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("Batch List Text Color"), wxDefaultPosition, wxDefaultSize, 0 );
743  ListTextStat->Wrap( 150 );
744  gSizer8->Add( ListTextStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
745 
746  StatisticsBackPick = new wxColourPickerCtrl( m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[5],ColorGreen[5],ColorBlue[5],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
747  gSizer8->Add( StatisticsBackPick, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
748 
749  StatisticsBackStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("Tab Panels Background Color"), wxDefaultPosition, wxDefaultSize, 0 );
750  StatisticsBackStat->Wrap( 150 );
751  gSizer8->Add( StatisticsBackStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
752 
753  StatisticsTextPick = new wxColourPickerCtrl( m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[6],ColorGreen[6],ColorBlue[6],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
754  gSizer8->Add( StatisticsTextPick, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
755 
756  StatisticsTextStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("Tab Panels Text Color"), wxDefaultPosition, wxDefaultSize, 0 );
757  StatisticsTextStat->Wrap( 150 );
758  gSizer8->Add( StatisticsTextStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
759 
760  remindBackPick = new wxColourPickerCtrl( m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[9],ColorGreen[9],ColorBlue[9],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
761  gSizer8->Add( remindBackPick, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
762 
763  remindBackStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("Notification List Background Color"), wxDefaultPosition, wxDefaultSize, 0 );
764  remindBackStat->Wrap( 150 );
765  gSizer8->Add( remindBackStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
766 
767  remindTextPick = new wxColourPickerCtrl( m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[10],ColorGreen[10],ColorBlue[10],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
768  gSizer8->Add( remindTextPick, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
769 
770  remindTextStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("Notification List Text Color"), wxDefaultPosition, wxDefaultSize, 0 );
771  remindTextStat->Wrap( 150 );
772  gSizer8->Add( remindTextStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
773 
774  DialogsBackPick = new wxColourPickerCtrl( m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
775  gSizer8->Add( DialogsBackPick, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
776 
777  DialogsBackStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("HatchKeeper Dialogs Background Color"), wxDefaultPosition, wxDefaultSize, 0 );
778  DialogsBackStat->Wrap( 150 );
779  gSizer8->Add( DialogsBackStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
780 
781  DialogsTextPick = new wxColourPickerCtrl( m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
782  gSizer8->Add( DialogsTextPick, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
783 
784  DialogsTextStat = new wxStaticText( m_scrolledWindow1, wxID_ANY, l("HatchKeeper Dialogs Text Color"), wxDefaultPosition, wxDefaultSize, 0 );
785  DialogsTextStat->Wrap( 150 );
786  gSizer8->Add( DialogsTextStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
787 
788  bSizer8->Add( gSizer8, 1, wxEXPAND, 5 );
789 
790 
791  m_scrolledWindow1->SetSizer( bSizer8 );
792  m_scrolledWindow1->Layout();
793  //bSizer8->Fit( m_scrolledWindow1 );
794  GuiPanel->AddPage( m_scrolledWindow1, l("GUI"), false );
795  DBPanel = new wxPanel( GuiPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
796  DBPanel->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
797  DBPanel->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
798 
799  wxBoxSizer* DBBSizer1;
800  DBBSizer1 = new wxBoxSizer( wxVERTICAL );
801 
802  ExportDataStat = new wxStaticText( DBPanel, wxID_ANY, l("Exporting HatchKeeper data generates a single hkbf file that includes Batches, Groups, Types, Breeds, and Schedules. This file can be used to backup data or transfer data to another HatchKeeper install. "), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL );
803  ExportDataStat->Wrap( 400 );
804  DBBSizer1->Add( ExportDataStat, 0, wxALL|wxEXPAND, 5 );
805 
806  ExportDataButton = new wxButton( DBPanel, wxID_ANY, l("Export HatchKeeper Data"), wxDefaultPosition, wxDefaultSize, 0 );
807  DBBSizer1->Add( ExportDataButton, 0, wxALL|wxEXPAND, 5 );
808 
809  m_staticline1 = new wxStaticLine( DBPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
810  DBBSizer1->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
811 
812  wxStaticText* CautionStat = new wxStaticText( DBPanel, wxID_ANY, l("Caution Zone!!!"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL );
813  CautionStat->Wrap( -1 );
814  CautionStat->SetFont( wxFont( 25, wxFONTFAMILY_DECORATIVE, wxFONTSTYLE_SLANT, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
815  CautionStat->SetForegroundColour( wxColour( 255, 0, 7 ) );
816 
817  DBBSizer1->Add( CautionStat, 1, wxALL|wxEXPAND, 5 );
818 
819  wxStaticText* m_staticText70 = new wxStaticText( DBPanel, wxID_ANY, l("Export/Import Database allows you to save a snapshot of the database that can be restored anytime later. Delete Database completely resets the app. Run SQL Command is for debugging the database."), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL );
820  m_staticText70->Wrap( 400 );
821  DBBSizer1->Add( m_staticText70, 1, wxALL|wxEXPAND, 5 );
822 
823  wxGridSizer* DBGSizer1;
824  DBGSizer1 = new wxGridSizer( 0, 2, 0, 0 );
825 
826  ExportDBButton = new wxButton( DBPanel, wxID_ANY, l("Export Database"), wxDefaultPosition, wxDefaultSize, 0 );
827  ExportDBButton->SetToolTip( l("Exports A Snapshot Of The Database. Useful For Backing Up Data.") );
828 
829  DBGSizer1->Add( ExportDBButton, 0, wxALL|wxEXPAND, 5 );
830 
831  ImportDBButton = new wxButton( DBPanel, wxID_ANY, l("Import Database"), wxDefaultPosition, wxDefaultSize, 0 );
832  ImportDBButton->SetToolTip( l("Imports A Previously Exported Database. Will Overwrite Current Database!") );
833 
834  DBGSizer1->Add( ImportDBButton, 1, wxALL|wxEXPAND, 5 );
835 
836  DeleteDBButton = new wxButton( DBPanel, wxID_ANY, l("Delete Database"), wxDefaultPosition, wxDefaultSize, 0 );
837  DeleteDBButton->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
838  DeleteDBButton->SetToolTip( l("Deletes All HatchKeeper Data, Including Settings. You Can't Undo This!!!") );
839 
840  DBGSizer1->Add( DeleteDBButton, 1, wxALL|wxEXPAND, 5 );
841 
842  RunDBButton = new wxButton( DBPanel, wxID_ANY, l("Run SQL Command"), wxDefaultPosition, wxDefaultSize, 0 );
843  RunDBButton->SetToolTip( l("Runs A Custom SQL Command. Use With Caution!") );
844 
845  DBGSizer1->Add( RunDBButton, 1, wxALL|wxEXPAND, 5 );
846 
847 
848  DBBSizer1->Add( DBGSizer1, 0, wxEXPAND, 5 );
849 
850 
851  DBPanel->SetSizer( DBBSizer1 );
852  DBPanel->Layout();
853  DBBSizer1->Fit( DBPanel );
854  GuiPanel->AddPage( DBPanel, l("Database"), false );
855 
856  bSizer1->Add( GuiPanel, 1, wxEXPAND | wxALL, 5 );
857 
858  PrefCloseButton = new wxButton( this, wxID_ANY, l("Close"), wxDefaultPosition, wxDefaultSize, 0 );
859  bSizer1->Add( PrefCloseButton, 0, wxALL|wxEXPAND, 5 );
860 
861  IncubatorButton->Bind(wxEVT_BUTTON, &PrefDialog::OnEditIncubators, this );
862  Tag1Button->Bind(wxEVT_BUTTON, &PrefDialog::OnEditTag1, this );
863  Tag2Button->Bind(wxEVT_BUTTON, &PrefDialog::OnEditTag2, this );
864  Tag3Button->Bind(wxEVT_BUTTON, &PrefDialog::OnEditTag3, this );
865  ExportDataButton->Bind(wxEVT_BUTTON, &PrefDialog::ExportHatchKeeperData, this );
866  ExportDBButton->Bind(wxEVT_BUTTON, &PrefDialog::ExportDB, this );
867  ImportDBButton->Bind(wxEVT_BUTTON, &PrefDialog::ImportDB, this );
868  DeleteDBButton->Bind(wxEVT_BUTTON, &PrefDialog::DeleteDB, this );
869  RunDBButton->Bind(wxEVT_BUTTON, &PrefDialog::RunDB, this );
870  PrefCloseButton->Bind(wxEVT_BUTTON, &PrefDialog::OnSaver, this );
871  TypeList->Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, &PrefDialog::OnTypeSelect, this);
872  TypeList->Bind(wxEVT_COMMAND_LIST_ITEM_DESELECTED, &PrefDialog::OnTypeUnselect, this);
873  TypeAddButton->Bind(wxEVT_BUTTON, &PrefDialog::OnAddTypeButton, this );
874  TypeRemoveButton->Bind(wxEVT_BUTTON, &PrefDialog::OnRemvTypeButton, this );
875  BreedList->Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, &PrefDialog::OnBreedSelect, this);
876  BreedList->Bind(wxEVT_COMMAND_LIST_ITEM_DESELECTED, &PrefDialog::OnBreedUnselect, this);
877  BreedAddButton->Bind(wxEVT_BUTTON, &PrefDialog::OnAddBreed, this );
878  BreedRemoveButton->Bind(wxEVT_BUTTON, &PrefDialog::OnRemvBreed, this );
879  LangImport->Bind(wxEVT_FILEPICKER_CHANGED, &PrefDialog::OnLangPath, this );
880 
881  this->SetSizer( bSizer1 );
882  this->Layout();
883 
884  this->Centre( wxBOTH );
885 
886  ShowTypes(false);
887  ShowBreeds(false);
888 }
889 
890 void PrefDialog::OnEditIncubators(wxCommandEvent& ) {
891  CSVManagerDialog* dialog = new CSVManagerDialog(this,9950,l("Incubators"));
892  dialog->ShowModal();
893  Settings.SetValue("Incubators", dialog->GetCsvString());
894  dialog->Destroy();
895 }
896 
897 void PrefDialog::OnEditTag1(wxCommandEvent& ) {
898  CSVManagerDialog* dialog = new CSVManagerDialog(this,9950,l("Tag 1"));
899  dialog->ShowModal();
900  Settings.SetValue("Tag1", dialog->GetCsvString());
901  dialog->Destroy();
902 }
903 
904 void PrefDialog::OnEditTag2(wxCommandEvent& ) {
905  CSVManagerDialog* dialog = new CSVManagerDialog(this,9950,l("Tag 2"));
906  dialog->ShowModal();
907  Settings.SetValue("Tag2", dialog->GetCsvString());
908  dialog->Destroy();
909 }
910 
911 void PrefDialog::OnEditTag3(wxCommandEvent& ) {
912  CSVManagerDialog* dialog = new CSVManagerDialog(this,9950,l("Tag 3"));
913  dialog->ShowModal();
914  Settings.SetValue("Tag3", dialog->GetCsvString());
915  dialog->Destroy();
916 }
917 
919 void PrefDialog::OnSaver(wxCommandEvent& )
920 {
921  //Days Till Candle
922  if(to_string(tillCandleSpinner->GetValue()) != Settings.GetValue("TillCandle"))
923  Settings.SetValue("TillCandle", to_string(tillCandleSpinner->GetValue()));
924 
925  //Lockdown Spinner
926  if(to_string(lockdownSpinner->GetValue()) != Settings.GetValue("BeforeHatch"))
927  Settings.SetValue("BeforeHatch", to_string(lockdownSpinner->GetValue()));
928 
929  //ShowSplash
930  if(showSplashCheckbox->GetValue()) {
931  if(Settings.GetValue("ShowSplash") != "0")
932  Settings.SetValue("ShowSplash", "0");
933  }
934  else {
935  if(Settings.GetValue("ShowSplash") != "1")
936  Settings.SetValue("ShowSplash", "1");
937  }
938 
939  //UseGenNotify
940  if(genNotifyCheckbox->GetValue()) {
941  if(Settings.GetValue("UseGenNotify") != "0")
942  Settings.SetValue("UseGenNotify", "0");
943  }
944  else {
945  if(Settings.GetValue("UseGenNotify") != "1")
946  Settings.SetValue("UseGenNotify", "1");
947  }
948 
949  //Open On Click
950  if(clickNotifyCheckbox->GetValue()) {
951  if(Settings.GetValue("OpenOnClick") != "0")
952  Settings.SetValue("OpenOnClick", "0");
953  }
954  else {
955  if(Settings.GetValue("OpenOnClick") != "1")
956  Settings.SetValue("OpenOnClick", "1");
957  }
958 
959  //OpenOnDismiss
960  if(dismissNotifyCheckbox->GetValue()) {
961  if(Settings.GetValue("OpenOnDismiss") != "0")
962  Settings.SetValue("OpenOnDismiss", "0");
963  }
964  else {
965  if(Settings.GetValue("OpenOnDismiss") != "1")
966  Settings.SetValue("OpenOnDismiss", "1");
967  }
968 
969  if(weightUnitChoice->GetSelection() != Settings.GetInt("WeightUnit") && weightUnitChoice->GetSelection() != -1) {
970  Settings.SetValue("WeightUnit", to_string(weightUnitChoice->GetSelection()));
971  }
972 
973 
974  if(CalTextSizeSpin->GetValue() != Settings.GetValue("CalTextSize"))
975  Settings.SetValue("CalTextSize", to_string(CalTextSizeSpin->GetValue()));
976 
977 
978  if(DateFormat->GetSelection() != Settings.GetInt("DateMode")) {
979  Settings.SetValue("DateMode", to_string(DateFormat->GetSelection()));
980  }
981 
982  //Get all colors
983  wxColour color;
984 
985  color = MainColorPick->GetColour();
986  string Red = to_string(color.Red()) + ",";
987  string Green = to_string(color.Green()) + ",";
988  string Blue = to_string(color.Blue()) + ",";
989 
990  color = CalBackPick->GetColour();
991  Red += to_string(color.Red()) + ",";
992  Green += to_string(color.Green()) + ",";
993  Blue += to_string(color.Blue()) + ",";
994 
995  color = CalTextPick->GetColour();
996  Red += to_string(color.Red()) + ",";
997  Green += to_string(color.Green()) + ",";
998  Blue += to_string(color.Blue()) + ",";
999 
1000  color = ListBackPick->GetColour();
1001  Red += to_string(color.Red()) + ",";
1002  Green += to_string(color.Green()) + ",";
1003  Blue += to_string(color.Blue()) + ",";
1004 
1005  color = ListTextPick->GetColour();
1006  Red += to_string(color.Red()) + ",";
1007  Green += to_string(color.Green()) + ",";
1008  Blue += to_string(color.Blue()) + ",";
1009 
1010  color = StatisticsBackPick->GetColour();
1011  Red += to_string(color.Red()) + ",";
1012  Green += to_string(color.Green()) + ",";
1013  Blue += to_string(color.Blue()) + ",";
1014 
1015  color = StatisticsTextPick->GetColour();
1016  Red += to_string(color.Red()) + ",";
1017  Green += to_string(color.Green()) + ",";
1018  Blue += to_string(color.Blue()) + ",";
1019 
1020  color = DialogsBackPick->GetColour();
1021  Red += to_string(color.Red()) + ",";
1022  Green += to_string(color.Green()) + ",";
1023  Blue += to_string(color.Blue()) + ",";
1024 
1025  color = DialogsTextPick->GetColour();
1026  Red += to_string(color.Red()) + ",";
1027  Green += to_string(color.Green()) + ",";
1028  Blue += to_string(color.Blue()) + ",";
1029 
1030  color = remindBackPick->GetColour();
1031  Red += to_string(color.Red()) + ",";
1032  Green += to_string(color.Green()) + ",";
1033  Blue += to_string(color.Blue()) + ",";
1034 
1035  color = remindTextPick->GetColour();
1036  Red += to_string(color.Red());
1037  Green += to_string(color.Green());
1038  Blue += to_string(color.Blue());
1039 
1040  if(Red != Settings.GetValue("ColorRed"))
1041  Settings.SetValue("ColorRed", Red);
1042  if(Green != Settings.GetValue("ColorGreen"))
1043  Settings.SetValue("ColorGreen", Green);
1044  if(Blue != Settings.GetValue("ColorBlue"))
1045  Settings.SetValue("ColorBlue", Blue);
1046 
1047  if(!Database.Execute(Settings.GetUpdate("Settings"))) {
1048  wxMessageDialog* dialog = new wxMessageDialog(this,
1049  "Sqlite Error: " + Database.GetErrors());
1050  dialog->ShowModal();
1051  dialog->Destroy();
1052  return;
1053  }
1054  EndModal(0);
1055 }
1056 
1058 void PrefDialog::OnAddTypeButton(wxCommandEvent&)
1059 {
1060  AddTypeDialog* dialog = new AddTypeDialog(this,9960,l("Add Type"));
1061  dialog->ShowModal();
1062  dialog->Destroy();
1063 
1064  ShowTypes(true);
1065 }
1066 
1068 void PrefDialog::OnTypeUnselect(wxListEvent& evt)
1069 {
1070  TypeRemoveButton->Disable();
1071 }
1072 
1074 void PrefDialog::OnTypeSelect(wxListEvent& evt)
1075 {
1076  TypeRemoveButton->Enable(true);
1077 }
1078 
1080 void PrefDialog::OnRemvTypeButton(wxCommandEvent&)
1081 {
1082  int sel = TypeList->GetFirstSelected();
1083 
1084  if(sel == -1) {
1085  wxMessageDialog dialog(NULL,
1086  l("No Type Is Selected!"));
1087  dialog.ShowModal();
1088  return;
1089  }
1090 
1091  if(!Database.Execute("DELETE FROM Types where ID = " + to_string(Types.GetID(sel)) + ";")) {
1092  wxMessageDialog* dialog = new wxMessageDialog(this,
1093  "Sqlite Error: " + Database.GetErrors());
1094  dialog->ShowModal();
1095  dialog->Destroy();
1096  return;
1097  }
1098 
1099  ShowTypes(true);
1100 }
1101 
1103 void PrefDialog::ShowTypes(bool Scan)
1104 {
1105  if(Scan)
1106  Types = Database.ReadTypes();
1107 
1108  TypeList->ClearAll();//Clear the previous list items
1109  TypeList->InsertColumn(0,l("Type" ), wxLIST_FORMAT_LEFT, 120);
1110  TypeList->InsertColumn(1,l("Incubation Days" ), wxLIST_FORMAT_LEFT, 180);
1111 
1112  for(int A = 0; A < Types.GetCount(); A++) {
1113  TypeList->InsertItem(A, wxString::Format(wxT("%s"), Types.GetName(A).c_str()));
1114  TypeList->SetItem(A, 1,wxString::Format(wxT("%d"),Types.GetNumber(A)) );
1115  }
1116  TypeRemoveButton->Disable();
1117 }
1118 
1120 void PrefDialog::OnBreedUnselect(wxListEvent& evt)
1121 {
1122  BreedRemoveButton->Disable();
1123 }
1124 
1126 void PrefDialog::OnBreedSelect(wxListEvent& evt)
1127 {
1128  BreedRemoveButton->Enable(true);
1129 }
1130 
1132 void PrefDialog::OnAddBreed(wxCommandEvent&)
1133 {
1134  AddBreedDialog* dialog = new AddBreedDialog(this,9960,l("Add Breed"));
1135  dialog->ShowModal();
1136  dialog->Destroy();
1137 
1138  ShowBreeds(true);
1139 }
1140 
1142 void PrefDialog::ShowBreeds(bool Scan)
1143 {
1144  if(Scan)
1146 
1147  BreedList->ClearAll();
1148  BreedList->InsertColumn(0,l("Breed" ), wxLIST_FORMAT_LEFT, 180);
1149  BreedList->InsertColumn(1,l("Breed Type" ), wxLIST_FORMAT_LEFT, 120);
1150  BreedList->InsertColumn(2,l("Days" ), wxLIST_FORMAT_LEFT, 50);
1151 
1152  for(int A = 0; A < Breeds.GetCount(); A++) {
1153  BreedList->InsertItem(A, wxString::Format(wxT("%s"), Breeds.GetName(A).c_str()));
1154  BreedList->SetItem(A, 1,wxString::Format(wxT("%s"),Breeds.GetText(A).c_str()));
1155  BreedList->SetItem(A, 2,wxString::Format(wxT("%d"),Breeds.GetNumber(A)));
1156  }
1157  BreedRemoveButton->Disable();
1158 }
1159 
1161 void PrefDialog::OnRemvBreed(wxCommandEvent&)
1162 {
1163  int sel = BreedList->GetFirstSelected();
1164 
1165  if(sel == -1) {
1166  wxMessageDialog dialog(NULL,
1167  l("No Breed Selected!"));
1168  dialog.ShowModal();
1169  return;
1170  }
1171 
1172  if(!Database.Execute("DELETE FROM Breeds where ID = " + to_string(Breeds.GetID(sel)) + ";")) {
1173  wxMessageDialog* dialog = new wxMessageDialog(this,"Sqlite Error: " + Database.GetErrors());
1174  dialog->ShowModal();
1175  dialog->Destroy();
1176  return;
1177  }
1178  ShowBreeds(true);
1179 }
1180 
1182 void PrefDialog::ExportHatchKeeperData(wxCommandEvent&) {
1183 
1184  HK_Info Info;
1185  HK_Date Date;
1186 
1187  wxFileDialog exportDialog(NULL,
1188  l("Export HatchKeeper Data"),
1189  wxEmptyString,
1190  "HatchKeeper-" + Info.GetVersion() + "-Data-" + Date.ToReadable("-",Settings.GetInt("DateMode")) + ".hkbf",
1191  "HatchKeeper Files (*.hkbf)|*.hkbf",
1192  wxFD_SAVE|wxFD_OVERWRITE_PROMPT,
1193  wxDefaultPosition,
1194  wxDefaultSize,
1195  l("HatchKeeper Data")
1196  );
1197 
1198  if (exportDialog.ShowModal() == wxID_CANCEL)
1199  return;
1200 
1201  string Path = exportDialog.GetPath().ToStdString();
1202  wxFileName fname(Path.c_str());
1203 
1204  if(fname.GetExt() != "hkbf")
1205  Path += ".hkbf";
1206 
1208 }
1209 
1211 void PrefDialog::ExportDB(wxCommandEvent&)
1212 {
1213  HK_Info Info;
1214  HK_Date Date;
1215 
1216  wxFileDialog exportDialog(NULL,
1217  l("Export Database"),
1218  wxEmptyString,
1219  "HatchKeeper-" + Info.GetVersion() + "-Database-" + Date.ToReadable("-",Settings.GetInt("DateMode")) + ".db",
1220  "Database Files (*.db)|*.db",
1221  wxFD_SAVE|wxFD_OVERWRITE_PROMPT,
1222  wxDefaultPosition,
1223  wxDefaultSize,
1224  l("Database")
1225  );
1226 
1227  if (exportDialog.ShowModal() == wxID_CANCEL)
1228  return;
1229 
1230  string Path = exportDialog.GetPath().ToStdString();
1231  wxFileName fname(Path.c_str());
1232 
1233  if(fname.GetExt() != "db")
1234  Path += ".db";
1235 
1236  if(!Database.CreateBackup(Path)) {
1237  wxMessageDialog dialog(this,
1238  l("Error Writing Database File!"));
1239  dialog.ShowModal();
1240  }
1241 }
1242 
1244 void PrefDialog::ImportDB(wxCommandEvent&)
1245 {
1246  wxFileDialog importDialog(
1247  NULL,
1248  l("Import Database"),
1249  wxEmptyString,
1250  wxEmptyString,
1251  "Sqlite3 Database Files (*.db)|*.db",
1252  wxFD_OPEN|wxFD_FILE_MUST_EXIST,
1253  wxDefaultPosition,
1254  wxDefaultSize,
1255  l("Database")
1256  );
1257 
1258  if (importDialog.ShowModal() == wxID_CANCEL)
1259  return;
1260 
1261  //Check Version
1262  string DBPath = HATCHKEEPER_DATA + "HatchKeeper.db";
1263  HK_Database DB(DBPath);
1264 
1265  if(!DB.CheckInfo()) {
1266  wxMessageDialog dialog(NULL,
1267  l("Database And App Version Don't Match!\nCancelling Operation"));
1268  dialog.ShowModal();
1269  return;
1270  }
1271 
1272  if(wxMessageBox(l("Are You Sure You Want To Replace Database?\nYou Can't Undo This!!!"), l("Replace?"),wxOK| wxCANCEL) != wxOK)
1273  return;
1274 
1275  HK_File File(DBPath);
1276  string Path = importDialog.GetPath().ToStdString();
1277 
1278  if(!File.Copy(Path)) {
1279  wxMessageDialog dialog(NULL,
1280  l("Replace Failed!"));
1281  dialog.ShowModal();
1282  }
1283 
1286  Types = Database.ReadTypes();
1289  Batches = Database.ReadBatches(Settings.GetInt("BatchSortState"));
1292 
1293  ShowTypes(false);
1294  ShowBreeds(false);
1295 }
1296 
1298 void PrefDialog::DeleteDB(wxCommandEvent&)
1299 {
1300  if(wxMessageBox(l("Are You Sure You Want To Delete Database?\nYou Can't Undo This!!!"), l("Delete?"),wxOK| wxCANCEL) != wxOK)
1301  return;
1302 
1303  string FileFolder = HATCHKEEPER_DATA + "HatchKeeper.db";
1304  if(remove(FileFolder.c_str()) != 0){
1305  wxMessageDialog dialog(NULL,
1306  l("Delete Failed!"));
1307  dialog.ShowModal();
1308  return;
1309  }
1310 
1311  //Create Empty Database
1312  Database.CreateDB();
1313 
1316  Types = Database.ReadTypes();
1319  Batches = Database.ReadBatches(Settings.GetInt("BatchSortState"));
1322 
1323  ShowTypes(false);
1324  ShowBreeds(false);
1325 }
1326 
1328 void PrefDialog::RunDB(wxCommandEvent& )
1329 {
1330  wxTextEntryDialog dlg(
1331  this,
1332  l("Enter SQL Command"),l("Enter SQL"),
1333  "SELECT * FROM Batches;",
1334  wxOK|wxCANCEL,
1335  wxDefaultPosition
1336  );
1337 
1338  string SQL;
1339 
1340  if ( dlg.ShowModal() == wxID_OK )
1341  SQL = dlg.GetValue();
1342  else
1343  return;
1344 
1345  if(SQL == "")
1346  return;
1347 
1348  if(!Database.Execute(SQL)) {
1349  wxMessageDialog dialog(NULL,Database.GetErrors().c_str());
1350  dialog.ShowModal();
1351  return;
1352  }
1353  else {
1354  vector<HK_KeyValue> TableData = Database.GetData();
1355  string Content = "";
1356  HK_KeyValue Data;
1357  int B = 0;
1358 
1359  if(TableData.size() == 0)
1360  return;
1361 
1362  for(unsigned int A = 0; A < TableData.size(); A++) {
1363  Data = TableData[A];
1364  for(B = 0; B < Data.GetCount(); B++)
1365  Content += Data.GetKey(B) + " : " + Data.GetValue(B) + " | ";
1366  }
1367 
1368  wxMessageDialog dialog(NULL,Content.c_str());
1369  dialog.ShowModal();
1370  return;
1371 
1372  }
1373 }
1374 
1375 void PrefDialog::OnLangPath(wxFileDirPickerEvent&) {
1376  Language.SetPath(LangImport->GetPath().ToStdString());
1377 
1378  Settings.SetValue("LanguageXML",Language.GetPath());
1379 
1380  cout<<Language.GetPath()<<":"<<LangImport->GetPath()<<":"<<Settings.GetValue("LanguageXML")<<endl;
1381 }
HK_Language Language
Definition: Declare.h:49
HK_KeyValue Settings
Definition: Declare.h:36
HK_Info Info
Definition: Declare.h:34
HK_Notifications Notify
Definition: Declare.h:42
HK_Batches Batches
Definition: Declare.h:44
HK_Storage Types
Definition: Declare.h:38
HK_Storage Remind
Definition: Declare.h:40
std::string HATCHKEEPER_DATA
Definition: Declare.h:30
HK_Storage Breeds
Definition: Declare.h:37
HK_Database Database(HATCHKEEPER_DATA+"HatchKeeper.db")
std::string l(std::string Text)
A Helper Function For HK_Language.
Definition: Declare.h:52
HK_Storage Groups
Definition: Declare.h:41
HK_Storage Schedules
Definition: Declare.h:39
HK_Documents ExportImport
Definition: Declare.h:46
void OnCancelButton(wxCommandEvent &)
Closes Dialog.
Definition: PrefDialog.cpp:47
void OnBreedType(wxCommandEvent &)
Fired When Type Changes.
Definition: PrefDialog.cpp:154
wxStaticText * BreedTypeStat
Definition: PrefDialog.cpp:39
wxSpinCtrl * BreedDaySpin
Definition: PrefDialog.cpp:40
wxButton * SaveButton
Definition: PrefDialog.cpp:42
wxStaticText * BreedDayText
Definition: PrefDialog.cpp:41
wxTextCtrl * BreedNameCtrl
Definition: PrefDialog.cpp:36
wxButton * CancelButton
Definition: PrefDialog.cpp:43
wxStaticText * BreedNameStat
Definition: PrefDialog.cpp:37
wxChoice * BreedTypeChoice
Definition: PrefDialog.cpp:38
AddBreedDialog(wxWindow *parent, wxWindowID id=500, const wxString &title=wxT(""), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU)
Constructor.
Definition: PrefDialog.cpp:53
void OnSaveButton(wxCommandEvent &)
Adds A Breed To The Database.
Definition: PrefDialog.cpp:123
A Dialog For Adding Breeds.
Definition: PrefDialog.cpp:170
wxStaticText * TypeDayText
Definition: PrefDialog.cpp:175
wxButton * CancelButton
Definition: PrefDialog.cpp:177
wxTextCtrl * TypeNameCtrl
Definition: PrefDialog.cpp:172
wxButton * SaveButton
Definition: PrefDialog.cpp:176
wxSpinCtrl * TypeDaySpin
Definition: PrefDialog.cpp:174
wxStaticText * TypeNameText
Definition: PrefDialog.cpp:173
void OnCancelButton(wxCommandEvent &)
Closes Dialog.
Definition: PrefDialog.cpp:181
AddTypeDialog(wxWindow *parent, wxWindowID id=500, const wxString &title=wxT(""), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU)
Constructor.
Definition: PrefDialog.cpp:187
void OnSaveButton(wxCommandEvent &)
Adds A Type To The Database.
Definition: PrefDialog.cpp:241
This Dialog Allows The User To Edit CSV Strings.
Definition: PrefDialog.cpp:281
wxTextCtrl * NameCtrl
Definition: PrefDialog.cpp:284
wxEditableListBox * CsvList
Definition: PrefDialog.cpp:285
wxButton * SaveButton
Definition: PrefDialog.cpp:286
void OnSave(wxCommandEvent &)
Sets Date To ReturnDate And Closes Dialog.
Definition: PrefDialog.cpp:366
string GetCsvString()
Definition: PrefDialog.cpp:290
wxStaticText * NameText
Definition: PrefDialog.cpp:283
CSVManagerDialog(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxT(""), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxSYSTEM_MENU)
Constructor.
Definition: PrefDialog.cpp:296
A Wrapper For The Sqlite3 Database.
Definition: Database.h:29
HK_Notifications ReadNotify()
Scans Notifications Into A HK_Storage Object.
HK_KeyValue ReadSettings()
Reads Settings Table Into HK_KeyValue Object.
vector< HK_KeyValue > GetData()
Returns Table Data.
bool Execute(string SQL)
Executes SQL Statments.
HK_Storage ReadSchedules()
Reads Schedules Table Into HK_Storage Object.
bool CreateBackup(string Path)
Copies HK_DBPath To Path.
HK_Storage ReadRemind()
Reads Reminders Table Into HK_Storage Object.
bool CheckInfo()
Checks Info Table In Database To See If It Matches HK_Info Data.
Definition: HK_Database.cpp:21
string GetErrors()
Returns sqlite3_errmsg(HK_DB))
HK_Storage ReadGroups()
Scans Groups Into A HK_Storage Object.
HK_Storage ReadTypes()
Reads Types Table Into HK_Storage Object.
bool CreateDB()
Populates Database With Defaults.
Definition: HK_Database.cpp:41
HK_Batches ReadBatches(int Sort)
Scans Batches Into HK_Batches Object.
HK_Storage ReadBreeds()
Scans Breeds Into A HK_Storage Object.
A Class For Managing Dates.
Definition: Date.h:25
std::string ToReadable(std::string Separator, int Mode)
Generate A Readable String.
Definition: HK_Date.cpp:132
bool ExportHKBF(string Filename, HK_Batches Batches, HK_Storage Groups)
Overloaded: Exports Multiple Batches, and a Group To A hkbf(xml) File.
Simple Platform Independent File Management Functions.
Definition: File.h:26
bool Copy(string Target)
Copy HK_FilePath To Target.
Definition: HK_File.cpp:17
Version And Other Information For HatchKeeper.
Definition: Info.h:22
std::string GetVersion()
Returns The Version Of HatchKeeper.
Definition: HK_Info.cpp:15
std::string GetValidChars()
Returns Chars That Are Allowed In Text Controls.
Definition: HK_Info.cpp:12
A Key and Value Type Storage.
Definition: KeyValue.h:25
vector< string > GetArray(int Selection)
Returns The Selected Value As An Array Of Strings.
string GetKey(int Selection)
Returns The Selected Key As A String.
Definition: HK_KeyValue.cpp:61
void SetValue(int Selection, string Value)
Sets Value For Selection. Sets Dirty As Well.
vector< int > GetIntArray(int Selection)
Returns The Selected Value As An Array Of Integers.
int GetInt(int Selection)
Returns The Selected Setting Value As An Integer.
Definition: HK_KeyValue.cpp:49
int GetCount()
Return The Amount Of Setting Keys Stored.
Definition: HK_KeyValue.cpp:26
vector< string > GetUpdate(string TableName)
Returns An SQL Statement Updating All Settings Marked Dirty. Marks All Clean.
string GetValue(int Selection)
Returns The Selected Setting Value As A String.
Definition: HK_KeyValue.cpp:67
void SetPath(std::string Path)
Sets/Loads Path Opens the xml language file and reads it into two arrays.
Definition: HK_Language.cpp:25
std::string GetPath()
Returns The Path For The Language File.
Definition: HK_Language.cpp:75
bool IsValidName(string Name)
Returns True If Name Isn't Already In Use.
Definition: HK_Storage.cpp:128
int GetValidID()
Returns A Valid ID For Adding Entries To The Database.
Definition: HK_Storage.cpp:106
int GetCount()
Returns The Number Of Elements Stored.
Definition: HK_Storage.cpp:101
int GetNumber(int Select)
Returns The Selected Stored Number.
Definition: HK_Storage.cpp:96
string GetName(int Select)
Returns The Selected Stored Name.
Definition: HK_Storage.cpp:61
string GetText(int Select)
Returns The Selected Stored Text.
Definition: HK_Storage.cpp:91
int GetID(int Select)
Returns The Selected Stored ID.
Definition: HK_Storage.cpp:66
Manages App Settings.
Definition: PrefDialog.cpp:400
wxStaticText * StatisticsBackStat
Definition: PrefDialog.cpp:461
wxCheckBox * showSplashCheckbox
Definition: PrefDialog.cpp:408
void OnLangPath(wxFileDirPickerEvent &)
wxCheckBox * dismissNotifyCheckbox
Definition: PrefDialog.cpp:411
wxButton * Tag2Button
Definition: PrefDialog.cpp:419
wxListView * IncubatorList
Definition: PrefDialog.cpp:416
void OnRemvTypeButton(wxCommandEvent &)
Removes Selected Type From The Database.
wxColourPickerCtrl * DialogsTextPick
Definition: PrefDialog.cpp:451
wxStaticText * StatisticsTextStat
Definition: PrefDialog.cpp:462
wxStaticText * ExportDataStat
Definition: PrefDialog.cpp:470
wxNotebook * GuiPanel
Definition: PrefDialog.cpp:402
void OnEditTag2(wxCommandEvent &)
Definition: PrefDialog.cpp:904
wxButton * TypeAddButton
Definition: PrefDialog.cpp:425
wxButton * ImportDBButton
Definition: PrefDialog.cpp:472
wxStaticText * CalTextSizeStat
Definition: PrefDialog.cpp:441
wxButton * BreedAddButton
Definition: PrefDialog.cpp:429
wxStaticText * weightUnitStat
Definition: PrefDialog.cpp:413
wxStaticText * DateFormatStat
Definition: PrefDialog.cpp:439
wxCheckBox * clickNotifyCheckbox
Definition: PrefDialog.cpp:410
wxColourPickerCtrl * CalTextPick
Definition: PrefDialog.cpp:445
void OnRemvBreed(wxCommandEvent &)
Deletes Selected Breed.
wxStaticText * remindBackStat
Definition: PrefDialog.cpp:464
wxButton * ExportDBButton
Definition: PrefDialog.cpp:471
void ShowBreeds(bool Scan)
Populates BreedList.
void OnEditTag1(wxCommandEvent &)
Definition: PrefDialog.cpp:897
wxSpinCtrl * lockdownSpinner
Definition: PrefDialog.cpp:406
void OnTypeUnselect(wxListEvent &evt)
Fired When Type Unselected.
void OnAddBreed(wxCommandEvent &)
Adds A Breed To The Database.
wxStaticText * tillCandleStat
Definition: PrefDialog.cpp:405
void ShowBackups(void)
wxColourPickerCtrl * DialogsBackPick
Definition: PrefDialog.cpp:450
wxListView * BreedList
Definition: PrefDialog.cpp:431
void OnBreedSelect(wxListEvent &evt)
Fired When Breed LeftClk.
wxColourPickerCtrl * MainColorPick
Definition: PrefDialog.cpp:443
wxSpinCtrl * tillCandleSpinner
Definition: PrefDialog.cpp:404
wxButton * Tag3Button
Definition: PrefDialog.cpp:420
wxColourPickerCtrl * ListTextPick
Definition: PrefDialog.cpp:447
wxPanel * DBPanel
Definition: PrefDialog.cpp:468
wxStaticText * MainBackStat
Definition: PrefDialog.cpp:457
wxButton * RunDBButton
Definition: PrefDialog.cpp:474
wxScrolledWindow * m_scrolledWindow1
Definition: PrefDialog.cpp:433
wxChoice * weightUnitChoice
Definition: PrefDialog.cpp:412
wxStaticText * remindTextStat
Definition: PrefDialog.cpp:465
wxPanel * BirdTypePanel
Definition: PrefDialog.cpp:424
wxButton * IncubatorButton
Definition: PrefDialog.cpp:417
wxFilePickerCtrl * LangImport
Definition: PrefDialog.cpp:436
wxColourPickerCtrl * CalBackPick
Definition: PrefDialog.cpp:444
wxColourPickerCtrl * StatisticsBackPick
Definition: PrefDialog.cpp:448
wxStaticText * DialogsTextStat
Definition: PrefDialog.cpp:455
wxStaticText * lockdownStat
Definition: PrefDialog.cpp:407
void ExportHatchKeeperData(wxCommandEvent &)
Exports Batches, Groups, Types, Breeds, And Schedules.
void OnEditTag3(wxCommandEvent &)
Definition: PrefDialog.cpp:911
wxSpinCtrl * CalTextSizeSpin
Definition: PrefDialog.cpp:440
void OnTypeSelect(wxListEvent &evt)
Fired When Type Selected.
wxListView * EggTagList
Definition: PrefDialog.cpp:422
void ShowTypes(bool Scan)
Populates TypeList And BreedTypeChoice.
void OnEditIncubators(wxCommandEvent &)
Definition: PrefDialog.cpp:890
wxButton * BreedRemoveButton
Definition: PrefDialog.cpp:430
wxStaticLine * GenStatLine
Definition: PrefDialog.cpp:414
wxButton * ExportDataButton
Definition: PrefDialog.cpp:469
void OnBreedUnselect(wxListEvent &evt)
Fired When Breed LeftClk.
wxStaticText * m_staticText33
Definition: PrefDialog.cpp:434
void DeleteDB(wxCommandEvent &)
Deletes Database, Creates New One, And Rescans Sample Stuff.
void OnAddTypeButton(wxCommandEvent &)
Adds A Type To The Database.
wxCheckBox * genNotifyCheckbox
Definition: PrefDialog.cpp:409
void ImportDB(wxCommandEvent &)
Imports A Database And Replaces Current Database.
wxButton * DeleteDBButton
Definition: PrefDialog.cpp:473
wxStaticText * IncuStat
Definition: PrefDialog.cpp:415
wxColourPickerCtrl * remindTextPick
Definition: PrefDialog.cpp:453
wxStaticText * DialogsBackStat
Definition: PrefDialog.cpp:463
wxColourPickerCtrl * StatisticsTextPick
Definition: PrefDialog.cpp:449
wxPanel * BreedPanel
Definition: PrefDialog.cpp:428
wxButton * Tag1Button
Definition: PrefDialog.cpp:418
wxChoice * DateFormat
Definition: PrefDialog.cpp:438
wxStaticText * ListBackStat
Definition: PrefDialog.cpp:459
void OnSaver(wxCommandEvent &)
Saves Settings And Closes The Dialog.
Definition: PrefDialog.cpp:919
wxPanel * GeneralPanel
Definition: PrefDialog.cpp:403
wxStaticText * CalTextStat
Definition: PrefDialog.cpp:458
void RunDB(wxCommandEvent &)
Asks For A SQL Command, Then Executes It Againt Database.
wxListView * TypeList
Definition: PrefDialog.cpp:427
wxStaticText * CalBackStat
Definition: PrefDialog.cpp:456
void ExportDB(wxCommandEvent &)
Saves A Copy Of The Database To The Selected Location.
wxStaticText * TagStat
Definition: PrefDialog.cpp:421
wxStaticText * ListTextStat
Definition: PrefDialog.cpp:460
wxStaticText * LangImportStat
Definition: PrefDialog.cpp:437
wxButton * TypeRemoveButton
Definition: PrefDialog.cpp:426
wxColourPickerCtrl * ListBackPick
Definition: PrefDialog.cpp:446
wxButton * PrefCloseButton
Definition: PrefDialog.cpp:466
wxStaticLine * m_staticline1
Definition: PrefDialog.cpp:435
wxColourPickerCtrl * remindBackPick
Definition: PrefDialog.cpp:452
PrefDialog(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxT("Preferences"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(550, 550), long style=wxRESIZE_BORDER|wxCAPTION|wxSYSTEM_MENU)
Constructor.
Definition: PrefDialog.cpp:506