HatchKeeper  0.90
The Free Open-Source Egg Incubation Software
ScheduleDialog.cpp
Go to the documentation of this file.
1 /*******************************************************************/
10 #include <wx/wx.h>
11 #include <wx/listctrl.h>
12 #include <wx/statline.h>
13 
14 //void scanSchedule(void);
15 
22 class AddScheduleDialog : public wxDialog
23 {
24  private:
25  wxTextCtrl* SchNameCtrl;
26  wxStaticText* SchNameStat;
27  wxDatePickerCtrl* SchDatePicker;
28  wxStaticText* SchDateStat;
29  wxButton* SchSaveButton;
30  wxButton* SchCancelButton;
31 
32  void OnSaveButton(wxCommandEvent& );
33  void OnCancelButton(wxCommandEvent& );
34  public:
35  AddScheduleDialog( wxWindow* parent, wxWindowID id = 500, const wxString& title = wxT("Add Schedule"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU );
36 };
37 
39 AddScheduleDialog::AddScheduleDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
40 {
41  this->SetSizeHints( wxDefaultSize, wxDefaultSize );
42 
43  //Colors
44  vector<int> ColorRed = Settings.GetIntArray("ColorRed");
45  vector<int> ColorGreen = Settings.GetIntArray("ColorGreen");
46  vector<int> ColorBlue = Settings.GetIntArray("ColorBlue");
47  this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
48  this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
49 
50  wxBoxSizer* bSizer1;
51  bSizer1 = new wxBoxSizer( wxVERTICAL );
52 
53  wxGridSizer* gSizer1;
54  gSizer1 = new wxGridSizer( 3, 2, 0, 0 );
55  //Filter Invalid Chars
56  wxTextValidator textVal(wxFILTER_INCLUDE_CHAR_LIST,NULL);
57  textVal.SetCharIncludes(Info.GetValidChars().c_str());
58 
59  SchNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 110,-1 ), 0 ,textVal);
60  SchNameCtrl->SetToolTip( l("The New Schedule Name") );
61 
62  gSizer1->Add( SchNameCtrl, 1, wxALL|wxEXPAND, 5 );
63 
64  SchNameStat = new wxStaticText( this, wxID_ANY, l("Schedule Name"), wxDefaultPosition, wxDefaultSize, 0 );
65  SchNameStat->Wrap( -1 );
66  gSizer1->Add( SchNameStat, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
67 
68  SchDatePicker = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxSize( 110,-1 ), wxDP_DROPDOWN );
69  SchDatePicker->SetToolTip( l("Select A Date For The New Schedule") );
70 
71  gSizer1->Add( SchDatePicker, 1, wxALL|wxEXPAND, 5 );
72 
73  SchDateStat = new wxStaticText( this, wxID_ANY, l("Schedule Date"), wxDefaultPosition, wxDefaultSize, 0 );
74  SchDateStat->Wrap( -1 );
75  gSizer1->Add( SchDateStat, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
76 
77  SchCancelButton = new wxButton( this, wxID_ANY, l("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
78  SchCancelButton->SetToolTip( l("Close This Dialog") );
79 
80  gSizer1->Add( SchCancelButton, 0, wxALL|wxEXPAND, 5 );
81 
82  SchSaveButton = new wxButton( this, wxID_ANY, l("Save"), wxDefaultPosition, wxDefaultSize, 0 );
83  SchSaveButton->SetToolTip( l("Add Schedule") );
84 
85  gSizer1->Add( SchSaveButton, 0, wxALL|wxEXPAND, 5 );
86 
87  bSizer1->Add( gSizer1, 0, wxEXPAND, 5 );
88  bSizer1->SetSizeHints(this);
89 
90  SchSaveButton->Bind(wxEVT_BUTTON, &AddScheduleDialog::OnSaveButton, this );
91  SchCancelButton->Bind(wxEVT_BUTTON, &AddScheduleDialog::OnCancelButton, this );
92 
93  this->SetSizer( bSizer1 );
94  this->Layout();
95 }
96 
97 
99 void AddScheduleDialog::OnCancelButton(wxCommandEvent& ){EndModal(0);}
100 
102 void AddScheduleDialog::OnSaveButton(wxCommandEvent& )
103 {
104  //Get Name
105  string curSchName = SchNameCtrl->GetLineText(0).ToStdString();
106 
107  if(curSchName == "") {
108  wxMessageDialog* dialog = new wxMessageDialog(this,
109  l("Please Enter A Name!"));
110  dialog->ShowModal();
111  dialog->Destroy();
112  return;
113  }
114 
115  for(int a = 0; a < Schedules.GetCount(); a++) {
116  if(curSchName == Schedules.GetName(a)) {
117  wxMessageDialog* dialog = new wxMessageDialog(this,
118  l("Please Enter A Different Name!\nThis One Exists Already!"));
119  dialog->ShowModal();
120  dialog->Destroy();
121  return;
122  }
123  }
124 
125  //Get Date
126  wxDateTime selDate = SchDatePicker->GetValue();
127 
128  HK_Date hkDate(
129  selDate.GetDay(wxDateTime::Local),
130  selDate.GetMonth(wxDateTime::Local) + 1,
131  selDate.GetYear(wxDateTime::Local)
132  );
133 
134  /* Create SQL statement */
135  string SQL = "INSERT INTO Schedules VALUES(" + to_string(Schedules.GetValidID()) + ", '";
136  SQL += curSchName + "','" + hkDate.ToSortable("/") + "');";
137 
138  if(!Database.Execute(SQL)) {
139  wxMessageDialog* dialog = new wxMessageDialog(this,
140  "Sqlite Error: " + Database.GetErrors());
141  dialog->ShowModal();
142  dialog->Destroy();
143  return;
144  }
145 
146  SchNameCtrl->Clear();
147  SchDatePicker->SetValue(wxDateTime::Today());
148  EndModal(0);
149 }
150 
157 class ScheduleDialog : public wxDialog
158 {
159  private:
160  //Calendar Vars
161  int SchAttr = -1; //The Scheduled Date Shown In Calendar
162  vector<int> MarkAttr; //Other Events Shown In Calendar
163 
164  //Choice Vars
165  bool ShowHatch = true;
166  bool ShowStart = true;
167  bool ShowCandl = true;
168  bool ShowLockd = true;
169 
170  wxGenericCalendarCtrl* SchCalendar;
171  wxListView * SchList;
172  wxChoice* SchFilterChoice;
173  wxListCtrl* SchOtherEvtList;
174  wxStaticLine* m_staticline1;
175  wxButton* SchDelButton;
176  wxTextCtrl* SchNameCtrl;
177  wxStaticText* SchNameStat;
178  wxDatePickerCtrl* SchDatePicker;
179  wxStaticText* SchDateStat;
180  wxStaticLine* m_staticline2;
181  wxButton* SchAddButton;
182  wxButton* SchCloseButton;
183 
184  void OnAddButton(wxCommandEvent& );
185  void OnRemvButton(wxCommandEvent& );
186  void OnClose(wxCommandEvent& );
187  void OnSchListSelect(wxListEvent& );
188  void OnSchListDESelect(wxListEvent& );
189  void SchCalendarChanged(wxCalendarEvent&);
190  void FilterChanged(wxCommandEvent&);
191 
192  void SetSchAttr();
193  void SetOtherAttr();
194  void RemoveAllAttr();
195  void ShowAllEvents();
196  void ShowSchedules(bool Scan);
197  void AddAttr(int Day);
198 
199  public:
200  ScheduleDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Schedule A Hatch Date"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,500 ), long style = wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|wxRESIZE_BORDER );
201 };
202 
204 ScheduleDialog::ScheduleDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
205 {
206  this->SetSizeHints( wxDefaultSize, wxDefaultSize );
207 
208  //Colors
209  vector<int> ColorRed = Settings.GetIntArray("ColorRed");
210  vector<int> ColorGreen = Settings.GetIntArray("ColorGreen");
211  vector<int> ColorBlue = Settings.GetIntArray("ColorBlue");
212  this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
213  this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
214 
215  wxBoxSizer* bSizer1;
216  bSizer1 = new wxBoxSizer( wxVERTICAL );
217 
218  wxGridSizer* gSizer1;
219  gSizer1 = new wxGridSizer( 0, 2, 0, 0 );
220 
221  SchCalendar = new wxGenericCalendarCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_SURROUNDING_WEEKS|wxCAL_SEQUENTIAL_MONTH_SELECTION );
222  SchCalendar->SetToolTip( l("Calendar To Compare Events: Red = Other Events(List At Right), Purple = Selected Schedule Date(List Below)") );
223  wxFont CalFont(11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,wxFONTWEIGHT_LIGHT, true);
224  SchCalendar->SetOwnFont(CalFont);
225  SchCalendar->SetBackgroundColour(wxColor(ColorRed[1],ColorGreen[1],ColorBlue[1],225));
226  SchCalendar->SetForegroundColour(wxColor(ColorRed[2],ColorGreen[2],ColorBlue[2],225));
227  SchCalendar->SetHeaderColours (wxColor(0,0,0,225), wxColor(211,211,211,225));
228 
229  gSizer1->Add( SchCalendar, 1, wxALL|wxEXPAND, 5 );
230 
231  wxBoxSizer* bSizer2;
232  bSizer2 = new wxBoxSizer( wxVERTICAL );
233 
234  wxArrayString SchFilterChoiceChoices;
235  SchFilterChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, SchFilterChoiceChoices, 0 );
236  SchFilterChoice->SetSelection( 0 );
237  SchFilterChoice->SetToolTip( l("Filter Events Shown In List") );
238 
239  bSizer2->Add( SchFilterChoice, 0, wxALL|wxEXPAND, 5 );
240 
241  SchOtherEvtList = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
242  SchOtherEvtList->SetToolTip( l("This List Shows Events For Selected Month") );
243 
244  bSizer2->Add( SchOtherEvtList, 1, wxALL|wxEXPAND, 5 );
245 
246 
247  gSizer1->Add( bSizer2, 1, wxEXPAND, 5 );
248 
249 
250  bSizer1->Add( gSizer1, 1, wxEXPAND, 5 );
251 
252  m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
253  bSizer1->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
254 
255  SchList = new wxListView( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
256  SchList->SetToolTip( l("Schedules List") );
257 
258  bSizer1->Add( SchList, 1, wxALL|wxEXPAND, 5 );
259 
260 
261  wxGridSizer* gSizer2;
262  gSizer2 = new wxGridSizer( 0, 3, 0, 0 );
263 
264  SchDelButton = new wxButton( this, wxID_ANY, l("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
265  SchDelButton->SetToolTip( l("Delete Schedule") );
266 
267  gSizer2->Add( SchDelButton, 0, wxEXPAND, 5 );
268 
269  SchAddButton = new wxButton( this, wxID_ANY, l("Add"), wxDefaultPosition, wxDefaultSize, 0 );
270  SchAddButton->SetToolTip( l("Add Schedule") );
271 
272  gSizer2->Add( SchAddButton, 0, wxEXPAND, 5 );
273 
274  SchCloseButton = new wxButton( this, wxID_ANY, l("Close"), wxDefaultPosition, wxDefaultSize, 0 );
275  SchCloseButton->SetToolTip( l("Close This Dialog") );
276 
277  gSizer2->Add( SchCloseButton, 0, wxEXPAND, 5 );
278 
279  bSizer1->Add( gSizer2, 0, wxEXPAND|wxALL, 5 );
280 
281 
282  this->SetSizer( bSizer1 );
283  this->Layout();
284 
285  this->Centre( wxBOTH );
286 
287  SchList->Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, &ScheduleDialog::OnSchListSelect, this );
288  SchList->Bind(wxEVT_COMMAND_LIST_ITEM_DESELECTED, &ScheduleDialog::OnSchListDESelect, this );
289  SchAddButton->Bind(wxEVT_BUTTON, &ScheduleDialog::OnAddButton, this );
290  SchDelButton->Bind(wxEVT_BUTTON, &ScheduleDialog::OnRemvButton, this );
291  SchCloseButton->Bind(wxEVT_BUTTON, &ScheduleDialog::OnClose, this );
292  SchFilterChoice->Bind(wxEVT_CHOICE, &ScheduleDialog::FilterChanged, this );
293  SchCalendar->Bind(wxEVT_CALENDAR_PAGE_CHANGED, &ScheduleDialog::SchCalendarChanged, this );
294 
295  //Set up sort options
296  SchFilterChoice->Append(l("Show All Dates"));
297  SchFilterChoice->Append(l("Show Only Hatch Dates"));
298  SchFilterChoice->Append(l("Show Only Start Dates"));
299  SchFilterChoice->Append(l("Show Only Candle Dates"));
300  SchFilterChoice->Append(l("Show Only Lockdown Dates"));
301  SchFilterChoice->SetSelection(0);
302 
303  ShowAllEvents();
304  ShowSchedules(false);
305 }
306 
308 void ScheduleDialog::OnAddButton(wxCommandEvent&)
309 {
310  AddScheduleDialog *dialog = new AddScheduleDialog(this,906,l("Add Schedule"));
311  dialog->ShowModal();
312  dialog->Destroy();
313  ShowSchedules(true);
314 }
315 
318 {
319  HK_Date Date;
320 
321  if(Scan)
323 
324  SchList->ClearAll();//Clear the previous list items
325  SchList->InsertColumn(0,l("Schedule Name" ), wxLIST_FORMAT_LEFT, 160);
326  SchList->InsertColumn(1,l("Date" ), wxLIST_FORMAT_LEFT, 100);
327 
328  for(int count1 = 0; count1 < Schedules.GetCount(); count1++) {
329  Date = Schedules.GetDate(count1);
330  SchList->InsertItem(count1, wxString::Format(wxT("%s"), Schedules.GetName(count1).c_str()));
331  SchList->SetItem(count1, 1,wxString::Format(wxT("%s"),Date.ToReadable("/",Settings.GetInt("DateMode"))) );
332  }
333  SchDelButton->Disable();
334 }
335 
337 void ScheduleDialog::OnClose(wxCommandEvent&){EndModal(0);}
338 
340 void ScheduleDialog::OnRemvButton(wxCommandEvent& )
341 {
342  int sel = SchList->GetFirstSelected();
343  if(sel == -1){
344  wxMessageDialog* dialog = new wxMessageDialog(this, l("No Item Is Selected!"));
345  dialog->ShowModal();
346  dialog->Destroy();
347  return;
348  }
349 
350  int really = wxMessageBox(
351  wxString::Format(wxT("Delete %s ?"),
352  Schedules.GetName(sel).c_str()), l("Delete?"),
353  wxOK| wxCANCEL
354  );
355 
356  if (really == 4) {
357  if(!Database.Execute("DELETE FROM Schedules where ID = " + to_string(Schedules.GetID(sel)) + ";")) {
358  wxMessageDialog* dialog = new wxMessageDialog(this,
359  "Sqlite Error: " + Database.GetErrors());
360  dialog->ShowModal();
361  dialog->Destroy();
362  return;
363  }
364  ShowSchedules(true);
365  }
366  else
367  return;
368 }
369 
372  RemoveAllAttr();
373  SchDelButton->Enable(true);
374 }
375 
378  RemoveAllAttr();
379  SchDelButton->Disable();
380 }
381 
383 void ScheduleDialog::FilterChanged(wxCommandEvent&)
384 {
385  switch(SchFilterChoice->GetSelection()) {
386  case 0: {
387  ShowStart = true;
388  ShowCandl = true;
389  ShowLockd = true;
390  ShowHatch = true;
391  break;
392  }
393  case 1: {
394  ShowStart = false;
395  ShowCandl = false;
396  ShowLockd = false;
397  ShowHatch = true;
398  break;
399  }
400  case 2: {
401  ShowStart = true;
402  ShowCandl = false;
403  ShowLockd = false;
404  ShowHatch = false;
405  break;
406  }
407  case 3: {
408  ShowStart = false;
409  ShowCandl = true;
410  ShowLockd = false;
411  ShowHatch = false;
412  break;
413  }
414  case 4: {
415  ShowStart = false;
416  ShowCandl = false;
417  ShowLockd = true;
418  ShowHatch = false;
419  break;
420  }
421  }
422  RemoveAllAttr();
423 }
424 
427 
430 {
431  //Get Selected Month/Year
432  wxDateTime calTime;
433  calTime = SchCalendar->GetDate();
434  HK_Date Date;
435  Date.SetMonth(calTime.GetMonth(wxDateTime::Local) + 1);
436  Date.SetYear(calTime.GetYear(wxDateTime::Local));
437 
438  int a,b,c = 0;
439  vector<int> MarkArray;
440  vector<string> MarkNotes;
441 
442  //Loop through all batches
443  for(b = 0; b < Batches.GetCount(); b++) {
444  if(Date.IsEqualMonth(Batches.GetStart(b)) && ShowStart == true) {
445  MarkArray.push_back(Batches.GetStart(b).GetDay());
446  MarkNotes.push_back(Batches.GetName(b) + l(" Start Date"));
447  }
448 
449  if(Date.IsEqualMonth(Batches.GetCandle(b)) && ShowCandl == true) {
450  MarkArray.push_back(Batches.GetCandle(b).GetDay());
451  MarkNotes.push_back(Batches.GetName(b) + l(" Candle Date"));
452  }
453 
454  if(Date.IsEqualMonth(Batches.GetLockdown(b)) && ShowLockd == true) {
455  MarkArray.push_back(Batches.GetLockdown(b).GetDay());
456  MarkNotes.push_back(Batches.GetName(b) + l(" Lockdown Date"));
457  c++;
458  }
459 
460  if(Date.IsEqualMonth(Batches.GetHatch(b)) && ShowHatch == true) {
461  MarkArray.push_back(Batches.GetHatch(b).GetDay());
462  MarkNotes.push_back(Batches.GetName(b) + l(" Hatch Date"));
463  }
464  }
465 
466  //Add To List View
467  SchOtherEvtList->ClearAll();//Clear the previous list items
468  SchOtherEvtList->InsertColumn(0,l("Event Name" ), wxLIST_FORMAT_LEFT, 160);
469  SchOtherEvtList->InsertColumn(1,l("Day" ), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
470 
471  for(unsigned int count1 = 0; count1 < MarkArray.size(); count1++) {
472  SchOtherEvtList->InsertItem(count1, wxString::Format(wxT("%s"), MarkNotes[count1].c_str()));
473  SchOtherEvtList->SetItem(count1, 1,wxString::Format(wxT("%d"),MarkArray[count1]) );
474 
475  //Check Against SchAttr
476  if(MarkArray[count1] == SchAttr)
477  continue;
478 
479  //Check Against MarkAttr[]
480  for(a = 0; a < MarkAttr.size(); a++) {
481  if(MarkArray[count1] == MarkAttr[a])
482  continue;
483  }
484 
485  //Finally Add It To MarkAttr[] and mark it in SchCalendar
486  MarkAttr.push_back(MarkArray[count1]);
487 
488  AddAttr(MarkArray[count1]);
489  }
490 
491  SchCalendar->Refresh();
492 }
493 
496 {
497  wxCalendarDateAttr* Attr1 = new wxCalendarDateAttr(wxCAL_BORDER_NONE );
498  Attr1->SetBackgroundColour (wxColour(225,0,0));
499 
500  SchCalendar->SetAttr( Day, Attr1);
501 }
502 
505 {
506  int listSel = SchList->GetFirstSelected();
507 
508  if(listSel == -1){
509  SchAttr = -1;
510  return;
511  }
512 
513  HK_Date Date = Schedules.GetDate(listSel);
514 
515  wxDateTime calTime = SchCalendar->GetDate();
516  HK_Date CalDate(
517  calTime.GetDay(wxDateTime::Local),
518  calTime.GetMonth(wxDateTime::Local) + 1,
519  calTime.GetYear(wxDateTime::Local)
520  );
521 
522  if(!Date.IsEqualMonth(CalDate)) {
523  SchAttr = -1;
524  return;
525  }
526 
527  wxCalendarDateAttr* Attr1 = new wxCalendarDateAttr(wxCAL_BORDER_NONE );
528  Attr1->SetBackgroundColour (wxColour(128,0,128));
529 
530  SchCalendar->SetAttr( Date.GetDay(), Attr1);
531  SchAttr = Date.GetDay();
532  SchCalendar->Refresh();
533 }
534 
537 {
538  //Reset Sch List Selection
539  if(SchAttr != -1) {
540  SchCalendar->ResetAttr(SchAttr);
541  SchAttr = -1;
542  }
543 
544  //Reset Other Events
545  for(unsigned int a = 0; a < MarkAttr.size(); a++)
546  SchCalendar->ResetAttr(MarkAttr[a]);
547 
548  MarkAttr.clear();
549 
550  SchCalendar->Refresh();
551 
552  SetSchAttr();
553  ShowAllEvents();
554 }
HK_KeyValue Settings
Definition: Declare.h:36
HK_Info Info
Definition: Declare.h:34
HK_Date Today
Definition: Declare.h:33
HK_Batches Batches
Definition: Declare.h:44
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 Schedules
Definition: Declare.h:39
A Dialog For Adding Schedule.
wxButton * SchSaveButton
void OnCancelButton(wxCommandEvent &)
Closes Dialog.
AddScheduleDialog(wxWindow *parent, wxWindowID id=500, const wxString &title=wxT("Add Schedule"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU)
Constructor.
wxStaticText * SchNameStat
wxButton * SchCancelButton
wxStaticText * SchDateStat
void OnSaveButton(wxCommandEvent &)
Adds A Schedule To The Database.
wxTextCtrl * SchNameCtrl
wxDatePickerCtrl * SchDatePicker
HK_Date GetHatch(int Select)
Returns Hatch Date For Selected Batch.
Definition: HK_Batches.cpp:87
HK_Date GetStart(int Select)
Returns Start Date For Selected Batch.
Definition: HK_Batches.cpp:81
HK_Date GetCandle(int Select)
Returns Candle Date For Selected Batch.
Definition: HK_Batches.cpp:83
int GetCount()
Returns The Number Of Batches Stored.
Definition: HK_Batches.cpp:191
HK_Date GetLockdown(int Select)
Returns Lockdown Date For Selected Batch.
Definition: HK_Batches.cpp:85
string GetName(int Select)
Returns Batch Name For Selected Batch.
Definition: HK_Batches.cpp:63
bool Execute(string SQL)
Executes SQL Statments.
HK_Storage ReadSchedules()
Reads Schedules Table Into HK_Storage Object.
string GetErrors()
Returns sqlite3_errmsg(HK_DB))
A Class For Managing Dates.
Definition: Date.h:25
void SetMonth(int Month)
Sets Month Value, Doesn't Check If Its Valid.
Definition: HK_Date.cpp:51
bool IsEqualMonth(HK_Date Date)
Checks To See If The Input Date's Month and Year Is Same As Stored Date.
Definition: HK_Date.cpp:336
std::string ToSortable(std::string Separator)
Generate A Sortable String For Database.
Definition: HK_Date.cpp:163
std::string ToReadable(std::string Separator, int Mode)
Generate A Readable String.
Definition: HK_Date.cpp:132
int GetDay()
Returns Day Value.
Definition: HK_Date.cpp:57
void SetYear(int Year)
Sets Year Value, Doesn't Check If Its Valid.
Definition: HK_Date.cpp:54
std::string GetValidChars()
Returns Chars That Are Allowed In Text Controls.
Definition: HK_Info.cpp:12
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
HK_Date GetDate(int Select)
Returns The Selected Stored Date.
Definition: HK_Storage.cpp:71
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
string GetName(int Select)
Returns The Selected Stored Name.
Definition: HK_Storage.cpp:61
int GetID(int Select)
Returns The Selected Stored ID.
Definition: HK_Storage.cpp:66
Manage Scheduled Hatch Dates.
void OnRemvButton(wxCommandEvent &)
Deletes Scheduled Date From Database.
void SetSchAttr()
Shows The Selected Schedule In the Calendar.
wxButton * SchCloseButton
wxListCtrl * SchOtherEvtList
wxStaticText * SchDateStat
wxListView * SchList
void RemoveAllAttr()
Clear Dates From Calendar And Sets More.
void SetOtherAttr()
wxTextCtrl * SchNameCtrl
wxStaticLine * m_staticline2
wxDatePickerCtrl * SchDatePicker
wxChoice * SchFilterChoice
wxGenericCalendarCtrl * SchCalendar
void OnSchListSelect(wxListEvent &)
Fired When A Schedule Is Selected.
void ShowAllEvents()
Marks Dates On Calendar.
wxStaticLine * m_staticline1
void FilterChanged(wxCommandEvent &)
Fired When Filter Dropdown Is Changed.
void OnSchListDESelect(wxListEvent &)
Fired When A Schedule Is Unselected.
void SchCalendarChanged(wxCalendarEvent &)
Fired When SchCalendar Month Changes.
void AddAttr(int Day)
Sets Attributes For A Day In The Calendar.
void OnAddButton(wxCommandEvent &)
Adds A Schedule to the Database.
void ShowSchedules(bool Scan)
Shows Schedules In SchList.
wxButton * SchDelButton
void OnClose(wxCommandEvent &)
Closes Dialog.
wxButton * SchAddButton
ScheduleDialog(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxT("Schedule A Hatch Date"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 500), long style=wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|wxRESIZE_BORDER)
Constructor.
vector< int > MarkAttr
wxStaticText * SchNameStat