|
@@ -9,6 +9,7 @@ use std::rc::Rc;
|
|
|
|
|
|
use crate::{app, dmc};
|
|
|
|
|
|
+// The set of possible symbols for chart icons
|
|
|
const SYMBOLS: &[char] = &['A', 'B', 'C', 'D'];
|
|
|
|
|
|
#[derive(Clone)]
|
|
@@ -27,14 +28,28 @@ impl App {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/// The name is a bit of a misnomer here, since it also contains the
|
|
|
+/// "model" (i.e. the `app` field) but this contains all the
|
|
|
+/// information necessary to refer to parts of the UI. Note that
|
|
|
+/// everything here is refcounted internally (the `App` via an `Rc`
|
|
|
+/// and everything else via the GTK machinery) so calling `.clone()`
|
|
|
+/// on this struct will just produce new copies that point at the same
|
|
|
+/// underlying data.
|
|
|
#[derive(Clone)]
|
|
|
pub struct View {
|
|
|
+ // the app data
|
|
|
app: App,
|
|
|
+ // the overall window
|
|
|
window: gtk::Window,
|
|
|
+ // a map from character to button that changes to that charater
|
|
|
icon_buttons: HashMap<char, gtk::Button>,
|
|
|
+ // the text entry for the DMC color
|
|
|
color_input: gtk::Entry,
|
|
|
+ // the textual name of that DMC color
|
|
|
color_name: gtk::Label,
|
|
|
+ // the create-it button
|
|
|
submit: gtk::Button,
|
|
|
+ // the drawing area
|
|
|
canvas: gtk::DrawingArea,
|
|
|
}
|
|
|
|