X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Date: Tue, 13 Dec 2016 14:43:33 +0100 (CET) X-X-Sender: igor2 AT igor2priv To: geda-user AT delorie DOT com X-Debug: to=geda-user AT delorie DOT com from="gedau AT igor2 DOT repo DOT hu" From: gedau AT igor2 DOT repo DOT hu Subject: [geda-user] [pcb-rnd] UI layers - good bye debug draw! + layer news Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Reply-To: geda-user AT delorie DOT com Hi all, I am about to start working on a plugin that requires me to show the user complex geometric constructs on the board, without changing the board. I figured there was a feature for this, inherited from mainline: debug draw. Unfortunately this feature was barely usable for my purpose: any screen update would erase the debug drawing and the user had little control over the visibility of the drawing. Also, multiple plugins can't seem to use the feature without interfering on some level. As a fix I've added "UI layers": these are layers dynamically created (typically by plugins). UI layers show up in the layer side bar and their visibility can be toggled. An UI layer is not part of the design, its content is not saved and is not even connected to the current PCB in any way. Demo video: https://archive.org/details/pcb_rnd_ui_layer Clock rendered using the embedded awk script: http://repo.hu/projects/pcb-rnd/user/06_feature/gpmi/rosetta/90_clock/ex.awk What this feature could be used for: - display simulation data over the board (heat distribution, high freq FEM simulation, etc.) - display the progress of an autorouter - semi-automatic plugins could show the user what they would do in the next step and let the user accept or reject the plan - "assistant" plugins: tracing user actions, they could provide useful info or warnings drawn and updated real-time on an UI layer Details ======= An UI layer can be created at any time. It has a name and a color. The usual persistent drawing primitives can be used: line, arc, text, polygon. If there are multiple UI layers, they are draw in the order of creation. The UI layers are always drawn last, after everything else. Export plugins ignore the UI layers. In theory the UI layer is user editable but in practice it is disabled . The clock is implemented as an embedded awk script using the gpmi plugin. The script defines an action called "clock". When the action is executed, a new UI layer is created and the dial of the clock is drawn using lines and texts. The three hands are three lines if different length and width. The script sets up a timer that runs once a second. The awk function for the timer does the time keeping and updates the clock hands by moving their endpoints. It's the same mechanism as if the user drag&drop'd the endpoint of a line. Layer news: this new feature was made possible because of the weeks of layer infrastructure rewrite. Pcb-rnd now has a much cleaner concept of layers, physical and logical. I removed a lot of assumptions about layers from all parts of the code. At the end of this transformation there will be no special layers - all layers will be equal and will look for specific layers by their properties and position in the physical layer stack, instead of guessing their IDs/indices by layer name or indices of other layers. With the introduction of UI layers I will gradually remove the API and implementation of debug_draw. Note: the script doesn't work with the wall time, I was too lazy to query the system clock. In reality the rendering is smooth and real-time, it was the desktop video capture program that makes it jumpy on the video. When I switch to the solder side (bottom side), the clock mirrors too, because it's all in the board coordinate system - this is intentional. Regards, Igor2