Merge branch 'master' into SuperChayan
This commit is contained in:
commit
c6a70cae2d
|
|
@ -2470,9 +2470,10 @@ static void handle_enter_notify(int draw_xhair, int crosshair_size)
|
||||||
|
|
||||||
static void handle_motion_notify(int event, KeySym key, int state, int rstate, int button,
|
static void handle_motion_notify(int event, KeySym key, int state, int rstate, int button,
|
||||||
int mx, int my, int aux, int draw_xhair, int enable_stretch,
|
int mx, int my, int aux, int draw_xhair, int enable_stretch,
|
||||||
int snap_cursor, int wire_draw_active)
|
const char *win_path, int snap_cursor, int wire_draw_active)
|
||||||
{
|
{
|
||||||
char str[PATH_MAX + 100];
|
char str[PATH_MAX + 100];
|
||||||
|
if(strcmp(win_path, xctx->current_win_path)) return;
|
||||||
if( waves_selected(event, key, state, button)) {
|
if( waves_selected(event, key, state, button)) {
|
||||||
waves_callback(event, mx, my, key, button, aux, state);
|
waves_callback(event, mx, my, key, button, aux, state);
|
||||||
return;
|
return;
|
||||||
|
|
@ -4130,11 +4131,12 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_button_press(int event, int state, int rstate, KeySym key, int button, int mx, int my,
|
static void handle_button_press(int event, int state, int rstate, KeySym key, int button, int mx, int my,
|
||||||
double c_snap, int draw_xhair, int crosshair_size,
|
double c_snap, int draw_xhair, int crosshair_size, int enable_stretch,
|
||||||
int enable_stretch, int cadence_compat, int aux)
|
const char *win_path, int cadence_compat, int aux)
|
||||||
{
|
{
|
||||||
int use_cursor_for_sel = tclgetintvar("use_cursor_for_selection");
|
int use_cursor_for_sel = tclgetintvar("use_cursor_for_selection");
|
||||||
int excl = xctx->ui_state & (STARTWIRE | STARTRECT | STARTLINE | STARTPOLYGON | STARTARC);
|
int excl = xctx->ui_state & (STARTWIRE | STARTRECT | STARTLINE | STARTPOLYGON | STARTARC);
|
||||||
|
if(strcmp(win_path, xctx->current_win_path)) return;
|
||||||
dbg(1, "callback(): ButtonPress ui_state=%d state=%d\n",xctx->ui_state,state);
|
dbg(1, "callback(): ButtonPress ui_state=%d state=%d\n",xctx->ui_state,state);
|
||||||
if(waves_selected(event, key, state, button)) {
|
if(waves_selected(event, key, state, button)) {
|
||||||
waves_callback(event, mx, my, key, button, aux, state);
|
waves_callback(event, mx, my, key, button, aux, state);
|
||||||
|
|
@ -4615,6 +4617,7 @@ int callback(const char *win_path, int event, int mx, int my, KeySym key, int bu
|
||||||
char str[PATH_MAX + 100];
|
char str[PATH_MAX + 100];
|
||||||
int redraw_only;
|
int redraw_only;
|
||||||
double c_snap;
|
double c_snap;
|
||||||
|
int tabbed_interface = tclgetboolvar("tabbed_interface");
|
||||||
int enable_stretch = tclgetboolvar("enable_stretch");
|
int enable_stretch = tclgetboolvar("enable_stretch");
|
||||||
int draw_xhair = tclgetboolvar("draw_crosshair");
|
int draw_xhair = tclgetboolvar("draw_crosshair");
|
||||||
int crosshair_size = tclgetintvar("crosshair_size");
|
int crosshair_size = tclgetintvar("crosshair_size");
|
||||||
|
|
@ -4645,21 +4648,32 @@ int callback(const char *win_path, int event, int mx, int my, KeySym key, int bu
|
||||||
#if 0
|
#if 0
|
||||||
/* exclude Motion and Expose events */
|
/* exclude Motion and Expose events */
|
||||||
if(event!=6 /* && event!=12 */) {
|
if(event!=6 /* && event!=12 */) {
|
||||||
dbg(0, "callback(): state=%d event=%d, win_path=%s, old_win_path=%s, semaphore=%d\n",
|
dbg(0, "callback(): state=%d event=%d, win_path=%s, current_win_path=%s, semaphore=%d\n",
|
||||||
state, event, win_path, old_win_path, xctx->semaphore+1);
|
state, event, win_path, xctx->current_win_path, xctx->semaphore+1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Schematic window context switch */
|
/* Schematic window context switch */
|
||||||
redraw_only =0;
|
redraw_only = 0;
|
||||||
if(strcmp(old_win_path, win_path) ) {
|
if((event == FocusIn || event == Expose || event == EnterNotify) &&
|
||||||
if( xctx->semaphore >= 1 || event == Expose) {
|
!tabbed_interface && strcmp(xctx->current_win_path, win_path) ) {
|
||||||
dbg(1, "callback(): semaphore >=2 (or Expose) switching window context: %s --> %s\n", old_win_path, win_path);
|
struct stat buf;
|
||||||
|
/* This will switch context only when copying stuff across windows */
|
||||||
|
if( event == EnterNotify && (!stat(sel_file, &buf) && (xctx->ui_state & STARTCOPY))) {
|
||||||
|
dbg(1, "callback(): switching window context for copy : %s --> %s, semaphore=%d\n",
|
||||||
|
xctx->current_win_path, win_path, xctx->semaphore);
|
||||||
|
new_schematic("switch", win_path, "", 1);
|
||||||
|
/* This does a "temporary" switch just to redraw obcured window parts */
|
||||||
|
} else if(event == Expose || xctx->semaphore >= 1 ) {
|
||||||
|
dbg(1, "callback(): switching window context for redraw ONLY: %s --> %s\n",
|
||||||
|
xctx->current_win_path, win_path);
|
||||||
redraw_only = 1;
|
redraw_only = 1;
|
||||||
|
my_strncpy(old_win_path, xctx->current_win_path, S(old_win_path));
|
||||||
new_schematic("switch_no_tcl_ctx", win_path, "", 1);
|
new_schematic("switch_no_tcl_ctx", win_path, "", 1);
|
||||||
} else {
|
/* this is the regular context switch when window gets focused */
|
||||||
|
} else if(event == FocusIn && xctx->semaphore == 0) {
|
||||||
dbg(1, "callback(): switching window context: %s --> %s, semaphore=%d\n",
|
dbg(1, "callback(): switching window context: %s --> %s, semaphore=%d\n",
|
||||||
old_win_path, win_path, xctx->semaphore);
|
xctx->current_win_path, win_path, xctx->semaphore);
|
||||||
new_schematic("switch", win_path, "", 1);
|
new_schematic("switch", win_path, "", 1);
|
||||||
}
|
}
|
||||||
/* done in switch_window() */
|
/* done in switch_window() */
|
||||||
|
|
@ -4735,7 +4749,7 @@ int callback(const char *win_path, int event, int mx, int my, KeySym key, int bu
|
||||||
|
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
handle_motion_notify(event, key, state, rstate, button, mx, my,
|
handle_motion_notify(event, key, state, rstate, button, mx, my,
|
||||||
aux, draw_xhair, enable_stretch,
|
aux, draw_xhair, enable_stretch, win_path,
|
||||||
snap_cursor, wire_draw_active);
|
snap_cursor, wire_draw_active);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -4752,7 +4766,7 @@ int callback(const char *win_path, int event, int mx, int my, KeySym key, int bu
|
||||||
|
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
handle_button_press(event, state, rstate, key, button, mx, my,
|
handle_button_press(event, state, rstate, key, button, mx, my,
|
||||||
c_snap, draw_xhair, crosshair_size, enable_stretch, cadence_compat, aux);
|
c_snap, draw_xhair, crosshair_size, enable_stretch, win_path, cadence_compat, aux);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
|
|
@ -4775,11 +4789,6 @@ int callback(const char *win_path, int event, int mx, int my, KeySym key, int bu
|
||||||
dbg(1, "callback(): semaphore >=2 restoring window context: %s <-- %s\n", old_win_path, win_path);
|
dbg(1, "callback(): semaphore >=2 restoring window context: %s <-- %s\n", old_win_path, win_path);
|
||||||
if(old_win_path[0]) new_schematic("switch_no_tcl_ctx", old_win_path, "", 1);
|
if(old_win_path[0]) new_schematic("switch_no_tcl_ctx", old_win_path, "", 1);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if(strcmp(old_win_path, win_path)) {
|
|
||||||
if(old_win_path[0]) dbg(1, "callback(): reset old_win_path: %s <- %s\n", old_win_path, win_path);
|
|
||||||
my_strncpy(old_win_path, win_path, S(old_win_path));
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8516,6 +8516,22 @@ proc getmousey {win} {
|
||||||
return $rely
|
return $rely
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc switch_window {parent topwin event window} {
|
||||||
|
# puts "$parent $topwin $event $window"
|
||||||
|
raise_dialog $parent $topwin
|
||||||
|
|
||||||
|
if { $parent eq {.}} {
|
||||||
|
if { $window eq $parent} {
|
||||||
|
xschem callback .drw $event 0 0 0 0 0 0
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if {$window eq $parent} {
|
||||||
|
# send a fake event just to force context switching in callback()
|
||||||
|
xschem callback $parent.drw $event 0 0 0 0 0 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
proc set_bindings {topwin} {
|
proc set_bindings {topwin} {
|
||||||
global env has_x OS autofocus_mainwindow
|
global env has_x OS autofocus_mainwindow
|
||||||
###
|
###
|
||||||
|
|
@ -8528,25 +8544,13 @@ global env has_x OS autofocus_mainwindow
|
||||||
|
|
||||||
bind $parent <Expose> [list raise_dialog $parent $topwin]
|
bind $parent <Expose> [list raise_dialog $parent $topwin]
|
||||||
bind $parent <Visibility> [list raise_dialog $parent $topwin]
|
bind $parent <Visibility> [list raise_dialog $parent $topwin]
|
||||||
bind $parent <FocusIn> [list raise_dialog $parent $topwin]
|
# This event will cause a window context switch
|
||||||
# send non-existent event just to force change schematic window context.
|
bind $parent <Enter> "switch_window $parent $topwin %T %W"
|
||||||
bind $parent <Enter> "
|
# This event will cause a window context switch
|
||||||
if { {$parent} eq {.}} {
|
bind $parent <FocusIn> "switch_window $parent $topwin %T %W"
|
||||||
if { {%W} eq {$parent}} {
|
|
||||||
# send a fake event just to force context switching in callback()
|
|
||||||
xschem callback .drw -55 0 0 0 0 0 0
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if { {%W} eq {$parent}} {
|
|
||||||
# send a fake event just to force context switching in callback()
|
|
||||||
xschem callback $parent.drw -55 0 0 0 0 0 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"
|
|
||||||
bind $topwin <Leave> "
|
bind $topwin <Leave> "
|
||||||
xschem callback %W %T %x %y 0 0 0 %s
|
xschem callback %W %T %x %y 0 0 0 %s
|
||||||
graph_show_measure stop
|
graph_show_measure stop
|
||||||
# $topwin configure -cursor {}
|
|
||||||
"
|
"
|
||||||
bind $topwin <Expose> "xschem callback %W %T %x %y 0 %w %h %s"
|
bind $topwin <Expose> "xschem callback %W %T %x %y 0 %w %h %s"
|
||||||
|
|
||||||
|
|
@ -8565,18 +8569,17 @@ global env has_x OS autofocus_mainwindow
|
||||||
bind $topwin <Double-Button-2> "xschem callback %W -3 %x %y 0 %b 0 %s"
|
bind $topwin <Double-Button-2> "xschem callback %W -3 %x %y 0 %b 0 %s"
|
||||||
bind $topwin <Double-Button-3> "xschem callback %W -3 %x %y 0 %b 0 %s"
|
bind $topwin <Double-Button-3> "xschem callback %W -3 %x %y 0 %b 0 %s"
|
||||||
bind $topwin <Configure> "xschem callback %W %T %x %y 0 %w %h 0"
|
bind $topwin <Configure> "xschem callback %W %T %x %y 0 %w %h 0"
|
||||||
bind $topwin <ButtonPress> "focus $topwin; xschem callback %W %T %x %y 0 %b 0 %s"
|
if {$autofocus_mainwindow} {
|
||||||
|
bind $topwin <ButtonPress> "focus $topwin; xschem callback %W %T %x %y 0 %b 0 %s"
|
||||||
|
} else {
|
||||||
|
bind $topwin <ButtonPress> "xschem callback %W %T %x %y 0 %b 0 %s"
|
||||||
|
}
|
||||||
bind $topwin <ButtonRelease> "xschem callback %W %T %x %y 0 %b 0 %s"
|
bind $topwin <ButtonRelease> "xschem callback %W %T %x %y 0 %b 0 %s"
|
||||||
bind $topwin <KeyPress> "xschem callback %W %T %x %y %N 0 0 %s"
|
bind $topwin <KeyPress> "xschem callback %W %T %x %y %N 0 0 %s"
|
||||||
bind $topwin <KeyRelease> "xschem callback %W %T %x %y %N 0 0 %s"
|
bind $topwin <KeyRelease> "xschem callback %W %T %x %y %N 0 0 %s"
|
||||||
if {$autofocus_mainwindow} {
|
if {$autofocus_mainwindow} {
|
||||||
bind $topwin <Motion> "focus $topwin; xschem callback %W %T %x %y 0 0 0 %s"
|
bind $topwin <Motion> "focus $topwin; xschem callback %W %T %x %y 0 0 0 %s"
|
||||||
bind $topwin <Enter> "
|
bind $topwin <Enter> "destroy .ctxmenu; focus $topwin; xschem callback %W %T %x %y 0 0 0 0"
|
||||||
# if {\$draw_crosshair} {$topwin configure -cursor none}
|
|
||||||
destroy .ctxmenu
|
|
||||||
focus $topwin
|
|
||||||
xschem callback %W %T %x %y 0 0 0 0
|
|
||||||
"
|
|
||||||
} else {
|
} else {
|
||||||
bind $topwin <Motion> "xschem callback %W %T %x %y 0 0 0 %s"
|
bind $topwin <Motion> "xschem callback %W %T %x %y 0 0 0 %s"
|
||||||
bind $topwin <Enter> "destroy .ctxmenu; xschem callback %W %T %x %y 0 0 0 0"
|
bind $topwin <Enter> "destroy .ctxmenu; xschem callback %W %T %x %y 0 0 0 0"
|
||||||
|
|
@ -9736,7 +9739,7 @@ proc entry_replace_selection {w} {
|
||||||
|
|
||||||
# focus the schematic window if mouse goes over it, even if a dialog box is displayed,
|
# focus the schematic window if mouse goes over it, even if a dialog box is displayed,
|
||||||
# without needing to click. This allows to move/zoom/pan the schematic while editing attributes.
|
# without needing to click. This allows to move/zoom/pan the schematic while editing attributes.
|
||||||
set_ne autofocus_mainwindow 1
|
set_ne autofocus_mainwindow 0
|
||||||
if {$OS == "Windows"} {
|
if {$OS == "Windows"} {
|
||||||
set_ne XSCHEM_TMP_DIR [xschem get temp_dir]
|
set_ne XSCHEM_TMP_DIR [xschem get temp_dir]
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -327,8 +327,8 @@
|
||||||
#### This allows to move/zoom/pan the schematic while editing attributes.
|
#### This allows to move/zoom/pan the schematic while editing attributes.
|
||||||
#### Clicking in the schematic window usually closes the dialog box or starts
|
#### Clicking in the schematic window usually closes the dialog box or starts
|
||||||
#### editing a new component if clicking on a new component.
|
#### editing a new component if clicking on a new component.
|
||||||
#### default: enabled (1)
|
#### default: NOT enabled (0)
|
||||||
# set autofocus_mainwindow 0
|
# set autofocus_mainwindow 1
|
||||||
|
|
||||||
#### replace selected text in text widgets when pasting from clipboard
|
#### replace selected text in text widgets when pasting from clipboard
|
||||||
#### default: enabled (1)
|
#### default: enabled (1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue