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>
16 #include <wx/checkbox.h>
17 #include <wx/colour.h>
18 #include <wx/filepicker.h>
19 #include <wx/editlbox.h>
21 #include "../../headers/Declare.h"
22 #include "../../headers/Storage.h"
23 #include "../../headers/File.h"
44 void OnBreedType(wxCommandEvent& );
45 void OnSaveButton(wxCommandEvent& );
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 );
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 )
55 wxTextValidator textVal(wxFILTER_INCLUDE_CHAR_LIST,NULL);
58 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
65 this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
66 this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
69 bSizer3 =
new wxBoxSizer( wxVERTICAL );
72 gSizer2 =
new wxGridSizer( 4, 2, 0, 0 );
74 BreedNameCtrl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 , textVal);
77 BreedNameStat =
new wxStaticText(
this, wxID_ANY,
l(
"Breed Name"), wxDefaultPosition, wxDefaultSize, 0 );
79 gSizer2->Add(
BreedNameStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
81 wxArrayString BreedTypeChoiceChoices;
82 BreedTypeChoice =
new wxChoice(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, BreedTypeChoiceChoices, 0 );
86 BreedTypeStat =
new wxStaticText(
this, wxID_ANY,
l(
"Breed Type"), wxDefaultPosition, wxDefaultSize, 0 );
88 gSizer2->Add(
BreedTypeStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
90 BreedDaySpin =
new wxSpinCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 );
94 BreedDayText =
new wxStaticText(
this, wxID_ANY,
l(
"Incubation Days"), wxDefaultPosition, wxDefaultSize, 0 );
96 gSizer2->Add(
BreedDayText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
98 CancelButton =
new wxButton(
this, wxID_ANY,
l(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
101 SaveButton =
new wxButton(
this, wxID_ANY,
l(
"Save"), wxDefaultPosition, wxDefaultSize, 0 );
102 gSizer2->Add(
SaveButton, 0, wxALL|wxEXPAND, 5 );
104 bSizer3->Add( gSizer2, 0, wxEXPAND, 5 );
106 bSizer3->SetSizeHints(
this);
118 this->SetSizer( bSizer3 );
126 wxMessageDialog dialog(
this,
127 l(
"Please Enter A Breed Name\nAnd Select A Type!"));
132 string breedHold =
BreedNameCtrl->GetLineText(0).ToStdString();
134 wxMessageDialog dialog(
this,
135 l(
"Breed Name Exists!\nPlease Enter A New\nBreed Name!"));
140 string SQL =
"INSERT INTO Breeds VALUES(" + to_string(
Breeds.
GetValidID()) +
", \'";
142 SQL +=
"," + to_string(
BreedDaySpin->GetValue()) +
");";
145 wxMessageDialog* dialog =
new wxMessageDialog(
this,
"Sqlite Error: " +
Database.
GetErrors());
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 );
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 )
189 wxTextValidator textVal(wxFILTER_INCLUDE_CHAR_LIST,NULL);
192 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
199 this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
200 this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
203 bSizer3 =
new wxBoxSizer( wxVERTICAL );
205 wxGridSizer* gSizer2;
206 gSizer2 =
new wxGridSizer( 3, 2, 0, 0 );
208 TypeNameCtrl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0,textVal );
211 TypeNameText =
new wxStaticText(
this, wxID_ANY,
l(
"Type Name"), wxDefaultPosition, wxDefaultSize, 0 );
213 gSizer2->Add(
TypeNameText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
215 TypeDaySpin =
new wxSpinCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 );
217 TypeDaySpin->SetForegroundColour( wxColor(0,0,0) );
219 TypeDayText =
new wxStaticText(
this, wxID_ANY,
l(
"Incubation Days"), wxDefaultPosition, wxDefaultSize, 0 );
221 gSizer2->Add(
TypeDayText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
223 CancelButton =
new wxButton(
this, wxID_ANY,
l(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
226 SaveButton =
new wxButton(
this, wxID_ANY,
l(
"Save"), wxDefaultPosition, wxDefaultSize, 0 );
227 gSizer2->Add(
SaveButton, 0, wxALL|wxEXPAND, 5 );
229 bSizer3->Add( gSizer2, 0, wxEXPAND, 5 );
231 bSizer3->SetSizeHints(
this);
236 this->SetSizer( bSizer3 );
243 string typeHold =
TypeNameCtrl->GetLineText(0).ToStdString();
246 if (
TypeNameCtrl->GetLineLength(0) == 0 || typeDayHold == 0) {
247 wxMessageDialog dialog(
this,
248 l(
"Please Enter A Type Name\nAnd Total Incubation Days!"));
254 wxMessageDialog dialog(
this,
255 l(
"Type Exists!\nPlease Enter A New\nType Name!"));
260 string SQL =
"INSERT INTO Types VALUES(" + to_string(
Types.
GetValidID()) +
", \'" ;
261 SQL += typeHold +
"\'," + to_string(typeDayHold) +
");";
264 wxMessageDialog* dialog =
new wxMessageDialog(
this,
289 void OnSave(wxCommandEvent& );
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 );
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 )
298 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
304 this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
305 this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
308 bSizer1 =
new wxBoxSizer( wxVERTICAL );
310 vector<string> Items;
311 wxArrayString Choices;
313 if(this->GetLabel() !=
l(
"Incubators"))
315 if(this->GetLabel() ==
l(
"Tag 1"))
317 else if(this->GetLabel() ==
l(
"Tag 2"))
323 wxGridSizer* gSizer2;
324 gSizer2 =
new wxGridSizer( 0, 2, 0, 0 );
326 wxTextValidator textVal(wxFILTER_INCLUDE_CHAR_LIST,NULL);
329 NameCtrl =
new wxTextCtrl(
this, wxID_ANY, Items[0], wxDefaultPosition, wxDefaultSize, 0 ,textVal);
330 gSizer2->Add(
NameCtrl, 0, wxALL|wxEXPAND, 5 );
332 NameText =
new wxStaticText(
this, wxID_ANY,
l(
"Name"), wxDefaultPosition, wxDefaultSize, 0 );
334 gSizer2->Add(
NameText, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
336 bSizer1->Add( gSizer2, 0, wxEXPAND, 5 );
340 Choices.Add(Items[0]);
343 for(
int a = 1; a < Items.size();a++)
344 Choices.Add(Items[a]);
347 CsvList =
new wxEditableListBox(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxEL_DEFAULT_STYLE);
350 bSizer1->Add(
CsvList, 2, wxALL|wxEXPAND, 5 );
352 SaveButton =
new wxButton(
this,wxID_ANY,
l(
"Save"), wxDefaultPosition, wxDefaultSize, 0 );
353 bSizer1->Add(
SaveButton, 0, wxALL|wxEXPAND, 5 );
355 bSizer1->SetSizeHints(
this);
357 this->SetSizer( bSizer1 );
360 this->Centre( wxBOTH );
371 if(this->GetLabel() ==
l(
"Incubators"))
373 Data[0].Replace(
" ",
"_");
375 for(
int a = 1; a < Data.GetCount(); a++) {
376 Data[a].Replace(
" ",
"_");
383 for(
int a = 0; a < Data.GetCount(); a++) {
384 Data[a].Replace(
" ",
"_");
498 void RunDB(wxCommandEvent&);
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 );
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 )
508 wxTextValidator textVal(wxFILTER_INCLUDE_CHAR_LIST,NULL);
511 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
517 this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
518 this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
521 bSizer1 =
new wxBoxSizer( wxVERTICAL );
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]) );
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]) );
531 wxBoxSizer* GenBSizer1;
532 GenBSizer1 =
new wxBoxSizer( wxVERTICAL );
534 wxGridSizer* GenGSizer1;
535 GenGSizer1 =
new wxGridSizer( 0, 2, 0, 0 );
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 );
579 GenGSizer1->Add(
weightUnitStat, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
586 GenGSizer1->Add(
tillCandleStat, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
591 lockdownStat =
new wxStaticText(
GeneralPanel, wxID_ANY,
l(
"Default Days Before Hatch For Lockdown"), wxDefaultPosition, wxDefaultSize, 0 );
593 GenGSizer1->Add(
lockdownStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
599 GenGSizer1->Add(
Tag1Button, 0, wxALL|wxEXPAND, 5 );
602 GenGSizer1->Add(
Tag2Button, 0, wxALL|wxEXPAND, 5 );
605 GenGSizer1->Add(
Tag3Button, 0, wxALL|wxEXPAND, 5 );
607 GenBSizer1->Add( GenGSizer1, 0, wxEXPAND, 5 );
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]) );
619 bSizer3 =
new wxBoxSizer( wxVERTICAL );
622 bSizer3->Add(
TypeList, 1, wxALL|wxEXPAND, 5 );
624 wxGridSizer* gSizer4;
625 gSizer4 =
new wxGridSizer( 1, 2, 0, 0 );
634 bSizer3->Add( gSizer4, 0, wxEXPAND, 5 );
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]) );
645 bSizer4 =
new wxBoxSizer( wxVERTICAL );
647 BreedList =
new wxListView(
BreedPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
648 bSizer4->Add(
BreedList, 1, wxALL|wxEXPAND, 5 );
650 wxGridSizer* gSizer7;
651 gSizer7 =
new wxGridSizer( 0, 2, 0, 0 );
659 bSizer4->Add( gSizer7, 0, wxEXPAND, 5 );
667 m_scrolledWindow1->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
668 m_scrolledWindow1->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
670 bSizer8 =
new wxBoxSizer( wxVERTICAL );
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 );
674 bSizer8->Add(
m_staticText33, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
679 wxGridSizer* gSizer8;
680 gSizer8 =
new wxGridSizer( 0, 2, 0, 0 );
682 LangImport =
new wxFilePickerCtrl (
m_scrolledWindow1, wxID_ANY,
"",
l(
"Select Language"),
"xml files (*.xml)|*.xml", wxDefaultPosition, wxDefaultSize, wxFLP_OPEN|wxFLP_FILE_MUST_EXIST);
685 gSizer8->Add(
LangImport, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
689 gSizer8->Add(
LangImportStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
691 wxArrayString DateFormatChoices;
697 gSizer8->Add(
DateFormat, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
701 gSizer8->Add(
DateFormatStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
705 gSizer8->Add(
CalTextSizeSpin, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
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 );
716 gSizer8->Add(
MainBackStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
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 );
723 gSizer8->Add(
CalBackStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
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 );
730 gSizer8->Add(
CalTextStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
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 );
737 gSizer8->Add(
ListBackStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
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 );
744 gSizer8->Add(
ListTextStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
746 StatisticsBackPick =
new wxColourPickerCtrl(
m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[5],ColorGreen[5],ColorBlue[5],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
753 StatisticsTextPick =
new wxColourPickerCtrl(
m_scrolledWindow1, wxID_ANY, wxColor(ColorRed[6],ColorGreen[6],ColorBlue[6],225), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
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 );
765 gSizer8->Add(
remindBackStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
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 );
772 gSizer8->Add(
remindTextStat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
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 );
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 );
788 bSizer8->Add( gSizer8, 1, wxEXPAND, 5 );
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]) );
799 wxBoxSizer* DBBSizer1;
800 DBBSizer1 =
new wxBoxSizer( wxVERTICAL );
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 );
806 ExportDataButton =
new wxButton(
DBPanel, wxID_ANY,
l(
"Export HatchKeeper Data"), wxDefaultPosition, wxDefaultSize, 0 );
809 m_staticline1 =
new wxStaticLine(
DBPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
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 ) );
817 DBBSizer1->Add( CautionStat, 1, wxALL|wxEXPAND, 5 );
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 );
823 wxGridSizer* DBGSizer1;
824 DBGSizer1 =
new wxGridSizer( 0, 2, 0, 0 );
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.") );
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!") );
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!!!") );
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!") );
845 DBGSizer1->Add(
RunDBButton, 1, wxALL|wxEXPAND, 5 );
848 DBBSizer1->Add( DBGSizer1, 0, wxEXPAND, 5 );
851 DBPanel->SetSizer( DBBSizer1 );
856 bSizer1->Add(
GuiPanel, 1, wxEXPAND | wxALL, 5 );
858 PrefCloseButton =
new wxButton(
this, wxID_ANY,
l(
"Close"), wxDefaultPosition, wxDefaultSize, 0 );
881 this->SetSizer( bSizer1 );
884 this->Centre( wxBOTH );
986 string Red = to_string(color.Red()) +
",";
987 string Green = to_string(color.Green()) +
",";
988 string Blue = to_string(color.Blue()) +
",";
991 Red += to_string(color.Red()) +
",";
992 Green += to_string(color.Green()) +
",";
993 Blue += to_string(color.Blue()) +
",";
996 Red += to_string(color.Red()) +
",";
997 Green += to_string(color.Green()) +
",";
998 Blue += to_string(color.Blue()) +
",";
1001 Red += to_string(color.Red()) +
",";
1002 Green += to_string(color.Green()) +
",";
1003 Blue += to_string(color.Blue()) +
",";
1006 Red += to_string(color.Red()) +
",";
1007 Green += to_string(color.Green()) +
",";
1008 Blue += to_string(color.Blue()) +
",";
1011 Red += to_string(color.Red()) +
",";
1012 Green += to_string(color.Green()) +
",";
1013 Blue += to_string(color.Blue()) +
",";
1016 Red += to_string(color.Red()) +
",";
1017 Green += to_string(color.Green()) +
",";
1018 Blue += to_string(color.Blue()) +
",";
1021 Red += to_string(color.Red()) +
",";
1022 Green += to_string(color.Green()) +
",";
1023 Blue += to_string(color.Blue()) +
",";
1026 Red += to_string(color.Red()) +
",";
1027 Green += to_string(color.Green()) +
",";
1028 Blue += to_string(color.Blue()) +
",";
1031 Red += to_string(color.Red()) +
",";
1032 Green += to_string(color.Green()) +
",";
1033 Blue += to_string(color.Blue()) +
",";
1036 Red += to_string(color.Red());
1037 Green += to_string(color.Green());
1038 Blue += to_string(color.Blue());
1048 wxMessageDialog* dialog =
new wxMessageDialog(
this,
1050 dialog->ShowModal();
1061 dialog->ShowModal();
1082 int sel =
TypeList->GetFirstSelected();
1085 wxMessageDialog dialog(NULL,
1086 l(
"No Type Is Selected!"));
1092 wxMessageDialog* dialog =
new wxMessageDialog(
this,
1094 dialog->ShowModal();
1109 TypeList->InsertColumn(0,
l(
"Type" ), wxLIST_FORMAT_LEFT, 120);
1110 TypeList->InsertColumn(1,
l(
"Incubation Days" ), wxLIST_FORMAT_LEFT, 180);
1135 dialog->ShowModal();
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);
1163 int sel =
BreedList->GetFirstSelected();
1166 wxMessageDialog dialog(NULL,
1167 l(
"No Breed Selected!"));
1173 wxMessageDialog* dialog =
new wxMessageDialog(
this,
"Sqlite Error: " +
Database.
GetErrors());
1174 dialog->ShowModal();
1187 wxFileDialog exportDialog(NULL,
1188 l(
"Export HatchKeeper Data"),
1191 "HatchKeeper Files (*.hkbf)|*.hkbf",
1192 wxFD_SAVE|wxFD_OVERWRITE_PROMPT,
1195 l(
"HatchKeeper Data")
1198 if (exportDialog.ShowModal() == wxID_CANCEL)
1201 string Path = exportDialog.GetPath().ToStdString();
1202 wxFileName fname(Path.c_str());
1204 if(fname.GetExt() !=
"hkbf")
1216 wxFileDialog exportDialog(NULL,
1217 l(
"Export Database"),
1220 "Database Files (*.db)|*.db",
1221 wxFD_SAVE|wxFD_OVERWRITE_PROMPT,
1227 if (exportDialog.ShowModal() == wxID_CANCEL)
1230 string Path = exportDialog.GetPath().ToStdString();
1231 wxFileName fname(Path.c_str());
1233 if(fname.GetExt() !=
"db")
1237 wxMessageDialog dialog(
this,
1238 l(
"Error Writing Database File!"));
1246 wxFileDialog importDialog(
1248 l(
"Import Database"),
1251 "Sqlite3 Database Files (*.db)|*.db",
1252 wxFD_OPEN|wxFD_FILE_MUST_EXIST,
1258 if (importDialog.ShowModal() == wxID_CANCEL)
1266 wxMessageDialog dialog(NULL,
1267 l(
"Database And App Version Don't Match!\nCancelling Operation"));
1272 if(wxMessageBox(
l(
"Are You Sure You Want To Replace Database?\nYou Can't Undo This!!!"),
l(
"Replace?"),wxOK| wxCANCEL) != wxOK)
1276 string Path = importDialog.GetPath().ToStdString();
1278 if(!File.
Copy(Path)) {
1279 wxMessageDialog dialog(NULL,
1280 l(
"Replace Failed!"));
1300 if(wxMessageBox(
l(
"Are You Sure You Want To Delete Database?\nYou Can't Undo This!!!"),
l(
"Delete?"),wxOK| wxCANCEL) != wxOK)
1304 if(remove(FileFolder.c_str()) != 0){
1305 wxMessageDialog dialog(NULL,
1306 l(
"Delete Failed!"));
1330 wxTextEntryDialog dlg(
1332 l(
"Enter SQL Command"),
l(
"Enter SQL"),
1333 "SELECT * FROM Batches;",
1340 if ( dlg.ShowModal() == wxID_OK )
1341 SQL = dlg.GetValue();
1355 string Content =
"";
1359 if(TableData.size() == 0)
1362 for(
unsigned int A = 0; A < TableData.size(); A++) {
1363 Data = TableData[A];
1364 for(B = 0; B < Data.
GetCount(); B++)
1368 wxMessageDialog dialog(NULL,Content.c_str());
std::string HATCHKEEPER_DATA
HK_Database Database(HATCHKEEPER_DATA+"HatchKeeper.db")
std::string l(std::string Text)
A Helper Function For HK_Language.
HK_Documents ExportImport
void OnCancelButton(wxCommandEvent &)
Closes Dialog.
void OnBreedType(wxCommandEvent &)
Fired When Type Changes.
wxStaticText * BreedTypeStat
wxSpinCtrl * BreedDaySpin
wxStaticText * BreedDayText
wxTextCtrl * BreedNameCtrl
wxStaticText * BreedNameStat
wxChoice * BreedTypeChoice
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.
void OnSaveButton(wxCommandEvent &)
Adds A Breed To The Database.
A Dialog For Adding Breeds.
wxStaticText * TypeDayText
wxTextCtrl * TypeNameCtrl
wxStaticText * TypeNameText
void OnCancelButton(wxCommandEvent &)
Closes Dialog.
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.
void OnSaveButton(wxCommandEvent &)
Adds A Type To The Database.
This Dialog Allows The User To Edit CSV Strings.
wxEditableListBox * CsvList
void OnSave(wxCommandEvent &)
Sets Date To ReturnDate And Closes Dialog.
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.
A Wrapper For The Sqlite3 Database.
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.
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.
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.
std::string ToReadable(std::string Separator, int Mode)
Generate A Readable String.
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.
bool Copy(string Target)
Copy HK_FilePath To Target.
Version And Other Information For HatchKeeper.
std::string GetVersion()
Returns The Version Of HatchKeeper.
std::string GetValidChars()
Returns Chars That Are Allowed In Text Controls.
A Key and Value Type Storage.
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.
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.
int GetCount()
Return The Amount Of Setting Keys Stored.
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.
void SetPath(std::string Path)
Sets/Loads Path Opens the xml language file and reads it into two arrays.
std::string GetPath()
Returns The Path For The Language File.
bool IsValidName(string Name)
Returns True If Name Isn't Already In Use.
int GetValidID()
Returns A Valid ID For Adding Entries To The Database.
int GetCount()
Returns The Number Of Elements Stored.
int GetNumber(int Select)
Returns The Selected Stored Number.
string GetName(int Select)
Returns The Selected Stored Name.
string GetText(int Select)
Returns The Selected Stored Text.
int GetID(int Select)
Returns The Selected Stored ID.
wxStaticText * StatisticsBackStat
wxCheckBox * showSplashCheckbox
void OnLangPath(wxFileDirPickerEvent &)
wxCheckBox * dismissNotifyCheckbox
wxListView * IncubatorList
void OnRemvTypeButton(wxCommandEvent &)
Removes Selected Type From The Database.
wxColourPickerCtrl * DialogsTextPick
wxStaticText * StatisticsTextStat
wxStaticText * ExportDataStat
void OnEditTag2(wxCommandEvent &)
wxButton * ImportDBButton
wxStaticText * CalTextSizeStat
wxButton * BreedAddButton
wxStaticText * weightUnitStat
wxStaticText * DateFormatStat
wxCheckBox * clickNotifyCheckbox
wxColourPickerCtrl * CalTextPick
void OnRemvBreed(wxCommandEvent &)
Deletes Selected Breed.
wxStaticText * remindBackStat
wxButton * ExportDBButton
void ShowBreeds(bool Scan)
Populates BreedList.
void OnEditTag1(wxCommandEvent &)
wxSpinCtrl * lockdownSpinner
void OnTypeUnselect(wxListEvent &evt)
Fired When Type Unselected.
void OnAddBreed(wxCommandEvent &)
Adds A Breed To The Database.
wxStaticText * tillCandleStat
wxColourPickerCtrl * DialogsBackPick
void OnBreedSelect(wxListEvent &evt)
Fired When Breed LeftClk.
wxColourPickerCtrl * MainColorPick
wxSpinCtrl * tillCandleSpinner
wxColourPickerCtrl * ListTextPick
wxStaticText * MainBackStat
wxScrolledWindow * m_scrolledWindow1
wxChoice * weightUnitChoice
wxStaticText * remindTextStat
wxButton * IncubatorButton
wxFilePickerCtrl * LangImport
wxColourPickerCtrl * CalBackPick
wxColourPickerCtrl * StatisticsBackPick
wxStaticText * DialogsTextStat
wxStaticText * lockdownStat
void ExportHatchKeeperData(wxCommandEvent &)
Exports Batches, Groups, Types, Breeds, And Schedules.
void OnEditTag3(wxCommandEvent &)
wxSpinCtrl * CalTextSizeSpin
void OnTypeSelect(wxListEvent &evt)
Fired When Type Selected.
void ShowTypes(bool Scan)
Populates TypeList And BreedTypeChoice.
void OnEditIncubators(wxCommandEvent &)
wxButton * BreedRemoveButton
wxStaticLine * GenStatLine
wxButton * ExportDataButton
void OnBreedUnselect(wxListEvent &evt)
Fired When Breed LeftClk.
wxStaticText * m_staticText33
void DeleteDB(wxCommandEvent &)
Deletes Database, Creates New One, And Rescans Sample Stuff.
void OnAddTypeButton(wxCommandEvent &)
Adds A Type To The Database.
wxCheckBox * genNotifyCheckbox
void ImportDB(wxCommandEvent &)
Imports A Database And Replaces Current Database.
wxButton * DeleteDBButton
wxColourPickerCtrl * remindTextPick
wxStaticText * DialogsBackStat
wxColourPickerCtrl * StatisticsTextPick
wxStaticText * ListBackStat
void OnSaver(wxCommandEvent &)
Saves Settings And Closes The Dialog.
wxStaticText * CalTextStat
void RunDB(wxCommandEvent &)
Asks For A SQL Command, Then Executes It Againt Database.
wxStaticText * CalBackStat
void ExportDB(wxCommandEvent &)
Saves A Copy Of The Database To The Selected Location.
wxStaticText * ListTextStat
wxStaticText * LangImportStat
wxButton * TypeRemoveButton
wxColourPickerCtrl * ListBackPick
wxButton * PrefCloseButton
wxStaticLine * m_staticline1
wxColourPickerCtrl * remindBackPick
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.