Index: trunk/doc/TODO =================================================================== --- trunk/doc/TODO (revision 21361) +++ trunk/doc/TODO (revision 21362) @@ -2,10 +2,6 @@ 1. For the upcoming release =============================================================================== - CLEANUP: fontsel - - add per object font change to the new action - - remove gtk pup dep - - remove lesstif pup dep - - rename action to fontsel - remove dlg_fontsel local callbacks - simplify the stub object pointers, keep only obj - rewrite buttons? Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 21361) +++ trunk/scconfig/Rev.h (revision 21362) @@ -1 +1 @@ -static const int myrev = 21313; +static const int myrev = 21362; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 21361) +++ trunk/scconfig/Rev.tab (revision 21362) @@ -1,4 +1,4 @@ -21313 configure HID API cleanup +21362 configure HID API cleanup, including dialogs rewritten with DAD 21289 configure new drc infra and GUI 21098 configure old pinout dialog removal 20317 configure new core color infra Index: trunk/scconfig/plugins.h =================================================================== --- trunk/scconfig/plugins.h (revision 21361) +++ trunk/scconfig/plugins.h (revision 21362) @@ -136,23 +136,19 @@ plugin_dep("extedit", "io_lihata") plugin_dep("fp_wget", "fp_fs") plugin_dep("hid_gtk2_gdk", "draw_csect") -plugin_dep("hid_gtk2_gdk", "draw_fontsel") plugin_dep("hid_gtk2_gdk", "lib_gtk_common") plugin_dep("hid_gtk2_gdk", "lib_gtk_config") plugin_dep("hid_gtk2_gdk", "lib_gtk_hid") plugin_dep("hid_gtk2_gl", "draw_csect") -plugin_dep("hid_gtk2_gl", "draw_fontsel") plugin_dep("hid_gtk2_gl", "lib_gtk_common") plugin_dep("hid_gtk2_gl", "lib_gtk_config") plugin_dep("hid_gtk2_gl", "lib_gtk_hid") plugin_dep("hid_gtk2_gl", "lib_hid_gl") plugin_dep("hid_gtk3_cairo", "draw_csect") -plugin_dep("hid_gtk3_cairo", "draw_fontsel") plugin_dep("hid_gtk3_cairo", "lib_gtk_common") plugin_dep("hid_gtk3_cairo", "lib_gtk_config") plugin_dep("hid_gtk3_cairo", "lib_gtk_hid") plugin_dep("hid_gtk3_gl", "draw_csect") -plugin_dep("hid_gtk3_gl", "draw_fontsel") plugin_dep("hid_gtk3_gl", "lib_gtk_common") plugin_dep("hid_gtk3_gl", "lib_gtk_config") plugin_dep("hid_gtk3_gl", "lib_gtk_hid") @@ -159,7 +155,6 @@ plugin_dep("hid_gtk3_gl", "lib_hid_gl") plugin_dep("hid_lesstif", "dialogs") plugin_dep("hid_lesstif", "draw_csect") -plugin_dep("hid_lesstif", "draw_fontsel") plugin_dep("hid_lesstif", "lib_hid_common") plugin_dep("import_dsn", "lib_compat_help") plugin_dep("import_ipcd356", "lib_compat_help") Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 21361) +++ trunk/src/Makefile.dep (revision 21362) @@ -3561,7 +3561,7 @@ ../src_plugins/lib_gtk_common/compat.h ../src_plugins/lib_gtk_common/dlg_fontsel.o: \ ../src_plugins/lib_gtk_common/dlg_fontsel.c ../config.h \ - ../src_plugins/lib_gtk_common/dlg_fontsel.h global_typedefs.h pcb_bool.h \ + global_typedefs.h pcb_bool.h \ unit.h hid.h ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ ../src_3rd/liblihata/parser.h ../src_3rd/genht/htsp.h \ ../src_3rd/genht/ht.h error.h global_typedefs.h attrib.h layer.h \ @@ -3825,7 +3825,7 @@ ../src_plugins/lib_gtk_common/bu_status_line.h \ ../src_plugins/lib_gtk_common/bu_icons.h \ ../src_plugins/lib_gtk_common/dlg_route_style.h \ - ../src_plugins/lib_gtk_common/dlg_fontsel.h global_typedefs.h \ + global_typedefs.h \ ../src_plugins/lib_gtk_common/util_str.h \ ../src_plugins/lib_gtk_common/util_listener.h \ ../src_plugins/lib_gtk_common/in_mouse.h \ @@ -4233,7 +4233,7 @@ ../src_plugins/lib_gtk_common/dlg_log.h error.h \ ../src_plugins/lib_gtk_common/dlg_netlist.h \ ../src_plugins/lib_gtk_common/dlg_search.h \ - ../src_plugins/lib_gtk_common/dlg_fontsel.h global_typedefs.h \ + global_typedefs.h \ ../src_plugins/lib_gtk_config/lib_gtk_config.h dolists.h ../src_plugins/lib_gtk_hid/common.o: ../src_plugins/lib_gtk_hid/common.c \ ../config.h crosshair.h vtonpoint.h global_typedefs.h pcb_bool.h unit.h \ Index: trunk/src_plugins/dialogs/dialogs.c =================================================================== --- trunk/src_plugins/dialogs/dialogs.c (revision 21361) +++ trunk/src_plugins/dialogs/dialogs.c (revision 21362) @@ -70,7 +70,7 @@ {"dad", pcb_act_dad, pcb_acth_dad, pcb_acts_dad}, {"DrcDialog", pcb_act_DrcDialog, pcb_acth_DrcDialog, pcb_acts_DrcDialog}, {"IOIncompatList", pcb_act_IOIncompatList, pcb_acth_IOIncompatList, pcb_acts_IOIncompatList}, - {"Fontsel2", pcb_act_Fontsel, pcb_acth_Fontsel, pcb_acts_Fontsel} + {"Fontsel", pcb_act_Fontsel, pcb_acth_Fontsel, pcb_acts_Fontsel} }; static const char *dialogs_cookie = "dialogs plugin"; Index: trunk/src_plugins/hid_gtk2_gdk/hid_gtk2_gdk.pup =================================================================== --- trunk/src_plugins/hid_gtk2_gdk/hid_gtk2_gdk.pup (revision 21361) +++ trunk/src_plugins/hid_gtk2_gdk/hid_gtk2_gdk.pup (revision 21362) @@ -8,5 +8,4 @@ dep lib_gtk_config dep lib_gtk_hid dep draw_csect -dep draw_fontsel autoload 1 Index: trunk/src_plugins/hid_gtk2_gl/hid_gtk2_gl.pup =================================================================== --- trunk/src_plugins/hid_gtk2_gl/hid_gtk2_gl.pup (revision 21361) +++ trunk/src_plugins/hid_gtk2_gl/hid_gtk2_gl.pup (revision 21362) @@ -9,5 +9,4 @@ dep lib_gtk_hid dep lib_hid_gl dep draw_csect -dep draw_fontsel autoload 1 Index: trunk/src_plugins/hid_gtk3_cairo/hid_gtk3_cairo.pup =================================================================== --- trunk/src_plugins/hid_gtk3_cairo/hid_gtk3_cairo.pup (revision 21361) +++ trunk/src_plugins/hid_gtk3_cairo/hid_gtk3_cairo.pup (revision 21362) @@ -7,5 +7,4 @@ dep lib_gtk_config dep lib_gtk_hid dep draw_csect -dep draw_fontsel autoload 1 Index: trunk/src_plugins/hid_gtk3_gl/hid_gtk3_gl.pup =================================================================== --- trunk/src_plugins/hid_gtk3_gl/hid_gtk3_gl.pup (revision 21361) +++ trunk/src_plugins/hid_gtk3_gl/hid_gtk3_gl.pup (revision 21362) @@ -8,5 +8,4 @@ dep lib_gtk_hid dep lib_hid_gl dep draw_csect -dep draw_fontsel autoload 1 Index: trunk/src_plugins/hid_lesstif/dialogs.c =================================================================== --- trunk/src_plugins/hid_lesstif/dialogs.c (revision 21361) +++ trunk/src_plugins/hid_lesstif/dialogs.c (revision 21362) @@ -1399,37 +1399,6 @@ return 0; } - -static const char pcb_acts_fontsel[] = "EditLayerGroups()"; -static const char pcb_acth_fontsel[] = "Let the user change fonts"; -extern void lesstif_show_fontsel_edit(pcb_layer_t *txtly, pcb_text_t *txt, int type); -static fgw_error_t pcb_act_fontsel(fgw_arg_t *res, int argc, fgw_arg_t *argv) -{ - if (argc > 2) - PCB_ACT_FAIL(fontsel); - - if (argc > 1) { - const char *op; - PCB_ACT_CONVARG(1, FGW_STR, fontsel, op = argv[1].val.str); - if (pcb_strcasecmp(op, "Object") == 0) { - pcb_coord_t x, y; - int type; - void *ptr1, *ptr2, *ptr3; - pcb_hid_get_coords(_("Select an Object"), &x, &y, 0); - if ((type = pcb_search_screen(x, y, PCB_CHANGENAME_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_OBJ_VOID) { -/* pcb_undo_save_serial();*/ - lesstif_show_fontsel_edit(ptr1, ptr2, type); - } - } - else - PCB_ACT_FAIL(fontsel); - } - else - lesstif_show_fontsel_edit(NULL, NULL, 0); - PCB_ACT_IRES(0); - return 0; -} - /* ------------------------------------------------------------ */ typedef struct { @@ -1810,7 +1779,6 @@ {"Print", pcb_act_Print, pcb_acth_Print, pcb_acts_Print}, {"AdjustSizes", pcb_act_AdjustSizes, pcb_acth_AdjustSizes, pcb_acts_AdjustSizes}, {"EditLayerGroups", pcb_act_EditLayerGroups, pcb_acth_EditLayerGroups, pcb_acts_EditLayerGroups}, - {"FontSel", pcb_act_fontsel, pcb_acth_fontsel, pcb_acts_fontsel}, {"ImportGUI", pcb_act_ImportGUI, pcb_acth_ImportGUI, pcb_acts_ImportGUI} }; Index: trunk/src_plugins/hid_lesstif/dlg_preview.c =================================================================== --- trunk/src_plugins/hid_lesstif/dlg_preview.c (revision 21361) +++ trunk/src_plugins/hid_lesstif/dlg_preview.c (revision 21362) @@ -291,82 +291,3 @@ } } -/***************** instance for font selection **********************/ - -#include "stub_draw.h" - -static PreviewData *fontsel_glob = NULL; - -static void fontsel_pre_close_glob(struct PreviewData *pd) -{ - if (pd == fontsel_glob) - fontsel_glob = NULL; -} - -static void lesstif_show_fontsel_global() -{ - pcb_layer_id_t lid; - if (fontsel_glob != NULL) - return; - if (pcb_layer_list(PCB, PCB_LYT_DIALOG, &lid, 1) > 0) { - fontsel_glob = lesstif_show_layer(lid, "Pen font selection", 0); - fontsel_glob->ctx.dialog_draw = pcb_stub_draw_fontsel; - fontsel_glob->mouse_ev = pcb_stub_draw_fontsel_mouse_ev; - fontsel_glob->overlay_draw = NULL; - fontsel_glob->pre_close = fontsel_pre_close_glob; - } -} - - -static PreviewData *fontsel_loc = NULL; - - -static void fontsel_pre_close_loc(struct PreviewData *pd) -{ - if (pd == fontsel_loc) - fontsel_loc = NULL; -} - -static void lesstif_show_fontsel_local(pcb_layer_t *txtly, pcb_text_t *txt, int type) -{ - pcb_layer_id_t lid; - pcb_text_t *old_txt; - pcb_layer_t *old_layer; - int old_type; - - if (pcb_layer_list(PCB, PCB_LYT_DIALOG, &lid, 1) <= 0) - return; - - old_txt = *pcb_stub_draw_fontsel_text_obj; - old_layer = *pcb_stub_draw_fontsel_layer_obj; - old_type = *pcb_stub_draw_fontsel_text_type; - - *pcb_stub_draw_fontsel_text_obj = txt; - *pcb_stub_draw_fontsel_layer_obj = txtly; - *pcb_stub_draw_fontsel_text_type = type; - - fontsel_loc = lesstif_show_layer(lid, "Change font of text object", 1); - fontsel_loc->mouse_ev = pcb_stub_draw_fontsel_mouse_ev; - fontsel_loc->overlay_draw = NULL; - fontsel_loc->pre_close = fontsel_pre_close_loc; - - - while (fontsel_loc != NULL) { - XEvent e; - XtAppNextEvent(app_context, &e); - XtDispatchEvent(&e); - } - - *pcb_stub_draw_fontsel_text_obj = old_txt; - *pcb_stub_draw_fontsel_layer_obj = old_layer; - *pcb_stub_draw_fontsel_text_type = old_type; -} - -void lesstif_show_fontsel_edit(pcb_layer_t *txtly, pcb_text_t *txt, int type) -{ - if (txt == NULL) - lesstif_show_fontsel_global(); - else - lesstif_show_fontsel_local(txtly, txt, type); -} - Index: trunk/src_plugins/hid_lesstif/hid_lesstif.pup =================================================================== --- trunk/src_plugins/hid_lesstif/hid_lesstif.pup (revision 21361) +++ trunk/src_plugins/hid_lesstif/hid_lesstif.pup (revision 21362) @@ -5,7 +5,6 @@ $package hid-lesstif default buildin dep draw_csect -dep draw_fontsel dep lib_hid_common dep dialogs autoload 1 Index: trunk/src_plugins/lib_gtk_common/dlg_fontsel.c =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_fontsel.c (revision 21361) +++ trunk/src_plugins/lib_gtk_common/dlg_fontsel.c (nonexistent) @@ -1,129 +0,0 @@ -/* - * COPYRIGHT - * - * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2017 Tibor 'Igor2' Palinkas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact: - * Project page: http://repo.hu/projects/pcb-rnd - * lead developer: http://repo.hu/projects/pcb-rnd/contact.html - * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") - * - */ - -#include "config.h" - -#include "dlg_fontsel.h" -#include "compat.h" -#include "bu_box.h" -#include "layer.h" -#include "wt_preview.h" -#include "stub_draw.h" - -typedef struct { - GtkDialog *dialog; - pcb_text_t *txt, *old_txt; - pcb_layer_t *layer, *old_layer; - int old_type; -} pcb_gtk_dlg_fontsel_t; - -static int dlg_fontsel_global_latch = 0; - -static void fontsel_close_cb(gpointer ctx_) -{ - pcb_gtk_dlg_fontsel_t *ctx = ctx_; - gtk_widget_destroy(GTK_WIDGET(ctx->dialog)); - if (ctx->txt == NULL) - dlg_fontsel_global_latch = 0; - *pcb_stub_draw_fontsel_text_obj = ctx->old_txt; - *pcb_stub_draw_fontsel_layer_obj = ctx->old_layer; - *pcb_stub_draw_fontsel_text_type = ctx->old_type; - free(ctx); -} - - -void pcb_gtk_dlg_fontsel(pcb_gtk_common_t *com, pcb_layer_t *txtly, pcb_text_t *txt, int type, int modal) -{ - GtkWidget *w; - GtkDialog *dialog; - GtkWidget *content_area, *prv; - GtkWidget *vbox; - pcb_gtk_dlg_fontsel_t *ctx; - - if (txt == NULL) { - if (dlg_fontsel_global_latch) /* do not open the global font selector twice */ - return; - dlg_fontsel_global_latch = 1; - } - else { - if (type != PCB_OBJ_TEXT) - return; - if (!modal) { - pcb_message(PCB_MSG_ERROR, "text-targeted fontsel dialogs must be modal because of the global-var API on the txt object.\n"); - return; - } - } - - - ctx = malloc(sizeof(pcb_gtk_dlg_fontsel_t)); - ctx->txt = txt; - - ctx->old_txt = *pcb_stub_draw_fontsel_text_obj; - ctx->old_layer = *pcb_stub_draw_fontsel_layer_obj; - ctx->old_type = *pcb_stub_draw_fontsel_text_type; - *pcb_stub_draw_fontsel_text_obj = txt; - *pcb_stub_draw_fontsel_layer_obj = txtly; - *pcb_stub_draw_fontsel_text_type = type; - - w = gtk_dialog_new_with_buttons("PCB - font selector", - GTK_WINDOW(com->top_window), - GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_NONE, NULL); - ctx->dialog = dialog = GTK_DIALOG(w); - gtk_dialog_set_default_response(dialog, GTK_RESPONSE_CLOSE); - - gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); - - g_signal_connect_swapped(G_OBJECT(dialog), "response", G_CALLBACK(fontsel_close_cb), ctx); - gtk_window_set_role(GTK_WINDOW(w), "PCB_Dialog"); - - content_area = gtk_dialog_get_content_area(dialog); - - vbox = gtkc_vbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(content_area), vbox, TRUE, TRUE, 0); - - /* create the preview render */ - { - pcb_gtk_preview_t *p; - pcb_box_t b; - prv = pcb_gtk_preview_dialog_new(com, com->init_drawing_widget, com->preview_expose, pcb_stub_draw_fontsel); - gtk_box_pack_start(GTK_BOX(vbox), prv, TRUE, TRUE, 0); - p = (pcb_gtk_preview_t *) prv; - b.X1 = b.Y1 = 0; - b.X2 = PCB_MM_TO_COORD(50); - b.Y2 = PCB_MM_TO_COORD(50); - - pcb_gtk_preview_zoomto(p, &b); - - p->mouse_cb = pcb_stub_draw_fontsel_mouse_ev; -/* p->overlay_draw_cb = pcb_stub_draw_csect_overlay;*/ - gtk_widget_set_size_request(prv, 200, 200); - } - - - gtk_widget_show_all(w); - gtk_window_set_modal(GTK_WINDOW(dialog), modal); -} Index: trunk/src_plugins/lib_gtk_common/dlg_fontsel.h =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_fontsel.h (revision 21361) +++ trunk/src_plugins/lib_gtk_common/dlg_fontsel.h (nonexistent) @@ -1,8 +0,0 @@ -#include -#include "global_typedefs.h" -#include "hid.h" -#include "glue.h" - -/* type is PCB_OBJ_TEXT or PCB_OBJ_ELEMENT_NAME */ -void pcb_gtk_dlg_fontsel(pcb_gtk_common_t *com, pcb_layer_t *txtly, pcb_text_t *txt, int type, int modal); - Index: trunk/src_plugins/lib_gtk_common/Plug.tmpasm =================================================================== --- trunk/src_plugins/lib_gtk_common/Plug.tmpasm (revision 21361) +++ trunk/src_plugins/lib_gtk_common/Plug.tmpasm (revision 21362) @@ -23,7 +23,6 @@ $(PLUGDIR)/lib_gtk_common/bu_command.o $(PLUGDIR)/lib_gtk_common/dlg_confirm.o $(PLUGDIR)/lib_gtk_common/dlg_file_chooser.o - $(PLUGDIR)/lib_gtk_common/dlg_fontsel.o $(PLUGDIR)/lib_gtk_common/dlg_input.o $(PLUGDIR)/lib_gtk_common/dlg_library.o $(PLUGDIR)/lib_gtk_common/dlg_library_param.o Index: trunk/src_plugins/lib_gtk_common/dlg_topwin.c =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_topwin.c (revision 21361) +++ trunk/src_plugins/lib_gtk_common/dlg_topwin.c (revision 21362) @@ -58,7 +58,6 @@ #include "bu_icons.h" #include "bu_info_bar.h" #include "dlg_route_style.h" -#include "dlg_fontsel.h" #include "util_str.h" #include "util_listener.h" #include "in_mouse.h" Index: trunk/src_plugins/lib_gtk_hid/actions.c =================================================================== --- trunk/src_plugins/lib_gtk_hid/actions.c (revision 21361) +++ trunk/src_plugins/lib_gtk_hid/actions.c (revision 21362) @@ -47,7 +47,6 @@ #include "../src_plugins/lib_gtk_common/dlg_log.h" #include "../src_plugins/lib_gtk_common/dlg_netlist.h" #include "../src_plugins/lib_gtk_common/dlg_search.h" -#include "../src_plugins/lib_gtk_common/dlg_fontsel.h" #include "../src_plugins/lib_gtk_config/lib_gtk_config.h" #include "actions.h" @@ -67,37 +66,6 @@ return 0; } -static const char pcb_acts_fontsel[] = "FontSel()\n"; -static const char pcb_acth_fontsel[] = "Select the font to draw new text with."; -static fgw_error_t pcb_act_fontsel(fgw_arg_t *res, int argc, fgw_arg_t *argv) -{ - const char *op = NULL; - if (argc > 2) - PCB_ACT_FAIL(fontsel); - - PCB_ACT_MAY_CONVARG(1, FGW_STR, fontsel, op = argv[1].val.str); - - if (op != NULL) { - if (pcb_strcasecmp(op, "Object") == 0) { - pcb_coord_t x, y; - int type; - void *ptr1, *ptr2, *ptr3; - pcb_hid_get_coords(_("Select an Object"), &x, &y, 0); - if ((type = pcb_search_screen(x, y, PCB_CHANGENAME_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_OBJ_VOID) { -/* pcb_undo_save_serial();*/ - pcb_gtk_dlg_fontsel(&ghidgui->common, ptr1, ptr2, type, 1); - } - } - else - PCB_ACT_FAIL(fontsel); - } - else - pcb_gtk_dlg_fontsel(&ghidgui->common, NULL, NULL, 0, 0); - - PCB_ACT_IRES(0); - return 0; -} - /* DOC: command.html */ static fgw_error_t pcb_act_Command(fgw_arg_t *res, int argc, fgw_arg_t *argv) { @@ -377,7 +345,6 @@ pcb_action_t ghid_menu_action_list[] = { {"AdjustStyle", pcb_act_AdjustStyle, pcb_acth_AdjustStyle, pcb_acts_AdjustStyle}, - {"fontsel", pcb_act_fontsel, pcb_acth_fontsel, pcb_acts_fontsel} }; PCB_REGISTER_ACTIONS(ghid_menu_action_list, ghid_act_cookie)