diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index a927ab101..fa9f647a9 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -3673,7 +3673,7 @@ public: wxThread::ExitCode TIconizeTaskThread::Entry() { - Sleep(750); + Sleep(500); if (__bChildRunning) // Il programma e' ancora attivo { wxFrame* frame = (wxFrame*)_task_win; diff --git a/xvaga/xvtextra.cpp b/xvaga/xvtextra.cpp index f9278a0a6..eba377979 100755 --- a/xvaga/xvtextra.cpp +++ b/xvaga/xvtextra.cpp @@ -452,16 +452,55 @@ BOOLEAN xvt_print_open(void) return m_po == NULL; } +/////////////////////////////////////////////////////////// + +void CreateAbortWindow() +{ + wxFrame* parent = (wxFrame*)TASK_WIN; + wxPrintAbortDialog* win = new wxPrintAbortDialog(parent, "Stampa" , wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE); + + wxBoxSizer *button_sizer = new wxBoxSizer( wxVERTICAL ); + button_sizer->Add( new wxStaticText( win, -1, "Stampa in corso..."), 0, wxALL, 10 ); + button_sizer->Add( new wxButton( win, wxID_CANCEL, wxT("Annulla") ), 0, wxALL | wxALIGN_CENTER, 10 ); + + win->SetAutoLayout( TRUE ); + win->SetSizer( button_sizer ); + + button_sizer->Fit(win); + button_sizer->SetSizeHints (win) ; + + win->Show(); + win->Update(); + + wxPrinterBase::sm_abortWindow = win; +} + +void DestroyAbortWindow() +{ + if (wxPrinterBase::sm_abortWindow != NULL) + { + wxPrinterBase::sm_abortWindow->Hide(); + delete wxPrinterBase::sm_abortWindow; + wxPrinterBase::sm_abortWindow = NULL; + } +} + +/////////////////////////////////////////////////////////// + BOOLEAN xvt_print_start_thread(BOOLEAN(*print_fcn)(long), long data) { + wxBeginBusyCursor(); m_po = new TwxPrintOut; + wxEndBusyCursor(); + CreateAbortWindow(); print_fcn(data); + DestroyAbortWindow(); m_po->OnEndDocument(); m_po->OnEndPrinting(); - delete m_po; m_po = NULL; + return TRUE; } @@ -470,7 +509,10 @@ BOOLEAN xvt_print_open_page(PRINT_RCD* precp) BOOLEAN ok = m_po != NULL; if (ok) { - m_po->GetDC()->StartPage(); + if (wxPrinterBase::sm_abortIt) + ok = FALSE; + else + m_po->GetDC()->StartPage(); } return ok; }