@@ -89,10 +89,16 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
8989 /* Create all three context menus upfront */
9090 g_hQueryCtx = CreatePopupMenu ();
9191 AppendMenuW (g_hQueryCtx , MF_STRING , IDM_EXECUTE , L"&Execute\tCtrl+Enter" );
92+ AppendMenuW (g_hQueryCtx , MF_STRING , IDM_EXECATCURSOR , L"Execute at &Cursor" );
93+ AppendMenuW (g_hQueryCtx , MF_SEPARATOR , 0 , NULL );
94+ AppendMenuW (g_hQueryCtx , MF_STRING , IDM_CLEAR , L"C&lear Editor" );
9295
9396 g_hResultCtx = CreatePopupMenu ();
9497 AppendMenuW (g_hResultCtx , MF_STRING , IDM_VIEWGRID , L"&Grid View\tCtrl+G" );
9598 AppendMenuW (g_hResultCtx , MF_SEPARATOR , 0 , NULL );
99+ AppendMenuW (g_hResultCtx , MF_STRING , IDM_COPYALL , L"&Copy All" );
100+ AppendMenuW (g_hResultCtx , MF_STRING , IDM_CLEARRESULTS , L"C&lear Results" );
101+ AppendMenuW (g_hResultCtx , MF_SEPARATOR , 0 , NULL );
96102 AppendMenuW (g_hResultCtx , MF_STRING , IDM_EXPORTRESULTS , L"&Export Results..." );
97103 AppendMenuW (g_hResultCtx , MF_STRING , IDM_EXPORTHTMLRES , L"Export &HTML..." );
98104
@@ -106,6 +112,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
106112 AppendMenuW (g_hSchemaCtx , MF_POPUP , (UINT )hSelObj , L"Selected &Object" );
107113 AppendMenuW (g_hSchemaCtx , MF_SEPARATOR , 0 , NULL );
108114 AppendMenuW (g_hSchemaCtx , MF_STRING , IDM_REFRESH , L"&Refresh" );
115+ AppendMenuW (g_hSchemaCtx , MF_STRING , IDM_COLLAPSEALL , L"&Collapse All" );
109116 AppendMenuW (g_hSchemaCtx , MF_STRING , IDM_EXPORTALLDDL , L"Export &All DDL..." );
110117 AppendMenuW (g_hSchemaCtx , MF_SEPARATOR , 0 , NULL );
111118 AppendMenuW (g_hSchemaCtx , MF_STRING , IDM_SHOWSIZES , L"Show &Details" );
@@ -341,6 +348,27 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
341348 case IDM_FIND : DoFind (); break ;
342349 case IDM_FINDNEXT : DoFindNext (); break ;
343350 case IDM_REPLACE : DoReplace (); break ;
351+ case IDM_CLEAR :
352+ if (g_viewMode == VIEW_QUERY ) {
353+ SetWindowTextW (g_hwndQuery , L"" );
354+ g_queryDirty = 0 ;
355+ UpdateLineNumbers ();
356+ }
357+ break ;
358+ case IDM_COPYALL :
359+ if (g_viewMode == VIEW_RESULT && !g_gridView ) {
360+ SendMessage (g_hwndResult , EM_SETSEL , 0 , -1 );
361+ SendMessage (g_hwndResult , WM_COPY , 0 , 0 );
362+ SendMessage (g_hwndResult , EM_SETSEL , 0 , 0 );
363+ }
364+ break ;
365+ case IDM_CLEARRESULTS :
366+ if (g_viewMode == VIEW_RESULT ) {
367+ SetWindowTextW (g_hwndResult , L"" );
368+ FreeLastResults ();
369+ if (g_gridView ) PopulateGrid ();
370+ }
371+ break ;
344372 case IDM_ABOUT :
345373 DoAbout ();
346374 break ;
@@ -372,6 +400,19 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
372400 case IDM_REFRESH :
373401 if (g_viewMode == 2 ) RefreshSchema ();
374402 break ;
403+ case IDM_COLLAPSEALL :
404+ if (g_viewMode == 2 && g_hwndSchema ) {
405+ /* Collapse category nodes (Tables/Views/Triggers) but keep db root expanded */
406+ HTREEITEM hRoot = TreeView_GetRoot (g_hwndSchema );
407+ if (hRoot ) {
408+ HTREEITEM hChild = TreeView_GetChild (g_hwndSchema , hRoot );
409+ while (hChild ) {
410+ TreeView_Expand (g_hwndSchema , hChild , TVE_COLLAPSE );
411+ hChild = TreeView_GetNextSibling (g_hwndSchema , hChild );
412+ }
413+ }
414+ }
415+ break ;
375416 case IDM_SHOWSIZES :
376417 g_showSizes = !g_showSizes ;
377418 ForceMenuRebuild ();
0 commit comments