Index: tool_logic.c =================================================================== --- tool_logic.c (revision 29343) +++ tool_logic.c (revision 29344) @@ -41,6 +41,8 @@ #include "tool_logic.h" +static void tool_logic_chg_layer(conf_native_t *cfg, int arr_idx); + /*** Generic part, all rnd apps should do something like this ***/ static char tool_logic_cookie[] = "tool_logic"; @@ -76,6 +78,7 @@ } pcb_event_bind(PCB_EVENT_TOOL_SELECT_PRE, tool_logic_chg_mode, NULL, tool_logic_cookie); + pcb_event_bind(PCB_EVENT_LAYERVIS_CHANGED, tool_logic_chg_layer, NULL, tool_logic_cookie); } void pcb_tool_logic_uninit(void) @@ -87,6 +90,12 @@ /*** pcb-rnd-specific parts ***/ +static void tool_logic_chg_layer(conf_native_t *cfg, int arr_idx) +{ + if (PCB->RatDraw && !pcb_tool_get(pcbhl_conf.editor.mode)->allow_when_drawing_ratlines) + pcb_tool_select_by_name(&PCB->hidlib, "line"); +} + pcb_bool pcb_tool_is_saved = pcb_false; static void get_grid_lock_coordinates(int type, void *ptr1, void *ptr2, void *ptr3, pcb_coord_t * x, pcb_coord_t * y)