Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 7021) +++ trunk/scconfig/Rev.h (revision 7022) @@ -1 +1 @@ -static const int myrev = 6980; +static const int myrev = 7022; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 7021) +++ trunk/scconfig/Rev.tab (revision 7022) @@ -1,3 +1,4 @@ +7022 configure multifont support: new actions 6980 configure gtk splitup: preferences dialog 6924 configure new import plugins 6735 configure gtk splitup Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 7021) +++ trunk/src/Makefile.dep (revision 7022) @@ -3742,6 +3742,21 @@ ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ ../src_3rd/genvector/vtp0.h list_conf.h error.h plug_io.h paths.h \ compat_nls.h compat_misc.h font_internal.c +font_act.o: font_act.c ../config.h board.h const.h macro.h \ + global_typedefs.h pcb_bool.h unit.h vtroutestyle.h attrib.h \ + ../src_3rd/genvector/genvector_impl.h \ + ../src_3rd/genvector/genvector_undef.h layer.h globalconst.h \ + obj_all_list.h obj_arc_list.h obj_common.h \ + ../src_3rd/liblihata/genht/hash.h ../src_3rd/genlist/gendlist.h flag.h \ + obj_arc.h ../src_3rd/genlist/gentdlist_impl.h \ + ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ + obj_elem_list.h obj_elem.h obj_line_list.h obj_line.h obj_pad_list.h \ + obj_pad.h obj_pinvia_list.h obj_pinvia.h obj_text.h font.h \ + ../src_3rd/liblihata/genht/htip.h ../src_3rd/liblihata/genht/ht.h \ + ../src_3rd/liblihata/genht/ht_inlines.h box.h math_helper.h move.h \ + misc_util.h ht_element.h ../src_3rd/liblihata/genht/ht.h obj_poly_list.h \ + obj_poly.h polyarea.h obj_text_list.h obj_rat_list.h obj_rat.h \ + layer_grp.h library.h rats_patch.h hid.h error.h drc.h action_helper.h fptr_cast.o: fptr_cast.c ../config.h fptr_cast.h free_atexit.o: free_atexit.c ../config.h funchash.o: funchash.c ../src_3rd/liblihata/genht/htpi.h \ Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 7021) +++ trunk/src/Makefile.in (revision 7022) @@ -44,6 +44,7 @@ error.o event.o font.o + font_act.o file_act.o find.o find_act.o @@ -172,7 +173,7 @@ # main: action registrations put /local/pcb/ACTION_REG_SRC { action_act.c buffer.c change_act.c conf_act.c file_act.c find_act.c - gui_act.c main_act.c netlist_act.c + gui_act.c main_act.c netlist_act.c font_act.c object_act.c plugins.c polygon_act.c plug_footprint_act.c rats_act.c rats_patch.c remove_act.c select_act.c undo_act.c } Index: trunk/src/font_act.c =================================================================== --- trunk/src/font_act.c (nonexistent) +++ trunk/src/font_act.c (revision 7022) @@ -0,0 +1,80 @@ +/* + * 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 St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "config.h" +#include +#include "board.h" +#include "hid.h" +#include "error.h" +#include "font.h" +#include "action_helper.h" + + +static const char pcb_acts_load_font_from[] = "LoadFontFrom()"; +static const char pcb_acth_load_font_from[] = "Load PCB font from a file"; + +int pcb_act_load_font_from(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +{ + const char *fname, *sid; + static char *default_file = NULL; + pcb_font_id_t fid; + + fname = (argc > 0) ? argv[0] : NULL; + sid = (argc > 1) ? argv[1] : NULL; + + if (sid != NULL) { + char *end; + fid = strtol(sid, &end, 10); + if (*end != '\0') { + pcb_message(PCB_MSG_ERROR, "LoadFontFrom(): when second argument is present, it must be an integer\n"); + return 1; + } + if (pcb_font(PCB, fid, 0) != NULL) { + pcb_message(PCB_MSG_ERROR, "LoadFontFrom(): font ID %d is already taken\n", fid); + return 1; + } + } + else { +#warning TODO: allocate a new + } + + if (!fname || !*fname) { + fname = pcb_gui->fileselect("Load PCB font file...", + "Picks a PCB font file to load.\n", + default_file, ".font", "pcnfont", HID_FILESELECT_READ); + if (fname == NULL) + PCB_ACT_FAIL(load_font_from); + if (default_file != NULL) { + free(default_file); + default_file = NULL; + } + } + + abort(); +} + + +pcb_hid_action_t font_action_list[] = { + {"LoadFontFrom", 0, pcb_act_load_font_from, + pcb_acth_load_font_from, pcb_acts_load_font_from} +}; + +PCB_REGISTER_ACTIONS(font_action_list, NULL)