From 5e06b19650cfeba2e6cb81345a703734346b9be5 Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Fri, 14 Feb 2025 01:21:41 +0100 Subject: [PATCH] More numberbox improvements --- Source/Components/DraggableNumber.h | 18 ++++++++---------- Source/Objects/ListObject.h | 2 -- Source/Sidebar/AutomationPanel.h | 1 - 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Source/Components/DraggableNumber.h b/Source/Components/DraggableNumber.h index af62244ad..ab9b700f8 100644 --- a/Source/Components/DraggableNumber.h +++ b/Source/Components/DraggableNumber.h @@ -124,19 +124,17 @@ class DraggableNumber : public Component, public TextEditor::Listener { minimumHorizontalScale = newScale; } - - void setJustificationType(Justification just) - { - // TODO: implement this! - } - + void setText(String const& newText, NotificationType notification) { + hideEditor(false); + currentValue = newText; repaint(); - //onTextChange(); - // TODO: send notification! + if(notification == sendNotification) { + onTextChange(); + } } TextEditor* getCurrentTextEditor() @@ -275,6 +273,7 @@ class DraggableNumber : public Component, public TextEditor::Listener std::swap (outgoingEditor, editor); if(!discardCurrentEditorContents) { + decimalDrag = 0; updateFromTextEditorContents (*outgoingEditor); } @@ -342,9 +341,8 @@ class DraggableNumber : public Component, public TextEditor::Listener if (!approximatelyEqual(lastValue, newValue) && notification != dontSendNotification) { onValueChange(newValue); + lastValue = newValue; } - - lastValue = newValue; } double getValue() const diff --git a/Source/Objects/ListObject.h b/Source/Objects/ListObject.h index e13a6bba0..d56055917 100644 --- a/Source/Objects/ListObject.h +++ b/Source/Objects/ListObject.h @@ -23,8 +23,6 @@ class ListObject final : public ObjectBase { { listLabel.setBounds(2, 0, getWidth() - 2, getHeight() - 1); listLabel.setMinimumHorizontalScale(1.f); - listLabel.setJustificationType(Justification::centredLeft); - // listLabel.setBorderSize(BorderSize(2, 6, 2, 2)); addAndMakeVisible(listLabel); diff --git a/Source/Sidebar/AutomationPanel.h b/Source/Sidebar/AutomationPanel.h index 022899ffd..fbde37304 100644 --- a/Source/Sidebar/AutomationPanel.h +++ b/Source/Sidebar/AutomationPanel.h @@ -231,7 +231,6 @@ class AutomationItem final : public ObjectDragAndDrop }; valueLabel.setMinimumHorizontalScale(1.0f); - valueLabel.setJustificationType(Justification::centred); nameLabel.setMinimumHorizontalScale(1.0f); nameLabel.setJustificationType(Justification::centred);