git-svn-id: http://moon:8086/svn/software/trunk/projects/FsTrack@127 b431acfa-c32f-4a4a-93f1-934dc6c82436
252 lines
9.6 KiB
C++
252 lines
9.6 KiB
C++
/*
|
|
==============================================================================
|
|
|
|
This is an automatically generated GUI class created by the Introjucer!
|
|
|
|
Be careful when adding custom code to these files, as only the code within
|
|
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
|
|
and re-saved.
|
|
|
|
Created with Introjucer version: 3.1.0
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
|
|
Copyright 2004-13 by Raw Material Software Ltd.
|
|
|
|
==============================================================================
|
|
*/
|
|
|
|
//[Headers] You can add your own extra header files here...
|
|
//[/Headers]
|
|
|
|
#include "MainComponent.h"
|
|
|
|
|
|
//[MiscUserDefs] You can add your own user definitions and misc code here...
|
|
//[/MiscUserDefs]
|
|
|
|
//==============================================================================
|
|
MainComponent::MainComponent (String const &homeDir)
|
|
{
|
|
addAndMakeVisible (m_fsuipcStatus = new Label ("FSUIP Status",
|
|
TRANS("Unknown")));
|
|
m_fsuipcStatus->setTooltip (TRANS("FSUIP Status"));
|
|
m_fsuipcStatus->setFont (Font (15.00f, Font::plain));
|
|
m_fsuipcStatus->setJustificationType (Justification::centredLeft);
|
|
m_fsuipcStatus->setEditable (false, false, false);
|
|
m_fsuipcStatus->setColour (TextEditor::textColourId, Colours::black);
|
|
m_fsuipcStatus->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
|
|
|
addAndMakeVisible (m_flightStatus = new Label ("Flight Status",
|
|
TRANS("Unknown")));
|
|
m_flightStatus->setTooltip (TRANS("Flight Status"));
|
|
m_flightStatus->setFont (Font (15.00f, Font::plain));
|
|
m_flightStatus->setJustificationType (Justification::centredLeft);
|
|
m_flightStatus->setEditable (false, false, false);
|
|
m_flightStatus->setColour (TextEditor::textColourId, Colours::black);
|
|
m_flightStatus->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
|
|
|
addAndMakeVisible (m_kmlUpdInterval_s = new Slider ("KML Update Interval"));
|
|
m_kmlUpdInterval_s->setTooltip (TRANS("KML Update Interval"));
|
|
m_kmlUpdInterval_s->setRange (0.1, 10, 0.1);
|
|
m_kmlUpdInterval_s->setSliderStyle (Slider::LinearHorizontal);
|
|
m_kmlUpdInterval_s->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20);
|
|
m_kmlUpdInterval_s->addListener (this);
|
|
|
|
addAndMakeVisible (m_colorSelector = new ColourSelector());
|
|
m_colorSelector->setName ("Color Selector");
|
|
|
|
addAndMakeVisible (m_altitudeMode = new ComboBox ("Altitude Mode"));
|
|
m_altitudeMode->setTooltip (TRANS("Altitude Mode"));
|
|
m_altitudeMode->setEditableText (false);
|
|
m_altitudeMode->setJustificationType (Justification::centredLeft);
|
|
m_altitudeMode->setTextWhenNothingSelected (String::empty);
|
|
m_altitudeMode->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
|
|
m_altitudeMode->addItem (TRANS("absolute"), 1);
|
|
m_altitudeMode->addItem (TRANS("relativeToGround"), 2);
|
|
m_altitudeMode->addItem (TRANS("clampToGround"), 3);
|
|
m_altitudeMode->addSeparator();
|
|
m_altitudeMode->addListener (this);
|
|
|
|
|
|
//[UserPreSize]
|
|
//[/UserPreSize]
|
|
|
|
setSize (400, 300);
|
|
|
|
|
|
//[Constructor] You can add your own custom stuff here..
|
|
m_toolTip = new TooltipWindow(this);
|
|
|
|
static String workDir(homeDir + String("\\FsTrack"));
|
|
|
|
File file(workDir);
|
|
file.createDirectory();
|
|
|
|
m_kml = new Kml(workDir.getCharPointer());
|
|
|
|
m_fsLink = new FsLink(workDir.getCharPointer());
|
|
m_fsLink->addListener(this);
|
|
m_fsLink->setKml(m_kml);
|
|
|
|
m_httpServer = new HttpServer(5001, workDir.getCharPointer());
|
|
m_httpServer->addListener(m_kml);
|
|
|
|
m_kmlUpdInterval_s->setValue(1.0, juce::NotificationType::sendNotification);
|
|
|
|
m_colorSelector->addChangeListener(this);
|
|
m_colorSelector->setCurrentColour(juce::Colours::yellow);
|
|
|
|
m_altitudeMode->setSelectedId(1, juce::NotificationType::sendNotification);
|
|
//[/Constructor]
|
|
}
|
|
|
|
MainComponent::~MainComponent()
|
|
{
|
|
//[Destructor_pre]. You can add your own custom destruction code here..
|
|
m_toolTip = nullptr;
|
|
m_kml = nullptr;
|
|
m_fsLink = nullptr;
|
|
m_httpServer = nullptr;
|
|
//[/Destructor_pre]
|
|
|
|
m_fsuipcStatus = nullptr;
|
|
m_flightStatus = nullptr;
|
|
m_kmlUpdInterval_s = nullptr;
|
|
m_colorSelector = nullptr;
|
|
m_altitudeMode = nullptr;
|
|
|
|
|
|
//[Destructor]. You can add your own custom destruction code here..
|
|
//[/Destructor]
|
|
}
|
|
|
|
//==============================================================================
|
|
void MainComponent::paint (Graphics& g)
|
|
{
|
|
//[UserPrePaint] Add your own custom painting code here..
|
|
//[/UserPrePaint]
|
|
|
|
g.fillAll (Colours::white);
|
|
|
|
//[UserPaint] Add your own custom painting code here..
|
|
//[/UserPaint]
|
|
}
|
|
|
|
void MainComponent::resized()
|
|
{
|
|
m_fsuipcStatus->setBounds (16, 264, 150, 24);
|
|
m_flightStatus->setBounds (216, 264, 150, 24);
|
|
m_kmlUpdInterval_s->setBounds (16, 232, 184, 24);
|
|
m_colorSelector->setBounds (24, 24, 168, 192);
|
|
m_altitudeMode->setBounds (216, 32, 160, 24);
|
|
//[UserResized] Add your own custom resize handling here..
|
|
//[/UserResized]
|
|
}
|
|
|
|
void MainComponent::sliderValueChanged (Slider* sliderThatWasMoved)
|
|
{
|
|
//[UsersliderValueChanged_Pre]
|
|
//[/UsersliderValueChanged_Pre]
|
|
|
|
if (sliderThatWasMoved == m_kmlUpdInterval_s)
|
|
{
|
|
//[UserSliderCode_m_kmlUpdInterval_s] -- add your slider handling code here..
|
|
m_fsLink->setUpdateInterval(sliderThatWasMoved->getValue());
|
|
//[/UserSliderCode_m_kmlUpdInterval_s]
|
|
}
|
|
|
|
//[UsersliderValueChanged_Post]
|
|
//[/UsersliderValueChanged_Post]
|
|
}
|
|
|
|
void MainComponent::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
|
|
{
|
|
//[UsercomboBoxChanged_Pre]
|
|
//[/UsercomboBoxChanged_Pre]
|
|
|
|
if (comboBoxThatHasChanged == m_altitudeMode)
|
|
{
|
|
//[UserComboBoxCode_m_altitudeMode] -- add your combo box handling code here..
|
|
m_kml->setAltitudeMode(comboBoxThatHasChanged->getItemText(comboBoxThatHasChanged->getSelectedItemIndex()));
|
|
//[/UserComboBoxCode_m_altitudeMode]
|
|
}
|
|
|
|
//[UsercomboBoxChanged_Post]
|
|
//[/UsercomboBoxChanged_Post]
|
|
}
|
|
|
|
|
|
|
|
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
|
|
void MainComponent::onStateChanged(IFsLink &obj)
|
|
{
|
|
m_fsuipcStatus->setText(obj.getLinkState(), juce::sendNotification);
|
|
m_flightStatus->setText(obj.getFlightState(), juce::sendNotification);
|
|
}
|
|
|
|
void MainComponent::onDataChanged(IFsLink &obj)
|
|
{
|
|
(void)obj;
|
|
}
|
|
|
|
void MainComponent::changeListenerCallback(juce::ChangeBroadcaster *source)
|
|
{
|
|
if (m_colorSelector == source)
|
|
{
|
|
ColourSelector &obj = (ColourSelector&)*source;
|
|
m_kml->setPathColor(String(obj.getCurrentColour().fromRGBA(obj.getCurrentColour().getBlue(), obj.getCurrentColour().getGreen(), obj.getCurrentColour().getRed(), obj.getCurrentColour().getAlpha()).toString()));
|
|
}
|
|
}
|
|
|
|
//[/MiscUserCode]
|
|
|
|
|
|
//==============================================================================
|
|
#if 0
|
|
/* -- Introjucer information section --
|
|
|
|
This is where the Introjucer stores the metadata that describe this GUI layout, so
|
|
make changes in here at your peril!
|
|
|
|
BEGIN_JUCER_METADATA
|
|
|
|
<JUCER_COMPONENT documentType="Component" className="MainComponent" componentName=""
|
|
parentClasses="public Component, public IFsLinkListener, public ChangeListener"
|
|
constructorParams="String const &homeDir" variableInitialisers=""
|
|
snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330"
|
|
fixedSize="1" initialWidth="400" initialHeight="300">
|
|
<BACKGROUND backgroundColour="ffffffff"/>
|
|
<LABEL name="FSUIP Status" id="a891503ff0f699d7" memberName="m_fsuipcStatus"
|
|
virtualName="" explicitFocusOrder="0" pos="16 264 150 24" tooltip="FSUIP Status"
|
|
edTextCol="ff000000" edBkgCol="0" labelText="Unknown" editableSingleClick="0"
|
|
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
|
|
fontsize="15" bold="0" italic="0" justification="33"/>
|
|
<LABEL name="Flight Status" id="2a046c84c0638c1f" memberName="m_flightStatus"
|
|
virtualName="" explicitFocusOrder="0" pos="216 264 150 24" tooltip="Flight Status"
|
|
edTextCol="ff000000" edBkgCol="0" labelText="Unknown" editableSingleClick="0"
|
|
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
|
|
fontsize="15" bold="0" italic="0" justification="33"/>
|
|
<SLIDER name="KML Update Interval" id="c4434642fabdd31c" memberName="m_kmlUpdInterval_s"
|
|
virtualName="" explicitFocusOrder="0" pos="16 232 184 24" tooltip="KML Update Interval"
|
|
min="0.10000000000000001" max="10" int="0.10000000000000001"
|
|
style="LinearHorizontal" textBoxPos="TextBoxLeft" textBoxEditable="1"
|
|
textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
|
|
<GENERICCOMPONENT name="Color Selector" id="bccc8a8094997edb" memberName="m_colorSelector"
|
|
virtualName="" explicitFocusOrder="0" pos="24 24 168 192" class="ColourSelector"
|
|
params=""/>
|
|
<COMBOBOX name="Altitude Mode" id="93006349fcf3e57a" memberName="m_altitudeMode"
|
|
virtualName="" explicitFocusOrder="0" pos="216 32 160 24" tooltip="Altitude Mode"
|
|
editable="0" layout="33" items="absolute relativeToGround clampToGround "
|
|
textWhenNonSelected="" textWhenNoItems="(no choices)"/>
|
|
</JUCER_COMPONENT>
|
|
|
|
END_JUCER_METADATA
|
|
*/
|
|
#endif
|
|
|
|
|
|
//[EndFile] You can add extra defines here...
|
|
//[/EndFile]
|