Index: trunk/src/examples/psu.lht =================================================================== --- trunk/src/examples/psu.lht (revision 1315) +++ trunk/src/examples/psu.lht (revision 1316) @@ -82,6 +82,17 @@ } } + ha:group.50 { + li:objects { + ha:line.51 { x1=21000; y1=16000; x2=21000; y2=13000; pen=3; } + } + ha:attrib { + uid=xxxxx3 + role=wire-net + name=net123 + } + } + ha:connection.40 { li:conn {/2/30/31;/2/20/20/1;} } Index: trunk/src/plugins/std_tools/std_tools.c =================================================================== --- trunk/src/plugins/std_tools/std_tools.c (revision 1315) +++ trunk/src/plugins/std_tools/std_tools.c (revision 1316) @@ -40,8 +40,9 @@ static const char std_tools_cookie[] = "std_tools"; #include "line_common.c" +#include "tool_circle.c" +#include "tool_wirenet.c" #include "tool_line.c" -#include "tool_wirenet.c" #include "tool_arrow.c" #include "tool_remove.c" @@ -55,6 +56,7 @@ int pplg_init_std_tools(void) { rnd_tool_reg(&sch_rnd_tool_arrow, std_tools_cookie); + rnd_tool_reg(&sch_rnd_tool_circle, std_tools_cookie); rnd_tool_reg(&sch_rnd_tool_line, std_tools_cookie); rnd_tool_reg(&sch_rnd_tool_wirenet, std_tools_cookie); rnd_tool_reg(&sch_rnd_tool_remove, std_tools_cookie); Index: trunk/src/plugins/std_tools/tool_circle.c =================================================================== --- trunk/src/plugins/std_tools/tool_circle.c (nonexistent) +++ trunk/src/plugins/std_tools/tool_circle.c (revision 1316) @@ -0,0 +1,120 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - standard tools + * Copyright (C) 2022 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/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + +static void tool_circle_init(void) +{ +} + +static void tool_circle_uninit(void) +{ +} + +static void tool_circle_press(rnd_hidlib_t *hl) +{ +} + +static void tool_circle_release(rnd_hidlib_t *hl) +{ +} + +static void tool_circle_adjust_attached_objects(rnd_hidlib_t *hl) +{ +} + + +static void tool_circle_draw_attached(rnd_hidlib_t *hl) +{ + csch_sheet_t *sheet = (csch_sheet_t *)hl; +TODO("when editing symbol, use the symbol deco style"); +} + +rnd_bool tool_circle_undo_act(rnd_hidlib_t *hl) +{ + +} + +rnd_bool tool_circle_redo_act(rnd_hidlib_t *hl) +{ + +} + + +static void tool_circle_escape(rnd_hidlib_t *hl) +{ +#if 0 + if (!csch_tool_circle.clicked) + rnd_tool_select_by_name(hl, "arrow"); + else + rnd_tool_select_by_name(hl, "line"); +#endif +} + + +/* XPM */ +static const char *circle_icon[] = { +/* columns rows colors chars-per-pixel */ +"21 21 4 1", +" c #000000", +". c #7A8584", +"X c #6EA5D7", +"O c None", +/* pixels */ +"OOOOOOOOO...OOOOOOOOO", +"OOOOOOO..OOO..OOOOOOO", +"OOOOOO.OOOOOOO.OOOOOO", +"OOOOOO.OOOOOOO.OOOOOO", +"OOOOO.OOOOxOOOO.OOOOO", +"OOOOO.OOOxxxOOO.OOOOO", +"OOOOO.OOOOxOOOO.OOOOO", +"OOOOOO.OOOOOOO.OOOOOO", +"OOOOOO.OOOOOOO.OOOOOO", +"OOOOOOO..OOO..OOOOOOO", +"OOOOOOOOO...OOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO", +" O O OOO O", +" OOOOO OO OOO OO OOOO", +" OOOOO OO OOO OO OOOO", +" OOOOO OO OOO OO OOOO", +" OOOOO OO OOO OOOO", +" OOOOO OO OO OOO OOOO", +" OOOOO OO OOO OO OOOO", +" O O OOO OO O", +"OOOOOOOOOOOOOOOOOOOOO" +}; + + +static rnd_tool_t sch_rnd_tool_circle = { + "circle", NULL, std_tools_cookie, 100, circle_icon, RND_TOOL_CURSOR_NAMED("question_arrow"), 0, + tool_circle_init, + tool_circle_uninit, + tool_circle_press, + tool_circle_release, + tool_circle_adjust_attached_objects, + tool_circle_draw_attached, + tool_circle_undo_act, + tool_circle_redo_act, + tool_circle_escape +}; Index: trunk/src/sch-rnd/Makefile.dep =================================================================== --- trunk/src/sch-rnd/Makefile.dep (revision 1315) +++ trunk/src/sch-rnd/Makefile.dep (revision 1316) @@ -190,9 +190,9 @@ ../plugins/std_tools/line_common.c ../libcschem/cnc_line.h \ ../libcschem/cnc_pen.h ../libcschem/operation.h ../libcschem/concrete.h \ ../libcschem/util_wirenet.h ../sch-rnd/crosshair.h \ - ../sch-rnd/conf_core.h ../plugins/std_tools/tool_line.c \ - ../plugins/std_tools/tool_wirenet.c ../plugins/std_tools/tool_arrow.c \ - ../plugins/std_tools/tool_remove.c + ../sch-rnd/conf_core.h ../plugins/std_tools/tool_circle.c \ + ../plugins/std_tools/tool_wirenet.c ../plugins/std_tools/tool_line.c \ + ../plugins/std_tools/tool_arrow.c ../plugins/std_tools/tool_remove.c conf_core.o: conf_core.c conf_core.h conf_core_fields.h crosshair.o: crosshair.c conf_core.h crosshair.h ../libcschem/config.h draw.o: draw.c ../libcschem/concrete.h ../libcschem/common_types.h \ Index: trunk/src/sch-rnd/menu-default.lht =================================================================== --- trunk/src/sch-rnd/menu-default.lht (revision 1315) +++ trunk/src/sch-rnd/menu-default.lht (revision 1316) @@ -35,8 +35,9 @@ # not pick up keys from this subtree. There's also no action here: the # plugin handling this subtree will always pick the tool. li:toolbar_static { + ha:circle {tip={draw a circle (atomic, drawing primitive)}} + ha:wirenet {tip={draw a line segment for a network (wire-net)}} ha:line {tip={draw a line (atomic, drawing primitive)}} - ha:wirenet {tip={draw a line segment for a network (wire-net)}} ha:remove {tip={remove object at location clicked}} ha:arrow {tip={switch to arrow mode}} } @@ -91,8 +92,9 @@ } ha:Tool { li:submenu { - ha:Line = { checked=ChkMode(line); li:a={{t;l};{F1};}; action=Tool(line); update_on={editor/mode} } + ha:Circle = { checked=ChkMode(circle); li:a={{t;l};{F1};}; action=Tool(curcle); update_on={editor/mode} } ha:Wirenet = { checked=ChkMode(wirenet); li:a={{t;a};{F2};}; action=Tool(wirenet); update_on={editor/mode} } + ha:Line = { checked=ChkMode(line); li:a={{t;l};{F3};}; action=Tool(line); update_on={editor/mode} } ha:Arrow = { checked=ChkMode(arrow); li:a={{t;t};{F11};}; action=Tool(arrow); update_on={editor/mode} } - ha:Escape = { a={Escape}; action=Tool(escape); }