#1001 names STRETCH and TRIM; #1555's tests cover MOVE, idle picks,
window corners and CPOLYGON. These cases from #1059 check that a click
made while the mouse moves counts where the button went down in
STRETCH (pick and window), MOVE (pick, and a slow drag is a window),
TRIM, with no command running, with PICKDRAG off, at a click-click
window's second corner, and over overlapping objects with selection
cycling. #1059's fast-long-drag case is left out: under the press-first
model a quick release is a click however far the mouse went.
Co-authored-by: Aldo Zarate <azarate@azf.com.mx>
#1555 acts on presses where the button goes down, but leaves grips (no
command running) to egui's click. egui calls a press held longer than
0.8 s a drag, and on a drawing that draws slowly an ordinary click lasts
that long, so the grip ignored it (#2813).
A press on a grip is now remembered and clicks the grip when the button
comes up within the press tolerance, however long it was held; a drag
from it still does nothing. #2853's slow-click tests come along: the
grip case fails without this change, the others pin press-first clicks
across slow frames.
Co-authored-by: austin62jake <340374338+austin62jake@users.noreply.github.com>
With #1748 a quick right-click between commands is Enter whenever the
time-sensitive right-click is on, and a longer click opens the shortcut
menu. Main's Right-Click Customization (#2371) still let Default and Edit
modes set to "Repeat last command" take every idle right-click, so a
longer click repeated the command instead of opening the menu.
As in AutoCAD, the modes now apply with the time-sensitive right-click
off, and the window greys them out with it on, as it does Command mode.
The Right-Click Customization tests set the option off where they test
the modes; a new test holds the button with both modes on repeat.
Adds the Dimension Style Manager: DIMSTYLE, D, DST, DDIM and both menu items open it, with the style list, a preview, Set Current, New, Modify, Override, Compare, Delete, Rename and the seven tabs. Also adds -DIMSTYLE and dimstyle.overrides; properties.describe and properties.set rows for text, mtext and dimensions in the Properties palette; and the dimension shortcut menu. Ported from #1042 (with #954, #994 and #1008), on top of this PR's dialog and its validation.
An open manager page is cancelled when another drawing becomes active (from #2322).
Fixes#1459, #1417, #1389.
Co-authored-by: eldrir <jamie@eldrir.com>
Co-authored-by: Slopapalooza <ai.slopapalooza@gmail.com>
Co-authored-by: Luminati <347279204+luminatiguy@users.noreply.github.com>
Signed-off-by: FredApps <153173854+FredApps@users.noreply.github.com>
- LISP: entlast sees a routine's own edits; entmod keeps INSERT attributes; HANDSEED is live
- lisp: drop a closed drawing's environment; keep entlast's order across property edits
- lisp: HANDSEED skips the handles the file's objects hold; hold the order in its cache test
- lisp: namedobjdict, dictsearch, dictnext, tblobjname; handent and entget of non-graphic objects (#1659, #1661)
- lisp: tblobjname matches names as the roles spell them; records cache held by a weak drawing reference (#1659)
- lisp: CodeRabbit follow-ups on non-graphic objects (#1659, #1661)
- lisp: test an imported DIMSTYLE's group-105 handle (#1659, #1661)
- docs: a DIMSTYLE's own name is in group 105 (#1659)
- engine: install AutoLISP's object records with their own setter (#1659, #1661)
- Windows: a file opened while CADCraft runs opens as a tab in the running window
- single instance: only a refused or missing socket counts as stale (review)
- single instance: the Windows socket test removes its temporary folder (review)
- single instance: the socket is named after the whole session name (review)
- single instance: a short fixed socket name, relative paths refused (review)
- single instance: Cargo.lock lists uds_windows, the fallbacks log at warn (review)
Co-authored-by: Alex-BB44 <273073052+Alex-BB44@users.noreply.github.com>
* Updates: take craft-update from craft-libs main at 6e03f65bf
* Updates: take craft-update from craft-libs main at e9829954
Moves craft-update to craft-libs e98299546f5c5c3c22388d16507f8b5e61a5f280,
which includes storytold/craft-libs#923: the update check's thread now
reads whether the copy can install itself, so Updater::tick no longer
walks the installed files.
* Blocks palette: list/medium/large icon modes, visible-only preview cache, grab-and-drop placement
* Address CodeRabbit review: repeat-placement tracking, Arc<Drawing> clone, contains_pointer, docstrings
* Keep repeat INSERT inside engine state machine and leave canvas hover check intact
* Handle Repeat/NoRepeat across all INSERT stages and bound preview work budget
* Fix Blocks palette review findings and preflight polyline previews
* Fix Blocks palette review findings and menu click ownership
* Restore bounded hatch thumbnails and exclude navigation clicks
* Support faithful hatch previews with shared work budget and bounded contour fallback
* Allow checking Repeat placement while block insertion is already in progress
* Address PR 2122 review feedback on hatch budget, ViewCube hit-testing and preview test
* Charge leader and wipeout expansion and bound MLeader array inserts in preview preflight
* Charge MLeader paths in preview preflight and match ViewCube hit-testing to displayed sheet
* Allow block insertion while rename editor is open and clarify hatch preview docs
* Limit palette repeat placement to palette-started insertions
* Account hatch preview comparisons as work occurs
* Bound attribute thumbnail work and preserve palette rotation
* Charge spline sampling work to the block preview budget
* Charge splines at 1/32 of their sampling cap so ordinary blocks still preview
* Charge text lengths in block preview budget and preserve inline INSERT arguments
* Bound MText column metadata in block previews
* Allow detailed block palette previews
* Explain refused block previews and keep them cached while scrolling
Previews now return Ready, Empty or Unavailable(reason) instead of an
ambiguous empty display list, so a refused thumbnail is no longer shown
like an empty block. Preflight separates input, computation and retained
output, and reuses the geometry/render sampling rules at a thumbnail
tolerance instead of a 4,000-sample worst case. A 64 MiB / 512-result LRU
replaces retain_visible. Insertion never depends on preview success.
Also: invalid-but-finite splines draw as their control polygon, and the
insertion-point prompt advertises REpeat so R keeps meaning Rotate.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Remove changes unrelated to the Blocks palette
Drop the contributor entry and the two xtask test adjustments so the PR
only contains palette, preview and insertion changes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Document the functions touched by the Blocks palette preview work
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Keep placement on unchanged rename and tighten palette click ownership
Confirming a block name unchanged no longer cancels the INSERT in progress.
Command-line releases are not placed as points when two arrive in one frame,
and menu ownership of a press is taken from the press position of the last
press in the frame.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Translate palette refusal messages and track canvas click ownership per release
Mark the five preview refusal texts for translation and add the palette status
texts to the other catalogs. Give each primary release in a frame the owner of
its own press, and place a release at its own position when the cursor has
moved onto a menu or a new press has begun.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Treat navigation controls as release owners in batched canvas clicks
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Track INSERT ownership and refuse palette edits during a foreign INSERT
The palette now cancels only the INSERT it started (identified by a per-run serial), advertises REpeat/NoRepeat at every numeric and point prompt, and refuses Edit, Create, Rename and Delete while an INSERT it did not start is running, so undoing that insertion cannot also undo a palette edit.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Keep clicks on command-line keywords from placing canvas points
The command line now records one rectangle covering the bar and every inline keyword, and the canvas treats a press, release or ordinary click there as the command line's, so a keyword pushed past the bar by a long prompt cannot also send a point.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Decide whether the ViewCube is shown from the current space, not the display list
The display list is rebuilt after a frame's clicks are handled, so right after a layout switch it was stale or cleared. A click where the ViewCube had just disappeared was dropped, and a click on one that had just appeared reached the drawing as a point. Painting and hit-testing now share viewcube_shown, which follows the layout space.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Treat only a refused charge as hatch budget exhaustion
Spending the hatch budget exactly left zero remaining, which hatch::draw and the preview builder read as exhaustion, so a valid preview could lose its hatches or be refused. HatchBudget now records a refused reservation separately and both checks use it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Keep CLOSEALL's confirmation, widen the command-line click area, persist the Blocks window choice
Only {json} calls and INSERT with inline arguments bypass the UI router, so CLOSEALL Y still asks before discarding drawings. The command line's click rectangle now includes the history lines or window, the resize grip and the AutoComplete rows. The floating-window preference of the Blocks palette is saved and restored with the other preferences.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Update Z and axis presets with a comma scale; grey the palette's Y scale when exploding
A comma-separated scale preset now sets Z to the size of X and the axis presets to X, Y and that Z, so an earlier Scale cannot leave a stale Z. The Blocks palette disables its Y scale while Explode is on, with a tooltip saying the exploded insertion scales both axes by X.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Fix doc comments on the BLOCK and ATTDEF input methods and the INSERT tests
BlockM::input and AttdefM::input named the INSERT state machine; the NoRepeat description sat on the comma-scale test instead of the repeat test, and the two newer INSERT tests had none of their own.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Reset the Verify counter between repeated INSERT placements
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Blocks palette: previews, block libraries and placement
Rewrite this PR on a smaller base. The Blocks window becomes a dockable
palette with a Current Drawing tab and a Libraries tab, icon and list views,
a kept list of block libraries (folders and DWG/DXF files) and one-click
placement through the existing interactive INSERT.
- Previews are built only for the visible tiles, a few per frame, under a
time and point budget, in a bounded least-recently-used cache.
- BLOCKLIBRARY, BLOCKLIBIMPORT and BLOCKLIBRARIES are commands; importing a
library block brings only the layers, linetypes, styles and blocks it needs.
- INSERT: Enter at the insertion point ends the command, as in AutoCAD.
- Hostile library files and block data are bounded; nothing panics.
- The canvas, ViewCube, command-line and interactive INSERT changes of the
earlier version are gone.
- Translations in all interface languages.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Blocks palette: read libraries off the UI thread, bound preview work
CodeRabbit's reviews of f2ae408 and 62bff60:
- A library is listed on a worker thread (the web reads it at once), with
a "Reading the library..." message in every catalog. Refresh waits for
the read, and now parses the file again even when its size and time
look the same. `list_library` is what BLOCKLIBRARY answers, without a
session.
- A preview's work is counted before anything is drawn: vertices, text,
and the blocks references, dimensions and multileaders draw. An object
with nothing in it still costs one visit. The pass that finds the size
draws no dashes, and a block of points no longer scans the drawing's
extents.
- A block listing keeps the first blocks by name without sorting the
whole table, for BLOCKSPALETTE too.
- Merging a drawing removes nothing from a drawing too big for the purge
scan: past its limit, a layer or style in use can look unused.
Also fixed: a block with more than 100,000 references could lose the
blocks it needs on import, because the walk counted repeated names. The
same count in `used_blocks`, which PURGE shares, could drop the arrowhead
of a merged dimension style, so that limit goes too: each block is walked
once, so the walk ends, cycles included.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Blocks palette: repeat a placement only after its own INSERT placed
The palette took any new handle as proof that its INSERT had placed the
block. Queued control requests can cancel that INSERT and run another
command to its end between two frames, and that command's handles then
started a placement nobody asked for.
The session now says how the last command ended: `commands_started`
numbers the commands, nested transparent ones left out, and
`last_finished` holds the number of the last one that ended by itself and
whether it added to the drawing. The palette repeats only when that is its
own INSERT, which also removes its handle counter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Blocks palette: a command started after a placement ends the repeat
A command with no prompt, such as REGEN, started right after INSERT placed
the block left `last_finished` on that INSERT, so the palette started
placing again after the user had moved on. The palette now also requires
that no command has started since.
A JSON command still does not end the repeat, on purpose: it never stops a
running command, so one that lands a frame later finds the next INSERT
running and leaves it alone. Ending the repeat only when it lands before
the frame would make the result depend on timing. A test pins this.
Also adds the doc comments CodeRabbit's coverage check asks for, on this
PR's own functions and tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* INSERT: a cancelled placement takes no undo step
INSERT wrote INSNAME when the name was given, so cancelling it left a
changed drawing and an undo step that undid nothing visible. Repeat
Placement, on by default, always ends with a cancelled INSERT, so the first
undo after placing a block from the palette appeared to do nothing.
INSNAME is now written when the block is placed. A cancelled INSERT no
longer offers its name as the next default.
Tests go through the palette where they only imitated it: the scale set in
the palette, and the two undo steps of a block from a library. The palette
places with two clicks, so the wording about a drag is gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Block import: keep what a block names and says about itself
BLOCKLIBIMPORT defined a new block from the chosen one's objects and base
point, so its description, annotative flag, units and explodable flag were
lost. They now come along.
The import's clean-up uses PURGE's scan, which only read the linetypes of
objects and layers. A linetype named only by a dimension style, a dimension
override, a multiline style, a multiline's copy of its style or an attribute
override looked unused, so the import dropped it and PURGE removed it while
the style still named it. The scan reads them all now.
A reference to a renamed anonymous block kept the drawing's block of that
name when it spelled the name in another case, or when it was a multileader's
block content. Both now take the new name, found as Drawing::block finds a
block.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* INSERT: Enter asks again at the insertion point, arrowheads follow renames
This PR made Enter and Space at the insertion point end INSERT, "as in
AutoCAD". AutoCAD 2027 does not: from -INSERT, from its palette and during
repeated placement it answers that a point or option is needed and asks
again. Only Escape ends it, so that change is gone.
A file named at the block name prompt defines its block before the insertion
point is asked for, and Escape keeps that definition, which is what AutoCAD
2027 does too. A test pins it.
An anonymous arrowhead block renamed by a merge kept its old name in the
dimension styles that came along and in dimension overrides, so they pointed
at this drawing's block. Both follow the rename now; a style this drawing
already had keeps its own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Block import and palette: keep every named style and layer, skip unused counts
Selective import uses PURGE's scans, which missed dimension styles named by
leaders, text styles named by linetype pattern elements, table cell styles,
dimension DIMTXSTY overrides and multiline or multileader-content attributes,
plus layers and linetypes named by attributes on multileader block content.
They all count as in use now.
The palette asks BLOCKSPALETTE for no reference counts so it does not read
every object after each edit, and cancels any running command before importing
a library block so the import keeps its own undo step.
* Blocks palette: a quick right-click at the insertion point cancels the placement
A placement started from the palette had no way out with the mouse: Enter at
the insertion point asks again, as AutoCAD 2027 does, and a quick right-click
is Enter. At that prompt only, for an INSERT the palette started, a quick
right-click now ends the command like Escape, which also ends Repeat
Placement. A typed INSERT and the scale and rotation prompts keep Enter, and
holding the button still opens the command menu.
Escape, the menu's Cancel and this right-click share one function that also
clears the half-typed text and the IME preedit; the menu's Cancel left the
preedit behind.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Blocks palette: a transparent command no longer stops Repeat Placement
A 'ZOOM or 'PAN run while the palette's INSERT asks for the insertion point
shows the prompt `>>ZOOM`, which the palette took for another command and so
stopped repeating the placement. A transparent command inside the INSERT does
not start a command; it is now the count of commands started that tells
whether the user moved on. A test pins it.
The blocklibrary params string names the `truncated` field both results
return.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Blocks palette: a transparent command ending inside INSERT is not its end; bound library reads
A transparent command that finishes inside a running one ('ZOOM in an INSERT)
recorded its end under the outer command's number. With an object added
meanwhile, cancelling the resumed INSERT looked like a placement and the
palette started another. Only a top-level command records its end now.
Switching quickly between big libraries started a reading thread for each. At
most four libraries are read at once; a further one waits, and the palette
says it is reading until a place comes back.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Blocks palette: BLOCKLIBIMPORT never replaces a block; BLOCKSPALETTE counts every object that draws one
BLOCKLIBIMPORT refuses a name the drawing already has (any letter case),
the rule the palette already follows, so a direct JSON call can no longer
change existing references. BLOCKSPALETTE counts block references,
dimensions and multileader block content through `referenced_block`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Blocks palette: a library file must be named .dwg or .dxf
cached_drawing read any regular path, and the reader sniffs the bytes, so a
DXF named part.bin was listed by BLOCKLIBRARY, imported by BLOCKLIBIMPORT and
loaded by the palette. It now refuses other names before the cache lookup, so
the three callers share the check. Regression test with a part.bin.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Blocks palette: library listing needs no drawing; a preview's two passes share one deadline
BLOCKLIBRARY and BLOCKLIBRARIES ignore the session but had the has_doc guard,
so the palette opened on the Start tab got "no drawing open", kept an empty
library list and never reloaded it. They are now always enabled; BLOCKLIBIMPORT
still needs a drawing.
outline() gave each of its two build passes the full PREVIEW_DEADLINE, so one
preview could take twice the limit. The detailed pass now gets what the coarse
pass left.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Blocks palette: a dimension override given as a number names its style, linetype or arrowhead
DIMOVERRIDE keeps a number as given (DIMTXSTY 123) and the dimension is
drawn with it as text, but the in-use scans only read strings, so PURGE,
style deletion and import cleanup could drop a style, linetype or
arrowhead block still in use. `purge::override_name` reads either, for
text styles, linetypes, arrowheads (main's `override_arrows` had the same
defect) and the arrowhead rename at import, which now rewrites an
override only when its block is really renamed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Blocks palette: put show()'s doc comment back on show()
right_click_cancels_placing had been inserted between show()'s doc comment
(the cursor-visibility contract, #1701) and show() itself, so the contract
documented the wrong function. Moved, no code change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* i18n(ka): add the 27 Blocks palette strings
Georgian rows for the strings this PR adds to the other catalogs (cargo test -p cadcraft-ui-egui translation_gaps -- --ignored --nocapture lists none of them any more).
---------
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
findfile only accepted regular files, so (findfile "dir") and
(findfile "dir/.") gave nil for a folder that exists. Routines test
whether an optional module is installed with (findfile "module/.").
A folder now counts too; the name is returned as given, as for a file.
Resolve the MTEXT conflicts with #3197 (jayzed80's #2952 fix) on the
shared tokenizer: Token::Unknown is now shown as typed (backslash kept,
code read as text) in plain_mtext, the layout parser and the paragraph
scan, matching main's behaviour. Drop the now-unneeded too_many_lines
expectation on parse.