OSDN Git Service

[sfviewer] Make sfviewer dialog resizable
authorStarg <starg@users.osdn.me>
Mon, 18 Jun 2018 07:10:12 +0000 (16:10 +0900)
committerStarg <starg@users.osdn.me>
Mon, 18 Jun 2018 10:39:27 +0000 (19:39 +0900)
sf_view_gui/resource.h
sf_view_gui/sfview_dlg.rc
sf_view_gui/sfview_main.cpp

index cd973e2..3af9776 100644 (file)
@@ -8,8 +8,8 @@
 #define IDB_BITMAP1                     104
 #define IDB_TREEICON                    104
 #define IDC_TREE1                       1001
-#define IDC_EDIT1                       1002
 #define IDC_EDSFNAME                    1002
+#define IDC_EDSFLABEL                   1003
 #define ID_FILE_OPENSOUNDFONT           40001
 #define ID_FILE_QUIT                    40002
 #define ID_FILE_SAVETIMIDITYCONFIGFILE  40003
@@ -29,7 +29,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        105
 #define _APS_NEXT_COMMAND_VALUE         40013
-#define _APS_NEXT_CONTROL_VALUE         1003
+#define _APS_NEXT_CONTROL_VALUE         1004
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
index 8e7f62b..14d0ac3 100644 (file)
@@ -27,7 +27,7 @@ BEGIN
 END
 
 101 DIALOGEX 0, 0, 255, 195
-STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU
+STYLE WS_OVERLAPPEDWINDOW
 EXSTYLE WS_EX_ACCEPTFILES
 CAPTION "Soundfont Viewer 1.01"
 MENU IDR_MENU1
@@ -35,7 +35,7 @@ LANGUAGE LANG_JAPANESE, 0x1
 FONT 9, "MS UI Gothic", FW_NORMAL, 0, 128
 BEGIN
        CONTROL         "", IDC_TREE1, WC_TREEVIEW, WS_TABSTOP | WS_HSCROLL | WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT, 0, 0, 255, 182
-       LTEXT           "Soundfont Path", -1, 0, 183, 56, 12, SS_LEFT
+       LTEXT           "Soundfont Path", IDC_EDSFLABEL, 0, 183, 56, 12, SS_LEFT
        EDITTEXT        IDC_EDSFNAME, 57, 183, 198, 12, NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY
 END
 
index 8b107ab..e95fd31 100644 (file)
@@ -2,6 +2,7 @@
 #define _CRT_SECURE_NO_WARNINGS
 #pragma warning(disable:4530) // \83A\83\93\83\8f\83C\83\93\83\83Z\83}\83\93\83e\83B\83N\83X\82ª\96³\8cø
 #include <windows.h>
+#include <windowsx.h>
 #include <commctrl.h>
 #include "resource.h"
 #pragma comment(lib, "shlwapi.lib")
@@ -296,6 +297,43 @@ LRESULT DlgMainProc_CLOSE(HWND hDlg, WPARAM wParam, LPARAM lParam)
        return TRUE;
 }
 
+LRESULT DlgMainProc_SIZE(HWND hDlg, WPARAM wParam, LPARAM lParam)
+{
+    if (wParam != SC_MINIMIZE) {
+        SetWindowPos(
+            GetDlgItem(hDlg, IDC_TREE1),
+            NULL,
+            0,
+            0,
+            GET_X_LPARAM(lParam),
+            GET_Y_LPARAM(lParam) - 17,
+            SWP_NOACTIVATE | SWP_NOZORDER
+        );
+
+        SetWindowPos(
+            GetDlgItem(hDlg, IDC_EDSFLABEL),
+            NULL,
+            0,
+            GET_Y_LPARAM(lParam) - 16,
+            99,
+            16,
+            SWP_NOACTIVATE | SWP_NOZORDER
+        );
+
+        SetWindowPos(
+            GetDlgItem(hDlg, IDC_EDSFNAME),
+            NULL,
+            100,
+            GET_Y_LPARAM(lParam) - 16,
+            GET_X_LPARAM(lParam) - 100,
+            16,
+            SWP_NOACTIVATE | SWP_NOZORDER
+        );
+    }
+
+    return TRUE;
+}
+
 LRESULT CALLBACK DlgMainProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
 #define SET_MYWINMSG(VN) case WM_ ## VN: return DlgMainProc_## VN(hDlg, wParam, lParam);
@@ -304,6 +342,7 @@ LRESULT CALLBACK DlgMainProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
                SET_MYWINMSG(DROPFILES);
                SET_MYWINMSG(COMMAND);
                SET_MYWINMSG(CLOSE);
+               SET_MYWINMSG(SIZE);
        }
 #undef  SET_MYWINMSG
        return FALSE;