Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugin-GUI
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yehaojie
plugin-GUI
Commits
86a09c9a
Commit
86a09c9a
authored
11 years ago
by
jsiegle
Browse files
Options
Downloads
Patches
Plain Diff
Add saving and loading capabilities to PhaseDetector settings
parent
0934f1ce
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/Processors/Editors/PhaseDetectorEditor.cpp
+109
-50
109 additions, 50 deletions
Source/Processors/Editors/PhaseDetectorEditor.cpp
Source/Processors/Editors/PhaseDetectorEditor.h
+12
-0
12 additions, 0 deletions
Source/Processors/Editors/PhaseDetectorEditor.h
with
121 additions
and
50 deletions
Source/Processors/Editors/PhaseDetectorEditor.cpp
+
109
−
50
View file @
86a09c9a
...
...
@@ -95,6 +95,8 @@ void PhaseDetectorEditor::updateSettings()
}
}
previousChannelCount
=
getProcessor
()
->
getNumInputs
();
}
void
PhaseDetectorEditor
::
comboBoxChanged
(
ComboBox
*
c
)
...
...
@@ -112,28 +114,6 @@ void PhaseDetectorEditor::comboBoxChanged(ComboBox* c)
}
// float channel;
// int id = c->getSelectedId();
// if (id == 1)
// {
// channel = -1.0f;
// }
// else
// {
// channel = float(id) - 2.0f;
// }
// if (c == inputChannelSelectionBox)
// {
// getProcessor()->setParameter(1, channel);
// } else if (c == outputChannelSelectionBox) {
// getProcessor()->setParameter(2, channel);
// }
}
void
PhaseDetectorEditor
::
buttonEvent
(
Button
*
button
)
...
...
@@ -141,32 +121,38 @@ void PhaseDetectorEditor::buttonEvent(Button* button)
if
(
button
==
plusButton
&&
interfaces
.
size
()
<
5
)
{
PhaseDetector
*
pd
=
(
PhaseDetector
*
)
getProcess
or
();
addDetect
or
();
int
detectorNumber
=
interfaces
.
size
()
+
1
;
}
DetectorInterface
*
di
=
new
DetectorInterface
(
pd
,
backgroundColours
[
detectorNumber
%
5
],
detectorNumber
-
1
);
di
->
setBounds
(
10
,
50
,
190
,
80
);
}
addAndMakeVisible
(
di
);
void
PhaseDetectorEditor
::
addDetector
()
{
interfaces
.
add
(
di
);
PhaseDetector
*
pd
=
(
PhaseDetector
*
)
getProcessor
(
);
String
itemName
=
"Detector "
;
itemName
+=
detectorNumber
;
int
detectorNumber
=
interfaces
.
size
()
+
1
;
std
::
cout
<<
itemName
<<
std
::
endl
;
DetectorInterface
*
di
=
new
DetectorInterface
(
pd
,
backgroundColours
[
detectorNumber
%
5
],
detectorNumber
-
1
);
di
->
setBounds
(
10
,
50
,
190
,
80
);
detectorSelector
->
addItem
(
itemName
,
detectorNumber
);
detectorSelector
->
setSelectedId
(
detectorNumber
,
false
);
addAndMakeVisible
(
di
);
for
(
int
i
=
0
;
i
<
detectorNumber
-
1
;
i
++
)
{
interfaces
[
i
]
->
setVisible
(
false
);
}
interfaces
.
add
(
di
);
}
String
itemName
=
"Detector "
;
itemName
+=
detectorNumber
;
//std::cout << itemName << std::endl;
detectorSelector
->
addItem
(
itemName
,
detectorNumber
);
detectorSelector
->
setSelectedId
(
detectorNumber
,
false
);
for
(
int
i
=
0
;
i
<
detectorNumber
-
1
;
i
++
)
{
interfaces
[
i
]
->
setVisible
(
false
);
}
}
void
PhaseDetectorEditor
::
saveEditorParameters
(
XmlElement
*
xml
)
...
...
@@ -174,24 +160,37 @@ void PhaseDetectorEditor::saveEditorParameters(XmlElement* xml)
xml
->
setAttribute
(
"Type"
,
"PhaseDetectorEditor"
);
// XmlElement* selectedChannel = xml->createNewChildElement("SELECTEDID");
// selectedChannel->setAttribute("INPUTCHANNEL",inputChannelSelectionBox->getSelectedId());
// selectedChannel->setAttribute("OUTPUTCHANNEL",outputChannelSelectionBox->getSelectedId());
for
(
int
i
=
0
;
i
<
interfaces
.
size
();
i
++
)
{
XmlElement
*
d
=
xml
->
createNewChildElement
(
"DETECTOR"
);
d
->
setAttribute
(
"PHASE"
,
interfaces
[
i
]
->
getPhase
());
d
->
setAttribute
(
"INPUT"
,
interfaces
[
i
]
->
getInputChan
());
d
->
setAttribute
(
"GATE"
,
interfaces
[
i
]
->
getGateChan
());
d
->
setAttribute
(
"OUTPUT"
,
interfaces
[
i
]
->
getOutputChan
());
}
}
void
PhaseDetectorEditor
::
loadEditorParameters
(
XmlElement
*
xml
)
{
int
i
=
0
;
forEachXmlChildElement
(
*
xml
,
xmlNode
)
{
if
(
xmlNode
->
hasTagName
(
"
SELECTEDID
"
))
if
(
xmlNode
->
hasTagName
(
"
DETECTOR
"
))
{
// inputChannelSelectionBox->setSelectedId(xmlNode->getIntAttribute("INPUTCHANNEL"));
// outputChannelSelectionBox->setSelectedId(xmlNode->getIntAttribute("OUTPUTCHANNEL"));
if
(
i
>
0
)
{
addDetector
();
}
interfaces
[
i
]
->
setPhase
(
xmlNode
->
getIntAttribute
(
"PHASE"
));
interfaces
[
i
]
->
setInputChan
(
xmlNode
->
getIntAttribute
(
"INPUT"
));
interfaces
[
i
]
->
setGateChan
(
xmlNode
->
getIntAttribute
(
"GATE"
));
interfaces
[
i
]
->
setOutputChan
(
xmlNode
->
getIntAttribute
(
"OUTPUT"
));
i
++
;
}
}
}
...
...
@@ -271,7 +270,7 @@ DetectorInterface::DetectorInterface(PhaseDetector* pd, Colour c, int id) :
DetectorInterface
::~
DetectorInterface
()
{
}
void
DetectorInterface
::
comboBoxChanged
(
ComboBox
*
c
)
...
...
@@ -324,9 +323,6 @@ void DetectorInterface::updateChannels(int numChannels)
}
inputSelector
->
setSelectedId
(
1
,
false
);
//getProcessor()->setParameter(1,-1.0f);
}
void
DetectorInterface
::
paint
(
Graphics
&
g
)
...
...
@@ -340,4 +336,67 @@ void DetectorInterface::paint(Graphics& g)
g
.
drawText
(
"GATE"
,
50
,
35
,
85
,
10
,
Justification
::
right
,
true
);
g
.
drawText
(
"OUTPUT"
,
50
,
60
,
85
,
10
,
Justification
::
right
,
true
);
}
int
DetectorInterface
::
getPhase
()
{
for
(
int
i
=
0
;
i
<
phaseButtons
.
size
();
i
++
)
{
if
(
phaseButtons
[
i
]
->
getToggleState
())
{
return
i
;
}
}
return
-
1
;
}
void
DetectorInterface
::
setPhase
(
int
p
)
{
if
(
p
>=
0
)
phaseButtons
[
p
]
->
setToggleState
(
true
,
false
);
processor
->
setActiveModule
(
idNum
);
processor
->
setParameter
(
1
,
(
float
)
p
+
1
);
}
void
DetectorInterface
::
setInputChan
(
int
chan
)
{
inputSelector
->
setSelectedId
(
chan
+
2
);
processor
->
setParameter
(
2
,
(
float
)
chan
);
}
void
DetectorInterface
::
setOutputChan
(
int
chan
)
{
outputSelector
->
setSelectedId
(
chan
+
2
);
processor
->
setParameter
(
3
,
(
float
)
chan
);
}
void
DetectorInterface
::
setGateChan
(
int
chan
)
{
gateSelector
->
setSelectedId
(
chan
+
2
);
processor
->
setParameter
(
4
,
(
float
)
chan
);
}
int
DetectorInterface
::
getInputChan
()
{
return
inputSelector
->
getSelectedId
()
-
2
;
}
int
DetectorInterface
::
getOutputChan
()
{
return
outputSelector
->
getSelectedId
()
-
2
;
}
int
DetectorInterface
::
getGateChan
()
{
return
gateSelector
->
getSelectedId
()
-
2
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Source/Processors/Editors/PhaseDetectorEditor.h
+
12
−
0
View file @
86a09c9a
...
...
@@ -65,6 +65,8 @@ private:
ScopedPointer
<
UtilityButton
>
plusButton
;
void
addDetector
();
// ScopedPointer<ComboBox> inputChannelSelectionBox;
// ScopedPointer<ComboBox> outputChannelSelectionBox;
...
...
@@ -96,6 +98,16 @@ public:
void
updateChannels
(
int
);
void
setPhase
(
int
);
void
setInputChan
(
int
);
void
setOutputChan
(
int
);
void
setGateChan
(
int
);
int
getPhase
();
int
getInputChan
();
int
getOutputChan
();
int
getGateChan
();
private:
Colour
backgroundColour
;
...
...
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