updated on Wed Jan 18 08:00:29 UTC 2012
[aur-mirror.git] / madedit / madedit-add-file-changed-event.patch
blobbafa97993f19c2390d578c53ece2ee24bc6a01cc
1 --- src/MadEditFrame.h.orig 2010-01-22 17:44:25.882267610 -0430
2 +++ src/MadEditFrame.h 2010-01-22 18:02:14.144664728 -0430
3 @@ -288,6 +288,8 @@
4 //void OnChar(wxKeyEvent& evt);
5 void OnActivate(wxActivateEvent &evt);
7 + void OnFileChanged(wxEvent &evt);
9 bool QueryCloseFile(int idx);
10 bool QueryCloseAllFiles();
12 --- src/MadEditFrame.cpp.orig 2010-01-22 17:41:26.481409287 -0430
13 +++ src/MadEditFrame.cpp 2010-01-22 18:35:11.374420287 -0430
14 @@ -960,6 +960,12 @@
18 +BEGIN_DECLARE_EVENT_TYPES()
19 + DECLARE_LOCAL_EVENT_TYPE( myEVT_FILE_CHANGED, wxNewEventType() )
20 +END_DECLARE_EVENT_TYPES()
22 +DEFINE_LOCAL_EVENT_TYPE( myEVT_FILE_CHANGED )
24 //----------------------------------------------------------------------------
25 // MadEditFrame
26 //----------------------------------------------------------------------------
27 @@ -976,6 +982,7 @@
28 //EVT_CHAR(MadEditFrame::OnChar)
29 // file
30 EVT_ACTIVATE(MadEditFrame::OnActivate)
31 + EVT_CUSTOM( myEVT_FILE_CHANGED, wxID_ANY, MadEditFrame::OnFileChanged)
32 EVT_UPDATE_UI(menuSave, MadEditFrame::OnUpdateUI_MenuFile_CheckCount)
33 EVT_UPDATE_UI(menuSaveAs, MadEditFrame::OnUpdateUI_MenuFile_CheckCount)
34 EVT_UPDATE_UI(menuSaveAll, MadEditFrame::OnUpdateUI_MenuFile_CheckCount)
35 @@ -2378,7 +2385,9 @@
37 if(g_CheckModTimeForReload)
39 - g_ActiveMadEdit->ReloadByModificationTime();
40 + wxCommandEvent event(myEVT_FILE_CHANGED, m_Notebook->GetId());
41 + event.SetEventObject(this);
42 + AddPendingEvent(event);
45 else
46 @@ -2387,6 +2396,14 @@
50 +void MadEditFrame::OnFileChanged(wxEvent& evt) {
51 + if(g_ActiveMadEdit) {
52 + wxMilliSleep(100);
53 + g_ActiveMadEdit->SetFocus();
54 + g_ActiveMadEdit->ReloadByModificationTime();
55 + }
58 void MadEditFrame::OnNotebookPageClosing(wxAuiNotebookEvent& event)
60 if(m_PageClosing)