Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 11156) +++ trunk/scconfig/Rev.h (revision 11157) @@ -1 +1 @@ -static const int myrev = 11136; +static const int myrev = 11157; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 11156) +++ trunk/scconfig/Rev.tab (revision 11157) @@ -1,5 +1,5 @@ +11157 configure extobj infrastructure 11136 configure attbl plugins -10859 configure extobj infrastructure 10786 configure new dialog box: viewport 10577 configure new IO plugins: io_eeschema and io_easyeda 10230 configure new plugin for hierarchic library from file system Index: trunk/src/libcschem/extobj.c =================================================================== --- trunk/src/libcschem/extobj.c (revision 11156) +++ trunk/src/libcschem/extobj.c (revision 11157) @@ -30,15 +30,11 @@ #include #include #include -#include -#include #include "cnc_grp.h" #include "extobj.h" -static const char extobj_cookie[] = "extobj"; - /* persistent copy of impl; both key and value are allocated; on unregister a zombie impl is kept with all fields (including name) set to NULL */ htsp_t extobjs_impls; @@ -134,81 +130,11 @@ return gfx; } -static const char csch_acts_Extobj[] = "Extobj(Object|Selected, Update|Edit)"; -static const char csch_acth_Extobj[] = "Standard extended object operations on a single object (under the cursor) or selected objects."; -fgw_error_t csch_act_Extobj(fgw_arg_t *res, int argc, fgw_arg_t *argv) -{ - const char *scope, *cmd; - enum {SC_INVALID, SC_OBJ, SC_SEL} sc = SC_INVALID; - enum {OP_INVALID, OP_UPDATE, OP_EDIT} op = OP_INVALID; - int want_extobj = 1; /* search only for extended objects for objs.array[] */ - vtp0_t objs = {0}; - - RND_ACT_IRES(1); - - /* we don't have funchash in libcschem, only in sch-rnd */ - RND_ACT_MAY_CONVARG(1, FGW_STR, Extobj, scope = argv[1].val.str); - RND_ACT_MAY_CONVARG(2, FGW_STR, Extobj, cmd = argv[2].val.str); - - switch(*scope) { - case 'o': case 'O': if (rnd_strcasecmp(scope, "object") == 0) sc = SC_OBJ; break; - case 's': case 'S': if (rnd_strcasecmp(scope, "selected") == 0) sc = SC_SEL; break; - } - - switch(*cmd) { - case 'u': case 'U': if (rnd_strcasecmp(scope, "update") == 0) op = OP_UPDATE; break; - case 'e': case 'E': if (rnd_strcasecmp(scope, "edit") == 0) op = OP_EDIT; break; - } - - switch(sc) { - case SC_OBJ: - break; - case SC_SEL: - break; - default: - rnd_message(RND_MSG_ERROR, "Extobj(): invalid scope '%s'\n", scope); - return 0; /* IRES is set to 1 */ - } - - if (objs.used == 0) { - rnd_message(RND_MSG_ERROR, "Extobj(): no suitable object found in scope '%s'\n", scope); - return 0; /* IRES is set to 1 */ - } - - switch(op) { - case OP_UPDATE: - RND_ACT_IRES(0); - return 0; - case OP_EDIT: - RND_ACT_IRES(0); - return 0; - default: - rnd_message(RND_MSG_ERROR, "Extobj(): invalid command '%s'\n", cmd); - break; - } - - return 0; /* IRES is set to 1 */ -} - -static rnd_action_t csch_extobj_act_list[] = { - {"Extobj", csch_act_Extobj, csch_acth_Extobj, csch_acts_Extobj} -}; - -void csch_extobj_act_init(void) -{ - RND_REGISTER_ACTIONS(csch_extobj_act_list, extobj_cookie); -} - void csch_extobj_init(void) { htsp_init(&extobjs_impls, strhash, strkeyeq); } -void csch_extobj_act_uninit(void) -{ - rnd_remove_actions_by_cookie(extobj_cookie); -} - void csch_extobj_uninit(void) { htsp_entry_t *e; Index: trunk/src/libcschem/extobj.h =================================================================== --- trunk/src/libcschem/extobj.h (revision 11156) +++ trunk/src/libcschem/extobj.h (revision 11157) @@ -59,9 +59,7 @@ /*** internal, do not call ***/ void csch_extobj_init(void); -void csch_extobj_act_init(void); void csch_extobj_uninit(void); -void csch_extobj_act_uninit(void); const csch_extobj_impl_t *csch_extobj_lookup(const char *name); /*** implementation ***/ Index: trunk/src/libcschem/libcschem.c =================================================================== --- trunk/src/libcschem/libcschem.c (revision 11156) +++ trunk/src/libcschem/libcschem.c (revision 11157) @@ -69,7 +69,6 @@ { csch_project_uninit(); csch_project_act_uninit(); - csch_extobj_act_uninit(); csch_integrity_act_uninit(); csch_drc_act_uninit(); csch_undo_act_uninit(); @@ -91,7 +90,6 @@ csch_drc_act_init(); csch_undo_act_init(); csch_project_init(); - csch_extobj_act_init(); return 0; } Index: trunk/src/sch-rnd/Makefile.in =================================================================== --- trunk/src/sch-rnd/Makefile.in (revision 11156) +++ trunk/src/sch-rnd/Makefile.in (revision 11157) @@ -25,6 +25,7 @@ draw_xor.o emergency.o export.o + extobj_act.o file_act.o font.o plug_io_act.o Index: trunk/src/sch-rnd/extobj_act.c =================================================================== --- trunk/src/sch-rnd/extobj_act.c (nonexistent) +++ trunk/src/sch-rnd/extobj_act.c (revision 11157) @@ -0,0 +1,123 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2024 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; 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/sch-rnd + * contact lead developer: http://www.repo.hu/projects/sch-rnd/contact.html + * mailing list: http://www.repo.hu/projects/sch-rnd/contact.html + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include + +#include "libcschem/cnc_grp.h" +#include "libcschem/extobj.h" + +#include "extobj_act.h" + +static const char extobj_cookie[] = "extobj"; + +static const char csch_acts_Extobj[] = "Extobj(Object|Selected, Update|Edit)"; +static const char csch_acth_Extobj[] = "Standard extended object operations on a single object (under the cursor) or selected objects."; +fgw_error_t csch_act_Extobj(fgw_arg_t *res, int argc, fgw_arg_t *argv) +{ + csch_sheet_t *sheet = CSCH_ACT_SHEET; + const char *scope, *cmd; + enum {SC_INVALID, SC_OBJ, SC_SEL} sc = SC_INVALID; + enum {OP_INVALID, OP_UPDATE, OP_EDIT} op = OP_INVALID; + int want_extobj = 1; /* search only for extended objects for objs.array[] */ + vtp0_t objs = {0}; + csch_chdr_t *cobj; + + RND_ACT_IRES(1); + + /* we don't have funchash in libcschem, only in sch-rnd */ + RND_ACT_MAY_CONVARG(1, FGW_STR, Extobj, scope = argv[1].val.str); + RND_ACT_MAY_CONVARG(2, FGW_STR, Extobj, cmd = argv[2].val.str); + + switch(*scope) { + case 'o': case 'O': if (rnd_strcasecmp(scope, "object") == 0) sc = SC_OBJ; break; + case 's': case 'S': if (rnd_strcasecmp(scope, "selected") == 0) sc = SC_SEL; break; + } + + switch(*cmd) { + case 'u': case 'U': if (rnd_strcasecmp(scope, "update") == 0) op = OP_UPDATE; break; + case 'e': case 'E': if (rnd_strcasecmp(scope, "edit") == 0) op = OP_EDIT; break; + } + + switch(sc) { + case SC_OBJ: + if (want_extobj) { +#if 0 + csch_rtree_box_t qb; + qb.x1 = + cobj = csch_search_first_gui_inspect_filter(sheet, csch_rtree_box_t *query, csch_search_obj_ignore_cb_t ignore); +#endif + } + + + break; + case SC_SEL: + break; + default: + rnd_message(RND_MSG_ERROR, "Extobj(): invalid scope '%s'\n", scope); + return 0; /* IRES is set to 1 */ + } + + if (objs.used == 0) { + rnd_message(RND_MSG_ERROR, "Extobj(): no suitable object found in scope '%s'\n", scope); + return 0; /* IRES is set to 1 */ + } + + switch(op) { + case OP_UPDATE: + RND_ACT_IRES(0); + return 0; + case OP_EDIT: + RND_ACT_IRES(0); + return 0; + default: + rnd_message(RND_MSG_ERROR, "Extobj(): invalid command '%s'\n", cmd); + break; + } + + return 0; /* IRES is set to 1 */ +} + +static rnd_action_t csch_extobj_act_list[] = { + {"Extobj", csch_act_Extobj, csch_acth_Extobj, csch_acts_Extobj} +}; + +void sch_rnd_extobj_act_init(void) +{ + RND_REGISTER_ACTIONS(csch_extobj_act_list, extobj_cookie); +} + +void sch_rnd_extobj_act_uninit(void) +{ + rnd_remove_actions_by_cookie(extobj_cookie); +} + Index: trunk/src/sch-rnd/extobj_act.h =================================================================== --- trunk/src/sch-rnd/extobj_act.h (nonexistent) +++ trunk/src/sch-rnd/extobj_act.h (revision 11157) @@ -0,0 +1,2 @@ +void sch_rnd_extobj_act_init(void); +void sch_rnd_extobj_act_uninit(void); Index: trunk/src/sch-rnd/sch-rnd.c =================================================================== --- trunk/src/sch-rnd/sch-rnd.c (revision 11156) +++ trunk/src/sch-rnd/sch-rnd.c (revision 11157) @@ -71,6 +71,7 @@ #include "project.h" #include "multi.h" #include "plug_io_act.h" +#include "extobj_act.h" #include "export.h" csch_chdr_t *csch_obj_clicked = NULL; @@ -274,6 +275,7 @@ sch_rnd_file_act_init2(); sch_rnd_font_act_init2(); sch_rnd_select_act_init2(); + sch_rnd_extobj_act_init(); sch_rnd_font_init2(); sch_rnd_draw_init2(); sch_rnd_buffer_init2(); @@ -310,6 +312,7 @@ sch_rnd_multi_uninit(); rnd_funchash_uninit(); csch_plug_io_act_uninit(); + sch_rnd_extobj_act_uninit(); csch_uninit(); sch_rnd_draw_uninit(); sch_rnd_font_uninit();