Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
juce6_test2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Lindgren
juce6_test2
Commits
429acd3d
Commit
429acd3d
authored
5 years ago
by
Per Lindgren
Browse files
Options
Downloads
Patches
Plain Diff
position as label
parent
775e39ed
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/PluginEditor.cpp
+13
-6
13 additions, 6 deletions
Source/PluginEditor.cpp
Source/PluginEditor.h
+15
-4
15 additions, 4 deletions
Source/PluginEditor.h
with
28 additions
and
10 deletions
Source/PluginEditor.cpp
+
13
−
6
View file @
429acd3d
...
@@ -15,14 +15,21 @@ Test2AudioProcessorEditor::Test2AudioProcessorEditor(Test2AudioProcessor &p)
...
@@ -15,14 +15,21 @@ Test2AudioProcessorEditor::Test2AudioProcessorEditor(Test2AudioProcessor &p)
{
{
// Make sure that before the constructor has finished, you've set the
// Make sure that before the constructor has finished, you've set the
// editor's size to whatever you need it to be.
// editor's size to whatever you need it to be.
addAndMakeVisible
(
positionLabel
);
// m_flogger = std::unique_ptr<juce::FileLogger>(juce::FileLogger::createDateStampedLogger("foo", "mylog", ".txt", "Welcome to plugin"));
positionLabel
.
setText
(
"Text input:"
,
juce
::
dontSendNotification
);
// positionLabel.attachToComponent(&inputText, true);
positionLabel
.
setColour
(
juce
::
Label
::
textColourId
,
juce
::
Colours
::
orange
);
positionLabel
.
setJustificationType
(
juce
::
Justification
::
right
);
startTimerHz
(
60
);
setResizable
(
true
,
true
);
setResizable
(
true
,
true
);
setResizeLimits
(
400
,
300
,
1024
,
1024
);
setSize
(
400
,
300
);
setSize
(
400
,
300
);
}
}
Test2AudioProcessorEditor
::~
Test2AudioProcessorEditor
()
Test2AudioProcessorEditor
::~
Test2AudioProcessorEditor
()
{
{
stopTimer
();
}
}
//==============================================================================
//==============================================================================
...
@@ -33,10 +40,9 @@ void Test2AudioProcessorEditor::paint(juce::Graphics &g)
...
@@ -33,10 +40,9 @@ void Test2AudioProcessorEditor::paint(juce::Graphics &g)
g
.
setColour
(
juce
::
Colours
::
white
);
g
.
setColour
(
juce
::
Colours
::
white
);
g
.
setFont
(
15.0f
);
g
.
setFont
(
15.0f
);
g
.
drawFittedText
(
"Hello Per 10 !"
,
getLocalBounds
(),
juce
::
Justification
::
centred
,
1
);
g
.
drawFittedText
(
"1) Position : "
+
std
::
to_string
(
processor
.
position
),
getLocalBounds
(),
juce
::
Justification
::
centred
,
1
);
g
.
drawFittedText
(
"Hello Per 10 !"
,
getLocalBounds
(),
juce
::
Justification
::
centred
,
1
);
// if (processor.m_flogger)
if
(
processor
.
m_flogger
)
// processor.m_flogger->logMessage("paint called");
processor
.
m_flogger
->
logMessage
(
"paint called"
);
}
}
void
Test2AudioProcessorEditor
::
resized
()
void
Test2AudioProcessorEditor
::
resized
()
...
@@ -45,6 +51,7 @@ void Test2AudioProcessorEditor::resized()
...
@@ -45,6 +51,7 @@ void Test2AudioProcessorEditor::resized()
// subcomponents in your editor..
// subcomponents in your editor..
auto
bounds
=
getLocalBounds
();
auto
bounds
=
getLocalBounds
();
positionLabel
.
setBounds
(
bounds
.
removeFromBottom
(
30
).
withSizeKeepingCentre
(
50
,
24
));
if
(
processor
.
m_flogger
)
if
(
processor
.
m_flogger
)
processor
.
m_flogger
->
logMessage
(
bounds
.
toString
());
processor
.
m_flogger
->
logMessage
(
bounds
.
toString
());
...
...
This diff is collapsed.
Click to expand it.
Source/PluginEditor.h
+
15
−
4
View file @
429acd3d
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
//==============================================================================
//==============================================================================
/**
/**
*/
*/
class
Test2AudioProcessorEditor
:
public
juce
::
AudioProcessorEditor
class
Test2AudioProcessorEditor
:
public
juce
::
AudioProcessorEditor
,
private
juce
::
Timer
{
{
public:
public:
Test2AudioProcessorEditor
(
Test2AudioProcessor
&
);
Test2AudioProcessorEditor
(
Test2AudioProcessor
&
);
...
@@ -28,8 +28,19 @@ private:
...
@@ -28,8 +28,19 @@ private:
// This reference is provided as a quick way for your editor to
// This reference is provided as a quick way for your editor to
// access the processor object that created it.
// access the processor object that created it.
Test2AudioProcessor
&
processor
;
Test2AudioProcessor
&
processor
;
// is this the way
std
::
unique_ptr
<
juce
::
FileLogger
>
m_flogger
;
juce
::
Label
positionLabel
;
// = juce::Label("Position", "Position : 0");
// or something like
//juce::Label positionLabel = {"Position"};
// should it be here or in the cpp file
// do we even need a cpp file, seems easier to do everything in the
// class declaration as we do not need to repeat the type name for each
// member function.
void
timerCallback
()
override
{
positionLabel
.
setText
(
"Pos : "
+
std
::
to_string
(
processor
.
position
),
juce
::
dontSendNotification
);
repaint
();
}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
(
Test2AudioProcessorEditor
)
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
(
Test2AudioProcessorEditor
)
};
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment