Allow cancelling a scan session.

- perform scanning in a thread
 - change the label of the scan button
 - trigger cancel with the same button and with the ESC key
 - process all GUI updates in asynchronous mode.

Do not use a top window as parent of popups:
 - If a top window goes away in an application with multiple instances of
 XInsaneWidget, any call to a scanner widget leads to a crash.

Minor changes.
This commit is contained in:
Saleem Edah-Tally
2025-07-11 21:10:59 +02:00
parent 3350f86ddf
commit 4b23b1f3de
12 changed files with 206 additions and 215 deletions

View File

@@ -116,6 +116,15 @@ void MiscTools::MessageBox ( const wxString& msg, const bool notify )
}
}
void MiscTools::AsyncMessageBox(const wxString& msg, const bool notify)
{
wxTheApp->CallAfter([msg, notify] ()
{
MiscTools::MessageBox(msg, notify);
}
);
}
wxTextValidator* MiscTools::MakeFileNameValidator ( bool excludeSpace )
{
wxTextValidator * tval = new wxTextValidator ( wxFILTER_EXCLUDE_CHAR_LIST );

View File

@@ -45,6 +45,7 @@ public:
* Shows a message as a modal dialog or as a notification.
*/
static void MessageBox ( const wxString& msg, const bool notify = false );
static void AsyncMessageBox ( const wxString& msg, const bool notify = false );
/**
* Creates a validator excluding file name forbidden characters, path

View File

@@ -14,7 +14,7 @@ TimeredStatusBar::TimeredStatusBar ( wxWindow * parent)
{
m_numFields = 3;
/* We use default reasonable widths for CAPS and NUM. */
const int widths[3] = {-1, 70, 70};
const int widths[3] = {-1, 70, 90};
SetFieldsCount ( m_numFields, widths );
m_timer.Stop();
m_timer.SetOwner ( this );