diff --git a/bin/lang/english.json b/bin/lang/english.json index fdef4c4..d4603fa 100644 --- a/bin/lang/english.json +++ b/bin/lang/english.json @@ -97,5 +97,7 @@ "IDC_STATIC_USE_GPU_NO":"Use GPU No", "IDC_RADIO_MODEL_UPCONV_RGB":"2-D illust (UpRGB Model)", "IDC_RADIO_MODEL_UPCONV_PHOTO":"Photo (UpPhoto Model)", -"MessageLogFatalError":"A fatal error has occurred.\r\nThere is a possibility the split size is too large" +"MessageLogFatalError":"A fatal error has occurred.\r\nThere is a possibility the split size is too large", +"IDC_STATIC_BATCH_SIZE":"Batch size", +"MessageBatchSizeCheckError":"Batch size must be greater than 0", } diff --git a/bin/lang/japanese.json b/bin/lang/japanese.json index b165bb7..230c962 100644 --- a/bin/lang/japanese.json +++ b/bin/lang/japanese.json @@ -97,5 +97,7 @@ "IDC_STATIC_USE_GPU_NO":"使用GPU No", "IDC_RADIO_MODEL_UPCONV_RGB":"2次元イラスト (UpRGBモデル)", "IDC_RADIO_MODEL_UPCONV_PHOTO":"写真・アニメ (UpPhotoモデル)", -"MessageLogFatalError":"致命的なエラーが発生しました。\r\n分割サイズが大きすぎる可能性があります" +"MessageLogFatalError":"致命的なエラーが発生しました。\r\n分割サイズが大きすぎる可能性があります", +"IDC_STATIC_BATCH_SIZE":"バッチサイズ", +"MessageBatchSizeCheckError":"バッチサイズは0より大きい整数である必要があります" } diff --git a/waifu2x-caffe-gui/MainDialog.cpp b/waifu2x-caffe-gui/MainDialog.cpp index 60205a5..c730093 100644 --- a/waifu2x-caffe-gui/MainDialog.cpp +++ b/waifu2x-caffe-gui/MainDialog.cpp @@ -25,6 +25,8 @@ const size_t AR_PATH_MAX(1024); +const int MaxBatchSizeList = 20; + const int MinCommonDivisor = 50; const int DefaultCommonDivisor = 128; const std::pair DefaultCommonDivisorRange = {90, 140}; @@ -38,6 +40,7 @@ const TCHAR * const MultiFileStr = TEXT("(Multi File)"); const UINT_PTR nIDEventTimeLeft = 1000; + LangStringList DialogEvent::langStringList; HWND DialogEvent::dh; @@ -488,6 +491,22 @@ bool DialogEvent::SyncMember(const bool NotSyncCropSize, const bool silent) } } + { + TCHAR buf[AR_PATH_MAX] = TEXT(""); + GetWindowText(GetDlgItem(dh, IDC_COMBO_BATCH_SIZE), buf, _countof(buf)); + buf[_countof(buf) - 1] = TEXT('\0'); + + TCHAR *ptr = nullptr; + batch_size = _tcstol(buf, &ptr, 10); + if (!ptr || *ptr != '\0' || batch_size <= 0) + { + batch_size = 1; + ret = false; + + MessageBox(dh, langStringList.GetString(L"MessageBatchSizeCheckError").c_str(), langStringList.GetString(L"MessageTitleError").c_str(), MB_OK | MB_ICONERROR); + } + } + use_tta = SendMessage(GetDlgItem(dh, IDC_CHECK_TTA), BM_GETCHECK, 0, 0) == BST_CHECKED; return ret; @@ -1116,6 +1135,8 @@ void DialogEvent::SaveIni(const bool isSyncMember) WritePrivateProfileString(TEXT("Setting"), TEXT("LastInputDirFix"), tInputDirFix.c_str(), getTString(SettingFilePath).c_str()); WritePrivateProfileString(TEXT("Setting"), TEXT("LastOutputDirFix"), tOutputDirFix.c_str(), getTString(SettingFilePath).c_str()); + + WritePrivateProfileString(TEXT("Setting"), TEXT("LastBatchSize"), to_tstring(batch_size).c_str(), getTString(SettingFilePath).c_str()); } struct stFindParam @@ -1596,6 +1617,7 @@ void DialogEvent::SetWindowTextLang() SET_WINDOW_TEXT(IDC_BUTTON_OUTPUT_REF); SET_WINDOW_TEXT(IDC_BUTTON_APP_SETTING); SET_WINDOW_TEXT(IDC_BUTTON_CLEAR_OUTPUT_DIR); + SET_WINDOW_TEXT(IDC_STATIC_BATCH_SIZE); #undef SET_WINDOW_TEXT @@ -1794,6 +1816,21 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData) } } + { + HWND hbatch = GetDlgItem(dh, IDC_COMBO_BATCH_SIZE); + + // ob`TCYXgɐ˂ł + int mindiff = INT_MAX; + int defaultListIndex = -1; + for(int i = 1; i <= MaxBatchSizeList; i++) + { + tstring str(to_tstring(i)); + SendMessage(hbatch, CB_ADDSTRING, 0, (LPARAM)str.c_str()); + } + + SendMessage(hbatch, CB_SETCURSEL, 0, 0); + } + { HWND hcrop = GetDlgItem(dh, IDC_COMBO_CROP_SIZE); @@ -1896,6 +1933,8 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData) GetPrivateProfileString(TEXT("Setting"), TEXT("LastOutputDirFix"), TEXT(""), tmp, _countof(tmp), getTString(SettingFilePath).c_str()); tmp[_countof(tmp) - 1] = TEXT('\0'); tOutputDirFix = tmp; + + batch_size = GetPrivateProfileInt(TEXT("Setting"), TEXT("LastBatchSize"), 1, getTString(SettingFilePath).c_str()); } TCHAR *ptr = nullptr; @@ -2069,6 +2108,11 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData) else SendMessage(GetDlgItem(hWnd, IDC_CHECK_TTA), BM_SETCHECK, BST_UNCHECKED, 0); + if (1 <= batch_size && batch_size <= MaxBatchSizeList) + { + SendMessage(GetDlgItem(dh, IDC_COMBO_BATCH_SIZE), CB_SETCURSEL, batch_size - 1, 0); + } + SetWindowText(GetDlgItem(hWnd, IDC_EDIT_SCALE_RATIO), tScaleRatio.c_str()); SetWindowText(GetDlgItem(hWnd, IDC_EDIT_SCALE_WIDTH), tScaleWidth.c_str()); SetWindowText(GetDlgItem(hWnd, IDC_EDIT_SCALE_HEIGHT), tScaleHeight.c_str()); @@ -2440,7 +2484,8 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData) if (cmdBatchSizeFile.isSet()) { - batch_size = cmdBatchSizeFile.getValue(); + SetWindowText(GetDlgItem(dh, IDC_COMBO_CROP_SIZE), to_tstring(cmdCropSizeFile.getValue()).c_str()); + //batch_size = cmdBatchSizeFile.getValue(); isSetParam = true; } diff --git a/waifu2x-caffe-gui/Resource.rc b/waifu2x-caffe-gui/Resource.rc index 4f1d7f0..01e0a49 100644 Binary files a/waifu2x-caffe-gui/Resource.rc and b/waifu2x-caffe-gui/Resource.rc differ diff --git a/waifu2x-caffe-gui/resource.h b/waifu2x-caffe-gui/resource.h index 097195b..10d9d74 100644 Binary files a/waifu2x-caffe-gui/resource.h and b/waifu2x-caffe-gui/resource.h differ