Skip to content

Commit

Permalink
Fixed patch description display on boot
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-calautti committed Jan 3, 2024
1 parent 3dfa5e7 commit 5714251
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
6 changes: 5 additions & 1 deletion app/include/gui/DeltaPatcherMainDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -52,6 +54,8 @@ class DeltaPatcherMainDialog : public MainDialog, public Logger
DeltaPatcherEncodePanel* encodePanel;

bool decodeMode;

wxString pendingPatchPath;
};

#endif // __DeltaPatcherMainDialog__
4 changes: 2 additions & 2 deletions app/include/gui/dpgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:

Expand Down
18 changes: 14 additions & 4 deletions app/src/gui/DeltaPatcherMainDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#include <wx/stdpaths.h>
#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);
Expand Down Expand Up @@ -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);
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions app/src/gui/dpgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down

0 comments on commit 5714251

Please sign in to comment.