From 927726889a5178b1e2c1c743fbaf1192e2cd3597 Mon Sep 17 00:00:00 2001 From: lltcggie Date: Wed, 16 Dec 2015 23:31:47 +0900 Subject: [PATCH] =?UTF-8?q?GUI=E3=81=A7=E8=B5=B7=E5=8B=95=E6=99=82?= =?UTF-8?q?=E3=81=ABcrop=5Fsize=5Flist.txt=E3=81=8B=E3=82=89=E8=AA=AD?= =?UTF-8?q?=E3=81=BF=E3=81=A0=E3=81=97=E3=81=9F=E5=88=86=E5=89=B2=E3=82=B5?= =?UTF-8?q?=E3=82=A4=E3=82=BA=E3=82=92=E3=83=AA=E3=82=B9=E3=83=88=E3=81=AB?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- waifu2x-caffe-gui/Source.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/waifu2x-caffe-gui/Source.cpp b/waifu2x-caffe-gui/Source.cpp index 5a0771a..1148b7d 100644 --- a/waifu2x-caffe-gui/Source.cpp +++ b/waifu2x-caffe-gui/Source.cpp @@ -909,6 +909,31 @@ public: } } + { + HWND hcrop = GetDlgItem(dh, IDC_COMBO_CROP_SIZE); + + SendMessage(hcrop, CB_ADDSTRING, 0, (LPARAM)TEXT("-----------------------")); + + // CropSizeListの値を追加していく + int mindiff = INT_MAX; + int defaultListIndex = -1; + for (const auto n : CropSizeList) + { + tstring str(to_tstring(n)); + const int index = SendMessage(hcrop, CB_ADDSTRING, 0, (LPARAM)str.c_str()); + + const int diff = abs(DefaultCommonDivisor - n); + if (DefaultCommonDivisorRange.first <= n && n <= DefaultCommonDivisorRange.second && diff < mindiff) + { + mindiff = diff; + defaultListIndex = index; + } + } + + if (GetWindowTextLength(hcrop) == 0) + SendMessage(hcrop, CB_SETCURSEL, defaultListIndex, 0); + } + const boost::filesystem::path SettingFilePath(exeDir / SettingFileName); tstring tScale;