static INT_PTR CALLBACK dialog_proc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) { switch( uMsg ) { case WM_INITDIALOG: dialog_init( hwndDlg ); update_list( hwndDlg, ( GSList * ) lParam ); return FALSE; case WM_COMMAND: switch( LOWORD( wParam ) ) { case IDOK: EndDialog( hwndDlg, SendDlgItemMessage( hwndDlg, IDC_ROLLBACK_LV, LVM_GETSELECTIONMARK, 0, 0 ) ); return 0; case IDCANCEL: EndDialog( hwndDlg, -1 ); return 0; } break; case WM_CLOSE: EndDialog( hwndDlg, -1 ); return 0; } return FALSE; }
static INT_PTR CALLBACK dialog_proc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) { switch( uMsg ) { case WM_INITDIALOG: dialog_init( hwndDlg ); return TRUE; case WM_COMMAND: switch( LOWORD( wParam ) ) { case IDCLOSE: case IDCANCEL: DestroyWindow( hwndDlg ); fuse_hABOWnd = NULL; if( hBoldFont ) DeleteObject( hBoldFont ); return TRUE; case IDC_ABOUT_STATIC_WEBSITE: ShellExecute( hwndDlg, "open", PACKAGE_URL, NULL, NULL, SW_SHOWNORMAL ); return TRUE; } break; case WM_CLOSE: DestroyWindow( hwndDlg ); fuse_hABOWnd = NULL; return TRUE; } return FALSE; }
/** * dialog_solver: * @wbcg: * @sheet: * * Create the dialog (guru). * **/ void dialog_solver (WBCGtk *wbcg, Sheet *sheet) { SolverState *state; GnmSolverParameters *old_params = sheet->solver_parameters; gboolean got_it; int pass; /* Only pop up one copy per workbook */ if (gnm_dialog_raise_if_exists (wbcg, SOLVER_KEY)) return; /* * First time around, pick a functional algorithm preferably one we * can determine is functional without asking the user anything. */ got_it = gnm_solver_factory_functional (old_params->options.algorithm, NULL); for (pass = 1; !got_it && pass <= 2; pass++) { GSList *l; WBCGtk *wbcg2 = pass == 2 ? wbcg : NULL; for (l = gnm_solver_db_get (); l; l = l->next) { GnmSolverFactory *factory = l->data; if (old_params->options.model_type != factory->type) continue; if (gnm_solver_factory_functional (factory, wbcg2)) { got_it = TRUE; gnm_solver_param_set_algorithm (old_params, factory); break; } } } state = g_new0 (SolverState, 1); state->ref_count = 1; state->wbcg = wbcg; state->sheet = sheet; state->warning_dialog = NULL; state->orig_params = gnm_solver_param_dup (sheet->solver_parameters, sheet); if (dialog_init (state)) { go_gtk_notice_dialog (wbcg_toplevel (wbcg), GTK_MESSAGE_ERROR, _("Could not create the Solver dialog.")); unref_state (state); return; } gnm_dialog_setup_destroy_handlers (GTK_DIALOG (state->dialog), wbcg, GNM_DIALOG_DESTROY_SHEET_REMOVED); gnm_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog), SOLVER_KEY); gtk_widget_show (state->dialog); }
/** * dialog_goal_seek: * @wbcg: * @sheet: * * Create the dialog (guru). * **/ void dialog_goal_seek (WBCGtk *wbcg, Sheet *sheet) { GoalSeekState *state; GladeXML *gui; g_return_if_fail (IS_SHEET (sheet)); /* Testing hook. */ if (wbcg == NULL) { GnmRangeRef *range = g_object_get_data (G_OBJECT (sheet), "ssconvert-goal-seek"); if (range) { Sheet *start_sheet, *end_sheet; GnmEvalPos ep; GnmRange r; gnm_rangeref_normalize (range, eval_pos_init_sheet (&ep, sheet), &start_sheet, &end_sheet, &r); g_return_if_fail (start_sheet == sheet); dialog_goal_seek_test (sheet, &r); return; } } g_return_if_fail (wbcg != NULL); /* Only pop up one copy per workbook */ if (gnumeric_dialog_raise_if_exists (wbcg, GOALSEEK_KEY)) return; gui = gnm_glade_xml_new (GO_CMD_CONTEXT (wbcg), "goalseek.glade", NULL, NULL); if (gui == NULL) return; state = g_new (GoalSeekState, 1); state->wbcg = wbcg; state->wb = wb_control_get_workbook (WORKBOOK_CONTROL (wbcg)); state->sheet = sheet; state->gui = gui; state->warning_dialog = NULL; state->cancelled = TRUE; if (dialog_init (state)) { go_gtk_notice_dialog (wbcg_toplevel (wbcg), GTK_MESSAGE_ERROR, _("Could not create the Goal-Seek dialog.")); g_free (state); return; } gnumeric_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog), GOALSEEK_KEY); gtk_widget_show (state->dialog); }
static INT_PTR CALLBACK dialog_proc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) { switch( uMsg ) { case WM_INITDIALOG: SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); dialog_init( hwndDlg, ( struct joystick_info * ) lParam ); return FALSE; case WM_COMMAND: switch( LOWORD( wParam ) ) { case IDC_JOYSTICKS_BUTTON_BUTTON1: case IDC_JOYSTICKS_BUTTON_BUTTON2: case IDC_JOYSTICKS_BUTTON_BUTTON3: case IDC_JOYSTICKS_BUTTON_BUTTON4: case IDC_JOYSTICKS_BUTTON_BUTTON5: case IDC_JOYSTICKS_BUTTON_BUTTON6: case IDC_JOYSTICKS_BUTTON_BUTTON7: case IDC_JOYSTICKS_BUTTON_BUTTON8: case IDC_JOYSTICKS_BUTTON_BUTTON9: case IDC_JOYSTICKS_BUTTON_BUTTON10: case IDC_JOYSTICKS_BUTTON_BUTTON11: case IDC_JOYSTICKS_BUTTON_BUTTON12: case IDC_JOYSTICKS_BUTTON_BUTTON13: case IDC_JOYSTICKS_BUTTON_BUTTON14: case IDC_JOYSTICKS_BUTTON_BUTTON15: show_key_selection_popoup( hwndDlg, lParam ); return 0; case IDOK: joystick_done( GetWindowLongPtr( hwndDlg, GWLP_USERDATA ) ); EndDialog( hwndDlg, 0 ); return 0; case IDCANCEL: EndDialog( hwndDlg, 0 ); return 0; } break; case WM_CLOSE: EndDialog( hwndDlg, 0 ); return 0; } return FALSE; }
/* * Main entry point for the Cell Sort dialog box */ void dialog_cell_sort (WBCGtk *wbcg) { SortFlowState *state; GtkBuilder *gui; g_return_if_fail (wbcg != NULL); if (gnumeric_dialog_raise_if_exists (wbcg, CELL_SORT_KEY)) return; gui = gnm_gtk_builder_new ("cell-sort.ui", NULL, GO_CMD_CONTEXT (wbcg)); if (gui == NULL) return; state = g_new (SortFlowState, 1); state->wbcg = wbcg; state->wb = wb_control_get_workbook (WORKBOOK_CONTROL (wbcg)); state->sv = wb_control_cur_sheet_view (WORKBOOK_CONTROL (wbcg)); state->sheet = sv_sheet (state->sv); state->warning_dialog = NULL; state->sel = NULL; state->sort_items = 0; state->gui = gui; state->dialog = go_gtk_builder_get_widget (state->gui, "CellSort"); state->image_ascending = gtk_widget_render_icon_pixbuf (state->dialog, GTK_STOCK_SORT_ASCENDING, GTK_ICON_SIZE_LARGE_TOOLBAR); state->image_descending = gtk_widget_render_icon_pixbuf (state->dialog, GTK_STOCK_SORT_DESCENDING, GTK_ICON_SIZE_LARGE_TOOLBAR); dialog_init (state); gnumeric_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog), CELL_SORT_KEY); gtk_widget_show (state->dialog); }
/************************************************************** * main: **************************************************************/ int main(int argc, char **argv) { Display * display; char name[132]; (void) strncpy(name, base(argv[0]), 132); /* Initialize the X Intrinsics */ XtToolkitInitialize(); /* Set up language environment for X */ XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL); /* Create application context */ app_context = XtCreateApplicationContext(); XtAppSetFallbackResources(app_context, fallback_reslist); /* open up one display */ display = XtOpenDisplay(app_context, NULL, name, "XmdI18nInput", (XrmOptionDescRec *)NULL, 0, &argc, argv); if (!display) { (void) fprintf(stderr, "Unable to open display\n"); exit(0); } /* Call init functions. This creates the user interface (placed in input.c) */ if (dialog_init(&argc, argv, display) != 0) exit(1); XtAppMainLoop(app_context); return 0; /* make compiler happy */ }
GtkWidget * nma_wired_dialog_new (const char *glade_file, NMClient *nm_client, NMSettingsConnectionInterface *connection, NMDevice *device) { GladeXML *xml; GtkWidget *dialog; gboolean success; xml = glade_xml_new (glade_file, "wireless_dialog", NULL); if (!xml) { applet_warning_dialog_show (_("The NetworkManager Applet could not find some required resources (the glade file was not found).")); return NULL; } dialog = glade_xml_get_widget (xml, "wireless_dialog"); if (!dialog) { nm_warning ("Couldn't find glade wireless_dialog widget."); g_object_unref (xml); return NULL; } success = dialog_init (dialog, xml, nm_client, glade_file, NM_CONNECTION (connection)); if (!success) { nm_warning ("Couldn't create wired security dialog."); gtk_widget_destroy (dialog); return NULL; } g_object_set_data_full (G_OBJECT (dialog), "connection", g_object_ref (connection), (GDestroyNotify) g_object_unref); return dialog; }
int clip___ACCEPT(ClipMachine * ClipMachineMemory) { int l, c = ClipMachineMemory->history.count_of_ClipVect; int ckey = 0; int pos, cpos, size = 16; unsigned char *s; char *prompt = _clip_parcl(ClipMachineMemory, 1, &l); int attr = _clip_colorSelect(ClipMachineMemory); int hpos = c; dialog_init(ClipMachineMemory); if (prompt) { /*_clip_fullscreen(ClipMachineMemory); */ /*out_dev(ClipMachineMemory, "\n", 1, attr, 1); */ out_dev(ClipMachineMemory, prompt, l, attr, 1); sync_mp(ClipMachineMemory); } s = (unsigned char *) malloc(size); s[0] = 0; for (pos = 0, cpos = 0;;) { int i; sync_mp(ClipMachineMemory); ckey = _clip_key(ClipMachineMemory, -1, _CLIP_INKEY_KEYBOARD); if (pos >= size - 1) { size = size * 3 / 2; s = (unsigned char *) realloc(s, size); } switch (ckey) { case 13: /* Enter */ s[pos] = 0; goto ret; case 27: /* Esc */ s[0] = 0; goto ret; case 5: /* Up */ if (!hpos) break; hpos--; newstr: { char *sp = ClipMachineMemory->history.items_of_ClipVect[hpos]; int l = strlen(sp); free(s); size = l + 4; s = (unsigned char *) malloc(size); memcpy(s, sp, l); s[l] = 0; for (i = 0; i < cpos; ++i) out_dev(ClipMachineMemory, "\b", 1, attr, 1); out_dev(ClipMachineMemory, (char *) s, l, attr, 1); for (i = l; i < pos; ++i) out_dev(ClipMachineMemory, " ", 1, attr, 1); for (; i > l; --i) out_dev(ClipMachineMemory, "\b", 1, attr, 1); pos = cpos = l; } break; case 24: /* Down */ if (hpos >= c - 1) break; ++hpos; goto newstr; case 21: /* Ctrl-U */ for (i = 0; i < cpos; ++i) out_dev(ClipMachineMemory, "\b", 1, attr, 1); for (i = 0; i < pos; ++i) out_dev(ClipMachineMemory, " ", 1, attr, 1); for (i = 0; i < pos; ++i) out_dev(ClipMachineMemory, "\b", 1, attr, 1); cpos = pos = 0; break; case 1: /* Home */ for (i = 0; i < cpos; ++i) out_dev(ClipMachineMemory, "\b", 1, attr, 1); cpos = 0; break; case 6: /* End */ if (cpos < pos) { out_dev(ClipMachineMemory, (char *) (s + cpos), pos - cpos, attr, 1); cpos = pos; } break; case 19: /* Left */ if (cpos > 0) { out_dev(ClipMachineMemory, "\b", 1, attr, 1); --cpos; } break; case 4: /* Right */ if (cpos < pos) { out_dev(ClipMachineMemory, (char *) (s + cpos), 1, attr, 1); ++cpos; } break; case 8: /* BS */ if (cpos > 0) { --pos; --cpos; if (pos == cpos) out_dev(ClipMachineMemory, "\b \b", 3, attr, 1); else { int l = pos - cpos; memmove(s + cpos, s + cpos + 1, l); s[pos] = ' '; out_dev(ClipMachineMemory, "\b", 1, attr, 1); out_dev(ClipMachineMemory, (char *) (s + cpos), l + 1, attr, 1); for (i = 0; i <= l; ++i) out_dev(ClipMachineMemory, "\b", 1, attr, 1); } } break; case 7: /* Del */ if (cpos < pos) { --pos; { int l = pos - cpos; memmove(s + cpos, s + cpos + 1, l); s[pos] = ' '; out_dev(ClipMachineMemory, (char *) (s + cpos), l + 1, attr, 1); for (i = 0; i <= l; ++i) out_dev(ClipMachineMemory, "\b", 1, attr, 1); } } break; default: if (ckey >= 32 && ckey < 256) { unsigned char b; b = ckey; if (cpos == pos) { s[cpos++] = b; pos = cpos; out_dev(ClipMachineMemory, (char *) (&b), 1, attr, 1); } else { int l = pos - cpos; memmove(s + cpos + 1, s + cpos, l); s[cpos] = b; out_dev(ClipMachineMemory, (char *) (&b), 1, attr, 1); out_dev(ClipMachineMemory, (char *) (s + cpos + 1), l, attr, 1); for (i = 0; i < l; ++i) out_dev(ClipMachineMemory, "\b", 1, attr, 1); ++cpos; ++pos; } } break; } } ret: _clip_retc(ClipMachineMemory, (char *) s); if (c == 0 || strcmp(ClipMachineMemory->history.items_of_ClipVect[c - 1], (char *) s)) add_ClipVect(&ClipMachineMemory->history, s); else free(s); if (c >= CLIP_MAX_HISTORY) { free(ClipMachineMemory->history.items_of_ClipVect[0]); remove_ClipVect(&ClipMachineMemory->history, 0); } out_dev(ClipMachineMemory, "\n", 1, attr, 1); sync_mp(ClipMachineMemory); return 0; }