区域裁切功能调整

This commit is contained in:
luoliangyi 2022-05-06 18:14:14 +08:00
parent ff106104a6
commit ec76884594
2 changed files with 22 additions and 18 deletions

View File

@ -599,26 +599,26 @@ void hg_settingdialog::createUI()
if (0 == strcmp(opt->name, "tl-x"))
{
m_cutLeftId = i + 1;
m_cutLeftValue = m_list_defaultOptions.at(i).second.toInt();
m_cutLeftValue = SANE_UNFIX(m_list_defaultOptions.at(i).second.toInt());
if (opt->constraint_type == SANE_CONSTRAINT_RANGE)
m_cutWidth = opt->constraint.range->max;
m_cutWidth = SANE_UNFIX(opt->constraint.range->max);
}
else if (0 == strcmp(opt->name, "tl-y"))
{
m_cutTopId = i + 1;
m_cutTopValue = m_list_defaultOptions.at(i).second.toInt();
m_cutTopValue = SANE_UNFIX(m_list_defaultOptions.at(i).second.toInt());
if (opt->constraint_type == SANE_CONSTRAINT_RANGE)
m_cutHeight = opt->constraint.range->max;
m_cutHeight = SANE_UNFIX(opt->constraint.range->max);
}
else if (0 == strcmp(opt->name, "br-x"))
{
m_cutRightId = i + 1;
m_cutRightValue = m_list_defaultOptions.at(i).second.toInt();
m_cutRightValue = SANE_UNFIX(m_list_defaultOptions.at(i).second.toInt());
}
else if (0 == strcmp(opt->name, "br-y"))
{
m_cutBottomId = i + 1;
m_cutBottomValue = m_list_defaultOptions.at(i).second.toInt();
m_cutBottomValue = SANE_UNFIX(m_list_defaultOptions.at(i).second.toInt());
}
if (Utf8ToStdString(opt->title) == "分辨率")
@ -637,13 +637,13 @@ void hg_settingdialog::createUI()
m_colorModeValue = m_list_defaultOptions.at(i).second.toString();
}
if (Utf8ToStdString(opt->title) == "伽玛")
if (Utf8ToStdString(opt->title) == "伽玛" || Utf8ToStdString(opt->title) == "伽玛值")
{
unsigned int len = sizeof(SANE_Gamma);
sane_io_control(m_handle, IO_CTRL_CODE_GET_CUSTOM_GAMMA, &m_gammaData, &len);
QPushButton* pushButton = new QPushButton(this);
pushButton->setText(StdStringToUtf8("伽马设置").c_str());
pushButton->setText(StdStringToUtf8("自定义色调曲线").c_str());
pushButton->setFixedWidth(120);
widget->layout()->addWidget(pushButton);
@ -967,10 +967,14 @@ void hg_settingdialog::slot_cutButtonClicked()
m_cutBottomValue = rcRet.bottom() / (0.03937 * m_dpiValue);
SANE_Int info;
sane_control_option(m_handle, m_cutLeftId, SANE_ACTION_SET_VALUE, &m_cutLeftValue, &info);
sane_control_option(m_handle, m_cutTopId, SANE_ACTION_SET_VALUE, &m_cutTopValue, &info);
sane_control_option(m_handle, m_cutRightId, SANE_ACTION_SET_VALUE, &m_cutRightValue, &info);
sane_control_option(m_handle, m_cutBottomId, SANE_ACTION_SET_VALUE, &m_cutBottomValue, &info);
SANE_Word value = SANE_FIX(m_cutLeftValue);
sane_control_option(m_handle, m_cutLeftId, SANE_ACTION_SET_VALUE, &value, &info);
value = SANE_FIX(m_cutTopValue);
sane_control_option(m_handle, m_cutTopId, SANE_ACTION_SET_VALUE, &value, &info);
value = SANE_FIX(m_cutRightValue);
sane_control_option(m_handle, m_cutRightId, SANE_ACTION_SET_VALUE, &value, &info);
value = SANE_FIX(m_cutBottomValue);
sane_control_option(m_handle, m_cutBottomId, SANE_ACTION_SET_VALUE, &value, &info);
}
}

View File

@ -117,12 +117,12 @@ private:
int m_cutTopId;
int m_cutRightId;
int m_cutBottomId;
int m_cutWidth; // 单位是毫米
int m_cutHeight; // 单位是毫米
int m_cutLeftValue; // 单位是毫米
int m_cutTopValue; // 单位是毫米
int m_cutRightValue; // 单位是毫米
int m_cutBottomValue; // 单位是毫米
double m_cutWidth; // 单位是毫米
double m_cutHeight; // 单位是毫米
double m_cutLeftValue; // 单位是毫米
double m_cutTopValue; // 单位是毫米
double m_cutRightValue; // 单位是毫米
double m_cutBottomValue; // 单位是毫米
int m_colorModeId;
QString m_colorModeValue;