X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=blobdiff_plain;f=source%2Fforms%2Feventeditor%2FfrmEventEditor.cpp;h=dda8dd17ac2d4d872181169a3fdaac0ddf9f37f6;hp=4c95dc30e282167d3b50108aeab3f910ae5527a6;hb=616ddd1b189837e5a7d1d6953534115be44f477b;hpb=a245ca84f8c7aacc34c966c4b8c6ca34a0fa0c1c diff --git a/source/forms/eventeditor/frmEventEditor.cpp b/source/forms/eventeditor/frmEventEditor.cpp index 4c95dc3..dda8dd1 100644 --- a/source/forms/eventeditor/frmEventEditor.cpp +++ b/source/forms/eventeditor/frmEventEditor.cpp @@ -70,8 +70,15 @@ void frmEventEditor::SetupForm(CalendarDataStorage *dataStorage, XCALPreferences calendarID = eventInfo.calendarID; + // Set the calendar combination box to the name. + + string combinedName = dataStorage->GetCalendar(calendarID).accountName; + combinedName += " : "; + combinedName += dataStorage->GetCalendar(eventInfo.calendarID).calendarName; + // Load the calendar info. + cmbCalendar->SetSelection(cmbCalendar->FindString(combinedName)); cmbCalendar->Show(false); lblCalendar->Show(false); @@ -122,14 +129,20 @@ void frmEventEditor::SetupForm(CalendarDataStorage *dataStorage, XCALPreferences eventData.LoadFile(eventFilePath); // TODO: Set the duration data. + + } else { + + // Setup the date and time with some default values (today's date and time). + + SetDefaultDateTime(); - return; } - - // Setup the date and time with some default values (today's date and time). - - SetDefaultDateTime(); + // Enable window updating and update window name. + + UpdateWindowName(); + enableUpdates = true; + } void frmEventEditor::SetEditMode(bool editMode){ @@ -165,8 +178,6 @@ void frmEventEditor::SaveNewContact(wxCommandEvent &event){ szrDetails->Layout(); szrList->Layout(); - - } void frmEventEditor::SaveContact(){ @@ -348,12 +359,33 @@ void frmEventEditor::SaveContact(){ } -void frmEventEditor::CloseWindow(wxCommandEvent &event){ +void frmEventEditor::CloseWindow(wxCommandEvent &event) +{ this->Close(); } +void frmEventEditor::CloseWindow(wxCloseEvent &event) +{ + + WindowData *deleteWindowData = new WindowData; + + deleteWindowData->DataType = 1; + deleteWindowData->WindowPointer = (void*)this; + deleteWindowData->WindowID = windowID; + + // Delete the window from the window list. + + wxCommandEvent deleteEvent(XCMAIN_DELETEWINDOWINFO); + deleteEvent.SetId(ID_DELETEWINDOW); + deleteEvent.SetClientData(deleteWindowData); + wxPostEvent(this->GetParent(), deleteEvent); + + this->Destroy(); + +} + bool frmEventEditor::ProcessEvent(wxEvent& event) { @@ -469,4 +501,77 @@ void frmEventEditor::SetDefaultDateTime(){ txtEndTime->SetValue((wxString)formattedTime); +} + +void frmEventEditor::SetWindowMenuItemID(int windowID) +{ + + this->windowID = windowID; + +} + +void frmEventEditor::ProcessCalendarControl(wxCommandEvent &event) +{ + + UpdateWindowName(); + +} + +void frmEventEditor::ProcessEventName(wxCommandEvent &event) +{ + + UpdateWindowName(); + +} + +void frmEventEditor::UpdateWindowName() +{ + + // Generate the window title. + + string windowTitle; + + if (cmbCalendar->GetSelection() == -1) + { + windowTitle += "(calendar not selected)"; + } + else + { + windowTitle += cmbCalendar->GetStringSelection().ToStdString(); + } + + if (txtEventName->IsEmpty()) + { + windowTitle += " - "; + windowTitle += "(unamed event)"; + } + else + { + windowTitle += " - "; + windowTitle += txtEventName->GetValue().ToStdString(); + } + + SetTitle(windowTitle); + + // Check if post window title updating is enabled before + // going any further. + + if (enableUpdates == false) + { + return; + } + + WindowData *updateWindowData = new WindowData; + + updateWindowData->DataType = 1; + updateWindowData->WindowPointer = (void*)this; + updateWindowData->WindowID = windowID; + + // Delete the window from the window list. + + wxCommandEvent updateEvent(XCMAIN_UPDATEWINDOWINFO); + updateEvent.SetId(ID_UPDATEWINDOW); + updateEvent.SetClientData(updateWindowData); + wxPostEvent(this->GetParent(), updateEvent); + } \ No newline at end of file