1
0
Fork 0

Rename SC visualizer to analyzer

Slightly more fitting term.
This commit is contained in:
Robbert van der Helm 2023-03-19 13:38:30 +01:00
parent 6f070150ea
commit 234a5f5334
2 changed files with 15 additions and 15 deletions

View file

@ -39,7 +39,7 @@ const COLUMN_WIDTH: Units = Pixels(330.0);
const DARKER_GRAY: Color = Color::rgb(0x69, 0x69, 0x69); const DARKER_GRAY: Color = Color::rgb(0x69, 0x69, 0x69);
/// The editor's mode. Essentially just a boolean to indicate whether the visualizer is shown or /// The editor's mode. Essentially just a boolean to indicate whether the analyzer is shown or
/// not. /// not.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum EditorMode { pub enum EditorMode {
@ -48,8 +48,8 @@ pub enum EditorMode {
#[serde(rename = "collapsed")] #[serde(rename = "collapsed")]
Collapsed, Collapsed,
#[default] #[default]
#[serde(rename = "visualizer-visible")] #[serde(rename = "analyzer-visible")]
VisualizerVisible, AnalyzerVisible,
} }
#[derive(Lens)] #[derive(Lens)]
@ -65,7 +65,7 @@ impl Model for Data {}
pub(crate) fn default_state(editor_mode: Arc<AtomicCell<EditorMode>>) -> Arc<ViziaState> { pub(crate) fn default_state(editor_mode: Arc<AtomicCell<EditorMode>>) -> Arc<ViziaState> {
ViziaState::new(move || match editor_mode.load() { ViziaState::new(move || match editor_mode.load() {
EditorMode::Collapsed => (COLLAPSED_GUI_WIDTH, GUI_HEIGHT), EditorMode::Collapsed => (COLLAPSED_GUI_WIDTH, GUI_HEIGHT),
EditorMode::VisualizerVisible => (EXPANDED_GUI_WIDTH, GUI_HEIGHT), EditorMode::AnalyzerVisible => (EXPANDED_GUI_WIDTH, GUI_HEIGHT),
}) })
} }
@ -89,11 +89,11 @@ pub(crate) fn create(
HStack::new(cx, |cx| { HStack::new(cx, |cx| {
main_column(cx); main_column(cx);
let visualizer_visible = Data::editor_mode let analyzer_visible = Data::editor_mode
.map(|editor_mode| editor_mode.load() == EditorMode::VisualizerVisible); .map(|editor_mode| editor_mode.load() == EditorMode::AnalyzerVisible);
Binding::new(cx, visualizer_visible, |cx, visualizer_visible| { Binding::new(cx, analyzer_visible, |cx, analyzer_visible| {
if visualizer_visible.get(cx) { if analyzer_visible.get(cx) {
visualizer_column(cx); analyzer_column(cx);
} }
}); });
}); });
@ -103,7 +103,7 @@ pub(crate) fn create(
fn main_column(cx: &mut Context) { fn main_column(cx: &mut Context) {
VStack::new(cx, |cx| { VStack::new(cx, |cx| {
HStack::new(cx, |cx| { HStack::new(cx, |cx| {
EditorModeButton::new(cx, Data::editor_mode, "Show visualizer") EditorModeButton::new(cx, Data::editor_mode, "Show analyzer")
// Makes this align a bit nicer with the plugin name // Makes this align a bit nicer with the plugin name
.top(Pixels(2.0)) .top(Pixels(2.0))
.left(Pixels(2.0)); .left(Pixels(2.0));
@ -229,11 +229,11 @@ fn main_column(cx: &mut Context) {
.child_right(Stretch(1.0)); .child_right(Stretch(1.0));
} }
fn visualizer_column(cx: &mut Context) { fn analyzer_column(cx: &mut Context) {
HStack::new(cx, |cx| { HStack::new(cx, |cx| {
Label::new(cx, "When I grow up I want to be a spectrum analyzer!"); Label::new(cx, "When I grow up I want to be a spectrum analyzer!");
}) })
// These arbitrary 12 pixels are to align with the visualizer toggle botton // These arbitrary 12 pixels are to align with the analyzer toggle botton
.space(Pixels(12.0)) .space(Pixels(12.0))
.bottom(Pixels(12.0)) .bottom(Pixels(12.0))
.left(Pixels(2.0)) .left(Pixels(2.0))

View file

@ -38,7 +38,7 @@ impl EditorModeButton {
.build(cx, move |cx| { .build(cx, move |cx| {
Label::new(cx, label).hoverable(false); Label::new(cx, label).hoverable(false);
}) })
.checked(lens.map(|v| v.load() == EditorMode::VisualizerVisible)) .checked(lens.map(|v| v.load() == EditorMode::AnalyzerVisible))
// We'll pretend this is a param-button, so this class is used for assigning a unique // We'll pretend this is a param-button, so this class is used for assigning a unique
// color // color
.class("editor-mode") .class("editor-mode")
@ -58,8 +58,8 @@ impl View for EditorModeButton {
| WindowEvent::MouseTripleClick(MouseButton::Left) => { | WindowEvent::MouseTripleClick(MouseButton::Left) => {
let current_mode = self.mode.load(); let current_mode = self.mode.load();
let new_mode = match current_mode { let new_mode = match current_mode {
EditorMode::Collapsed => EditorMode::VisualizerVisible, EditorMode::Collapsed => EditorMode::AnalyzerVisible,
EditorMode::VisualizerVisible => EditorMode::Collapsed, EditorMode::AnalyzerVisible => EditorMode::Collapsed,
}; };
self.mode.store(new_mode); self.mode.store(new_mode);