ThorConfigDialog::ThorConfigDialog(ThorConfig *_config, Component *content) : DialogWindow (T("Options"), Colours::white, true, true) { config = _config; if (content) { setContentComponent (content); setName (content->getName()); } else setContentComponent (configComponent = new ThorConfigComponent(config)); setTitleBarHeight (16); enterModalState (true); setVisible (true); setAlwaysOnTop(true); }
CSLWindow() : DocumentWindow (T("CSL 5.0 OSC/MIDI Server"), Colours::lightgrey, DocumentWindow::allButtons, true) { setContentComponent (createCSLComponent()); // create app window setResizable (false, false); setVisible (true); setUsingNativeTitleBar(true); centreWithSize(308, 200); // top window size 8 @ 24 larger than the component }
~PluginListWindow() { ApplicationProperties::getInstance()->getUserSettings()->setValue ("listWindowPos", getWindowStateAsString()); setContentComponent (0); jassert (currentPluginListWindow == this); currentPluginListWindow = 0; }
//============================================================================== MainWindow::MainWindow() : DocumentWindow (T("The Jucer"), Colours::azure, DocumentWindow::allButtons) { if (oldLook == 0) oldLook = new OldSchoolLookAndFeel(); setContentComponent (multiDocHolder = new MultiDocHolder()); setApplicationCommandManagerToWatch (commandManager); #if JUCE_MAC setMacMainMenu (this); #else setMenuBar (this); #endif setResizable (true, false); centreWithSize (700, 600); // restore the last size and position from our settings file.. restoreWindowStateFromString (StoredSettings::getInstance()->getProps() .getValue (T("lastMainWindowPos"))); // Register all the app commands.. { commandManager->registerAllCommandsForTarget (JUCEApplication::getInstance()); commandManager->registerAllCommandsForTarget (this); // use a temporary one of these to harvest its commands.. JucerDocumentHolder tempDesignHolder (ObjectTypes::createNewDocument (0)); commandManager->registerAllCommandsForTarget (&tempDesignHolder); } commandManager->getKeyMappings()->resetToDefaultMappings(); XmlElement* const keys = StoredSettings::getInstance()->getProps().getXmlValue (T("keyMappings")); if (keys != 0) { commandManager->getKeyMappings()->restoreFromXml (*keys); delete keys; } addKeyListener (commandManager->getKeyMappings()); // don't want the window to take focus when the title-bar is clicked.. setWantsKeyboardFocus (false); #ifndef JUCE_DEBUG // scan for fonts before the app gets started rather than glitching later FontPropertyComponent::preloadAllFonts(); #endif }
ShredderPluginEditor::ShredderPluginEditor(ShredderPlugin *_shredderPlugin, ShredderSlot *_shredderSlot) : DocumentWindow (String::empty, Colours::aliceblue, DocumentWindow::closeButton, true), shredderPlugin(_shredderPlugin), shredderSlot(_shredderSlot), shredderMidiSlot(0) { if (shredderPlugin->getLastPos().isEmpty()) { setContentComponent (shredderPlugin->getEditor(), true, true); centreAroundComponent (shredderSlot, getWidth(), getHeight()); } else { setBounds (shredderPlugin->getLastPos()); setContentComponent (shredderPlugin->getEditor(), true, false); } setName (shredderPlugin->getName()); setVisible (true); }
//============================================================================== void StandaloneFilterWindow::deleteFilter() { if (deviceManager != 0) deviceManager->setFilter (0); if (filter != 0 && getContentComponent() != 0) { filter->editorBeingDeleted (dynamic_cast <AudioProcessorEditor*> (getContentComponent())); setContentComponent (0, true); } deleteAndZero (filter); }
MainWindow::MainWindow(const String &name, const Colour &backgroundColour, const int requiredButtons, const bool addToDesktop) : DocumentWindow(name, backgroundColour, requiredButtons, addToDesktop), _pContentWindow(nullptr), _tooltipWindow(this) { setDropShadowEnabled(false); //setTitleBarHeight(24); setTitleBarTextCentred(false); Image *l_pAppIcon = ImageCache::getFromMemory(SAKURA_ICON_PNG, SAKURA_ICON_PNG_SIZE); setIcon(l_pAppIcon); setContentComponent(_pContentWindow = new SakuraMatrix(this), true, true); }
FindAndReplaceWindow(FindAndReplaceDialog* comp) : DocumentWindow(T("Find & Replace"), Colour(0xffe5e5e5), DocumentWindow::closeButton, true) { comp->setVisible(true); centreWithSize(comp->getWidth(),comp->getHeight()); setContentComponent(comp); setResizable(false, false); setUsingNativeTitleBar(true); setDropShadowEnabled(true); setVisible(true); }
//============================================================================== MainHostWindow::MainHostWindow() : DocumentWindow (JUCEApplication::getInstance()->getApplicationName(), Colours::lightgrey, DocumentWindow::allButtons) { XmlElement* const savedAudioState = ApplicationProperties::getInstance()->getUserSettings() ->getXmlValue (T("audioDeviceState")); deviceManager.initialise (256, 256, savedAudioState, true); delete savedAudioState; setResizable (true, false); setResizeLimits (500, 400, 10000, 10000); centreWithSize (800, 600); setContentComponent (new GraphDocumentComponent (&deviceManager)); restoreWindowStateFromString (ApplicationProperties::getInstance()->getUserSettings()->getValue ("mainWindowPos")); setVisible (true); InternalPluginFormat internalFormat; internalFormat.getAllTypes (internalTypes); XmlElement* const savedPluginList = ApplicationProperties::getInstance() ->getUserSettings() ->getXmlValue (T("pluginList")); if (savedPluginList != 0) { knownPluginList.recreateFromXml (*savedPluginList); delete savedPluginList; } pluginSortMethod = (KnownPluginList::SortMethod) ApplicationProperties::getInstance()->getUserSettings() ->getIntValue (T("pluginSortMethod"), KnownPluginList::sortByManufacturer); knownPluginList.addChangeListener (this); addKeyListener (commandManager->getKeyMappings()); Process::setPriority (Process::HighPriority); #if JUCE_MAC setMacMainMenu (this); #else setMenuBar (this); #endif }
MainHostWindow::~MainHostWindow() { delete PluginListWindow::currentPluginListWindow; #if JUCE_MAC setMacMainMenu (0); #else setMenuBar (0); #endif knownPluginList.removeChangeListener (this); ApplicationProperties::getInstance()->getUserSettings()->setValue ("mainWindowPos", getWindowStateAsString()); setContentComponent (0); }
//============================================================================== MainAppWindow::MainAppWindow() : DocumentWindow (JUCEApplication::getInstance()->getApplicationName(), Colours::lightgrey, DocumentWindow::allButtons) { mMainController = new MainController(); MainEditor* const contentComponent = new MainEditor(mMainController); mMainController->setEditor((MainEditor*)contentComponent); setContentComponent (contentComponent, true, true); centreWithSize (1024, 768); //+ getTitleBarHeight()); setUsingNativeTitleBar(true); setVisible (true); }
//============================================================================== HelloWorldWindow() : DocumentWindow (T("XML-RPC testing"), Colours::lightgrey, DocumentWindow::allButtons, true) { // Create an instance of our main content component, and add it // to our window. MainComponent* const contentComponent = new MainComponent(); setContentComponent (contentComponent, true, true); centreWithSize (getWidth(), getHeight()); setResizable (false, false); setTitleBarHeight (23); setVisible (true); }
void StandaloneFilterWindow::resetFilter() { deleteFilter(); filter = createPluginFilter(); if (filter != 0) { if (deviceManager != 0) deviceManager->setFilter (filter); setContentComponent (filter->createEditorIfNeeded(), true, true); } PropertySet* const globalSettings = getGlobalSettings(); if (globalSettings != 0) globalSettings->removeValue (T("filterState")); }
MainWindow::~MainWindow() { #if JUCE_MAC setMacMainMenu (0); #else setMenuBar (0); #endif removeKeyListener (commandManager->getKeyMappings()); // save the current size and position to our settings file.. StoredSettings::getInstance()->getProps() .setValue (T("lastMainWindowPos"), getWindowStateAsString()); setContentComponent (0); LookAndFeel::setDefaultLookAndFeel (0); deleteAndZero (oldLook); }
BEGIN_JUCE_NAMESPACE #include "juce_FileChooserDialogBox.h" #include "../lookandfeel/juce_LookAndFeel.h" #include "../../../text/juce_LocalisedStrings.h" #include "../windows/juce_AlertWindow.h" //============================================================================== FileChooserDialogBox::FileChooserDialogBox (const String& name, const String& instructions, FileBrowserComponent& chooserComponent, const bool warnAboutOverwritingExistingFiles_, const Colour& backgroundColour) : ResizableWindow (name, backgroundColour, true), warnAboutOverwritingExistingFiles (warnAboutOverwritingExistingFiles_) { content = new ContentComponent(); content->setName (name); content->instructions = instructions; content->chooserComponent = &chooserComponent; content->addAndMakeVisible (&chooserComponent); content->okButton = new TextButton (chooserComponent.getActionVerb()); content->addAndMakeVisible (content->okButton); content->okButton->addButtonListener (this); content->okButton->setEnabled (chooserComponent.currentFileIsValid()); content->okButton->addShortcut (KeyPress (KeyPress::returnKey, 0, 0)); content->cancelButton = new TextButton (TRANS("Cancel")); content->addAndMakeVisible (content->cancelButton); content->cancelButton->addButtonListener (this); content->cancelButton->addShortcut (KeyPress (KeyPress::escapeKey, 0, 0)); setContentComponent (content); setResizable (true, true); setResizeLimits (300, 300, 1200, 1000); content->chooserComponent->addListener (this); }
PluginListWindow (KnownPluginList& knownPluginList) : DocumentWindow ("Available Plugins", Colours::white, DocumentWindow::minimiseButton | DocumentWindow::closeButton) { currentPluginListWindow = this; const File deadMansPedalFile (ApplicationProperties::getInstance()->getUserSettings() ->getFile().getSiblingFile ("RecentlyCrashedPluginsList")); setContentComponent (new PluginListComponent (knownPluginList, deadMansPedalFile, ApplicationProperties::getInstance()->getUserSettings()), true, true); setResizable (true, false); setResizeLimits (300, 400, 800, 1500); setTopLeftPosition (60, 60); restoreWindowStateFromString (ApplicationProperties::getInstance()->getUserSettings()->getValue ("listWindowPos")); setVisible (true); }
//============================================================================== MainAppWindow::MainAppWindow() : DocumentWindow (JUCEApplication::getInstance()->getApplicationName(), Colours::lightgrey, DocumentWindow::allButtons) { mAudio = new AudioDeviceManager(); ContentComp* contentComp = new ContentComp (this); setContentComponent (contentComp); centreWithSize (1000, 650); setVisible (true); //AudioDeviceSelectorComponent *sel = new AudioDeviceSelectorComponent(*mAudio, 1, 1, 2, 2, false, false, true, false); //label = new Label (T("Label"), T("text here")); //label->setBounds (10, 10, 280, 20); //addAndMakeVisible(label); //AudioDeviceManager &deviceManager, const int minAudioInputChannels, const int maxAudioInputChannels, const int minAudioOutputChannels, const int maxAudioOutputChannels, const bool showMidiInputOptions, const bool showMidiOutputSelector, const bool showChannelsAsStereoPairs, const bool hideAdvancedOptionsWithButton }
juce_UseDebuggingNewOperator //============================================================================== IPhoneUIEmulatorWindow() : DocumentWindow (T("Emulator"), Colours::lightgrey, DocumentWindow::allButtons, true) { // Create an instance of our main content component, and add it // to our window. //MainComponent* const contentComponent = new MainComponent(); IPhoneUIEmulator* const contentComponent = new IPhoneUIEmulator(); setContentComponent (contentComponent, true, true); centreWithSize (getWidth(), getHeight()); setVisible (true); }
//============================================================================== EdoFileEditor::EdoFileEditor (const File fileToEdit, const bool allowEditing) : DocumentWindow (fileToEdit.getFullPathName(), Colours::white, DocumentWindow::allButtons, true) { //[UserPreSize] editorComponent = new EdoFileEditorComponent (fileToEdit, allowEditing); setContentComponent (editorComponent, true, true); if (ApplicationProperties::getInstance()->getUserSettings()->getValue (T("fileEditorRectangle"), String::empty) != String::empty) { setBounds (Rectangle::fromString (ApplicationProperties::getInstance()->getUserSettings()->getValue (T("fileEditorRectangle")))); } else { centreWithSize (400, 400); } setResizable (true, true); //[/UserPreSize] //[Constructor] You can add your own custom stuff here.. //[/Constructor] }
juce_UseDebuggingNewOperator //============================================================================== HelloWorldWindow() : DocumentWindow (T("PBR Synth"), Colours::lightgrey, DocumentWindow::allButtons, true) { // Create an instance of our main content component, and add it // to our window. //MainComponent* const contentComponent = new MainComponent(); NewJucerComponent* const contentComponent = new NewJucerComponent(); setContentComponent (contentComponent, true, true); centreWithSize (getWidth(), getHeight()); setVisible (true); }
//============================================================================== MainAppWindow::MainAppWindow(ApplicationCommandManager* commandManager) : // Initialise the base 'DocumentWindow'... DocumentWindow ( T("MyJuceApp"), Colours::lightgrey, DocumentWindow::allButtons, true ) { setResizable (true, false); // resizability is a property of ResizableWindow, which is setTitleBarHeight (25); // Set the height of the titlebar on our window. MainComponent* contentComponent = new MainComponent (this, commandManager); setContentComponent (contentComponent); #if defined(LINUX) setMenuBar(contentComponent); #endif //setMenuBar(setMacMainMenu(contentComponent)); }
WindowAbout::WindowAbout(int nWidth, int nHeight) : ResizableWindow(T("About K-Meter"), false) // create new window child of width "nWidth" and height "nHeight" { // set dimensions to those passed to the function ... setBounds(0, 0, nWidth, nHeight); // ... and keep the new window on top setAlwaysOnTop(true); // prohibit movement of the new window pConstrainer = new ProhibitingBoundsConstrainer(); setConstrainer(pConstrainer); // empty windows are boring, so let's prepare a space for some // window components contentComponent = new Component(T("Window Area")); setContentComponent(contentComponent); // create a word-wrapping read-only text editor component with // multiple lines for displaying information about the plug-in TextEditorAbout = new TextEditor(T("About Text")); TextEditorAbout->setMultiLine(true, true); TextEditorAbout->setReadOnly(true); // initialise colours of the text editor component TextEditorAbout->setColour(TextEditor::backgroundColourId, Colours::black.withAlpha(0.25f)); TextEditorAbout->setColour(TextEditor::textColourId, Colours::white); TextEditorAbout->setColour(TextEditor::highlightColourId, Colours::white.withAlpha(0.25f)); TextEditorAbout->setColour(TextEditor::highlightedTextColourId, Colours::white); // set up two fonts, one for headlines and one for regular text Font fontHeadline(15.0f, Font::bold); Font fontRegular(13.0f, Font::plain); // display plug-in name and version number TextEditorAbout->setFont(fontHeadline); TextEditorAbout->insertTextAtCaret( String("K-Meter ") + JucePlugin_VersionString + T("\n") ); // display plug-in description TextEditorAbout->setFont(fontRegular); TextEditorAbout->insertTextAtCaret( String(JucePlugin_Desc) + T(".\n\n") ); // display the contributors TextEditorAbout->setFont(fontHeadline); TextEditorAbout->insertTextAtCaret( T("Contributors\n") ); TextEditorAbout->setFont(fontRegular); TextEditorAbout->insertTextAtCaret( L"Martin Zuther\n" L"Bob Katz\n" L"bram@smartelectronix\n\n" ); // display copyright notice TextEditorAbout->setFont(fontHeadline); TextEditorAbout->insertTextAtCaret( T("Copyright\n") ); TextEditorAbout->setFont(fontRegular); TextEditorAbout->insertTextAtCaret( T("(c) 2010-2011 Contributors\n\n") ); // display used libraries TextEditorAbout->setFont(fontHeadline); TextEditorAbout->insertTextAtCaret( T("Libraries\n") ); TextEditorAbout->setFont(fontRegular); TextEditorAbout->insertTextAtCaret( #ifdef LINUX L"ALSA\n" #endif L"FFTW\n" #ifdef LINUX L"FreeType\n" #endif L"JUCE\n" #ifdef LINUX L"POSIX Threads\n" L"Xlib\n" L"Xext\n" #endif L"\n" ); #if (JUCE_USE_VSTSDK_2_4 != 0) // display trademarks (but only when necessary) TextEditorAbout->setFont(fontHeadline); TextEditorAbout->insertTextAtCaret( T("Trademarks\n") ); TextEditorAbout->setFont(fontRegular); TextEditorAbout->insertTextAtCaret( T("VST PlugIn Technology by Steinberg\n\n") ); #endif #if (JUCE_ASIO != 0) // display trademarks (but only when necessary) TextEditorAbout->setFont(fontHeadline); TextEditorAbout->insertTextAtCaret( T("Trademarks\n") ); TextEditorAbout->setFont(fontRegular); TextEditorAbout->insertTextAtCaret( T("ASIO Technology by Steinberg Media Technologies GmbH\n\n") ); #endif // display license summary TextEditorAbout->setFont(fontHeadline); TextEditorAbout->insertTextAtCaret( T("License\n") ); TextEditorAbout->setFont(fontRegular); TextEditorAbout->insertTextAtCaret( L"This program is free software: you can redistribute it and/or modify " L"it under the terms of the GNU General Public License as published by " L"the Free Software Foundation, either version 3 of the License, or " L"(at your option) any later version.\n\n" L"This program is distributed in the hope that it will be useful, " L"but WITHOUT ANY WARRANTY; without even the implied warranty of " L"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " L"GNU General Public License for more details.\n\n" L"You should have received a copy of the GNU General Public License " L"along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n" L"Thank you for using free software!\n\n" ); // in case the text has become too long to fit into the text // editor component, scroll to the beginning TextEditorAbout->setCaretPosition(0); TextEditorAbout->scrollEditorToPositionCaret(0, 0); // finally, position and display the text editor component TextEditorAbout->setBounds(0, 0, nWidth, nHeight - 47); contentComponent->addAndMakeVisible(TextEditorAbout); // create and position an "about" button that appears as if it // were pressed down and which closes the window when clicked ButtonAbout = new TextButton(T("About")); ButtonAbout->setBounds(nWidth - 73, nHeight - 34, 60, 20); ButtonAbout->setColour(TextButton::buttonColourId, Colours::yellow); ButtonAbout->setColour(TextButton::buttonOnColourId, Colours::grey); // add "about" window as button listener and display the button ButtonAbout->addButtonListener(this); contentComponent->addAndMakeVisible(ButtonAbout); // prepare an image button by loading its images from memory ImageButtonGplNormal = ImageCache::getFromMemory(resources::button_gpl_normal_png, resources::button_gpl_normal_pngSize); ImageButtonGplOver = ImageCache::getFromMemory(resources::button_gpl_over_png, resources::button_gpl_over_pngSize); ImageButtonGplDown = ImageCache::getFromMemory(resources::button_gpl_down_png, resources::button_gpl_down_pngSize); // create and position the image button which opens the license // text in a web browser ButtonGpl = new ImageButton(T("GPL Link")); ButtonGpl->setBounds(4, nHeight - 41, 64, 32); ButtonGpl->setImages(true, false, true, ImageButtonGplNormal, 1.0f, Colour(), ImageButtonGplOver, 1.0f, Colour(), ImageButtonGplDown, 1.0f, Colour() ); // add "about" window as button listener and display the button ButtonGpl->addButtonListener(this); contentComponent->addAndMakeVisible(ButtonGpl); }
//============================================================================== void VstPluginWindow::setPlugin (BasePlugin* plugin_) { DBG ("VstPluginWindow::setPlugin"); externalEditor = 0; // DO NOT DELETE IT (it is deleted by setContentComponent (0)) specialEditor = 0; // DO NOT DELETE IT (it is deleted by setContentComponent (0)) nativeEditor = 0; // DO NOT DELETE IT (it is deleted by setContentComponent (0)) content = 0; setContentComponent (0); plugin = plugin_; if (plugin) { int preferredWidth = 400; int preferredHeight = 300; bool limitHeight = false; // we got a plugin to show setName (plugin->getName ()); if (plugin->hasEditor ()) { // plugin have its internal editor, but don't want others ! if (plugin->isEditorInternal ()) { specialEditor = (PluginEditorComponent*) plugin->createEditor (); if (specialEditor) { preferredWidth = specialEditor->getPreferredWidth(); preferredHeight = specialEditor->getPreferredHeight(); setResizable (specialEditor->isResizable (), false); setContentComponent (specialEditor); } } // plugin have external editor by its own else { nativeEditor = new VstPluginNativeEditor (plugin, this); externalEditor = new VstPluginExternalEditor (plugin, this); setContentComponent (content = new VstPluginWindowContent (owner, plugin, this, nativeEditor, externalEditor)); int lastSelectedTab = plugin->getIntValue (PROP_WINDOWPAGE, 0); if (lastSelectedTab == 0) { preferredWidth = externalEditor->getPreferredWidth(); preferredHeight = externalEditor->getPreferredHeight(); } else { preferredWidth = nativeEditor->getPreferredWidth(); preferredHeight = nativeEditor->getPreferredHeight(); } } } else { // plugin don't have a editor, but wants a host provided one nativeEditor = new VstPluginNativeEditor (plugin, this); preferredWidth = nativeEditor->getPreferredWidth(); preferredHeight = nativeEditor->getPreferredHeight(); setContentComponent (content = new VstPluginWindowContent (owner, plugin, this, nativeEditor, externalEditor)); } resizeContentComponent (preferredWidth, preferredHeight, limitHeight); updateParameters(); } else { // we do not have any plugin setResizable (true, false); } }
MainAppWindow::~MainAppWindow() { setMenuBar(0); setContentComponent(0, true); }
void TextEditorWindow::setTextBuffer(TextBuffer* buf) { // setContentComponent(buf); // buffer=buf; setContentComponent( new EditorComponent(buf) ); }
//============================================================================== StandaloneFilterWindow::StandaloneFilterWindow (const String& title, const Colour& backgroundColour) : DocumentWindow (title, backgroundColour, DocumentWindow::minimiseButton | DocumentWindow::closeButton), filter (0), deviceManager (0), optionsButton (0) { setTitleBarButtonsRequired (DocumentWindow::minimiseButton | DocumentWindow::closeButton, false); PropertySet* const globalSettings = getGlobalSettings(); optionsButton = new TextButton (T("options")); Component::addAndMakeVisible (optionsButton); optionsButton->addButtonListener (this); optionsButton->setTriggeredOnMouseDown (true); JUCE_TRY { filter = createPluginFilter(); if (filter != 0) { deviceManager = new AudioFilterStreamingDeviceManager(); deviceManager->setFilter (filter); XmlElement* savedState = 0; if (globalSettings != 0) savedState = globalSettings->getXmlValue (T("audioSetup")); deviceManager->initialise (filter->getNumInputChannels(), filter->getNumOutputChannels(), savedState, true); delete savedState; if (globalSettings != 0) { JUCE_NAMESPACE::MemoryBlock data; if (data.fromBase64Encoding (globalSettings->getValue (T("filterState"))) && data.getSize() > 0) { filter->setStateInformation (data.getData(), data.getSize()); } } setContentComponent (filter->createEditorIfNeeded(), true, true); const int x = globalSettings->getIntValue (T("windowX"), -100); const int y = globalSettings->getIntValue (T("windowY"), -100); if (x != -100 && y != -100) setBoundsConstrained (x, y, getWidth(), getHeight()); else centreWithSize (getWidth(), getHeight()); } } JUCE_CATCH_ALL if (deviceManager == 0) { jassertfalse // Your filter didn't create correctly! In a standalone app that's not too great. JUCEApplication::quit(); } }