Skip to content

v0.32.0

Choose a tag to compare

@github-actions github-actions released this 17 Oct 02:36
· 7 commits to main since this release
f0e14eb

What changed and why

Two public API additions make this a minor release. First, the core options whose geometry is edited by dragging a teaching shape
now implement INotifyPropertyChanged and raise it for the values a grip writes. Second, CvDispCtrl.FitToView() is new. Both
came from a consumer request. Without the first, a number row in CvPropEditCtrl kept its old value while a grip was dragged,
because the editor redraws a row only when the source notifies. Without the second, a host could not bring a hidden-then-shown
display back to the fitted view: hiding is not a resize, so the zoom stayed, and the fit was internal.

Take this release if you show a grip-edited value in CvPropEditCtrl (for example the ring-fill band RMinPx/RMaxPx, or a
CvRegionOpt used as the editor source) and want it to follow the drag; if you want your own view-model to hear grip edits on a
core option; or if you want a display that was hidden and shown again to return to the fit.

Upgrading from 0.31.0:

  • If you subscribe to CvPatternOpt.PropertyChanged and ignore PropertyName, your handler now runs on every drag step of the
    train or search region (up to five times per mouse move), not only when Trained changes. Filter on the property name if the
    handler marks the recipe dirty, retrains, or rebuilds the edit shapes.
  • If a CvPropEditCtrl row has text that was typed but not yet committed, dragging the grip that writes that value now replaces the
    text with the dragged value. Before, the typed text survived and overwrote the drag when the row lost focus.
  • Code that uses FitToView() or subscribes to PropertyChanged on one of the newly notifying types will not compile against
    0.31.x.

Core — grip-edited geometry notifies (new API)

CvUnwrapOpt, CvRingFillOpt, CvBlobOpt, CvCropOpt, CvEdgeFilterOpt, CvFindLineOpt, CvHoughCircleOpt, CvRegionOpt
and CvFindCircleOpt now implement INotifyPropertyChanged. CvPatternOpt already did, for Trained; it now also notifies its
train and search region coordinates. CvColorSegmentOpt is unchanged; its region is a CvRegionOpt, which notifies on its own.

What is notified is narrow on purpose: the geometry a grip writes, plus CvFindCircleOpt's span toggle, which writes the same
values from a button. Ordinary settings that are edited in the property editor do not notify, so PropertyChanged is not a dirty
signal; CvPropEditCtrl.Committed still is. Assigning the value a property already holds does not notify.

One grip write is stored completely before anything is raised. A shape's Changed writes several axes (a diagonal drag moves X
and Y). If each setter raised as it went, a subscriber would read a rectangle with a new X and an old Y. A host that called
EditShapeSync from inside PropertyChanged would then push the old Y back into the shape and lose that axis of the drag without
any error. The independent review before this release found that while the change was still on dev, and it is fixed here.

Most grip coordinates stay hidden from the property editor ([Browsable(false)]). They now notify, but the stock editor has no row
for them. The visible ones that follow a drag are the ring-fill band and a CvRegionOpt given directly as the editor source.

Wpf — CvDispCtrl.FitToView() (new API)

Same as the ⛶ toolbar button: drops the user's zoom and pan and fits the image. The fit is applied at the next draw. It can be
called while the control is collapsed or hidden, and the control shows fitted when it comes back. Calling it before the first frame
is harmless. Call it on the UI thread. The toolbar button and the context-menu item now call it.

Documentation

The CvPropEditCtrl README row and doc comment no longer say that most sources lack INotifyPropertyChanged. They say what a
source notification does (re-reads the row, is not a commit) and that it replaces uncommitted text in that row. Comments that hid
grip coordinates "because the editor is a static snapshot" are gone — that premise no longer holds; the coordinates stay hidden.

Tests

The core suite grows from 138 to 140 and the WPF suite from 55 to 57.

  • GripEditsNotifyEveryPropertyTheyWrite drags every grip of every core shape source and compares all values before and after.
    Any value that changed without a PropertyChanged fails, without a hand-written property list. It also checks that every
    notification inside one grip write sees the same geometry, using shape Set calls that move several axes in one Changed, and it
    asserts that such multi-axis writes happened (otherwise that check would prove nothing). The set of shape sources is found by
    reflection, so a new one fails until it is added.
  • ResyncingTheShapeInsidePropertyChangedKeepsEveryAxis reproduces the lost-axis case: on per-setter notification, the opt ends at
    130,100 instead of 130,160.
  • GripDragUpdatesTheNumberRowLive drags the ring-fill band and checks that both number rows follow, with no commit. It then types
    into a row and checks one commit and the canonical text.
  • FitToViewRestoresTheFitEvenWhileHidden covers a visible control, Collapsed and Hidden. Each has a control that skips
    FitToView and keeps the zoom.

Each fix was mutation-checked: turning off notification, notifying per setter, and an empty FitToView each turn the matching tests
red.

Version

0.32.0 — minor. Public API was added: INotifyPropertyChanged on nine option types and CvDispCtrl.FitToView(). The patch
exception for completing the previous minor's feature does not apply.

Checks

  • dotnet build CvInspect.sln -c Release --no-incremental reports 0 warnings (an incremental build reports none when it recompiles nothing)
  • main is an ancestor of this branch (the release-pr-guard job verifies it)
  • the tag will be created on the merge commit, main merged back into dev afterwards, and dev bumped to the next -dev version