Index: trunk/src/stub_draw.c =================================================================== --- trunk/src/stub_draw.c (revision 7132) +++ trunk/src/stub_draw.c (revision 7133) @@ -93,8 +93,10 @@ static pcb_text_t *dummy_fontsel_text = NULL; static pcb_layer_t *dummy_fontsel_layer = NULL; +static int dummy_fontsel_type = 0; void (*pcb_stub_draw_fontsel)(pcb_hid_gc_t gc) = dummy_draw_fontsel; pcb_bool (*pcb_stub_draw_fontsel_mouse_ev)(void *widget, pcb_hid_mouse_ev_t kind, pcb_coord_t x, pcb_coord_t y) = dummy_mouse; pcb_text_t **pcb_stub_draw_fontsel_text_obj = &dummy_fontsel_text; pcb_layer_t **pcb_stub_draw_fontsel_layer_obj = &dummy_fontsel_layer; +int *pcb_stub_draw_fontsel_text_type = &dummy_fontsel_type; Index: trunk/src/stub_draw.h =================================================================== --- trunk/src/stub_draw.h (revision 7132) +++ trunk/src/stub_draw.h (revision 7133) @@ -47,5 +47,6 @@ extern pcb_bool (*pcb_stub_draw_fontsel_mouse_ev)(void *widget, pcb_hid_mouse_ev_t kind, pcb_coord_t x, pcb_coord_t y); extern pcb_text_t **pcb_stub_draw_fontsel_text_obj; extern pcb_layer_t **pcb_stub_draw_fontsel_layer_obj; +extern int *pcb_stub_draw_fontsel_text_type; #endif Index: trunk/src_plugins/draw_fontsel/draw_fontsel.c =================================================================== --- trunk/src_plugins/draw_fontsel/draw_fontsel.c (revision 7132) +++ trunk/src_plugins/draw_fontsel/draw_fontsel.c (revision 7133) @@ -34,6 +34,7 @@ #include "data.h" #include "draw.h" #include "font.h" +#include "const.h" #include "hid_actions.h" #include "obj_all.h" #include "plugins.h" @@ -103,6 +104,7 @@ pcb_text_t *fontsel_txt = NULL; pcb_layer_t *fontsel_layer = NULL; +int fontsel_txt_type = 0; static void pcb_draw_font(pcb_hid_gc_t gc, pcb_font_t *f, int x, int *y) { @@ -193,7 +195,14 @@ conf_set(CFR_DESIGN, "design/text_font_id", 0, sval, POL_OVERWRITE); } else { - pcb_text_set_font(fontsel_layer, fontsel_txt, fid); + switch(fontsel_txt_type) { + case PCB_TYPE_TEXT: + pcb_text_set_font(fontsel_layer, fontsel_txt, fid); + break; + case PCB_TYPE_ELEMENT_NAME: + pcb_message(PCB_MSG_ERROR, "Can't change element name font yet\n"); + break; + } pcb_gui->invalidate_all(); } return 1; @@ -225,6 +234,7 @@ pcb_stub_draw_fontsel_mouse_ev = pcb_mouse_fontsel; pcb_stub_draw_fontsel_text_obj = &fontsel_txt; pcb_stub_draw_fontsel_layer_obj = &fontsel_layer; + pcb_stub_draw_fontsel_text_type = &fontsel_txt_type; return hid_draw_fontsel_uninit; } Index: trunk/src_plugins/hid_gtk/gui-top-window.c =================================================================== --- trunk/src_plugins/hid_gtk/gui-top-window.c (revision 7132) +++ trunk/src_plugins/hid_gtk/gui-top-window.c (revision 7133) @@ -1739,7 +1739,7 @@ pcb_gui->get_coords(_("Select an Object"), &x, &y); if ((type = pcb_search_screen(x, y, PCB_CHANGENAME_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) { /* pcb_undo_save_serial();*/ - pcb_gtk_dlg_fontsel(gport, gport->top_window, ptr1, ptr2, 1); + pcb_gtk_dlg_fontsel(gport, gport->top_window, ptr1, ptr2, type, 1); } } else @@ -1746,7 +1746,7 @@ PCB_ACT_FAIL(fontsel); } else - pcb_gtk_dlg_fontsel(gport, gport->top_window, NULL, NULL, 0); + pcb_gtk_dlg_fontsel(gport, gport->top_window, NULL, NULL, 0, 0); return 0; } Index: trunk/src_plugins/lib_gtk_common/dlg_fontsel.c =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_fontsel.c (revision 7132) +++ trunk/src_plugins/lib_gtk_common/dlg_fontsel.c (revision 7133) @@ -32,11 +32,13 @@ #include "layer.h" #include "wt_preview.h" #include "stub_draw.h" +#include "const.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; @@ -49,11 +51,12 @@ 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(void *gport, GtkWidget *top_window, pcb_layer_t *txtly, pcb_text_t *txt, int modal) +void pcb_gtk_dlg_fontsel(void *gport, GtkWidget *top_window, pcb_layer_t *txtly, pcb_text_t *txt, int type, int modal) { GtkWidget *w; GtkDialog *dialog; @@ -68,6 +71,8 @@ dlg_fontsel_global_latch = 1; } else { + if ((type != PCB_TYPE_TEXT) && (type != PCB_TYPE_ELEMENT_NAME)) + 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; @@ -80,8 +85,10 @@ 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(top_window), Index: trunk/src_plugins/lib_gtk_common/dlg_fontsel.h =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_fontsel.h (revision 7132) +++ trunk/src_plugins/lib_gtk_common/dlg_fontsel.h (revision 7133) @@ -2,7 +2,8 @@ #include "global_typedefs.h" #include "hid.h" -void pcb_gtk_dlg_fontsel(void *gport, GtkWidget *top_window, pcb_layer_t *txtly, pcb_text_t *txt, int modal); +/* type is PCB_TYPE_TEXT or PCB_TYPE_ELEMENT_NAME */ +void pcb_gtk_dlg_fontsel(void *gport, GtkWidget *top_window, pcb_layer_t *txtly, pcb_text_t *txt, int type, int modal); /* temporary back reference to hid_gtk: */ extern void ghid_init_drawing_widget(GtkWidget *widget, void *gport);