static gboolean plug_delete_event (GtkWidget *widget, GdkEvent *ev, XfceSettingsEditorBox *settings_editor) { save_window_size (widget, settings_editor); gtk_main_quit (); return TRUE; }
static void config_save (void) { if (ui_is_shown ()) save_window_size (); layout_save (); pw_col_save (); }
static void config_save (void) { if (gtk_window_is_active ((GtkWindow *) window)) save_window_size (); layout_save (); pw_col_save (); }
static void settings_dialog_response (GtkWidget *dialog, gint response_id, XfceSettingsEditorBox *settings_editor) { if (response_id == GTK_RESPONSE_HELP) xfce_dialog_show_help_with_version (GTK_WINDOW (dialog), "xfce4-settings", "settings-editor", NULL, XFCE4_SETTINGS_VERSION_SHORT); else { save_window_size (dialog, settings_editor); gtk_main_quit (); } }
void prefs_save(void) { GKeyFile *keyfile = g_key_file_new(); char *filename = g_build_filename(g_get_user_config_dir(), PACKAGE, NULL); char *data; save_hash_funcs(keyfile); save_digest_format(keyfile); save_window_view(keyfile); save_window_show_toolbar(keyfile); save_window_size(keyfile); data = g_key_file_to_data(keyfile, NULL, NULL); g_file_set_contents(filename, data, -1, NULL); g_free(data); g_free(filename); g_key_file_free(keyfile); }
static void ui_show (gboolean show) { if (show) { if (! ui_is_shown ()) restore_window_size (); gtk_window_present ((GtkWindow *) window); /* turn visualization back on if necessary */ ui_infoarea_show_vis (aud_get_bool ("gtkui", "infoarea_show_vis")); } else { if (ui_is_shown ()) save_window_size (); gtk_widget_hide (window); /* turn visualization off to reduce CPU usage */ ui_infoarea_show_vis (FALSE); } }
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { static HWND last_focus=0; if(FALSE) //if(msg!=WM_MOUSEFIRST&&msg!=WM_NCHITTEST&&msg!=WM_SETCURSOR&&msg!=WM_ENTERIDLE&&msg!=WM_NOTIFY) if(msg!=WM_NCHITTEST&&msg!=WM_SETCURSOR&&msg!=WM_ENTERIDLE&&msg!=WM_MOUSEMOVE&&msg!=WM_NCMOUSEMOVE) { static DWORD tick=0; if((GetTickCount()-tick)>500) printf("--\n"); print_msg(msg,lparam,wparam,hwnd); tick=GetTickCount(); } switch(msg) { case WM_MENUSELECT: break; case WM_CREATE: { RECT rect={0}; extern int keep_closed,trim_trailing,left_justify; get_ini_value("SETTINGS","KEEP_CLOSED",&keep_closed); get_ini_value("SETTINGS","TRIM_TRAILING",&trim_trailing); get_ini_value("SETTINGS","LEFT_JUSTIFY",&left_justify); load_icon(hwnd); load_window_size(hwnd,"MAIN_WINDOW"); GetClientRect(hwnd,&rect); get_ini_value("SETTINGS","TREE_WIDTH",&tree_width); if(tree_width>rect.right-10 || tree_width<10){ tree_width=rect.right/4; if(tree_width<12) tree_width=12; } ghmdiclient=create_mdiclient(hwnd,ghmenu,ghinstance); ghdbview=create_dbview(hwnd,ghinstance); ghstatusbar=CreateStatusWindow(WS_CHILD|WS_VISIBLE,"ready",hwnd,IDC_STATUS); create_status_bar_parts(hwnd,ghstatusbar); resize_main_window(hwnd,tree_width); } break; case WM_DROPFILES: process_drop(hwnd,wparam); break; case WM_COPYDATA: if(lparam!=0){ COPYDATASTRUCT *cd=lparam; process_cmd_line(cd->lpData); } break; case WM_USER: debug_window_focus(lparam,"WM_USER"); switch(wparam){ case IDC_TREEVIEW: if(lparam!=0) SetFocus(lparam); break; case IDC_MDI_LISTVIEW: if(lparam!=0){ last_focus=lparam; SetFocus(lparam); } break; case IDC_LV_EDIT: if(lparam!=0) last_focus=lparam; break; } break; case WM_USER+1: debug_window_focus(last_focus,"WMUSER+1"); if(last_focus!=0) SetFocus(last_focus); break; case WM_NCACTIVATE: debug_window_focus(last_focus,"NCACTIVATE wparam=%08X",wparam); if(wparam==0){ last_focus=GetFocus(); } else{ PostMessage(hwnd,WM_USER+1,0,0); } break; case WM_ACTIVATEAPP: //close any tooltip on app switch debug_window_focus(last_focus,"ACTIVATEAPP wparam=%08X",wparam); if(wparam){ PostMessage(hwnd,WM_USER+1,0,0); } break; case WM_KILLFOCUS: case WM_RBUTTONDOWN: case WM_LBUTTONUP: if(main_drag){ ReleaseCapture(); main_drag=FALSE; write_ini_value("SETTINGS","TREE_WIDTH",tree_width); } break; case WM_LBUTTONDOWN: { int x=LOWORD(lparam); if(x>=(tree_width-10) && x<(tree_width+10)){ SetCapture(hwnd); SetCursor(LoadCursor(NULL,IDC_SIZEWE)); main_drag=TRUE; } } break; case WM_MOUSEFIRST: { int x=LOWORD(lparam); if(x>=(tree_width-10) && x<(tree_width+10)) SetCursor(LoadCursor(NULL,IDC_SIZEWE)); if(main_drag){ RECT rect; GetClientRect(ghmainframe,&rect); if(x>10 && x<rect.right-10){ tree_width=x; resize_main_window(hwnd,tree_width); } } } break; case WM_COMMAND: switch(LOWORD(wparam)){ case IDM_OPEN: if((GetKeyState(VK_SHIFT)&0x8000) || GetKeyState(VK_CONTROL)&0x8000) task_open_db(""); else{ if(does_key_exist("SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources","Journal")) task_open_db("UID=dba;PWD=sql;DSN=Journal"); else task_open_db(""); } break; case IDM_CLOSE: { HANDLE hroot=0; if(tree_find_focused_root(&hroot)){ char str[MAX_PATH]={0}; tree_get_db_table(hroot,str,sizeof(str),0,0,0); if(str[0]!=0){ set_status_bar_text(ghstatusbar,0,"closing %s",str); task_close_db(str); } } else set_status_bar_text(ghstatusbar,0,"select a DB"); } break; case IDM_SETTINGS: DialogBox(ghinstance,MAKEINTRESOURCE(IDD_SETTINGS),hwnd,settings_proc); break; case IDM_RECENT: DialogBox(ghinstance,MAKEINTRESOURCE(IDD_RECENT),hwnd,recent_proc); break; case IDM_STOP_THREAD: { int click=MessageBox(hwnd,"Are you sure you want to terminate the task?","Warning",MB_OKCANCEL|MB_SYSTEMMODAL); if(click==IDOK){ terminate_worker_thread(); stop_thread_menu(FALSE); } } break; case IDM_QUERY: task_new_query(); break; case IDC_EXECUTE_SQL: task_execute_query(NULL); break; case IDM_TILE_DIALOG: tile_select_dialog(hwnd); break; case IDM_WINDOW_TILE: mdi_tile_windows_vert(); break; case IDM_WINDOW_CASCADE: mdi_cascade_win_vert(); break; case IDM_WINDOW_LRTILE: mdi_tile_windows_horo(); break; case IDM_REFRESH_ALL: refresh_all_dialog(hwnd); break; case IDM_REORDER: reorder_win_dialog(hwnd); break; } break; case WM_SIZE: resize_main_window(hwnd,tree_width); create_status_bar_parts(ghmainframe,ghstatusbar); return 0; break; case WM_QUERYENDSESSION: return 1; //ok to end session break; case WM_ENDSESSION: if(wparam){ if(!(GetKeyState(VK_SHIFT)&0x8000)) save_window_size(hwnd,"MAIN_WINDOW"); } return 0; case WM_CLOSE: break; case WM_DESTROY: if(!(GetKeyState(VK_SHIFT)&0x8000)) save_window_size(hwnd,"MAIN_WINDOW"); PostQuitMessage(0); break; } return DefFrameProc(hwnd, ghmdiclient, msg, wparam, lparam); }