The note the op returns reads "...; frame 1223.25 x 791.25 pt"; the README
quoted it as "PDF page".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The preset code uses QPageSize and std::floor whether or not QtPdf was
found; it compiled only because other headers bring them in.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The router costed every grid edge against every symbol and every wire
segment on the folio. On the 191-symbol, 366-wire Polonez example that
is about 145 million tests and 700 ms per route, so a qet_edit routing
some 40 wires there ran into the scripting run's 30-second limit.
Each symbol and wire now visits only the grid edges it can touch, found
by binary search, and applies the same exact test to them as before, in
the same order. Rerouting every conductor of the 23 example projects
gives the same 11,018 saved segments as before, now 22 ms per route on
Polonez instead of 700.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
setFolioBorder(folio, "preset", "tabloid-landscape") picks the column and
row counts and whole-number sizes that fill the sheet best without going
over it, as one ChangeBorderCommand. The title block and headers are
measured from the folio, so it holds for any template on either edge.
Sizes stay whole because the folio properties panel edits them in whole
pixels. Among fills within 1.5 pt of the sheet, the size nearest the
current one wins: from a new folio tabloid landscape is 23 x 70 by 12 x 82,
not 9 x 179 by 5 x 197. A0-A5, letter, legal, tabloid/ledger, each
-portrait or -landscape; folioPresets() lists them, and folioBorder() reads
"width" and "height" of the frame and title block.
Every preset exports on its sheet; landscape ones rely on the previous
commit, which turns a wide page before matching it to a sheet.
The MCP server checks the name up front, probes for folioPresets(), and
the op's note says what was chosen and the frame's size in points.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The PDF export sizes each page to its folio, and QPageSize rounds a size
within 3 pt of a standard sheet to the sheet. QPageSize knows the sheets
upright only (bar Ledger), so only portrait folios snapped: an A3 landscape
folio came out as a 1190 x 841 pt page, while an A3 portrait one was
842 x 1191, the sheet. A wide folio is now matched upright and turned.
tst_pdfpagesize exports a fixture with an A3 folio each way and checks both
pages are A3; it fails without the change (1190 x 841).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Most shipped symbols leave their terminals unnamed, so --export-wiring
wrote both terminal columns empty and a reader had to work each end out
from the .qet: terminal uuid, then its place in the definition, then the
index. The terminal table now keeps the index the scripting API's
addConductor() takes, from both fills of the database (the document and
the folios give the same value: Element::parseTerminal()'s sort, top to
bottom then left to right), and wiring_list_view and the CSV gain
from/to_terminal_index and from/to_terminal_uuid as their last columns.
The index is left empty for two terminals at one point, where the sort
is not stable and the index is not defined; the uuid tells them apart.
The wiring list dialog reads named columns and is unaffected.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A new conductor gets the default two or three straight segments, which
run through whatever symbol or wire lies between its terminals; scripts
then fix it segment by segment with moveConductorSegment().
ConductorRouter finds an orthogonal path on the folio grid that leaves
and enters each terminal in its own direction, keeps clear of every
element's rectangle, stays inside the border, and charges for bends and
for running along or crossing other wires. qet.routeConductor() and
qet.routeConductorBetween() apply it through Conductor::setPathPoints(),
which pushes the same ChangeConductorCommand a handle drag does, so the
path is saved, survives a reload, and one undo restores the default.
Where no route exists the wire keeps its path and the call says so.
qet-mcp: add_conductor takes "route": "avoid", and a route_conductor op
reroutes an existing conductor (by terminal or by uuid). The router
methods are required only by an edit that routes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
With LongPathsEnabled set in the registry, Windows lets a program open
paths of 260 characters or more only if its manifest says longPathAware.
QElectroTech.exe so far carried the toolchain's default manifest. This one
repeats what the default declares (supported Windows versions, asInvoker)
and adds longPathAware. MSVC takes the .manifest as a source; MinGW gets it
through a small resource file.
Follow-up to #1178 (symbols in deep folders).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A symbol file that exists but cannot be read has a null uuid, which the
check against the copy already embedded reported as "would collide with a
different element". Say that the file could not be read, with its full
path and length, since a long path is the usual cause on Windows.
tst_unreadableelement makes the file unreadable through its permissions
and fails on master with the old message.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ElementsLocation::pugiXml() and the qet_directory name lookup opened files
with pugixml's load_file(), which on Windows fails once the full path
reaches MAX_PATH. QFile handles long paths, so exist() and the import
succeeded while uuid(), the name, the informations and the thumbnail of
the same symbol came back empty. Read the bytes with QFile and hand them
to load_buffer().
Reported on #1178 as a false collision from qet.addElement.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With "one text per potential" on, the number is drawn on the
potential's longest conductor. When two conductors tie for longest,
longestConductorInPotential() kept whichever it met first, iterating a
QSet<Conductor *> in pointer order -- which changes from run to run. The
same file, exported twice, could put the number on either conductor:
same numbers, different PDF.
A tie is now broken by where the conductors' ends are on the folio, then
by uuid. Not by uuid first: a file with no conductor uuids gets fresh
ones on every load, and a project generated again by a script gets new
ones each time, while the drawing is the same.
tst_potentialtextcarrier exports a fixture with such a tie eight times;
before the fix it failed in each of three tries.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
XmlElementCollection::importCategory() returned the project collection's
first category, taken to be "import". A project can hold other
top-level categories before it: examples/lmdg.qet has "k_elem" first.
Imported symbols were then filed under k_elem/, while every lookup of an
imported symbol is under import/ (QETProject::importElement(),
XmlElementCollection::addElement()). The first placement worked; the
second could not find the copy, tried to import it again and failed.
In the editor the drop silently placed nothing; a script's
qet.addElement() returned "".
Look the category up by name, falling back to the first one as before
when a project has none called "import".
Test: tst_importcategory places the same symbol twice in a copy of
lmdg.qet through --run. It fails without the fix (the second placement
returns "") and passes with it. ctest 45/45.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Selecting several parts by clicking them in the Parts list, then dragging
one on the drawing, moved only the part under the cursor; the others
stayed where they were. No selection handles were shown either.
updateSelectionFromPartsList() blocks the scene's signals while it copies
the list selection to the drawing, so selectionChanged never reached
ElementScene::managePrimitivesGroups(), which sets up the decorator that
moves a multi-part selection. Call it once the signals are unblocked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A selection of several parts is moved by ElementPrimitiveDecorator, which
snapped to a fixed 1-unit step at every zoom. That is the "selection is
big" half of #112: below 100 % one part landed on the 10 grid but a
multi-part selection did not, and at 100-400 % it ignored the grid too.
It now snaps to the editor's current grid, as a single part does; Ctrl
still gives the fine 1-unit step. Resizing and arrow-key moves are
unchanged.
Also from review: add rows just below each zoom threshold to
tst_elementviewgrid (each catches a moved threshold the old rows missed),
and use one grid_step in drawBackground() instead of identical x/y copies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pressing OK in Projet > Propriétés du projet without changing anything
marked the project modified and rewrote its defaults for new folios.
Besides the Page Num placeholder (fixed separately), four causes:
- Title block custom fields: since #271 the dialog offers the
template's variables for filling in; those left empty came back as
part of the context. Drop the ones not in the stored context.
- DiagramContext::remove() left the key's show flag behind, so a
context with a key removed never equalled one without it.
- Guides: applyConf() marked the project modified whether or not the
guides changed. Compare them like every other setting.
- Wire dash size and cross-reference offsets: the spin boxes cannot
show the stored default (dash size 1 under a minimum of 2; offset 0
under a minimum of 40 shown as "Default"), so the clamped value came
back. Keep the stored value unless the box shows something else, as
#1204 did for the wire panel.
Checked in the GUI (with the Page Num fix as well) on grafcet,
schema_indus and Projet_vierge: OK with no edit then Ctrl+S saves the
same file as Ctrl+S alone; master writes dash-size 1 -> 2, a
cross-reference offset 0 -> 40, and on Projet_vierge 22 empty custom
fields. New test for DiagramContext::remove() fails without the fix.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
In Projet > Propriétés du projet > Nouveau folio, the Page Num box shows
a "Créer un Folio Numérotation Auto" entry when the project has no folio
auto-numbering. Pressing OK, even without touching anything, returned
that entry's text as the numbering's name: it was saved in the project
as auto_page_num (in the interface's language), and since it differed
from the stored empty value the project was marked modified.
When the project has numberings, an empty stored value cannot be shown
at all, so the first numbering came back instead.
Return the stored value unless the user picks an entry (activated() is
only emitted for a user's choice), and never return the placeholder.
Checked in the GUI on grafcet, schema_indus and Projet_vierge: after OK
with no edit and Ctrl+S, master saves auto_page_num="Créer un Folio
Numérotation Auto"; this branch keeps auto_page_num="". An edited field
on the same page (default author) is still saved.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The conductor properties dialog disables the "Texte visible" checkbox
when the folio has "Afficher un texte de potentiel par folio" on, but it
also hides that option, so nothing told the user why the box could not
be ticked. A wire saved with its text off then looked impossible to fix.
The locked box's tooltip now names the folio option and where to change
it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AssignVariables::replaceVariable() is a fixed list of replacements. Every
auxiliary family is listed for blocks 1 to 4 except the machine
manufacturer reference, which stopped at the plain
%{machine_manufacturer_reference}. A text using one of the four
auxiliary forms printed the variable itself on the folio and in exports.
Add the four, next to their manufacturer-reference neighbours.
Test: tst_resaveunchanged resaves a project with one terminal whose
texts combine each machine reference variable with its neighbour, and
checks the saved texts carry the values. It fails without the fix (the
variable is saved as typed) and passes with it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Below 100 % ElementView::drawBackground() hid the grid and also set the
snap step to 1 unit, so anything dragged while zoomed out landed off the
grid with nothing on screen to show it. A large symbol opens fitted to
the window below 100 %, which is why the report also says "when the
selection is big".
Keep hiding the grid below 100 % (its dots would merge into a grey
wash), but snap every 10 units, as at 100 %. The zoom-to-grid rule moves
into a header-only ElementViewGrid so it can be tested without an
editor window, like textgrid.h.
Checked in the editor: a one-rectangle symbol zoomed out to about 0.6x,
its edge dragged by (15, 10) px and saved: master moves it by (28, 18),
this branch by (30, 20). tst_elementviewgrid fails with the old step 1
and passes now; ctest 45/45.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A contact (slave) not linked to a coil has no element to take its label
from: DynamicElementTextItem::elementUseForInfo() returns null. Since
8985babfe (#978) the composite-text branch of updateLabel() called
element->actualLabel() without checking, so a text built from %{label}
on such a contact crashed QElectroTech while the project was loading
(QETProject::refresh -> Diagram::refreshContents). The project could not
be opened again.
Check the element as the ElementInfo branch above already does; with no
element, %{label} shows empty, as it did before 8985babfe.
Test: tst_resaveunchanged opens a blank project holding one unlinked
contact with a %{label} text. It fails without the fix (the --resave
crashes) and passes with it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>