cargo fmt

This commit is contained in:
Hakan 2026-05-12 10:36:15 +03:00
commit ca07268c7c
204 changed files with 13988 additions and 5516 deletions

View file

@ -4,16 +4,47 @@ use crate::app::Message;
use iced::widget::{column, container, row, scrollable, text, Space};
use iced::{Background, Color, Element, Fill, Theme};
const TB: Color = Color { r: 0.13, g: 0.13, b: 0.13, a: 1.0 };
const BG: Color = Color { r: 0.15, g: 0.15, b: 0.15, a: 1.0 };
const BORDER: Color = Color { r: 0.35, g: 0.35, b: 0.35, a: 1.0 };
const DIM: Color = Color { r: 0.55, g: 0.55, b: 0.55, a: 1.0 };
const ACCENT: Color = Color { r: 0.25, g: 0.50, b: 0.85, a: 1.0 };
const KEY: Color = Color { r: 0.40, g: 0.70, b: 1.00, a: 1.0 };
const TB: Color = Color {
r: 0.13,
g: 0.13,
b: 0.13,
a: 1.0,
};
const BG: Color = Color {
r: 0.15,
g: 0.15,
b: 0.15,
a: 1.0,
};
const BORDER: Color = Color {
r: 0.35,
g: 0.35,
b: 0.35,
a: 1.0,
};
const DIM: Color = Color {
r: 0.55,
g: 0.55,
b: 0.55,
a: 1.0,
};
const ACCENT: Color = Color {
r: 0.25,
g: 0.50,
b: 0.85,
a: 1.0,
};
const KEY: Color = Color {
r: 0.40,
g: 0.70,
b: 1.00,
a: 1.0,
};
fn hdivider<'a>() -> Element<'a, Message> {
container(Space::new().width(Fill).height(1))
.width(Fill).height(1)
.width(Fill)
.height(1)
.style(|_: &Theme| container::Style {
background: Some(Background::Color(BORDER)),
..Default::default()
@ -23,7 +54,11 @@ fn hdivider<'a>() -> Element<'a, Message> {
fn shortcut_row<'a>(key: &'static str, action: &'static str) -> Element<'a, Message> {
row![
text(key).size(11).color(KEY).font(iced::Font::MONOSPACE).width(160),
text(key)
.size(11)
.color(KEY)
.font(iced::Font::MONOSPACE)
.width(160),
text(action).size(11),
]
.spacing(8)
@ -34,7 +69,12 @@ fn shortcut_row<'a>(key: &'static str, action: &'static str) -> Element<'a, Mess
fn section<'a>(title: &'static str) -> Element<'a, Message> {
container(text(title).size(11).color(DIM))
.padding(iced::Padding { top: 6.0, right: 0.0, bottom: 2.0, left: 0.0 })
.padding(iced::Padding {
top: 6.0,
right: 0.0,
bottom: 2.0,
left: 0.0,
})
.into()
}
@ -48,7 +88,7 @@ pub fn view_window<'a>(
.size(10)
.color(DIM),
]
.align_y(iced::Center)
.align_y(iced::Center),
)
.style(|_: &Theme| container::Style {
background: Some(Background::Color(TB)),
@ -60,36 +100,40 @@ pub fn view_window<'a>(
// ── Shortcut entries ──────────────────────────────────────────────────
let mut rows: Vec<Element<'_, Message>> = vec![
section("── Function Keys ──────────────────────────────────────"),
shortcut_row("F3", "Toggle Object Snap"),
shortcut_row("F7", "Toggle Grid"),
shortcut_row("F8", "Toggle Ortho"),
shortcut_row("F9", "Toggle Grid Snap"),
shortcut_row("F10", "Toggle Polar Tracking"),
shortcut_row("F11", "Toggle Object Snap Tracking"),
shortcut_row("F12", "Toggle Dynamic Input"),
shortcut_row("F3", "Toggle Object Snap"),
shortcut_row("F7", "Toggle Grid"),
shortcut_row("F8", "Toggle Ortho"),
shortcut_row("F9", "Toggle Grid Snap"),
shortcut_row("F10", "Toggle Polar Tracking"),
shortcut_row("F11", "Toggle Object Snap Tracking"),
shortcut_row("F12", "Toggle Dynamic Input"),
section("── Ctrl Shortcuts ──────────────────────────────────────"),
shortcut_row("Ctrl+N", "New Drawing"),
shortcut_row("Ctrl+O", "Open File"),
shortcut_row("Ctrl+S", "Save"),
shortcut_row("Ctrl+Shift+S", "Save As"),
shortcut_row("Ctrl+Z", "Undo"),
shortcut_row("Ctrl+Shift+Z / Ctrl+Y","Redo"),
shortcut_row("Ctrl+C", "Copy to Clipboard"),
shortcut_row("Ctrl+X", "Cut to Clipboard"),
shortcut_row("Ctrl+V", "Paste from Clipboard"),
shortcut_row("Ctrl+N", "New Drawing"),
shortcut_row("Ctrl+O", "Open File"),
shortcut_row("Ctrl+S", "Save"),
shortcut_row("Ctrl+Shift+S", "Save As"),
shortcut_row("Ctrl+Z", "Undo"),
shortcut_row("Ctrl+Shift+Z / Ctrl+Y", "Redo"),
shortcut_row("Ctrl+C", "Copy to Clipboard"),
shortcut_row("Ctrl+X", "Cut to Clipboard"),
shortcut_row("Ctrl+V", "Paste from Clipboard"),
section("── Other Keys ──────────────────────────────────────────"),
shortcut_row("Enter / Space", "Finalize command / Repeat last"),
shortcut_row("Escape", "Cancel active command"),
shortcut_row("Delete", "Delete selected entities"),
shortcut_row("↑ / ↓", "Command history navigation"),
shortcut_row("Enter / Space", "Finalize command / Repeat last"),
shortcut_row("Escape", "Cancel active command"),
shortcut_row("Delete", "Delete selected entities"),
shortcut_row("↑ / ↓", "Command history navigation"),
];
// Custom overrides section
rows.push(section("── Custom Overrides (SHORTCUTS SET) ──────────────────"));
rows.push(section(
"── Custom Overrides (SHORTCUTS SET) ──────────────────",
));
if overrides.is_empty() {
rows.push(
text(" (none — use: SHORTCUTS SET <key> <command>)")
.size(11).color(DIM).into()
.size(11)
.color(DIM)
.into(),
);
} else {
let mut sorted: Vec<_> = overrides.iter().collect();
@ -97,21 +141,25 @@ pub fn view_window<'a>(
for (key, cmd) in sorted {
rows.push(
row![
text(key.as_str()).size(11).color(KEY).font(iced::Font::MONOSPACE).width(160),
text(key.as_str())
.size(11)
.color(KEY)
.font(iced::Font::MONOSPACE)
.width(160),
text(cmd.as_str()).size(11),
]
.spacing(8).align_y(iced::Center).padding([2, 0])
.into()
.spacing(8)
.align_y(iced::Center)
.padding([2, 0])
.into(),
);
}
}
// ── Section headers styled separately ────────────────────────────────
let content = scrollable(
column(rows).spacing(3).padding([12, 16])
)
.width(Fill)
.height(Fill);
let content = scrollable(column(rows).spacing(3).padding([12, 16]))
.width(Fill)
.height(Fill);
// ── Header row with accent ────────────────────────────────────────────
let header = container(
@ -120,22 +168,25 @@ pub fn view_window<'a>(
text("Action").size(10).color(ACCENT),
]
.spacing(8)
.padding([4, 16])
.padding([4, 16]),
)
.style(|_: &Theme| container::Style {
background: Some(Background::Color(Color { r: 0.13, g: 0.13, b: 0.18, a: 1.0 })),
background: Some(Background::Color(Color {
r: 0.13,
g: 0.13,
b: 0.18,
a: 1.0,
})),
..Default::default()
})
.width(Fill);
container(
column![toolbar, hdivider(), header, hdivider(), content].spacing(0)
)
.style(|_: &Theme| container::Style {
background: Some(Background::Color(BG)),
..Default::default()
})
.width(Fill)
.height(Fill)
.into()
container(column![toolbar, hdivider(), header, hdivider(), content].spacing(0))
.style(|_: &Theme| container::Style {
background: Some(Background::Color(BG)),
..Default::default()
})
.width(Fill)
.height(Fill)
.into()
}