diff --git a/app/include/gui/DeltaPatcherMainDialog.h b/app/include/gui/DeltaPatcherMainDialog.h index 40823f9..d4ee538 100644 --- a/app/include/gui/DeltaPatcherMainDialog.h +++ b/app/include/gui/DeltaPatcherMainDialog.h @@ -39,11 +39,13 @@ class DeltaPatcherMainDialog : public MainDialog, public Logger void OnMainDialogClose( wxCloseEvent& event ); void OnClickAbout( wxCommandEvent& event ); void OnOperationSelected( wxCommandEvent& event ); + void OnMainDialogShow( wxShowEvent& event ); + //Workaround for stupid sizing bug in wxGTK void OnActivate( wxActivateEvent& event ) { static bool first=true; if(first){Update(); Fit(); first=false;} event.Skip(); } public: /** Constructor */ - DeltaPatcherMainDialog( wxWindow* parent, const wxChar* patchName=wxEmptyString); + DeltaPatcherMainDialog( wxWindow* parent, const wxString& patchName=wxEmptyString); virtual void Log(int type,const wxChar* msg); void ShowHideLog(); @@ -52,6 +54,8 @@ class DeltaPatcherMainDialog : public MainDialog, public Logger DeltaPatcherEncodePanel* encodePanel; bool decodeMode; + + wxString pendingPatchPath; }; #endif // __DeltaPatcherMainDialog__ diff --git a/app/include/gui/dpgui.h b/app/include/gui/dpgui.h index f9195a2..f94bce4 100644 --- a/app/include/gui/dpgui.h +++ b/app/include/gui/dpgui.h @@ -48,7 +48,7 @@ class MainDialog : public wxDialog void _wxFB_OnClickAbout( wxCommandEvent& event ){ OnClickAbout( event ); } void _wxFB_OnOperationSelected( wxCommandEvent& event ){ OnOperationSelected( event ); } void _wxFB_OnShowHideLog( wxCommandEvent& event ){ OnShowHideLog( event ); } - + void _wxFB_OnMainDialogShow( wxShowEvent& event ){ OnMainDialogShow( event ); } protected: enum @@ -73,7 +73,7 @@ class MainDialog : public wxDialog virtual void OnClickAbout( wxCommandEvent& event ) { event.Skip(); } virtual void OnOperationSelected( wxCommandEvent& event ) { event.Skip(); } virtual void OnShowHideLog( wxCommandEvent& event ) { event.Skip(); } - + virtual void OnMainDialogShow( wxShowEvent& event ) { event.Skip(); } public: diff --git a/app/src/gui/DeltaPatcherMainDialog.cpp b/app/src/gui/DeltaPatcherMainDialog.cpp index 4a1e9cd..9b9d170 100644 --- a/app/src/gui/DeltaPatcherMainDialog.cpp +++ b/app/src/gui/DeltaPatcherMainDialog.cpp @@ -15,9 +15,9 @@ #include #endif -DeltaPatcherMainDialog::DeltaPatcherMainDialog( wxWindow* parent, const wxChar* patchName ) +DeltaPatcherMainDialog::DeltaPatcherMainDialog( wxWindow* parent, const wxString& patchName ) : -MainDialog( parent ), decodeMode(true) +MainDialog( parent ), decodeMode(true), pendingPatchPath(patchName) { wxIcon icon(icon_xpm); SetIcon(icon); @@ -45,8 +45,6 @@ MainDialog( parent ), decodeMode(true) //preparing default panel decodePanel=new DeltaPatcherDecodePanel(this,this); - if(!wxIsEmpty(patchName)) - decodePanel->SetPatchFile(patchName); panelSizer->Add( decodePanel, 1, wxEXPAND | wxALL, 5 ); decodePanel->GetSizer()->Fit(decodePanel); @@ -71,6 +69,18 @@ MainDialog( parent ), decodeMode(true) } +void DeltaPatcherMainDialog::OnMainDialogShow( wxShowEvent& event ) +{ + if(event.IsShown()) + { + if(!wxIsEmpty(pendingPatchPath)) + { + decodePanel->SetPatchFile(pendingPatchPath); + pendingPatchPath.Clear(); + } + } +} + void DeltaPatcherMainDialog::OnShowHideLog( wxCommandEvent& event ) { ShowHideLog(); diff --git a/app/src/gui/dpgui.cpp b/app/src/gui/dpgui.cpp index b7c0a0a..262c349 100644 --- a/app/src/gui/dpgui.cpp +++ b/app/src/gui/dpgui.cpp @@ -12,6 +12,7 @@ BEGIN_EVENT_TABLE( MainDialog, wxDialog ) EVT_ACTIVATE( MainDialog::_wxFB_OnActivate ) EVT_CLOSE( MainDialog::_wxFB_OnMainDialogClose ) + EVT_SHOW( MainDialog::_wxFB_OnMainDialogShow ) EVT_BUTTON( wxID_ABOUT, MainDialog::_wxFB_OnClickAbout ) EVT_BUTTON( wxID_OPERATION_BUTTON, MainDialog::_wxFB_OnOperationSelected ) EVT_BUTTON( wxID_SHOW_IDE_LOG, MainDialog::_wxFB_OnShowHideLog )