diff options
Diffstat (limited to 'support/dktools/Dk4WxProgressDialog.cpp')
-rw-r--r-- | support/dktools/Dk4WxProgressDialog.cpp | 431 |
1 files changed, 0 insertions, 431 deletions
diff --git a/support/dktools/Dk4WxProgressDialog.cpp b/support/dktools/Dk4WxProgressDialog.cpp deleted file mode 100644 index 3a2546c262..0000000000 --- a/support/dktools/Dk4WxProgressDialog.cpp +++ /dev/null @@ -1,431 +0,0 @@ -/* -Copyright (C) 2017-2020, Dirk Krause -SPDX-License-Identifier: BSD-3-Clause -*/ - -/* - WARNING: This file was generated by the dkct program (see - http://dktools.sourceforge.net/ for details). - Changes you make here will be lost if dkct is run again! - You should modify the original source and run dkct on it. - Original source: Dk4WxProgressDialog.wxc -*/ - -/** @file Dk4WxProgressDialog.cpp The Dk4WxProgressDialog module. -*/ - - -#line 271 "Dk4WxProgressDialog.wxc" - -#include "dk4conf.h" -#include "Dk4WxProgressDialog.h" - - - - - -#line 278 "Dk4WxProgressDialog.wxc" - - - -#if wxCHECK_VERSION(3,0,0) -wxBEGIN_EVENT_TABLE(Dk4WxProgressDialog,wxDialog) -#else -BEGIN_EVENT_TABLE(Dk4WxProgressDialog,wxDialog) -#endif - EVT_IDLE( Dk4WxProgressDialog::OnIdle) - EVT_BUTTON(wxID_CANCEL, Dk4WxProgressDialog::OnCancel) -#if wxCHECK_VERSION(3,0,0) -wxEND_EVENT_TABLE() -#else -END_EVENT_TABLE() -#endif - - -static const wxChar * dk4wx_progress_kw_wx[] = { -/* 0 */ -wxT("Operation in progress"), - -/* 1 */ -wxT("Cancel"), - -/* 2 */ -wxT("Abort operation"), - -/* 3 */ -wxT("Abortion scheduled, please wait."), - -NULL - - -#line 305 "Dk4WxProgressDialog.wxc" -}; - - - -/** Integer preference names. -*/ -static const wxChar * const names[] = { -/* 0 */ -wxT("progress.min-width"), - -NULL - - -#line 315 "Dk4WxProgressDialog.wxc" -}; - - - -#line 319 "Dk4WxProgressDialog.wxc" -Dk4WxProgressDialog::Dk4WxProgressDialog( - wxFrame *parent, - Dk4WxApplicationHelper *pAppHelp -) -: wxDialog( - parent, wxID_ANY, - ( - (NULL != pAppHelp) - ? (pAppHelp->GetBasicString(2)) - : (dk4wx_progress_kw_wx[0]) - ), - wxDefaultPosition, - wxDefaultSize, - wxDEFAULT_DIALOG_STYLE -) -{ - const wxChar *labelText = NULL; - int minWidth = 300; - - labelText = dk4wx_progress_kw_wx[0]; - if (NULL != pAppHelp) { - labelText = pAppHelp->GetBasicString(2); - pAppHelp->GetMultiple(names, &minWidth, 1); - if (0 > minWidth) { minWidth = 300; } - } - - iOld = 0; - iNew = 0; - bActive = true; - bAborted = false; - bFinished = false; - bSuccess = false; - bHaveDialog = false; - sDialogTitle = wxEmptyString; - sDialogText = wxEmptyString; - iDialogStyle = wxID_OK; - if (NULL != pAppHelp) { - sText[0] = pAppHelp->GetBasicString(3); // Button label - sText[1] = pAppHelp->GetBasicString(4); // Button tooltip - sText[2] = pAppHelp->GetBasicString(5); // Text hint - } else { - sText[0] = dk4wx_progress_kw_wx[1]; - sText[1] = dk4wx_progress_kw_wx[2]; - sText[2] = dk4wx_progress_kw_wx[3]; - } - dkctGUILayoutOK = false; - sDialog = NULL; - verticalSizer = NULL; - sttInProgress = NULL; - gaugeProgress = NULL; - sttWait = NULL; - bCancel = NULL; - sDialog = new wxBoxSizer( - wxHORIZONTAL - ); - if(!(sDialog)) { - goto dkctGUILayoutFinished; - } - sDialog->Add(10, 10, 0); - verticalSizer = new wxBoxSizer( - wxVERTICAL - ); - if(!(verticalSizer)) { - goto dkctGUILayoutFinished; - } - verticalSizer->Add(10, 10, 0); - sttInProgress = new wxStaticText( - this, - wxID_ANY, - labelText, - wxDefaultPosition, - wxDefaultSize, - wxALIGN_CENTRE - ); - if(!(sttInProgress)) { - goto dkctGUILayoutFinished; - } - verticalSizer->Add( - sttInProgress - ); - verticalSizer->Add(10, 10, 0); - gaugeProgress = new wxGauge( - this, - wxID_ANY, - 1000 - ); - if(!(gaugeProgress)) { - goto dkctGUILayoutFinished; - } - verticalSizer->Add( - gaugeProgress, - 1, - wxALIGN_CENTER_HORIZONTAL|wxGROW - ); - verticalSizer->Add(10, 10, 0); - sttWait = new wxStaticText( - this, - wxID_ANY, - wxT(""), - wxDefaultPosition, - wxDefaultSize, - wxALIGN_CENTRE - ); - if(!(sttWait)) { - goto dkctGUILayoutFinished; - } - verticalSizer->Add( - sttWait, - 1, - wxALIGN_CENTER_HORIZONTAL|wxGROW - ); - verticalSizer->Add(10, 10, 0); - bCancel = new wxButton( - this, - wxID_CANCEL, - sText[0] - ); - if(!(bCancel)) { - goto dkctGUILayoutFinished; - } - bCancel->SetToolTip(sText[1]); - verticalSizer->Add( - bCancel, - 0, - wxALIGN_CENTER_HORIZONTAL - ); - verticalSizer->Add(10, 10, 0); - sDialog->Add( - verticalSizer, - 1, - wxGROW - ); - sDialog->Add(10, 10, 0); - SetSizer(sDialog); - dkctGUILayoutOK = true; - dkctGUILayoutFinished: - if(dkctGUILayoutOK) { - sDialog->Fit(this); - sDialog->SetSizeHints(this); - } - -#line 365 "Dk4WxProgressDialog.wxc" - if (dkctGUILayoutOK) { - wxSize gaugeSize = gaugeProgress->GetMinSize(); - if (300 > gaugeSize.GetWidth()) { - gaugeSize.SetWidth(300); - gaugeProgress->SetMinSize(gaugeSize); - } - sDialog->Fit(this); - sDialog->SetSizeHints(this); - } -} - - -#line 377 "Dk4WxProgressDialog.wxc" - - - -void -Dk4WxProgressDialog::OnIdle(wxIdleEvent & event) -{ - int result; - { - wxCriticalSectionLocker lock(csProtect); - if (bActive) { - if (bFinished) { - bActive = false; - result = wxID_OK; - if ((bAborted) || (!(bSuccess))) { result = wxID_CANCEL; } - if (IsModal()) { - EndModal(result); - } else { - SetReturnCode((bSuccess) && (!(bAborted))); - Show(false); - } - } else { - if (iNew != iOld) { - iOld = iNew; - gaugeProgress->SetValue(iNew); - Refresh(); - Update(); - } - event.RequestMore(); - } - } - } - event.Skip(); -} - - - -void -Dk4WxProgressDialog::OnCancel(wxCommandEvent & WXUNUSED(event)) -{ - bCancel->Enable(false); - bCancel->SetToolTip(sText[2]); - Refresh(); - Update(); - { - wxCriticalSectionLocker lock(csProtect); - if (!(bFinished)) { - bAborted = true; - } - } -} - - - -void -Dk4WxProgressDialog::SetGauge(int value) -{ - wxCriticalSectionLocker lock(csProtect); - iNew = value; -} - - - -void -Dk4WxProgressDialog::SetDialogData( - const wxString & title, - const wxString & msg, - int st -) -{ - wxCriticalSectionLocker lock(csProtect); - bHaveDialog = true; - sDialogTitle = title; - sDialogText = msg; - iDialogStyle = st; -} - - - -void -Dk4WxProgressDialog::StartProcessing(void) -{ - wxCriticalSectionLocker lock(csProtect); - bActive = true; - sDialogTitle = wxEmptyString; - sDialogText = wxEmptyString; - iOld = 0; - iNew = 0; - bAborted = false; - bFinished = false; - bSuccess = true; - bActive = true; - bHaveDialog = false; -} - - - -void -Dk4WxProgressDialog::EndProcessing(bool success) -{ - wxCriticalSectionLocker lock(csProtect); - bFinished = true; - if (!(bAborted)) { - bSuccess = success; - } -} - - - -bool -Dk4WxProgressDialog::CanContinue(void) -{ - bool back = true; - { - wxCriticalSectionLocker lock(csProtect); - if ((bAborted) || (bFinished)) { - back = false; - } - } - return back; -} - - - -bool -Dk4WxProgressDialog::IsFinished(void) -{ - bool back = false; - { - wxCriticalSectionLocker lock(csProtect); - back = bFinished; - } - return back; -} - - - -int -Dk4WxProgressDialog::GetGauge(void) -{ - int back = 0; - { - wxCriticalSectionLocker lock(csProtect); - back = iNew; - } - return back; -} - - - -void -Dk4WxProgressDialog::AbortProcessing(void) -{ - wxCriticalSectionLocker lock(csProtect); - if (!(bFinished)) { - bAborted = true; - } -} - - - -bool -Dk4WxProgressDialog::GetSuccess(void) -{ - bool back = false; - { - wxCriticalSectionLocker lock(csProtect); - if (bFinished) { - back = true; - if ((bAborted) || (!(bSuccess))) { back = false; } - } - } - return back; -} - - - -bool -Dk4WxProgressDialog::GetDialogData( - wxString & title, - wxString & msg, - int & style -) -{ - bool back = false; - { - wxCriticalSectionLocker lock(csProtect); - if (bHaveDialog) { - title = sDialogTitle; - msg = sDialogText; - style = iDialogStyle; - back = true; - } - } - return back; -} - |