mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 02:09:00 +00:00
Merge pull request #2762 from aiongg/panel-states-memo
Panel states as memo props: Color, Actions and scope panels (#2336)
This commit is contained in:
@@ -60,7 +60,9 @@ impl ActionsSettings {
|
||||
|
||||
/// The Actions panel's persisted section: Button Mode and the collapsed sets.
|
||||
/// Selection and expansion are not persisted.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(
|
||||
Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, craft_ui::contract::MemoProps, craft_ui::contract::PlainData,
|
||||
)]
|
||||
#[serde(default, rename_all = "camelCase")]
|
||||
#[non_exhaustive]
|
||||
pub struct ActionsSettings {
|
||||
@@ -72,7 +74,7 @@ pub struct ActionsSettings {
|
||||
|
||||
/// A row of the tree: a set header, an action or one of its steps. Also the selection (one row at
|
||||
/// a time) and the list's key.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, craft_ui::contract::MemoProps, craft_ui::contract::PlainData)]
|
||||
#[non_exhaustive]
|
||||
pub enum ActionSelection {
|
||||
/// The set header of this name.
|
||||
@@ -89,7 +91,7 @@ pub enum ActionSelection {
|
||||
/// The panel remaps `selected` itself when it reports a [`Reorder`](ActionsEvent::Reorder)
|
||||
/// that moves a row, since it owns the selection. After a [`Delete`](ActionsEvent::Delete) the
|
||||
/// app clears `selected` (the panel cannot tell which rows the delete removed).
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, craft_ui::contract::MemoProps, craft_ui::contract::PlainData)]
|
||||
#[non_exhaustive]
|
||||
pub struct ActionsPanelState {
|
||||
/// The persisted section.
|
||||
|
||||
@@ -62,7 +62,19 @@ craft_ui::words! {
|
||||
|
||||
/// What the panel shows: Photoshop's panel menu choices, in its order. Hue Cube is the default;
|
||||
/// the theme never changes it.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Hash,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
craft_ui::contract::MemoProps,
|
||||
craft_ui::contract::PlainData,
|
||||
)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[non_exhaustive]
|
||||
pub enum ColorPanelMode {
|
||||
@@ -129,7 +141,19 @@ impl ColorPanelMode {
|
||||
}
|
||||
|
||||
/// The ramp under the sliders. Shift-click on the ramp cycles them in this order.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Hash,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
craft_ui::contract::MemoProps,
|
||||
craft_ui::contract::PlainData,
|
||||
)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[non_exhaustive]
|
||||
pub enum ColorPanelRamp {
|
||||
@@ -179,7 +203,9 @@ impl ColorPanelRamp {
|
||||
}
|
||||
|
||||
/// The Color panel's settings, kept across runs (settings section `color_panel`).
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, craft_ui::contract::MemoProps, craft_ui::contract::PlainData,
|
||||
)]
|
||||
#[serde(default, rename_all = "camelCase")]
|
||||
#[non_exhaustive]
|
||||
pub struct ColorPanelState {
|
||||
|
||||
@@ -207,7 +207,7 @@ impl HistogramData {
|
||||
}
|
||||
|
||||
/// A range of whole levels (bin positions) a plot has selected, both ends included.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, craft_ui::contract::MemoProps, craft_ui::contract::PlainData)]
|
||||
#[non_exhaustive]
|
||||
pub struct LevelRange {
|
||||
/// The first level.
|
||||
|
||||
@@ -4,7 +4,19 @@ use crate::ui::histogram::LevelRange;
|
||||
use crate::ui::scopes::clipping::{ClippingDiagnostic, ClippingMode, ClippingWarnings};
|
||||
|
||||
/// The panel's view (its menu's Compact, Expanded and All Channels View).
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Hash,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
craft_ui::contract::MemoProps,
|
||||
craft_ui::contract::PlainData,
|
||||
)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[non_exhaustive]
|
||||
pub enum ScopeView {
|
||||
@@ -20,7 +32,7 @@ pub enum ScopeView {
|
||||
/// The scope panel's persisted section: the app keeps it with its preferences (PhotoCraft's
|
||||
/// `histogramPanel` and `filter.cameraRaw.scope`). Unknown fields are ignored, missing ones take
|
||||
/// their defaults.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize, craft_ui::contract::MemoProps, craft_ui::contract::PlainData)]
|
||||
#[serde(default, rename_all = "camelCase")]
|
||||
#[non_exhaustive]
|
||||
pub struct ScopeSettings {
|
||||
@@ -93,7 +105,7 @@ impl ScopeSettings {
|
||||
|
||||
/// What the panel keeps for the app between passes: the persisted settings and the selected
|
||||
/// level range (not persisted).
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, craft_ui::contract::MemoProps, craft_ui::contract::PlainData)]
|
||||
#[non_exhaustive]
|
||||
pub struct ScopePanelState {
|
||||
/// The persisted section.
|
||||
|
||||
Reference in New Issue
Block a user