void VoxGame::CreateGUI() { m_pMainWindow = new GUIWindow(m_pRenderer, m_defaultFont, "Main"); m_pMainWindow->AllowMoving(true); m_pMainWindow->AllowClosing(false); m_pMainWindow->AllowMinimizing(true); m_pMainWindow->AllowScrolling(true); m_pMainWindow->SetRenderTitleBar(true); m_pMainWindow->SetRenderWindowBackground(true); m_pMainWindow->SetOutlineRender(true); m_pMainWindow->SetDimensions(15, 35, 320, 140); m_pMainWindow->SetApplicationDimensions(m_windowWidth, m_windowHeight); m_pWireframeCheckBox = new CheckBox(m_pRenderer, m_defaultFont, "Wireframe"); m_pWireframeCheckBox->SetDimensions(10, 10, 14, 14); m_pShadowsCheckBox = new CheckBox(m_pRenderer, m_defaultFont, "Shadows"); m_pShadowsCheckBox->SetDimensions(10, 28, 14, 14); m_pMSAACheckBox = new CheckBox(m_pRenderer, m_defaultFont, "Anti-Aliasing"); m_pMSAACheckBox->SetDimensions(10, 46, 14, 14); m_pDynamicLightingCheckBox = new CheckBox(m_pRenderer, m_defaultFont, "Lighting"); m_pDynamicLightingCheckBox->SetDimensions(10, 64, 14, 14); m_pSSAOCheckBox = new CheckBox(m_pRenderer, m_defaultFont, "SSAO"); m_pSSAOCheckBox->SetDimensions(10, 82, 14, 14); m_pBlurCheckBox = new CheckBox(m_pRenderer, m_defaultFont, "Blur"); m_pBlurCheckBox->SetDimensions(10, 100, 14, 14); m_pDeferredCheckBox = new CheckBox(m_pRenderer, m_defaultFont, "Deferred"); m_pDeferredCheckBox->SetDimensions(10, 118, 14, 14); m_pUpdateCheckBox = new CheckBox(m_pRenderer, m_defaultFont, "Update"); m_pUpdateCheckBox->SetDimensions(110, 28, 14, 14); m_pUpdateCheckBox->SetToggled(true); m_pDebugRenderCheckBox = new CheckBox(m_pRenderer, m_defaultFont, "DebugRender"); m_pDebugRenderCheckBox->SetDimensions(110, 10, 14, 14); m_pInstanceRenderCheckBox = new CheckBox(m_pRenderer, m_defaultFont, "Instance Particles"); m_pInstanceRenderCheckBox->SetDimensions(110, 46, 14, 14); m_pPlayAnimationButton = new Button(m_pRenderer, m_defaultFont, "Play Anim"); m_pPlayAnimationButton->SetDimensions(230, 40, 85, 25); m_pPlayAnimationButton->SetCallBackFunction(_PlayAnimationPressed); m_pPlayAnimationButton->SetCallBackData(this); m_pAnimationsPulldown = new PulldownMenu(m_pRenderer, m_defaultFont, "Animation"); m_pAnimationsPulldown->SetDimensions(150, 70, 140, 14); m_pAnimationsPulldown->SetMaxNumItemsDisplayed(5); m_pAnimationsPulldown->SetDepth(2.0f); m_pAnimationsPulldown->SetRenderHeader(true); m_pAnimationsPulldown->SetMenuItemChangedCallBackFunction(_AnimationPullDownChanged); m_pAnimationsPulldown->SetMenuItemChangedCallBackData(this); m_pWeaponsPulldown = new PulldownMenu(m_pRenderer, m_defaultFont, "Weapons"); m_pWeaponsPulldown->SetDimensions(150, 93, 140, 14); m_pWeaponsPulldown->SetMaxNumItemsDisplayed(5); m_pWeaponsPulldown->SetDepth(3.0f); m_pWeaponsPulldown->SetRenderHeader(true); m_pWeaponsPulldown->SetMenuItemChangedCallBackFunction(_WeaponPullDownChanged); m_pWeaponsPulldown->SetMenuItemChangedCallBackData(this); m_pWeaponsPulldown->AddPulldownItem("None"); m_pWeaponsPulldown->AddPulldownItem("Sword"); m_pWeaponsPulldown->AddPulldownItem("Sword & Shield"); m_pWeaponsPulldown->AddPulldownItem("2 Handed Sword"); m_pWeaponsPulldown->AddPulldownItem("Hammer"); m_pWeaponsPulldown->AddPulldownItem("Bow"); m_pWeaponsPulldown->AddPulldownItem("Staff"); m_pWeaponsPulldown->AddPulldownItem("DruidStaff"); m_pWeaponsPulldown->AddPulldownItem("PriestStaff"); m_pWeaponsPulldown->AddPulldownItem("NecroStaff"); m_pWeaponsPulldown->AddPulldownItem("Torch"); m_pWeaponsPulldown->AddPulldownItem("Magic"); m_pCharacterPulldown = new PulldownMenu(m_pRenderer, m_defaultFont, "Character"); m_pCharacterPulldown->SetDimensions(150, 115, 140, 14); m_pCharacterPulldown->SetMaxNumItemsDisplayed(5); m_pCharacterPulldown->SetDepth(4.0f); m_pCharacterPulldown->SetRenderHeader(true); m_pCharacterPulldown->SetMenuItemChangedCallBackFunction(_CharacterPullDownChanged); m_pCharacterPulldown->SetMenuItemChangedCallBackData(this); m_pMainWindow->AddComponent(m_pShadowsCheckBox); m_pMainWindow->AddComponent(m_pSSAOCheckBox); m_pMainWindow->AddComponent(m_pBlurCheckBox); m_pMainWindow->AddComponent(m_pDynamicLightingCheckBox); m_pMainWindow->AddComponent(m_pWireframeCheckBox); m_pMainWindow->AddComponent(m_pMSAACheckBox); m_pMainWindow->AddComponent(m_pDeferredCheckBox); m_pMainWindow->AddComponent(m_pUpdateCheckBox); m_pMainWindow->AddComponent(m_pDebugRenderCheckBox); m_pMainWindow->AddComponent(m_pInstanceRenderCheckBox); m_pMainWindow->AddComponent(m_pPlayAnimationButton); m_pMainWindow->AddComponent(m_pAnimationsPulldown); m_pMainWindow->AddComponent(m_pWeaponsPulldown); m_pMainWindow->AddComponent(m_pCharacterPulldown); m_pGameWindow = new GUIWindow(m_pRenderer, m_defaultFont, "Game"); m_pGameWindow->AllowMoving(true); m_pGameWindow->AllowClosing(false); m_pGameWindow->AllowMinimizing(true); m_pGameWindow->AllowScrolling(true); m_pGameWindow->SetRenderTitleBar(true); m_pGameWindow->SetRenderWindowBackground(true); m_pGameWindow->SetOutlineRender(true); m_pGameWindow->SetDimensions(350, 35, 270, 140); m_pGameWindow->SetApplicationDimensions(m_windowWidth, m_windowHeight); m_pGameOptionBox = new OptionBox(m_pRenderer, m_defaultFont, "Game"); m_pGameOptionBox->SetDimensions(10, 50, 14, 14); m_pGameOptionBox->SetCallBackFunction(_GameModeChanged); m_pGameOptionBox->SetCallBackData(this); m_pFrontEndOptionBox = new OptionBox(m_pRenderer, m_defaultFont, "Frontend"); m_pFrontEndOptionBox->SetDimensions(10, 30, 14, 14); m_pFrontEndOptionBox->SetCallBackFunction(_GameModeChanged); m_pFrontEndOptionBox->SetCallBackData(this); m_pDebugOptionBox = new OptionBox(m_pRenderer, m_defaultFont, "Debug"); m_pDebugOptionBox->SetDimensions(10, 10, 14, 14); m_pDebugOptionBox->SetCallBackFunction(_GameModeChanged); m_pDebugOptionBox->SetCallBackData(this); m_pGameModeOptionController = new OptionController(m_pRenderer, m_defaultFont, "Mode"); m_pGameModeOptionController->SetDisplayLabel(true); m_pGameModeOptionController->SetDisplayBorder(true); m_pGameModeOptionController->SetDimensions(10, 55, 85, 70); m_pGameModeOptionController->Add(m_pGameOptionBox); m_pGameModeOptionController->Add(m_pDebugOptionBox); m_pGameModeOptionController->Add(m_pFrontEndOptionBox); m_pDebugOptionBox->SetToggled(true); m_pFaceMergingCheckbox = new CheckBox(m_pRenderer, m_defaultFont, "Face Merging"); m_pFaceMergingCheckbox->SetDimensions(10, 10, 14, 14); m_pFaceMergingCheckbox->SetCallBackFunction(_FaceMergeCheckboxChanged); m_pFaceMergingCheckbox->SetCallBackData(this); m_pStepUpdateCheckbox = new CheckBox(m_pRenderer, m_defaultFont, "Step Update"); m_pStepUpdateCheckbox->SetDimensions(110, 10, 14, 14); m_pStepUpdateButton = new Button(m_pRenderer, m_defaultFont, "Step"); m_pStepUpdateButton->SetDimensions(200, 5, 65, 25); m_pStepUpdateButton->SetCallBackFunction(_StepUpdatePressed); m_pStepUpdateButton->SetCallBackData(this); m_pDebugCameraOptionBox = new OptionBox(m_pRenderer, m_defaultFont, "Debug"); m_pDebugCameraOptionBox->SetDimensions(10, 70, 14, 14); m_pDebugCameraOptionBox->SetCallBackFunction(_CameraModeChanged); m_pDebugCameraOptionBox->SetCallBackData(this); m_pMouseRotateCameraOptionBox = new OptionBox(m_pRenderer, m_defaultFont, "Player Rotate"); m_pMouseRotateCameraOptionBox->SetDimensions(10, 50, 14, 14); m_pMouseRotateCameraOptionBox->SetCallBackFunction(_CameraModeChanged); m_pMouseRotateCameraOptionBox->SetCallBackData(this); m_pAutoCameraOptionBox = new OptionBox(m_pRenderer, m_defaultFont, "Auto"); m_pAutoCameraOptionBox->SetDimensions(10, 30, 14, 14); m_pAutoCameraOptionBox->SetCallBackFunction(_CameraModeChanged); m_pAutoCameraOptionBox->SetCallBackData(this); m_pFrontendCameraOptionBox = new OptionBox(m_pRenderer, m_defaultFont, "Frontend"); m_pFrontendCameraOptionBox->SetDimensions(10, 10, 14, 14); m_pFrontendCameraOptionBox->SetCallBackFunction(_CameraModeChanged); m_pFrontendCameraOptionBox->SetCallBackData(this); m_pCameraModeOptionController = new OptionController(m_pRenderer, m_defaultFont, "Camera"); m_pCameraModeOptionController->SetDisplayLabel(true); m_pCameraModeOptionController->SetDisplayBorder(true); m_pCameraModeOptionController->SetDimensions(160, 35, 105, 90); m_pCameraModeOptionController->Add(m_pDebugCameraOptionBox); m_pCameraModeOptionController->Add(m_pMouseRotateCameraOptionBox); m_pCameraModeOptionController->Add(m_pAutoCameraOptionBox); m_pCameraModeOptionController->Add(m_pFrontendCameraOptionBox); m_pDebugCameraOptionBox->SetToggled(true); m_pMouseRotateCameraOptionBox->SetDisabled(true); m_pAutoCameraOptionBox->SetDisabled(true); m_pFrontendCameraOptionBox->SetDisabled(true); m_pGameWindow->AddComponent(m_pGameModeOptionController); m_pGameWindow->AddComponent(m_pCameraModeOptionController); m_pGameWindow->AddComponent(m_pFaceMergingCheckbox); m_pGameWindow->AddComponent(m_pStepUpdateCheckbox); m_pGameWindow->AddComponent(m_pStepUpdateButton); // Console window m_pConsoleWindow = new GUIWindow(m_pRenderer, m_defaultFont, "Console"); m_pConsoleWindow->AllowMoving(true); m_pConsoleWindow->AllowClosing(false); m_pConsoleWindow->AllowMinimizing(true); m_pConsoleWindow->AllowScrolling(true); m_pConsoleWindow->SetRenderTitleBar(true); m_pConsoleWindow->SetRenderWindowBackground(true); m_pConsoleWindow->SetOutlineRender(true); m_pConsoleWindow->SetDimensions(635, 35, 500, 140); m_pConsoleWindow->SetApplicationDimensions(m_windowWidth, m_windowHeight); m_pConsoleTextbox = new TextBox(m_pRenderer, m_defaultFont, "", ""); m_pConsoleTextbox->SetDimensions(1, 1, 498, 16); m_pConsoleTextbox->SetDontLoseFocus(false); m_pConsoleTextbox->SetCallBackFunction_OnReturnPressed(_ConsoleReturnPressed); m_pConsoleTextbox->SetCallBackData_OnReturnPressed(this); m_pConsoleTextbox->SetPipeColour(Colour(0.0f, 0.0f, 0.0f)); m_pConsoleTextbox->SetDontLoseFocus(true); m_pConsoleScrollbar = new ScrollBar(m_pRenderer); m_pConsoleScrollbar->SetScrollDirection(EScrollBarDirection_Vertical); m_pConsoleScrollbar->SetScrollSize(1.0f); m_pConsoleScrollbar->SetScrollPosition(1.0f); m_pConsoleScrollbar->SetScissorEnabled(true); m_pConsoleScrollbar->SetScrollArea(-484, 0, 490, 122); m_pConsoleScrollbar->SetDepth(2.0f); m_pConsoleScrollbar->SetDimensions(486, 18, 14, 122); m_pConsoleScrollbar->SetScissorEnabled(true); m_pConsoleWindow->AddComponent(m_pConsoleTextbox); m_pConsoleWindow->AddComponent(m_pConsoleScrollbar); m_pGUI->AddWindow(m_pMainWindow); m_pGUI->AddWindow(m_pGameWindow); m_pGUI->AddWindow(m_pConsoleWindow); UpdateCharactersPulldown(); UpdateWeaponsPulldown(); UpdateAnimationsPulldown(); m_pCharacterPulldown->SetSelectedItem("Steve"); m_pWeaponsPulldown->SetSelectedItem("None"); m_pAnimationsPulldown->SetSelectedItem("BindPose"); m_GUICreated = true; }
//============================================================================== Ambix_converterAudioProcessorEditor::Ambix_converterAudioProcessorEditor (Ambix_converterAudioProcessor* ownerFilter) : AudioProcessorEditor (ownerFilter), hyperlinkButton (nullptr), box_in_ch_seq (nullptr), label (nullptr), label2 (nullptr), label3 (nullptr), box_out_ch_seq (nullptr), label4 (nullptr), box_in_norm (nullptr), box_out_norm (nullptr), tgl_invert_cs (nullptr), box_presets (nullptr), label5 (nullptr), tgl_flip (nullptr), tgl_flop (nullptr), tgl_flap (nullptr), label6 (nullptr) { tooltipWindow.setMillisecondsBeforeTipAppears (700); // tooltip delay addAndMakeVisible (hyperlinkButton = new HyperlinkButton ("(C) 2013 Matthias Kronlachner", URL ("http://www.matthiaskronlachner.com"))); hyperlinkButton->setTooltip ("http://www.matthiaskronlachner.com"); hyperlinkButton->setButtonText ("(C) 2013 Matthias Kronlachner"); hyperlinkButton->setColour (HyperlinkButton::textColourId, Colours::azure); addAndMakeVisible (box_in_ch_seq = new ComboBox ("new combo box")); box_in_ch_seq->setTooltip ("channel input sequence"); box_in_ch_seq->setEditableText (false); box_in_ch_seq->setJustificationType (Justification::centredLeft); box_in_ch_seq->setTextWhenNothingSelected ("ACN"); box_in_ch_seq->setTextWhenNoChoicesAvailable ("(no choices)"); box_in_ch_seq->addItem ("ACN", 1); box_in_ch_seq->addItem ("Furse-Malham", 2); box_in_ch_seq->addItem ("SID", 3); box_in_ch_seq->addListener (this); addAndMakeVisible (label = new Label ("new label", "Channel sequence")); label->setFont (Font (15.0000f, Font::plain)); label->setJustificationType (Justification::centredRight); label->setEditable (false, false, false); label->setColour (Label::textColourId, Colours::azure); label->setColour (TextEditor::textColourId, Colours::black); label->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (label2 = new Label ("new label", "Input")); label2->setFont (Font (15.0000f, Font::bold)); label2->setJustificationType (Justification::centred); label2->setEditable (false, false, false); label2->setColour (Label::textColourId, Colours::black); label2->setColour (TextEditor::textColourId, Colours::black); label2->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (label3 = new Label ("new label", "Normalization")); label3->setFont (Font (15.0000f, Font::plain)); label3->setJustificationType (Justification::centredRight); label3->setEditable (false, false, false); label3->setColour (Label::textColourId, Colours::azure); label3->setColour (TextEditor::textColourId, Colours::black); label3->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (box_out_ch_seq = new ComboBox ("new combo box")); box_out_ch_seq->setTooltip ("channel output sequence"); box_out_ch_seq->setEditableText (false); box_out_ch_seq->setJustificationType (Justification::centredLeft); box_out_ch_seq->setTextWhenNothingSelected ("ACN"); box_out_ch_seq->setTextWhenNoChoicesAvailable ("(no choices)"); box_out_ch_seq->addItem ("ACN", 1); box_out_ch_seq->addItem ("Furse-Malham", 2); box_out_ch_seq->addItem ("SID", 3); box_out_ch_seq->addListener (this); addAndMakeVisible (label4 = new Label ("new label", "Output")); label4->setFont (Font (15.0000f, Font::bold)); label4->setJustificationType (Justification::centred); label4->setEditable (false, false, false); label4->setColour (Label::textColourId, Colours::black); label4->setColour (TextEditor::textColourId, Colours::black); label4->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (box_in_norm = new ComboBox ("new combo box")); box_in_norm->setTooltip ("channel input normalization scheme"); box_in_norm->setEditableText (false); box_in_norm->setJustificationType (Justification::centredLeft); box_in_norm->setTextWhenNothingSelected ("SN3D"); box_in_norm->setTextWhenNoChoicesAvailable ("(no choices)"); box_in_norm->addItem ("SN3D", 1); box_in_norm->addItem ("Furse-Malham", 2); box_in_norm->addItem ("N3D", 3); box_in_norm->addListener (this); addAndMakeVisible (box_out_norm = new ComboBox ("new combo box")); box_out_norm->setTooltip ("channel output normalization scheme"); box_out_norm->setEditableText (false); box_out_norm->setJustificationType (Justification::centredLeft); box_out_norm->setTextWhenNothingSelected ("SN3D"); box_out_norm->setTextWhenNoChoicesAvailable ("(no choices)"); box_out_norm->addItem ("SN3D", 1); box_out_norm->addItem ("Furse-Malham", 2); box_out_norm->addItem ("N3D", 3); box_out_norm->addListener (this); addAndMakeVisible (tgl_invert_cs = new ToggleButton ("new toggle button")); tgl_invert_cs->setTooltip ("only activate this if you know what you are doing!"); tgl_invert_cs->setButtonText ("Invert Condon-Shortley"); tgl_invert_cs->addListener (this); tgl_invert_cs->setColour (ToggleButton::textColourId, Colours::azure); addAndMakeVisible (tgl_flip = new ToggleButton ("new toggle button")); tgl_flip->setTooltip ("Mirror left-right (flip)"); tgl_flip->setButtonText ("left <> right"); tgl_flip->addListener (this); tgl_flip->setColour (ToggleButton::textColourId, Colours::azure); addAndMakeVisible (tgl_flop = new ToggleButton ("new toggle button")); tgl_flop->setTooltip ("Mirror front-back (flop)"); tgl_flop->setButtonText ("front <> back"); tgl_flop->addListener (this); tgl_flop->setColour (ToggleButton::textColourId, Colours::azure); addAndMakeVisible (tgl_flap = new ToggleButton ("new toggle button")); tgl_flap->setTooltip ("Mirror top-bottom (flap)"); tgl_flap->setButtonText ("top <> bottom"); tgl_flap->addListener (this); tgl_flap->setColour (ToggleButton::textColourId, Colours::azure); addAndMakeVisible (label6 = new Label ("new label", "Mirror")); label6->setFont (Font (15.0000f, Font::bold)); label6->setJustificationType (Justification::centredLeft); label6->setEditable (false, false, false); label6->setColour (Label::textColourId, Colours::azure); label6->setColour (TextEditor::textColourId, Colours::black); label6->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (box_presets = new ComboBox ("new combo box")); box_presets->setTooltip ("choose conversion scheme from several presets"); box_presets->setEditableText (false); box_presets->setJustificationType (Justification::centredLeft); box_presets->setTextWhenNothingSelected (""); box_presets->setTextWhenNoChoicesAvailable ("(no presets)"); box_presets->addItem (".amb / AMB plugins (full periphonic) / Tetraproc -> ambix", 1); box_presets->addItem ("ambix -> .amb / AMB plugins (full periphonic) / Tetraproc", 2); box_presets->addSeparator(); box_presets->addItem ("Universal Ambisonics (UA) -> ambix", 3); box_presets->addItem ("ambix -> Universal Ambisonics (UA)", 4); box_presets->addSeparator(); box_presets->addItem ("Wigware / B2X (3D) -> ambix", 5); box_presets->addItem ("ambix -> Wigware / B2X (3D)", 6); box_presets->addSeparator(); box_presets->addItem ("iem_ambi -> ambix", 7); box_presets->addItem ("ambix -> iem_ambi", 8); box_presets->addSeparator(); box_presets->addItem ("ICST (may vary) -> ambix", 9); box_presets->addItem ("ambix -> ICST (may vary)", 10); box_presets->addSeparator(); box_presets->addItem ("mtx_spherical_harmonics -> ambix", 11); box_presets->addItem ("ambix -> mtx_spherical_harmonics", 12); box_presets->addSeparator(); box_presets->addItem ("flat - no change", 13); box_presets->addListener (this); box_presets->setText(ownerFilter->box_presets_text, dontSendNotification); addAndMakeVisible (label5 = new Label ("new label", "Presets")); label5->setFont (Font (15.0000f, Font::plain)); label5->setJustificationType (Justification::centredRight); label5->setEditable (false, false, false); label5->setColour (Label::textColourId, Colours::azure); label5->setColour (TextEditor::textColourId, Colours::black); label5->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (tgl_in_2d = new ToggleButton ("new toggle button")); tgl_in_2d->setButtonText (TRANS("2D")); tgl_in_2d->setTooltip ("input is 2D Ambisonics"); tgl_in_2d->addListener (this); addAndMakeVisible (tgl_out_2d = new ToggleButton ("new toggle button")); tgl_out_2d->setButtonText (TRANS("2D")); tgl_out_2d->setTooltip ("output is 2D Ambisonics (this could throw away channels!)"); tgl_out_2d->addListener (this); //[UserPreSize] //[/UserPreSize] setSize (410, 305); //[Constructor] You can add your own custom stuff here.. //startTimer (500); // timer is deprecated - use changelistener! //[/Constructor] ownerFilter->addChangeListener(this); getParamsFromHost(); }
inline Colour operator +(const Colour& a, const Colour& b) { return Colour(a.R()+b.R(), a.G()+b.G(), a.B()+b.B()); }
Plotter::Plotter( DataLog* log, float left, float right, float bottom, float top, float tickx, float ticky, Plotter* linked_plotter_x, Plotter* linked_plotter_y ) : default_log(log), colour_wheel(0.6f), rview_default(left,right,bottom,top), rview(rview_default), target(rview), selection(0,0,0,0), track(false), track_x("$i"), track_y(""), trigger_edge(0), trigger("$0"), linked_plotter_x(linked_plotter_x), linked_plotter_y(linked_plotter_y) { if(!log) { throw std::runtime_error("DataLog not specified"); } // Prevent links to ourselves - this could cause infinite recursion. if(linked_plotter_x == this) this->linked_plotter_x = 0; if(linked_plotter_y == this) this->linked_plotter_y = 0; // Handle our own mouse / keyboard events this->handler = this; hover[0] = 0; hover[1] = 0; // Default colour scheme colour_bg = Colour(0.0f, 0.0f, 0.0f); colour_tk = Colour(0.2f, 0.2f, 0.2f); colour_ax = Colour(0.5f, 0.5f, 0.5f); SetTicks(tickx, ticky); // Create shader for drawing simple primitives prog_lines.AddShader( GlSlVertexShader, "attribute vec2 a_position;\n" "uniform vec4 u_color;\n" "uniform vec2 u_scale;\n" "uniform vec2 u_offset;\n" "varying vec4 v_color;\n" "void main() {\n" " gl_Position = vec4(u_scale * (a_position + u_offset),0,1);\n" " v_color = u_color;\n" "}\n" ); prog_lines.AddShader( GlSlFragmentShader, #ifdef HAVE_GLES_2 "precision mediump float;\n" #endif // HAVE_GLES_2 "varying vec4 v_color;\n" "void main() {\n" " gl_FragColor = v_color;\n" "}\n" ); prog_lines.BindPangolinDefaultAttribLocationsAndLink(); prog_text.AddShader( GlSlVertexShader, "attribute vec2 a_position;\n" "attribute vec2 a_texcoord;\n" "uniform vec4 u_color;\n" "uniform vec2 u_scale;\n" "uniform vec2 u_offset;\n" "varying vec4 v_color;\n" "varying vec2 v_texcoord;\n" "void main() {\n" " gl_Position = vec4(u_scale * (a_position + u_offset),0,1);\n" " v_color = u_color;\n" " v_texcoord = a_texcoord;\n" "}\n" ); prog_text.AddShader( GlSlFragmentShader, #ifdef HAVE_GLES_2 "precision mediump float;\n" #endif // HAVE_GLES_2 "varying vec4 v_color;\n" "varying vec2 v_texcoord;\n" "uniform sampler2D u_texture;\n" "void main() {\n" " gl_FragColor = v_color;\n" " gl_FragColor.a *= texture2D(u_texture, v_texcoord).a;\n" "}\n" ); prog_text.BindPangolinDefaultAttribLocationsAndLink(); const size_t RESERVED_SIZE = 100; // Setup default PlotSeries plotseries.reserve(RESERVED_SIZE); for(unsigned int i=0; i< 10; ++i) { std::ostringstream oss; oss << "$" << i; plotseries.push_back( PlotSeries() ); plotseries.back().CreatePlot( "$i", oss.str(), colour_wheel.GetUniqueColour(), i < log->Labels().size() ? log->Labels()[i] : oss.str() ); } // Setup test PlotMarkers plotmarkers.reserve(RESERVED_SIZE); // plotmarkers.push_back( Marker( Marker::Vertical, 10, Marker::GreaterThan, Colour(1,0,0,0.2)) ); // plotmarkers.push_back( Marker( Marker::Horizontal, 1, Marker::LessThan, Colour(0,1,0,0.2)) ); // Setup test implicit plots. plotimplicits.reserve(RESERVED_SIZE); // plotimplicits.push_back( PlotImplicit() ); // plotimplicits.back().CreateInequality("x+y <= 150.0", colour_wheel.GetUniqueColour().WithAlpha(0.2) ); // plotimplicits.push_back( PlotImplicit() ); // plotimplicits.back().CreateInequality("x+2.0*y <= 170.0", colour_wheel.GetUniqueColour().WithAlpha(0.2) ); // plotimplicits.push_back( PlotImplicit() ); // plotimplicits.back().CreateInequality("3.0*y <= 180.0", colour_wheel.GetUniqueColour().WithAlpha(0.2) ); // Setup texture spectogram style plots // ... }
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ const Colour LookAndFeel_E1::backgroundColor = Colour (LookAndFeel_E1::defaultBackgroundColor); const Colour LookAndFeel_E1::elementBlue = Colour (0xff4765a0); const Colour LookAndFeel_E1::textColor = Colour (LookAndFeel_E1::defaultTextColor); const Colour LookAndFeel_E1::textActiveColor = Colour (LookAndFeel_E1::defaultTextActiveColor); const Colour LookAndFeel_E1::textBoldColor = Colour (LookAndFeel_E1::defaultTextBoldColor); const Colour LookAndFeel_E1::highlightBackgroundColor = LookAndFeel_E1::textColor.darker(0.6000006).withAlpha(0.6f); LookAndFeel_E1::LookAndFeel_E1() { // PopupMenu Styling setColour (PopupMenu::backgroundColourId, backgroundColor.darker()); setColour (PopupMenu::textColourId, textColor.withAlpha(0.84f)); setColour (PopupMenu::headerTextColourId, textColor.brighter(0.2f).withAlpha(0.84f)); setColour (PopupMenu::highlightedBackgroundColourId, backgroundColor.darker()); setColour (PopupMenu::highlightedTextColourId, textActiveColor.darker());
void GUI::LeftPanel::paint (Graphics & g) { // backGround Filling g.fillAll (Colour (0xff292929)); }
//-------------------------------------------------------- // //-------------------------------------------------------- SyncBool TLFile::ImportBinaryData(const TString& DataString,TBinary& BinaryData,TRef DataType) { /* // work out the type of data TRefRef BinaryDataType = BinaryData.GetDataTypeHint(); // check for conflicting type hints if ( DataType.IsValid() && BinaryDataType.IsValid() && DataType != BinaryDataType ) { TDebugString Debug_String; Debug_String << "Data import type hint mismatch; Tried to import as " << DataType << " but binary says it's " << BinaryDataType; TLDebug_Break( Debug_String ); // fall through to use the data type embedded in the binary data DataType = BinaryDataType; } else if ( BinaryDataType.IsValid() && !DataType.IsValid() ) { // use the type specified in the binary DataType = BinaryDataType; } */ // import the data based on the type u32 CharIndex = 0; switch ( DataType.GetData() ) { case TLBinary_TypeRef(float): { float f; if ( !TLString::ReadNextFloatArray( DataString, CharIndex, &f, 1 ) ) return SyncFalse; BinaryData.Write( f ); return SyncTrue; } case TLBinary_TypeRef(float2): { float2 f; if ( !TLString::ReadNextFloatArray( DataString, CharIndex, f.GetData(), f.GetSize() ) ) return SyncFalse; BinaryData.Write( f ); return SyncTrue; } case TLBinary_TypeRef(float3): { float3 f; if ( !TLString::ReadNextFloatArray( DataString, CharIndex, f.GetData(), f.GetSize() ) ) return SyncFalse; BinaryData.Write( f ); return SyncTrue; } case TLBinary_TypeRef(float4): { float4 f; if ( !TLString::ReadNextFloatArray( DataString, CharIndex, f.GetData(), f.GetSize() ) ) return SyncFalse; BinaryData.Write( f ); return SyncTrue; } case TLBinary_TypeRef(TQuaternion): { float4 f; if ( !TLString::ReadNextFloatArray( DataString, CharIndex, f.GetData(), f.GetSize() ) ) return SyncFalse; // convert to normalised quaternion TLMaths::TQuaternion Quat( f ); Quat.Normalise(); BinaryData.Write( Quat ); return SyncTrue; } case TLBinary_TypeRef(TEuler): { float3 f; if ( !TLString::ReadNextFloatArray( DataString, CharIndex, f.GetData(), f.GetSize() ) ) return SyncFalse; // convert to Euler type TLMaths::TEuler Euler( f ); BinaryData.Write( Euler ); return SyncTrue; } case TLBinary_TypeRef(TAxisAngle): { float4 f; if ( !TLString::ReadNextFloatArray( DataString, CharIndex, f.GetData(), f.GetSize() ) ) return SyncFalse; // convert to normalised quaternion TLMaths::TAxisAngle AxisAngle( f ); BinaryData.Write( AxisAngle ); return SyncTrue; } case TLBinary_TypeRef(TRef): { TRef Ref( DataString ); BinaryData.Write( Ref ); return SyncTrue; } case TLBinary_TypeRef_String: { // do string cleanup, convert "\n" to a linefeed etc if ( TLString::IsStringDirty( DataString ) ) { TString OutputString = DataString; TLString::CleanString( OutputString ); BinaryData.WriteString( OutputString ); } else { // already clean, just write the original BinaryData.WriteString( DataString ); } return SyncTrue; } case TLBinary_TypeRef(TColour): { float4 f; if ( !TLString::ReadNextFloatArray( DataString, CharIndex, f.GetData(), f.GetSize() ) ) return SyncFalse; // check range // gr: use TLDebug_CheckInRange() ? if ( f.x > 1.0f || f.x < 0.0f || f.y > 1.0f || f.y < 0.0f || f.z > 1.0f || f.z < 0.0f || f.w > 1.0f || f.w < 0.0f ) { if ( !TLDebug_Break( TString("Colour float type has components out of range (0..1); %.3f,%.3f,%.3f,%.3f", f.x, f.y, f.z, f.w) ) ) return SyncFalse; } TColour Colour( f ); BinaryData.Write( Colour ); return SyncTrue; } case TLBinary_TypeRef(TColour24): { Type3<s32> Colours; if ( !TLString::ReadNextInteger( DataString, CharIndex, Colours.x ) ) return SyncFalse; if ( !TLString::ReadNextInteger( DataString, CharIndex, Colours.y ) ) return SyncFalse; if ( !TLString::ReadNextInteger( DataString, CharIndex, Colours.z ) ) return SyncFalse; // check range // gr: use TLDebug_CheckInRange() ? if ( Colours.x > 255 || Colours.x < 0 || Colours.y > 255 || Colours.y < 0 || Colours.z > 255 || Colours.z < 0 ) { if ( !TLDebug_Break( TString("Colour24 type has components out of range (0..255); %d,%d,%d", Colours.x, Colours.y, Colours.z ) ) ) return SyncFalse; } TColour24 Colour( Colours.x, Colours.y, Colours.z ); BinaryData.Write( Colour ); return SyncTrue; } case TLBinary_TypeRef(TColour32): { Type4<s32> Colours; if ( !TLString::ReadNextInteger( DataString, CharIndex, Colours.x ) ) return SyncFalse; if ( !TLString::ReadNextInteger( DataString, CharIndex, Colours.y ) ) return SyncFalse; if ( !TLString::ReadNextInteger( DataString, CharIndex, Colours.z ) ) return SyncFalse; if ( !TLString::ReadNextInteger( DataString, CharIndex, Colours.w ) ) return SyncFalse; // check range // gr: use TLDebug_CheckInRange() ? if ( Colours.x > 255 || Colours.x < 0 || Colours.y > 255 || Colours.y < 0 || Colours.z > 255 || Colours.z < 0 || Colours.w > 255 || Colours.w < 0 ) { if ( !TLDebug_Break( TString("Colour32 type has components out of range (0..255); %d,%d,%d,%d", Colours.x, Colours.y, Colours.z, Colours.w ) ) ) return SyncFalse; } TColour32 Colour( Colours.x, Colours.y, Colours.z, Colours.w ); BinaryData.Write( Colour ); return SyncTrue; } case TLBinary_TypeRef(TColour64): { Type4<s32> Colours; if ( !TLString::ReadNextInteger( DataString, CharIndex, Colours.x ) ) return SyncFalse; if ( !TLString::ReadNextInteger( DataString, CharIndex, Colours.y ) ) return SyncFalse; if ( !TLString::ReadNextInteger( DataString, CharIndex, Colours.z ) ) return SyncFalse; if ( !TLString::ReadNextInteger( DataString, CharIndex, Colours.w ) ) return SyncFalse; // check range // gr: use TLDebug_CheckInRange() ? if ( Colours.x > 65535 || Colours.x < 0 || Colours.y > 65535 || Colours.y < 0 || Colours.z > 65535 || Colours.z < 0 || Colours.w > 65535 || Colours.w < 0 ) { if ( !TLDebug_Break( TString("Colour64 type has components out of range (0..65535); %d,%d,%d,%d", Colours.x, Colours.y, Colours.z, Colours.w ) ) ) return SyncFalse; } TColour64 Colour( Colours.x, Colours.y, Colours.z, Colours.w ); BinaryData.Write( Colour ); return SyncTrue; } case TLBinary_TypeRef(u8): return ImportBinaryDataIntegerInRange<u8>( BinaryData, DataString ); case TLBinary_TypeRef(s8): return ImportBinaryDataIntegerInRange<s8>( BinaryData, DataString ); case TLBinary_TypeRef(u16): return ImportBinaryDataIntegerInRange<u16>( BinaryData, DataString ); case TLBinary_TypeRef(s16): return ImportBinaryDataIntegerInRange<s16>( BinaryData, DataString ); case TLBinary_TypeRef(u32): return ImportBinaryDataIntegerInRange<u32>( BinaryData, DataString ); case TLBinary_TypeRef(s32): return ImportBinaryDataIntegerInRange<s32>( BinaryData, DataString ); case TLBinary_TypeRef(Bool): { // read first char, we can work out true/false/0/1 from that if ( DataString.GetLength() == 0 ) return SyncFalse; const TChar& BoolChar = DataString.GetCharAt(0); if ( BoolChar == 't' || BoolChar == 'T' || BoolChar == '1' ) { BinaryData.Write( (Bool)TRUE ); return SyncTrue; } else if ( BoolChar == 'f' || BoolChar == 'F' || BoolChar == '0' ) { BinaryData.Write( (Bool)FALSE ); return SyncTrue; } else { TLDebug_Break("Bool data is not True,False,0 or 1"); return SyncFalse; } } default: break; }; TDebugString Debug_String; Debug_String << "Unsupported/todo data type " << DataType << ". Data string: [" << DataString << "]"; TLDebug_Break( Debug_String ); return SyncFalse; }
ControlPanel::ControlPanel(ProcessorGraph* graph_, AudioComponent* audio_) : graph(graph_), audio(audio_), initialize(true), open(false), lastEngineIndex(-1) { if (1) { font = Font("Paragraph", 13, Font::plain); // MemoryInputStream mis(BinaryData::misoserialized, BinaryData::misoserializedSize, false); // Typeface::Ptr typeface = new CustomTypeface(mis); // font = Font(typeface); // font.setHeight(15); } audioEditor = (AudioEditor*) graph->getAudioNode()->createEditor(); addAndMakeVisible(audioEditor); playButton = new PlayButton(); playButton->addListener(this); addAndMakeVisible(playButton); recordButton = new RecordButton(); recordButton->addListener(this); addAndMakeVisible(recordButton); masterClock = new Clock(); addAndMakeVisible(masterClock); cpuMeter = new CPUMeter(); addAndMakeVisible(cpuMeter); diskMeter = new DiskSpaceMeter(); addAndMakeVisible(diskMeter); cpb = new ControlPanelButton(this); addAndMakeVisible(cpb); recordSelector = new ComboBox(); recordSelector->addListener(this); for (int i =0; i < RecordEngineManager::getNumOfBuiltInEngines(); i++) { RecordEngineManager* rem = RecordEngineManager::createBuiltInEngineManager(i); recordSelector->addItem(rem->getName(),i+1); recordEngines.add(rem); } addChildComponent(recordSelector); recordOptionsButton = new UtilityButton("R",Font("Small Text", 15, Font::plain)); recordOptionsButton->setEnabledState(true); recordOptionsButton->addListener(this); recordOptionsButton->setTooltip("Configure options for selected record engine"); addChildComponent(recordOptionsButton); newDirectoryButton = new UtilityButton("+", Font("Small Text", 15, Font::plain)); newDirectoryButton->setEnabledState(false); newDirectoryButton->addListener(this); newDirectoryButton->setTooltip("Start a new data directory"); addChildComponent(newDirectoryButton); File executable = File::getSpecialLocation(File::currentExecutableFile); #if defined(__APPLE__) const String executableDirectory = executable.getParentDirectory().getParentDirectory().getParentDirectory().getParentDirectory().getFullPathName(); #else const String executableDirectory = executable.getParentDirectory().getFullPathName(); #endif filenameComponent = new FilenameComponent("folder selector", executableDirectory, true, true, true, "*", "", ""); addChildComponent(filenameComponent); prependText = new Label("Prepend",""); prependText->setEditable(true); prependText->addListener(this); prependText->setColour(Label::backgroundColourId, Colours::lightgrey); prependText->setTooltip("Prepend to name of data directory"); addChildComponent(prependText); dateText = new Label("Date","YYYY-MM-DD_HH-MM-SS"); dateText->setColour(Label::backgroundColourId, Colours::lightgrey); dateText->setColour(Label::textColourId, Colours::grey); addChildComponent(dateText); appendText = new Label("Append",""); appendText->setEditable(true); appendText->addListener(this); appendText->setColour(Label::backgroundColourId, Colours::lightgrey); addChildComponent(appendText); appendText->setTooltip("Append to name of data directory"); //diskMeter->updateDiskSpace(graph->getRecordNode()->getFreeSpace()); //diskMeter->repaint(); //refreshMeters(); startTimer(10); setWantsKeyboardFocus(true); backgroundColour = Colour(58,58,58); }
int vcolour(Vec3 c) { // converts a 4 vector to a colour. return Colour((int)(c[0]), (int)(c[1]), (int)(c[2])); }
void MainContentComponent::paint (Graphics& g) { g.fillAll (Colour (0xffeeddff)); }
CodeEditorComponent::ColourScheme LuaTokeniser::getDefaultColourScheme() { static const CodeEditorComponent::ColourScheme::TokenType types[] = { { "Error", Colour (0xffcc0000) }, { "Comment", Colour (0xff3c3c3c) }, { "Keyword", Colour (0xff0000cc) }, { "Operator", Colour (0xff225500) }, { "Identifier", Colour (0xff000000) }, { "Integer", Colour (0xff880000) }, { "Float", Colour (0xff885500) }, { "String", Colour (0xff990099) }, { "Bracket", Colour (0xff000055) }, { "Punctuation", Colour (0xff004400) } }; CodeEditorComponent::ColourScheme cs; for (auto& t : types) cs.set (t.name, Colour (t.colour)); return cs; }
//============================================================================== ChannelStripComponent::ChannelStripComponent(ApplicationCommandManager &commands, int trackID, const Audio::Engine &engine) : _commands(commands), _trackID(trackID), _engine(engine) { addAndMakeVisible(label = new Label(String::empty, String::empty)); label->setFont(Font(11.0f, Font::FontStyleFlags::plain)); label->setJustificationType(Justification::centred); label->setEditable(false, true); label->addListener(this); // some method should be used to return the name of a track auto trackLabel = "Track" + String(trackID); label->setText(trackLabel, NotificationType::sendNotification); addAndMakeVisible(volumeSlider = new Slider(trackLabel + " v")); volumeSlider->setSliderStyle(Slider::SliderStyle::LinearVertical); volumeSlider->setRange(0.0f, 1.0f); volumeSlider->setSkewFactor(0.5f); volumeSlider->setTextBoxStyle(Slider::NoTextBox, false, 80, 20); volumeSlider->setValue(0.7f); _engine.getMixer()->changeGain(ChannelStripNode::GAIN, static_cast<float>(volumeSlider->getValue())); volumeSlider->addListener(this); addAndMakeVisible(panPot = new Slider(trackLabel + " p")); panPot->setSliderStyle(Slider::SliderStyle::RotaryVerticalDrag); panPot->setRange(0.0f, 1.0f); panPot->setTextBoxStyle(Slider::NoTextBox, false, 80, 20); panPot->setColour(Slider::rotarySliderFillColourId, Colour(0x7fffff)); panPot->setColour(Slider::rotarySliderOutlineColourId, Colour(0x8cffff)); panPot->setValue(0.5f); _engine.getMixer()->changePan(ChannelStripNode::PAN, static_cast<float>(panPot->getValue())); panPot->addListener(this); addAndMakeVisible(muteButton = new ToggleButton("Mute")); muteButton->setColour(TextButton::buttonColourId, Colours::blue); setButtonState("Mute", false); muteButton->addListener(this); if (trackID != 0) { addAndMakeVisible(soloButton = new ToggleButton("Solo")); soloButton->setColour(TextButton::buttonColourId, Colours::yellow); setButtonState("Solo", false); soloButton->addListener(this); } addAndMakeVisible(_pluginsButton = new TextButton("Plugins")); _pluginsButton->addListener(this); addAndMakeVisible(plugins1 = new TextButton("Plugin 1")); plugins1->addListener(this); addAndMakeVisible(plugins2 = new TextButton("Plugin 2")); plugins2->addListener(this); plugins2->setEnabled(false); addAndMakeVisible(plugins3 = new TextButton("Plugin 3")); plugins3->addListener(this); plugins3->setEnabled(false); addAndMakeVisible(plugins4 = new TextButton("Plugin 4")); plugins4->addListener(this); plugins4->setEnabled(false); addAndMakeVisible(plugins5 = new TextButton("Plugin 1")); plugins5->addListener(this); addAndMakeVisible(plugins6 = new TextButton("Plugin 2")); plugins6->addListener(this); plugins6->setEnabled(false); addAndMakeVisible(plugins7 = new TextButton("Plugin 3")); plugins7->addListener(this); plugins7->setEnabled(false); addAndMakeVisible(plugins8 = new TextButton("Plugin 4")); plugins8->addListener(this); plugins8->setEnabled(false); }
// Stuff in here should be gotten rid of or parameterized, it's purely for testing purposes. void ParticleEmitter::Emit(const int& numParticles) { for (int i = 0; i < numParticles; ++i) { float randXVel = (float)((rand()%31) - 15); float randYVel = (float)((rand()%16) + 15); if (inactiveParticles.size() > 0) { activeParticles.push_back(inactiveParticles.back()); inactiveParticles.pop_back(); activeParticles.back()->ReInit(0.1f, Vector2f(), Vector2f(randXVel, randYVel)); } else { activeParticles.push_back(new Particle(.1f, Vector2f(), Vector2f(randXVel, randYVel), Colour(.01f,1.f,.01f,1.f), Colour(1.f,.01f,.01f,0.f))); } } }
void VoxGame::AddConsoleLabel(string message) { if (m_GUICreated == false) { m_vStringCache.push_back(message); return; } char lChatString[8192]; sprintf(lChatString, "%s", message.c_str()); string chatString = lChatString; int lCharIndex = 0; int lStartLineIndex = 0; int lPreviousSpaceIndex = 0; // Our position float lCurrentTextX = 0.0f; int newLineIndex = 1; int indexToUse = (int)m_vpConsoleLabels.size() + (int)m_vpConsoleLabels_Add.size(); while (lChatString[lCharIndex] != 0) { char lpChar = lChatString[lCharIndex]; char lpNextChar = lChatString[lCharIndex + 1]; // Check for spaces if (lpChar == ' ') { string lString(chatString.substr(lStartLineIndex, lCharIndex - lStartLineIndex)); int lTextLineWidth = m_pRenderer->GetFreeTypeTextWidth(m_defaultFont, "%s", lString.c_str()); // If the current X position, plus our new text length is greater than the width, then we know we will go out of bounds if (lCurrentTextX + lTextLineWidth > m_pConsoleScrollbar->GetScrollArea().m_width) { string lString(chatString.substr(lStartLineIndex, lPreviousSpaceIndex - lStartLineIndex)); Label* pNewLabel = new Label(m_pRenderer, m_defaultFont, lString.c_str(), Colour(1.0f, 1.0f, 1.0f)); int xPos = m_pConsoleScrollbar->GetScrollArea().m_x; int yPos = m_pConsoleScrollbar->GetScrollArea().m_y + m_pConsoleScrollbar->GetScrollArea().m_height - (indexToUse + newLineIndex) * 14; pNewLabel->SetLocation(xPos, yPos); m_vpConsoleLabels_Add.push_back(pNewLabel); // Skip over the new line, else we will detect it on the next loop lStartLineIndex = lPreviousSpaceIndex + 1; newLineIndex++; } lPreviousSpaceIndex = lCharIndex; } // Check for the end of the string if (lpNextChar == 0) { string lString(chatString.substr(lStartLineIndex, lCharIndex + 1 - lStartLineIndex)); int lTextLineWidth = m_pRenderer->GetFreeTypeTextWidth(m_defaultFont, "%s", lString.c_str()); Label* pNewLabel = new Label(m_pRenderer, m_defaultFont, lString.c_str(), Colour(1.0f, 1.0f, 1.0f)); int xPos = m_pConsoleScrollbar->GetScrollArea().m_x; int yPos = m_pConsoleScrollbar->GetScrollArea().m_y + m_pConsoleScrollbar->GetScrollArea().m_height - (indexToUse + newLineIndex) * 14; pNewLabel->SetLocation(xPos, yPos); m_vpConsoleLabels_Add.push_back(pNewLabel); } lCharIndex++; } }
//============================================================================== const Colour Colours::findColourForName (const String& colourName, const Colour& defaultColour) { static const int presets[] = { // (first value is the string's hashcode, second is ARGB) 0x05978fff, 0xff000000, /* black */ 0x06bdcc29, 0xffffffff, /* white */ 0x002e305a, 0xff0000ff, /* blue */ 0x00308adf, 0xff808080, /* grey */ 0x05e0cf03, 0xff008000, /* green */ 0x0001b891, 0xffff0000, /* red */ 0xd43c6474, 0xffffff00, /* yellow */ 0x620886da, 0xfff0f8ff, /* aliceblue */ 0x20a2676a, 0xfffaebd7, /* antiquewhite */ 0x002dcebc, 0xff00ffff, /* aqua */ 0x46bb5f7e, 0xff7fffd4, /* aquamarine */ 0x0590228f, 0xfff0ffff, /* azure */ 0x05947fe4, 0xfff5f5dc, /* beige */ 0xad388e35, 0xffffe4c4, /* bisque */ 0x00674f7e, 0xffffebcd, /* blanchedalmond */ 0x39129959, 0xff8a2be2, /* blueviolet */ 0x059a8136, 0xffa52a2a, /* brown */ 0x89cea8f9, 0xffdeb887, /* burlywood */ 0x0fa260cf, 0xff5f9ea0, /* cadetblue */ 0x6b748956, 0xff7fff00, /* chartreuse */ 0x2903623c, 0xffd2691e, /* chocolate */ 0x05a74431, 0xffff7f50, /* coral */ 0x618d42dd, 0xff6495ed, /* cornflowerblue */ 0xe4b479fd, 0xfffff8dc, /* cornsilk */ 0x3d8c4edf, 0xffdc143c, /* crimson */ 0x002ed323, 0xff00ffff, /* cyan */ 0x67cc74d0, 0xff00008b, /* darkblue */ 0x67cd1799, 0xff008b8b, /* darkcyan */ 0x31bbd168, 0xffb8860b, /* darkgoldenrod */ 0x67cecf55, 0xff555555, /* darkgrey */ 0x920b194d, 0xff006400, /* darkgreen */ 0x923edd4c, 0xffbdb76b, /* darkkhaki */ 0x5c293873, 0xff8b008b, /* darkmagenta */ 0x6b6671fe, 0xff556b2f, /* darkolivegreen */ 0xbcfd2524, 0xffff8c00, /* darkorange */ 0xbcfdf799, 0xff9932cc, /* darkorchid */ 0x55ee0d5b, 0xff8b0000, /* darkred */ 0xc2e5f564, 0xffe9967a, /* darksalmon */ 0x61be858a, 0xff8fbc8f, /* darkseagreen */ 0xc2b0f2bd, 0xff483d8b, /* darkslateblue */ 0xc2b34d42, 0xff2f4f4f, /* darkslategrey */ 0x7cf2b06b, 0xff00ced1, /* darkturquoise */ 0xc8769375, 0xff9400d3, /* darkviolet */ 0x25832862, 0xffff1493, /* deeppink */ 0xfcad568f, 0xff00bfff, /* deepskyblue */ 0x634c8b67, 0xff696969, /* dimgrey */ 0x45c1ce55, 0xff1e90ff, /* dodgerblue */ 0xef19e3cb, 0xffb22222, /* firebrick */ 0xb852b195, 0xfffffaf0, /* floralwhite */ 0xd086fd06, 0xff228b22, /* forestgreen */ 0xe106b6d7, 0xffff00ff, /* fuchsia */ 0x7880d61e, 0xffdcdcdc, /* gainsboro */ 0x00308060, 0xffffd700, /* gold */ 0xb3b3bc1e, 0xffdaa520, /* goldenrod */ 0xbab8a537, 0xffadff2f, /* greenyellow */ 0xe4cacafb, 0xfff0fff0, /* honeydew */ 0x41892743, 0xffff69b4, /* hotpink */ 0xd5796f1a, 0xffcd5c5c, /* indianred */ 0xb969fed2, 0xff4b0082, /* indigo */ 0x05fef6a9, 0xfffffff0, /* ivory */ 0x06149302, 0xfff0e68c, /* khaki */ 0xad5a05c7, 0xffe6e6fa, /* lavender */ 0x7c4d5b99, 0xfffff0f5, /* lavenderblush */ 0x195756f0, 0xfffffacd, /* lemonchiffon */ 0x28e4ea70, 0xffadd8e6, /* lightblue */ 0xf3c7ccdb, 0xfff08080, /* lightcoral */ 0x28e58d39, 0xffe0ffff, /* lightcyan */ 0x21234e3c, 0xfffafad2, /* lightgoldenrodyellow */ 0xf40157ad, 0xff90ee90, /* lightgreen */ 0x28e744f5, 0xffd3d3d3, /* lightgrey */ 0x28eb3b8c, 0xffffb6c1, /* lightpink */ 0x9fb78304, 0xffffa07a, /* lightsalmon */ 0x50632b2a, 0xff20b2aa, /* lightseagreen */ 0x68fb7b25, 0xff87cefa, /* lightskyblue */ 0xa8a35ba2, 0xff778899, /* lightslategrey */ 0xa20d484f, 0xffb0c4de, /* lightsteelblue */ 0xaa2cf10a, 0xffffffe0, /* lightyellow */ 0x0032afd5, 0xff00ff00, /* lime */ 0x607bbc4e, 0xff32cd32, /* limegreen */ 0x06234efa, 0xfffaf0e6, /* linen */ 0x316858a9, 0xffff00ff, /* magenta */ 0xbf8ca470, 0xff800000, /* maroon */ 0xbd58e0b3, 0xff66cdaa, /* mediumaquamarine */ 0x967dfd4f, 0xff0000cd, /* mediumblue */ 0x056f5c58, 0xffba55d3, /* mediumorchid */ 0x07556b71, 0xff9370db, /* mediumpurple */ 0x5369b689, 0xff3cb371, /* mediumseagreen */ 0x066be19e, 0xff7b68ee, /* mediumslateblue */ 0x3256b281, 0xff00fa9a, /* mediumspringgreen */ 0xc0ad9f4c, 0xff48d1cc, /* mediumturquoise */ 0x628e63dd, 0xffc71585, /* mediumvioletred */ 0x168eb32a, 0xff191970, /* midnightblue */ 0x4306b960, 0xfff5fffa, /* mintcream */ 0x4cbc0e6b, 0xffffe4e1, /* mistyrose */ 0xe97218a6, 0xffffdead, /* navajowhite */ 0x00337bb6, 0xff000080, /* navy */ 0xadd2d33e, 0xfffdf5e6, /* oldlace */ 0x064ee1db, 0xff808000, /* olive */ 0x9e33a98a, 0xff6b8e23, /* olivedrab */ 0xc3de262e, 0xffffa500, /* orange */ 0x58bebba3, 0xffff4500, /* orangered */ 0xc3def8a3, 0xffda70d6, /* orchid */ 0x28cb4834, 0xffeee8aa, /* palegoldenrod */ 0x3d9dd619, 0xff98fb98, /* palegreen */ 0x74022737, 0xffafeeee, /* paleturquoise */ 0x15e2ebc8, 0xffdb7093, /* palevioletred */ 0x5fd898e2, 0xffffefd5, /* papayawhip */ 0x93e1b776, 0xffffdab9, /* peachpuff */ 0x003472f8, 0xffcd853f, /* peru */ 0x00348176, 0xffffc0cb, /* pink */ 0x00348d94, 0xffdda0dd, /* plum */ 0xd036be93, 0xffb0e0e6, /* powderblue */ 0xc5c507bc, 0xff800080, /* purple */ 0xa89d65b3, 0xffbc8f8f, /* rosybrown */ 0xbd9413e1, 0xff4169e1, /* royalblue */ 0xf456044f, 0xff8b4513, /* saddlebrown */ 0xc9c6f66e, 0xfffa8072, /* salmon */ 0x0bb131e1, 0xfff4a460, /* sandybrown */ 0x34636c14, 0xff2e8b57, /* seagreen */ 0x3507fb41, 0xfffff5ee, /* seashell */ 0xca348772, 0xffa0522d, /* sienna */ 0xca37d30d, 0xffc0c0c0, /* silver */ 0x80da74fb, 0xff87ceeb, /* skyblue */ 0x44a8dd73, 0xff6a5acd, /* slateblue */ 0x44ab37f8, 0xff708090, /* slategrey */ 0x0035f183, 0xfffffafa, /* snow */ 0xd5440d16, 0xff00ff7f, /* springgreen */ 0x3e1524a5, 0xff4682b4, /* steelblue */ 0x0001bfa1, 0xffd2b48c, /* tan */ 0x0036425c, 0xff008080, /* teal */ 0xafc8858f, 0xffd8bfd8, /* thistle */ 0xcc41600a, 0xffff6347, /* tomato */ 0xfeea9b21, 0xff40e0d0, /* turquoise */ 0xcf57947f, 0xffee82ee, /* violet */ 0x06bdbae7, 0xfff5deb3, /* wheat */ 0x10802ee6, 0xfff5f5f5, /* whitesmoke */ 0xe1b5130f, 0xff9acd32 /* yellowgreen */ }; const int hash = colourName.trim().toLowerCase().hashCode(); for (int i = 0; i < numElementsInArray (presets); i += 2) if (presets [i] == hash) return Colour (presets [i + 1]); return defaultColour; }
}; //============================================================================== class TemplateFileProperty : public ComponentTextProperty <Component> { public: TemplateFileProperty (JucerDocument& doc) : ComponentTextProperty <Component> ("Template file", 2048, false, 0, doc) {} void setText (const String& newText) override { document.setTemplateFile (newText); } String getText() const override { return document.getTemplateFile(); } }; }; static const Colour tabColour (Colour (0xff888888)); static SourceCodeEditor* createCodeEditor (const File& file, SourceCodeDocument& sourceCodeDoc) { return new SourceCodeEditor (&sourceCodeDoc, new CppCodeEditorComponent (file, sourceCodeDoc.getCodeDocument())); } //============================================================================== JucerDocumentEditor::JucerDocumentEditor (JucerDocument* const doc) : document (doc), tabbedComponent (TabbedButtonBar::TabsAtTop), compLayoutPanel (0), lastViewportX (0), lastViewportY (0), currentZoomLevel (1.0)
//============================================================================== AudioDemoPlaybackPage::AudioDemoPlaybackPage (AudioDeviceManager& deviceManager_) : deviceManager (deviceManager_), thread ("audio file preview"), directoryList (0, thread), zoomLabel (0), explanation (0), zoomSlider (0), thumbnail (0), startStopButton (0), fileTreeComp (0) { addAndMakeVisible (zoomLabel = new Label (String::empty, "zoom:")); zoomLabel->setFont (Font (15.0000f, Font::plain)); zoomLabel->setJustificationType (Justification::centredRight); zoomLabel->setEditable (false, false, false); zoomLabel->setColour (TextEditor::textColourId, Colours::black); zoomLabel->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (explanation = new Label (String::empty, "Select an audio file in the treeview above, and this page will display its waveform, and let you play it..")); explanation->setFont (Font (14.0000f, Font::plain)); explanation->setJustificationType (Justification::bottomRight); explanation->setEditable (false, false, false); explanation->setColour (TextEditor::textColourId, Colours::black); explanation->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (zoomSlider = new Slider (String::empty)); zoomSlider->setRange (0, 1, 0); zoomSlider->setSliderStyle (Slider::LinearHorizontal); zoomSlider->setTextBoxStyle (Slider::NoTextBox, false, 80, 20); zoomSlider->addListener (this); zoomSlider->setSkewFactor (2); addAndMakeVisible (thumbnail = new DemoThumbnailComp (formatManager, transportSource, *zoomSlider)); addAndMakeVisible (startStopButton = new TextButton (String::empty)); startStopButton->setButtonText ("Play/Stop"); startStopButton->addListener (this); startStopButton->setColour (TextButton::buttonColourId, Colour (0xff79ed7f)); addAndMakeVisible (fileTreeComp = new FileTreeComponent (directoryList)); //[UserPreSize] //[/UserPreSize] setSize (600, 400); //[Constructor] You can add your own custom stuff here.. formatManager.registerBasicFormats(); directoryList.setDirectory (File::getSpecialLocation (File::userHomeDirectory), true, true); thread.startThread (3); fileTreeComp->setColour (FileTreeComponent::backgroundColourId, Colours::white); fileTreeComp->addListener (this); deviceManager.addAudioCallback (&audioSourcePlayer); audioSourcePlayer.setSource (&transportSource); //[/Constructor] }
//============================================================================== RhythmicGateAudioProcessorEditor::RhythmicGateAudioProcessorEditor () { //[Constructor_pre] You can add your own custom stuff here.. //[/Constructor_pre] addAndMakeVisible (slider = new Slider ("new slider")); slider->setRange (0, 1, 0.01); slider->setSliderStyle (Slider::LinearBar); slider->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider->setColour (Slider::backgroundColourId, Colour (0x4ef78181)); slider->addListener (this); addAndMakeVisible (slider2 = new Slider ("new slider")); slider2->setRange (0, 1, 0.01); slider2->setSliderStyle (Slider::LinearBar); slider2->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider2->addListener (this); addAndMakeVisible (slider3 = new Slider ("new slider")); slider3->setRange (0, 1, 0.01); slider3->setSliderStyle (Slider::LinearBar); slider3->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider3->addListener (this); addAndMakeVisible (slider4 = new Slider ("new slider")); slider4->setRange (0, 1, 0.01); slider4->setSliderStyle (Slider::LinearBar); slider4->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider4->addListener (this); addAndMakeVisible (slider5 = new Slider ("new slider")); slider5->setRange (0, 1, 0.01); slider5->setSliderStyle (Slider::LinearBar); slider5->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider5->setColour (Slider::backgroundColourId, Colour (0x4ef78181)); slider5->addListener (this); addAndMakeVisible (slider6 = new Slider ("new slider")); slider6->setRange (0, 1, 0.01); slider6->setSliderStyle (Slider::LinearBar); slider6->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider6->addListener (this); addAndMakeVisible (slider7 = new Slider ("new slider")); slider7->setRange (0, 1, 0.01); slider7->setSliderStyle (Slider::LinearBar); slider7->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider7->addListener (this); addAndMakeVisible (slider8 = new Slider ("new slider")); slider8->setRange (0, 1, 0.01); slider8->setSliderStyle (Slider::LinearBar); slider8->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider8->addListener (this); addAndMakeVisible (slider9 = new Slider ("new slider")); slider9->setRange (0, 1, 0.01); slider9->setSliderStyle (Slider::LinearBar); slider9->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider9->setColour (Slider::backgroundColourId, Colour (0x4ef78181)); slider9->addListener (this); addAndMakeVisible (slider10 = new Slider ("new slider")); slider10->setRange (0, 1, 0.01); slider10->setSliderStyle (Slider::LinearBar); slider10->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider10->addListener (this); addAndMakeVisible (slider11 = new Slider ("new slider")); slider11->setRange (0, 1, 0.01); slider11->setSliderStyle (Slider::LinearBar); slider11->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider11->addListener (this); addAndMakeVisible (slider12 = new Slider ("new slider")); slider12->setRange (0, 1, 0.01); slider12->setSliderStyle (Slider::LinearBar); slider12->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider12->addListener (this); addAndMakeVisible (slider13 = new Slider ("new slider")); slider13->setRange (0, 1, 0.01); slider13->setSliderStyle (Slider::LinearBar); slider13->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider13->setColour (Slider::backgroundColourId, Colour (0x4ef78181)); slider13->addListener (this); addAndMakeVisible (slider14 = new Slider ("new slider")); slider14->setRange (0, 1, 0.01); slider14->setSliderStyle (Slider::LinearBar); slider14->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider14->addListener (this); addAndMakeVisible (slider15 = new Slider ("new slider")); slider15->setRange (0, 1, 0.01); slider15->setSliderStyle (Slider::LinearBar); slider15->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider15->addListener (this); addAndMakeVisible (slider16 = new Slider ("new slider")); slider16->setRange (0, 1, 0.01); slider16->setSliderStyle (Slider::LinearBar); slider16->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider16->addListener (this); addAndMakeVisible (slider17 = new Slider ("new slider")); slider17->setRange (0, 10, 0); slider17->setSliderStyle (Slider::RotaryVerticalDrag); slider17->setTextBoxStyle (Slider::TextBoxBelow, false, 80, 20); slider17->addListener (this); addAndMakeVisible (slider18 = new Slider ("new slider")); slider18->setRange (0, 10, 0); slider18->setSliderStyle (Slider::RotaryVerticalDrag); slider18->setTextBoxStyle (Slider::TextBoxBelow, false, 80, 20); slider18->addListener (this); addAndMakeVisible (slider19 = new Slider ("new slider")); slider19->setRange (0, 10, 0); slider19->setSliderStyle (Slider::RotaryVerticalDrag); slider19->setTextBoxStyle (Slider::TextBoxBelow, false, 80, 20); slider19->addListener (this); addAndMakeVisible (label = new Label ("new label", TRANS("Attack"))); label->setFont (Font (15.00f, Font::plain)); label->setJustificationType (Justification::centredLeft); label->setEditable (false, false, false); label->setColour (TextEditor::textColourId, Colours::black); label->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (label2 = new Label ("new label", TRANS("Release"))); label2->setFont (Font (15.00f, Font::plain)); label2->setJustificationType (Justification::centredLeft); label2->setEditable (false, false, false); label2->setColour (TextEditor::textColourId, Colours::black); label2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (label3 = new Label ("new label", TRANS("Dry/Wet"))); label3->setFont (Font (15.00f, Font::plain)); label3->setJustificationType (Justification::centredLeft); label3->setEditable (false, false, false); label3->setColour (TextEditor::textColourId, Colours::black); label3->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (label4 = new Label ("new label", TRANS("Step 1-8"))); label4->setFont (Font (15.00f, Font::plain)); label4->setJustificationType (Justification::centredLeft); label4->setEditable (false, false, false); label4->setColour (TextEditor::textColourId, Colours::black); label4->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (label5 = new Label ("new label", TRANS("Step 9-16"))); label5->setFont (Font (15.00f, Font::plain)); label5->setJustificationType (Justification::centredLeft); label5->setEditable (false, false, false); label5->setColour (TextEditor::textColourId, Colours::black); label5->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (slider20 = new Slider ("new slider")); slider20->setRange (0, 10, 0); slider20->setSliderStyle (Slider::RotaryVerticalDrag); slider20->setTextBoxStyle (Slider::TextBoxBelow, false, 80, 20); slider20->addListener (this); addAndMakeVisible (label6 = new Label ("new label", TRANS("Takte (1/16-4)"))); label6->setFont (Font (15.00f, Font::plain)); label6->setJustificationType (Justification::centredLeft); label6->setEditable (false, false, false); label6->setColour (TextEditor::textColourId, Colours::black); label6->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); //[UserPreSize] //[/UserPreSize] setSize (600, 400); //[Constructor] You can add your own custom stuff here.. //[/Constructor] }
bool Viewer::on_expose_event( GdkEventExpose* /*event*/ ) { Glib::RefPtr<Gdk::GL::Drawable> gldrawable = get_gl_drawable(); if ( !gldrawable ) { return false; } if ( !gldrawable->gl_begin(get_gl_context()) ) { return false; } // Start drawing draw_init( get_width(), get_height() ); // Transform the world gnomon for( int i = 0; i < 4; i += 1 ) { m_gnomonTrans[i] = m_viewing * m_gnomon[i]; } // Draw the world gnomon set_colour( Colour(0.1, 0.1, 1.0) ); draw_line2D( m_gnomonTrans[0], m_gnomonTrans[1] ); draw_line2D( m_gnomonTrans[0], m_gnomonTrans[2] ); draw_line2D( m_gnomonTrans[0], m_gnomonTrans[3] ); // Draw the modelling gnomon set_colour( Colour(0.1, 1.0, 0.1) ); draw_modellingGnomon(); // Draw the unit cube set_colour( Colour(0.1, 0.1, 0.1) ); draw_unitCube(); // Initialize the viewport if ( !m_viewflag ) { m_viewport[0] = ( Point2D(get_width() * 0.05, get_height() * 0.05) ); m_viewport[1] = ( Point2D(get_width() * 0.95, get_height() * 0.05) ); m_viewport[2] = ( Point2D(get_width() * 0.95, get_height() * 0.95) ); m_viewport[3] = ( Point2D(get_width() * 0.05, get_height() * 0.95) ); m_viewflag = true; } // Draw the viewport set_colour( Colour(0.1, 0.1, 0.1) ); draw_line( m_viewport[0], m_viewport[1] ); draw_line( m_viewport[1], m_viewport[2] ); draw_line( m_viewport[2], m_viewport[3] ); draw_line( m_viewport[3], m_viewport[0] ); // Finish drawing draw_complete(); // Update the information bar update_infobar(); // Swap the contents of the front and back buffers so we see what we // just drew. This should only be done if double buffering is enabled. gldrawable->swap_buffers(); gldrawable->gl_end(); return true; }
void paint (Graphics& g) override { g.fillAll (Colour (0xff4d4d4d)); }
void Furniture::HandlePickup(int pickupId) { m_handlePickup = false; // pickupId is the new owner if (pickupId == 0) { // DROP #ifdef PICKUP_DEBUG std::cout << "Got drop msg... "; #endif // Set down: change height to player height. Put player on top. if (m_pickupId == 0) { #ifdef PICKUP_DEBUG std::cout << *this << " Got drop msg but no previous owner!\n"; #endif } else { #ifdef PICKUP_DEBUG std::cout << *this << " Got drop msg; previous owner ID " << m_pickupId << "\n"; #endif GameObject* go = TheGame::Instance()->GetGameObject(m_pickupId); if (go) { float y = go->GetPos().y; m_pos.y = y; float h = m_aabb.GetYSize(); go->SetPos(go->GetPos() + Vec3f(0, h + 10.0f, 0)); // 10 is TEMP TEST Player* p = dynamic_cast<Player*>(go); // TODO Always a player ? if (p) { p->SetCarrying(0); } } } // This looks very wrong - the server should set the position of the object when it is put down. // At the very least, only the player who moved the item should position it!? if (m_pickupId == GetLocalPlayerId()) { TheObjectUpdater::Instance()->SendPosUpdateReq(GetId(), m_pos, m_location); // Hide drop button //TheGSMain::Instance()->ShowDropButton(this, false); m_sceneNode->SetColour(Colour(1, 1, 1, 1)); //m_sceneNode->SetBlended(false); } } else { // Pick up msg GameObject* go = TheGame::Instance()->GetGameObject(pickupId); if (go) { #ifdef PICKUP_DEBUG std::cout << *this << " got picked up by " << *go << "\n"; #endif if (pickupId == GetLocalPlayerId()) { std::cout << "That's me! Local player picked up this object!\n"; // Show drop button //TheGSMain::Instance()->ShowDropButton(this, true); m_sceneNode->SetColour(Colour(1, 1, 1, 0.5f)); //m_sceneNode->SetBlended(true); } Player* p = dynamic_cast<Player*>(go); // TODO Always a player ? if (p) { p->SetCarrying(this); } } else { #ifdef PICKUP_DEBUG std::cout << *this << " got picked up by object " << pickupId << " but this object not created yet!!\n"; #endif } } #ifdef PICKUP_DEBUG std::cout << "Setting m_pickupId to " << pickupId << "\n"; #endif m_pickupId = pickupId; }
//============================================================================== CtrlrAbout::CtrlrAbout (CtrlrManager &_owner) : owner(_owner) { //[Constructor_pre] You can add your own custom stuff here.. //[/Constructor_pre] addAndMakeVisible (ctrlrName = new Label (String::empty, TRANS("Ctrlr"))); ctrlrName->setFont (Font (48.00f, Font::bold)); ctrlrName->setJustificationType (Justification::centredLeft); ctrlrName->setEditable (false, false, false); ctrlrName->setColour (Label::textColourId, Colour (0xd6000000)); ctrlrName->setColour (TextEditor::textColourId, Colours::black); ctrlrName->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (ctrlrLogo = new ImageButton (String::empty)); ctrlrLogo->addListener (this); ctrlrLogo->setImages (false, true, true, Image(), 0.750f, Colour (0x00000000), Image(), 0.850f, Colour (0x00000000), Image(), 0.990f, Colour (0x00000000)); addAndMakeVisible (versionInfoLabel = new TextEditor (String::empty)); versionInfoLabel->setMultiLine (true); versionInfoLabel->setReturnKeyStartsNewLine (true); versionInfoLabel->setReadOnly (true); versionInfoLabel->setScrollbarsShown (true); versionInfoLabel->setCaretVisible (false); versionInfoLabel->setPopupMenuEnabled (true); versionInfoLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); versionInfoLabel->setColour (TextEditor::outlineColourId, Colour (0x9c000000)); versionInfoLabel->setColour (TextEditor::shadowColourId, Colour (0x00000000)); versionInfoLabel->setText (String::empty); addAndMakeVisible (label = new Label ("new label", TRANS("Instance name"))); label->setFont (Font (24.00f, Font::bold)); label->setJustificationType (Justification::topRight); label->setEditable (false, false, false); label->setColour (TextEditor::textColourId, Colours::black); label->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (label2 = new Label ("new label", TRANS("Author"))); label2->setFont (Font (24.00f, Font::plain)); label2->setJustificationType (Justification::topRight); label2->setEditable (false, false, false); label2->setColour (TextEditor::textColourId, Colours::black); label2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (label3 = new Label ("new label", TRANS("Version"))); label3->setFont (Font (24.00f, Font::plain)); label3->setJustificationType (Justification::topRight); label3->setEditable (false, false, false); label3->setColour (TextEditor::textColourId, Colours::black); label3->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (label4 = new Label ("new label", TRANS("URL"))); label4->setFont (Font (24.00f, Font::plain)); label4->setJustificationType (Justification::topRight); label4->setEditable (false, false, false); label4->setColour (TextEditor::textColourId, Colours::black); label4->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (instanceUrl = new HyperlinkButton (String::empty, URL ("http://www.rawmaterialsoftware.com/juce"))); instanceUrl->setTooltip (TRANS("http://www.rawmaterialsoftware.com/juce")); addAndMakeVisible (instanceVersion = new Label (String::empty, String::empty)); instanceVersion->setFont (Font (22.00f, Font::bold)); instanceVersion->setJustificationType (Justification::topLeft); instanceVersion->setEditable (false, false, false); instanceVersion->setColour (TextEditor::textColourId, Colours::black); instanceVersion->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (instanceAuthor = new Label (String::empty, String::empty)); instanceAuthor->setFont (Font (22.00f, Font::bold)); instanceAuthor->setJustificationType (Justification::topLeft); instanceAuthor->setEditable (false, false, false); instanceAuthor->setColour (TextEditor::textColourId, Colours::black); instanceAuthor->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (instanceName = new Label (String::empty, String::empty)); instanceName->setFont (Font (24.00f, Font::bold)); instanceName->setJustificationType (Justification::topLeft); instanceName->setEditable (false, false, false); instanceName->setColour (TextEditor::textColourId, Colours::black); instanceName->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (instanceDescription = new TextEditor (String::empty)); instanceDescription->setMultiLine (true); instanceDescription->setReturnKeyStartsNewLine (true); instanceDescription->setReadOnly (true); instanceDescription->setScrollbarsShown (true); instanceDescription->setCaretVisible (false); instanceDescription->setPopupMenuEnabled (false); instanceDescription->setColour (TextEditor::backgroundColourId, Colour (0x00ffffff)); instanceDescription->setColour (TextEditor::outlineColourId, Colour (0x59000000)); instanceDescription->setColour (TextEditor::shadowColourId, Colour (0x00000000)); instanceDescription->setText (String::empty); //[UserPreSize] ctrlrLogo->setMouseCursor(MouseCursor::PointingHandCursor); ctrlrLogo->setImages (false, true, true, IMAGE(ico_midi_small_png), 0.8500f, Colour (0x0), IMAGE(ico_midi_small_png), 0.9500f, Colour (0x0), IMAGE(ico_midi_small_png), 1.0000f, Colour (0x0)); addVersionInfo ("Version", STR(ctrlrRevision)); addVersionInfo ("Build date", STR(ctrlrRevisionDate)); #if CTRLR_NIGHTLY == 1 addVersionInfo ("Branch", "Nightly"); #else addVersionInfo ("Branch", "Stable"); #endif addVersionInfo ("Juce", SystemStats::getJUCEVersion().fromLastOccurrenceOf("JUCE v", false, true)); addVersionInfo ("libusb", "1.0.19"); addVersionInfo ("liblo", "0.28"); addVersionInfo ("lua", LUA_RELEASE); addVersionInfo ("luabind", _STR(LUABIND_VERSION / 1000) + "." + _STR(LUABIND_VERSION / 100 % 100) + "." + _STR(LUABIND_VERSION % 100)); addVersionInfo ("boost", _STR(BOOST_VERSION / 100000) + "." + _STR(BOOST_VERSION / 100 % 1000) + "." + _STR(BOOST_VERSION % 100)); versionInfoLabel->setFont (Font (owner.getFontManager().getDefaultMonoFontName(), 12.0f, Font::plain)); versionInfoLabel->setColour (TextEditor::backgroundColourId, Colours::white.withAlpha(0.8f)); if (owner.getInstanceMode() == InstanceSingle || owner.getInstanceMode() == InstanceSingleRestriced) { //[/UserPreSize] setSize (600, 380); //[Constructor] You can add your own custom stuff here.. if (owner.getActivePanel()) { instanceName->setText (owner.getActivePanel()->getProperty(Ids::name).toString(), dontSendNotification); instanceAuthor->setText (owner.getActivePanel()->getProperty(Ids::panelAuthorName).toString(), dontSendNotification); instanceDescription->setText (owner.getActivePanel()->getProperty(Ids::panelAuthorDesc).toString(), dontSendNotification); instanceUrl->setButtonText (owner.getActivePanel()->getProperty(Ids::panelAuthorUrl)); instanceUrl->setURL(URL(owner.getActivePanel()->getProperty(Ids::panelAuthorUrl))); instanceVersion->setText (owner.getActivePanel()->getVersionString(false, false, "."), dontSendNotification); } } else { setSize (600, 96); } updateVersionLabel(); //[/Constructor] }
MainContentComponent::MainContentComponent(): oscHandler(), clippingLed( *this ), audioIOComponent(), audioRecorder(), delayLine(), sourceImagesHandler(), ambi2binContainer() { // set window dimensions setSize (650, 700); // specify the required number of input and output channels setAudioChannels (2, 2); // add to change listeners oscHandler.addChangeListener(this); // add audioIOComponent as addAudioCallback for adc input deviceManager.addAudioCallback(&audioIOComponent); //========================================================================== // INIT GUI ELEMENTS // add GUI sub-components addAndMakeVisible(audioIOComponent); addAndMakeVisible(clippingLed); clippingLed.setAlwaysOnTop(true); // setup logo image logoImage = ImageCache::getFromMemory(BinaryData::evertims_logo_512_png, BinaryData::evertims_logo_512_pngSize); logoImage = logoImage.rescaled(logoImage.getWidth()/2, logoImage.getHeight()/2); // init log text box addAndMakeVisible (logTextBox); logTextBox.setMultiLine (true); logTextBox.setReturnKeyStartsNewLine (true); logTextBox.setReadOnly (true); logTextBox.setScrollbarsShown (true); logTextBox.setCaretVisible (false); logTextBox.setPopupMenuEnabled (true); logTextBox.setColour (TextEditor::textColourId, Colours::whitesmoke); logTextBox.setColour (TextEditor::backgroundColourId, Colour(PixelARGB(200,30,30,30))); logTextBox.setColour (TextEditor::outlineColourId, Colours::whitesmoke); logTextBox.setColour (TextEditor::shadowColourId, Colours::darkorange); // init text buttons buttonMap.insert({ { &saveIrButton, "Save RIRs to Desktop" }, { &saveOscButton, "Save OSC state to Desktop" }, { &clearSourceImageButton, "Clear" } }); for (auto& pair : buttonMap) { auto& obj = pair.first; const auto& param = pair.second; obj->setButtonText(param); obj->addListener (this); obj->setEnabled (true); addAndMakeVisible(obj); } saveIrButton.setColour (TextButton::buttonColourId, Colours::transparentBlack); saveOscButton.setColour (TextButton::buttonColourId, Colour(PixelARGB(160,0,0,0))); clearSourceImageButton.setColour (TextButton::buttonColourId, Colours::indianred); // init combo boxes comboBoxMap.insert({ { &numFrequencyBandsComboBox, {"3", "10"} }, { &srcDirectivityComboBox, {"omni", "directional"} }, }); for (auto& pair : comboBoxMap) { auto& obj = pair.first; const auto& param = pair.second; addAndMakeVisible(obj); obj->setEditableText(false); obj->setJustificationType(Justification::right); obj->setColour(ComboBox::backgroundColourId, Colour(PixelARGB(200,30,30,30))); obj->setColour(ComboBox::buttonColourId, Colour(PixelARGB(200,30,30,30))); obj->setColour(ComboBox::outlineColourId, Colour(PixelARGB(200,30,30,30))); obj->setColour(ComboBox::textColourId, Colours::whitesmoke); obj->setColour(ComboBox::arrowColourId, Colours::whitesmoke); obj->addListener (this); for( int i = 0; i < param.size(); i++ ){ obj->addItem(param[i], i+1); } obj->setSelectedId(1); } // init sliders sliderMap.insert({ { &gainReverbTailSlider, { 0.0, 2.0, 1.0} }, // min, max, value { &gainDirectPathSlider, { 0.0, 2.0, 1.0} }, { &gainEarlySlider, { 0.0, 2.0, 1.0} }, { &crossfadeStepSlider, { 0.001, 0.2, 0.1} } }); for (auto& pair : sliderMap) { auto& obj = pair.first; const auto& param = pair.second; addAndMakeVisible(obj); obj->setRange( param[0], param[1] ); obj->setValue( param[2] ); obj->setSliderStyle(Slider::LinearHorizontal); obj->setColour(Slider::textBoxBackgroundColourId, Colours::transparentBlack); obj->setColour(Slider::backgroundColourId, Colours::darkgrey); obj->setColour(Slider::trackColourId, Colours::lightgrey); obj->setColour(Slider::thumbColourId, Colours::white); obj->setColour(Slider::textBoxTextColourId, Colours::white); obj->setColour(Slider::textBoxOutlineColourId, Colours::transparentBlack); obj->setTextBoxStyle(Slider::TextBoxRight, true, 70, 20); obj->addListener(this); } crossfadeStepSlider.setSliderStyle(Slider::RotaryVerticalDrag); crossfadeStepSlider.setColour(Slider::rotarySliderFillColourId, Colours::white); crossfadeStepSlider.setColour(Slider::rotarySliderOutlineColourId, Colours::darkgrey); crossfadeStepSlider.setTextBoxStyle(Slider::TextBoxRight, true, 50, 20); crossfadeStepSlider.setRotaryParameters(10 / 8.f * 3.1416, 22 / 8.f * 3.1416, true); crossfadeStepSlider.setSkewFactor(0.7); // init labels labelMap.insert({ { &numFrequencyBandsLabel, "Num absorb freq bands:" }, { &srcDirectivityLabel, "Source directivity:" }, { &inputLabel, "Inputs" }, { ¶meterLabel, "Parameters" }, { &logLabel, "Logs" }, { &directPathLabel, "Direct path" }, { &earlyLabel, "Early reflections" }, { &crossfadeLabel, "Crossfade factor" }, { &clippingLedLabel, "clip" } }); for (auto& pair : labelMap) { auto& obj = pair.first; const auto& param = pair.second; addAndMakeVisible(obj); obj->setText( param, dontSendNotification ); obj->setColour(Label::textColourId, Colours::whitesmoke); } inputLabel.setColour(Label::backgroundColourId, Colour(30, 30, 30)); parameterLabel.setColour(Label::backgroundColourId, Colour(30, 30, 30)); logLabel.setColour(Label::backgroundColourId, Colour(30, 30, 30)); // init toggles toggleMap.insert({ { &reverbTailToggle, "Reverb tail" }, { &enableDirectToBinaural, "Direct to binaural" }, { &enableLog, "Enable logs" }, { &enableRecord, "Record Ambisonic to disk" } }); for (auto& pair : toggleMap) { auto& obj = pair.first; const auto& param = pair.second; addAndMakeVisible(obj); obj->setButtonText( param ); obj->setColour(ToggleButton::textColourId, Colours::whitesmoke); obj->setEnabled(true); obj->addListener(this); if( obj != &enableRecord ){ obj->setToggleState(true, juce::sendNotification); } } // disable direct to binaural until fixed // enableDirectToBinaural.setEnabled(false); enableDirectToBinaural.setToggleState(false, juce::sendNotification); enableRecord.setToggleState(false, juce::sendNotification); }
Colour Colour::operator *(const Colour& other) { return Colour(m_data[0]*other.m_data[0], m_data[1]*other.m_data[1], m_data[2]*other.m_data[2]); }
LookAndFeel_E1::LookAndFeel_E1() { // PopupMenu Styling setColour (PopupMenu::backgroundColourId, backgroundColor.darker()); setColour (PopupMenu::textColourId, textColor.withAlpha(0.84f)); setColour (PopupMenu::headerTextColourId, textColor.brighter(0.2f).withAlpha(0.84f)); setColour (PopupMenu::highlightedBackgroundColourId, backgroundColor.darker()); setColour (PopupMenu::highlightedTextColourId, textActiveColor.darker()); // ComboBox Styling setColour (ComboBox::backgroundColourId, Colours::black); setColour (ComboBox::outlineColourId, Colours::black.brighter(0.2f)); setColour (ComboBox::buttonColourId, Colours::black.brighter(0.2f)); setColour (ComboBox::textColourId, Colour((uint32)defaultTextActiveColor)); setColour (ComboBox::arrowColourId, Colour((uint32)defaultTextColor)); // Meter Styling typedef Element::DigitalMeter Meter; setColour (Meter::levelOverColourId, Colours::red); setColour (Meter::level0dBColourId, Colours::red); setColour (Meter::level3dBColourId, Colours::yellow); setColour (Meter::level6dBColourId, Colours::yellow); setColour (Meter::level10dBColourId, Colours::green); setColour (Meter::backgroundColourId, Colours::black); // ListBox Styling setColour (ListBox::backgroundColourId, Colour (0x00000000)); setColour (ListBox::textColourId, LookAndFeel_E1::textColor); setColour (TextEditor::backgroundColourId, LookAndFeel_E1::backgroundColor); setColour (TextEditor::highlightColourId, LookAndFeel_E1::backgroundColor.brighter()); setColour (TextEditor::highlightColourId, highlightBackgroundColor); setColour (TextEditor::highlightedTextColourId, LookAndFeel_E1::textColor.contrasting()); setColour (TextEditor::textColourId, LookAndFeel_E1::textColor); // Toolbar Styling setColour (Toolbar::backgroundColourId, LookAndFeel_E1::backgroundColor.brighter (0.05f)); setColour (Toolbar::buttonMouseDownBackgroundColourId, LookAndFeel_E1::backgroundColor.brighter (0.1f)); setColour (Toolbar::buttonMouseOverBackgroundColourId, LookAndFeel_E1::backgroundColor.darker (0.046f)); // alert window setColour (AlertWindow::backgroundColourId, LookAndFeel_E1::backgroundColor); setColour (AlertWindow::textColourId, LookAndFeel_E1::textColor); // Label setColour(Label::textColourId, LookAndFeel_E1::textColor); // search path component setColour (FileSearchPathListComponent::backgroundColourId, LookAndFeel_E1::backgroundColor); // Tree View setColour (TreeView::backgroundColourId, Colour (0x00000000)); setColour (TreeView::linesColourId, LookAndFeel_E1::textColor); setColour (TreeView::dragAndDropIndicatorColourId, Colours::orange.darker()); setColour (TreeView::selectedItemBackgroundColourId, highlightBackgroundColor); // Digital meter styling setColour (DigitalMeter::levelOverColourId, Colours::yellow.darker()); setColour (DigitalMeter::level0dBColourId, Colours::yellowgreen); setColour (DigitalMeter::level3dBColourId, Colours::lightgreen); setColour (DigitalMeter::level6dBColourId, Colours::green); setColour (DigitalMeter::level10dBColourId, Colours::darkgreen.darker()); setColour (DigitalMeter::backgroundColourId, Colours::transparentBlack); setColour (DigitalMeter::foregroundColourId, Colours::transparentWhite); setColour (mainBackgroundColourId, Colour (0xff333333)); setColour (treeviewHighlightColourId, Colour (0xffeeeeee)); #if 0 setColour (ListBox::backgroundColourId, Colour (0xff222222)); setColour (TreeView::selectedItemBackgroundColourId, Colour (0x301111ee)); setColour (TreeView::backgroundColourId, Colour (0xff222222)); const Colour textButtonColour (0xffeeeeff); setColour (TextButton::buttonColourId, textButtonColour); setColour (ComboBox::buttonColourId, textButtonColour); setColour (ScrollBar::thumbColourId, Colour::greyLevel (0.8f).contrasting().withAlpha (0.13f)); #endif }
Colour operator *(double s, const Colour& c) { return Colour(s*c[0], s*c[1], s*c[2]); }
inline Colour operator *(double s, const Colour& a) { return Colour(s*a.R(), s*a.G(), s*a.B()); }
Colour operator +(const Colour& u, const Colour& v) { return Colour(u[0]+v[0], u[1]+v[1], u[2]+v[2]); }
//============================================================================== void DownButton::paint (Graphics& g) { //[UserPrePaint] Add your own custom painting code here.. if(!state) { //[/UserPrePaint] g.fillAll (Colour (0xff2b2b2b)); g.setGradientFill (ColourGradient (Colours::white, 40.0f, 32.0f, Colour (0xffe4e4e4), 56.0f, 24.0f, true)); g.fillPath (internalPath1); g.setColour (Colour (0xff777777)); g.strokePath (internalPath1, PathStrokeType (3.0000f, PathStrokeType::curved, PathStrokeType::rounded)); //[UserPaint] Add your own custom painting code here.. } else { g.setGradientFill (ColourGradient (Colours::white, 40.0f, 32.0f, Colour (0xffe4e4e4), 56.0f, 24.0f, true)); g.fillPath (internalPath1); g.setGradientFill (ColourGradient (Colour (0xe0ffffff), 50.0f, 50.0f, //x, y, Colour(0xD000ff00), 75.0f, 75.0f, true)); //Draw pad border g.strokePath (internalPath1, PathStrokeType (4.0000f, PathStrokeType::curved, PathStrokeType::rounded)); g.setGradientFill (ColourGradient (Colour (0x309d9d9d), 50.0f, 50.0f, //x, y, Colours::red, 150.0f, 50.0f, true)); g.fillEllipse(30.0f - pressure/2.0f, 16.0f - pressure/2.0f, pressure, pressure); //g.setColour(Colour((uint8)0,(uint8)0,(uint8)0,(uint8)100)); g.setGradientFill (ColourGradient (Colour (0x309d9d9d), 50.0f, 50.0f, //x, y, Colours::red, 150.0f, 50.0f, true)); //Pressure border g.drawEllipse(30.0f - pressure/2.0f, 16.0f - pressure/2.0f, pressure, pressure,pressure/7.0f); g.setColour(Colour (0xff101010)); g.strokePath (internalPath1, PathStrokeType (1.0000f, PathStrokeType::curved, PathStrokeType::rounded)); } //[/UserPaint] }
int main(int argc, char *argv[]) { int key = 0; int iCheck = 0; int iX; int iK; char KeyInput[_MAX_PATH]; char Key[3]; char CommandlineDatPath[_MAX_PATH]; double csvValue; int Meters = 0; unsigned long ReturnValue; FILE *hDatFile; uint16_t InfoFlag = SILENTMODE; uint16_t Port = 0; uint16_t Mode = RADIOT2; uint16_t LogMode = LOGTOCSV; uint16_t wMBUSStick = iM871AIdentifier; char comDeviceName[100]; int hStick; ecwMBUSMeter ecpiwwMeter[MAXMETER]; memset(ecpiwwMeter, 0, MAXMETER*sizeof(ecwMBUSMeter)); memset(CommandlineDatPath, 0, _MAX_PATH*sizeof(char)); if(argc > 1) parseparam(argc, argv, CommandlineDatPath, &InfoFlag, &Port, &Mode, &LogMode); //read config back if ((hDatFile = fopen("meter.dat", "rb")) != NULL) { Meters = fread((void*)ecpiwwMeter, sizeof(ecwMBUSMeter), MAXMETER, hDatFile); fclose(hDatFile); } Intro(); //open wM-Bus Stick #1 wMBUSStick = iM871AIdentifier; sprintf(comDeviceName, "/dev/ttyUSB%d", Port); hStick = wMBus_OpenDevice(comDeviceName, wMBUSStick); if(hStick <= 0) { //try 2.Stick wMBUSStick = iAMB8465Identifier; usleep(500*1000); hStick = wMBus_OpenDevice(comDeviceName, wMBUSStick); } if(hStick <= 0) { ErrorAndExit("no wM-Bus Stick not found\n"); } if((iM871AIdentifier == wMBUSStick) && (APIOK == wMBus_GetStickId(hStick, wMBUSStick, &ReturnValue, InfoFlag)) && (iM871AIdentifier == ReturnValue)) { if(InfoFlag > SILENTMODE) { printf("IMST iM871A Stick found\n"); } } else { wMBus_CloseDevice(hStick, wMBUSStick); //try 2. Stick wMBUSStick = iAMB8465Identifier; hStick = wMBus_OpenDevice(comDeviceName,wMBUSStick); if((iAMB8465Identifier == wMBUSStick) && (APIOK == wMBus_GetStickId(hStick, wMBUSStick, &ReturnValue, InfoFlag)) && (iAMB8465Identifier == ReturnValue)) { if(InfoFlag > SILENTMODE) { printf("Amber Stick found\n"); } } else { wMBus_CloseDevice(hStick, wMBUSStick); ErrorAndExit("no wM-Bus Stick not found\n"); } } if(APIOK == wMBus_GetRadioMode(hStick, wMBUSStick, &ReturnValue, InfoFlag)) { if(InfoFlag > SILENTMODE) { printf("wM-BUS %s Mode\n", (ReturnValue == RADIOT2) ? "T2" : "S2"); } if (ReturnValue != Mode) wMBus_SwitchMode(hStick, wMBUSStick, (uint8_t) Mode, InfoFlag); } else ErrorAndExit("wM-Bus Stick not found\n"); wMBus_InitDevice(hStick, wMBUSStick, InfoFlag); UpdateMetersonStick(hStick, wMBUSStick, Meters, ecpiwwMeter, InfoFlag); IsNewMinute(); while (!((key == 0x1B) || (key == 'q'))) { usleep(500*1000); //sleep 500ms key = getkey(); /*key =fgetc(stdin); while(key!='\n' && fgetc(stdin) != '\n'); printf("Key=%d",key);*/ //add a new Meter if (key == 'a') { iX=0; while(0 != ecpiwwMeter[iX].manufacturerID) { iX++; if(iX == MAXMETER-1) continue; } //check entry in list of meters if(iX < MAXMETER) { printf("\nAdding Meter #%d \n",iX+1); ecpiwwMeter[iX].manufacturerID = FASTFORWARD; printf("Enter Meter Manufacturer (1234): "); if(fgets(KeyInput, _MAX_PATH,stdin)) ecpiwwMeter[iX].manufacturerID=CalcHEXStrBCD(KeyInput); ecpiwwMeter[iX].ident = 0x12345678; printf("Enter Meter Ident (12345678): "); if(fgets(KeyInput, _MAX_PATH,stdin)) ecpiwwMeter[iX].ident=CalcUIntBCD(atoi(KeyInput)); ecpiwwMeter[iX].type = 0x00; printf("Enter Meter Type (2 = Electricity ; 3 = Gas ; 4 = Heat Supplied ; 7 = Water) : "); if(fgets(KeyInput, _MAX_PATH,stdin)) { switch(atoi(KeyInput)) { case METER_GAS : ecpiwwMeter[iX].type = METER_GAS; break; case METER_WATER: ecpiwwMeter[iX].type = METER_WATER; break; case METER_HEAT : ecpiwwMeter[iX].type = METER_HEAT; break; default: printf(" - wrong Type ; default to Electricity"); case METER_ELECTRICITY : ecpiwwMeter[iX].type = METER_ELECTRICITY; break; } } ecpiwwMeter[iX].version = 0x01; printf("Enter Meter Version (1234): "); if(fgets(KeyInput, _MAX_PATH,stdin)) ecpiwwMeter[iX].version=CalcUIntBCD(atoi(KeyInput)); printf("Enter Key (0 = Zero ; 1 = Default ; 2 = Enter the 16 Bytes) : "); if(fgets(KeyInput, _MAX_PATH, stdin)) { switch(atoi(KeyInput)) { case 0 : for(iK = 0; iK<AES_KEYLENGHT_IN_BYTES; iK++) ecpiwwMeter[iX].key[iK] = 0; break; default: case 1 : for(iK = 0; iK<AES_KEYLENGHT_IN_BYTES; iK++) ecpiwwMeter[iX].key[iK] = (uint8_t)(0x1C + 3*iK); break; case 2 : printf("Key:"); fgets(KeyInput, _MAX_PATH, stdin); for(iK = 0; iK<AES_KEYLENGHT_IN_BYTES; iK++) ecpiwwMeter[iX].key[iK] = 0; if((strlen(KeyInput)-1) < AES_KEYLENGHT_IN_BYTES*2) printf("Key is too short - default to Zero\n"); else { memset(Key,0,sizeof(Key)); for(iK = 0; iK<(int)(strlen(KeyInput)-1)/2; iK++) { Key[0] = KeyInput[2*iK]; Key[1] = KeyInput[2*iK+1]; ecpiwwMeter[iX].key[iK] = (uint8_t) strtoul(Key, NULL, 16); } } break; } } Meters++; Meters = min(Meters, MAXMETER); DisplayListofMeters(Meters, ecpiwwMeter); UpdateMetersonStick(hStick, wMBUSStick, Meters, ecpiwwMeter, InfoFlag); } else printf("All %d Meters defined\n", MAXMETER); } // display list of meters if(key == 'l') DisplayListofMeters(Meters, ecpiwwMeter); //remove a meter from the list if(key == 'r') { printf("Enter Meterindex to remove: "); if(fgets(KeyInput, _MAX_PATH, stdin)) { iX = atoi(KeyInput); if(iX-1 <= Meters-1) { printf("Remove Meter #%d\n",iX); memset(&ecpiwwMeter[iX-1], 0, sizeof(ecwMBUSMeter)); DisplayListofMeters(Meters, ecpiwwMeter); UpdateMetersonStick(hStick, wMBUSStick, Meters, ecpiwwMeter, InfoFlag); } else printf("Index not defined\n"); } } // switch to S2 mode if(key == 's') { wMBus_SwitchMode( hStick,wMBUSStick, RADIOS2,InfoFlag); wMBus_GetRadioMode(hStick, wMBUSStick, &ReturnValue, InfoFlag); if(InfoFlag > SILENTMODE) { printf("wM-BUS %s Mode\n", (ReturnValue == RADIOT2) ? "T2" : "S2"); } } // switch to T2 mode if(key == 't') { wMBus_SwitchMode( hStick,wMBUSStick, RADIOT2,InfoFlag); wMBus_GetRadioMode(hStick, wMBUSStick, &ReturnValue, InfoFlag); if(InfoFlag > SILENTMODE) { printf("wM-BUS %s Mode\n", (ReturnValue == RADIOT2) ? "T2" : "S2"); } } if(key == 'h') { wMBus_GetLastError( hStick,wMBUSStick); wMBus_GetDataByHand(); } if(key == 'x') { printf("\n\nStatus from Stick\n"); wMBus_GetStickStatus( hStick, wMBUSStick, InfoFlag); } //check whether there are new data from the EnergyCams if (IsNewMinute() || (key == 'u')) { if(wMBus_GetMeterDataList() > 0) { iCheck = 0; for(iX=0; iX<Meters; iX++) { if((0x01<<iX) & wMBus_GetMeterDataList()) { ecMBUSData RFData; int iMul=1; int iDiv=1; wMBus_GetData4Meter(iX, &RFData); if(RFData.exp < 0) { //GAS for(iK=RFData.exp; iK<0; iK++) iDiv=iDiv*10; csvValue = ((double)RFData.value)/iDiv; } else { for(iK=0; iK<RFData.exp; iK++) iMul=iMul*10; csvValue = (double)RFData.value*iMul; } // Log Meter alive Colour(PRINTF_GREEN, false); printf("\nMeter #%d : %04x %08x %02x %02x", iX+1, ecpiwwMeter[iX].manufacturerID, ecpiwwMeter[iX].ident, ecpiwwMeter[iX].type, ecpiwwMeter[iX].version); if((RFData.pktInfo & PACKET_WAS_ENCRYPTED) == PACKET_WAS_ENCRYPTED) printf(" Decryption OK "); if((RFData.pktInfo & PACKET_DECRYPTIONERROR) == PACKET_DECRYPTIONERROR) printf(" Decryption ERROR "); if((RFData.pktInfo & PACKET_WAS_NOT_ENCRYPTED) == PACKET_WAS_NOT_ENCRYPTED) printf(" not encrypted "); if((RFData.pktInfo & PACKET_IS_ENCRYPTED) == PACKET_IS_ENCRYPTED) printf(" is encrypted "); printf(" RSSI=%i dbm, #%d ", RFData.rssiDBm, RFData.accNo); Colour(0,false); // Log to File Log2File(CommandlineDatPath, LogMode, iX, InfoFlag, csvValue, &RFData, &ecpiwwMeter[iX]); } } } else { Colour(PRINTF_YELLOW, false); if(iCheck == 0) printf("\n"); printf("."); iCheck++; Colour(0, false); } } } // end while if(hStick >0) wMBus_CloseDevice(hStick, wMBUSStick); //save Meter config to file if(Meters > 0) { if ((hDatFile = fopen("meter.dat", "wb")) != NULL) { fwrite((void*)ecpiwwMeter, sizeof(ecwMBUSMeter), MAXMETER, hDatFile); fclose(hDatFile); } } return 0; }