mirror of
https://github.com/lltcggie/waifu2x-caffe.git
synced 2025-06-26 13:42:48 +00:00
出力パスを設定するボタンを消した
(設定ダイアログ内で出力名を変更できない制限をどうにかするのがめんどくさかったから)
This commit is contained in:
parent
7f84627e04
commit
1ff18fce1d
Binary file not shown.
@ -785,68 +785,6 @@ private:
|
|||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 出力フォルダを選択する
|
|
||||||
static UINT_PTR CALLBACK OFNHookProcOut(
|
|
||||||
_In_ HWND hdlg,
|
|
||||||
_In_ UINT uiMsg,
|
|
||||||
_In_ WPARAM wParam,
|
|
||||||
_In_ LPARAM lParam
|
|
||||||
)
|
|
||||||
{
|
|
||||||
switch (uiMsg)
|
|
||||||
{
|
|
||||||
case WM_INITDIALOG:
|
|
||||||
{
|
|
||||||
// ダイアログを中央に表示
|
|
||||||
|
|
||||||
HWND hParent = GetParent(hdlg);
|
|
||||||
|
|
||||||
HWND hwndScreen;
|
|
||||||
RECT rectScreen;
|
|
||||||
hwndScreen = GetDesktopWindow();
|
|
||||||
GetWindowRect(hwndScreen, &rectScreen);
|
|
||||||
|
|
||||||
RECT rDialog;
|
|
||||||
GetWindowRect(hParent, &rDialog);
|
|
||||||
const int Width = rDialog.left = rDialog.right;
|
|
||||||
const int Height = rDialog.bottom - rDialog.top;
|
|
||||||
|
|
||||||
int DialogPosX;
|
|
||||||
int DialogPosY;
|
|
||||||
DialogPosX = ((rectScreen.right - rectScreen.left) / 2 - Width / 2);
|
|
||||||
DialogPosY = ((rectScreen.bottom - rectScreen.top) / 2 - Height / 2);
|
|
||||||
SetWindowPos(hParent, NULL, DialogPosX, DialogPosY, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_NOTIFY:
|
|
||||||
{
|
|
||||||
// 常に出力ファイル名を固定する
|
|
||||||
|
|
||||||
NMHDR *pnmh;
|
|
||||||
OFNOTIFY *pnot;
|
|
||||||
|
|
||||||
pnot = (OFNOTIFY *)lParam;
|
|
||||||
pnmh = &pnot->hdr;
|
|
||||||
|
|
||||||
tstring &nowName = *(tstring *)pnot->lpOFN->lCustData;
|
|
||||||
|
|
||||||
switch (pnmh->code)
|
|
||||||
{
|
|
||||||
case CDN_SELCHANGE:
|
|
||||||
{
|
|
||||||
HWND hParent = GetParent(hdlg);
|
|
||||||
CommDlg_OpenSave_SetControlText(hParent, edt1, nowName.c_str());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0L;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogEvent() : dh(nullptr), mode("noise_scale"), noise_level(1), scale_ratio(2.0), model_dir(TEXT("models/anime_style_art_rgb")),
|
DialogEvent() : dh(nullptr), mode("noise_scale"), noise_level(1), scale_ratio(2.0), model_dir(TEXT("models/anime_style_art_rgb")),
|
||||||
process("gpu"), outputExt(TEXT("png")), inputFileExt(TEXT("png:jpg:jpeg:tif:tiff:bmp:tga")),
|
process("gpu"), outputExt(TEXT("png")), inputFileExt(TEXT("png:jpg:jpeg:tif:tiff:bmp:tga")),
|
||||||
@ -1371,68 +1309,6 @@ public:
|
|||||||
OnSetInputFilePath(szFile);
|
OnSetInputFilePath(szFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputRef(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData)
|
|
||||||
{
|
|
||||||
OPENFILENAME ofn;
|
|
||||||
TCHAR szPath[AR_PATH_MAX] = TEXT("");
|
|
||||||
TCHAR szFile[AR_PATH_MAX] = TEXT("");
|
|
||||||
|
|
||||||
tstring nowName;
|
|
||||||
bool isDir = false;
|
|
||||||
|
|
||||||
GetWindowText(GetDlgItem(dh, IDC_EDIT_INPUT), szFile, _countof(szFile));
|
|
||||||
szFile[_countof(szPath) - 1] = TEXT('\0');
|
|
||||||
if (*szFile != TEXT('\0'))
|
|
||||||
{
|
|
||||||
boost::filesystem::path p(szFile);
|
|
||||||
isDir = boost::filesystem::is_directory(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
GetWindowText(GetDlgItem(dh, IDC_EDIT_OUTPUT), szFile, _countof(szFile));
|
|
||||||
szFile[_countof(szPath) - 1] = TEXT('\0');
|
|
||||||
if (*szFile == TEXT('\0'))
|
|
||||||
{
|
|
||||||
nowName = TEXT("");
|
|
||||||
GetCurrentDirectory(_countof(szPath), szPath);
|
|
||||||
szPath[_countof(szPath) - 1] = TEXT('\0');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boost::filesystem::path p(szFile);
|
|
||||||
const auto filename = getTString(p.filename());
|
|
||||||
const auto dir = getTString(p.branch_path());
|
|
||||||
|
|
||||||
nowName = filename;
|
|
||||||
_tcscpy(szFile, filename.c_str());
|
|
||||||
_tcscpy(szPath, dir.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
ofn.lStructSize = sizeof(ofn);
|
|
||||||
ofn.hwndOwner = NULL;
|
|
||||||
ofn.lpstrFile = szFile;
|
|
||||||
ofn.nMaxFile = _countof(szFile);
|
|
||||||
ofn.lpstrFilter = TEXT("すべてのフォルダ\0*.folder\0");
|
|
||||||
ofn.nFilterIndex = 1;
|
|
||||||
ofn.lpstrTitle = TEXT("出力するフォルダを選択してください");
|
|
||||||
ofn.lpstrInitialDir = szPath;
|
|
||||||
ofn.lpstrCustomFilter = NULL;
|
|
||||||
ofn.nMaxCustFilter = 0;
|
|
||||||
ofn.lpstrFileTitle = NULL;
|
|
||||||
ofn.nMaxFileTitle = 0;
|
|
||||||
ofn.nFileOffset = 0;
|
|
||||||
ofn.nFileExtension = 0;
|
|
||||||
ofn.lpstrDefExt = NULL;
|
|
||||||
ofn.lCustData = (LPARAM)&nowName;
|
|
||||||
ofn.lpfnHook = OFNHookProcOut;
|
|
||||||
ofn.lpTemplateName = 0;
|
|
||||||
ofn.Flags = OFN_HIDEREADONLY | OFN_NOVALIDATE | OFN_PATHMUSTEXIST | OFN_READONLY | OFN_EXPLORER | OFN_ENABLEHOOK | OFN_OVERWRITEPROMPT;
|
|
||||||
if (GetSaveFileName(&ofn))
|
|
||||||
{
|
|
||||||
szFile[_countof(szFile) - 1] = TEXT('\0');
|
|
||||||
SetWindowText(GetDlgItem(dh, IDC_EDIT_OUTPUT), szFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1482,7 +1358,6 @@ int WINAPI WinMain(HINSTANCE hInstance,
|
|||||||
cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::Exec, &cDialogEvent), NULL, IDC_BUTTON_EXEC);
|
cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::Exec, &cDialogEvent), NULL, IDC_BUTTON_EXEC);
|
||||||
cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::Cancel, &cDialogEvent), NULL, IDC_BUTTON_CANCEL);
|
cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::Cancel, &cDialogEvent), NULL, IDC_BUTTON_CANCEL);
|
||||||
cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::InputRef, &cDialogEvent), NULL, IDC_BUTTON_INPUT_REF);
|
cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::InputRef, &cDialogEvent), NULL, IDC_BUTTON_INPUT_REF);
|
||||||
cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::OutputRef, &cDialogEvent), NULL, IDC_BUTTON_OUTPUT_REF);
|
|
||||||
|
|
||||||
cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::RadioButtom, &cDialogEvent), NULL, IDC_RADIO_MODE_NOISE);
|
cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::RadioButtom, &cDialogEvent), NULL, IDC_RADIO_MODE_NOISE);
|
||||||
cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::RadioButtom, &cDialogEvent), NULL, IDC_RADIO_MODE_SCALE);
|
cDialog.SetCommandCallBack(SetClassFunc(DialogEvent::RadioButtom, &cDialogEvent), NULL, IDC_RADIO_MODE_SCALE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user