11 #include <wx/listctrl.h>
12 #include <wx/statline.h>
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 );
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 )
41 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
47 this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
48 this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
51 bSizer1 =
new wxBoxSizer( wxVERTICAL );
54 gSizer1 =
new wxGridSizer( 3, 2, 0, 0 );
56 wxTextValidator textVal(wxFILTER_INCLUDE_CHAR_LIST,NULL);
59 SchNameCtrl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 110,-1 ), 0 ,textVal);
64 SchNameStat =
new wxStaticText(
this, wxID_ANY,
l(
"Schedule Name"), wxDefaultPosition, wxDefaultSize, 0 );
66 gSizer1->Add(
SchNameStat, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
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") );
73 SchDateStat =
new wxStaticText(
this, wxID_ANY,
l(
"Schedule Date"), wxDefaultPosition, wxDefaultSize, 0 );
75 gSizer1->Add(
SchDateStat, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
77 SchCancelButton =
new wxButton(
this, wxID_ANY,
l(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
82 SchSaveButton =
new wxButton(
this, wxID_ANY,
l(
"Save"), wxDefaultPosition, wxDefaultSize, 0 );
87 bSizer1->Add( gSizer1, 0, wxEXPAND, 5 );
88 bSizer1->SetSizeHints(
this);
93 this->SetSizer( bSizer1 );
105 string curSchName =
SchNameCtrl->GetLineText(0).ToStdString();
107 if(curSchName ==
"") {
108 wxMessageDialog* dialog =
new wxMessageDialog(
this,
109 l(
"Please Enter A Name!"));
117 wxMessageDialog* dialog =
new wxMessageDialog(
this,
118 l(
"Please Enter A Different Name!\nThis One Exists Already!"));
129 selDate.GetDay(wxDateTime::Local),
130 selDate.GetMonth(wxDateTime::Local) + 1,
131 selDate.GetYear(wxDateTime::Local)
136 SQL += curSchName +
"','" + hkDate.
ToSortable(
"/") +
"');";
139 wxMessageDialog* dialog =
new wxMessageDialog(
this,
186 void OnClose(wxCommandEvent& );
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 );
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 )
206 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
212 this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
213 this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
216 bSizer1 =
new wxBoxSizer( wxVERTICAL );
218 wxGridSizer* gSizer1;
219 gSizer1 =
new wxGridSizer( 0, 2, 0, 0 );
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);
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));
232 bSizer2 =
new wxBoxSizer( wxVERTICAL );
234 wxArrayString SchFilterChoiceChoices;
235 SchFilterChoice =
new wxChoice(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, SchFilterChoiceChoices, 0 );
241 SchOtherEvtList =
new wxListCtrl(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
242 SchOtherEvtList->SetToolTip(
l(
"This List Shows Events For Selected Month") );
247 gSizer1->Add( bSizer2, 1, wxEXPAND, 5 );
250 bSizer1->Add( gSizer1, 1, wxEXPAND, 5 );
252 m_staticline1 =
new wxStaticLine(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
255 SchList =
new wxListView(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
256 SchList->SetToolTip(
l(
"Schedules List") );
258 bSizer1->Add(
SchList, 1, wxALL|wxEXPAND, 5 );
261 wxGridSizer* gSizer2;
262 gSizer2 =
new wxGridSizer( 0, 3, 0, 0 );
264 SchDelButton =
new wxButton(
this, wxID_ANY,
l(
"Remove"), wxDefaultPosition, wxDefaultSize, 0 );
269 SchAddButton =
new wxButton(
this, wxID_ANY,
l(
"Add"), wxDefaultPosition, wxDefaultSize, 0 );
274 SchCloseButton =
new wxButton(
this, wxID_ANY,
l(
"Close"), wxDefaultPosition, wxDefaultSize, 0 );
279 bSizer1->Add( gSizer2, 0, wxEXPAND|wxALL, 5 );
282 this->SetSizer( bSizer1 );
285 this->Centre( wxBOTH );
325 SchList->InsertColumn(0,
l(
"Schedule Name" ), wxLIST_FORMAT_LEFT, 160);
326 SchList->InsertColumn(1,
l(
"Date" ), wxLIST_FORMAT_LEFT, 100);
342 int sel =
SchList->GetFirstSelected();
344 wxMessageDialog* dialog =
new wxMessageDialog(
this,
l(
"No Item Is Selected!"));
350 int really = wxMessageBox(
351 wxString::Format(wxT(
"Delete %s ?"),
358 wxMessageDialog* dialog =
new wxMessageDialog(
this,
435 Date.
SetMonth(calTime.GetMonth(wxDateTime::Local) + 1);
436 Date.
SetYear(calTime.GetYear(wxDateTime::Local));
439 vector<int> MarkArray;
440 vector<string> MarkNotes;
469 SchOtherEvtList->InsertColumn(1,
l(
"Day" ), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
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]) );
476 if(MarkArray[count1] ==
SchAttr)
480 for(a = 0; a <
MarkAttr.size(); a++) {
481 if(MarkArray[count1] ==
MarkAttr[a])
486 MarkAttr.push_back(MarkArray[count1]);
497 wxCalendarDateAttr* Attr1 =
new wxCalendarDateAttr(wxCAL_BORDER_NONE );
498 Attr1->SetBackgroundColour (wxColour(225,0,0));
506 int listSel =
SchList->GetFirstSelected();
517 calTime.GetDay(wxDateTime::Local),
518 calTime.GetMonth(wxDateTime::Local) + 1,
519 calTime.GetYear(wxDateTime::Local)
527 wxCalendarDateAttr* Attr1 =
new wxCalendarDateAttr(wxCAL_BORDER_NONE );
528 Attr1->SetBackgroundColour (wxColour(128,0,128));
545 for(
unsigned int a = 0; a <
MarkAttr.size(); a++)
HK_Database Database(HATCHKEEPER_DATA+"HatchKeeper.db")
std::string l(std::string Text)
A Helper Function For HK_Language.
A Dialog For Adding Schedule.
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.
wxDatePickerCtrl * SchDatePicker
HK_Date GetHatch(int Select)
Returns Hatch Date For Selected Batch.
HK_Date GetStart(int Select)
Returns Start Date For Selected Batch.
HK_Date GetCandle(int Select)
Returns Candle Date For Selected Batch.
int GetCount()
Returns The Number Of Batches Stored.
HK_Date GetLockdown(int Select)
Returns Lockdown Date For Selected Batch.
string GetName(int Select)
Returns Batch Name For Selected Batch.
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.
void SetMonth(int Month)
Sets Month Value, Doesn't Check If Its Valid.
bool IsEqualMonth(HK_Date Date)
Checks To See If The Input Date's Month and Year Is Same As Stored Date.
std::string ToSortable(std::string Separator)
Generate A Sortable String For Database.
std::string ToReadable(std::string Separator, int Mode)
Generate A Readable String.
int GetDay()
Returns Day Value.
void SetYear(int Year)
Sets Year Value, Doesn't Check If Its Valid.
std::string GetValidChars()
Returns Chars That Are Allowed In Text Controls.
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.
HK_Date GetDate(int Select)
Returns The Selected Stored Date.
int GetValidID()
Returns A Valid ID For Adding Entries To The Database.
int GetCount()
Returns The Number Of Elements Stored.
string GetName(int Select)
Returns The Selected Stored Name.
int GetID(int Select)
Returns The Selected Stored ID.
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
void RemoveAllAttr()
Clear Dates From Calendar And Sets More.
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.
void OnClose(wxCommandEvent &)
Closes Dialog.
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.
wxStaticText * SchNameStat