/** * \internal */ static void validate_parse_link_click_callback(GtkTextView * text_view, GtkTextTag * link_tag, const gchar * url, struct validate *validate) { GtkTreeIter menu_iter; gint validate_case; validate_case = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(link_tag), "validate_case")); if (!menu_get_selected(&menu_iter, FALSE) || !gebr_gui_gtk_tree_model_iter_equal_to(GTK_TREE_MODEL(debr.ui_menu.model), &menu_iter, &validate->menu_iter)) menu_select_iter(&validate->menu_iter); gchar *program_path = g_object_get_data(G_OBJECT(link_tag), "program_path_string"); gchar *parameter_path = g_object_get_data(G_OBJECT(link_tag), "parameter_path_string"); gboolean ret = FALSE; if (program_path != NULL) { menu_select_program_and_paramater(program_path, parameter_path); if (parameter_path != NULL) ret = on_parameter_properties_activate(); else if (validate_case == GEBR_VALIDATE_CASE_HELP) debr_help_edit(GEBR_GEOXML_OBJECT(debr.program)); else ret = on_program_properties_activate(); } else if (validate_case == GEBR_VALIDATE_CASE_HELP) debr_help_edit(GEBR_GEOXML_OBJECT(debr.menu)); else ret = on_menu_properties_activate(); if (ret) validate_menu(&validate->menu_iter); }
static void create_help_edit_window(GebrGeoXmlObject * object, const gchar * help) { gchar * title; gchar * help_backup; const gchar * object_title; GtkTreeIter iter; GebrGuiHelpEditWidget * help_edit_widget; GtkWidget * help_edit_window; if (gebr_geoxml_object_get_type(object) == GEBR_GEOXML_OBJECT_TYPE_PROGRAM) { help_backup = debr_program_get_backup_help_from_pointer(object); object_title = gebr_geoxml_program_get_title(GEBR_GEOXML_PROGRAM(object)); if (object_title && strlen (object_title)) title = g_strdup_printf(_("Help of the program \"%s\""), object_title); else title = g_strdup_printf(_("Help of the program")); } else { help_backup = debr_menu_get_backup_help_from_pointer(object); object_title = gebr_geoxml_document_get_title(GEBR_GEOXML_DOCUMENT(object)); if (object_title && strlen (object_title)) title = g_strdup_printf(_("Help of the menu \"%s\""), object_title); else title = g_strdup_printf(_("Help of the menu")); } menu_get_selected(&iter, TRUE); help_edit_widget = debr_help_edit_widget_new(object, help, help_backup != NULL); help_edit_window = gebr_gui_help_edit_window_new(help_edit_widget); gebr_gui_help_edit_window_set_auto_save(GEBR_GUI_HELP_EDIT_WINDOW(help_edit_window), TRUE); merge_ui_def(GEBR_GUI_HELP_EDIT_WINDOW(help_edit_window), help_backup != NULL && strlen (help_backup) > 2); g_free(help_backup); g_signal_connect (help_edit_window, "destroy", G_CALLBACK (help_edit_window_on_destroy), NULL); g_signal_connect (help_edit_widget, "commit-request", G_CALLBACK (help_edit_on_commit_request), NULL); g_signal_connect (help_edit_widget, "content-loaded", G_CALLBACK (help_edit_on_content_loaded), help_edit_window); g_hash_table_insert(debr.help_edit_windows, object, help_edit_window); gtk_window_set_title(GTK_WINDOW(help_edit_window), title); gtk_window_set_default_size(GTK_WINDOW(help_edit_window), 600, 500); gtk_widget_show(help_edit_window); g_free(title); }
void menu_touch(int xx, int yy) { if (g_menu_applet) { if (g_menu_applet(xx, yy)) menu_back_after_applet(); return; } menu_touch_y = yy; menu_touch_x = xx; //menu_update(); int old = g_item; g_item = menu_get_selected(); lcd_lock(); if (old != -1) menu_paint_cell(old); if (g_item != -1) menu_paint_cell(g_item); lcd_release(); if (xx == -1 || yy == -1 || g_item == -1) { if (old != -1) { if (g_menu[g_index][old].press_handler) { g_menu[g_index][old].press_handler(0); } void (*callback)(int) = g_menu[g_index][old].activate; g_crumbs[g_index] = old; if (g_menu[g_index][old].next && g_index < MAX_DEPTH) { g_index++; g_menu[g_index] = g_menu[g_index-1][old].next; menu_update(); } else if (g_menu[g_index][old].touch_handler) { g_menu_applet = g_menu[g_index][old].touch_handler; g_item = old; menu_clear(); } else if (strcmp(g_menu[g_index][old].text, "Back") == 0) { menu_run_callback(0); if (g_index > 0) g_index--; menu_update(); menu_run_callback(1); } // run the callback which should start the applet or update the display if (callback) { callback(1); } } return; } menu_touch_y = 0; menu_touch_x = 0; if (g_menu[g_index][g_item].press_handler) { g_menu[g_index][g_item].press_handler(1); } }
void menu_touch(int xx, int yy) { //char c[15]; vConsolePrint("Menu Touch Called\r\n"); //sprintf(c, "x %d y %d\r\n", xx, yy); //vConsolePrint(c); if (g_menu_applet) { if (g_menu_applet(xx, yy)) menu_back_after_applet(); return; } menu_touch_y = yy; menu_touch_x = xx; //menu_update(); char bb[30]; int old = g_item; if (g_incoming_command == 1) { g_item = g_command_item; } else { g_item = menu_get_selected(); } g_incoming_command=0; // sprintf(bb, "Item Selected is: %u\r\n", g_item); // vConsolePrint(bb); // fflush(stdout); lcd_lock(); if (old != -1) menu_paint_cell(old); if (g_item != -1) menu_paint_cell(g_item); lcd_release(); if (xx == -1 || yy == -1 || g_item == -1) { if (old != -1) { if (g_menu[g_index][old].press_handler) { g_menu[g_index][old].press_handler(0); } void (*callback)(int) = g_menu[g_index][old].activate; g_crumbs[g_index] = old; if (g_menu[g_index][old].next && g_index < MAX_DEPTH) { g_index++; g_menu[g_index] = g_menu[g_index-1][old].next; menu_update(); } else if (g_menu[g_index][old].touch_handler) { g_menu_applet = g_menu[g_index][old].touch_handler; g_item = old; menu_clear(); } else if (strcmp(g_menu[g_index][old].text, "Back") == 0) { menu_run_callback(0); if (g_index > 0) g_index--; menu_update(); menu_run_callback(1); } // run the callback which should start the applet or update the display if (callback) { callback(1); } } return; } menu_touch_y = 0; menu_touch_x = 0; if (g_menu[g_index][g_item].press_handler) { g_menu[g_index][g_item].press_handler(1); } }