void InspectorWindow::setObject(sObject object) { if (object) { if (!m_attr_viewer || (m_attr_viewer->getViewedManager() != object)) { shared_ptr<AttributeViewer> viewer = AttributeViewer::create(object); if (viewer) { m_attr_viewer = viewer; m_attr_viewer->setBounds(getLocalBounds()); setContentNonOwned(m_attr_viewer.get(), true); string name = toString(object->getName()); if (name.empty()) name = "Object"; setName(name + " inspector"); } } } else { m_attr_viewer = sAttributeViewer(); setContentNonOwned(nullptr, true); setName("Object inspector"); } }
//============================================================================== MainWindow::MainWindow () : DocumentWindow ("JSDSP", Colours::azure, DocumentWindow::allButtons, true) { setResizable (true, true); // resizability is a property of ResizableWindow setResizeLimits (1200, 500, 1200, 500); setSize (1200, 500); setUsingNativeTitleBar(true); mainComponent = new MainComponent(); setContentNonOwned(mainComponent, false); mainComponent->setVisible(true); mainComponent->setSize(this->getWidth(), this->getHeight()); #if HIDE MainMenuBar *menuBar = new MainMenuBar(); setContentOwned (menuBar, false); // this tells the DocumentWindow to automatically create and manage a MenuBarComponent // which uses our contentComp as its MenuBarModel setMenuBar (menuBar); #endif }
MainAppWindow::MainAppWindow() : DocumentWindow (JUCEApplication::getInstance()->getApplicationName(), Colours::lightgrey, DocumentWindow::allButtons) { setUsingNativeTitleBar (true); setResizable (true, false); setResizeLimits (400, 400, 10000, 10000); #if JUCE_IOS || JUCE_ANDROID setFullScreen (true); #else setBounds ((int) (0.1f * getParentWidth()), (int) (0.1f * getParentHeight()), jmax (850, (int) (0.5f * getParentWidth())), jmax (600, (int) (0.7f * getParentHeight()))); #endif contentComponent = new ContentComponent(); setContentNonOwned (contentComponent, false); setVisible (true); // this lets the command manager use keypresses that arrive in our window to send out commands addKeyListener (getApplicationCommandManager().getKeyMappings()); #if JUCE_WINDOWS || JUCE_LINUX || JUCE_MAC taskbarIcon = new DemoTaskbarComponent(); #endif #if JUCE_ANDROID setOpenGLRenderingEngine(); #endif triggerAsyncUpdate(); }
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 ValueTreeDebugger::construct() { main = new ValueTreeDebuggerMain(); setContentNonOwned (main, true); setResizable (true, false); setUsingNativeTitleBar (true); centreWithSize (getWidth(), getHeight()); setVisible (true); }
DefaultDialogWindow (LaunchOptions& options) : DialogWindow (options.dialogTitle, options.dialogBackgroundColour, options.escapeKeyTriggersCloseButton, true) { setUsingNativeTitleBar (options.useNativeTitleBar); setAlwaysOnTop (juce_areThereAnyAlwaysOnTopWindows()); if (options.content.willDeleteObject()) setContentOwned (options.content.release(), true); else setContentNonOwned (options.content.release(), true); centreAroundComponent (options.componentToCentreAround, getWidth(), getHeight()); setResizable (options.resizable, options.useBottomRightCornerResizer); }
EditorWindow (ValueList& list) : DocumentWindow ("Live Values", Colours::lightgrey, DocumentWindow::closeButton) { setLookAndFeel (&lookAndFeel); setUsingNativeTitleBar (true); viewport.setViewedComponent (new ValueListHolderComponent (list), true); viewport.setSize (700, 600); viewport.setScrollBarsShown (true, false); setContentNonOwned (&viewport, true); setResizable (true, false); setResizeLimits (500, 400, 10000, 10000); centreWithSize (getWidth(), getHeight()); setVisible (true); }
InspectorWindow::InspectorWindow(sAttributeViewer attrsViewer) : BaseWindow("Inspector", Colours::lightgrey, minimiseButton | closeButton, true), m_attr_viewer(attrsViewer) { setResizable(true, false); setResizeLimits(50, 50, 32000, 32000); setTopLeftPosition(0, 0); setSize(300, 440); setVisible(true); if (m_attr_viewer) { m_attr_viewer->setBounds(getLocalBounds()); setContentNonOwned(m_attr_viewer.get(), true); } }
TempDialogWindow (const String& title, Component* contentComponent_, Component* componentToCentreAround, const Colour& colour, const bool escapeKeyTriggersCloseButton_, const bool shouldBeResizable, const bool useBottomRightCornerResizer) : DialogWindow (title, colour, escapeKeyTriggersCloseButton_, true) { if (! JUCEApplication::isStandaloneApp()) setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level setContentNonOwned (contentComponent_, true); centreAroundComponent (componentToCentreAround, getWidth(), getHeight()); setResizable (shouldBeResizable, useBottomRightCornerResizer); }
DefaultDialogWindow (LaunchOptions& options) : DialogWindow (options.dialogTitle, options.dialogBackgroundColour, options.escapeKeyTriggersCloseButton, true) { setUsingNativeTitleBar (options.useNativeTitleBar); if (! JUCEApplication::isStandaloneApp()) setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level if (options.content.willDeleteObject()) setContentOwned (options.content.release(), true); else setContentNonOwned (options.content.release(), true); centreAroundComponent (options.componentToCentreAround, getWidth(), getHeight()); setResizable (options.resizable, options.useBottomRightCornerResizer); }
void InspectorWindow::setPage(sPage page) { if (page) { if (!m_attr_viewer || (m_attr_viewer->getViewedManager() != page)) { shared_ptr<AttributeViewer> viewer = AttributeViewer::create(page); if (viewer) { m_attr_viewer = viewer; m_attr_viewer->setBounds(getLocalBounds()); setContentNonOwned(m_attr_viewer.get(), true); setName("Page inspector"); } } } }
//======================================================= // toggle manuals //======================================================= void CodeWindow::toggleManuals(String manual) { if(!showingHelp) if(manual=="Csound") { String helpDir; if(manual=="Csound") helpDir = appProperties->getUserSettings()->getValue("CsoundHelpDir", ""); if(helpDir.length()<2) CabbageUtils::showMessage("Please set the Csound manual directory in the Preference menu", &getLookAndFeel()); else{ CodeDocument::Position pos1, pos2; pos1 = textEditor->getDocument().findWordBreakBefore(textEditor->getCaretPos()); pos2 = textEditor->getDocument().findWordBreakAfter(textEditor->getCaretPos()); String opcode = csoundDoc.getTextBetween(pos1, pos2); URL urlCsound(helpDir+"/"+opcode.trim()+String(".html")); String urlCabbage; ChildProcess process; File temp1(urlCsound.toString(false)); if(temp1.exists()){ #ifdef LINUX if(!process.start("xdg-open "+urlCsound.toString(false).toUTF8())) CabbageUtils::showMessage("couldn't show file", &getLookAndFeel()); #else htmlHelp->goToURL(urlCsound.toString(false)); showingHelp = true; setContentNonOwned(nullptr, false); setContentNonOwned(htmlHelp, false); #endif } } } else{ String path; #if defined(LINUX) || defined(MACOSX) path = File::getSpecialLocation(File::currentExecutableFile).getParentDirectory().getFullPathName()+"/Docs/cabbage.html"; #else path = File::getSpecialLocation(File::currentExecutableFile).getParentDirectory().getFullPathName()+"\\Docs\\cabbage.html"; #endif if(!File(path).existsAsFile()) CabbageUtils::showMessage( "Could not find Cabbage manual. Make sure\n\ it is located in the Docs folder in the same\n\ directory as the main Cabbage executable", &getLookAndFeel()); else{ ChildProcess process; File temp1(path); if(temp1.exists()){ #ifdef LINUX if(!process.start("xdg-open "+path)) CabbageUtils::showMessage("couldn't show file", &getLookAndFeel()); #else htmlHelp->goToURL(path); showingHelp = true; setContentNonOwned(nullptr, false); setContentNonOwned(htmlHelp, false); #endif } } } else{
//============================================================================== CodeWindow::CodeWindow(String name):DocumentWindow (name, Colours::black, DocumentWindow::allButtons), fontSize(15), showOutput(true), csoundOutputText(""), debugMessage(""), firstTime(true), font(String("Courier New"), 15, 1), showingHelp(false) { setApplicationCommandManagerToWatch(&commandManager); commandManager.registerAllCommandsForTarget(this); addKeyListener(commandManager.getKeyMappings()); textEditor = new CsoundCodeEditor("csound", csoundDoc, &csoundToker); restoreWindowStateFromString (appProperties->getUserSettings()->getValue ("mainWindowPos")); textEditor->addActionListener(this); this->setTitleBarHeight(20); this->setColour(DocumentWindow::backgroundColourId, CabbageUtils::getBackgroundSkin()); setMenuBar(this, 25); setVisible(true); this->setWantsKeyboardFocus(false); if(!appProperties->getUserSettings()->getValue("EditorColourScheme", var(0)).getIntValue()) setEditorColourScheme("white"); else if(appProperties->getUserSettings()->getValue("EditorColourScheme", var(0)).getIntValue()) setEditorColourScheme("dark"); RecentlyOpenedFilesList recentFiles; recentFiles.restoreFromString (appProperties->getUserSettings() ->getValue ("recentlyOpenedFiles")); csdFile = recentFiles.getFile (0); csoundDoc.replaceAllContent(csdFile.loadFileAsString()); //cabbageTimer->addActionListener(this); //cabbageTimer->startTimedEvent(10, "splash"); setResizable(true, false); String opcodeFile = File(File::getSpecialLocation(File::currentExecutableFile)).getParentDirectory().getFullPathName(); opcodeFile += "/opcodes.txt"; Logger::writeToLog(opcodeFile); if(File(opcodeFile).existsAsFile()) textEditor->setOpcodeStrings(File(opcodeFile).loadFileAsString()); //else csound->Message("Could not open opcodes.txt file, parameter display disabled.."); //set up popup for displaying info regarding opcodes.. popupDisplay = new PopupDisplay("Poppy"); popupDisplay->addActionListener(this); popupDisplay->setTitleBarHeight(0); popupDisplay->addToDesktop(0); popupDisplay->setVisible(false); htmlHelp = new WebBrowserComponent(false); setContentNonOwned(textEditor, false); }
void DataWindow::closeButtonPressed() { setContentNonOwned(0,false); setVisible(false); controlButton->setToggleState(false,dontSendNotification); }