From 1428d36cee0ce1cbd170b7d259d4d53376dbaa04 Mon Sep 17 00:00:00 2001 From: lltcggie Date: Thu, 25 Oct 2018 04:35:59 +0900 Subject: [PATCH] =?UTF-8?q?GUI=E3=81=A7=E3=83=90=E3=83=83=E3=83=81?= =?UTF-8?q?=E3=82=B5=E3=82=A4=E3=82=BA=E3=82=92=E8=A8=AD=E5=AE=9A=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= =?UTF-8?q?=20CropSize=E3=81=A7=E5=87=BA=E5=8A=9B=E3=81=8C=E5=A4=89?= =?UTF-8?q?=E3=82=8F=E3=82=8B=E3=83=A2=E3=83=87=E3=83=AB=E3=81=A7CropSize?= =?UTF-8?q?=E3=82=92=E5=A4=89=E3=81=88=E3=81=9A=E3=81=AB=E9=AB=98=E9=80=9F?= =?UTF-8?q?=E5=8C=96=E3=81=99=E3=82=8B=E3=81=9F=E3=82=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/lang/english.json | 4 ++- bin/lang/japanese.json | 4 ++- waifu2x-caffe-gui/MainDialog.cpp | 47 ++++++++++++++++++++++++++++++- waifu2x-caffe-gui/Resource.rc | Bin 18374 -> 18696 bytes waifu2x-caffe-gui/resource.h | Bin 8348 -> 8624 bytes 5 files changed, 52 insertions(+), 3 deletions(-) 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 4f1d7f02edcfe8c50871de1c7607a42ae9b69519..01e0a49160bff0af82a2f12c5e63e035437fce40 100644 GIT binary patch delta 220 zcmX@s&)6}EaYL0Pr#XWGgARi^gZbozJo=M2NqR7wGFVLBDCa)eMM{O)1SlS_pg7r1 z(P8r$sVmHa77S)U<%SF<3`SsWMnI*(f|d-%U{O;rZOUK?(=>SWoH{KMKlk Yj^n++HCaH24@FXOk}%6=K8ZdK0JIVo0ssI2 delta 25 hcmdnsJjZcE0`KGtd>oq<_>OT+o+qiaIYrWk0|0^;2?ziH