StefanSchippers / xschem

A schematic editor for VLSI/Asic/Analog custom designs, netlist backends for VHDL, Spice and Verilog. The tool is focused on hierarchy and parametric designs, to maximize circuit reuse.
Other
297 stars 21 forks source link

Issue with preview_window #196

Closed georgtree closed 2 months ago

georgtree commented 2 months ago

Hello! Could you help please - I have preview_window in detached window, all works, but after I make Save As action in main window, preview_window command stops work until I kill current window and launch tcl script again. I draw command in event handler, so after window stops work, event handler still work. What could be an issue? I add a video. Thank you in advance.

https://github.com/StefanSchippers/xschem/assets/113975847/f93b25d3-1f96-4ab6-887f-fceb99d72be6

georgtree commented 2 months ago

I tested it with component browser, and it disappeared when I do Save As.

StefanSchippers commented 2 months ago

Yes I need to address this. The reason is simple. The preview_window() function (in xinit.c) saves as static (inside the function) data the informations about the previewed schematic. This means only one preview (including yours and the one used in the save/load file dialog) at a time may be active. Opening a second preview instance will overwrite the data of the previous preview and likely cause a lot of trouble.

georgtree commented 2 months ago

Is it possible to return working state of preview window?

georgtree commented 2 months ago

I solved this issue by recreate preview_window each time in event handler

StefanSchippers commented 2 months ago

This is a possibility, but I am working on a preview functions that allows multiple previews at the same time...

georgtree commented 2 months ago

Sounds great :)

StefanSchippers commented 2 months ago

Ok, now preview_window should allow up to 10 open previews. You can do something like:

toplevel .a -bg {}
toplevel .b -bg {}
xschem preview_window create .a 
xschem preview_window create .b
xschem preview_window draw .a xschem-repo/trunk/xschem_library/examples/poweramp.sch
xschem preview_window draw .b xschem-repo/trunk/xschem_library/examples/test_lm324.sch

You can repeat a xschem preview_window draw .a another_schematic to update .a with a different schematic. or you can do a

xschem preview_window destroy .a
...
...
toplevel .a -bg {}
xschem preview_window create .a
xschem preview_window draw .a yet_another_schematic
georgtree commented 2 months ago

Yes, just tested, all work !