fix correct drawing of new schematic window if schematic not found
This commit is contained in:
parent
7fcda987c0
commit
043e83e18f
|
|
@ -662,6 +662,7 @@ void drawgrid()
|
|||
int i=0;
|
||||
int big_gr;
|
||||
|
||||
dbg(1, "drawgrid(): draw grid\n");
|
||||
big_gr = tclgetboolvar("big_grid_points");
|
||||
if( !tclgetboolvar("draw_grid") || !has_x) return;
|
||||
delta=tclgetdoublevar("cadgrid")*xctx->mooz;
|
||||
|
|
@ -1499,7 +1500,7 @@ void draw(void)
|
|||
if(xctx->draw_window)
|
||||
XFillRectangle(display, xctx->window, xctx->gc[BACKLAYER], xctx->areax1, xctx->areay1,
|
||||
xctx->areaw, xctx->areah);
|
||||
dbg(2, "draw(): window: %d %d %d %d\n",xctx->areax1, xctx->areay1, xctx->areax2, xctx->areay2);
|
||||
dbg(1, "draw(): window: %d %d %d %d\n",xctx->areax1, xctx->areay1, xctx->areax2, xctx->areay2);
|
||||
drawgrid();
|
||||
x1 = X_TO_XSCHEM(xctx->areax1);
|
||||
y1 = Y_TO_XSCHEM(xctx->areay1);
|
||||
|
|
|
|||
|
|
@ -874,6 +874,8 @@ void new_schematic(const char *what, const char *top_path, const char *tk_win_pa
|
|||
enable_layers();
|
||||
build_colors(0.0, 0.0);
|
||||
resetwin(1, 0, 1, 0, 0); /* create preview pixmap. resetwin(create_pixmap, clear_pixmap, force, w, h) */
|
||||
/* draw empty window so if following load fails due to missing file window appears correctly drawn */
|
||||
zoom_full(1, 0, 1, 0.97);
|
||||
load_schematic(1,filename, 1);
|
||||
zoom_full(1, 0, 1, 0.97); /* draw */
|
||||
} else if(!strcmp(what, "destroy")) {
|
||||
|
|
@ -1605,7 +1607,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
dbg(1, "Tcl_AppInit(): done xinit()\n");
|
||||
/* Set backing store window attribute */
|
||||
winattr.backing_store = WhenMapped;
|
||||
/* winattr.backing_store = NotUseful;*/
|
||||
/* winattr.backing_store = NotUseful; */
|
||||
Tk_ChangeWindowAttributes(tkwindow, CWBackingStore, &winattr);
|
||||
|
||||
dbg(1, "Tcl_AppInit(): sizeof xInstance=%lu , sizeof xSymbol=%lu\n",
|
||||
|
|
@ -1642,7 +1644,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
/* Completing tk windows creation (see xschem.tcl, pack_widgets) and event binding */
|
||||
/* *AFTER* X initialization done */
|
||||
/* */
|
||||
if(has_x) tcleval("pack_widgets");
|
||||
if(has_x) tcleval("pack_widgets; set_bindings .drw");
|
||||
|
||||
fs=tclgetintvar("fullscreen");
|
||||
if(fs) {
|
||||
|
|
|
|||
|
|
@ -3450,7 +3450,6 @@ proc every {interval script} {
|
|||
after $interval [list every $interval $script]
|
||||
}
|
||||
|
||||
#### TEST MODE #####
|
||||
proc new_window {what {filename {}} {path {-}}} {
|
||||
if { $what eq {create}} {
|
||||
if {$tctx::cnt == 0} {
|
||||
|
|
@ -3466,9 +3465,9 @@ proc new_window {what {filename {}} {path {-}}} {
|
|||
}
|
||||
}
|
||||
toplevel $path -bg {} -width 400 -height 400
|
||||
update
|
||||
build_widgets $path
|
||||
pack_widgets $path ;# also does set_bindings $path.drw
|
||||
set_bindings $path.drw
|
||||
update
|
||||
xschem new_schematic create $path $path.drw [abs_sym_path $filename]
|
||||
save_ctx $path.drw
|
||||
|
|
@ -3656,49 +3655,55 @@ global env has_x OS
|
|||
###
|
||||
### Tk event handling
|
||||
###
|
||||
set parent [winfo toplevel $topwin]
|
||||
|
||||
bind $parent <Expose> [list raise_dialog $parent $topwin]
|
||||
bind $parent <Visibility> [list raise_dialog $parent $topwin]
|
||||
bind $parent <FocusIn> [list raise_dialog $parent $topwin]
|
||||
# send non-existent event just to force change schematic window context.
|
||||
bind $parent <Enter> "
|
||||
if { {$parent} eq {.}} {
|
||||
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
|
||||
if {($OS== "Windows" || [string length [lindex [array get env DISPLAY] 1] ] > 0 ) && [info exists has_x]} {
|
||||
set parent [winfo toplevel $topwin]
|
||||
|
||||
bind $parent <Expose> [list raise_dialog $parent $topwin]
|
||||
bind $parent <Visibility> [list raise_dialog $parent $topwin]
|
||||
bind $parent <FocusIn> [list raise_dialog $parent $topwin]
|
||||
# send non-existent event just to force change schematic window context.
|
||||
bind $parent <Enter> "
|
||||
if { {$parent} eq {.}} {
|
||||
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
|
||||
}
|
||||
}
|
||||
} 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 <Expose> "xschem callback %W %T %x %y 0 %w %h %s"
|
||||
bind $topwin <Double-Button-1> "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 <Configure> "xschem windowid; xschem callback %W %T %x %y 0 %w %h 0"
|
||||
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 <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 <Motion> "focus $topwin; xschem callback %W %T %x %y 0 0 0 %s"
|
||||
bind $topwin <Enter> "focus $topwin; xschem callback %W %T %x %y 0 0 0 0"
|
||||
bind $topwin <Unmap> " wm withdraw .infotext; set show_infowindow 0 "
|
||||
bind $topwin "?" {textwindow "${XSCHEM_SHAREDIR}/xschem.help"}
|
||||
|
||||
# on Windows Alt key mask is reported as 131072 (1<<17) so build masks manually with values passed from C code
|
||||
if {$OS == "Windows" } {
|
||||
bind $topwin <Alt-KeyPress> {xschem callback %W %T %x %y %N 0 0 [expr {$Mod1Mask}]}
|
||||
bind $topwin <Control-Alt-KeyPress> {xschem callback %W %T %x %y %N 0 0 [expr {$ControlMask + $Mod1Mask}]}
|
||||
bind $topwin <Shift-Alt-KeyPress> {xschem callback %W %T %x %y %N 0 0 [expr {$ShiftMask + $Mod1Mask}]}
|
||||
bind $topwin <MouseWheel> {
|
||||
if {%D<0} {
|
||||
xschem callback %W 4 %x %y 0 5 0 %s
|
||||
} else {
|
||||
xschem callback %W 4 %x %y 0 4 0 %s
|
||||
"
|
||||
bind $topwin <Expose> "xschem callback %W %T %x %y 0 %w %h %s"
|
||||
bind $topwin <Double-Button-1> "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"
|
||||
if { $topwin eq {.drw} } {
|
||||
bind $topwin <Configure> "xschem windowid; xschem callback %W %T %x %y 0 %w %h 0"
|
||||
} else {
|
||||
bind $topwin <Configure> "xschem callback %W %T %x %y 0 %w %h 0"
|
||||
}
|
||||
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 <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 <Motion> "focus $topwin; xschem callback %W %T %x %y 0 0 0 %s"
|
||||
bind $topwin <Enter> "focus $topwin; xschem callback %W %T %x %y 0 0 0 0"
|
||||
bind $topwin <Unmap> " wm withdraw .infotext; set show_infowindow 0 "
|
||||
bind $topwin "?" {textwindow "${XSCHEM_SHAREDIR}/xschem.help"}
|
||||
|
||||
# on Windows Alt key mask is reported as 131072 (1<<17) so build masks manually with values passed from C code
|
||||
if {$OS == "Windows" } {
|
||||
bind $topwin <Alt-KeyPress> {xschem callback %W %T %x %y %N 0 0 [expr {$Mod1Mask}]}
|
||||
bind $topwin <Control-Alt-KeyPress> {xschem callback %W %T %x %y %N 0 0 [expr {$ControlMask + $Mod1Mask}]}
|
||||
bind $topwin <Shift-Alt-KeyPress> {xschem callback %W %T %x %y %N 0 0 [expr {$ShiftMask + $Mod1Mask}]}
|
||||
bind $topwin <MouseWheel> {
|
||||
if {%D<0} {
|
||||
xschem callback %W 4 %x %y 0 5 0 %s
|
||||
} else {
|
||||
xschem callback %W 4 %x %y 0 4 0 %s
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue