pcb-rnd knowledge pool


The new DRC dialog

drc_new1 by Tibor 'Igor2' Palinkas on 2018-11-30

Tags: announcement, new, drc

node source



Abstract: As the first step of the DRC rewrite, a new low level view/drc infrastructure is introduced and the DRC GUI is rewritten. This pool node describes what was wrong with the old GUI and how the new one fixes those problems.


Output format: lesstif looked totally different for no reason

There was a rather complex dialog box code for gtk, which presented the result as a list with preview for each item. For lesstif there was a dialog that didn't present any preview or list, but helped the user to step through the violations sequentially. According to the code, if neither method was available in the HID, it printed human readable messages.

Our HID policy prefers that all GUI HIDs provide the same functionality. The user may want to look at a list of all DRC violations or just a small dialog to step through them, but this preference should not force the user to choose the GUI toolkit accordingly. Also, simple text output should be available even if the user is running a GUI.

Thus the new DRC action has an optional argument that specifies which output format should be used, and all formats are available on all HIDs.

There are two GUI formats, both implemented using DAD (which will work with any GUI HID). The format called "list" is an advanced version of the original gtk violation list (see below). The "simple" format is a rewrite of the dialog that was used in lesstif (see below).

There are three text output formats available: human readable on stdout, human readable in the log window and script readable on stdout.

preview: screenshots vs. live data

The original implementation in geda/PCB used to create a "screenshot" of the situation for the (gtk list) violation preview. If there were multiple problems located close by, this meant after fixing the first, the preview for the rest were already outdated.

The new dialog boxes use live preview: the preview is automatically updated as the board changes, so it is never outdated.

object highlight: single-object

The original code used to highlight only a single object on DRC violaton. This is fine for some cases, e.g. "line too thin". But when there's a broken trace or a "gap too small" (potential short circuit), it's more useful to highlight at least two objects.

The new code defines two object lists, a "red team" and a "blue team". Red team consists of the offender object(s), and blue consists of objects that are related. For a "line too thin", we have only a red player. For a short or broken trace, we have a red player (the object we blame) and a blue player to indicate where exactly the problem happened.

On a crowded board, especially if the offending object is large, this dual-color highlight makes it much simpler to determine where the problem really is.

The highlight happens on the preview, not in the main window drawing area. This way editing the drawing for the bugfix is not disturbed by unusual colors while the user can refer back to the preview any time.

List: better screen utilization

The original gtk violation list did not have a too well screen utilization: the window was large, but it spent most of the screen space on repeating the same text messages over and over, plus displayed a lot of very small previews.

The new window presents a compact list and focuses on one issue at a time, showing only one preview that can be bigger. This way even a smaller window delivers more useful information.

If a violation is resolved, it can be removed from the list using a button.

Screeshot of the list violations dialog box

Stepper: manage your list

The simplified dialog, which is more useful on a small screen, omits the list and allows the user a sequential stepping through all violations. It shows the preview and description of one violation. The user however can step backward and forward and there's an indication about where the user is standing within the list.

If a violation is resolved, it can be removed from the list using a button.

Screeshot of the simple violations dialog box

Bonus: generic view lists

Besides the above things that were needed directly for the DRC GUI rewrite, we now also have a stronger backing infrastructure. In fact we do not have a drc violation list, but a generic list-of-views. A view is a rectangle of the board we can zoom to. As metadata it has a few text fields and a red and a blue object list for highlight.

At the moment this infra is used only for the drc, but it won't be very hard to reuse it for storing user notes. The user will be able to keep open multiple list-style dialog boxes; listing different view items, copying or moving items between the dialog boxes. It will be possible to save and load lists.