Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 38350) +++ trunk/scconfig/Rev.h (revision 38351) @@ -1 +1 @@ -static const int myrev = 38025; +static const int myrev = 38351; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 38350) +++ trunk/scconfig/Rev.tab (revision 38351) @@ -1,3 +1,4 @@ +38351 configure font mode: preview dialog 38025 configure export_bom2: new bom plugin with templates 37808 configure gsch2pcb-rnd removal 36904 configure enable plugin the order and order_pcbway plugins Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 38350) +++ trunk/src/Makefile.dep (revision 38351) @@ -818,7 +818,8 @@ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h draw.h flag.h \ layer.h move.h remove.h operation.h flag_str.h undo.h \ ../src_3rd/libuundo/uundo.h undo_old.h event.h polygon.h obj_poly_draw.h \ - draw.h brave.h + draw.h ../src_plugins/fontmode/preview.h brave.h +../src_plugins/fontmode/preview.o: ../src_plugins/fontmode/preview.c ../src_plugins/fp_board/fp_board.o: ../src_plugins/fp_board/fp_board.c \ ../config.h plug_footprint.h data.h globalconst.h layer.h attrib.h \ global_typedefs.h obj_common.h flag.h data_parent.h obj_arc_list.h \ @@ -2723,7 +2724,15 @@ ../src_plugins/tool_std/tool_thermal.h undo.h \ ../src_3rd/libuundo/uundo.h undo_old.h obj_pstk_draw.h draw.h ../src_plugins/trimesh/trimesh.o: ../src_plugins/trimesh/trimesh.c \ - ../config.h ../src_plugins/lib_polyhelp/triangulate.h \ + ../config.h board.h vtroutestyle.h attrib.h global_typedefs.h layer.h \ + globalconst.h obj_common.h flag.h data_parent.h obj_arc_list.h obj_arc.h \ + obj_line_list.h obj_line.h obj_poly_list.h obj_poly.h obj_text_list.h \ + obj_text.h font.h obj_gfx_list.h obj_gfx.h layer_grp.h rats_patch.h \ + board.h data.h crosshair.h route.h buffer.h obj_rat_list.h obj_rat.h \ + idpath.h obj_subc_list.h obj_subc.h ../src_3rd/libminuid/libminuid.h \ + ht_subc.h obj_pstk_list.h obj_pstk.h vtpadstack.h obj_pstk_shape.h \ + polygon.h vtpadstack_t.h flag.h obj_line.h \ + ../src_plugins/lib_polyhelp/triangulate.h \ ../src_3rd/fast89-poly2tri/fast89_poly2tri.h ../src_plugins/vendordrill/vendor.o: ../src_plugins/vendordrill/vendor.c \ ../config.h conf_core.h globalconst.h change.h board.h vtroutestyle.h \ Index: trunk/src_plugins/fontmode/Plug.tmpasm =================================================================== --- trunk/src_plugins/fontmode/Plug.tmpasm (revision 38350) +++ trunk/src_plugins/fontmode/Plug.tmpasm (revision 38351) @@ -1,5 +1,8 @@ put /local/rnd/mod {fontmode} -put /local/rnd/mod/OBJS [@ $(PLUGDIR)/fontmode/fontmode.o @] +put /local/rnd/mod/OBJS [@ + $(PLUGDIR)/fontmode/fontmode.o + $(PLUGDIR)/fontmode/preview.o +@] switch /local/module/fontmode/controls case {buildin} include /local/pcb/tmpasm/buildin; end; Index: trunk/src_plugins/fontmode/fontmode.c =================================================================== --- trunk/src_plugins/fontmode/fontmode.c (revision 38350) +++ trunk/src_plugins/fontmode/fontmode.c (revision 38351) @@ -58,6 +58,7 @@ #include "event.h" #include "polygon.h" #include "obj_poly_draw.h" +#include "preview.h" /* FIXME - we currently hardcode the grid and PCB size. What we should do in the future is scan the font for its extents, and size @@ -715,7 +716,8 @@ {"FontXform", pcb_act_FontXform, pcb_acth_FontXform, pcb_acts_FontXform}, {"FontSetXdelta", pcb_act_FontSetXdelta, pcb_acth_FontSetXdelta, pcb_acts_FontSetXdelta}, {"FontNormalize", pcb_act_FontNormalize, pcb_acth_FontNormalize, pcb_acts_FontNormalize}, - {"FontBaseline", pcb_act_FontBaseline, pcb_acth_FontBaseline, pcb_acts_FontBaseline} + {"FontBaseline", pcb_act_FontBaseline, pcb_acth_FontBaseline, pcb_acts_FontBaseline}, + {"FontModePreview", pcb_act_FontModePreview, pcb_acth_FontModePreview, pcb_acts_FontModePreview} }; static const char *fontmode_cookie = "fontmode plugin"; Index: trunk/src_plugins/fontmode/preview.c =================================================================== --- trunk/src_plugins/fontmode/preview.c (nonexistent) +++ trunk/src_plugins/fontmode/preview.c (revision 38351) @@ -0,0 +1,69 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design - font editor preview dlg + * Copyright (C) 2023 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 +#include + +typedef struct{ + RND_DAD_DECL_NOINIT(dlg) + int active; /* already open - allow only one instance */ +} fmprv_ctx_t; + +fmprv_ctx_t fmprv_ctx; + +static void fmprv_close_cb(void *caller_data, rnd_hid_attr_ev_t ev) +{ + fmprv_ctx_t *ctx = caller_data; + RND_DAD_FREE(ctx->dlg); + memset(ctx, 0, sizeof(fmprv_ctx_t)); /* reset all states to the initial - includes ctx->active = 0; */ +} + +static void pcb_dlg_fontmode_preview(void) +{ + rnd_hid_dad_buttons_t clbtn[] = {{"Close", 0}, {NULL, 0}}; + + if (fmprv_ctx.active) + return; /* do not open another */ + + RND_DAD_BEGIN_VBOX(fmprv_ctx.dlg); + RND_DAD_COMPFLAG(fmprv_ctx.dlg, RND_HATF_EXPFILL); + RND_DAD_LABEL(fmprv_ctx.dlg, "fmprv"); + RND_DAD_BUTTON_CLOSES(fmprv_ctx.dlg, clbtn); + RND_DAD_END(fmprv_ctx.dlg); + + /* set up the context */ + fmprv_ctx.active = 1; + + RND_DAD_NEW("font_mode_preview", fmprv_ctx.dlg, "Font editor: preview", &fmprv_ctx, rnd_false, fmprv_close_cb); +} + +const char pcb_acts_FontModePreview[] = "FontModePreview()\n"; +const char pcb_acth_FontModePreview[] = "Open the font mode preview dialog that also helps editing font tables"; +fgw_error_t pcb_act_FontModePreview(fgw_arg_t *res, int argc, fgw_arg_t *argv) +{ + pcb_dlg_fontmode_preview(); + return 0; +} Index: trunk/src_plugins/fontmode/preview.h =================================================================== --- trunk/src_plugins/fontmode/preview.h (nonexistent) +++ trunk/src_plugins/fontmode/preview.h (revision 38351) @@ -0,0 +1,3 @@ +extern const char pcb_acts_FontModePreview[]; +extern const char pcb_acth_FontModePreview[]; +fgw_error_t pcb_act_FontModePreview(fgw_arg_t *res, int argc, fgw_arg_t *argv);