//============================================================================== CombSplit::CombSplit () : Component (L"CombSplit"), groupComponent (0), textButton (0), label (0), block_sizeslider (0), number_of_filesslider (0), label2 (0), resetbutton (0), textButton2 (0) { addAndMakeVisible (groupComponent = new GroupComponent (L"new group", L"Comb Split")); groupComponent->setTextLabelPosition (Justification::centredLeft); groupComponent->setColour (GroupComponent::outlineColourId, Colour (0xb0000000)); addAndMakeVisible (textButton = new TextButton (L"new button")); textButton->setButtonText (L"Do it!"); textButton->addListener (this); textButton->setColour (TextButton::buttonColourId, Colour (0x2ebbbbff)); addAndMakeVisible (label = new Label (L"new label", L"Block size (# of bins)")); label->setFont (Font (15.0000f, Font::plain)); label->setJustificationType (Justification::centredLeft); label->setEditable (false, false, false); label->setColour (Label::backgroundColourId, Colour (0x0)); label->setColour (Label::textColourId, Colours::black); label->setColour (Label::outlineColourId, Colour (0x0)); label->setColour (TextEditor::textColourId, Colours::black); label->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (block_sizeslider = new Slider (L"new slider")); block_sizeslider->setRange (0, 99, 1); block_sizeslider->setSliderStyle (Slider::LinearHorizontal); block_sizeslider->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); block_sizeslider->setColour (Slider::thumbColourId, Colour (0x79ffffff)); block_sizeslider->setColour (Slider::textBoxBackgroundColourId, Colour (0xffffff)); block_sizeslider->addListener (this); addAndMakeVisible (number_of_filesslider = new Slider (L"new slider")); number_of_filesslider->setRange (1, 10, 1); number_of_filesslider->setSliderStyle (Slider::LinearHorizontal); number_of_filesslider->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); number_of_filesslider->setColour (Slider::thumbColourId, Colour (0x6effffff)); number_of_filesslider->setColour (Slider::textBoxBackgroundColourId, Colour (0xffffff)); number_of_filesslider->addListener (this); addAndMakeVisible (label2 = new Label (L"new label", L"Number of files")); label2->setFont (Font (15.0000f, Font::plain)); label2->setJustificationType (Justification::centredLeft); label2->setEditable (false, false, false); label2->setColour (Label::backgroundColourId, Colour (0x0)); label2->setColour (Label::textColourId, Colours::black); label2->setColour (Label::outlineColourId, Colour (0x0)); label2->setColour (TextEditor::textColourId, Colours::black); label2->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (resetbutton = new TextButton (L"resetbutton")); resetbutton->setButtonText (L"reset"); resetbutton->addListener (this); resetbutton->setColour (TextButton::buttonColourId, Colour (0x35bbbbff)); addAndMakeVisible (textButton2 = new TextButton (L"new button")); textButton2->setButtonText (L"Redo it!"); textButton2->addListener (this); textButton2->setColour (TextButton::buttonColourId, Colour (0x40bbbbff)); //[UserPreSize] //[/UserPreSize] setSize (600, 400); //[Constructor] You can add your own custom stuff here.. buttonClicked(resetbutton); #undef Slider //[/Constructor] }
TextBox::TextBox(int x, int y, const Color &textColor, const std::string &text, FontName fontName, TextureManager &textureManager) : Surface(x, y, 1, 1) { this->fontName = fontName; // Split "text" into lines of text. this->textLines = [&text]() { auto temp = std::vector<std::string>(); // Add one empty string to start. temp.push_back(std::string()); const char newLine = '\n'; int textLineIndex = 0; for (auto &c : text) { if (c != newLine) { // std::string has push_back! Yay! Intuition + 1. temp.at(textLineIndex).push_back(c); } else { temp.push_back(std::string()); textLineIndex++; } } return temp; }(); // Calculate the proper dimensions of the text box. // No need for a "FontSurface" type... just do the heavy lifting in this class. auto font = Font(fontName); int upperCharWidth = font.getUpperCharacterWidth(); int upperCharHeight = font.getUpperCharacterHeight(); int lowerCharWidth = font.getLowerCharacterWidth(); int lowerCharHeight = font.getLowerCharacterHeight(); const int newWidth = [](const std::vector<std::string> &lines, int upperCharWidth, int lowerCharWidth) { // Find longest line (in pixels) out of all lines. int longestLength = 0; for (auto &line : lines) { // Sum of all character lengths in the current line. int linePixels = 0; for (auto &c : line) { linePixels += islower(c) ? lowerCharWidth : upperCharWidth; } // Check against the current longest line. if (linePixels > longestLength) { longestLength = linePixels; } } // In pixels. return longestLength; }(this->textLines, upperCharWidth, lowerCharWidth); const int newHeight = static_cast<int>(this->textLines.size()) * upperCharHeight; // Resize the surface with the proper dimensions for fitting all the text. SDL_FreeSurface(this->surface); this->surface = [](int width, int height, int colorBits) { return SDL_CreateRGBSurface(0, width, height, colorBits, 0, 0, 0, 0); }(newWidth, newHeight, Surface::DEFAULT_BPP); // Make this surface transparent. this->setTransparentColor(Color::Transparent); this->fill(Color::Transparent); // Blit each character surface in at the right spot. auto point = Int2(); auto fontSurface = textureManager.getSurface(font.getFontTextureName()); int upperCharOffsetWidth = font.getUpperCharacterOffsetWidth(); int upperCharOffsetHeight = font.getUpperCharacterOffsetHeight(); int lowerCharOffsetWidth = font.getLowerCharacterOffsetWidth(); int lowerCharOffsetHeight = font.getLowerCharacterOffsetHeight(); for (auto &line : this->textLines) { for (auto &c : line) { int width = islower(c) ? lowerCharWidth : upperCharWidth; int height = islower(c) ? lowerCharHeight : upperCharHeight; auto letterSurface = [&]() { auto cellPosition = Font::getCharacterCell(c); int offsetWidth = islower(c) ? lowerCharOffsetWidth : upperCharOffsetWidth; int offsetHeight = islower(c) ? lowerCharOffsetHeight : upperCharOffsetHeight; // Make a copy surface of the font character. auto pixelPosition = Int2( cellPosition.getX() * (width + offsetWidth), cellPosition.getY() * (height + offsetHeight)); auto clipRect = Rectangle(pixelPosition.getX(), pixelPosition.getY(), width, height); auto surface = Surface(width, height); fontSurface.blit(surface, Int2(), clipRect); return surface; }(); // Set the letter surface to have transparency. letterSurface.setTransparentColor(Color::Magenta); // Set the letter colors to the desired color. auto letterPixels = static_cast<unsigned int*>(letterSurface.getSurface()->pixels); auto mappedColor = SDL_MapRGBA(letterSurface.getSurface()->format, textColor.getR(), textColor.getG(), textColor.getB(), textColor.getA()); int area = letterSurface.getWidth() * letterSurface.getHeight(); for (int i = 0; i < area; ++i) { auto pixel = &letterPixels[i]; // If transparent, then color it? I dunno, but it works. if ((*pixel) == 0) { *pixel = mappedColor; } } // Draw the letter onto this texture. letterSurface.blit(*this, point); // Move drawing position to the right of the current character. point.setX(point.getX() + width); } // Move drawing point back to the left and down by one capital character size. point.setX(0); point.setY(point.getY() + upperCharHeight); } assert(this->surface->w > 1); assert(this->surface->h > 1); assert(this->textLines.size() > 0); assert(this->fontName == fontName); }
const Font CtrlrFontManager::getFontFromString (const String &string) { //_DBG(string); if (!string.contains (";")) { //_DBG("\tno ; in string"); if (string == String::empty) { //_DBG("\tstring is empty, return default font"); return (Font (15.0f)); } return (Font::fromString(string)); } StringArray fontProps; fontProps.addTokens (string, ";", "\"\'"); Font font; if (fontProps[fontTypefaceName] != String::empty) { //_DBG("\tfont name not empty: "+fontProps[fontTypefaceName]); if (fontProps[fontSet] != String::empty && fontProps[fontSet].getIntValue() >= 0) { //_DBG("\tfont set is not empty and >= 0: "+_STR(fontProps[fontSet])); /* We need to fetch the typeface for the font from the correct font set */ Array<Font> &fontSetToUse = getFontSet((const FontSet)fontProps[fontSet].getIntValue()); for (int i=0; i<fontSetToUse.size(); i++) { if (fontSetToUse[i].getTypefaceName() == fontProps[fontTypefaceName]) { //_DBG("\tgot font from set, index: "+_STR(i)); font = fontSetToUse[i]; break; } } } else { /* The font set is not specified, fall back to JUCE to find the typeface name this will actualy be the OS set */ font.setTypefaceName (fontProps[fontTypefaceName]); } font.setHeight (fontProps[fontHeight].getFloatValue()); font.setBold (false); font.setUnderline (false); font.setItalic (false); if (fontProps[fontBold] != String::empty) font.setBold (fontProps[fontBold].getIntValue() ? true : false); if (fontProps[fontItalic] != String::empty) font.setItalic (fontProps[fontItalic].getIntValue() ? true : false); if (fontProps[fontUnderline] != String::empty) font.setUnderline (fontProps[fontUnderline].getIntValue() ? true : false); if (fontProps[fontKerning] != String::empty) font.setExtraKerningFactor (fontProps[fontKerning].getFloatValue()); if (fontProps[fontHorizontalScale] != String::empty) font.setHorizontalScale (fontProps[fontHorizontalScale].getFloatValue()); } return (font); }
//============================================================================== AudioDemoPlaybackPage::AudioDemoPlaybackPage (AudioDeviceManager& deviceManager_) : deviceManager (deviceManager_), thread ("audio file preview"), directoryList (0, thread), zoomLabel (0), thumbnail (0), startStopButton (0), fileTreeComp (0), explanation (0), zoomSlider (0) { addAndMakeVisible (zoomLabel = new Label (String::empty, T("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 (thumbnail = new DemoThumbnailComp()); addAndMakeVisible (startStopButton = new TextButton (String::empty)); startStopButton->setButtonText (T("Play/Stop")); startStopButton->addButtonListener (this); startStopButton->setColour (TextButton::buttonColourId, Colour (0xff79ed7f)); addAndMakeVisible (fileTreeComp = new FileTreeComponent (directoryList)); addAndMakeVisible (explanation = new Label (String::empty, T("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); //[UserPreSize] //[/UserPreSize] setSize (600, 400); //[Constructor] You can add your own custom stuff here.. 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); currentAudioFileSource = 0; //[/Constructor] }
//============================================================================== EdoGaduSearch::EdoGaduSearch (EdoGadu *_edoGaduComponent) : edoGaduComponent(_edoGaduComponent), inpUin (0), label (0), inpFristName (0), label2 (0), inpLastName (0), label3 (0), label4 (0), inpNickName (0), label5 (0), inpCity (0), inpSex (0), label6 (0), label7 (0), inpBirthYear (0), searchResult (0), btnSearch (0), searchRunning (0) { addAndMakeVisible (inpUin = new TextEditor (T("new text editor"))); inpUin->setMultiLine (false); inpUin->setReturnKeyStartsNewLine (false); inpUin->setReadOnly (false); inpUin->setScrollbarsShown (true); inpUin->setCaretVisible (true); inpUin->setPopupMenuEnabled (true); inpUin->setColour (TextEditor::backgroundColourId, Colour (0x97ffffff)); inpUin->setColour (TextEditor::outlineColourId, Colours::black); inpUin->setColour (TextEditor::shadowColourId, Colour (0x0)); inpUin->setText (String::empty); addAndMakeVisible (label = new Label (T("new label"), T("UIN"))); label->setFont (Font (18.0000f, Font::bold)); label->setJustificationType (Justification::centred); label->setEditable (false, false, false); label->setColour (TextEditor::textColourId, Colours::black); label->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (inpFristName = new TextEditor (T("new text editor"))); inpFristName->setMultiLine (false); inpFristName->setReturnKeyStartsNewLine (false); inpFristName->setReadOnly (false); inpFristName->setScrollbarsShown (true); inpFristName->setCaretVisible (true); inpFristName->setPopupMenuEnabled (true); inpFristName->setColour (TextEditor::backgroundColourId, Colour (0x97ffffff)); inpFristName->setColour (TextEditor::outlineColourId, Colours::black); inpFristName->setColour (TextEditor::shadowColourId, Colour (0x0)); inpFristName->setText (String::empty); addAndMakeVisible (label2 = new Label (T("new label"), T("First Name"))); label2->setFont (Font (18.0000f, Font::bold)); label2->setJustificationType (Justification::centred); label2->setEditable (false, false, false); label2->setColour (TextEditor::textColourId, Colours::black); label2->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (inpLastName = new TextEditor (T("new text editor"))); inpLastName->setMultiLine (false); inpLastName->setReturnKeyStartsNewLine (false); inpLastName->setReadOnly (false); inpLastName->setScrollbarsShown (true); inpLastName->setCaretVisible (true); inpLastName->setPopupMenuEnabled (true); inpLastName->setColour (TextEditor::backgroundColourId, Colour (0x97ffffff)); inpLastName->setColour (TextEditor::outlineColourId, Colours::black); inpLastName->setColour (TextEditor::shadowColourId, Colour (0x0)); inpLastName->setText (String::empty); addAndMakeVisible (label3 = new Label (T("new label"), T("Last Name"))); label3->setFont (Font (18.0000f, Font::bold)); label3->setJustificationType (Justification::centred); label3->setEditable (false, false, false); label3->setColour (TextEditor::textColourId, Colours::black); label3->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (label4 = new Label (T("new label"), T("Nick Name"))); label4->setFont (Font (18.0000f, Font::bold)); label4->setJustificationType (Justification::centred); label4->setEditable (false, false, false); label4->setColour (TextEditor::textColourId, Colours::black); label4->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (inpNickName = new TextEditor (T("new text editor"))); inpNickName->setMultiLine (false); inpNickName->setReturnKeyStartsNewLine (false); inpNickName->setReadOnly (false); inpNickName->setScrollbarsShown (true); inpNickName->setCaretVisible (true); inpNickName->setPopupMenuEnabled (true); inpNickName->setColour (TextEditor::backgroundColourId, Colour (0x97ffffff)); inpNickName->setColour (TextEditor::outlineColourId, Colours::black); inpNickName->setColour (TextEditor::shadowColourId, Colour (0x0)); inpNickName->setText (String::empty); addAndMakeVisible (label5 = new Label (T("new label"), T("City"))); label5->setFont (Font (18.0000f, Font::bold)); label5->setJustificationType (Justification::centred); label5->setEditable (false, false, false); label5->setColour (TextEditor::textColourId, Colours::black); label5->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (inpCity = new TextEditor (T("new text editor"))); inpCity->setMultiLine (false); inpCity->setReturnKeyStartsNewLine (false); inpCity->setReadOnly (false); inpCity->setScrollbarsShown (true); inpCity->setCaretVisible (true); inpCity->setPopupMenuEnabled (true); inpCity->setColour (TextEditor::backgroundColourId, Colour (0x97ffffff)); inpCity->setColour (TextEditor::outlineColourId, Colours::black); inpCity->setColour (TextEditor::shadowColourId, Colour (0x0)); inpCity->setText (String::empty); addAndMakeVisible (inpSex = new ComboBox (T("new combo box"))); inpSex->setEditableText (false); inpSex->setJustificationType (Justification::centredLeft); inpSex->setTextWhenNothingSelected (T("Female")); inpSex->setTextWhenNoChoicesAvailable (T("(no choices)")); inpSex->addItem (T("Male"), 1); inpSex->addItem (T("Female"), 2); inpSex->addListener (this); addAndMakeVisible (label6 = new Label (T("new label"), T("Sex"))); label6->setFont (Font (18.0000f, Font::bold)); label6->setJustificationType (Justification::centred); label6->setEditable (false, false, false); label6->setColour (TextEditor::textColourId, Colours::black); label6->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (label7 = new Label (T("new label"), T("Year of Birth"))); label7->setFont (Font (18.0000f, Font::bold)); label7->setJustificationType (Justification::centred); label7->setEditable (false, false, false); label7->setColour (TextEditor::textColourId, Colours::black); label7->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (inpBirthYear = new TextEditor (T("new text editor"))); inpBirthYear->setMultiLine (false); inpBirthYear->setReturnKeyStartsNewLine (false); inpBirthYear->setReadOnly (false); inpBirthYear->setScrollbarsShown (true); inpBirthYear->setCaretVisible (true); inpBirthYear->setPopupMenuEnabled (true); inpBirthYear->setColour (TextEditor::backgroundColourId, Colour (0x97ffffff)); inpBirthYear->setColour (TextEditor::outlineColourId, Colours::black); inpBirthYear->setColour (TextEditor::shadowColourId, Colour (0x0)); inpBirthYear->setText (T("1980 1986")); addAndMakeVisible (searchResult = new ListBox (T("searchResults"),this)); searchResult->setName (T("searchResults")); addAndMakeVisible (btnSearch = new ImageButton (T("new button"))); btnSearch->setTooltip (T("Start searching (and wait a while)")); btnSearch->addButtonListener (this); btnSearch->setImages (false, true, true, 0, 1.0000f, Colour (0x0), 0, 1.0000f, Colour (0x0), 0, 1.0000f, Colour (0x0)); addAndMakeVisible (searchRunning = new ProgressBar (searchSwitch)); searchRunning->setName (T("new component")); //[UserPreSize] searchResult->setColour (ListBox::backgroundColourId, Colour (0x97ffffff)); searchResult->setColour (ListBox::outlineColourId, Colours::black); searchResult->setOutlineThickness (1); searchRunning->setPercentageDisplay (false); btnSearch->setImages (false, true, true, EdoApp::getInstance()->getEdoImage(edoSearch), 0.7500f, Colour (0x0), EdoApp::getInstance()->getEdoImage(edoSearch), 1.0000f, Colour (0x0), EdoApp::getInstance()->getEdoImage(edoSearch), 1.0000f, Colour (0x23005fff)); //[/UserPreSize] setSize (400, 400); //[Constructor] You can add your own custom stuff here.. searchSwitch=0; //[/Constructor] }
const Font StatusBar::getFont() { return Font(Font::getDefaultMonospacedFontName(), (float)kFontSize, Font::plain); }
//============================================================================== WdmChMapComponent::WdmChMapComponent () : m_out (false), m_group (0), m_input (0), m_output (0), m_dragging (0), m_speaker_label (0), m_speaker_table (0), m_dev_ch_label (0), m_device_channels (0), m_speaker(0), m_update (0) { setName("WDM Ch Mapper"); initWdmNames(); getChannelNames(); getMappedNames(); addAndMakeVisible (m_group = new GroupComponent ("channelsGroup", "In Channels")); addAndMakeVisible (m_input = new ToggleButton ("input")); m_input->setButtonText ("Input"); m_input->addListener (this); m_input->setRadioGroupId(1234); addAndMakeVisible (m_output = new ToggleButton ("output")); m_output->setButtonText ("Output"); m_output->addListener (this); m_output->setRadioGroupId(1234); addAndMakeVisible (m_reset = new TextButton ("reset")); m_reset->setButtonText ("Reset"); m_reset->addListener (this); addAndMakeVisible (m_speaker_label = new Label ("wdmChannelsLabel", "WDM Channels")); m_speaker_label->setFont (Font (15.0000f, Font::plain)); m_speaker_label->setJustificationType (Justification::centredBottom); m_speaker_label->setEditable (false, false, false); addAndMakeVisible (m_speaker_table = new SpeakerListComponent (*this, m_wdm_names, m_in_ch_names, m_out_ch_names, m_in_map_names, m_out_map_names, false)); m_speaker_table->setOutlineThickness(1); addAndMakeVisible (m_wdm_ch_label = new Label ("wdmChLabel", "Mapped WDM Channels")); m_wdm_ch_label->setFont (Font (15.0000f, Font::plain)); m_wdm_ch_label->setJustificationType (Justification::topLeft); m_wdm_ch_label->setEditable (false, false, false); addAndMakeVisible (m_dev_ch_label = new Label ("devChLabel", "Device Channels")); m_dev_ch_label->setFont (Font (15.0000f, Font::plain)); m_dev_ch_label->setJustificationType (Justification::topLeft); m_dev_ch_label->setEditable (false, false, false); addAndMakeVisible (m_instr_label = new Label ("instLabel", "Drag WDM channels \nto Device channels to map them.\n\nDrag maps out of the \nDevice channels list\nto unmap them.")); m_instr_label->setFont (Font (15.0000f, Font::plain)); m_instr_label->setJustificationType (Justification::centred); m_instr_label->setEditable (false, false, false); addAndMakeVisible (m_device_channels = new ChannelListComponent (*this, m_wdm_names, m_in_ch_names, m_out_ch_names, m_in_map_names, m_out_map_names)); m_device_channels->setOutlineThickness(1); if (m_out) m_input->setToggleState(true, true); else m_output->setToggleState(true, true); lookAndFeelChanged(); }
//============================================================================== mlrVSTGUI::mlrVSTGUI (mlrVSTAudioProcessor* owner, const int &newNumChannels, const int &newNumStrips) : AudioProcessorEditor (owner), // Communication //////////////////////// parent(owner), // Style / positioning objects ////////// myLookAndFeel(), overrideLF(), // Fonts /////////////////////////////////////////////////////// fontSize(12.f), defaultFont("ProggyCleanTT", 18.f, Font::plain), // Volume controls ////////////////////////////////////////////////// masterGainSlider("master gain"), masterSliderLabel("master", "mstr"), slidersArray(), slidersMuteBtnArray(), // Tempo controls /////////////////////////////////////// bpmSlider("bpm slider"), bpmLabel(), quantiseSettingsCbox("quantise settings"), quantiseLabel("quantise label", "quant."), // Buttons ////////////////////////////////// loadFilesBtn("load samples", "load samples"), sampleStripToggle("sample strip toggle", DrawableButton::ImageRaw), patternStripToggle("pattern strip toggle", DrawableButton::ImageRaw), sampleImg(), patternImg(), // Record / Resample / Pattern UI //////////////////////////////////////// precountLbl("precount", "precount"), recordLengthLbl("length", "length"), bankLbl("bank", "bank"), recordPrecountSldr(), recordLengthSldr(), recordBankSldr(), resamplePrecountSldr(), resampleLengthSldr(), resampleBankSldr(), patternPrecountSldr(), patternLengthSldr(), patternBankSldr(), recordBtn("record", Colours::black, Colours::white), resampleBtn("resample", Colours::black, Colours::white), patternBtn("pattern", Colours::black, Colours::white), // branding vstNameLbl("vst label", "mlrVST"), // Misc /////////////////////////////////////////// lastDisplayedPosition(), debugButton("loadfile", DrawableButton::ImageRaw), // temporary button // Presets ////////////////////////////////////////////////// presetLabel("presets", "presets"), presetCbox(), presetPrevBtn("prev", 0.25, Colours::black, Colours::white), presetNextBtn("next", 0.75, Colours::black, Colours::white), addPresetBtn("add", "add preset"), toggleSetlistBtn("setlist"), presetPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725), presetPanel(presetPanelBounds, owner), // Settings /////////////////////////////////////// numChannels(newNumChannels), useExternalTempo(true), toggleSettingsBtn("settings"), settingsPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725), settingsPanel(settingsPanelBounds, owner, this), // Mappings ////////////////////////////////////// mappingPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725), toggleMappingBtn("mappings"), mappingPanel(mappingPanelBounds, owner), // SampleStrip controls /////////////////////////// sampleStripControlArray(), numStrips(newNumStrips), waveformControlHeight( (GUI_HEIGHT - numStrips * PAD_AMOUNT) / numStrips), waveformControlWidth(THUMBNAIL_WIDTH), // Overlays ////////////////////////////// patternStripArray(), hintOverlay(owner) { DBG("GUI loaded " << " strips of height " << waveformControlHeight); parent->addChangeListener(this); // these are compile time constants setSize(GUI_WIDTH, GUI_HEIGHT); setWantsKeyboardFocus(true); int xPosition = PAD_AMOUNT; int yPosition = PAD_AMOUNT; // set up volume sliders buildSliders(xPosition, yPosition); // add the bpm slider and quantise settings setupTempoUI(xPosition, yPosition); // set up the various panels (settings, mapping, etc) // and the buttons that control them setupPanels(xPosition, yPosition); // preset associated UI elements setupPresetUI(xPosition, yPosition); // useful UI debugging components addAndMakeVisible(&debugButton); debugButton.addListener(this); debugButton.setColour(DrawableButton::backgroundColourId, Colours::blue); debugButton.setBounds(50, 300, 50, 25); sampleImg.setImage(ImageCache::getFromMemory(BinaryData::waveform_png, BinaryData::waveform_pngSize)); patternImg.setImage(ImageCache::getFromMemory(BinaryData::pattern_png, BinaryData::pattern_pngSize)); addAndMakeVisible(&sampleStripToggle); sampleStripToggle.addListener(this); sampleStripToggle.setImages(&sampleImg); sampleStripToggle.setBounds(100, 300, 70, 25); displayMode = modeSampleStrips; addAndMakeVisible(&loadFilesBtn); loadFilesBtn.addListener(this); loadFilesBtn.setBounds(50, 350, 100, 25); setUpRecordResampleUI(); buildSampleStripControls(numStrips); setupPatternOverlays(); masterGainSlider.addListener(this); // start timer to update play positions, slider values etc. startTimer(50); addAndMakeVisible(&vstNameLbl); vstNameLbl.setBounds(PAD_AMOUNT, 600, 250, 50); vstNameLbl.setFont(Font("ProggyCleanTT", 40.f, Font::plain)); vstNameLbl.setColour(Label::textColourId, Colours::white); addChildComponent(&hintOverlay); const int overlayHeight = 150; hintOverlay.setBounds(0, GUI_HEIGHT/2 - overlayHeight/2, GUI_WIDTH, overlayHeight); // This tells the GUI to use a custom "theme" LookAndFeel::setDefaultLookAndFeel(&myLookAndFeel); }
//============================================================================== SpectrumShift::SpectrumShift () : Component (T("SpectrumShift")), groupComponent (0), shift_valueslider (0), label (0), textButton (0), resetbutton (0), label2 (0), textButton2 (0) { addAndMakeVisible (groupComponent = new GroupComponent (T("new group"), T("Spectrum Shift"))); groupComponent->setTextLabelPosition (Justification::centredLeft); groupComponent->setColour (GroupComponent::outlineColourId, Colour (0xb0000000)); addAndMakeVisible (shift_valueslider = new Slider (T("new slider"))); shift_valueslider->setRange (-22050, 22050, 0); shift_valueslider->setSliderStyle (Slider::LinearHorizontal); shift_valueslider->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); shift_valueslider->setColour (Slider::backgroundColourId, Colour (0x956565)); shift_valueslider->setColour (Slider::thumbColourId, Colour (0x7bfffcfc)); shift_valueslider->setColour (Slider::textBoxBackgroundColourId, Colour (0xffffff)); shift_valueslider->addListener (this); addAndMakeVisible (label = new Label (T("new label"), T("Shift value (Hz)"))); label->setFont (Font (15.0000f, Font::plain)); label->setJustificationType (Justification::centredLeft); label->setEditable (false, false, false); label->setColour (Label::backgroundColourId, Colour (0x0)); label->setColour (Label::textColourId, Colours::black); label->setColour (Label::outlineColourId, Colour (0x0)); label->setColour (TextEditor::textColourId, Colours::black); label->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (textButton = new TextButton (T("new button"))); textButton->setButtonText (T("Do it!")); textButton->addButtonListener (this); textButton->setColour (TextButton::buttonColourId, Colour (0x44bbbbff)); addAndMakeVisible (resetbutton = new TextButton (T("resetbutton"))); resetbutton->setButtonText (T("reset")); resetbutton->addButtonListener (this); resetbutton->setColour (TextButton::buttonColourId, Colour (0x25bbbbff)); addAndMakeVisible (label2 = new Label (T("new label"), T("Optimal spectrum shift, with no window artefacts. The frequency you specify (positive or negative) will be added to all frequency values, shifting the spectrum up or down."))); label2->setFont (Font (15.0000f, Font::plain)); label2->setJustificationType (Justification::centredLeft); label2->setEditable (false, false, false); label2->setColour (Label::backgroundColourId, Colour (0x0)); label2->setColour (Label::textColourId, Colours::black); label2->setColour (Label::outlineColourId, Colour (0x0)); label2->setColour (TextEditor::textColourId, Colours::black); label2->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (textButton2 = new TextButton (T("new button"))); textButton2->setButtonText (T("Redo it!")); textButton2->addButtonListener (this); textButton2->setColour (TextButton::buttonColourId, Colour (0x40bbbbff)); setSize (600, 400); //[Constructor] You can add your own custom stuff here.. buttonClicked(resetbutton); #undef Slider //[/Constructor] }
//============================================================================== OscillatorEditor::OscillatorEditor () { //[Constructor_pre] You can add your own custom stuff here.. //[/Constructor_pre] addAndMakeVisible (m_waveformTypeSlider = new Slider ("Waveform Type Slider")); m_waveformTypeSlider->setRange (0, 1, 0); m_waveformTypeSlider->setSliderStyle (Slider::RotaryVerticalDrag); m_waveformTypeSlider->setTextBoxStyle (Slider::NoTextBox, true, 80, 20); m_waveformTypeSlider->setColour (Slider::thumbColourId, Colour (0xff1de9b6)); m_waveformTypeSlider->setColour (Slider::trackColourId, Colour (0x00000000)); m_waveformTypeSlider->setColour (Slider::rotarySliderFillColourId, Colour (0xff1de9b6)); m_waveformTypeSlider->setColour (Slider::rotarySliderOutlineColourId, Colour (0xff212121)); m_waveformTypeSlider->setColour (Slider::textBoxTextColourId, Colour (0xff212121)); m_waveformTypeSlider->setColour (Slider::textBoxBackgroundColourId, Colour (0x00000000)); m_waveformTypeSlider->setColour (Slider::textBoxHighlightColourId, Colour (0xff1de9b6)); m_waveformTypeSlider->setColour (Slider::textBoxOutlineColourId, Colour (0x00000000)); m_waveformTypeSlider->addListener (this); addAndMakeVisible (m_detuneLabel = new Label ("Detune Label", TRANS("DETUNE"))); m_detuneLabel->setFont (Font ("Avenir Next", 14.00f, Font::plain)); m_detuneLabel->setJustificationType (Justification::centred); m_detuneLabel->setEditable (false, false, false); m_detuneLabel->setColour (Label::textColourId, Colour (0xff212121)); m_detuneLabel->setColour (TextEditor::textColourId, Colour (0xff212121)); m_detuneLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); m_detuneLabel->setColour (TextEditor::highlightColourId, Colour (0xff1de9b6)); addAndMakeVisible (m_waveTypeLabel = new Label ("Waveform Type Label", TRANS("WAVE"))); m_waveTypeLabel->setFont (Font ("Avenir Next", 14.00f, Font::plain)); m_waveTypeLabel->setJustificationType (Justification::centred); m_waveTypeLabel->setEditable (false, false, false); m_waveTypeLabel->setColour (Label::textColourId, Colour (0xff212121)); m_waveTypeLabel->setColour (TextEditor::textColourId, Colour (0xff212121)); m_waveTypeLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); m_waveTypeLabel->setColour (TextEditor::highlightColourId, Colour (0xff1de9b6)); addAndMakeVisible (m_detuneSlider = new Slider ("Detune Slider")); m_detuneSlider->setRange (0, 1, 0.0104166); m_detuneSlider->setSliderStyle (Slider::RotaryVerticalDrag); m_detuneSlider->setTextBoxStyle (Slider::NoTextBox, true, 80, 20); m_detuneSlider->setColour (Slider::thumbColourId, Colour (0xff1de9b6)); m_detuneSlider->setColour (Slider::trackColourId, Colour (0x00000000)); m_detuneSlider->setColour (Slider::rotarySliderFillColourId, Colour (0xff1de9b6)); m_detuneSlider->setColour (Slider::rotarySliderOutlineColourId, Colour (0xff212121)); m_detuneSlider->setColour (Slider::textBoxTextColourId, Colour (0xff212121)); m_detuneSlider->setColour (Slider::textBoxBackgroundColourId, Colour (0x00000000)); m_detuneSlider->setColour (Slider::textBoxHighlightColourId, Colour (0xff1de9b6)); m_detuneSlider->setColour (Slider::textBoxOutlineColourId, Colour (0x00000000)); m_detuneSlider->addListener (this); addAndMakeVisible (m_distortionSlider = new Slider ("Distortion Slider")); m_distortionSlider->setRange (0, 1, 0); m_distortionSlider->setSliderStyle (Slider::RotaryVerticalDrag); m_distortionSlider->setTextBoxStyle (Slider::NoTextBox, true, 80, 20); m_distortionSlider->setColour (Slider::thumbColourId, Colour (0xff1de9b6)); m_distortionSlider->setColour (Slider::trackColourId, Colour (0x00000000)); m_distortionSlider->setColour (Slider::rotarySliderFillColourId, Colour (0xff1de9b6)); m_distortionSlider->setColour (Slider::rotarySliderOutlineColourId, Colour (0xff212121)); m_distortionSlider->setColour (Slider::textBoxTextColourId, Colour (0xff212121)); m_distortionSlider->setColour (Slider::textBoxBackgroundColourId, Colour (0x00000000)); m_distortionSlider->setColour (Slider::textBoxHighlightColourId, Colour (0xff1de9b6)); m_distortionSlider->setColour (Slider::textBoxOutlineColourId, Colour (0x00000000)); m_distortionSlider->addListener (this); addAndMakeVisible (m_distLabel = new Label ("Distortion Label", TRANS("DIST."))); m_distLabel->setFont (Font ("Avenir Next", 14.00f, Font::plain)); m_distLabel->setJustificationType (Justification::centred); m_distLabel->setEditable (false, false, false); m_distLabel->setColour (Label::textColourId, Colour (0xff212121)); m_distLabel->setColour (TextEditor::textColourId, Colour (0xff212121)); m_distLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); m_distLabel->setColour (TextEditor::highlightColourId, Colour (0xff1de9b6)); //[UserPreSize] m_detuneSlider->setValue(0.5); //[/UserPreSize] setSize (176, 68); //[Constructor] You can add your own custom stuff here.. //[/Constructor] }
GlyphsDemo (ControllersComponent& cc) : GraphicsDemoBase (cc, "Glyphs") { glyphs.addFittedText (Font (20.0f), "The Quick Brown Fox Jumped Over The Lazy Dog", -120, -50, 240, 100, Justification::centred, 2, 1.0f); }
int main() { const int WINDOW_WIDTH = 748;//873 const int WINDOW_HEIGHT = 440;//491 const int YARDSIZE = 12; const int FIELDW = (131*YARDSIZE); const int FIELDH = (41*YARDSIZE); const int ENDZONE = (25*YARDSIZE); const int NUMPLAYERS = 12; int x = FIELDW-WINDOW_WIDTH; int y = 0; int loop = 0; double rotation = 0; double height = -1*PI/6 ; float power = 0; bool direction = true; bool nkey = false; bool zkey = false; bool xkey = false; bool mkey = false; Team teams[2]; cout << "Welcome to the first test of College Ultimate\n"; Window test(WINDOW_WIDTH,WINDOW_HEIGHT, "College Ultimate Test", false); Field stndfield(YARDSIZE, FIELDW, FIELDH, ENDZONE); teams[0].initialize(275, FIELDH, Color(255,255,255), true, "guy1runleft.png","guy1runright.png","guy1standleft.png","guy1standright.png"); teams[1].initialize(1275, FIELDH, Color(0,0,0), false, "guy2runleft.png","guy2runright.png","guy2standleft.png","guy2standright.png"); Frisbee disc(290,FIELDH/2); test.disableAutoPageFlip(); TimerEvent clock = test.startTimer(25); //game loop while(true) { test.waitForTimerEvent(); stndfield.drawField(test, x, y); if(test.isKeyDown(NamedKey::ESCAPE)) return 0; disc.centerWindow(x,y,test); if(teams[0].getIXpos() < (FIELDW/2) ) { teams[0].hasCaught(teams[1], disc, teams[0].getCaught()+teams[1].getCaught(), rotation, teams[0].getInit()+teams[1].getInit(), FIELDW-ENDZONE, FIELDW, YARDSIZE, FIELDH); teams[1].hasCaught(teams[0], disc, teams[0].getCaught()+teams[1].getCaught(), rotation, teams[0].getInit()+teams[1].getInit(), YARDSIZE, ENDZONE+YARDSIZE, YARDSIZE, FIELDH); } else { teams[0].hasCaught(teams[1], disc, teams[0].getCaught()+teams[1].getCaught(), rotation, teams[0].getInit()+teams[1].getInit(), YARDSIZE, ENDZONE+YARDSIZE, YARDSIZE, FIELDH); teams[1].hasCaught(teams[0], disc, teams[0].getCaught()+teams[1].getCaught(), rotation, teams[0].getInit()+teams[1].getInit(), FIELDW-ENDZONE, FIELDW, YARDSIZE, FIELDH); } if(!(teams[0].getCaught()+teams[1].getCaught()) ) { disc.move(rotation,power,height, FIELDW, FIELDH, YARDSIZE); } else { //////throw sceen if(teams[1].getCaught() && (teams[1].getCaught()-1 == teams[1].isSelected()) ) { if(test.isKeyDown(NamedKey::LEFT_ARROW)) { rotation -= (0.075); } if(test.isKeyDown(NamedKey::RIGHT_ARROW)) { rotation += (0.075); } if(test.isKeyDown(NamedKey::UP_ARROW)) { if(height > -1*PI/6 ) height -= (0.075); } if(test.isKeyDown(NamedKey::DOWN_ARROW)) { if(height < -0.075 ) height += (0.075); } } if(teams[0].getCaught() && (teams[0].getCaught()-1 == teams[0].isSelected()) ) { if(test.isKeyDown('1')) { rotation -= (0.075); } if(test.isKeyDown('3')) { rotation += (0.075); } if(test.isKeyDown('5')) { if(height > -1*PI/6 ) height -= (0.075); } if(test.isKeyDown('2')) { if(height < -0.075 ) height += (0.075); } } if(teams[0].getCaught() && (teams[0].getCaught()-1 != teams[0].isSelected()) && teams[0].getInit()) { rotation = teams[0].findRotation(); } if(teams[1].getCaught() && (teams[1].getCaught()-1 != teams[1].isSelected()) && teams[1].getInit()) { rotation = teams[1].findRotation(); } disc.drawArrow(test, teams[0].givePlayer(teams[0].getCaught()-1), x, y, rotation); disc.drawArrow(test, teams[1].givePlayer(teams[1].getCaught()-1), x, y, rotation); if(test.isKeyDown('x') && !xkey && teams[1].getCaught() != false) { xkey = true; power = 0; } if(test.isKeyDown('9') && !mkey && teams[0].getCaught() != false) { mkey = true; power = 0; } if(test.isKeyDown('x') && xkey && teams[1].getCaught() != false) { if(power<8.9) power += (float)(.15); } if(test.isKeyDown('9') && mkey && teams[0].getCaught() != false) { if(power<8.9) power += (float)(.15); } if(!test.isKeyDown('9') && mkey && teams[0].getStatus()!=2 && teams[0].getCaught() != false) { mkey = false; if( teams[0].getInit() == false && teams[0].getCaught() != false) { teams[0].changeInit(true); teams[0].changeStatus(2); } teams[0].clearCaught(); teams[1].clearCaught(); disc.throwFrisbee(); for(loop = 0; loop<7; ++loop) { disc.move(rotation,power, height, FIELDW, FIELDH, YARDSIZE); } } if(!test.isKeyDown('x') && xkey && teams[1].getStatus()!=2 && teams[1].getCaught() != false) { xkey = false; if( teams[1].getInit() == false && teams[1].getCaught() != false) { teams[1].changeInit(true); teams[1].changeStatus(2); } teams[0].clearCaught(); teams[1].clearCaught(); disc.throwFrisbee(); for(loop = 0; loop<7; ++loop) { disc.move(rotation,power, height, FIELDW, FIELDH, YARDSIZE); } } ///////////////////// } if(teams[0].getStatus() == 3 && teams[1].getStatus() != 3 && teams[0].getInit() != false) disc.changeInit(teams[0].getIXpos()+30, FIELDH/2); if(teams[1].getStatus() == 3 && teams[0].getStatus() != 3 && teams[1].getInit() != false) disc.changeInit(teams[1].getIXpos()+30, FIELDH/2); if(teams[0].getStatus() == 3 || teams[1].getStatus() == 3) { teams[0].changeStatus(3); teams[1].changeStatus(3); teams[0].clearCaught(); teams[1].clearCaught(); teams[0].changeInit(false); teams[1].changeInit(false); if(teams[0].lineUp(FIELDW, FIELDH, YARDSIZE) ) teams[0].changeStatus(0); if(teams[1].lineUp(FIELDW, FIELDH, YARDSIZE) ) teams[1].changeStatus(0); disc.restart(); } //teams[0].sortClosest(disc); //teams[1].sortClosest(disc); if(test.isKeyDown('z') && !zkey) { teams[1].nextSelected(); zkey = true; } if(test.isKeyDown('7') && !nkey) { teams[0].nextSelected(); nkey = true; } if(!test.isKeyDown('z') && zkey) zkey = false; if(!test.isKeyDown('7') && nkey) nkey = false; if(teams[0].getInit()+teams[1].getInit() && (teams[1].getCaught()-1!= teams[1].isSelected()) ) { if(test.isKeyDown(NamedKey::LEFT_ARROW)) { teams[1].move(teams[1].isSelected(), -8, 0, FIELDW, FIELDH, YARDSIZE); } if(test.isKeyDown(NamedKey::RIGHT_ARROW)) { teams[1].move(teams[1].isSelected(), 8, 0, FIELDW, FIELDH, YARDSIZE); } if(test.isKeyDown(NamedKey::UP_ARROW)) { teams[1].move(teams[1].isSelected(), 0,-8, FIELDW, FIELDH, YARDSIZE); } if(test.isKeyDown(NamedKey::DOWN_ARROW)) { teams[1].move(teams[1].isSelected(), 0, 8, FIELDW, FIELDH, YARDSIZE); } } if(teams[0].getInit()+teams[1].getInit() && (teams[0].getCaught()-1!=teams[0].isSelected()) ) { if(test.isKeyDown('1')) { teams[0].move(teams[0].isSelected(), -8, 0, FIELDW, FIELDH, YARDSIZE); } if(test.isKeyDown('3')) { teams[0].move(teams[0].isSelected(), 8, 0, FIELDW, FIELDH, YARDSIZE); } if(test.isKeyDown('5')) { teams[0].move(teams[0].isSelected(), 0, -8, FIELDW, FIELDH, YARDSIZE); } if(test.isKeyDown('2')) { teams[0].move(teams[0].isSelected(), 0, 8, FIELDW, FIELDH, YARDSIZE); } } teams[0].decisiveMove(disc, teams[1], teams[0].getInit()+teams[1].getInit(), FIELDW, FIELDH, YARDSIZE); teams[1].decisiveMove(disc, teams[0], teams[0].getInit()+teams[1].getInit(), FIELDW, FIELDH, YARDSIZE); teams[0].drawTeam(test, x, y); teams[1].drawTeam(test, x, y); disc.drawFrisbee(test, x, y); //Scoreboard //test.drawRectangleFilled(Style::BLACK, 0, test.getHeight()*6/7, test.getWidth(), test.getHeight() ); test.drawText( Style(Color::WHITE, 2), Font(Font::ROMAN, 16), 5, test.getHeight()-42, "Fish"); test.drawText( Style(Color::WHITE, 2), Font(Font::ROMAN, 16), 160, test.getHeight()-42, test.numberToString(teams[0].getScore() ) ); test.drawText( Style(Color::WHITE, 2), Font(Font::ROMAN, 16), 5, test.getHeight()-17, "Veggies"); test.drawText( Style(Color::WHITE, 2), Font(Font::ROMAN, 16), 160, test.getHeight()-17, test.numberToString(teams[1].getScore() )); //Powerbar test.drawText( Style(Color::WHITE, 1.5), Font(Font::ROMAN, 10), test.getWidth()/3+40, test.getHeight()-40, "Power:"); test.drawRectangleFilled(Style(Color(255,145,0), 1), test.getWidth()/3-10, test.getHeight()-33, test.getWidth()/3-10+(power*16.666), test.getHeight()-21); test.drawRectangleOutline(Style(Color::WHITE, 1), test.getWidth()/3-10, test.getHeight()-33, test.getWidth()/3 + 140, test.getHeight()-21); //Heightbar test.drawLine( Style(Color::WHITE, 5), test.getWidth()/3 +202.5+(27.5*cos(height)), test.getHeight()-35+(27.5*sin(height)), test.getWidth()/3+202.5+(27.5*cos(height+PI)), test.getHeight()-35+(27.5*sin(height+PI))); //Feild Map test.drawRectangleFilled(Style::GREEN, test.getWidth()*3/4, test.getHeight()-55, test.getWidth()*3/4+(FIELDW/YARDSIZE), test.getHeight()-55+(FIELDH/YARDSIZE)); test.drawRectangleOutline(Style(Color::WHITE, 1), test.getWidth()*3/4, test.getHeight()-55, test.getWidth()*3/4+(FIELDW/YARDSIZE), test.getHeight()-55+(FIELDH/YARDSIZE)); test.drawRectangleOutline(Style(Color::WHITE, 1), test.getWidth()*3/4+(ENDZONE/YARDSIZE), test.getHeight()-55, test.getWidth()*3/4+(FIELDW-ENDZONE)/YARDSIZE, test.getHeight()-55+(FIELDH/YARDSIZE)); teams[0].drawPixels(test, YARDSIZE); teams[1].drawPixels(test, YARDSIZE); disc.drawPixel(test, YARDSIZE); test.flipPage(); } return 0; }
GraphViewer::GraphViewer() { labelFont = Font("Paragraph", 50, Font::plain); rootNum = 0; }
Font JucerTreeViewBase::getFont() const { return Font (getItemHeight() * 0.6f); }
Font Font::load(Canvas &canvas, const std::string &family_name, const FontDescription &reference_desc, FontFamily &font_family, const XMLResourceDocument &doc, std::function<Resource<Sprite>(Canvas &, const std::string &)> cb_get_sprite) { DomElement font_element; XMLResourceNode resource; resource = doc.get_resource(family_name); font_element = resource.get_element(); DomElement sprite_element = font_element.named_item("sprite").to_element(); if (!sprite_element.is_null()) { if (!sprite_element.has_attribute("glyphs")) throw Exception(string_format("Font resource %1 has no 'glyphs' attribute.", resource.get_name())); if (!sprite_element.has_attribute("letters")) throw Exception(string_format("Font resource %1 has no 'letters' attribute.", resource.get_name())); if (!cb_get_sprite) throw Exception(string_format("Font resource %1 requires a sprite loader callback specified.", resource.get_name())); Resource<Sprite> spr_glyphs = cb_get_sprite(canvas, sprite_element.get_attribute("glyphs")); const std::string &letters = sprite_element.get_attribute("letters"); int spacelen = StringHelp::text_to_int(sprite_element.get_attribute("spacelen", "-1")); bool monospace = StringHelp::text_to_bool(sprite_element.get_attribute("monospace", "false")); // Modify the default font metrics, if specified float height = 0.0f; float line_height = 0.0f; float ascent = 0.0f; float descent = 0.0f; float internal_leading = 0.0f; float external_leading = 0.0f; if (sprite_element.has_attribute("height")) height = StringHelp::text_to_float(sprite_element.get_attribute("height", "0")); if (sprite_element.has_attribute("line_height")) line_height = StringHelp::text_to_float(sprite_element.get_attribute("line_height", "0")); if (sprite_element.has_attribute("ascent")) ascent = StringHelp::text_to_float(sprite_element.get_attribute("ascent", "0")); if (sprite_element.has_attribute("descent")) descent = StringHelp::text_to_float(sprite_element.get_attribute("descent", "0")); if (sprite_element.has_attribute("internal_leading")) internal_leading = StringHelp::text_to_float(sprite_element.get_attribute("internal_leading", "0")); if (sprite_element.has_attribute("external_leading")) external_leading = StringHelp::text_to_float(sprite_element.get_attribute("external_leading", "0")); FontMetrics font_metrics(height, ascent, descent, internal_leading, external_leading, line_height, canvas.get_pixel_ratio()); font_family.add(canvas, spr_glyphs.get(), letters, spacelen, monospace, font_metrics); FontDescription desc = reference_desc.clone(); return Font(font_family, desc); } DomElement ttf_element = font_element.named_item("ttf").to_element(); if (ttf_element.is_null()) ttf_element = font_element.named_item("freetype").to_element(); if (!ttf_element.is_null()) { FontDescription desc = reference_desc.clone(); std::string filename; if (ttf_element.has_attribute("file")) { filename = PathHelp::combine(resource.get_base_path(), ttf_element.get_attribute("file")); } if (!ttf_element.has_attribute("typeface")) throw Exception(string_format("Font resource %1 has no 'typeface' attribute.", resource.get_name())); std::string font_typeface_name = ttf_element.get_attribute("typeface"); if (ttf_element.has_attribute("height")) desc.set_height(ttf_element.get_attribute_int("height", 0)); if (ttf_element.has_attribute("average_width")) desc.set_average_width(ttf_element.get_attribute_int("average_width", 0)); if (ttf_element.has_attribute("anti_alias")) desc.set_anti_alias(ttf_element.get_attribute_bool("anti_alias", true)); if (ttf_element.has_attribute("subpixel")) desc.set_subpixel(ttf_element.get_attribute_bool("subpixel", true)); if (filename.empty()) { font_family.add(font_typeface_name, desc); return Font(font_family, desc); } else { font_family.add(desc, filename, resource.get_file_system()); return Font(font_family, desc); } } throw Exception(string_format("Font resource %1 did not have a <sprite> or <ttf> child element", resource.get_name())); }
//============================================================================== WindowComponent::WindowComponent () : grpTextLayoutEditor (0), grpLayout (0), lblWordWrap (0), lblReadingDirection (0), lblJustification (0), lblLineSpacing (0), cmbWordWrap (0), cmbReadingDirection (0), cmbJustification (0), slLineSpacing (0), grpFont (0), lblFontFamily (0), lblFontStyle (0), tbUnderlined (0), tbStrikethrough (0), cmbFontFamily (0), cmbFontStyle (0), grpColor (0), ceColor (0), lblColor (0), grpDbgCaret (0), lblCaretPos (0), slCaretPos (0), lblCaretSelStart (0), slCaretSelStart (0), slCaretSelEnd (0), lblCaretSelEnd (0), grpDbgRanges (0), txtDbgRanges (0), txtEditor (0), tbDbgRanges (0), slFontSize (0), lblFontSize (0), grpDbgActions (0), tbR1C1 (0), tbR2C1 (0), tbR3C1 (0), tbR4C1 (0), tbR1C2 (0), tbR2C2 (0), tbR3C2 (0), tbR4C2 (0), tbR1C3 (0), tbR2C3 (0), tbR3C3 (0), tbR4C7 (0), tbR1C4 (0), tbR1C5 (0), tbR2C4 (0), tbR3C4 (0), tbR4C8 (0), tbR2C5 (0), tbR3C5 (0), tbR4C9 (0), tbR5C1 (0), tbR5C2 (0), tbR5C3 (0), tbR5C4 (0), tbR5C5 (0) { addAndMakeVisible (grpTextLayoutEditor = new GroupComponent (L"grpTextLayoutEditor", L"Text Layout Editor")); addAndMakeVisible (grpLayout = new GroupComponent (L"grpLayout", L"Layout")); addAndMakeVisible (lblWordWrap = new Label (L"lblWordWrap", L"Word Wrap:")); lblWordWrap->setFont (Font (15.0000f)); lblWordWrap->setJustificationType (Justification::centredLeft); lblWordWrap->setEditable (false, false, false); lblWordWrap->setColour (TextEditor::textColourId, Colours::black); lblWordWrap->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (lblReadingDirection = new Label (L"lblReadingDirection", L"Reading Direction:")); lblReadingDirection->setFont (Font (15.0000f)); lblReadingDirection->setJustificationType (Justification::centredLeft); lblReadingDirection->setEditable (false, false, false); lblReadingDirection->setColour (TextEditor::textColourId, Colours::black); lblReadingDirection->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (lblJustification = new Label (L"lblJustification", L"Justification:")); lblJustification->setFont (Font (15.0000f)); lblJustification->setJustificationType (Justification::centredLeft); lblJustification->setEditable (false, false, false); lblJustification->setColour (TextEditor::textColourId, Colours::black); lblJustification->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (lblLineSpacing = new Label (L"lblLineSpacing", L"Line Spacing:")); lblLineSpacing->setFont (Font (15.0000f)); lblLineSpacing->setJustificationType (Justification::centredLeft); lblLineSpacing->setEditable (false, false, false); lblLineSpacing->setColour (TextEditor::textColourId, Colours::black); lblLineSpacing->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (cmbWordWrap = new ComboBox (L"cmbWordWrap")); cmbWordWrap->setEditableText (false); cmbWordWrap->setJustificationType (Justification::centredLeft); cmbWordWrap->setTextWhenNothingSelected (String::empty); cmbWordWrap->setTextWhenNoChoicesAvailable (L"(no choices)"); cmbWordWrap->addItem (L"None", 1); cmbWordWrap->addItem (L"By Word", 2); cmbWordWrap->addItem (L"By Character", 3); cmbWordWrap->addListener (this); addAndMakeVisible (cmbReadingDirection = new ComboBox (L"cmbReadingDirection")); cmbReadingDirection->setEditableText (false); cmbReadingDirection->setJustificationType (Justification::centredLeft); cmbReadingDirection->setTextWhenNothingSelected (String::empty); cmbReadingDirection->setTextWhenNoChoicesAvailable (L"(no choices)"); cmbReadingDirection->addItem (L"Natural", 1); cmbReadingDirection->addItem (L"Left to Right", 2); cmbReadingDirection->addItem (L"Right to Left", 3); cmbReadingDirection->addListener (this); addAndMakeVisible (cmbJustification = new ComboBox (L"cmbJustification")); cmbJustification->setEditableText (false); cmbJustification->setJustificationType (Justification::centredLeft); cmbJustification->setTextWhenNothingSelected (String::empty); cmbJustification->setTextWhenNoChoicesAvailable (L"(no choices)"); cmbJustification->addItem (L"Left", 1); cmbJustification->addItem (L"Right", 2); cmbJustification->addItem (L"Centered", 3); cmbJustification->addItem (L"Justified", 4); cmbJustification->addListener (this); addAndMakeVisible (slLineSpacing = new Slider (L"slLineSpacing")); slLineSpacing->setRange (0, 10, 0.01); slLineSpacing->setSliderStyle (Slider::IncDecButtons); slLineSpacing->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slLineSpacing->addListener (this); addAndMakeVisible (grpFont = new GroupComponent (L"grpFont", L"Font")); addAndMakeVisible (lblFontFamily = new Label (L"lblFontFamily", L"Font Family:")); lblFontFamily->setFont (Font (15.0000f)); lblFontFamily->setJustificationType (Justification::centredLeft); lblFontFamily->setEditable (false, false, false); lblFontFamily->setColour (TextEditor::textColourId, Colours::black); lblFontFamily->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (lblFontStyle = new Label (L"lblFontStyle", L"Font Style:")); lblFontStyle->setFont (Font (15.0000f)); lblFontStyle->setJustificationType (Justification::centredLeft); lblFontStyle->setEditable (false, false, false); lblFontStyle->setColour (TextEditor::textColourId, Colours::black); lblFontStyle->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (tbUnderlined = new ToggleButton (L"new toggle button")); tbUnderlined->setButtonText (L"Underlined"); tbUnderlined->addListener (this); addAndMakeVisible (tbStrikethrough = new ToggleButton (L"new toggle button")); tbStrikethrough->setButtonText (L"Strikethrough"); tbStrikethrough->addListener (this); addAndMakeVisible (cmbFontFamily = new ComboBox (L"cmbFontFamily")); cmbFontFamily->setEditableText (false); cmbFontFamily->setJustificationType (Justification::centredLeft); cmbFontFamily->setTextWhenNothingSelected (String::empty); cmbFontFamily->setTextWhenNoChoicesAvailable (L"(no choices)"); cmbFontFamily->addListener (this); addAndMakeVisible (cmbFontStyle = new ComboBox (L"cmbFontStyle")); cmbFontStyle->setEditableText (false); cmbFontStyle->setJustificationType (Justification::centredLeft); cmbFontStyle->setTextWhenNothingSelected (String::empty); cmbFontStyle->setTextWhenNoChoicesAvailable (L"(no choices)"); cmbFontStyle->addListener (this); addAndMakeVisible (grpColor = new GroupComponent (L"grpColor", L"Color")); addAndMakeVisible (ceColor = new ColourEditorComponent(false)); ceColor->setName (L"ceColor"); addAndMakeVisible (lblColor = new Label (L"lblColor", L"Color:")); lblColor->setFont (Font (15.0000f)); lblColor->setJustificationType (Justification::centredLeft); lblColor->setEditable (false, false, false); lblColor->setColour (TextEditor::textColourId, Colours::black); lblColor->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (grpDbgCaret = new GroupComponent (L"grpDbgCaret", L"Debug Caret")); addAndMakeVisible (lblCaretPos = new Label (L"lblCaretPos", L"Caret Position")); lblCaretPos->setFont (Font (15.0000f)); lblCaretPos->setJustificationType (Justification::centredLeft); lblCaretPos->setEditable (false, false, false); lblCaretPos->setColour (TextEditor::textColourId, Colours::black); lblCaretPos->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (slCaretPos = new Slider (L"slCaretPos")); slCaretPos->setRange (0, 1000000, 1); slCaretPos->setSliderStyle (Slider::IncDecButtons); slCaretPos->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slCaretPos->addListener (this); addAndMakeVisible (lblCaretSelStart = new Label (L"lblCaretSelStart", L"Selection Start")); lblCaretSelStart->setFont (Font (15.0000f)); lblCaretSelStart->setJustificationType (Justification::centredLeft); lblCaretSelStart->setEditable (false, false, false); lblCaretSelStart->setColour (TextEditor::textColourId, Colours::black); lblCaretSelStart->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (slCaretSelStart = new Slider (L"slCaretSelStart")); slCaretSelStart->setRange (0, 1000000, 1); slCaretSelStart->setSliderStyle (Slider::IncDecButtons); slCaretSelStart->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slCaretSelStart->addListener (this); addAndMakeVisible (slCaretSelEnd = new Slider (L"slCaretSelEnd")); slCaretSelEnd->setRange (0, 1000000, 1); slCaretSelEnd->setSliderStyle (Slider::IncDecButtons); slCaretSelEnd->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slCaretSelEnd->addListener (this); addAndMakeVisible (lblCaretSelEnd = new Label (L"lblCaretSelEnd", L"Selection End")); lblCaretSelEnd->setFont (Font (15.0000f)); lblCaretSelEnd->setJustificationType (Justification::centredLeft); lblCaretSelEnd->setEditable (false, false, false); lblCaretSelEnd->setColour (TextEditor::textColourId, Colours::black); lblCaretSelEnd->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (grpDbgRanges = new GroupComponent (L"grpDbgRanges", L"Debug Ranges")); addAndMakeVisible (txtDbgRanges = new TextEditor (L"txtDbgRanges")); txtDbgRanges->setMultiLine (true); txtDbgRanges->setReturnKeyStartsNewLine (true); txtDbgRanges->setReadOnly (false); txtDbgRanges->setScrollbarsShown (true); txtDbgRanges->setCaretVisible (true); txtDbgRanges->setPopupMenuEnabled (true); txtDbgRanges->setText (String::empty); addAndMakeVisible (txtEditor = new TextEditor (L"txtEditor")); txtEditor->setMultiLine (true); txtEditor->setReturnKeyStartsNewLine (true); txtEditor->setReadOnly (false); txtEditor->setScrollbarsShown (true); txtEditor->setCaretVisible (true); txtEditor->setPopupMenuEnabled (true); txtEditor->setText (String::empty); addAndMakeVisible (tbDbgRanges = new TextButton (L"tbDbgRanges")); tbDbgRanges->setButtonText (L"Update"); tbDbgRanges->addListener (this); addAndMakeVisible (slFontSize = new Slider (L"slFontSize")); slFontSize->setRange (0, 256, 0.0001); slFontSize->setSliderStyle (Slider::IncDecButtons); slFontSize->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slFontSize->addListener (this); addAndMakeVisible (lblFontSize = new Label (L"lblFontSize", L"Font Size:")); lblFontSize->setFont (Font (15.0000f)); lblFontSize->setJustificationType (Justification::centredLeft); lblFontSize->setEditable (false, false, false); lblFontSize->setColour (TextEditor::textColourId, Colours::black); lblFontSize->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (grpDbgActions = new GroupComponent (L"grpDbgActions", L"Debug Actions")); addAndMakeVisible (tbR1C1 = new TextButton (L"tbR1C1")); tbR1C1->addListener (this); addAndMakeVisible (tbR2C1 = new TextButton (L"tbR2C1")); tbR2C1->addListener (this); addAndMakeVisible (tbR3C1 = new TextButton (L"tbR3C1")); tbR3C1->addListener (this); addAndMakeVisible (tbR4C1 = new TextButton (L"tbR4C1")); tbR4C1->addListener (this); addAndMakeVisible (tbR1C2 = new TextButton (L"tbR1C2")); tbR1C2->addListener (this); addAndMakeVisible (tbR2C2 = new TextButton (L"tbR2C2")); tbR2C2->addListener (this); addAndMakeVisible (tbR3C2 = new TextButton (L"tbR3C2")); tbR3C2->addListener (this); addAndMakeVisible (tbR4C2 = new TextButton (L"tbR4C2")); tbR4C2->addListener (this); addAndMakeVisible (tbR1C3 = new TextButton (L"tbR1C3")); tbR1C3->addListener (this); addAndMakeVisible (tbR2C3 = new TextButton (L"tbR2C3")); tbR2C3->addListener (this); addAndMakeVisible (tbR3C3 = new TextButton (L"tbR3C3")); tbR3C3->addListener (this); addAndMakeVisible (tbR4C7 = new TextButton (L"tbR4C3")); tbR4C7->addListener (this); addAndMakeVisible (tbR1C4 = new TextButton (L"tbR1C4")); tbR1C4->addListener (this); addAndMakeVisible (tbR1C5 = new TextButton (L"tbR1C5")); tbR1C5->addListener (this); addAndMakeVisible (tbR2C4 = new TextButton (L"tbR2C4")); tbR2C4->addListener (this); addAndMakeVisible (tbR3C4 = new TextButton (L"tbR3C4")); tbR3C4->addListener (this); addAndMakeVisible (tbR4C8 = new TextButton (L"tbR4C4")); tbR4C8->addListener (this); addAndMakeVisible (tbR2C5 = new TextButton (L"tbR2C5")); tbR2C5->addListener (this); addAndMakeVisible (tbR3C5 = new TextButton (L"tbR3C5")); tbR3C5->addListener (this); addAndMakeVisible (tbR4C9 = new TextButton (L"tbR4C5")); tbR4C9->addListener (this); addAndMakeVisible (tbR5C1 = new TextButton (L"tbR5C1")); tbR5C1->addListener (this); addAndMakeVisible (tbR5C2 = new TextButton (L"tbR5C2")); tbR5C2->addListener (this); addAndMakeVisible (tbR5C3 = new TextButton (L"tbR5C3")); tbR5C3->addListener (this); addAndMakeVisible (tbR5C4 = new TextButton (L"tbR5C4")); tbR5C4->addListener (this); addAndMakeVisible (tbR5C5 = new TextButton (L"tbR5C5")); tbR5C5->addListener (this); //[UserPreSize] //[/UserPreSize] setSize (600, 400); //[Constructor] You can add your own custom stuff here.. cmbWordWrap->setText("None"); cmbReadingDirection->setText("Natural"); cmbJustification->setText("Left"); cmbFontFamily->addItemList(Font::findAllTypefaceFamilies(), 1); cmbFontFamily->setText("Verdana"); slFontSize->setValue(15.0000f); //[/Constructor] }
void HintOverlay::paint(Graphics &g) { // see which button has been pressed const int modifierStatus = processor->getModifierBtnState(); // if no button is pressed then don't display the hint if (modifierStatus == MappingEngine::rmNoBtn) return; // start with the background colour g.setColour(Colours::black.withAlpha(0.5f)); g.fillRect(overlayPaintBounds); // TODO: should be not hardcoded. const int numMappings = 8; int buttonPadding; if (numMappings > 8) { buttonPadding = PAD_AMOUNT/2; g.setFont(Font("Verdana", 12.f, Font::plain)); } else { buttonPadding = PAD_AMOUNT; g.setFont(Font("Verdana", 16.f, Font::plain)); } const int buttonSize = (overlayPaintBounds.getWidth() - (numMappings + 1) * buttonPadding) / numMappings; for (int i = 0; i < numMappings; ++i) { const float xPos = (float) ((buttonPadding + buttonSize)*i + buttonPadding); const float yPos = (overlayPaintBounds.getHeight() - buttonSize) / 2.0f; // highlight any mappings that are held if (processor->isColumnHeld(i)) g.setColour(Colours::orange); else g.setColour(Colours::white.withAlpha(0.9f)); g.fillRoundedRectangle(xPos, yPos, (float) buttonSize, (float) buttonSize, buttonSize/10.0f); if (i > 7) break; // get the ID of the mapping associated with this type of modifier button const int currentMapping = processor->getMonomeMapping(modifierStatus, i); // and find out what its name is const String mappingName = processor->mappingEngine.getMappingName(modifierStatus, currentMapping); g.setColour(Colours::black); //g.drawMultiLineText(mappingName, xPos+2, yPos+10, buttonSize); g.drawFittedText(mappingName, (int) (xPos) + 1, (int) (yPos) + 1, buttonSize-2, buttonSize-2, Justification::centred, 4, 1.0f); } }
//============================================================================== WaveGenerationComponent::WaveGenerationComponent () { //[Constructor_pre] You can add your own custom stuff here.. //[/Constructor_pre] addAndMakeVisible (comboBox = new ComboBox ("new combo box")); comboBox->setEditableText (false); comboBox->setJustificationType (Justification::centredLeft); comboBox->setTextWhenNothingSelected (String::empty); comboBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); comboBox->addItem (TRANS("Sine"), 1); comboBox->addItem (TRANS("Square"), 2); comboBox->addItem (TRANS("Saw"), 3); comboBox->addItem (TRANS("Triangle"), 4); comboBox->addItem (TRANS("Noise"), 5); comboBox->addListener (this); addAndMakeVisible (slider = new Slider ("new slider")); slider->setRange (0, 10, 0); slider->setSliderStyle (Slider::IncDecButtons); slider->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider->addListener (this); addAndMakeVisible (slider2 = new Slider ("new slider")); slider2->setRange (0, 10, 0); slider2->setSliderStyle (Slider::IncDecButtons); slider2->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); slider2->addListener (this); addAndMakeVisible (slider3 = new Slider ("new slider")); slider3->setRange (0, 10, 0); slider3->setSliderStyle (Slider::RotaryVerticalDrag); slider3->setTextBoxStyle (Slider::TextBoxBelow, false, 80, 20); slider3->addListener (this); addAndMakeVisible (label = new Label ("new label", TRANS("Octave"))); 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("Pitch"))); 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("Detune"))); label3->setFont (Font (15.00f, Font::plain)); label3->setJustificationType (Justification::centred); label3->setEditable (false, false, false); label3->setColour (TextEditor::textColourId, Colours::black); label3->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); //[UserPreSize] //[/UserPreSize] setSize (600, 400); //[Constructor] You can add your own custom stuff here.. //[/Constructor] }
Font CtrlrLookAndFeel::getSliderPopupFont(Slider &) { return (owner.getFontManager().getFontFromString(getPanelProperty(Ids::uiPanelTooltipFont, Font(15.0f, Font::bold).toString()))); }
//============================================================================== Content::Content () : Component ("Content") { addAndMakeVisible (GroupServer = new GroupComponent ("GroupServer", "Server")); addAndMakeVisible (GroupSettings = new GroupComponent ("GroupSettings", "Settings")); addAndMakeVisible (InputDevices = new ComboBox ("InputDevices")); InputDevices->setEditableText (false); InputDevices->setJustificationType (Justification::centredLeft); InputDevices->setTextWhenNothingSelected ("(no server)"); InputDevices->setTextWhenNoChoicesAvailable ("(no server)"); InputDevices->addListener (this); addAndMakeVisible (LabelInputDevice = new Label ("LabelInputDevice", "Input Device:")); LabelInputDevice->setFont (Font (15.00f, Font::plain)); LabelInputDevice->setJustificationType (Justification::centredRight); LabelInputDevice->setEditable (false, false, false); LabelInputDevice->setColour (TextEditor::textColourId, Colours::black); LabelInputDevice->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (OutputDevices = new ComboBox ("OutputDevices")); OutputDevices->setEditableText (false); OutputDevices->setJustificationType (Justification::centredLeft); OutputDevices->setTextWhenNothingSelected ("(no server)"); OutputDevices->setTextWhenNoChoicesAvailable ("(no server)"); OutputDevices->addListener (this); addAndMakeVisible (LabelOutputDevice = new Label ("LabelOutputDevice", "Output Device:")); LabelOutputDevice->setFont (Font (15.00f, Font::plain)); LabelOutputDevice->setJustificationType (Justification::centredRight); LabelOutputDevice->setEditable (false, false, false); LabelOutputDevice->setColour (TextEditor::textColourId, Colours::black); LabelOutputDevice->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (SampleRate = new ComboBox ("SampleRate")); SampleRate->setEditableText (false); SampleRate->setJustificationType (Justification::centredLeft); SampleRate->setTextWhenNothingSelected ("(no server)"); SampleRate->setTextWhenNoChoicesAvailable ("(no choices)"); SampleRate->addItem ("44100", 1); SampleRate->addItem ("48000", 2); SampleRate->addItem ("88200", 3); SampleRate->addItem ("96000", 4); SampleRate->addListener (this); addAndMakeVisible (LabelSampleRate = new Label ("LabelSampleRate", "Sample Rate:")); LabelSampleRate->setFont (Font (15.00f, Font::plain)); LabelSampleRate->setJustificationType (Justification::centredRight); LabelSampleRate->setEditable (false, false, false); LabelSampleRate->setColour (TextEditor::textColourId, Colours::black); LabelSampleRate->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (LabelServerAddress = new Label ("LabelServerAddress", "Server Address:")); LabelServerAddress->setFont (Font (15.00f, Font::plain)); LabelServerAddress->setJustificationType (Justification::centredRight); LabelServerAddress->setEditable (false, false, false); LabelServerAddress->setColour (TextEditor::textColourId, Colours::black); LabelServerAddress->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (Server = new ComboBox ("Server")); Server->setEditableText (true); Server->setJustificationType (Justification::centredLeft); Server->setTextWhenNothingSelected (String::empty); Server->setTextWhenNoChoicesAvailable ("(no choices)"); Server->addItem ("127.0.0.1", 1); Server->addListener (this); addAndMakeVisible (LabelInput = new Label ("LabelInput", "I N P U T S")); LabelInput->setFont (Font (15.00f, Font::plain)); LabelInput->setJustificationType (Justification::centredLeft); LabelInput->setEditable (false, false, false); LabelInput->setColour (TextEditor::textColourId, Colours::black); LabelInput->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (LabelInput2 = new Label ("LabelInput", "O\nU\nT\nP\nU\nT\nS")); LabelInput2->setFont (Font (15.00f, Font::plain)); LabelInput2->setJustificationType (Justification::centredTop); LabelInput2->setEditable (false, false, false); LabelInput2->setColour (TextEditor::textColourId, Colours::black); LabelInput2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (textButton = new TextButton ("new button")); textButton->setButtonText ("Resync"); textButton->addListener (this); textButton->setColour (TextButton::buttonColourId, Colour (0xffff8a8a)); textButton->setColour (TextButton::buttonOnColourId, Colour (0xffff7373)); //[UserPreSize] addAndMakeVisible (matrixView = new MatrixView()); matrixView->setName ("MatrixView"); matrixView->setBounds (368, 32, 224, 152); //[/UserPreSize] setSize (450, 250); //[Constructor] You can add your own custom stuff here.. //[/Constructor] }
ProcessorList::ProcessorList() : isDragging(false), totalHeight(800), itemHeight(32), subItemHeight(22), xBuffer(1), yBuffer(1) { listFontLight = Font("Default Light", 25, Font::plain); listFontPlain = Font("Default", 20, Font::plain); setColour(PROCESSOR_COLOR, Colour(59, 59, 59)); setColour(FILTER_COLOR, Colour(0, 174, 239)); setColour(SINK_COLOR, Colour(0, 166, 81)); setColour(SOURCE_COLOR, Colour(241, 90, 41)); setColour(UTILITY_COLOR, Colour(147, 149, 152)); ProcessorListItem* sources = new ProcessorListItem("Sources"); //sources->addSubItem(new ProcessorListItem("RHA2000-EVAL")); //sources->addSubItem(new ProcessorListItem("Signal Generator")); //sources->addSubItem(new ProcessorListItem("Custom FPGA")); sources->addSubItem(new ProcessorListItem("Rhythm FPGA")); sources->addSubItem(new ProcessorListItem("File Reader")); //sources->addSubItem(new ProcessorListItem("Network Events")); sources->addSubItem(new ProcessorListItem("Serial Port")); //sources->addSubItem(new ProcessorListItem("Event Generator")); ProcessorListItem* filters = new ProcessorListItem("Filters"); filters->addSubItem(new ProcessorListItem("Bandpass Filter")); filters->addSubItem(new ProcessorListItem("Spike Detector")); //filters->addSubItem(new ProcessorListItem("Resampler")); filters->addSubItem(new ProcessorListItem("Phase Detector")); //filters->addSubItem(new ProcessorListItem("Digital Ref")); filters->addSubItem(new ProcessorListItem("Channel Map")); //filters->addSubItem(new ProcessorListItem("Eye Tracking")); ProcessorListItem* sinks = new ProcessorListItem("Sinks"); sinks->addSubItem(new ProcessorListItem("LFP Viewer")); //sinks->addSubItem(new ProcessorListItem("LFP Trig. Avg.")); sinks->addSubItem(new ProcessorListItem("Spike Viewer")); //sinks->addSubItem(new ProcessorListItem("PSTH")); //sinks->addSubItem(new ProcessorListItem("Network Sink")); //sinks->addSubItem(new ProcessorListItem("WiFi Output")); //sinks->addSubItem(new ProcessorListItem("Arduino Output")); // sinks->addSubItem(new ProcessorListItem("FPGA Output")); sinks->addSubItem(new ProcessorListItem("Pulse Pal")); ProcessorListItem* utilities = new ProcessorListItem("Utilities"); utilities->addSubItem(new ProcessorListItem("Splitter")); utilities->addSubItem(new ProcessorListItem("Merger")); utilities->addSubItem(new ProcessorListItem("Record Control")); //utilities->addSubItem(new ProcessorListItem("Advancers")); baseItem = new ProcessorListItem("Processors"); baseItem->addSubItem(sources); baseItem->addSubItem(filters); baseItem->addSubItem(sinks); baseItem->addSubItem(utilities); // set parent names / colors baseItem->setParentName("Processors"); for (int n = 0; n < baseItem->getNumSubItems(); n++) { const String category = baseItem->getSubItem(n)->getName(); baseItem->getSubItem(n)->setParentName(category); for (int m = 0; m < baseItem->getSubItem(n)->getNumSubItems(); m++) { baseItem->getSubItem(n)->getSubItem(m)->setParentName(category);// = category; } } }
//============================================================================== //transport controls //============================================================================== TransportComponent::TransportComponent(SidebarPanel &ownerPanel, String name): owner(ownerPanel), PropertyComponent(name, 70), lookAndFeel(), playButton("playButton", DrawableButton::ImageOnButtonBackground), stopButton("stopButton", DrawableButton::ImageOnButtonBackground), bpmSlider("bpmSlider"), timeLabel("TimeLabel"), beatsLabel("beatsLabel"), timingInfoBox(), standardLookAndFeel(new LookAndFeel_V2()) { bpmSlider.setSliderStyle(Slider::SliderStyle::LinearBarVertical); bpmSlider.setRange(1, 500, 1); bpmSlider.setValue(60, dontSendNotification); bpmSlider.addListener(this); bpmSlider.setVelocityBasedMode(true); bpmSlider.setColour(Slider::ColourIds::thumbColourId, Colours::black); bpmSlider.setColour(Slider::ColourIds::textBoxTextColourId, Colours::white); bpmSlider.setColour(Slider::ColourIds::textBoxBackgroundColourId, Colours::black); timeSigNum.setSliderStyle(Slider::SliderStyle::LinearBarVertical); timeSigNum.setRange(1, 24, 1); timeSigNum.setValue(4, dontSendNotification); timeSigNum.addListener(this); timeSigNum.setColour(Slider::ColourIds::thumbColourId, Colours::black); timeSigNum.setColour(Slider::ColourIds::textBoxTextColourId, Colours::white); timeSigNum.setColour(Slider::ColourIds::textBoxBackgroundColourId, Colours::black); timeSigDen.setSliderStyle(Slider::SliderStyle::LinearBarVertical); timeSigDen.setRange(1, 24, 1); timeSigDen.setValue(4, dontSendNotification); timeSigDen.addListener(this); timeSigDen.setColour(Slider::ColourIds::thumbColourId, Colours::black); timeSigDen.setColour(Slider::ColourIds::textBoxTextColourId, Colours::white); timeSigDen.setColour(Slider::ColourIds::textBoxBackgroundColourId, Colours::black); bpmSlider.setVelocityModeParameters(0.9); bpmSlider.setTextValueSuffix(" BPM"); timeLabel.setJustificationType(Justification::left); timeLabel.setFont(Font(24, 1)); timeLabel.setLookAndFeel(standardLookAndFeel); timeLabel.setColour(Label::backgroundColourId, Colours::black); timeLabel.setColour(Label::textColourId, Colours::cornflowerblue); timeLabel.setText("00 : 00 : 00", dontSendNotification); beatsLabel.setJustificationType(Justification::right); beatsLabel.setFont(Font(18, 1)); beatsLabel.setLookAndFeel(standardLookAndFeel); beatsLabel.setColour(Label::backgroundColourId, Colours::black); beatsLabel.setColour(Label::textColourId, Colours::cornflowerblue); beatsLabel.setText("Beat 1", dontSendNotification); playButton.setLookAndFeel(&lookAndFeel); playButton.setColour(TextButton::buttonColourId, Colours::green.darker(.8f)); playButton.setColour(TextButton::buttonOnColourId, Colours::yellow); playButton.setClickingTogglesState(true); stopButton.setLookAndFeel(&lookAndFeel); stopButton.setColour(TextButton::buttonColourId, Colours::green.darker(.8f)); playButton.setImages(cUtils::createPlayButtonPath(30, Colours::white), cUtils::createPlayButtonPath(30, Colours::white), cUtils::createPauseButtonPath(30), cUtils::createPauseButtonPath(30), cUtils::createPauseButtonPath(30)); stopButton.setImages(cUtils::createStopButtonPath(30, Colours::white)); addAndMakeVisible (timingInfoBox); addAndMakeVisible (playButton); addAndMakeVisible (stopButton); addAndMakeVisible (bpmSlider); addAndMakeVisible (bpmLabel); addAndMakeVisible (timeLabel); addAndMakeVisible (beatsLabel); // addAndMakeVisible (timeSigNum); // addAndMakeVisible (timeSigDen); playButton.addListener (this); stopButton.addListener (this); }
////////////////////////////////////////////////////////////////////// // Called to draw an overlay bitmap containing items that // does not need to be recreated every fft data update. ////////////////////////////////////////////////////////////////////// void CMeter::DrawOverlay() { if(m_OverlayPixmap.isNull()) return; int w = m_OverlayPixmap.width(); int h = m_OverlayPixmap.height(); int x,y; QRect rect; QPainter painter(&m_OverlayPixmap); m_OverlayPixmap.fill(QColor(0x20,0x20,0x20,0xFF)); #if 0 //fill background with gradient QLinearGradient gradient(0, 0, 0 ,h); gradient.setColorAt(1, Qt::black); gradient.setColorAt(0, Qt::black); painter.setBrush(gradient); painter.drawRect(0, 0, w, h); #endif //Draw scale lines qreal marg = (qreal)w*CTRL_MARGIN; qreal hline = (qreal)h*CTRL_XAXIS_HEGHT; qreal magstart = (qreal)h*CTRL_MAJOR_START; qreal minstart = (qreal)h*CTRL_MINOR_START; qreal hstop = (qreal)w-marg; painter.setPen(QPen(Qt::white, 1, Qt::SolidLine)); painter.drawLine(QLineF(marg, hline, hstop, hline)); // top line with ticks painter.drawLine(QLineF(marg, hline+8, hstop, hline+8)); // bottom line qreal xpos = marg; for(x=0; x<11; x++) { if(x&1) //minor tics painter.drawLine( QLineF(xpos, minstart, xpos, hline) ); else painter.drawLine( QLineF(xpos, magstart, xpos, hline) ); xpos += (hstop-marg)/10.0; } //draw scale text //create Font to use for scales QFont Font("Arial"); QFontMetrics metrics(Font); y = h/4; Font.setPixelSize(y); Font.setWeight(QFont::Normal); painter.setFont(Font); int rwidth = (int)((hstop-marg)/5.0); m_Str = "-100"; rect.setRect(marg/2-5, 0, rwidth, magstart); for (x = MIN_DB; x <= MAX_DB; x += 20) { m_Str.setNum(x); painter.drawText(rect, Qt::AlignHCenter|Qt::AlignVCenter, m_Str); rect.translate(rwidth, 0); } /* for(x=1; x<=9; x+=2) { m_Str.setNum(x); painter.drawText(rect, Qt::AlignHCenter|Qt::AlignVCenter, m_Str); rect.translate( rwidth,0); } painter.setPen(QPen(Qt::red, 1,Qt::SolidLine)); for(x=20; x<=60; x+=20) { m_Str = "+" + m_Str.setNum(x); painter.drawText(rect, Qt::AlignHCenter|Qt::AlignVCenter, m_Str); rect.translate( rwidth,0); } */ }
//============================================================================== AmplitudeToPhase::AmplitudeToPhase () : Component (T("AmplitudeToPhase")), groupComponent (0), amplitude_multiplierslider (0), label (0), textButton (0), resetbutton (0), label2 (0), textButton2 (0) { addAndMakeVisible (groupComponent = new GroupComponent (T("new group"), T("Amplitude->Phase"))); groupComponent->setTextLabelPosition (Justification::centredLeft); groupComponent->setColour (GroupComponent::outlineColourId, Colour (0xb0000000)); addAndMakeVisible (amplitude_multiplierslider = new Slider (T("new slider"))); amplitude_multiplierslider->setRange (0, 100, 0); amplitude_multiplierslider->setSliderStyle (Slider::LinearHorizontal); amplitude_multiplierslider->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20); amplitude_multiplierslider->setColour (Slider::backgroundColourId, Colour (0x956565)); amplitude_multiplierslider->setColour (Slider::thumbColourId, Colour (0x79fffcfc)); amplitude_multiplierslider->setColour (Slider::textBoxBackgroundColourId, Colour (0xffffff)); amplitude_multiplierslider->addListener (this); addAndMakeVisible (label = new Label (T("new label"), T("Amplitude multiplier (0-100)"))); label->setFont (Font (15.0000f, Font::plain)); label->setJustificationType (Justification::centredLeft); label->setEditable (false, false, false); label->setColour (Label::backgroundColourId, Colour (0x0)); label->setColour (Label::textColourId, Colours::black); label->setColour (Label::outlineColourId, Colour (0x0)); label->setColour (TextEditor::textColourId, Colours::black); label->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (textButton = new TextButton (T("new button"))); textButton->setButtonText (T("Do it!")); textButton->addListener (this); textButton->setColour (TextButton::buttonColourId, Colour (0x4bbbbbff)); addAndMakeVisible (resetbutton = new TextButton (T("resetbutton"))); resetbutton->setButtonText (T("reset")); resetbutton->addListener (this); resetbutton->setColour (TextButton::buttonColourId, Colour (0x40bbbbff)); addAndMakeVisible (label2 = new Label (T("new label"), T("The phases of the partials are set to their respective amplitudes, after a specified gain multiplication. Rather useless."))); label2->setFont (Font (15.0000f, Font::plain)); label2->setJustificationType (Justification::centredLeft); label2->setEditable (false, false, false); label2->setColour (Label::backgroundColourId, Colour (0x0)); label2->setColour (Label::textColourId, Colours::black); label2->setColour (Label::outlineColourId, Colour (0x0)); label2->setColour (TextEditor::textColourId, Colours::black); label2->setColour (TextEditor::backgroundColourId, Colour (0x0)); addAndMakeVisible (textButton2 = new TextButton (T("new button"))); textButton2->setButtonText (T("Redo it!")); textButton2->addListener (this); textButton2->setColour (TextButton::buttonColourId, Colour (0x40bbbbff)); setSize (600, 400); //[Constructor] You can add your own custom stuff here.. buttonClicked(resetbutton); #undef Slider //[/Constructor] }
////////////////////////////////////////////////////////////////////// // Called to draw an overlay bitmap containing grid and text that // does not need to be recreated every fft data update. ////////////////////////////////////////////////////////////////////// void CPlotter::DrawOverlay() { if (m_OverlayPixmap.isNull()) return; int w = m_OverlayPixmap.width(); int h = m_OverlayPixmap.height(); int x,y; float pixperdiv; QRect rect; QPainter painter(&m_OverlayPixmap); painter.initFrom(this); // horizontal grids (size and grid calcs could be moved to resize) m_VerDivs = h/m_VdivDelta+1; m_HorDivs = w/m_HdivDelta; if (m_HorDivs % 2) m_HorDivs++; // we want an odd number of divs so that we have a center line //m_OverlayPixmap.fill(Qt::black); //fill background with gradient QLinearGradient gradient(0, 0, 0 ,h); gradient.setColorAt(0, QColor(0x20,0x20,0x20,0xFF)); gradient.setColorAt(1, QColor(0x4F,0x4F,0x4F,0xFF)); painter.setBrush(gradient); painter.drawRect(0, 0, w, h); //Draw demod filter box if (m_FilterBoxEnabled) { ClampDemodParameters(); m_DemodFreqX = XfromFreq(m_DemodCenterFreq); m_DemodLowCutFreqX = XfromFreq(m_DemodCenterFreq + m_DemodLowCutFreq); m_DemodHiCutFreqX = XfromFreq(m_DemodCenterFreq + m_DemodHiCutFreq); int dw = m_DemodHiCutFreqX - m_DemodLowCutFreqX; painter.setBrush(Qt::SolidPattern); painter.setOpacity(0.3); painter.fillRect(m_DemodLowCutFreqX, 0, dw, h, Qt::gray); painter.setOpacity(1.0); painter.setPen(QPen(QColor(0xFF,0x71,0x71,0xFF), 1, Qt::SolidLine)); painter.drawLine(m_DemodFreqX, 0, m_DemodFreqX, h); } //create Font to use for scales QFont Font("Arial"); Font.setPointSize(m_FontSize); QFontMetrics metrics(Font); Font.setWeight(QFont::Normal); painter.setFont(Font); // draw vertical grids pixperdiv = (float)w / (float)m_HorDivs; y = h - h/m_VerDivs/2; for (int i = 1; i < m_HorDivs; i++) { x = (int)((float)i*pixperdiv); if ((i == m_HorDivs/2) && m_CenterLineEnabled) // center line painter.setPen(QPen(QColor(0x78,0x82,0x96,0xFF), 1, Qt::SolidLine)); else painter.setPen(QPen(QColor(0xF0,0xF0,0xF0,0x30), 1, Qt::DotLine)); painter.drawLine(x, 0, x , y); } //draw frequency values MakeFrequencyStrs(); painter.setPen(QColor(0xD8,0xBA,0xA1,0xFF)); y = h - (h/m_VerDivs); for (int i = 1; i < m_HorDivs; i++) { x = (int)((float)i*pixperdiv - pixperdiv/2); rect.setRect(x, y, (int)pixperdiv, h/m_VerDivs); painter.drawText(rect, Qt::AlignHCenter|Qt::AlignBottom, m_HDivText[i]); } m_dBStepSize = abs(m_MaxdB-m_MindB)/(double)m_VerDivs; pixperdiv = (float)h / (float)m_VerDivs; painter.setPen(QPen(QColor(0xF0,0xF0,0xF0,0x30), 1,Qt::DotLine)); for (int i = 1; i < m_VerDivs; i++) { y = (int)((float) i*pixperdiv); painter.drawLine(5*metrics.width("0",-1), y, w, y); } //draw amplitude values painter.setPen(QColor(0xD8,0xBA,0xA1,0xFF)); //Font.setWeight(QFont::Light); painter.setFont(Font); int dB = m_MaxdB; m_YAxisWidth = metrics.width("-120 "); for (int i = 1; i < m_VerDivs; i++) { dB -= m_dBStepSize; /* move to end if want to include maxdb */ y = (int)((float)i*pixperdiv); rect.setRect(0, y-metrics.height()/2, m_YAxisWidth, metrics.height()); painter.drawText(rect, Qt::AlignRight|Qt::AlignVCenter, QString::number(dB)); } if (!m_Running) { //if not running so is no data updates to draw to screen //copy into 2Dbitmap the overlay bitmap. m_2DPixmap = m_OverlayPixmap.copy(0,0,w,h); //trigger a new paintEvent update(); } }
void CtrlrLuaMethodEditArea::insertOutput(const String &textToInsert, const Colour what) { output->setCaretPosition(output->getText().length()); output->insertText (textToInsert, Font (owner.getOwner().getOwner().getFontManager().getDefaultMonoFontName(), 16.0f, Font::plain), what); }
//---------------------------------------------------------------------------- static uint font_family_table[] = { FF_DONTCARE, // DEFAULT_FAMILY FF_DECORATIVE, // DECORATIVE FF_MODERN, // MODERN FF_ROMAN, // ROMAN FF_SCRIPT, // SCRIPT FF_SWISS // SWISS }; //---------------------------------------------------------------------------- static Font system_font = Font("Tahoma", 8); //---------------------------------------------------------------------------- static void SetRect(RECT* r, const Rect& rect) { r->left = rect.Left(); r->top = rect.Top(); r->right = rect.Right(); r->bottom = rect.Bottom(); } //---------------------------------------------------------------------------- WinGraphics::WinGraphics() : m_dc(0),
JUCE_COMRESULT DrawGlyphRun (void* clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_MEASURING_MODE, DWRITE_GLYPH_RUN const* glyphRun, DWRITE_GLYPH_RUN_DESCRIPTION const* runDescription, IUnknown* clientDrawingEffect) { TextLayout* const layout = static_cast<TextLayout*> (clientDrawingContext); if (baselineOriginY != lastOriginY) { lastOriginY = baselineOriginY; ++currentLine; if (currentLine >= layout->getNumLines()) { jassert (currentLine == layout->getNumLines()); TextLayout::Line* const newLine = new TextLayout::Line(); layout->addLine (newLine); newLine->lineOrigin = Point<float> (baselineOriginX, baselineOriginY); } } TextLayout::Line& glyphLine = layout->getLine (currentLine); DWRITE_FONT_METRICS dwFontMetrics; glyphRun->fontFace->GetMetrics (&dwFontMetrics); glyphLine.ascent = jmax (glyphLine.ascent, scaledFontSize (dwFontMetrics.ascent, dwFontMetrics, glyphRun)); glyphLine.descent = jmax (glyphLine.descent, scaledFontSize (dwFontMetrics.descent, dwFontMetrics, glyphRun)); String fontFamily, fontStyle; getFontFamilyAndStyle (glyphRun, fontFamily, fontStyle); TextLayout::Run* const glyphRunLayout = new TextLayout::Run (Range<int> (runDescription->textPosition, runDescription->textPosition + runDescription->stringLength), glyphRun->glyphCount); glyphLine.runs.add (glyphRunLayout); glyphRun->fontFace->GetMetrics (&dwFontMetrics); const float totalHeight = std::abs ((float) dwFontMetrics.ascent) + std::abs ((float) dwFontMetrics.descent); const float fontHeightToEmSizeFactor = (float) dwFontMetrics.designUnitsPerEm / totalHeight; glyphRunLayout->font = Font (fontFamily, fontStyle, glyphRun->fontEmSize / fontHeightToEmSizeFactor); glyphRunLayout->colour = getColourOf (static_cast<ID2D1SolidColorBrush*> (clientDrawingEffect)); const Point<float> lineOrigin (layout->getLine (currentLine).lineOrigin); float x = baselineOriginX - lineOrigin.x; for (UINT32 i = 0; i < glyphRun->glyphCount; ++i) { const float advance = glyphRun->glyphAdvances[i]; if ((glyphRun->bidiLevel & 1) != 0) x -= advance; // RTL text glyphRunLayout->glyphs.add (TextLayout::Glyph (glyphRun->glyphIndices[i], Point<float> (x, baselineOriginY - lineOrigin.y), advance)); if ((glyphRun->bidiLevel & 1) == 0) x += advance; // LTR text } return S_OK; }
ToolBarControls::ToolBarControls() { addAndMakeVisible (audioStreamToggleButton = new ImageButton ("playButton")); audioStreamToggleButton->setClickingTogglesState(true); audioStreamToggleButton->setImages (false, true, true, ImageCache::getFromMemory (BinaryData::Play128_png, BinaryData::Play128_pngSize), 1.0f, Colour (0x00000000), Image::null, 0.7f, Colour (0x00000000), ImageCache::getFromMemory (BinaryData::Stop128_png, BinaryData::Stop128_pngSize), 1.0f, Colour (0x00000000)); addAndMakeVisible (recordToggleButton = new ImageButton ("recordButton")); recordToggleButton->setClickingTogglesState(true); recordToggleButton->setImages (false, true, true, ImageCache::getFromMemory (BinaryData::RecordOff128_png, BinaryData::RecordOff128_pngSize), 1.0f, Colour (0x00000000), Image::null, 0.7f, Colour (0x00000000), ImageCache::getFromMemory (BinaryData::RecordOn128_png, BinaryData::RecordOn128_pngSize), 1.0f, Colour (0x00000000)); addAndMakeVisible (saveTrainingButton = new ImageButton ("saveTrainingButton")); saveTrainingButton->setClickingTogglesState(false); saveTrainingButton->setImages (false, true, true, ImageCache::getFromMemory (BinaryData::Save128_png, BinaryData::Save128_pngSize), 1.0f, Colour (0x00000000), Image::null, 0.7f, Colour (0x00000000), Image::null, 1.0f, Colour (0x77000000)); addAndMakeVisible (loadTrainingButton = new ImageButton ("loadTrainingButton")); loadTrainingButton->setClickingTogglesState(false); loadTrainingButton->setImages (false, true, true, ImageCache::getFromMemory (BinaryData::Load128_png, BinaryData::Load128_pngSize), 1.0f, Colour (0x00000000), Image::null, 0.7f, Colour (0x00000000), Image::null, 1.0f, Colour (0x77000000)); addAndMakeVisible (addClassButton = new ImageButton ("addClassButton")); addClassButton->setClickingTogglesState(false); addClassButton->setImages (false, true, true, ImageCache::getFromMemory (BinaryData::AddClass128_png, BinaryData::AddClass128_pngSize), 1.0f, Colour (0x00000000), Image::null, 0.7f, Colour (0x00000000), Image::null, 1.0f, Colour (0x77000000)); addAndMakeVisible (deleteClassButton = new ImageButton ("deleteClassButton")); deleteClassButton->setClickingTogglesState(false); deleteClassButton->setTriggeredOnMouseDown(true); deleteClassButton->setImages (false, true, true, ImageCache::getFromMemory (BinaryData::DeleteClass128_png, BinaryData::DeleteClass128_pngSize), 1.0f, Colour (0x00000000), Image::null, 0.7f, Colour (0x00000000), Image::null, 1.0f, Colour (0x77000000)); //--- Labels ---// addAndMakeVisible (trainClassLabel = new Label ("trainClassLabel", TRANS("Train"))); trainClassLabel->setFont (Font ("Myriad Pro", 11.90f, Font::plain)); trainClassLabel->setJustificationType (Justification::centred); trainClassLabel->setEditable (false, false, false); trainClassLabel->setColour (Label::textColourId, Colour (0xFF5C6266)); trainClassLabel->setColour (TextEditor::textColourId, Colour (0xFF3D4248)); trainClassLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); trainClassLabel->setColour (TextEditor::highlightColourId, Colour (0x00000000)); addAndMakeVisible (playLabel = new Label ("playLabel", TRANS("Play"))); playLabel->setFont (Font ("Myriad Pro", 11.90f, Font::plain)); playLabel->setJustificationType (Justification::centred); playLabel->setEditable (false, false, false); playLabel->setColour (Label::textColourId, Colour (0xFF5C6266)); playLabel->setColour (TextEditor::textColourId, Colour (0xFF3D4248)); playLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); playLabel->setColour (TextEditor::highlightColourId, Colour (0x00000000)); addAndMakeVisible (addClassLabel = new Label ("addClassLabel", TRANS("Add Class"))); addClassLabel->setFont (Font ("Myriad Pro", 11.90f, Font::plain)); addClassLabel->setJustificationType (Justification::centred); addClassLabel->setEditable (false, false, false); addClassLabel->setColour (Label::textColourId, Colour (0xFF5C6266)); addClassLabel->setColour (TextEditor::textColourId, Colour (0xFF3D4248)); addClassLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addClassLabel->setColour (TextEditor::highlightColourId, Colour (0x00000000)); addAndMakeVisible (deleteClassLabel = new Label ("deleteClassLabel", TRANS("Delete Class"))); deleteClassLabel->setFont (Font ("Myriad Pro", 11.90f, Font::plain)); deleteClassLabel->setJustificationType (Justification::centred); deleteClassLabel->setEditable (false, false, false); deleteClassLabel->setColour (Label::textColourId, Colour (0xFF5C6266)); deleteClassLabel->setColour (TextEditor::textColourId, Colour (0xFF3D4248)); deleteClassLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); deleteClassLabel->setColour (TextEditor::highlightColourId, Colour (0x00000000)); addAndMakeVisible (saveTrainingLabel = new Label ("saveTrainingLabel", TRANS("Save"))); saveTrainingLabel->setFont (Font ("Myriad Pro", 11.90f, Font::plain)); saveTrainingLabel->setJustificationType (Justification::centred); saveTrainingLabel->setEditable (false, false, false); saveTrainingLabel->setColour (Label::textColourId, Colour (0xFF5C6266)); saveTrainingLabel->setColour (TextEditor::textColourId, Colour (0xFF3D4248)); saveTrainingLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); saveTrainingLabel->setColour (TextEditor::highlightColourId, Colour (0x00000000)); addAndMakeVisible (loadTrainingLabel = new Label ("loadTrainingLabel", TRANS("Load"))); loadTrainingLabel->setFont (Font ("Myriad Pro", 11.90f, Font::plain)); loadTrainingLabel->setJustificationType (Justification::centred); loadTrainingLabel->setEditable (false, false, false); loadTrainingLabel->setColour (Label::textColourId, Colour (0xFF5C6266)); loadTrainingLabel->setColour (TextEditor::textColourId, Colour (0xFF3D4248)); loadTrainingLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); loadTrainingLabel->setColour (TextEditor::highlightColourId, Colour (0x00000000)); // setSize (getParentWidth(), getParentHeight()); }
//--------------------------------------------------------------------- Resource* FontManager::createImpl(const String& name, ResourceHandle handle, const String& group, bool isManual, ManualResourceLoader* loader, const NameValuePairList* params) { return OGRE_NEW Font(this, name, handle, group, isManual, loader); }