From 35abf9e371b1bdb6e3933480f8b84872829231bb Mon Sep 17 00:00:00 2001
From: guy <guy@c028cbd2-c16b-5b4b-a496-9718f37d4682>
Date: Tue, 28 Oct 2003 15:10:01 +0000
Subject: [PATCH] Patch level         : 2.0 626 Files correlati     : xvaga.dll
 Ricompilazione Demo : [ ] Commento            :

EP20141
far riapparire la finestra di elaborazione stampa in fase di creazione
della stampa (ora si vede una videata grigia)


git-svn-id: svn://10.65.10.50/trunk@11544 c028cbd2-c16b-5b4b-a496-9718f37d4682
---
 xvaga/xvaga.cpp    |  2 +-
 xvaga/xvtextra.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 3 deletions(-)

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;
 }