Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
0.03 release
[xestiacalendar/.git] / source / forms / main / frmMain.cpp
index e1f2bd9..8d6a4f8 100644 (file)
@@ -1,3 +1,21 @@
+// frmMain.h - frmMain form functions
+//
+// (c) 2016-2017 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Calendar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
+
 #include "frmMain.h"
 
 frmMain::frmMain( wxWindow* parent )
@@ -67,6 +85,10 @@ frmMainADT( parent )
        Connect(ID_UPDATEENTRY, XCMAIN_UPDATEEVENT, wxCommandEventHandler(frmMain::UpdateEvent));
        Connect(ID_EDITEVENT, XCMAIN_EDITEVENT, wxCommandEventHandler(frmMain::EditEvent));
        
+       Connect(ID_ADDWINDOW, XCMAIN_ADDWINDOWINFO, wxCommandEventHandler(frmMain::WindowAdd));
+       Connect(ID_UPDATEWINDOW, XCMAIN_UPDATEWINDOWINFO, wxCommandEventHandler(frmMain::WindowUpdate));
+       Connect(ID_DELETEWINDOW, XCMAIN_DELETEWINDOWINFO, wxCommandEventHandler(frmMain::WindowDelete));
+       
 }
 
 void frmMain::QuitApp( wxCloseEvent& event )
@@ -236,6 +258,13 @@ void frmMain::LoadAccountData(){
 void frmMain::ShowPreferencesWindow( wxCommandEvent& event )
 {
 
+       // Close all windows first.
+       
+       if (CloseAllWindows() == false)
+       {
+               return;
+       }
+       
        // Open the preferences window.
     
        reloadAccounts = FALSE;
@@ -356,6 +385,13 @@ void frmMain::CreateNewCalendar( wxCommandEvent& event )
 void frmMain::EditCalendar( wxCommandEvent& event )
 {
        
+       // Close all windows first.
+       
+       if (CloseAllWindows() == false)
+       {
+               return;
+       }
+       
        // Get the calendar data.
        
        CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(event.GetInt());
@@ -373,6 +409,13 @@ void frmMain::EditCalendar( wxCommandEvent& event )
 void frmMain::DeleteCalendar( wxCommandEvent& event )
 {
 
+       // Close all windows first.
+       
+       if (CloseAllWindows() == false)
+       {
+               return;
+       }
+       
        CalendarProperties *calendarEventInfo = (CalendarProperties*)event.GetClientData();
        
        // Get the calendar data.
@@ -451,6 +494,21 @@ void frmMain::CreateNewEvent( wxCommandEvent& event ){
        
        frmEventEditor *frameNewEvent = new frmEventEditor ( this );
        frameNewEvent->SetupForm(&calendarData, preferences);
+       frameNewEvent->SetWindowMenuItemID(++WindowMenuItemID);
+       
+       // Add the window to the window list.
+       
+       WindowData *newWindowData = new WindowData;
+    
+       newWindowData->DataType = 1;
+       newWindowData->WindowPointer = (void*)frameNewEvent;
+       newWindowData->WindowID = WindowMenuItemID;
+       
+       wxCommandEvent addevent(XCMAIN_ADDWINDOWINFO);
+       addevent.SetId(ID_ADDWINDOW);
+       addevent.SetClientData(newWindowData);
+       wxPostEvent(this, addevent);
+       
        frameNewEvent->Show();
        
 }
@@ -460,7 +518,24 @@ void frmMain::EditEvent( wxCommandEvent& event ){
        frmEventEditor *frameEditEvent = new frmEventEditor ( this );
        frameEditEvent->SetEventID(event.GetInt());
        frameEditEvent->SetEditMode(true);
+       frameEditEvent->SetWindowMenuItemID(++WindowMenuItemID);
        frameEditEvent->SetupForm(&calendarData, preferences);
+       
+       // Add the window to the window list.
+       
+       WindowData *newWindowData = new WindowData;
+    
+       newWindowData->DataType = 1;
+       newWindowData->WindowPointer = (void*)frameEditEvent;
+       newWindowData->WindowID = WindowMenuItemID;
+       
+       wxCommandEvent addevent(XCMAIN_ADDWINDOWINFO);
+       addevent.SetId(ID_ADDWINDOW);
+       addevent.SetClientData(newWindowData);
+       wxPostEvent(this, addevent);
+
+       // Setup the form and display it.
+       
        frameEditEvent->Show();
        
 }
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy