Commit Graph

6 Commits

Author SHA1 Message Date
Kellermorph f6be424cad Keep the terminal number out of the export columns
Manual testing found that the CSV export of the project offered the
terminal number as a column, and failed when it was chosen. The export
takes its columns from the element info keys, but the query behind the
nomenclature has no terminal_number column, so the query breaks.

The widget which offers the columns skips the keys it cannot query
(formula and exclude_from_bom) and skips the terminal number with them,
with a comment saying why.

The key itself stays an element info key: the element editor keeps
offering %{terminal_number} as a text variable, and the label keeps
splitting into label and number the way it was drawn.
2026-10-23 13:02:17 +02:00
Kellermorph 86563850f8 Move the terminal labelling setting into the project
The review asked for it, and it is the right place: the same file must
draw the same way on every machine which opens it, so how a terminal
writes its label belongs to the project, not to the application's own
settings.

The choice lives with the other display options of the sheets, in the
project properties (General page), and is saved in the project as
<terminal_labelling split="true"/> -- written only when on, so a
project with it off saves byte for byte as before. Reading it is a
member of the project now: no QSettings built per text refresh any
more, and switching it redraws the labels of the drawings already open.

The application setting (QetSettings, the General configuration page)
is gone with it, and the test reads the project's own value.
2026-10-22 18:40:19 +02:00
Kellermorph 790497978a Split the labelling of terminal symbols only
An element of any other type draws its label as a whole, whatever the
labelling setting says: the colon in a label like "-K1:13" is part of
that label, not a terminal number waiting to be split off. Only an
element whose data says it is a terminal is ever drawn split.

The test picks a non-terminal whose own label field draws the label it
is given -- not a report (its label is where its partner is), not a
slave (its label follows its master) and not a numbered symbol (a
formula composes its label): those draw texts of their own the split
never touches.
2026-10-22 18:33:06 +02:00
Kellermorph 337502edfc Take the label field off the sheet while the name is hidden
An element whose name must not be drawn left its label field behind
as an empty frame: selected along with the element, ready to click,
drawing nothing. The field now follows the Show name box both ways:

- a field bound to the label is hidden while Element::labelShown()
  says no, and shown again the moment the box is ticked again, both
  through the same signals which refresh the text (elementInfoChange,
  the label connection refresh, binding the field to another
  information), so it can never get stuck on one side;
- a hidden field is deselected and gets no resize handles, and one
  which comes back gets its handles back when its element is still
  selected;
- every other field, composite texts included, is drawn as always,
  and the data of the element never changes - only the drawing.

Adds a test: the field is visible, goes away with the name, and
comes back with it.
2026-10-22 13:18:55 +02:00
Kellermorph edf761c2b6 Add a Show name box to the selection properties of a terminal
The box hides the name of the terminal on the sheet only: the element
keeps all of its data, and with the labelling split the terminal keeps
its number, drawn once - in its own field when the symbol has one,
alone in the label field when it has not.

Only a terminal may have its name undrawn: the box is shown for the
element type Terminal alone, and Element::labelShown() obeys the
stored information for a terminal only. The choice is stored as the
element information "label_shown" = "false" and only that, so files
of every element which still draws its name stay exactly as they are.

Multi-selection: the flag appears for terminals only and counts an
absent information as "shown", so a mixed selection shows the box
ticked only when every terminal has it ticked.

Includes four test cases: hidden name keeps the stored data, keeps
the number without a number field, leaves the number to its own
field, and a non-terminal draws its name whatever the file says.
2026-10-22 12:51:50 +02:00
Kellermorph dfec60a3a5 Draw a terminal's label and its number apart, when asked to
A terminal's label is written as it is read off the plan, "X1:1", and
the symbol draws it as one field. On a long strip that field is long
enough to reach into the next terminal, and a user who wants the number
next to the screw and the label out of the way has no way to say so.

Settings > General > Appearance now has a "Display of the terminal
labelling" group with two choices: the label and its terminal number in
one field, the way it has always been drawn, or the two split. The
first is what every drawing gets, so nothing moves until the user asks
for it, and choosing the other one redraws the drawings already open --
nothing needs to be closed and opened again.

A symbol made for the split carries a text field bound to the new
"Terminal number" information (in the element editor's list, next to
the label, and as the %{terminal_number} variable of a composite text):
the label field then shows "X1" and the number field "1", each placed
where the symbol wants it, and hideable when it must be. A symbol which
has no such field -- every symbol drawn until now -- gets the number on
its own line inside the label field, so switching the setting on can
never make a number vanish, and never needs a symbol to be touched
first. A field which becomes, or stops being, the number field tells
the label fields of its symbol to draw themselves again.

Only the drawing reacts. What the element stores, the numbering, the
sorting in the terminal strip editor, the automatic strip import and
every export keep the whole label: the split is read where the text is
drawn (Element::labelForDisplay() and friends), not where the label is
made.

The new test covers both choices, with and without the number field, a
label with no colon at all, and the way back to the whole label. The
full test suite passes (124/124).
2026-10-22 10:01:12 +02:00