From 8ce32b73b7ab7abb0e84e2ff5fa6aafd6307b71d Mon Sep 17 00:00:00 2001 From: Chayan Deb Date: Sat, 18 Jan 2025 14:05:29 +0530 Subject: [PATCH] [Code Refactoring]: Modified the source code for compatibility with the upstream repo (due to 'infix_wire' feature integration with new name 'infix_interface') --- src/callback.c | 85 +++++++++++++++++++++++++++++++++----------------- src/xschem.tcl | 8 ++--- 2 files changed, 61 insertions(+), 32 deletions(-) diff --git a/src/callback.c b/src/callback.c index 606f95bb..dc85ca6e 100644 --- a/src/callback.c +++ b/src/callback.c @@ -2202,6 +2202,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key, XKeyboardState kbdstate; #endif int draw_xhair = tclgetboolvar("draw_crosshair"); +int infix_interface = tclgetboolvar("infix_interface"); int rstate; /* (reduced state, without ShiftMask) */ /* this fix uses an alternative method for getting mouse coordinates on KeyPress/KeyRelease @@ -2748,16 +2749,17 @@ int rstate; /* (reduced state, without ShiftMask) */ { int prev_state = xctx->ui_state; if(xctx->semaphore >= 2) break; - if(tclgetboolvar("infix_wire")) { - start_wire(xctx->mousex_snap, xctx->mousey_snap); - } else if(prev_state == STARTWIRE) { + + if(infix_interface) { start_wire(xctx->mousex_snap, xctx->mousey_snap); + if(prev_state == STARTWIRE) { + tcleval("set constr_mv 0"); + xctx->constr_mv = 0; + } } else { - tcleval("xschem wire"); - } - if(prev_state == STARTWIRE) { - tcleval("set constr_mv 0"); - xctx->constr_mv = 0; + xctx->last_command = 0; + xctx->ui_state |= MENUSTART; + xctx->ui_state2 = MENUSTARTWIRE; } break; } @@ -2805,10 +2807,15 @@ int rstate; /* (reduced state, without ShiftMask) */ { if(xctx->semaphore >= 2) break; dbg(1, "callback(): start polygon\n"); - xctx->mx_double_save=xctx->mousex_snap; - xctx->my_double_save=xctx->mousey_snap; - xctx->last_command = 0; - new_polygon(PLACE, xctx->mousex_snap, xctx->mousey_snap); + if(infix_interface) { + xctx->mx_double_save = xctx->mousex_snap; + xctx->my_double_save = xctx->mousey_snap; + xctx->last_command = 0; + new_polygon(PLACE, xctx->mousex_snap, xctx->mousey_snap); + } else { + xctx->ui_state |= MENUSTART; + xctx->ui_state2 = MENUSTARTPOLYGON; + } break; } if(key=='P' && rstate == 0) /* pan, other way to. */ @@ -2957,10 +2964,15 @@ int rstate; /* (reduced state, without ShiftMask) */ if(key=='r' /* && !xctx->ui_state */ && rstate==0) /* start rect */ { dbg(1, "callback(): start rect\n"); - xctx->mx_double_save=xctx->mousex_snap; - xctx->my_double_save=xctx->mousey_snap; - xctx->last_command = 0; - new_rect(PLACE,xctx->mousex_snap, xctx->mousey_snap); + if(infix_interface) { + xctx->mx_double_save=xctx->mousex_snap; + xctx->my_double_save=xctx->mousey_snap; + xctx->last_command = 0; + new_rect(PLACE,xctx->mousex_snap, xctx->mousey_snap); + } else{ + xctx->ui_state |= MENUSTART; + xctx->ui_state2 = MENUSTARTRECT; + } break; } if(key=='V' && rstate == ControlMask) /* toggle spice/vhdl netlist */ @@ -3130,19 +3142,29 @@ int rstate; /* (reduced state, without ShiftMask) */ if(key=='C' /* && !xctx->ui_state */ && rstate == 0) /* place arc */ { if(xctx->semaphore >= 2) break; - xctx->mx_double_save=xctx->mousex_snap; - xctx->my_double_save=xctx->mousey_snap; - xctx->last_command = 0; - new_arc(PLACE, 180., xctx->mousex_snap, xctx->mousey_snap); + if(infix_interface) { + xctx->mx_double_save=xctx->mousex_snap; + xctx->my_double_save=xctx->mousey_snap; + xctx->last_command = 0; + new_arc(PLACE, 180., xctx->mousex_snap, xctx->mousey_snap); + } else { + xctx->ui_state |= MENUSTART; + xctx->ui_state2 = MENUSTARTARC; + } break; } if(key=='C' /* && !xctx->ui_state */ && rstate == ControlMask) /* place circle */ { if(xctx->semaphore >= 2) break; - xctx->mx_double_save=xctx->mousex_snap; - xctx->my_double_save=xctx->mousey_snap; - xctx->last_command = 0; - new_arc(PLACE, 360., xctx->mousex_snap, xctx->mousey_snap); + if(infix_interface) { + xctx->mx_double_save=xctx->mousex_snap; + xctx->my_double_save=xctx->mousey_snap; + xctx->last_command = 0; + new_arc(PLACE, 360., xctx->mousex_snap, xctx->mousey_snap); + } else { + xctx->ui_state |= MENUSTART; + xctx->ui_state2 = MENUSTARTCIRCLE; + } break; } if(key=='O' && rstate == ControlMask ) /* load most recent tile */ @@ -3452,10 +3474,17 @@ int rstate; /* (reduced state, without ShiftMask) */ if(key=='l' /* && !xctx->ui_state */ && rstate == 0) /* start line */ { int prev_state = xctx->ui_state; - start_line(xctx->mousex_snap, xctx->mousey_snap); - if(prev_state == STARTLINE) { - tcleval("set constr_mv 0" ); - xctx->constr_mv=0; + if(xctx->semaphore>=2) break; + if(infix_interface) { + start_line(xctx->mousex_snap, xctx->mousey_snap); + if(prev_state == STARTLINE) { + tcleval("set constr_mv 0" ); + xctx->constr_mv=0; + } + } else { + xctx->last_command = 0; + xctx->ui_state |= MENUSTART; + xctx->ui_state2 = MENUSTARTLINE; } break; } diff --git a/src/xschem.tcl b/src/xschem.tcl index 24b5da01..e615f1ea 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -7589,7 +7589,7 @@ set tctx::global_list { PDK_ROOT PDK SKYWATER_MODELS SKYWATER_STDCELLS INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR XSCHEM_LIBRARY_PATH add_all_windows_drives auto_hilight auto_hilight_graph_nodes autofocus_mainwindow - autotrim_wires infix_wire orthogonal_wiring bespice_listen_port big_grid_points bus_replacement_char cadgrid cadlayers + autotrim_wires infix_interface orthogonal_wiring bespice_listen_port big_grid_points bus_replacement_char cadgrid cadlayers cadsnap cairo_font_name cairo_font_scale change_lw color_ps tctx::colors compare_sch constr_mv copy_cell crosshair_layer custom_label_prefix custom_token dark_colors dark_colorscheme dark_gui_colorscheme delay_flag dim_bg dim_value disable_unique_names @@ -8010,7 +8010,7 @@ proc build_widgets { {topwin {} } } { global netlist_show flat_netlist split_files compare_sch intuitive_interface global draw_grid big_grid_points sym_txt change_lw incr_hilight symbol_width global cadsnap cadgrid draw_window toolbar_visible hide_symbols undo_type - global disable_unique_names persistent_command autotrim_wires infix_wire orthogonal_wiring en_hilight_conn_inst + global disable_unique_names persistent_command autotrim_wires infix_interface orthogonal_wiring en_hilight_conn_inst global local_netlist_dir editor netlist_type netlist_dir spiceprefix initial_geometry if { $dark_gui_colorscheme} { set selectcolor white @@ -8133,7 +8133,7 @@ proc build_widgets { {topwin {} } } { -onvalue disk -offvalue memory -command {switch_undo} $topwin.menubar.option add checkbutton -label "Enable stretch" -variable enable_stretch \ -selectcolor $selectcolor -accelerator Y - $topwin.menubar.option add checkbutton -label "Enable infix-wire" -variable infix_wire \ + $topwin.menubar.option add checkbutton -label "Enable infix-interface" -variable infix_interface \ -selectcolor $selectcolor $topwin.menubar.option add checkbutton -label "Enable orthogonal wiring" -variable orthogonal_wiring \ -selectcolor $selectcolor -accelerator Shift+L @@ -9067,7 +9067,7 @@ set_ne draw_grid_axes 1 set_ne persistent_command 0 set_ne intuitive_interface 1 set_ne autotrim_wires 0 -set_ne infix_wire 0 +set_ne infix_interface 0 set_ne orthogonal_wiring 1 set_ne compare_sch 0 set_ne disable_unique_names 0