Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config editor; revise model traits, Spinner widget, SizeMgr::dpem, ... #334

Merged
merged 27 commits into from
Jul 14, 2022

Conversation

dhardy
Copy link
Collaborator

@dhardy dhardy commented Jul 13, 2022

The highlight of this PR is a new editor for event config:
config-editor

The code for this in the gallery is tiny; essentially just:

let config = toolkit.event_config().clone();
let editor: SingleView<SharedRc<Config>> = SingleView::new(config);

Instead the editor implementation is an impl of kas::widgets::view::driver::Driver for driver::DefaultView, and thus easy to re-use.

Quite a few other changes happened as part of this work:

  • Add kas_core::label::StrLabel: a hidden simple label widget used for macro-generated implicit widgets from string literals (rationale: this feature is now usable within kas_widgets)
  • Replace Vec2::max_abs_comp with max_comp (can be used with Vec2::abs)
  • Add TkAction::EMPTY
  • Revise Spinner widget: bug-fix + cleaner code
  • Rename trait SpinnerTypeSpinnerValue and SliderTypeSliderValue
  • Slider and Spinner now have optional event-handling closures like Button, CheckBox etc.
  • Replace usages of Rc<RefCell<Config>> with SharedRc<Config> and update derived values when the shared value is updated
  • SharedRc: add borrow, try_borrow, update_mut methods (eventually these should move to the SharedData trait but that requires GATs)
  • SharedRc: remove ListData and MatrixData impls
  • Rename trait SingleData to SharedData (and *Mut version); use as base of ListData, MatrixData: this means we now have a useful trait as the basis of all shared data
  • Add Data: SharedData as a type parameter to Driver; add Driver::on_message to handle event messages (this replaces SingleData::handle_message etc.)
  • Make kas_widgets::edit a public module containing EditField and associates
  • Add SizeMgr::dpem, min_scroll_size; remove pixels_from_* methods and line_height
  • Revise and unify handling of scroll-wheel actions (using event config)

dhardy added 27 commits July 13, 2022 17:32
This avoids the need for macros to depend on kas_widgets
Also: document macro syntax for implicit widgets in layout
…abs)

Also: use L-inf metric in EventState::config_test_pan_thresh
Rationale: the Driver impl knows about the view widget
and what messages it sends. The Data type doesn't.
Also: add NotifyGuard type
Also: event handling for Driver impls over Edit* widgets
Also: add EventMgr::try_observe_msg
Also: add Toolkit::event_config
@dhardy dhardy merged commit 7b8da00 into master Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant