縦横幅同時指定のコマンドラインオプション指定方法変更

This commit is contained in:
lltcggie 2017-03-20 22:20:31 +09:00
parent da3d7e785a
commit 86e5156a9d
2 changed files with 21 additions and 23 deletions

View File

@ -2129,9 +2129,6 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData)
TCLAP::ValueArg<int> cmdScaleHeight(L"h", L"scale_height", TCLAP::ValueArg<int> cmdScaleHeight(L"h", L"scale_height",
L"custom scale height", false, 0, L"double", cmd); L"custom scale height", false, 0, L"double", cmd);
TCLAP::ValueArg<int> cmdScaleWidthHeight(L"", L"scale_width_height",
L"custom scale width and height", false, 0, L"double", cmd);
std::vector<std::wstring> cmdProcessConstraintV; std::vector<std::wstring> cmdProcessConstraintV;
cmdProcessConstraintV.push_back(L"cpu"); cmdProcessConstraintV.push_back(L"cpu");
cmdProcessConstraintV.push_back(L"gpu"); cmdProcessConstraintV.push_back(L"gpu");
@ -2298,7 +2295,27 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData)
isSetParam = true; isSetParam = true;
} }
if (cmdScaleWidth.isSet()) if (cmdScaleWidth.isSet() && cmdScaleHeight.isSet())
{
SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_RATIO), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_WIDTH), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_HEIGHT), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_WIDTH_HEIGHT), BM_SETCHECK, BST_CHECKED, 0);
EnableWindow(GetDlgItem(dh, IDC_EDIT_SCALE_RATIO), FALSE);
EnableWindow(GetDlgItem(dh, IDC_EDIT_SCALE_WIDTH), FALSE);
EnableWindow(GetDlgItem(dh, IDC_EDIT_SCALE_HEIGHT), FALSE);
EnableWindow(GetDlgItem(dh, IDC_EDIT_SCALE_WIDTH_HEIGHT), TRUE);
auto str = to_tstring(cmdScaleWidth.getValue());
str += TEXT("x");
str += to_tstring(cmdScaleHeight.getValue());
SetWindowText(GetDlgItem(dh, IDC_EDIT_SCALE_WIDTH_HEIGHT), str.c_str());
isSetParam = true;
}
else if (cmdScaleWidth.isSet())
{ {
SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_RATIO), BM_SETCHECK, BST_UNCHECKED, 0); SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_RATIO), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_WIDTH), BM_SETCHECK, BST_CHECKED, 0); SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_WIDTH), BM_SETCHECK, BST_CHECKED, 0);
@ -2346,22 +2363,6 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData)
isSetParam = true; isSetParam = true;
} }
else if (cmdScaleWidthHeight.isSet())
{
SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_RATIO), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_WIDTH), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_HEIGHT), BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCALE_WIDTH_HEIGHT), BM_SETCHECK, BST_CHECKED, 0);
EnableWindow(GetDlgItem(dh, IDC_EDIT_SCALE_RATIO), FALSE);
EnableWindow(GetDlgItem(dh, IDC_EDIT_SCALE_WIDTH), FALSE);
EnableWindow(GetDlgItem(dh, IDC_EDIT_SCALE_HEIGHT), FALSE);
EnableWindow(GetDlgItem(dh, IDC_EDIT_SCALE_WIDTH_HEIGHT), TRUE);
SetWindowText(GetDlgItem(dh, IDC_EDIT_SCALE_WIDTH_HEIGHT), to_tstring(cmdScaleWidthHeight.getValue()).c_str());
isSetParam = true;
}
if (cmdProcess.isSet()) if (cmdProcess.isSet())
{ {

View File

@ -108,9 +108,6 @@ int main(int argc, char** argv)
TCLAP::ValueArg<double> cmdScaleHeight("h", "scale_height", TCLAP::ValueArg<double> cmdScaleHeight("h", "scale_height",
"custom scale height", false, 0, "double", cmd); "custom scale height", false, 0, "double", cmd);
TCLAP::ValueArg<int> cmdScaleWidthHeight("", "scale_width_height",
"custom scale width and height", false, 0, "double", cmd);
TCLAP::ValueArg<std::string> cmdModelPath("", "model_dir", TCLAP::ValueArg<std::string> cmdModelPath("", "model_dir",
"path to custom model directory (don't append last / )", false, "path to custom model directory (don't append last / )", false,
"models/upconv_7_anime_style_art_rgb", "string", cmd); "models/upconv_7_anime_style_art_rgb", "string", cmd);