Skip to content

Commit 8932625

Browse files
committed
Minor UI polish: grouped export and import functions into submenus, alt-key shortcut fixes that may still be bugged, but appear to work on physical SH3 targets
1 parent 533e3a6 commit 8932625

1 file changed

Lines changed: 25 additions & 19 deletions

File tree

src/sqlite-ce-edit/main.c

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ static LRESULT CALLBACK LineNumProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
332332

333333
/* Subclass proc for query edit - catches Ctrl+Enter */
334334
static LRESULT CALLBACK QueryEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
335-
/* Alt+X - Exit */
336-
if (msg == WM_SYSKEYDOWN && wParam == 'X') {
335+
/* Alt+X - Exit (must handle here when edit has focus) */
336+
if (msg == WM_SYSKEYDOWN && (wParam == 'X' || wParam == 'x')) {
337337
DestroyWindow(g_hwndMain);
338338
return 0;
339339
}
@@ -466,9 +466,6 @@ static LRESULT CALLBACK QueryEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
466466
return 0;
467467
g_searchMode = 0; /* Any typing exits search mode */
468468
}
469-
/* Suppress beep for Alt+X (handled by accelerator) */
470-
if (msg == WM_SYSCHAR && (wParam == 'x' || wParam == 'X'))
471-
return 0;
472469
return CallWindowProc(g_pfnQueryProc, hwnd, msg, wParam, lParam);
473470
}
474471

@@ -2378,19 +2375,26 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
23782375

23792376
hMenu = CreateMenu();
23802377
hFile = CreatePopupMenu();
2381-
AppendMenuW(hFile, MF_STRING, IDM_NEW, L"&New Database...");
2382-
AppendMenuW(hFile, MF_STRING, IDM_OPEN, L"&Open Database...");
2383-
AppendMenuW(hFile, MF_STRING, IDM_CLOSE, L"&Close Database");
2384-
AppendMenuW(hFile, MF_SEPARATOR, 0, NULL);
2385-
AppendMenuW(hFile, MF_STRING, IDM_OPENQUERY, L"Open &Query...\tCtrl+O");
2386-
AppendMenuW(hFile, MF_STRING, IDM_SAVEQUERY, L"&Save Query...\tCtrl+S");
2387-
AppendMenuW(hFile, MF_SEPARATOR, 0, NULL);
2388-
AppendMenuW(hFile, MF_STRING, IDM_EXPORTCSV, L"&Export Results...");
2389-
AppendMenuW(hFile, MF_STRING, IDM_EXPORTDB, L"Export &Database...");
2390-
AppendMenuW(hFile, MF_STRING, IDM_IMPORTCSV, L"&Import CSV...");
2391-
AppendMenuW(hFile, MF_STRING, IDM_IMPORTCEDB, L"Import CE &Database...");
2392-
AppendMenuW(hFile, MF_SEPARATOR, 0, NULL);
2393-
AppendMenuW(hFile, MF_STRING, IDM_EXIT, L"E&xit\tAlt+X");
2378+
{
2379+
HMENU hExport, hImport;
2380+
AppendMenuW(hFile, MF_STRING, IDM_NEW, L"&New Database...");
2381+
AppendMenuW(hFile, MF_STRING, IDM_OPEN, L"&Open Database...");
2382+
AppendMenuW(hFile, MF_STRING, IDM_CLOSE, L"&Close Database");
2383+
AppendMenuW(hFile, MF_SEPARATOR, 0, NULL);
2384+
AppendMenuW(hFile, MF_STRING, IDM_OPENQUERY, L"Open &Query...\tCtrl+O");
2385+
AppendMenuW(hFile, MF_STRING, IDM_SAVEQUERY, L"&Save Query...\tCtrl+S");
2386+
AppendMenuW(hFile, MF_SEPARATOR, 0, NULL);
2387+
hExport = CreatePopupMenu();
2388+
AppendMenuW(hExport, MF_STRING, IDM_EXPORTCSV, L"&Results...");
2389+
AppendMenuW(hExport, MF_STRING, IDM_EXPORTDB, L"&Database...");
2390+
AppendMenuW(hFile, MF_POPUP, (UINT)hExport, L"&Export");
2391+
hImport = CreatePopupMenu();
2392+
AppendMenuW(hImport, MF_STRING, IDM_IMPORTCSV, L"&CSV...");
2393+
AppendMenuW(hImport, MF_STRING, IDM_IMPORTCEDB, L"CE &Database...");
2394+
AppendMenuW(hFile, MF_POPUP, (UINT)hImport, L"&Import");
2395+
AppendMenuW(hFile, MF_SEPARATOR, 0, NULL);
2396+
AppendMenuW(hFile, MF_STRING, IDM_EXIT, L"E&xit\tAlt+X");
2397+
}
23942398
AppendMenuW(hMenu, MF_POPUP, (UINT)hFile, L"&File");
23952399

23962400
hView = CreatePopupMenu();
@@ -2624,13 +2628,15 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
26242628
}
26252629
break;
26262630

2627-
case WM_KEYDOWN:
26282631
case WM_SYSKEYDOWN:
26292632
/* Alt+X - Exit */
26302633
if (wParam == 'X' && GetKeyState(VK_MENU) < 0) {
26312634
DestroyWindow(hwnd);
26322635
return 0;
26332636
}
2637+
break;
2638+
2639+
case WM_KEYDOWN:
26342640
/* Global shortcuts (when command bar has focus) */
26352641
if (GetKeyState(VK_CONTROL) < 0) {
26362642
if (wParam == 'O') { DoOpenQuery(); return 0; }

0 commit comments

Comments
 (0)