diff --git a/pgadmin/ctl/ctlProgressStatusBar.cpp b/pgadmin/ctl/ctlProgressStatusBar.cpp index 1981229..418fb73 100644 --- a/pgadmin/ctl/ctlProgressStatusBar.cpp +++ b/pgadmin/ctl/ctlProgressStatusBar.cpp @@ -33,7 +33,7 @@ ctlProgressStatusBar::ctlProgressStatusBar(wxWindow *parent, bool showProgressIn m_autoProgressive(autoProgressive), m_autoValIncrementing(true), m_hr(0), m_min(0), m_sec(0), m_mil(0), m_val(0) { - static int widths[] = {ms_progressbar_width, -1, ms_progressstatus_width}; + static int widths[] = {-1, ms_progressbar_width, ms_progressstatus_width}; int fields = 0; if (max <= 0) @@ -67,6 +67,9 @@ ctlProgressStatusBar::ctlProgressStatusBar(wxWindow *parent, bool showProgressIn m_mil = 0; } } + // Dummy event to place the progressbar at right place + wxSizeEvent ev; + this->OnSize(ev); } ctlProgressStatusBar::~ctlProgressStatusBar() @@ -80,6 +83,10 @@ ctlProgressStatusBar::~ctlProgressStatusBar() void ctlProgressStatusBar::OnSize(wxSizeEvent &ev) { + // We should have hide the progress bar + if (GetFieldsCount() <= ProgressBar_field) + return; + wxRect r; GetFieldRect(ProgressBar_field, r); @@ -174,4 +181,21 @@ void ctlProgressStatusBar::StopProgress() m_progressStopped = true; } +void ctlProgressStatusBar::SetFieldsCount(int number, const int *widths) +{ + m_progress->Show(number > ProgressBar_field); + wxStatusBar::SetFieldsCount( number, widths); + + // Dummy Size event (to reposition the progress bar) + wxSizeEvent ev; + this->OnSize(ev); +} + +void ctlProgressStatusBar::SetStatusWidths(int n, const int widths_field[]) +{ + wxStatusBar::SetStatusWidths( n, widths_field); + // Dummy Size event (to reposition the progress bar) + wxSizeEvent ev; + this->OnSize(ev); +} \ No newline at end of file diff --git a/pgadmin/debugger/frmDebugger.cpp b/pgadmin/debugger/frmDebugger.cpp index faba15f..3f2f72b 100644 --- a/pgadmin/debugger/frmDebugger.cpp +++ b/pgadmin/debugger/frmDebugger.cpp @@ -695,7 +695,7 @@ ctlMenuToolbar *frmDebugger::SetupToolBar(void) ctlProgressStatusBar *frmDebugger::SetupStatusBar(void) { ctlProgressStatusBar *bar = new ctlProgressStatusBar(this, false); - int widths[] = { ctlProgressStatusBar::ms_progressbar_width, -1, ctlProgressStatusBar::ms_progressstatus_width, 190}; + int widths[] = { -1, ctlProgressStatusBar::ms_progressbar_width, ctlProgressStatusBar::ms_progressstatus_width, 190}; bar->SetFieldsCount(4); bar->SetStatusWidths(4, widths); @@ -970,7 +970,7 @@ void frmDebugger::DisplaySource(dbgCachedStack &_cached) void frmDebugger::SetStatusText(const wxString &_status) { - m_statusBar->SetStatusText(_status, 1); + m_statusBar->SetStatusText(_status, 0); } @@ -1003,7 +1003,7 @@ void frmDebugger::LaunchWaitingDialog(const wxString &msg) } m_statusTxt = strStatus; - m_statusBar->SetStatusText(strStatus, 1); + SetStatusText(strStatus); m_statusBar->ShowProgress(); } @@ -1012,7 +1012,7 @@ void frmDebugger::CloseProgressBar() { if (!m_statusTxt.IsEmpty()) { - m_statusBar->SetStatusText(m_statusTxt + wxT(" Done"), 1); + SetStatusText(m_statusTxt + wxT(" Done")); m_statusTxt = wxT(""); } m_statusBar->StopProgress(); diff --git a/pgadmin/include/ctl/ctlProgressStatusBar.h b/pgadmin/include/ctl/ctlProgressStatusBar.h index add2497..ed24818 100644 --- a/pgadmin/include/ctl/ctlProgressStatusBar.h +++ b/pgadmin/include/ctl/ctlProgressStatusBar.h @@ -26,6 +26,8 @@ public: void ShowProgress(bool restart = true); void StopProgress(); void SetProgress(int val); + virtual void SetFieldsCount(int number = 1, const int *widths = NULL); + virtual void SetStatusWidths(int n, const int widths_field[]); static const unsigned short ms_increment, ms_progressbar_width, @@ -47,8 +49,8 @@ protected: enum { - ProgressBar_field, Status_field, + ProgressBar_field, ProgressStatus_field, Max_Field };