mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 02:09:00 +00:00
Merge pull request #2578 from aiongg/component-constants
Component constants and component sets (creative and office looks, rulers first)
This commit is contained in:
@@ -81,7 +81,7 @@ Egui paths are resolved through the file's `use` items (one table per file, grou
|
||||
|
||||
Names are resolved through the file's `use` items, per module scope: grouped imports, renames (`use egui::Margin as M`), module aliases (`use crate::theme as t`) and glob imports (`use crate::theme::*`) all reach the rule table, so `margin(4.0)` is flagged after `use crate::theme::margin`. A bare name that a fn in the same module defines is not extended through globs. Imports in a module do not apply in sibling modules.
|
||||
|
||||
A literal is a number, optionally negated, parenthesised, cast or in arithmetic; zero is never flagged. A name is flagged when a `const` or `static` in the same file with that name has such a value. Consts are keyed by module and impl scope: a bare name takes the innermost scope that defines it, `Self::X`, `self::X`, `super::X`, `crate::X`, `Type::X` and `module::X` (last two segments) the scope they name, and a name with several candidates is flagged when any is non-zero.
|
||||
A literal is a number, optionally negated, parenthesised, cast or in arithmetic; zero is never flagged. A name is flagged when a `const` or `static` in the same file with that name has such a value, unless it is a component constant: a module- or impl-level `const` with a doc comment, the named place for a dimension of one component's own drawing (craft-framework.md 5.4). A name that resolves to a component constant is not a literal size, and its initializer is its definition, so the literals in it are not flagged either. A `const` inside a fn body, a `static` and an undocumented `const` are flagged as literals. Consts are keyed by module and impl scope: a bare name takes the innermost scope that defines it, `Self::X`, `self::X`, `super::X`, `crate::X`, `Type::X` and `module::X` (last two segments) the scope they name, and a name with several candidates is flagged when any is non-zero.
|
||||
|
||||
## Markers
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ pub(crate) fn analyze_file(src: &str, file: &syn::File, include_tests: bool) ->
|
||||
imports: Vec::new(),
|
||||
fns: Vec::new(),
|
||||
scope: Vec::new(),
|
||||
in_named_const: false,
|
||||
out: Analysis::default(),
|
||||
include_tests,
|
||||
};
|
||||
@@ -184,6 +185,9 @@ struct ConstDef {
|
||||
line: usize,
|
||||
expr: Expr,
|
||||
value: Option<f64>,
|
||||
/// A component constant: a module- or impl-level `const` with a doc comment. A name that resolves to it is not a
|
||||
/// literal size, and its initializer is its definition, not a call site.
|
||||
named: bool,
|
||||
}
|
||||
|
||||
/// A `use` declaration: `alias` is the name it brings in, `None` for a glob (`path::*`).
|
||||
@@ -202,6 +206,8 @@ struct Linter<'a> {
|
||||
fns: Vec<(Vec<Frame>, String)>,
|
||||
/// The modules and impl blocks around the item being visited.
|
||||
scope: Vec<Frame>,
|
||||
/// Inside the initializer of a named const, where `literal-size/*` does not apply.
|
||||
in_named_const: bool,
|
||||
out: Analysis,
|
||||
include_tests: bool,
|
||||
}
|
||||
@@ -212,17 +218,21 @@ struct ConstCollector {
|
||||
imports: Vec<Import>,
|
||||
fns: Vec<(Vec<Frame>, String)>,
|
||||
scope: Vec<Frame>,
|
||||
/// How many fn bodies enclose the item being visited.
|
||||
fn_depth: usize,
|
||||
include_tests: bool,
|
||||
}
|
||||
|
||||
impl ConstCollector {
|
||||
fn add(&mut self, name: &syn::Ident, expr: &Expr) {
|
||||
/// Records a const or static; `documented` is whether it is a `const` with a doc comment.
|
||||
fn add(&mut self, name: &syn::Ident, expr: &Expr, documented: bool) {
|
||||
self.defs.push(ConstDef {
|
||||
scope: self.scope.clone(),
|
||||
name: name.to_string(),
|
||||
line: name.span().start().line,
|
||||
expr: expr.clone(),
|
||||
value: None,
|
||||
named: documented && self.fn_depth == 0,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -256,9 +266,21 @@ impl<'ast> Visit<'ast> for ConstCollector {
|
||||
fn visit_item_fn(&mut self, i: &'ast syn::ItemFn) {
|
||||
if !self.skipped(&i.attrs) {
|
||||
self.fns.push((module_scope(&self.scope).to_vec(), i.sig.ident.to_string()));
|
||||
self.fn_depth += 1;
|
||||
visit::visit_item_fn(self, i);
|
||||
self.fn_depth -= 1;
|
||||
}
|
||||
}
|
||||
fn visit_impl_item_fn(&mut self, i: &'ast syn::ImplItemFn) {
|
||||
self.fn_depth += 1;
|
||||
visit::visit_impl_item_fn(self, i);
|
||||
self.fn_depth -= 1;
|
||||
}
|
||||
fn visit_trait_item_fn(&mut self, i: &'ast syn::TraitItemFn) {
|
||||
self.fn_depth += 1;
|
||||
visit::visit_trait_item_fn(self, i);
|
||||
self.fn_depth -= 1;
|
||||
}
|
||||
fn visit_item_use(&mut self, i: &'ast syn::ItemUse) {
|
||||
if !self.skipped(&i.attrs) {
|
||||
let mut found = Vec::new();
|
||||
@@ -268,15 +290,15 @@ impl<'ast> Visit<'ast> for ConstCollector {
|
||||
}
|
||||
}
|
||||
fn visit_item_const(&mut self, i: &'ast syn::ItemConst) {
|
||||
self.add(&i.ident, &i.expr);
|
||||
self.add(&i.ident, &i.expr, has_doc(&i.attrs));
|
||||
visit::visit_item_const(self, i);
|
||||
}
|
||||
fn visit_item_static(&mut self, i: &'ast syn::ItemStatic) {
|
||||
self.add(&i.ident, &i.expr);
|
||||
self.add(&i.ident, &i.expr, false);
|
||||
visit::visit_item_static(self, i);
|
||||
}
|
||||
fn visit_impl_item_const(&mut self, i: &'ast syn::ImplItemConst) {
|
||||
self.add(&i.ident, &i.expr);
|
||||
self.add(&i.ident, &i.expr, has_doc(&i.attrs));
|
||||
visit::visit_impl_item_const(self, i);
|
||||
}
|
||||
}
|
||||
@@ -349,6 +371,11 @@ fn last_ident(path: &syn::Path) -> Option<String> {
|
||||
path.segments.last().map(|s| s.ident.to_string())
|
||||
}
|
||||
|
||||
/// Whether an item carries a doc comment (`///` or `#[doc = ...]`).
|
||||
fn has_doc(attrs: &[Attribute]) -> bool {
|
||||
attrs.iter().any(|a| a.path().is_ident("doc"))
|
||||
}
|
||||
|
||||
fn cfg_is_test(meta: &Meta) -> bool {
|
||||
match meta {
|
||||
Meta::Path(p) => p.is_ident("test"),
|
||||
@@ -420,8 +447,14 @@ impl Linter<'_> {
|
||||
}
|
||||
|
||||
fn resolve_consts(&mut self, file: &syn::File) {
|
||||
let mut collector =
|
||||
ConstCollector { defs: Vec::new(), imports: Vec::new(), fns: Vec::new(), scope: Vec::new(), include_tests: self.include_tests };
|
||||
let mut collector = ConstCollector {
|
||||
defs: Vec::new(),
|
||||
imports: Vec::new(),
|
||||
fns: Vec::new(),
|
||||
scope: Vec::new(),
|
||||
fn_depth: 0,
|
||||
include_tests: self.include_tests,
|
||||
};
|
||||
collector.visit_file(file);
|
||||
self.defs = collector.defs;
|
||||
self.imports = collector.imports;
|
||||
@@ -431,7 +464,8 @@ impl Linter<'_> {
|
||||
.defs
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, d)| d.value.is_none())
|
||||
// A named const keeps no literal value: a name that resolves to it reads like a token.
|
||||
.filter(|(_, d)| d.value.is_none() && !d.named)
|
||||
.filter_map(|(i, d)| self.eval_in(&d.expr, &d.scope).map(|v| (i, v)))
|
||||
.collect();
|
||||
if resolved.is_empty() {
|
||||
@@ -552,12 +586,21 @@ impl Linter<'_> {
|
||||
Some((shown, def.line))
|
||||
}
|
||||
|
||||
/// Whether the const item named `ident` is a named const (`ConstDef::named`).
|
||||
fn is_named_const(&self, ident: &syn::Ident) -> bool {
|
||||
let line = ident.span().start().line;
|
||||
self.defs.iter().any(|d| d.named && d.line == line && *ident == d.name)
|
||||
}
|
||||
|
||||
fn is_flagged_size(&self, e: &Expr) -> bool {
|
||||
self.eval(e).is_some_and(|v| v != 0.0)
|
||||
}
|
||||
|
||||
/// Reports `what` when any of `args` is a non-zero literal size.
|
||||
fn size_rule<'e>(&mut self, rule: &'static str, what: proc_macro2::Span, args: impl IntoIterator<Item = &'e Expr>) {
|
||||
if self.in_named_const {
|
||||
return;
|
||||
}
|
||||
let args: Vec<&Expr> = args.into_iter().collect();
|
||||
// A vector of literal -1, 0 and 1 is a direction, not a size.
|
||||
if rule == VEC2 && args.iter().all(|a| is_unit_literal(a)) {
|
||||
@@ -726,11 +769,21 @@ fn is_unit_literal(e: &Expr) -> bool {
|
||||
|
||||
fn hint(rule: &str) -> &'static str {
|
||||
match rule {
|
||||
VEC2 => "use a size token (`Tokens::of(ui).size.control.md`, `space.gap.inline`) or mark `// design: allow(<reason>)`",
|
||||
ADD_SPACE => "use a spacing token (`Tokens::of(ui).space.gap.inline`) or mark `// design: allow(<reason>)`",
|
||||
CORNER_RADIUS => "use a radius token from `Tokens::of(ui)` or mark `// design: allow(<reason>)`",
|
||||
STROKE => "use a stroke width token from `Tokens::of(ui)` or mark `// design: allow(<reason>)`",
|
||||
MARGIN => "use a spacing token (`Tokens::of(ui).space`) or mark `// design: allow(<reason>)`",
|
||||
VEC2 => {
|
||||
"use a size token (`Tokens::of(ui).size.control.md`, `space.gap.inline`), a documented module-level const for a dimension of the component's own drawing, or mark `// design: allow(<reason>)`"
|
||||
}
|
||||
ADD_SPACE => {
|
||||
"use a spacing token (`Tokens::of(ui).space.gap.inline`), a documented module-level const for a dimension of the component's own drawing, or mark `// design: allow(<reason>)`"
|
||||
}
|
||||
CORNER_RADIUS => {
|
||||
"use a radius token from `Tokens::of(ui)`, a documented module-level const for a dimension of the component's own drawing, or mark `// design: allow(<reason>)`"
|
||||
}
|
||||
STROKE => {
|
||||
"use a stroke width token from `Tokens::of(ui)`, a documented module-level const for a dimension of the component's own drawing, or mark `// design: allow(<reason>)`"
|
||||
}
|
||||
MARGIN => {
|
||||
"use a spacing token (`Tokens::of(ui).space`), a documented module-level const for a dimension of the component's own drawing, or mark `// design: allow(<reason>)`"
|
||||
}
|
||||
TOOLTIP => "use `craft_ui::contract::Props::tooltip` or `craft_ui::contract::Show::show_with_tip` or mark `// design: allow(<reason>)`",
|
||||
STYLE_MUTATION => "set styles through the theme (craft-ui installs them from the tokens) or mark `// design: allow(<reason>)`",
|
||||
_ => "use a type-size token from `Tokens::of(ui)` or mark `// design: allow(<reason>)`",
|
||||
@@ -774,9 +827,18 @@ impl<'ast> Visit<'ast> for Linter<'_> {
|
||||
}
|
||||
fn visit_item_const(&mut self, i: &'ast syn::ItemConst) {
|
||||
if !self.skips(&i.attrs, i.span()) {
|
||||
let named = self.in_named_const || self.is_named_const(&i.ident);
|
||||
let outer = std::mem::replace(&mut self.in_named_const, named);
|
||||
visit::visit_item_const(self, i);
|
||||
self.in_named_const = outer;
|
||||
}
|
||||
}
|
||||
fn visit_impl_item_const(&mut self, i: &'ast syn::ImplItemConst) {
|
||||
let named = self.in_named_const || self.is_named_const(&i.ident);
|
||||
let outer = std::mem::replace(&mut self.in_named_const, named);
|
||||
visit::visit_impl_item_const(self, i);
|
||||
self.in_named_const = outer;
|
||||
}
|
||||
fn visit_item_static(&mut self, i: &'ast syn::ItemStatic) {
|
||||
if !self.skips(&i.attrs, i.span()) {
|
||||
visit::visit_item_static(self, i);
|
||||
|
||||
@@ -58,6 +58,7 @@ const CLOSED: &[&str] = &[
|
||||
"ReorderMove", // built or matched in craft-ui-patterns
|
||||
"RowState", // built or matched in craft-ui-widgets
|
||||
"RuleLook", // built or matched in craft-ui-canvas
|
||||
"RulerFace", // matched by every ruler (craft-text, craft-pages, craft-ui-canvas): a new face must be drawn by each
|
||||
"ShellRegions", // built or matched in craft-ui-shell
|
||||
"SizeLimits", // built or matched in craft-ui-panels
|
||||
"StoryOutput", // built or matched in craft-ui-widgets
|
||||
|
||||
@@ -67,6 +67,20 @@ fn consts_resolve_by_module_and_impl_scope() {
|
||||
assert_eq!(run(src).len(), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn documented_consts_are_component_constants() {
|
||||
// A documented module or impl const is a named value, its initializer included; arithmetic on it reads like a token.
|
||||
let src = "/// The tick.\nconst TICK: f32 = 3.0;\n/// The room.\nconst ROOM: Vec2 = vec2(30.0, 40.0);\nstruct A;\nimpl A {\n /// The pad.\n const PAD: f32 = 6.0;\n fn f(&self, ui: &mut Ui) { ui.add_space(Self::PAD); ui.add_space(TICK * 2.0); let v = vec2(TICK, ROOM.y); }\n}\n";
|
||||
assert!(clean(src));
|
||||
|
||||
// An undocumented const, a documented const in a fn body and a literal stay flagged.
|
||||
let src = "const GAP: f32 = 4.0;\nfn f(ui: &mut Ui) { ui.add_space(GAP); }\nfn g(ui: &mut Ui) {\n /// The gap.\n const LOCAL: f32 = 4.0;\n ui.add_space(LOCAL);\n}\nfn h(ui: &mut Ui) { ui.add_space(4.0); }\n";
|
||||
assert_eq!(run(src).iter().map(|f| f.line).collect::<Vec<_>>(), [2, 6, 8]);
|
||||
|
||||
// The initializer of an undocumented const is a call site.
|
||||
assert!(flagged("const ROOM: Vec2 = vec2(30.0, 40.0);\n", "literal-size/vec2"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clippy_allow_attributes_are_counted_and_inner_ones_flagged() {
|
||||
let src = "#![allow(clippy::disallowed_methods, reason = \"stock widgets\")]\n#[expect(clippy::disallowed_types)]\nstruct S;\n#[allow(clippy::too_many_arguments)]\nfn f() {}\nmod m {\n #![expect(clippy::disallowed_methods)]\n}\n";
|
||||
|
||||
@@ -10,7 +10,6 @@ use craft_ui::primitives::{Draw, ToolIcon};
|
||||
use egui::Vec2;
|
||||
|
||||
/// The apex of the Convert Point icon's caret, in the units of the icon's box.
|
||||
// design: allow[literal-size/vec2](the cursor art's hot spot offset in icon units, not a layout size)
|
||||
const CONVERT_TIP: Vec2 = Vec2::new(ICON_BOX / 2.0, 5.5);
|
||||
|
||||
/// The canvas tool of Add Anchor Point, Delete Anchor Point, Convert Point and Direct Selection. Every press of these
|
||||
|
||||
@@ -17,7 +17,7 @@ use craft_ui::contract::{
|
||||
Access, Bind, Common, Component, Cx, Focus as _, IdSource, Input, MeasureCx, Name, NoValue, Numeric, Outcome, PaintUi, PartsCx, Pointer as _,
|
||||
Props as _, Remember as _, Role, Show as _, Styled as _, WordSetCx as _,
|
||||
};
|
||||
use craft_ui::primitives::{PaintShape, StrokeWidth, TextRun, Tick, TickEdge, TickRank};
|
||||
use craft_ui::primitives::{PaintShape, RulerFace, StrokeWidth, TextRun, Tick, TickEdge, TickRank};
|
||||
use craft_ui::runtime::env::{Env, Label};
|
||||
use craft_ui::runtime::focus::{ActivateKeys, FocusShape, KeyUse};
|
||||
use craft_ui::style::{ComponentStyle, FocusLook, StyleColor, StyleCx, TextLook, TypeRole};
|
||||
@@ -80,6 +80,10 @@ pub struct VerticalRulerStyle {
|
||||
metrics: Metrics,
|
||||
#[style(focus)]
|
||||
focus: FocusLook,
|
||||
/// The face: the prop's, else the component set's.
|
||||
face: RulerFace,
|
||||
/// The strip round the centred face's bar.
|
||||
strip: StyleColor,
|
||||
/// The text range.
|
||||
fill: StyleColor,
|
||||
/// The margins above and below it.
|
||||
@@ -113,6 +117,9 @@ struct Held(Option<(usize, f32)>);
|
||||
/// shaded as margin and the text range filled, and a drag of a grip is one gesture.
|
||||
///
|
||||
/// - Ticks and numbers count from the page's top in the unit, through the canvas rulers' tick rule.
|
||||
/// - The face ([`RulerFace`]) is the prop's, else the component set's: the edge face hangs the ticks from the strip's
|
||||
/// inner edge with each number below its whole-unit tick; the centred face (Word's) draws a bar inset in the strip
|
||||
/// with the ticks centred on it and the numbers in place of the whole-unit ticks, over the text range only.
|
||||
/// - A grip drag reports a [`RowDrag`]: Begin, Update per move, Commit on release, Cancel on Escape. It snaps to the
|
||||
/// ruler's step; Alt reports in `mods` that the drag is free of the snap and the position is not snapped.
|
||||
/// - The grips are one Tab stop: Page Down and Page Up pick the next or previous grip, the arrows nudge the focused one
|
||||
@@ -133,13 +140,17 @@ pub struct VerticalRuler<'a> {
|
||||
/// The table row bottoms, points from the page's top, each a grip.
|
||||
#[prop]
|
||||
rows: &'a [f32],
|
||||
/// The face; unset, the scope's component set picks it ([`RulerFace::of`]).
|
||||
#[style_key]
|
||||
#[prop]
|
||||
face: Option<RulerFace>,
|
||||
report: Option<RowDrag>,
|
||||
}
|
||||
|
||||
impl<'a> VerticalRuler<'a> {
|
||||
/// The ruler named `label` along `page`.
|
||||
pub fn new(label: impl Into<Label>, page: &'a PlacedPage) -> Self {
|
||||
VerticalRuler { common: Common::new(), page, text: None, unit: DocUnit::points(), rows: &[], report: None }.label(label)
|
||||
VerticalRuler { common: Common::new(), page, text: None, unit: DocUnit::points(), rows: &[], face: None, report: None }.label(label)
|
||||
}
|
||||
|
||||
/// Screen points per page point.
|
||||
@@ -170,12 +181,14 @@ impl Component for VerticalRuler<'_> {
|
||||
type Style = VerticalRulerStyle;
|
||||
type Output = VerticalRulerOutput;
|
||||
|
||||
fn style(cx: &StyleCx<'_>, _: VerticalRulerStyleKey) -> VerticalRulerStyle {
|
||||
fn style(cx: &StyleCx<'_>, key: VerticalRulerStyleKey) -> VerticalRulerStyle {
|
||||
let tokens = cx.tokens;
|
||||
let colors = &tokens.color;
|
||||
VerticalRulerStyle {
|
||||
metrics: Metrics::new(),
|
||||
focus: cx.focus_look(),
|
||||
face: key.face.unwrap_or(RulerFace::of(cx.set())),
|
||||
strip: cx.color(colors.surface.chrome),
|
||||
// As `TextRuler`'s: the text range is the light well, the margins are shaded as the desk round the page.
|
||||
fill: cx.color(colors.surface.sunken),
|
||||
margin: cx.color(colors.surface.canvas),
|
||||
@@ -307,38 +320,61 @@ impl Component for VerticalRuler<'_> {
|
||||
let text = ruler_text(self.unit, &numbers);
|
||||
let per_doc = text.units.per_doc;
|
||||
let shape = |rect: Rect| PaintShape::Rect(rect, CornerRadius::ZERO);
|
||||
let draw = ui.draw();
|
||||
draw.fill(&shape(rect), style.margin);
|
||||
let face = style.face;
|
||||
let bar = ui.content_painter(cx).ruler_bar(rect, TickEdge::Right, face);
|
||||
let page = Rect::from_x_y_ranges(rect.x_range(), self.y(0.0)..=self.y(self.page_height())).intersect(rect);
|
||||
if let Some(range) = self.text {
|
||||
let band = Rect::from_x_y_ranges(rect.x_range(), self.y(range.min)..=self.y(range.max)).intersect(page);
|
||||
if band.is_positive() {
|
||||
draw.fill(&shape(band), style.fill);
|
||||
let draw = ui.draw();
|
||||
// The edge face shades the whole strip; the centred face shades the page's span of its bar on the strip's own
|
||||
// surface.
|
||||
match face {
|
||||
RulerFace::Edge => draw.fill(&shape(rect), style.margin),
|
||||
RulerFace::Centred => {
|
||||
draw.fill(&shape(rect), style.strip);
|
||||
draw.fill(&shape(Rect::from_x_y_ranges(bar.x_range(), page.y_range())), style.margin);
|
||||
}
|
||||
}
|
||||
let text_band = self.text.map(|range| Rect::from_x_y_ranges(bar.x_range(), self.y(range.min)..=self.y(range.max)).intersect(page));
|
||||
if let Some(band) = text_band.filter(|band| band.is_positive()) {
|
||||
draw.fill(&shape(band), style.fill);
|
||||
}
|
||||
let grips: Vec<Rect> = self.rows.iter().map(|row| self.grip_rect(rect, style, *row)).collect();
|
||||
let (lo, hi) = (((page.min.y - self.y(0.0)) / scale).max(0.0), ((page.max.y - self.y(0.0)) / scale).max(0.0));
|
||||
let ticks: Vec<RulerTick> =
|
||||
Rulers::ticks(&text.units, TickRule::of_unit(self.unit.kind), f64::from(scale), (f64::from(lo) * per_doc)..=(f64::from(hi) * per_doc));
|
||||
let marks: Vec<Tick> = ticks
|
||||
.iter()
|
||||
.map(|tick| self.y((tick.value / per_doc) as f32))
|
||||
.zip(ticks.iter())
|
||||
.filter(|(y, _)| (page.min.y..=page.max.y).contains(y))
|
||||
.map(|(y, tick)| Tick::new(y - rect.min.y, tick.rank))
|
||||
.collect();
|
||||
ui.content_painter(cx).ticks(rect, TickEdge::Right, &marks);
|
||||
let draw = ui.draw();
|
||||
let color: StyleColor = cx.resolve(&style.label.color);
|
||||
// The centred face numbers the text range only, as a word processor's vertical ruler does.
|
||||
let numbered_span = match face {
|
||||
RulerFace::Edge => page,
|
||||
RulerFace::Centred => text_band.unwrap_or(page),
|
||||
};
|
||||
let mut runs = Vec::new();
|
||||
for tick in ticks.iter().filter(|tick| matches!(tick.rank, TickRank::Major)) {
|
||||
let y = self.y((tick.value / per_doc) as f32);
|
||||
let run = TextRun::new(text.tick_label(&numbers, tick.value, tick.step)).role(style.label.role).color(color);
|
||||
let size = draw.layout(&run, f32::INFINITY).size();
|
||||
let boxed = Rect::from_min_size(pos2(rect.min.x, y + style.pad), vec2(rect.width(), size.y));
|
||||
if page.contains_rect(boxed) && size.x <= rect.width() && !grips.iter().any(|grip| grip.intersects(boxed)) {
|
||||
draw.text(boxed, &run);
|
||||
let boxed = match face {
|
||||
RulerFace::Edge => Rect::from_min_size(pos2(rect.min.x, y + style.pad), vec2(rect.width(), size.y)),
|
||||
RulerFace::Centred => RulerFace::centred_number(bar, TickEdge::Right, y, size),
|
||||
};
|
||||
let span = Rect::from_x_y_ranges(rect.x_range(), numbered_span.y_range());
|
||||
if span.contains_rect(boxed) && size.x <= bar.width() && !grips.iter().any(|grip| grip.intersects(boxed)) {
|
||||
runs.push((boxed, run));
|
||||
}
|
||||
}
|
||||
let marks: Vec<Tick> = ticks
|
||||
.iter()
|
||||
.map(|tick| (self.y((tick.value / per_doc) as f32), tick))
|
||||
.filter(|(y, _)| (page.min.y..=page.max.y).contains(y))
|
||||
.map(|(y, tick)| Tick::new(y - bar.min.y, tick.rank))
|
||||
.collect();
|
||||
let boxes: Vec<Rect> = runs.iter().map(|(boxed, _)| *boxed).collect();
|
||||
let marks = face.beside_numbers(TickEdge::Right, bar.min.y, marks, &boxes, style.pad);
|
||||
ui.content_painter(cx).ticks(bar, TickEdge::Right, face, &marks);
|
||||
let draw = ui.draw();
|
||||
for (boxed, run) in &runs {
|
||||
draw.text(*boxed, run);
|
||||
}
|
||||
for grip in &grips {
|
||||
draw.fill(&shape(*grip), style.margin);
|
||||
draw.stroke(&shape(*grip), StrokeWidth::Thin, style.marker);
|
||||
@@ -374,7 +410,8 @@ pub struct PageRulersOutput {
|
||||
/// their edges win. It shows no guides, no zero point and no units menu; `Rulers` is unchanged.
|
||||
///
|
||||
/// The text ruler counts from the text column's start edge and is cut to the page's width; the vertical ruler counts
|
||||
/// from the page's top and shades the margins. The strips are as thick as the canvas rulers' strips.
|
||||
/// from the page's top and shades the margins. The strips are as thick as the canvas rulers' strips. Both rulers take
|
||||
/// the face given here, else the scope's component set's.
|
||||
#[must_use = "show the rulers with `show_at`"]
|
||||
#[derive(craft_ui::contract::Pattern)]
|
||||
pub struct PageRulers<'a> {
|
||||
@@ -393,6 +430,7 @@ pub struct PageRulers<'a> {
|
||||
mirrored_even: bool,
|
||||
id: IdSource,
|
||||
gaps_draggable: bool,
|
||||
face: Option<RulerFace>,
|
||||
}
|
||||
|
||||
impl<'a> PageRulers<'a> {
|
||||
@@ -414,9 +452,16 @@ impl<'a> PageRulers<'a> {
|
||||
mirrored_even: false,
|
||||
id: IdSource::Auto,
|
||||
gaps_draggable: true,
|
||||
face: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The face of both rulers ([`TextRuler::face`], [`VerticalRuler::face`]); unset, the scope's component set picks it.
|
||||
pub fn face(mut self, face: RulerFace) -> Self {
|
||||
self.face = Some(face);
|
||||
self
|
||||
}
|
||||
|
||||
/// Salts the text ruler's id with `salt` (the caret paragraph's key): a new salt is a new ruler, so a drag open on
|
||||
/// the ruler of another paragraph ends with no commit.
|
||||
pub fn id_salt(mut self, salt: impl AsIdSalt) -> Self {
|
||||
@@ -503,6 +548,7 @@ impl<'a> PageRulers<'a> {
|
||||
mirrored_even,
|
||||
id,
|
||||
gaps_draggable,
|
||||
face,
|
||||
} = self;
|
||||
let (words, interface_rtl) = {
|
||||
let env = Env::of(ui);
|
||||
@@ -536,11 +582,17 @@ impl<'a> PageRulers<'a> {
|
||||
if let Some(kind) = kind {
|
||||
horizontal = horizontal.kind(kind);
|
||||
}
|
||||
if let Some(face) = face {
|
||||
horizontal = horizontal.face(face);
|
||||
}
|
||||
let ruler_out = horizontal.show_at(ui, top_strip);
|
||||
|
||||
let vertical_label = Label::from(words.vertical.fill(&[("name", label.as_str())]));
|
||||
let vertical =
|
||||
VerticalRuler::new(vertical_label, page).text(Rangef::new(top as f32, bottom as f32)).unit(unit).rows(rows).show_at(ui, left_strip);
|
||||
let mut vertical = VerticalRuler::new(vertical_label, page).text(Rangef::new(top as f32, bottom as f32)).unit(unit).rows(rows);
|
||||
if let Some(face) = face {
|
||||
vertical = vertical.face(face);
|
||||
}
|
||||
let vertical = vertical.show_at(ui, left_strip);
|
||||
|
||||
let margins_label = Label::from(words.margins.fill(&[("name", label.as_str())]));
|
||||
let margins =
|
||||
|
||||
@@ -10,6 +10,7 @@ use crate::ui::view::{PageView, PageViewState};
|
||||
use craft_text::ui::DocUnit;
|
||||
use craft_text::ui::ruler::{RulerValues, TabAlign};
|
||||
use craft_ui::contract::{Bind, Show as _};
|
||||
use craft_ui::primitives::RulerFace;
|
||||
use craft_ui::runtime::env::UnitKind;
|
||||
use craft_ui::testing::{Drive, StoryData, StoryOutput, story};
|
||||
use egui::{Rangef, Rect, Ui, pos2, vec2};
|
||||
@@ -37,31 +38,46 @@ fn inches() -> DocUnit {
|
||||
DocUnit::new(UnitKind::Inches, 96.0)
|
||||
}
|
||||
|
||||
/// The vertical ruler along a demo page, with `rows` and the text range when `text` is set.
|
||||
fn vertical(ui: &mut Ui, rows: &[f32], text: Option<Rangef>) -> StoryOutput {
|
||||
/// The vertical ruler along a demo page, with `rows`, the text range when `text` is set and `face` when set.
|
||||
fn vertical(ui: &mut Ui, rows: &[f32], text: Option<Rangef>, face: Option<RulerFace>) -> StoryOutput {
|
||||
let full = craft_ui::testing::stage(ui);
|
||||
let page = demo_placed(1, pos2(full.min.x + STRIP, full.min.y + PAGE_TOP)).remove(0);
|
||||
// design: allow[literal-size/vec2](the strip is the demo page margin in document points, story data)
|
||||
let strip = Rect::from_min_size(full.min, vec2(STRIP, full.height()));
|
||||
let mut ruler = VerticalRuler::new("Vertical ruler", &page).unit(inches()).rows(rows);
|
||||
if let Some(range) = text {
|
||||
ruler = ruler.text(range);
|
||||
}
|
||||
if let Some(face) = face {
|
||||
ruler = ruler.face(face);
|
||||
}
|
||||
ruler.show_at(ui, strip).into()
|
||||
}
|
||||
|
||||
#[story(VerticalRuler<'static>, covers = [Default], drive = Drive::Never)]
|
||||
fn with_row_grips(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
||||
vertical(ui, &ROWS, None)
|
||||
vertical(ui, &ROWS, None, None)
|
||||
}
|
||||
|
||||
#[story(VerticalRuler<'static>, covers = [], drive = Drive::Never)]
|
||||
fn text_range_shaded(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
||||
vertical(ui, &[], Some(Rangef::new(TEXT.0, TEXT.1)))
|
||||
vertical(ui, &[], Some(Rangef::new(TEXT.0, TEXT.1)), None)
|
||||
}
|
||||
|
||||
/// The edge face: ticks grow from the strip's inner edge, each number below its whole-unit tick.
|
||||
#[story(VerticalRuler<'static>, covers = [], drive = Drive::Never)]
|
||||
fn vertical_edge_face(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
||||
vertical(ui, &ROWS, Some(Rangef::new(TEXT.0, TEXT.1)), Some(RulerFace::Edge))
|
||||
}
|
||||
|
||||
/// The centred face (the office set's): a bar inset in the strip, ticks centred on it, numbers in place of the
|
||||
/// whole-unit ticks over the text range only.
|
||||
#[story(VerticalRuler<'static>, covers = [], drive = Drive::Never)]
|
||||
fn vertical_centred_face(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
||||
vertical(ui, &ROWS, Some(Rangef::new(TEXT.0, TEXT.1)), Some(RulerFace::Centred))
|
||||
}
|
||||
|
||||
/// The rulers around one demo page, the margin edges and the paragraph's values kept in the story's data.
|
||||
fn single_page(ui: &mut Ui, data: &mut StoryData, right_to_left: Option<bool>) -> StoryOutput {
|
||||
fn single_page(ui: &mut Ui, data: &mut StoryData, right_to_left: Option<bool>, face: Option<RulerFace>) -> StoryOutput {
|
||||
let full = craft_ui::testing::stage(ui);
|
||||
let page = demo_placed(1, pos2(full.min.x + PAGE_LEFT, full.min.y + PAGE_TOP)).remove(0);
|
||||
let state = data.value("rulers", (PageEdges::new(Margins::uniform(72.0)), RulerValues::default()));
|
||||
@@ -75,6 +91,9 @@ fn single_page(ui: &mut Ui, data: &mut StoryData, right_to_left: Option<bool>) -
|
||||
if right_to_left.is_some() {
|
||||
rulers = rulers.right_to_left(right_to_left);
|
||||
}
|
||||
if let Some(face) = face {
|
||||
rulers = rulers.face(face);
|
||||
}
|
||||
rulers.show_at(ui, full).margins.into()
|
||||
}
|
||||
|
||||
@@ -93,10 +112,22 @@ fn multi_page_view_with_rulers_on_page_2(ui: &mut Ui, data: &mut StoryData) -> S
|
||||
|
||||
#[story(PageRulers<'static>, covers = [], drive = Drive::Never)]
|
||||
fn table_and_two_columns(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
single_page(ui, data, None)
|
||||
single_page(ui, data, None, None)
|
||||
}
|
||||
|
||||
/// Both rulers in the edge face.
|
||||
#[story(PageRulers<'static>, covers = [], drive = Drive::Never)]
|
||||
fn page_edge_face(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
single_page(ui, data, None, Some(RulerFace::Edge))
|
||||
}
|
||||
|
||||
/// Both rulers in the centred face (the office set's).
|
||||
#[story(PageRulers<'static>, covers = [], drive = Drive::Never)]
|
||||
fn page_centred_face(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
single_page(ui, data, None, Some(RulerFace::Centred))
|
||||
}
|
||||
|
||||
#[story(PageRulers<'static>, covers = [], drive = Drive::Never)]
|
||||
fn right_to_left(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
single_page(ui, data, Some(true))
|
||||
single_page(ui, data, Some(true), None)
|
||||
}
|
||||
|
||||
@@ -311,13 +311,11 @@ impl Component for PrintPreview<'_> {
|
||||
}
|
||||
// The description and the labels are text of the printed page; the preview shows where each stands.
|
||||
if marks.description {
|
||||
// design: allow[literal-size/vec2](printer's marks are page geometry in points, not UI sizes)
|
||||
let from = paper.left_bottom() + vec2(MARK_GAP, -MARK_GAP);
|
||||
// design: allow[literal-size/vec2](printer's marks are page geometry in points, not UI sizes)
|
||||
rule(RuleKind::Edge, from, from + vec2(MARK_LEN * 3.0, 0.0));
|
||||
}
|
||||
if marks.labels {
|
||||
// design: allow[literal-size/vec2](printer's marks are page geometry in points, not UI sizes)
|
||||
let from = paper.left_top() + vec2(MARK_GAP, MARK_GAP);
|
||||
// design: allow[literal-size/vec2](printer's marks are page geometry in points, not UI sizes)
|
||||
rule(RuleKind::Edge, from, from + vec2(MARK_LEN * 3.0, 0.0));
|
||||
|
||||
@@ -20,6 +20,7 @@ use craft_ui::contract::{
|
||||
Access, Bind, BindMut, Common, Component, Cx, Edit as _, EditResponse, Input, MeasureCx, Name, Numeric, Outcome, PaintUi, PartsCx, Props as _,
|
||||
Role, WordSetCx as _,
|
||||
};
|
||||
use craft_ui::primitives::RulerFace;
|
||||
use craft_ui::runtime::focus::{ActivateKeys, FocusShape, KeyUse};
|
||||
use craft_ui::style::{ComponentStyle, Flags, FocusLook, Stateful, StyleColor, StyleCx, TextLook, TypeRole};
|
||||
use egui::{Rect, Response, Vec2};
|
||||
@@ -282,6 +283,10 @@ pub struct TextRulerStyle {
|
||||
metrics: Metrics,
|
||||
#[style(focus)]
|
||||
focus: FocusLook,
|
||||
/// The face: the prop's, else the component set's.
|
||||
face: RulerFace,
|
||||
/// The strip round the centred face's bar.
|
||||
strip: StyleColor,
|
||||
/// The column.
|
||||
fill: StyleColor,
|
||||
/// The margins beside the column.
|
||||
@@ -326,7 +331,9 @@ pub struct TextRulerStyle {
|
||||
///
|
||||
/// - Ticks and numbers in the unit through the canvas rulers' tick rule (inches follow Word's sixteenths), from the
|
||||
/// column's start edge; numbers keep clear of the markers. The column takes the ruler's fill, the margins the
|
||||
/// margin shade.
|
||||
/// margin shade. The face ([`RulerFace`]) is the prop's, else the component set's: the edge face hangs the ticks
|
||||
/// from the strip's bottom with each number beside its whole-unit tick; the centred face (Word's) draws a bar inset
|
||||
/// in the strip with the ticks centred on it and the numbers in place of the whole-unit ticks.
|
||||
/// - Indent markers (Word's): the first-line triangle down at the top, the hanging triangle up and the left box under
|
||||
/// it at the bottom, the right triangle at the right. Dragging the box moves first-line and left together; Alt drags
|
||||
/// freely (no snap).
|
||||
@@ -388,6 +395,10 @@ pub struct TextRuler<'a> {
|
||||
/// The stop shown picked.
|
||||
#[prop(name = "picked_stop")]
|
||||
selected: Option<usize>,
|
||||
/// The face; unset, the scope's component set picks it ([`RulerFace::of`]).
|
||||
#[style_key]
|
||||
#[prop]
|
||||
face: Option<RulerFace>,
|
||||
report: Report,
|
||||
}
|
||||
|
||||
@@ -408,6 +419,7 @@ impl<'a> TextRuler<'a> {
|
||||
scale: None,
|
||||
right_to_left: None,
|
||||
selected: None,
|
||||
face: None,
|
||||
report: Report::default(),
|
||||
}
|
||||
.label(label)
|
||||
@@ -478,12 +490,14 @@ impl Component for TextRuler<'_> {
|
||||
type Style = TextRulerStyle;
|
||||
type Output = TextRulerOutput;
|
||||
|
||||
fn style(cx: &StyleCx<'_>, _: TextRulerStyleKey) -> TextRulerStyle {
|
||||
fn style(cx: &StyleCx<'_>, key: TextRulerStyleKey) -> TextRulerStyle {
|
||||
let tokens = cx.tokens;
|
||||
let colors = &tokens.color;
|
||||
TextRulerStyle {
|
||||
metrics: Metrics::new(),
|
||||
focus: cx.focus_look(),
|
||||
face: key.face.unwrap_or(RulerFace::of(cx.set())),
|
||||
strip: cx.color(colors.surface.chrome),
|
||||
// The column is the light well the text goes in; the margins are shaded as the desk round the page, so the
|
||||
// column reads lighter than the margins in both modes.
|
||||
fill: cx.color(colors.surface.sunken),
|
||||
|
||||
@@ -6,7 +6,7 @@ use super::run::{Held, ruler_text};
|
||||
use super::{TextRuler, TextRulerStyle};
|
||||
use craft_ui::canvas::{RulerTick, Rulers, TickRule};
|
||||
use craft_ui::contract::{Cx, Edit as _, PaintUi, Remember as _, Styled as _};
|
||||
use craft_ui::primitives::{PaintShape, StrokeWidth, TextRun, Tick, TickEdge, TickRank};
|
||||
use craft_ui::primitives::{PaintShape, RulerFace, StrokeWidth, TextRun, Tick, TickEdge, TickRank};
|
||||
use craft_ui::style::StyleColor;
|
||||
use egui::{CornerRadius, Pos2, Rect, pos2, vec2};
|
||||
|
||||
@@ -17,15 +17,21 @@ impl TextRuler<'_> {
|
||||
let (g, shapes) = (layout.g, layout.shapes);
|
||||
let values = cx.value().cloned().unwrap_or_default();
|
||||
let held = cx.recall::<Held>();
|
||||
let draw = ui.draw();
|
||||
let rect = |rect: Rect| PaintShape::Rect(rect, CornerRadius::ZERO);
|
||||
let path = |a: Pos2, b: Pos2| PaintShape::Path(vec![a, b]);
|
||||
let visible = g.visible();
|
||||
draw.fill(&rect(visible), style.margin);
|
||||
draw.fill(&rect(g.column().intersect(visible)), style.fill);
|
||||
let bar = ui.content_painter(cx).ruler_bar(g.strip, TickEdge::Bottom, style.face);
|
||||
// The edge face shades the whole strip; the centred face shades its bar on the strip's own surface.
|
||||
let across = |part: Rect| Rect::from_x_y_ranges(part.x_range(), bar.y_range());
|
||||
let draw = ui.draw();
|
||||
if style.face == RulerFace::Centred {
|
||||
draw.fill(&rect(g.strip), style.strip);
|
||||
}
|
||||
draw.fill(&rect(across(visible)), style.margin);
|
||||
draw.fill(&rect(across(g.column().intersect(visible))), style.fill);
|
||||
for (start, end) in self.gaps {
|
||||
let (a, b) = (g.x(*start), g.x(*end));
|
||||
let gap = Rect::from_x_y_ranges(a.min(b)..=a.max(b), g.strip.y_range()).intersect(visible);
|
||||
let gap = Rect::from_x_y_ranges(a.min(b)..=a.max(b), bar.y_range()).intersect(visible);
|
||||
if gap.is_positive() {
|
||||
draw.fill(&rect(gap), style.margin);
|
||||
}
|
||||
@@ -114,34 +120,45 @@ impl TextRuler<'_> {
|
||||
let (lo, hi) = g.shown_span();
|
||||
let ticks: Vec<RulerTick> =
|
||||
Rulers::ticks(&text.units, TickRule::of_unit(self.unit.kind), f64::from(g.scale), (f64::from(lo) * per_doc)..=(f64::from(hi) * per_doc));
|
||||
let bar = ui.content_painter(cx).ruler_bar(g.strip, TickEdge::Bottom, style.face);
|
||||
let draw = ui.draw();
|
||||
let color: StyleColor = cx.resolve(&style.label.color);
|
||||
// Numbers count from the column's start edge, so none stand in the margins.
|
||||
let in_column = |at: f32| (0.0..=g.width).contains(&at);
|
||||
let mut runs = Vec::new();
|
||||
for tick in ticks.iter().filter(|tick| matches!(tick.rank, TickRank::Major)) {
|
||||
if !in_column((tick.value / per_doc) as f32) {
|
||||
continue;
|
||||
}
|
||||
let x = g.x((tick.value / per_doc) as f32);
|
||||
let label = text.tick_label(&numbers, tick.value, tick.step);
|
||||
let run = TextRun::new(label).role(style.label.role).color(color);
|
||||
let size = draw.layout(&run, f32::INFINITY).size();
|
||||
let boxed = match style.face {
|
||||
RulerFace::Edge => {
|
||||
let start = if g.right_to_left { x - style.pad - size.x } else { x + style.pad };
|
||||
Rect::from_min_size(pos2(start, g.strip.top()), vec2(size.x, g.strip.height()))
|
||||
}
|
||||
RulerFace::Centred => RulerFace::centred_number(bar, TickEdge::Bottom, x, size),
|
||||
};
|
||||
if g.visible().contains_rect(boxed) && !keep_clear.iter().any(|clear| clear.intersects(boxed)) {
|
||||
runs.push((boxed, run));
|
||||
}
|
||||
}
|
||||
// The tick rule adds a labelled step beyond each end; a ruler cut to its extent (a page's) shows none past it.
|
||||
let covered = g.visible().x_range();
|
||||
let marks: Vec<Tick> = ticks
|
||||
.iter()
|
||||
.map(|tick| g.x((tick.value / per_doc) as f32))
|
||||
.zip(&ticks)
|
||||
.map(|tick| (g.x((tick.value / per_doc) as f32), tick))
|
||||
.filter(|(x, _)| covered.contains(*x))
|
||||
.map(|(x, tick)| Tick::new(x - g.strip.min.x, tick.rank))
|
||||
.map(|(x, tick)| Tick::new(x - bar.min.x, tick.rank))
|
||||
.collect();
|
||||
ui.content_painter(cx).ticks(g.strip, TickEdge::Bottom, &marks);
|
||||
let boxes: Vec<Rect> = runs.iter().map(|(boxed, _)| *boxed).collect();
|
||||
let marks = style.face.beside_numbers(TickEdge::Bottom, bar.min.x, marks, &boxes, style.pad);
|
||||
ui.content_painter(cx).ticks(bar, TickEdge::Bottom, style.face, &marks);
|
||||
let draw = ui.draw();
|
||||
let color: StyleColor = cx.resolve(&style.label.color);
|
||||
// Numbers count from the column's start edge, so none stand in the margins.
|
||||
let in_column = |tick: &&RulerTick| {
|
||||
let at = (tick.value / per_doc) as f32;
|
||||
(0.0..=g.width).contains(&at)
|
||||
};
|
||||
for tick in ticks.iter().filter(|tick| matches!(tick.rank, TickRank::Major)).filter(in_column) {
|
||||
let x = g.x((tick.value / per_doc) as f32);
|
||||
let label = text.tick_label(&numbers, tick.value, tick.step);
|
||||
let run = TextRun::new(label).role(style.label.role).color(color);
|
||||
let width = draw.layout(&run, f32::INFINITY).size().x;
|
||||
let size = vec2(width, g.strip.height());
|
||||
let at = if g.right_to_left { pos2(x - style.pad - width, g.strip.top()) } else { pos2(x + style.pad, g.strip.top()) };
|
||||
let boxed = Rect::from_min_size(at, size);
|
||||
if g.visible().contains_rect(boxed) && !keep_clear.iter().any(|clear| clear.intersects(boxed)) {
|
||||
draw.text(boxed, &run);
|
||||
}
|
||||
for (boxed, run) in &runs {
|
||||
draw.text(*boxed, run);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::ui::length::DocUnit;
|
||||
use craft_behavior::Mixed;
|
||||
use craft_ui::canvas::Rulers;
|
||||
use craft_ui::contract::{Show as _, Validity};
|
||||
use craft_ui::primitives::RulerFace;
|
||||
use craft_ui::runtime::env::{Message, UnitKind};
|
||||
use craft_ui::testing::{Drive, Grip, StoryData, StoryOutput, story};
|
||||
use egui::Ui;
|
||||
@@ -85,8 +86,8 @@ const TWO_GAPS: [(f32, f32); 2] = [(144.0, 162.0), (306.0, 324.0)];
|
||||
/// Three gaps in the text width, between four columns.
|
||||
const THREE_GAPS: [(f32, f32); 3] = [(108.0, 126.0), (225.0, 243.0), (342.0, 360.0)];
|
||||
|
||||
#[story(TextRuler<'static>, covers = [], drive = Drive::Never)]
|
||||
fn page_wide(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
/// Word's ruler over a page, its zero at the left margin, in `face` (unset: the component set's).
|
||||
fn over_a_page(ui: &mut Ui, data: &mut StoryData, face: Option<RulerFace>) -> StoryOutput {
|
||||
let (values, values_at) = data.value_at("values", word());
|
||||
let stage = craft_ui::testing::stage(ui);
|
||||
let (strip, _) = Rulers::strips(ui, stage);
|
||||
@@ -96,7 +97,29 @@ fn page_wide(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
} else {
|
||||
(strip.min.x + PAGE_MARGIN, egui::Rangef::new(strip.min.x, strip.min.x + PAGE))
|
||||
};
|
||||
TextRuler::new("Ruler", values_at.bind(&mut *values), COLUMN).unit(inches()).origin(origin).extent(extent).scale(1.0).show_at(ui, strip).into()
|
||||
let mut ruler = TextRuler::new("Ruler", values_at.bind(&mut *values), COLUMN).unit(inches()).origin(origin).extent(extent).scale(1.0);
|
||||
if let Some(face) = face {
|
||||
ruler = ruler.face(face);
|
||||
}
|
||||
ruler.show_at(ui, strip).into()
|
||||
}
|
||||
|
||||
#[story(TextRuler<'static>, covers = [], drive = Drive::Never)]
|
||||
fn page_wide(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
over_a_page(ui, data, None)
|
||||
}
|
||||
|
||||
/// The edge face: ticks rise from the strip's bottom, each number beside its whole-unit tick.
|
||||
#[story(TextRuler<'static>, covers = [], drive = Drive::Never)]
|
||||
fn edge_face(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
over_a_page(ui, data, Some(RulerFace::Edge))
|
||||
}
|
||||
|
||||
/// The centred face (the office set's): a bar inset in the strip, ticks centred on it, numbers in place of the
|
||||
/// whole-unit ticks over the column only.
|
||||
#[story(TextRuler<'static>, covers = [], drive = Drive::Never)]
|
||||
fn centred_face(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
over_a_page(ui, data, Some(RulerFace::Centred))
|
||||
}
|
||||
|
||||
#[story(TextRuler<'static>, covers = [], drive = Drive::Never)]
|
||||
|
||||
@@ -4,11 +4,15 @@
|
||||
use craft_behavior::GesturePhase;
|
||||
use craft_text::ui::DocUnit;
|
||||
use craft_text::ui::ruler::{GapDrag, GapEdge, RulerValues, TabAlign, TabLeader, TabStop, TextRuler};
|
||||
use craft_theme::ComponentSet;
|
||||
use craft_ui::buttons::Button;
|
||||
use craft_ui::canvas::Rulers;
|
||||
use craft_ui::contract::{Bind, Show as _, ShowContainer as _};
|
||||
use craft_ui::layout_components::Stack;
|
||||
use craft_ui::popover::Popover;
|
||||
use craft_ui::primitives::RulerFace;
|
||||
use craft_ui::runtime::env::UnitKind;
|
||||
use craft_ui::runtime::env::with_env;
|
||||
use craft_ui::testing::{Fixture, pointer, trial};
|
||||
use egui::{Key, Modifiers, Vec2};
|
||||
use std::cell::RefCell;
|
||||
@@ -314,3 +318,129 @@ fn a_tab_stop_gesture_is_primary_only_cancellable_and_a_drag_off_the_ruler_clear
|
||||
fixture.drag_at(at, Vec2::new(0.0, 80.0));
|
||||
assert!(values.borrow().stops.is_empty(), "a release well away from the strip clears the stop");
|
||||
}
|
||||
|
||||
/// What one frame of a page-wide ruler painted: its strip, its tick marks and its numbers.
|
||||
struct Painted {
|
||||
strip: egui::Rect,
|
||||
ticks: Vec<egui::Rect>,
|
||||
numbers: Vec<egui::Rect>,
|
||||
}
|
||||
|
||||
/// The tick marks among `shapes`: thin upright lines inside `strip`.
|
||||
fn tick_marks(shapes: &[egui::Shape], strip: egui::Rect) -> Vec<egui::Rect> {
|
||||
shapes
|
||||
.iter()
|
||||
.map(egui::Shape::visual_bounding_rect)
|
||||
.filter(|rect| rect.is_finite() && rect.width() <= 2.0 && rect.height() > 0.0)
|
||||
.filter(|rect| strip.expand(0.5).contains_rect(*rect))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// A page-wide ruler in inches, shown with `face` when given, in a fixture whose root takes `set`; `popup` shows it in
|
||||
/// an open popover inside a scope that sets the office set.
|
||||
fn page_ruler(set: ComponentSet, face: Option<RulerFace>, popup: bool) -> (Fixture, Rc<RefCell<Option<egui::Rect>>>) {
|
||||
let values = Rc::new(RefCell::new(RulerValues::default()));
|
||||
let strip_at: Rc<RefCell<Option<egui::Rect>>> = Rc::new(RefCell::new(None));
|
||||
let seen = strip_at.clone();
|
||||
let mut fixture = Fixture::new(move |ui| {
|
||||
let ruler = |ui: &mut egui::Ui| {
|
||||
let stage = craft_ui::testing::stage(ui);
|
||||
let (strip, _) = Rulers::strips(ui, stage);
|
||||
*seen.borrow_mut() = Some(strip);
|
||||
let mut values = values.borrow_mut();
|
||||
let mut ruler = TextRuler::new("Ruler", Bind::bound(&mut *values), 432.0)
|
||||
.unit(DocUnit::new(UnitKind::Inches, 96.0))
|
||||
.origin(strip.min.x + 72.0)
|
||||
.extent(egui::Rangef::new(strip.min.x, strip.min.x + 576.0))
|
||||
.scale(1.0);
|
||||
if let Some(face) = face {
|
||||
ruler = ruler.face(face);
|
||||
}
|
||||
ruler.show_at(ui, strip);
|
||||
};
|
||||
if popup {
|
||||
with_env(
|
||||
ui,
|
||||
|env| {
|
||||
env.values.set(ComponentSet::Office);
|
||||
},
|
||||
|ui| {
|
||||
Popover::new("Card", Bind::given(true)).show(ui, |ui, _| ruler(ui));
|
||||
},
|
||||
);
|
||||
} else {
|
||||
ruler(ui);
|
||||
}
|
||||
});
|
||||
fixture.set(set);
|
||||
fixture.settle();
|
||||
(fixture, strip_at)
|
||||
}
|
||||
|
||||
/// The latest paint of `fixture`.
|
||||
fn painted(fixture: &mut Fixture, strip_at: &Rc<RefCell<Option<egui::Rect>>>) -> Painted {
|
||||
let shapes = fixture.frame_shapes();
|
||||
let strip = strip_at.borrow().expect("the ruler showed");
|
||||
Painted { strip, ticks: tick_marks(&shapes, strip), numbers: numbers(fixture) }
|
||||
}
|
||||
|
||||
/// Whether the ruler paints the centred face: every tick is centred on the strip's middle line and clear of its edges,
|
||||
/// and every number is centred on that line with no tick under it.
|
||||
fn centred(p: &Painted) -> bool {
|
||||
let middle = p.strip.center().y;
|
||||
!p.ticks.is_empty()
|
||||
&& !p.numbers.is_empty()
|
||||
&& p.ticks.iter().all(|tick| (tick.center().y - middle).abs() < 1.0 && tick.max.y < p.strip.max.y - 1.0)
|
||||
&& p.numbers.iter().all(|number| (number.center().y - middle).abs() < 1.0)
|
||||
&& p.numbers.iter().all(|number| !p.ticks.iter().any(|tick| number.x_range().contains(tick.center().x)))
|
||||
}
|
||||
|
||||
/// Whether the ruler paints the edge face: every tick rises from the strip's bottom edge.
|
||||
fn edge(p: &Painted) -> bool {
|
||||
!p.ticks.is_empty() && p.ticks.iter().all(|tick| (tick.max.y - p.strip.max.y).abs() < 1.0)
|
||||
}
|
||||
|
||||
/// With no face given, the component set picks it: the office set's ruler centres its marks on a bar and puts numbers
|
||||
/// in place of the whole-unit ticks, the creative set's hangs them from the strip's bottom edge.
|
||||
#[trial]
|
||||
fn the_component_set_picks_the_ruler_face() {
|
||||
let (mut fixture, strip) = page_ruler(ComponentSet::Office, None, false);
|
||||
let office = painted(&mut fixture, &strip);
|
||||
assert!(centred(&office), "the office set paints the centred face: ticks {:?}, numbers {:?}", office.ticks, office.numbers);
|
||||
let (mut fixture, strip) = page_ruler(ComponentSet::Creative, None, false);
|
||||
let creative = painted(&mut fixture, &strip);
|
||||
assert!(edge(&creative), "the creative set paints the edge face: ticks {:?}", creative.ticks);
|
||||
}
|
||||
|
||||
/// A face given on the ruler wins over the component set.
|
||||
#[trial]
|
||||
fn a_given_face_wins_over_the_component_set() {
|
||||
let (mut fixture, strip) = page_ruler(ComponentSet::Office, Some(RulerFace::Edge), false);
|
||||
let given_edge = painted(&mut fixture, &strip);
|
||||
assert!(edge(&given_edge), "the edge face under the office set: ticks {:?}", given_edge.ticks);
|
||||
let (mut fixture, strip) = page_ruler(ComponentSet::Creative, Some(RulerFace::Centred), false);
|
||||
let given_centred = painted(&mut fixture, &strip);
|
||||
assert!(centred(&given_centred), "the centred face under the creative set: ticks {:?}", given_centred.ticks);
|
||||
}
|
||||
|
||||
/// A scope's component set reaches a popup opened inside it, though the root's set is another.
|
||||
#[trial]
|
||||
fn a_scopes_component_set_reaches_a_popup_opened_inside_it() {
|
||||
let (mut fixture, strip) = page_ruler(ComponentSet::Creative, None, true);
|
||||
let in_popup = painted(&mut fixture, &strip);
|
||||
assert!(centred(&in_popup), "the popup's ruler takes the scope's office set: ticks {:?}", in_popup.ticks);
|
||||
}
|
||||
|
||||
/// A set change restyles the ruler in the frame it arrives in, in one pass, and the frame after asks for nothing more.
|
||||
#[trial]
|
||||
fn a_component_set_change_restyles_the_ruler_in_one_pass_and_then_rests() {
|
||||
let (mut fixture, strip) = page_ruler(ComponentSet::Creative, None, false);
|
||||
assert!(edge(&painted(&mut fixture, &strip)));
|
||||
fixture.set(ComponentSet::Office);
|
||||
let changed = painted(&mut fixture, &strip);
|
||||
assert!(centred(&changed), "the frame of the change paints the office face");
|
||||
assert_eq!(fixture.passes(), 1, "the change takes one pass");
|
||||
fixture.idle(1);
|
||||
assert_eq!(fixture.passes(), 1);
|
||||
assert!(!fixture.repaint_requested(), "an idle frame after the change asks for no repaint");
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//! `craft-theme`.
|
||||
//!
|
||||
//! ```
|
||||
//! use craft_theme::{ThemeId, AppDefaults, ModeChoice, Size, ThemePair};
|
||||
//! use craft_theme::{ThemeId, AppDefaults, ComponentSet, ModeChoice, Size, ThemePair};
|
||||
//! use craft_theme_store::{SelectionChange, Store, StoreOptions, SuiteDir};
|
||||
//!
|
||||
//! let mut store = Store::open(&SuiteDir::memory(), StoreOptions::new("doc 1.0"));
|
||||
@@ -30,7 +30,8 @@
|
||||
//! assert_eq!((accepted.suite.theme_dark.as_ref(), accepted.suite.mode, accepted.revision), (Some(&graphite.id), None, 1));
|
||||
//!
|
||||
//! let artcraft = ThemeId::parse("craft.artcraft").unwrap();
|
||||
//! let defaults = AppDefaults { theme: ThemePair::same(artcraft), mode: ModeChoice::Dark, size: Size::Compact, sizes: Default::default() };
|
||||
//! let defaults =
|
||||
//! AppDefaults { theme: ThemePair::same(artcraft), mode: ModeChoice::Dark, size: Size::Compact, sizes: Default::default(), set: ComponentSet::Office };
|
||||
//! let selection = accepted.suite.with_defaults(&defaults);
|
||||
//! assert_eq!((selection.theme.light, selection.mode), (graphite.id, ModeChoice::Dark));
|
||||
//! ```
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use craft_ui::testing::trial;
|
||||
use std::{fs, path::Path, time::Duration};
|
||||
|
||||
use craft_theme::{ContrastChoice, ModeChoice, MotionChoice, Selection, Size, TextSize, ThemeId, ThemePair};
|
||||
use craft_theme::{ComponentSet, ContrastChoice, ModeChoice, MotionChoice, Selection, Size, TextSize, ThemeId, ThemePair};
|
||||
|
||||
use crate::{
|
||||
Accepted, FileStamp, Problem, SelectionChange, SelectionError, Store, StoreError, StoreOptions, SuiteDir,
|
||||
@@ -31,6 +31,7 @@ fn sel(theme: &str, mode: ModeChoice) -> Selection {
|
||||
motion: MotionChoice::System,
|
||||
size: Size::Compact,
|
||||
text_size: TextSize::Small,
|
||||
set: ComponentSet::Creative,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ use std::{
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use craft_theme::{ContrastChoice, ModeChoice, MotionChoice, Selection, Size, TextSize, ThemeId, ThemePair};
|
||||
use craft_theme::{ComponentSet, ContrastChoice, ModeChoice, MotionChoice, Selection, Size, TextSize, ThemeId, ThemePair};
|
||||
|
||||
use super::SuiteWatch;
|
||||
use crate::{Accepted, SelectionChange, Store, StoreOptions, SuiteDir};
|
||||
@@ -33,6 +33,7 @@ fn sel(theme: &str, mode: ModeChoice) -> Selection {
|
||||
motion: MotionChoice::System,
|
||||
size: Size::Compact,
|
||||
text_size: TextSize::Small,
|
||||
set: ComponentSet::Creative,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,17 +20,15 @@ let resolved = resolve(theme, appearance, None);
|
||||
|
||||
## Tokens
|
||||
|
||||
Three layers, each derived from the one before:
|
||||
Two layers, the second derived from the first:
|
||||
|
||||
1. **Primitives**: sRGB and OKLCH colour, WCAG contrast, 12-step colour ramps, fixed scales
|
||||
(space, radius, stroke, opacity, duration, easing, elevation).
|
||||
2. **Semantic tokens**: surface, text, line, state, accent, status, overlay, data and caption
|
||||
colours; shape, size, space, motion and type tokens. Seeds (neutral, accent, four status
|
||||
colours) generate ramps, and ramps fill the tokens.
|
||||
3. **Component tokens**: one struct per component family (button, badge, check box, radio button and switch, text and number field, guide, handle, icon button, kbd, list box, marquee, progress bar, readout, ruler, segmented control, slider, swatch, toggle button, tooltip), with curated overrides.
|
||||
|
||||
A theme sets **seeds** and may **pin** any colour token (`"surface.panel": "#F0F0F0"`), or a
|
||||
component field, per mode. Pins win over derivation. Apps can pin per app (`apps.<id>`).
|
||||
A theme sets **seeds** and may **pin** any colour token (`"surface.panel": "#F0F0F0"`) per mode. Pins win over derivation. Apps can pin per app (`apps.<id>`).
|
||||
|
||||
## Contrast
|
||||
|
||||
|
||||
@@ -69,9 +69,6 @@
|
||||
"short": 120.0,
|
||||
"track": 144.0
|
||||
},
|
||||
"notice": {
|
||||
"width": 360.0
|
||||
},
|
||||
"pane": {
|
||||
"least": 50.0
|
||||
},
|
||||
@@ -96,18 +93,6 @@
|
||||
"row": {
|
||||
"text": 21.0
|
||||
},
|
||||
"ruler": {
|
||||
"tick": {
|
||||
"mid": 9.0,
|
||||
"minor": 4.5
|
||||
}
|
||||
},
|
||||
"scroll_fade": 20.0,
|
||||
"story": {
|
||||
"height": 450.0,
|
||||
"width_max": 900.0,
|
||||
"width_min": 300.0
|
||||
},
|
||||
"thumb": {
|
||||
"card": 160.0,
|
||||
"lg": 48.0,
|
||||
|
||||
@@ -69,9 +69,6 @@
|
||||
"short": 96.0,
|
||||
"track": 128.0
|
||||
},
|
||||
"notice": {
|
||||
"width": 360.0
|
||||
},
|
||||
"pane": {
|
||||
"least": 40.0
|
||||
},
|
||||
@@ -96,18 +93,6 @@
|
||||
"row": {
|
||||
"text": 18.0
|
||||
},
|
||||
"ruler": {
|
||||
"tick": {
|
||||
"mid": 6.0,
|
||||
"minor": 3.0
|
||||
}
|
||||
},
|
||||
"scroll_fade": 20.0,
|
||||
"story": {
|
||||
"height": 360.0,
|
||||
"width_max": 720.0,
|
||||
"width_min": 240.0
|
||||
},
|
||||
"thumb": {
|
||||
"card": 128.0,
|
||||
"lg": 48.0,
|
||||
|
||||
@@ -7,9 +7,9 @@ use std::fmt::Write as _;
|
||||
|
||||
use crate::{
|
||||
BarSizes, ColorToken, ControlSizes, DialogSizes, DockColumnSizes, Easing, Edge, Elevation, ElevationTokens, FloatSizes, FontSlot, Gaps,
|
||||
HandleSizes, HitSizes, IconSizes, Insets, KnobShape, LengthSizes, Motion, MotionTokens, NoticeSizes, Pads, PaneSizes, PlotSizes, RadiusSet,
|
||||
RailSizes, RampSizes, Rgba, RowSizes, RulerSizes, RulerTickSizes, ShapeTokens, SizeTokens, SpaceTokens, StorySizes, StrokeTokens, ThumbSamples,
|
||||
ThumbSizes, Tokens, TypeStyle, TypeTokens, WellShape, WindowSizes,
|
||||
HandleSizes, HitSizes, IconSizes, Insets, KnobShape, LengthSizes, Motion, MotionTokens, Pads, PaneSizes, PlotSizes, RadiusSet, RailSizes,
|
||||
RampSizes, Rgba, RowSizes, ShapeTokens, SizeTokens, SpaceTokens, StrokeTokens, ThumbSamples, ThumbSizes, Tokens, TypeStyle, TypeTokens,
|
||||
WellShape, WindowSizes,
|
||||
};
|
||||
|
||||
/// The text of every token, one `key = value` line each, in a fixed order.
|
||||
@@ -116,7 +116,6 @@ fn size_lines(out: &mut Lines, size: &SizeTokens) {
|
||||
bar,
|
||||
panel_header,
|
||||
popup_min,
|
||||
scroll_fade,
|
||||
thumb: thumbs,
|
||||
handle,
|
||||
hit,
|
||||
@@ -130,11 +129,8 @@ fn size_lines(out: &mut Lines, size: &SizeTokens) {
|
||||
float,
|
||||
window,
|
||||
pane,
|
||||
ruler,
|
||||
dock,
|
||||
notice,
|
||||
dialog,
|
||||
story,
|
||||
} = size;
|
||||
let ControlSizes { sm, md } = control;
|
||||
out.line("size.control.sm", len(*sm));
|
||||
@@ -154,7 +150,6 @@ fn size_lines(out: &mut Lines, size: &SizeTokens) {
|
||||
}
|
||||
out.line("size.panel_header", len(*panel_header));
|
||||
out.line("size.popup_min", len(*popup_min));
|
||||
out.line("size.scroll_fade", len(*scroll_fade));
|
||||
let ThumbSizes { sm, md, lg, card, sample } = thumbs;
|
||||
out.line("size.thumb.sm", len(*sm));
|
||||
out.line("size.thumb.md", len(*md));
|
||||
@@ -198,23 +193,13 @@ fn size_lines(out: &mut Lines, size: &SizeTokens) {
|
||||
out.line("size.window.cascade", len(*cascade));
|
||||
let PaneSizes { least } = pane;
|
||||
out.line("size.pane.least", len(*least));
|
||||
let RulerSizes { tick } = ruler;
|
||||
let RulerTickSizes { mid, minor } = tick;
|
||||
out.line("size.ruler.tick.mid", len(*mid));
|
||||
out.line("size.ruler.tick.minor", len(*minor));
|
||||
let DockColumnSizes { column } = dock;
|
||||
out.line("size.dock.column", len(*column));
|
||||
let NoticeSizes { width } = notice;
|
||||
out.line("size.notice.width", len(*width));
|
||||
let DialogSizes { least, wrap, button, side_button } = dialog;
|
||||
out.line("size.dialog.least", len(*least));
|
||||
out.line("size.dialog.wrap", len(*wrap));
|
||||
out.line("size.dialog.button", len(*button));
|
||||
out.line("size.dialog.side_button", len(*side_button));
|
||||
let StorySizes { height, width_min, width_max } = story;
|
||||
out.line("size.story.height", len(*height));
|
||||
out.line("size.story.width_min", len(*width_min));
|
||||
out.line("size.story.width_max", len(*width_max));
|
||||
}
|
||||
|
||||
fn slot(s: FontSlot) -> &'static str {
|
||||
|
||||
@@ -86,8 +86,8 @@ pub use ramp::{Mode, Ramp, RampKind};
|
||||
pub use resolve::{Resolved, resolve, resolve_sized};
|
||||
pub use scale::{Duration, Easing, Elevation, Opacity, Radius, Space, Stroke};
|
||||
pub use selection::{
|
||||
AppChoice, AppDefaults, ContrastChoice, Fallback, ModeChoice, MotionChoice, Selection, Shown, SuiteChoice, SystemAppearance, ThemePair,
|
||||
resolve_selection,
|
||||
AppChoice, AppDefaults, ComponentSet, ContrastChoice, Fallback, ModeChoice, MotionChoice, Selection, Shown, SuiteChoice, SystemAppearance,
|
||||
ThemePair, resolve_selection,
|
||||
};
|
||||
pub use stateful::{FlagMask, Flags, Mix, Resolve, StateMix, Stateful};
|
||||
pub use theme::{
|
||||
@@ -98,9 +98,9 @@ pub use token_group::{GroupValues, TokenGroup};
|
||||
pub use tokens::{
|
||||
AccentColors, BarSizes, CaptionColors, ColorToken, ColorTokens, ControlSizes, DataColors, DialogSizes, DockColumnSizes, Edge, EdgeColors,
|
||||
ElevationTokens, FloatSizes, FontSlot, Gaps, HandleSizes, HitSizes, IconSizes, Insets, KnobShape, LengthSizes, LineColors, Motion, MotionTokens,
|
||||
NoticeSizes, OverlayColors, Pads, PaneSizes, PlotSizes, RadiusSet, RailSizes, RampSizes, RowSizes, RulerSizes, RulerTickSizes, ShapeTokens,
|
||||
SizeTokens, SpaceTokens, StateColors, Status, StatusColors, StatusKind, StorySizes, StrokeTokens, SurfaceColors, TextColors, ThumbSamples,
|
||||
ThumbSizes, Tokens, TypeRole, TypeStyle, TypeTokens, WellShape, WindowSizes,
|
||||
OverlayColors, Pads, PaneSizes, PlotSizes, RadiusSet, RailSizes, RampSizes, RowSizes, ShapeTokens, SizeTokens, SpaceTokens, StateColors, Status,
|
||||
StatusColors, StatusKind, StrokeTokens, SurfaceColors, TextColors, ThumbSamples, ThumbSizes, Tokens, TypeRole, TypeStyle, TypeTokens, WellShape,
|
||||
WindowSizes,
|
||||
};
|
||||
pub use values::ColorSource;
|
||||
pub use variant::{CustomVariant, Emphasis, RadiusStep, Variant, VariantLook};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! What the user picked (theme per mode, mode, contrast, motion, size, text size), how the suite's
|
||||
//! What the user picked (theme per mode, mode, contrast, motion, size, text size, component set), how the suite's
|
||||
//! choice, an app's own choice and the app's defaults combine, and resolution of the result
|
||||
//! against what the OS reports.
|
||||
|
||||
@@ -112,6 +112,19 @@ impl ThemePair {
|
||||
}
|
||||
}
|
||||
|
||||
/// The set of component looks an app shows: each component that has variants maps the set to one of them (a ruler's
|
||||
/// face, for one), and every other component looks the same in each set. A component stays functionally identical
|
||||
/// across sets. The app states its set ([`AppDefaults::set`]); the suite's choice never carries one.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ComponentSet {
|
||||
/// The look the creative apps' users expect.
|
||||
#[default]
|
||||
Creative,
|
||||
/// The look the office apps' users expect.
|
||||
Office,
|
||||
}
|
||||
|
||||
/// What the user picked, every field concrete (after defaults are filled in).
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Selection {
|
||||
@@ -127,6 +140,9 @@ pub struct Selection {
|
||||
pub size: Size,
|
||||
/// The text size.
|
||||
pub text_size: TextSize,
|
||||
/// The component set: the app's own, never the suite's.
|
||||
#[serde(default)]
|
||||
pub set: ComponentSet,
|
||||
}
|
||||
|
||||
/// The suite's choice as `selection.json` holds it. Each field is set once a user picks it in
|
||||
@@ -167,6 +183,7 @@ impl SuiteChoice {
|
||||
motion: self.motion.unwrap_or_default(),
|
||||
size: self.size.unwrap_or(defaults.size),
|
||||
text_size: self.text_size.unwrap_or_default(),
|
||||
set: defaults.set,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,6 +227,8 @@ pub struct AppDefaults {
|
||||
/// The app's own sizes: base overrides and component pins, applied to whichever size set is
|
||||
/// chosen.
|
||||
pub sizes: AppSizes,
|
||||
/// The component set the app shows when the user hasn't chosen one for it.
|
||||
pub set: ComponentSet,
|
||||
}
|
||||
|
||||
/// An app's own choice, kept in the app's preferences: "Use a different theme / mode / size in
|
||||
@@ -226,12 +245,15 @@ pub struct AppChoice {
|
||||
pub mode: Option<ModeChoice>,
|
||||
/// The app's own size set.
|
||||
pub size: Option<Size>,
|
||||
/// The app's own component set. No user-visible choice sets it yet.
|
||||
#[serde(default)]
|
||||
pub set: Option<ComponentSet>,
|
||||
}
|
||||
|
||||
impl AppChoice {
|
||||
/// A choice with all three fields given.
|
||||
/// A choice of theme, mode and size; the component set follows the app's default.
|
||||
pub const fn new(theme: Option<ThemePair>, mode: Option<ModeChoice>, size: Option<Size>) -> Self {
|
||||
Self { theme, mode, size }
|
||||
Self { theme, mode, size, set: None }
|
||||
}
|
||||
|
||||
/// This choice with the app's own mode.
|
||||
@@ -246,12 +268,19 @@ impl AppChoice {
|
||||
self
|
||||
}
|
||||
|
||||
/// `suite` with this app's theme, mode and size where set.
|
||||
/// This choice with the app's own component set.
|
||||
pub fn with_set(mut self, set: ComponentSet) -> Self {
|
||||
self.set = Some(set);
|
||||
self
|
||||
}
|
||||
|
||||
/// `suite` with this app's theme, mode, size and component set where set.
|
||||
pub fn apply(&self, suite: &Selection) -> Selection {
|
||||
Selection {
|
||||
theme: self.theme.clone().unwrap_or_else(|| suite.theme.clone()),
|
||||
mode: self.mode.unwrap_or(suite.mode),
|
||||
size: self.size.unwrap_or(suite.size),
|
||||
set: self.set.unwrap_or(suite.set),
|
||||
..suite.clone()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,6 @@ pub(crate) fn leaves(b: &mut Preset) -> Vec<Leaf<'_>> {
|
||||
"base.size.bar.options_narrow" Num 16.0..=80.0 => s.bar.options_narrow;
|
||||
"base.size.panel_header" Num 16.0..=64.0 => s.panel_header;
|
||||
"base.size.popup_min" Num 64.0..=640.0 => s.popup_min;
|
||||
"base.size.scroll_fade" Num 4.0..=64.0 => s.scroll_fade;
|
||||
"base.size.thumb.sm" Num 12.0..=96.0 => s.thumb.sm;
|
||||
"base.size.thumb.md" Num 12.0..=96.0 => s.thumb.md;
|
||||
"base.size.thumb.lg" Num 12.0..=96.0 => s.thumb.lg;
|
||||
@@ -140,13 +139,7 @@ pub(crate) fn leaves(b: &mut Preset) -> Vec<Leaf<'_>> {
|
||||
"base.size.float.height" Num 48.0..=1024.0 => s.float.height;
|
||||
"base.size.window.cascade" Num 8.0..=96.0 => s.window.cascade;
|
||||
"base.size.pane.least" Num 16.0..=128.0 => s.pane.least;
|
||||
"base.size.ruler.tick.mid" Num 1.0..=32.0 => s.ruler.tick.mid;
|
||||
"base.size.ruler.tick.minor" Num 1.0..=32.0 => s.ruler.tick.minor;
|
||||
"base.size.story.height" Num 120.0..=1024.0 => s.story.height;
|
||||
"base.size.story.width_min" Num 120.0..=1024.0 => s.story.width_min;
|
||||
"base.size.story.width_max" Num 120.0..=2048.0 => s.story.width_max;
|
||||
"base.size.dock.column" Num 120.0..=640.0 => s.dock.column;
|
||||
"base.size.notice.width" Num 120.0..=1024.0 => s.notice.width;
|
||||
"base.size.dialog.least" Num 120.0..=1024.0 => s.dialog.least;
|
||||
"base.size.dialog.wrap" Num 120.0..=1024.0 => s.dialog.wrap;
|
||||
"base.size.dialog.button" Num 24.0..=240.0 => s.dialog.button;
|
||||
|
||||
@@ -202,8 +202,6 @@ pub struct SizeTokens {
|
||||
pub panel_header: f32,
|
||||
/// Least width of a popup surface: a menu or a popup list.
|
||||
pub popup_min: f32,
|
||||
/// The length of the fade at an edge of a scroll region past which its content continues.
|
||||
pub scroll_fade: f32,
|
||||
/// Thumbnail sides.
|
||||
pub thumb: ThumbSizes,
|
||||
/// Canvas drag handles.
|
||||
@@ -233,41 +231,8 @@ pub struct SizeTokens {
|
||||
pub pane: PaneSizes,
|
||||
/// The docks' columns.
|
||||
pub dock: DockColumnSizes,
|
||||
/// Notice cards: toasts.
|
||||
pub notice: NoticeSizes,
|
||||
/// Dialogs: their content width and their buttons.
|
||||
pub dialog: DialogSizes,
|
||||
/// The rulers of a canvas.
|
||||
pub ruler: RulerSizes,
|
||||
/// The stage a story draws on.
|
||||
pub story: StorySizes,
|
||||
}
|
||||
|
||||
/// The stage a story draws on, in logical pixels: a story of a canvas control, and each column of a story grid.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
pub struct StorySizes {
|
||||
/// The height of the stage a story of a canvas control shows its canvas on.
|
||||
pub height: f32,
|
||||
/// The least width of a story: of that stage, and of a column of a story grid.
|
||||
pub width_min: f32,
|
||||
/// The greatest width of that stage.
|
||||
pub width_max: f32,
|
||||
}
|
||||
|
||||
/// The sizes of a canvas ruler, in logical pixels.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
pub struct RulerSizes {
|
||||
/// The tick marks.
|
||||
pub tick: RulerTickSizes,
|
||||
}
|
||||
|
||||
/// The lengths of a ruler's tick marks, in logical pixels. The major tick spans the ruler's depth.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
pub struct RulerTickSizes {
|
||||
/// The tick halfway between two labelled ticks.
|
||||
pub mid: f32,
|
||||
/// The tick between two other ticks.
|
||||
pub minor: f32,
|
||||
}
|
||||
|
||||
/// The sizes of the panes of a dock's split, in logical pixels.
|
||||
@@ -286,13 +251,6 @@ pub struct DockColumnSizes {
|
||||
pub column: f32,
|
||||
}
|
||||
|
||||
/// The sizes of a notice card, in logical pixels.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
pub struct NoticeSizes {
|
||||
/// The width every card of a toast stack has where the room allows.
|
||||
pub width: f32,
|
||||
}
|
||||
|
||||
/// The sizes of a dialog, in logical pixels.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
pub struct DialogSizes {
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 42
|
||||
size.bar.options_narrow = 36
|
||||
size.panel_header = 34
|
||||
size.popup_min = 240
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 34
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 240
|
||||
size.float.height = 300
|
||||
size.window.cascade = 38
|
||||
size.pane.least = 50
|
||||
size.ruler.tick.mid = 9
|
||||
size.ruler.tick.minor = 4.5
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 450
|
||||
size.story.width_min = 300
|
||||
size.story.width_max = 900
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -144,7 +144,6 @@ size.bar.options = 36
|
||||
size.bar.options_narrow = 28
|
||||
size.panel_header = 28
|
||||
size.popup_min = 192
|
||||
size.scroll_fade = 20
|
||||
size.thumb.sm = 18
|
||||
size.thumb.md = 24
|
||||
size.thumb.lg = 48
|
||||
@@ -177,17 +176,11 @@ size.float.width = 192
|
||||
size.float.height = 240
|
||||
size.window.cascade = 32
|
||||
size.pane.least = 40
|
||||
size.ruler.tick.mid = 6
|
||||
size.ruler.tick.minor = 3
|
||||
size.dock.column = 340
|
||||
size.notice.width = 360
|
||||
size.dialog.least = 380
|
||||
size.dialog.wrap = 440
|
||||
size.dialog.button = 84
|
||||
size.dialog.side_button = 96
|
||||
size.story.height = 360
|
||||
size.story.width_min = 240
|
||||
size.story.width_max = 720
|
||||
stroke.thin = 1
|
||||
stroke.medium = 1.5
|
||||
stroke.thick = 2
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//! Integration tests, built into the library's own test executable.
|
||||
|
||||
mod dumps;
|
||||
mod selection;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//! The component set: the app states it, the user's own choice for the app overrides it, and the suite's choice never
|
||||
//! carries it.
|
||||
|
||||
use craft_theme::{AppChoice, AppDefaults, ComponentSet, ModeChoice, Size, SuiteChoice, ThemeId, ThemePair};
|
||||
|
||||
#[test]
|
||||
fn the_component_set_is_the_apps_unless_the_user_chose_one_for_it_and_never_the_suites() {
|
||||
let defaults = AppDefaults {
|
||||
theme: ThemePair::same(ThemeId::suite_default()),
|
||||
mode: ModeChoice::Light,
|
||||
size: Size::Comfortable,
|
||||
sizes: Default::default(),
|
||||
set: ComponentSet::Office,
|
||||
};
|
||||
let suite = SuiteChoice::default().with_defaults(&defaults);
|
||||
assert_eq!(suite.set, ComponentSet::Office, "a fresh install shows the app's set");
|
||||
let follows = AppChoice::new(None, None, None).apply(&suite);
|
||||
assert_eq!(follows.set, ComponentSet::Office, "an app choice without a set keeps the app's");
|
||||
let own = AppChoice::new(None, None, None).with_set(ComponentSet::Creative).apply(&suite);
|
||||
assert_eq!(own.set, ComponentSet::Creative, "the user's set for the app wins");
|
||||
let stored: AppChoice = serde_json::from_str(r#"{"theme":null,"mode":null,"size":null}"#).expect("a stored choice without a set reads");
|
||||
assert_eq!(stored.apply(&suite).set, ComponentSet::Office);
|
||||
let shared = SuiteChoice::from(own);
|
||||
assert_eq!(shared.with_defaults(&defaults).set, ComponentSet::Office, "the suite's choice carries no set to other apps");
|
||||
}
|
||||
@@ -11,7 +11,7 @@ use craft_ui::contract::{
|
||||
Access, Bind, BindMut, Common, Component, Cx, Edit as _, EditResponse, Focus as _, Input, MeasureCx, Name, Numeric, Outcome, PaintUi, PartsCx,
|
||||
Pointer as _, Props, Role, Styled as _, WordSetCx as _,
|
||||
};
|
||||
use craft_ui::primitives::{PaintShape, StrokeWidth, TextRun, Tick as TickMark, TickEdge, TickRank};
|
||||
use craft_ui::primitives::{PaintShape, RulerFace, StrokeWidth, TextRun, Tick as TickMark, TickEdge, TickRank};
|
||||
use craft_ui::runtime::env::Label;
|
||||
use craft_ui::runtime::focus::{ActivateKeys, KeyUse};
|
||||
use craft_ui::style::{ComponentStyle, FocusLook, Stateful, StyleColor, StyleCx, TextLook, TypeRole, UiTokens};
|
||||
@@ -613,7 +613,7 @@ impl Component for TimelineRuler<'_> {
|
||||
|
||||
let ticks = ruler_ticks(&axis, rect.width(), ruler_ladder(rate.timecode_base(), style.line));
|
||||
let marks: Vec<TickMark> = ticks.iter().map(|tick| TickMark::new(axis.x_of(tick.at, left) - left, tick.rank)).collect();
|
||||
ui.content_painter(cx).ticks(body, TickEdge::Bottom, &marks);
|
||||
ui.content_painter(cx).ticks(body, TickEdge::Bottom, RulerFace::Edge, &marks);
|
||||
let color = cx.resolve(&style.label.color);
|
||||
for (tick, text) in ticks.iter().filter_map(|tick| tick.label.as_ref().map(|text| (tick, text))) {
|
||||
let layout = draw.layout(&TextRun::new(text.as_str()).role(style.label.role).color(color), f32::INFINITY);
|
||||
|
||||
@@ -16,7 +16,7 @@ use crate::contract::{
|
||||
PaintUi, PartsCx, Pointer as _, Props as _, Role, Styled as _, WordSetCx as _,
|
||||
};
|
||||
use crate::menu::Menu;
|
||||
use crate::primitives::{PaintShape, RectSide, StrokeWidth, TextRun, Tick, TickEdge, TickRank};
|
||||
use crate::primitives::{PaintShape, RectSide, RulerFace, StrokeWidth, TextRun, Tick, TickEdge, TickRank};
|
||||
use crate::runtime::env::{Label, UnitKind};
|
||||
use crate::runtime::focus::KeyUse;
|
||||
use crate::runtime::memory::Remember as _;
|
||||
@@ -137,8 +137,14 @@ pub struct RulersStyle {
|
||||
pad: f32,
|
||||
/// How far a vertical label's next character sits below the one before: the label role's size.
|
||||
pitch: f32,
|
||||
/// The face: the prop's, else the component set's.
|
||||
face: RulerFace,
|
||||
/// The strips and the corner.
|
||||
fill: StyleColor,
|
||||
margin: StyleColor,
|
||||
/// The well: the edge face's margin bands, the centred face's bar.
|
||||
well: StyleColor,
|
||||
/// The centred face's margin bands, shaded as the desk round the page.
|
||||
shade: StyleColor,
|
||||
label: TextLook,
|
||||
marker: StyleColor,
|
||||
}
|
||||
@@ -212,6 +218,10 @@ pub struct Rulers<'a> {
|
||||
/// no menu.
|
||||
#[prop]
|
||||
units: Option<&'a [UnitKind]>,
|
||||
/// The face; unset, the scope's component set picks it ([`RulerFace::of`]).
|
||||
#[style_key]
|
||||
#[prop]
|
||||
face: Option<RulerFace>,
|
||||
/// The canvas's space and snap in this pass, which the canvas hands to the rulers it shows.
|
||||
space: Option<CanvasSpace>,
|
||||
snap: Option<Snap>,
|
||||
@@ -231,6 +241,7 @@ impl<'a> Rulers<'a> {
|
||||
interactive: true,
|
||||
margins: RulerMargins::default(),
|
||||
units: None,
|
||||
face: None,
|
||||
space: None,
|
||||
snap: None,
|
||||
guide: None,
|
||||
@@ -357,15 +368,17 @@ impl Component for Rulers<'_> {
|
||||
type Style = RulersStyle;
|
||||
type Output = RulersOutput;
|
||||
|
||||
fn style(cx: &StyleCx<'_>, _: RulersStyleKey) -> RulersStyle {
|
||||
fn style(cx: &StyleCx<'_>, key: RulersStyleKey) -> RulersStyle {
|
||||
let c = &cx.tokens.color;
|
||||
RulersStyle {
|
||||
metrics: Metrics::new(),
|
||||
thickness: thickness(cx.tokens),
|
||||
pad: cx.tokens.space.gap.tight,
|
||||
pitch: cx.tokens.typography.get(LABEL_ROLE).size,
|
||||
face: key.face.unwrap_or(RulerFace::of(cx.set())),
|
||||
fill: cx.color(c.surface.chrome),
|
||||
margin: cx.color(c.surface.sunken),
|
||||
well: cx.color(c.surface.sunken),
|
||||
shade: cx.color(c.surface.canvas),
|
||||
label: TextLook::new(LABEL_ROLE, Stateful::new(cx.color(c.text.muted))),
|
||||
marker: cx.color(c.text.normal),
|
||||
}
|
||||
@@ -520,11 +533,39 @@ impl Component for Rulers<'_> {
|
||||
draw.fill(&rect(corner), style.fill);
|
||||
return;
|
||||
};
|
||||
let face = style.face;
|
||||
let level = space.view.level(zero);
|
||||
let rulers = space.rulers();
|
||||
let text_of = |part: RulerPart| if part == RulerPart::Vertical { rulers.y } else { rulers.x };
|
||||
for (part, strip, spans) in [(RulerPart::Horizontal, top, &self.margins.horizontal), (RulerPart::Vertical, left, &self.margins.vertical)] {
|
||||
let vertical = part == RulerPart::Vertical;
|
||||
// The divider is painted inside each strip's inner edge; the ticks keep clear of it so they keep their full
|
||||
// length, and the centred face's bar is inset in what is left.
|
||||
let band = draw.rule_width(RuleKind::Divider);
|
||||
let tick_strip = |part: RulerPart, strip: Rect| {
|
||||
if part == RulerPart::Vertical {
|
||||
Rect::from_min_max(strip.min, Pos2::new(strip.right() - band, strip.bottom()))
|
||||
} else {
|
||||
Rect::from_min_max(strip.min, Pos2::new(strip.right(), strip.bottom() - band))
|
||||
}
|
||||
};
|
||||
let painter = ui.content_painter(cx);
|
||||
let parts = [(RulerPart::Horizontal, top, TickEdge::Bottom), (RulerPart::Vertical, left, TickEdge::Right)];
|
||||
let bars = parts.map(|(part, strip, edge)| painter.ruler_bar(tick_strip(part, strip), edge, face));
|
||||
if face == RulerFace::Centred {
|
||||
for bar in &bars {
|
||||
draw.fill(&rect(*bar), style.well);
|
||||
}
|
||||
}
|
||||
// The edge face shades the margin bands across the strip in the well colour; the centred face shades them on
|
||||
// its bar, as the text ruler shades its margins.
|
||||
let mut margin_bands: [Vec<Rect>; 2] = [Vec::new(), Vec::new()];
|
||||
for (((part, strip, _), spans), (bar, bands)) in
|
||||
parts.iter().zip([&self.margins.horizontal, &self.margins.vertical]).zip(bars.iter().zip(margin_bands.iter_mut()))
|
||||
{
|
||||
let vertical = *part == RulerPart::Vertical;
|
||||
let across = match face {
|
||||
RulerFace::Edge => *strip,
|
||||
RulerFace::Centred => *bar,
|
||||
};
|
||||
for span in spans {
|
||||
let at = |along: f64| {
|
||||
let p = if vertical { Point::new(zero.x, along) } else { Point::new(along, zero.y) };
|
||||
@@ -533,59 +574,80 @@ impl Component for Rulers<'_> {
|
||||
};
|
||||
let (a, b) = (at(span.start), at(span.end));
|
||||
let (lo, hi) = (a.min(b), a.max(b));
|
||||
let band = if vertical {
|
||||
Rect::from_min_max(Pos2::new(strip.left(), lo), Pos2::new(strip.right(), hi))
|
||||
let shaded = if vertical {
|
||||
Rect::from_min_max(Pos2::new(across.left(), lo), Pos2::new(across.right(), hi))
|
||||
} else {
|
||||
Rect::from_min_max(Pos2::new(lo, strip.top()), Pos2::new(hi, strip.bottom()))
|
||||
Rect::from_min_max(Pos2::new(lo, across.top()), Pos2::new(hi, across.bottom()))
|
||||
};
|
||||
let band = band.intersect(strip);
|
||||
if band.is_positive() {
|
||||
draw.fill(&rect(band), style.margin);
|
||||
let shaded = shaded.intersect(across);
|
||||
if shaded.is_positive() {
|
||||
draw.fill(&rect(shaded), if face == RulerFace::Centred { style.shade } else { style.well });
|
||||
bands.push(shaded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let painter = ui.content_painter(cx);
|
||||
let numbers = cx.env.units();
|
||||
let label = &style.label;
|
||||
let color = cx.resolve(&label.color);
|
||||
// A label is painted where the strip shows it: it overlaps the strip and stays inside the rulers' rect, so a
|
||||
// label that hangs off an end of the strip is left out.
|
||||
// label that hangs off an end of the strip is left out. The centred face numbers no margin band.
|
||||
let shows = |strip: Rect, text: Rect| text.intersects(strip) && cx.rect.contains_rect(text);
|
||||
for (part, strip, edge) in [(RulerPart::Horizontal, top, TickEdge::Bottom), (RulerPart::Vertical, left, TickEdge::Right)] {
|
||||
for (((part, strip, edge), bar), bands) in parts.into_iter().zip(bars).zip(&margin_bands) {
|
||||
let vertical = part == RulerPart::Vertical;
|
||||
let ticks = Self::axis_ticks(&text_of(part), &level, strip, part, zero);
|
||||
let marks: Vec<Tick> =
|
||||
ticks.iter().map(|(tick, at)| Tick::new(*at - if vertical { strip.top() } else { strip.left() }, tick.rank)).collect();
|
||||
// The divider is painted inside the strip's inner edge; the ticks hang from its inner side so they keep their full length.
|
||||
let band = draw.rule_width(RuleKind::Divider);
|
||||
let tick_strip = if vertical {
|
||||
Rect::from_min_max(strip.min, Pos2::new(strip.right() - band, strip.bottom()))
|
||||
} else {
|
||||
Rect::from_min_max(strip.min, Pos2::new(strip.right(), strip.bottom() - band))
|
||||
};
|
||||
painter.ticks(tick_strip, edge, &marks);
|
||||
let mut galleys = Vec::new();
|
||||
for (tick, at) in ticks.iter().filter(|(tick, _)| tick.rank == TickRank::Major) {
|
||||
let text = text_of(part).tick_label(&numbers, tick.value, tick.step);
|
||||
if vertical {
|
||||
// One character per line, centred in the strip: a narrow "1" lines up with a "0".
|
||||
let mut y = at + style.pad;
|
||||
for ch in text.chars() {
|
||||
let layout = draw.layout(&TextRun::new(ch.to_string()).role(label.role).color(color), f32::INFINITY);
|
||||
let at = Pos2::new(strip.center().x - layout.size().x / 2.0, y);
|
||||
let layouts: Vec<_> =
|
||||
text.chars().map(|ch| draw.layout(&TextRun::new(ch.to_string()).role(label.role).color(color), f32::INFINITY)).collect();
|
||||
let mut y = match face {
|
||||
RulerFace::Edge => at + style.pad,
|
||||
RulerFace::Centred => at - style.pitch * layouts.len() as f32 / 2.0,
|
||||
};
|
||||
let middle = match face {
|
||||
RulerFace::Edge => strip.center().x,
|
||||
RulerFace::Centred => bar.center().x,
|
||||
};
|
||||
let placed: Vec<_> = layouts
|
||||
.into_iter()
|
||||
.map(|layout| {
|
||||
let at = Pos2::new(middle - layout.size().x / 2.0, y);
|
||||
y += style.pitch;
|
||||
(at, layout)
|
||||
})
|
||||
.collect();
|
||||
let column = placed.iter().fold(Rect::NOTHING, |all, (at, layout)| all.union(Rect::from_min_size(*at, layout.size())));
|
||||
if face == RulerFace::Centred && (!shows(strip, column) || bands.iter().any(|band| band.intersects(column))) {
|
||||
continue;
|
||||
}
|
||||
for (at, layout) in placed {
|
||||
if shows(strip, Rect::from_min_size(at, layout.size())) {
|
||||
draw.galley(at, &layout);
|
||||
galleys.push((at, layout));
|
||||
}
|
||||
y += style.pitch;
|
||||
}
|
||||
} else {
|
||||
let layout = draw.layout(&TextRun::new(text).role(label.role).color(color), f32::INFINITY);
|
||||
let at = Pos2::new(at + style.pad, strip.top() + style.pad);
|
||||
if shows(strip, Rect::from_min_size(at, layout.size())) {
|
||||
draw.galley(at, &layout);
|
||||
let boxed = match face {
|
||||
RulerFace::Edge => Rect::from_min_size(Pos2::new(at + style.pad, strip.top() + style.pad), layout.size()),
|
||||
RulerFace::Centred => RulerFace::centred_number(bar, edge, *at, layout.size()),
|
||||
};
|
||||
let clear = face == RulerFace::Edge || !bands.iter().any(|band| band.intersects(boxed));
|
||||
if shows(strip, boxed) && clear {
|
||||
galleys.push((boxed.min, layout));
|
||||
}
|
||||
}
|
||||
}
|
||||
let origin = if vertical { bar.top() } else { bar.left() };
|
||||
let marks: Vec<Tick> = ticks.iter().map(|(tick, at)| Tick::new(*at - origin, tick.rank)).collect();
|
||||
let boxes: Vec<Rect> = galleys.iter().map(|(at, layout)| Rect::from_min_size(*at, layout.size())).collect();
|
||||
let marks = face.beside_numbers(edge, origin, marks, &boxes, style.pad);
|
||||
painter.ticks(bar, edge, face, &marks);
|
||||
for (at, layout) in &galleys {
|
||||
draw.galley(*at, layout);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(at) = crate::runtime::pointer::frame(&cx.core.ctx).pos.filter(|at| cx.rect.contains(*at)) {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
//! Stories of the rulers.
|
||||
|
||||
use super::{CORNER, Rulers};
|
||||
use super::{CORNER, RulerMargins, Rulers};
|
||||
use crate::canvas::testing::canvas_story::{StoryDocument, on_ruled_canvas};
|
||||
use crate::canvas::{Canvas, RulerText};
|
||||
use crate::canvas::{Canvas, RasterSource as _, RulerText};
|
||||
use crate::contract::Validity;
|
||||
use crate::primitives::RulerFace;
|
||||
use crate::runtime::env::{Message, UnitKind};
|
||||
use crate::testing::{Drive, Fixture, StoryData, StoryOutput, story};
|
||||
use crate::testing::{pointer, stage};
|
||||
@@ -17,6 +18,9 @@ const DRAG_THRESHOLDS: f32 = 12.0;
|
||||
/// The least x the invalid story accepts for the zero point.
|
||||
const LEAST_X: f64 = 0.0;
|
||||
|
||||
/// The margin the face stories shade on each side of the document, pixels.
|
||||
const MARGIN: f64 = 48.0;
|
||||
|
||||
/// The units the menu story offers.
|
||||
const UNITS: [UnitKind; 2] = [UnitKind::Pixels, UnitKind::Points];
|
||||
|
||||
@@ -115,3 +119,30 @@ fn zero_point_left_of_the_document(ui: &mut Ui, data: &mut StoryData) -> StoryOu
|
||||
let canvas = rulers_canvas(room, ui.pixels_per_point(), settings, Rulers::new("Rulers", zero_at.bind(&mut *zero).check(inside)));
|
||||
on_ruled_canvas(ui, room, canvas, Some(&StoryDocument::STANDARD))
|
||||
}
|
||||
|
||||
/// The rulers in `face` with the document's margins shaded.
|
||||
fn in_face(ui: &mut Ui, data: &mut StoryData, face: RulerFace) -> StoryOutput {
|
||||
let settings = settings(data);
|
||||
let (zero, zero_at) = data.value_at("zero", Point::ZERO);
|
||||
let room = stage(ui);
|
||||
let size = StoryDocument::STANDARD.size();
|
||||
let (width, height) = (f64::from(size.width), f64::from(size.height));
|
||||
let margins = RulerMargins::new([0.0..MARGIN, width - MARGIN..width], [0.0..MARGIN, height - MARGIN..height]);
|
||||
let rulers = Rulers::new("Rulers", zero_at.bind(&mut *zero)).margins(margins).face(face);
|
||||
let canvas = rulers_canvas(room, ui.pixels_per_point(), settings, rulers);
|
||||
on_ruled_canvas(ui, room, canvas, Some(&StoryDocument::STANDARD))
|
||||
}
|
||||
|
||||
/// The edge face: ticks rise from each strip's inner edge, each label beside its major tick, the margins in the well
|
||||
/// colour.
|
||||
#[story(Rulers<'static>, covers = [], drive = Drive::Never)]
|
||||
fn edge_face(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
in_face(ui, data, RulerFace::Edge)
|
||||
}
|
||||
|
||||
/// The centred face (the office set's): a bar inset in each strip, ticks centred on it, labels in place of the major
|
||||
/// ticks and none over the shaded margins.
|
||||
#[story(Rulers<'static>, covers = [], drive = Drive::Never)]
|
||||
fn centred_face(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
in_face(ui, data, RulerFace::Centred)
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ const ROTATE_STEP_DEG: f64 = 15.0;
|
||||
|
||||
/// The room Fit Artboard on Screen leaves around the board, in points: at the sides, and above and below (the board's
|
||||
/// name sits above it).
|
||||
const ARTBOARD_MARGIN: Vec2 = Vec2::new(30.0, 40.0); // design: allow[literal-size/vec2](view-fit room in screen points, not a look)
|
||||
const ARTBOARD_MARGIN: Vec2 = Vec2::new(30.0, 40.0);
|
||||
|
||||
/// The room Fit Layers on Screen leaves around the layers' bounds, in points.
|
||||
const LAYERS_MARGIN: Vec2 = Vec2::new(20.0, 20.0); // design: allow[literal-size/vec2](view-fit room in screen points, not a look)
|
||||
const LAYERS_MARGIN: Vec2 = Vec2::new(20.0, 20.0);
|
||||
|
||||
/// The room Fit on Screen leaves around the document on each side, in points.
|
||||
const FIT_MARGIN: f64 = 20.0;
|
||||
|
||||
@@ -195,7 +195,7 @@ impl BodyHooks<'_> {
|
||||
let content = Vec2::new(if scroll.horizontal_on() { ex } else { view.width() }, if scroll.vertical_on() { ey } else { view.height() });
|
||||
let offset = Vec2::new(self.offset.x as f32, self.offset.y as f32);
|
||||
let background = surface_style(tokens, SurfaceKind::under(own_surface(props, cx), env.surface)).fill;
|
||||
ui.painter().extend(ScrollBar::fades(&look, view, HiddenContent::new(content, view.size(), offset, rtl), background));
|
||||
ui.painter().extend(ScrollBar::fades(view, HiddenContent::new(content, view.size(), offset, rtl), background));
|
||||
}
|
||||
if let Some(view) = self.view {
|
||||
use crate::contract::Pointer as _;
|
||||
|
||||
@@ -653,7 +653,7 @@ impl<C: Collection> ShapeHooks<C> for ItemsHooks<'_, '_, C> {
|
||||
// The rows blend into the surface they sit on.
|
||||
let background = surface_style(&env.tokens, SurfaceKind::under(own, env.surface)).fill;
|
||||
let hidden = HiddenContent::new(self.content, rect.size(), Vec2::new(self.offset_x as f32, self.offset as f32), rtl);
|
||||
ui.painter().extend(ScrollBar::fades(&look, rect, hidden, background));
|
||||
ui.painter().extend(ScrollBar::fades(rect, hidden, background));
|
||||
if self.shows_bar(rect) {
|
||||
let track = bar_track(rect, look.thickness, rtl);
|
||||
let content = f64::from(self.content.y);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user