MainWindow() : DocumentWindow ("MainWindow", Colours::lightgrey, DocumentWindow::allButtons) { setContentOwned (new MainComponent(), true); centreWithSize (getWidth(), getHeight()); setResizable (true, true); setUsingNativeTitleBar (true); }
AudioConfigurationWindow::AudioConfigurationWindow(AudioDeviceManager& adm, Button* cButton) : DocumentWindow("Audio Settings", Colours::red, DocumentWindow::closeButton), controlButton(cButton) { centreWithSize(360,300); setUsingNativeTitleBar(true); setResizable(false,false); //std::cout << "Audio CPU usage:" << adm.getCpuUsage() << std::endl; AudioDeviceSelectorComponent* adsc = new AudioDeviceSelectorComponent (adm, 0, // minAudioInputChannels 2, // maxAudioInputChannels 0, // minAudioOutputChannels 2, // maxAudioOutputChannels false, // showMidiInputOptions false, // showMidiOutputSelector false, // showChannelsAsStereoPairs false); // hideAdvancedOptionsWithButton adsc->setBounds(0,0,450,240); setContentOwned(adsc, true); setVisible(false); //setContentComponentSize(getWidth(), getHeight()); }
void SplashScreen::show (const String& title, const int width, const int height, const int minimumTimeToDisplayFor, const bool useDropShadow, const bool removeOnMouseClick) { setName (title); setAlwaysOnTop (true); setVisible (true); centreWithSize (width, height); addToDesktop (useDropShadow ? ComponentPeer::windowHasDropShadow : 0); toFront (false); #if JUCE_MODAL_LOOPS_PERMITTED MessageManager::getInstance()->runDispatchLoopUntil (300); #endif repaint(); originalClickCounter = removeOnMouseClick ? Desktop::getMouseButtonClickCounter() : std::numeric_limits<int>::max(); earliestTimeToDelete = Time::getCurrentTime() + RelativeTime::milliseconds (minimumTimeToDisplayFor); startTimer (50); }
SettingsWindow::SettingsWindow () : DialogWindow (TRANS("Settings"), Colour (192,192,192), true, false) // do not add to desktop yet { SettingsPanel* contentComp = new SettingsPanel; setOpaque (true); //setDropShadowEnabled (false); // iOS doesn't have a native title bar //setUsingNativeTitleBar (true); // must happen AFTER setUsingNativeTitleBar() Component::addToDesktop (getDesktopWindowStyleFlags()); // must happen after addToDesktop() setContentOwned (contentComp, true); centreWithSize (getWidth(), getHeight()); setVisible (true); enterModalState (); }
MainWindow() : DocumentWindow("Arooo", Colours::lightgrey, DocumentWindow::closeButton | DocumentWindow::minimiseButton, true) { mainComponent = new MainComponent(); setContentOwned(mainComponent, true); centreWithSize(getWidth(), getHeight()); setVisible(true); }
ZenDebugEditor::ZenDebugEditor() : DocumentWindow("Zen Debug", Colours::lightgrey, DocumentWindow::allButtons) { this->setName("ValueTreeEditorWindow"); tabsComponent = new TabbedComponent(TabbedButtonBar::TabsAtTop); tabsComponent->setName("DebugTabbedComponent"); valueTreeEditorComponent = new ValueTreeEditor::Editor("ValueTreeEditor"); tabsComponent->addTab("Params", Colours::lightgrey, valueTreeEditorComponent, false); bufferVisualiserComponent = new BufferVisualiser("BufferVisualiser"); tabsComponent->addTab("Buffers", Colours::lightgrey, bufferVisualiserComponent->getComponent(), false); midiVisualiserComponent = new ZenMidiVisualiserComponent("MidiVisualiser"); tabsComponent->addTab("MIDI", Colours::lightgrey, midiVisualiserComponent, false); notepadComponent = new NotepadComponent("Notepad", ""); tabsComponent->addTab("Notes", Colours::lightgrey, notepadComponent, false); componentVisualiserComponent = nullptr; this->setSize(400, 400); tabsComponent->setCurrentTabIndex(0); tabsComponent->setBounds(0, 0, getWidth(), getHeight()); setContentNonOwned(tabsComponent, false); setResizable(true, false); setUsingNativeTitleBar(true); centreWithSize(getWidth(), getHeight()); setVisible(true); }
//============================================================================== void TopLevelWindow::centreAroundComponent (Component* c, const int width, const int height) { if (c == nullptr) c = TopLevelWindow::getActiveTopLevelWindow(); if (c == nullptr || c->getBounds().isEmpty()) { centreWithSize (width, height); } else { Point<int> targetCentre (c->localPointToGlobal (c->getLocalBounds().getCentre())); Rectangle<int> parentArea (c->getParentMonitorArea()); if (getParentComponent() != nullptr) { targetCentre = getParentComponent()->getLocalPoint (nullptr, targetCentre); parentArea = getParentComponent()->getLocalBounds(); } parentArea.reduce (12, 12); setBounds (jlimit (parentArea.getX(), jmax (parentArea.getX(), parentArea.getRight() - width), targetCentre.getX() - width / 2), jlimit (parentArea.getY(), jmax (parentArea.getY(), parentArea.getBottom() - height), targetCentre.getY() - height / 2), width, height); } }
//================================================================================================= MainWindow::MainWindow() : DocumentWindow (JUCEApplication::getInstance()->getApplicationName(), Colours::lightgrey, DocumentWindow::allButtons) { // 创建基础组件和读写文档的对象 baseComponent = new BaseComponent(); appDoc = LoadAndSaveDoc::getInstance(); appDoc->addChangeListener(this); // FileBasedDocument 对象绑定可变捕获器 // 获取全局性的撤销管理器、命令管理器和程序属性 undoManager = AppSingleton::getInstance()->getUndoManager(); commandManager = AppSingleton::getInstance()->getCommandManager(); appProperties = AppSingleton::getInstance()->getAppProperties(); // 注册命令目标 commandManager->registerAllCommandsForTarget (JUCEApplication::getInstance()); commandManager->registerAllCommandsForTarget (this); // 获取所有命令默认的快捷键 commandManager->getKeyMappings()->resetToDefaultMappings(); // 获取用户自定义的快捷键 ScopedPointer<XmlElement> keys(appProperties->getUserSettings()->getXmlValue("keyMappings")); if (keys != nullptr) commandManager->getKeyMappings()->restoreFromXml(*keys); // 本类绑定按键捕获器 addKeyListener (commandManager->getKeyMappings()); // 设置本类的默认属性 centreWithSize (1280, 800); setResizable(true, false); setResizeLimits(800, 600, 4096, 4096); setVisible (true); setUsingNativeTitleBar(true); // 主菜单随时关注命令的变化 setApplicationCommandManagerToWatch(commandManager); // 设置主菜单 #ifdef JUCE_MAC setMacMainMenu(this); #else setMenuBar(this); #endif // 恢复上次退出时的窗口状态 restoreWindowStateFromString(appProperties->getUserSettings()->getValue("mainWindowState")); setName(AppString::appNameOnTitleBar + TRANS("Untitled")); // 设置标题栏默认显示的文本 // 设置并添加基础组件 baseComponent->setSize(getWidth(), getHeight()); setContentOwned(baseComponent, false); // 设置当前进程为高优先级 Process::setPriority (Process::HighPriority); }
ProcessesWindow::ProcessesWindow() : DocumentWindow("Processes", Colours::white, DocumentWindow::closeButton) { processesComponent = new ProcessesComponent(); setResizable(false, false); setContentOwned(processesComponent, true); centreWithSize(getWidth(), getHeight()); setVisible(false); }
MainWindow (String name) : DocumentWindow (name,Colour(0xff3f3f3f),DocumentWindow::allButtons) { setUsingNativeTitleBar (true); setContentOwned (new MainContentComponent(), true); LookAndFeel::setDefaultLookAndFeel (&lookAndFeelV1); centreWithSize (getWidth(), getHeight()); setVisible (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 }
MidiConfigurationWindow::MidiConfigurationWindow(MTCSender& mtcSender) : DialogWindow(TRANS("Configure MIDI"), Colours::lightgrey, true, true) , m_mtcSender(mtcSender) { setContentOwned(new MidiConfigurationComponent(this, m_mtcSender.getDevice()), true); centreWithSize(getWidth(), getHeight()); setVisible(true); setResizable(true, true); }
MainWindow() : DocumentWindow ("MainWindow", Colours::lightgrey, DocumentWindow::allButtons) { setContentOwned (new MainContentComponent(), true); centreWithSize (getWidth(), getHeight()); setVisible (true); }
MainWindow() : DocumentWindow ("FPT Analyzer 2.0", Colours::lightgrey, DocumentWindow::allButtons) { setContentOwned (new MainContentComponent(), true); Rectangle<int> r = Desktop::getInstance().getDisplays().getMainDisplay().userArea; centreWithSize (r.getWidth(), r.getHeight()); setVisible (true); }
MainWindow(String name) : DocumentWindow(name, Colours::lightgrey, DocumentWindow::closeButton) { setUsingNativeTitleBar(true); setContentOwned(new HelmStandaloneEditor(), true); setResizable(true, true); centreWithSize(getWidth(), getHeight()); setVisible(true); }
CContourPickerDialog () : DocumentWindow ("Edit Contour", Colours::grey, DocumentWindow::closeButton, true) { CContourCurveEditor* c = new CContourCurveEditor; setContentOwned (c, true); centreWithSize (getWidth(), getHeight()); setVisible (true); }
void MainWindow::showNewProjectWizard() { jassert (currentProject == nullptr); setContentOwned (createNewProjectWizardComponent(), true); centreWithSize (900, 630); setVisible (true); addToDesktop(); getContentComponent()->grabKeyboardFocus(); }
void ValueTreeDebugger::construct() { main = new ValueTreeDebuggerMain(); setContentNonOwned (main, true); setResizable (true, false); setUsingNativeTitleBar (true); centreWithSize (getWidth(), getHeight()); setVisible (true); }
MainWindow (String name) : DocumentWindow (name, Colours::lightgrey, DocumentWindow::allButtons) { setUsingNativeTitleBar (true); setContentOwned (new MPETestClasses::MainComponent(), true); centreWithSize (getWidth(), getHeight()); setVisible (true); }
//============================================================================== MainWindow::MainWindow() : DocumentWindow ("The Jucer", Colours::azure, DocumentWindow::allButtons) { if (oldLook == 0) oldLook = new OldSchoolLookAndFeel(); setContentOwned (multiDocHolder = new MultiDocHolder(), false); 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 ("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 ("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 }
AserveWindow (String name, Audio& audio) : DocumentWindow (name, Colours::lightgrey, DocumentWindow::allButtons) { setUsingNativeTitleBar (true); setContentOwned (new AserveComponent (audio), true); centreWithSize (getWidth(), getHeight()); setVisible (true); }
MainWindow() : DocumentWindow (ProjectInfo::projectName, Colours::lightgrey, DocumentWindow::allButtons) { setUsingNativeTitleBar (true); setContentOwned (new StringDemoComponent(), true); setResizable (true, false); centreWithSize (getWidth(), getHeight()); setVisible (true); }
MainWindow (String name) : DocumentWindow (name, Colours::lightgrey, DocumentWindow::allButtons) { setUsingNativeTitleBar (true); setContentOwned (new CONTENTCOMPCLASS(), true); centreWithSize (getWidth(), getHeight()); setVisible (true); }
MainWindow() : DocumentWindow ("Roomote", Colours::black, 0) { setContentOwned (new MainContentComponent(), false); setTitleBarHeight(0); centreWithSize (322, 242); // Not sure why 2 more pixels need to be added setVisible (true); }
MainWindow (const String& name) : DocumentWindow (name, Colours::lightgrey, DocumentWindow::allButtons) { setUsingNativeTitleBar (true); setContentOwned (createMainContentComponent(), true); setResizable (true, true); centreWithSize (getWidth(), getHeight()); setVisible (true); }
//============================================================================== MainAppWindow::MainAppWindow() : DocumentWindow (JUCEApplication::getInstance()->getApplicationName(), Colours::lightgrey, DocumentWindow::allButtons) { setContentOwned(new MainComponent(), false); centreWithSize (400, 200); setVisible (true); }
//============================================================================== MainAppWindow::MainAppWindow(AlphaLiveEngine &ref, AppDocumentState &ref2, MenuBarModel *menuBar_) : DocumentWindow (JUCEApplication::getInstance()->getApplicationName(), Colours::black, 5), alphaLiveEngineRef(ref), appDocumentStateRef(ref2), menuBar(menuBar_) { //create the main component mainComponent = new MainComponent(alphaLiveEngineRef, appDocumentStateRef, this); //see here - http://www.rawmaterialsoftware.com/viewtopic.php?f=3&t=6358&hilit=windows+native+menu+bar //I have since abandomed this method, as when moving the apps window around the desktop it would leave //'ghost' outlines. So now the TopLevelWindow class is intilialsed with the deafault 'addToDesktop(true)' //above, and not done manually below. //Though must check this doesn't screw up Windows stuff like described in the forum post. #if ! JUCE_MAC setMenuBar (menuBar); #endif //use native OS title bar setUsingNativeTitleBar(true); //set main component to own the content of the main window setContentOwned(mainComponent, false); #if JUCE_MAC centreWithSize (1024, 690); #endif #if ! JUCE_MAC //add default menu bar height the height to accomadate the menu bar in the overal window centreWithSize (1024, 690 + LookAndFeel::getDefaultLookAndFeel().getDefaultMenuBarHeight()); #endif // update key mappings.. should this be done here?? What am I even doing here? commandManager->getKeyMappings()->resetToDefaultMappings(); addKeyListener (commandManager->getKeyMappings()); // don't want the window to take focus when the title-bar is clicked.. setWantsKeyboardFocus (false); }
MainWindow::MainWindow() : juce::DocumentWindow ("Friendly Binary Builder", juce::Colours::darkgrey, juce::DocumentWindow::closeButton) { setUsingNativeTitleBar (true); setContentOwned (new MainComponent(), true); centreWithSize (getWidth(), getHeight()); setVisible (true); }
MainWindow (String name, const PropertiesFile::Options & options) : DocumentWindow (name, Colours::lightgrey, DocumentWindow::allButtons), main_content_(options) { setUsingNativeTitleBar (true); setContentOwned (&main_content_, true); centreWithSize (getWidth(), getHeight()); setVisible (true); setResizable(true, true); }
//============================================================================== VstPluginWindow::VstPluginWindow (PluginEditorWindowHolder* owner_, BasePlugin* plugin_) : DialogWindow (String::empty, Colours::beige, true, false), plugin (0), owner (owner_), specialEditor (0), nativeEditor (0), externalEditor (0), content (0) { DBG ("VstPluginWindow::VstPluginWindow"); // add to desktop addToDesktop (getDesktopWindowStyleFlags()); // setup window default values setTitleBarHeight (24); centreWithSize (400, 300); setWantsKeyboardFocus (true); setBackgroundColour (Config::getInstance ()->getColour (T("mainBackground"))); // try to move the window to its old position int oldX = -1, oldY = -1, oldW = -1, oldH = -1, lastPage = 0; if (plugin_) { oldX = plugin_->getIntValue (PROP_WINDOWXPOS, -1); oldY = plugin_->getIntValue (PROP_WINDOWYPOS, -1); oldW = plugin_->getIntValue (PROP_WINDOWWSIZE, -1); oldH = plugin_->getIntValue (PROP_WINDOWHSIZE, -1); lastPage = plugin_->getIntValue (PROP_WINDOWPAGE, 0); } // try to move the window to its old position if (oldX >= 0 && oldY >= 0) setTopLeftPosition (oldX, oldY); // try to set the window to its old size if ((lastPage == 0 && ! externalEditor) || (lastPage == 1 && externalEditor)) { if (oldW >= 0 && oldY >= 0) setSize (oldW, oldH); } // default plugin to open setPlugin (plugin_); // setMenuBar here, after setting the plugin, so the plugin's menu items are there immediately setMenuBar (this, getMenuBarHeight ()); // restore window to front toFront (false); setVisible (true); }