From d2df66b41ada2b84302552cdb40d730bed2cc9df Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Wed, 17 May 2023 10:36:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=A6=E7=95=8C=E9=9D=A2=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E6=97=B6=EF=BC=8C=E9=9C=80=E8=A6=81=E9=80=9A?= =?UTF-8?q?=E7=9F=A5notifyApp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- twain/twain/huagaods.cpp | 8 +++++++- twain/twain/huagaods.hpp | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/twain/twain/huagaods.cpp b/twain/twain/huagaods.cpp index 791e2ef..084a24f 100644 --- a/twain/twain/huagaods.cpp +++ b/twain/twain/huagaods.cpp @@ -776,7 +776,7 @@ static const SCANNERID scanner_guid = MAKE_SCANNER_ID(PRODUCT_PID, PRODUCT_VID); static std::once_flag oc; huagao_ds::huagao_ds() : cur_head_(NULL), dpi_(200), xfer_ready_failed_(false), log_all_triple_(false), scanner_status_(SCANNER_STATUS_NOT_INIT) - ,count_(-1), bUiOnly_(false), is_getting_count_(false) + ,count_(-1), bUiOnly_(false), is_getting_count_(false), show_setting_(false) { //std::call_once(oc, [&]() { log4cplus::Initializer(); }); } @@ -1101,6 +1101,7 @@ Result huagao_ds::userInterfaceDisable(const Identity&, UserInterface& ui) Result huagao_ds::userInterfaceEnable(const Identity&, UserInterface& ui) { bUiOnly_ = false; + show_setting_ = false; if (!ui.showUi()) { scanner_->ui_show_progress((HWND)ui.parent().raw(), m_bIndicator); @@ -1683,6 +1684,7 @@ Result huagao_ds::capCommon(const Identity&, Msg msg, Capability& data) { } Twpp::Result huagao_ds::showTwainUI(Twpp::UserInterface& data, bool bUiOnly) { + show_setting_ = true; bUiOnly_ = bUiOnly; // display user UI ... (setting UI, can we show my own main window here ?) return scanner_->ui_show_setting((HWND)data.parent().raw(), !bUiOnly, m_bIndicator) ? success() : seqError(); @@ -3583,6 +3585,7 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc) } rc = notifyCloseCancel(); } + show_setting_ = false; break; case SANE_EVENT_UI_CLOSE_CANCEL: scanner_->stop(); @@ -3590,7 +3593,10 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc) //break; case SANE_EVENT_UI_CLOSE_NORMAL: case SANE_EVENT_SCAN_FINISHED: + scanner_->ui_hide(); scanner_status_ = SCANNER_STATUS_STOPPED; // notifyCloseCancel is not need, because it done in EndXfer + if(show_setting_) + notifyCloseCancel(); //notifyCloseOk(); //break; break; diff --git a/twain/twain/huagaods.hpp b/twain/twain/huagaods.hpp index 66a4167..97363f7 100644 --- a/twain/twain/huagaods.hpp +++ b/twain/twain/huagaods.hpp @@ -55,6 +55,7 @@ class huagao_ds : public Twpp::SourceFromThis { bool log_all_triple_; bool app_trigger_event_; bool bUiOnly_; + bool show_setting_; int count_; volatile bool is_getting_count_; static std::string get_hidedlg_path(void);