修复配置方案变更存储BUG

This commit is contained in:
gb 2023-03-03 15:02:25 +08:00
parent 2595588750
commit 46e96bd6e4
4 changed files with 23 additions and 3 deletions

View File

@ -9,7 +9,7 @@
// CDlgIndicator 对话框
dlg_cfg_mgr::dlg_cfg_mgr(gb::scanner_cfg* cfg, HWND parent) : cfg_(cfg), dlg_base(parent, IDD_CFG_MGR)
dlg_cfg_mgr::dlg_cfg_mgr(gb::scanner_cfg* cfg, HWND parent) : cfg_(cfg), dlg_base(parent, IDD_CFG_MGR), schm_changed_(false)
{
create();
@ -199,10 +199,17 @@ void dlg_cfg_mgr::on_del_selected(void)
{
changed = true;
ListView_DeleteItem(lwnd, sels[i]);
schm_changed_ = true;
}
}
}
void dlg_cfg_mgr::on_del_all(void)
{
cfg_->remove_all_schemes();
ListView_DeleteAllItems(get_item(IDC_LIST1));
schm_changed_ = true;
}
bool dlg_cfg_mgr::is_scheme_changed(void)
{
return schm_changed_;
}

View File

@ -15,6 +15,7 @@ class dlg_cfg_mgr: public dlg_base
{
gb::scanner_cfg* cfg_;
std::wstring label_;
bool schm_changed_;
BOOL handle_message(UINT msg, WPARAM wp, LPARAM lp) override;
void handle_command(WORD code, WORD id, HANDLE ctrl);
@ -32,4 +33,5 @@ public:
~dlg_cfg_mgr();
public:
bool is_scheme_changed(void);
};

View File

@ -130,6 +130,7 @@ void dlg_setting::handle_command(WORD code, WORD id, HANDLE ctrl)
}
n->release();
}
s->end_setting(true);
s->release();
}
}
@ -143,7 +144,7 @@ void dlg_setting::handle_command(WORD code, WORD id, HANDLE ctrl)
gb::sane_config_schm* s = cfg_->get_scheme();
if (s)
{
s->end_setting(true);
s->end_setting(false);
s->release();
}
@ -180,7 +181,7 @@ void dlg_setting::handle_command(WORD code, WORD id, HANDLE ctrl)
gb::sane_config_schm* schm = cfg_->get_scheme();
if (schm)
{
schm->end_setting(true);
schm->end_setting(false);
schm->release();
}
cfg_->select_scheme(nullptr);
@ -195,6 +196,14 @@ void dlg_setting::handle_command(WORD code, WORD id, HANDLE ctrl)
{
dlg_cfg_mgr dlg(cfg_, hwnd());
dlg.do_modal(hwnd());
if (dlg.is_scheme_changed())
{
gb::sane_config_schm* schm = cfg_->get_scheme();
apply_scheme_(schm, apply_param_);
if (schm)
schm->release();
refresh_controls(-1);
}
}
else if (id == IDC_BUTTON_CONFIG_MENU)
{

View File

@ -28,6 +28,8 @@ using namespace std::placeholders;
extern HMODULE me_;
// WIA COM: IStiUSD & IWiaMiniDrv
//custom define caps enum
enum CapTypeEx : unsigned short {
CAP_TYPE_EX_FILL_BLACK_BKG = 0x8004,