예제 #1
0
//==============================================================================
MainWindow::MainWindow()
    : DocumentWindow (IntrojucerApp::getApp().getApplicationName(),
                      Colour::greyLevel (0.6f),
                      DocumentWindow::allButtons,
                      false)
{
    setUsingNativeTitleBar (true);
    createProjectContentCompIfNeeded();

   #if ! JUCE_MAC
    setMenuBar (IntrojucerApp::getApp().menuModel);
   #endif

    setResizable (true, false);
    centreWithSize (800, 600);

    ApplicationCommandManager& commandManager = IntrojucerApp::getCommandManager();

    // Register all the app commands..
    commandManager.registerAllCommandsForTarget (this);
    commandManager.registerAllCommandsForTarget (getProjectContentComponent());

    // update key mappings..
    {
        commandManager.getKeyMappings()->resetToDefaultMappings();

        ScopedPointer <XmlElement> keys (getGlobalProperties().getXmlValue ("keyMappings"));

        if (keys != nullptr)
            commandManager.getKeyMappings()->restoreFromXml (*keys);

        addKeyListener (commandManager.getKeyMappings());
    }

    // don't want the window to take focus when the title-bar is clicked..
    setWantsKeyboardFocus (false);

    getLookAndFeel().setColour (ColourSelector::backgroundColourId, Colours::transparentBlack);

    setResizeLimits (600, 500, 32000, 32000);
}
예제 #2
0
    TempDialogWindow (const String& title,
                      Component* contentComponent_,
                      Component* componentToCentreAround,
                      const Colour& colour,
                      const bool escapeKeyTriggersCloseButton_,
                      const bool shouldBeResizable,
                      const bool useBottomRightCornerResizer,
					  const bool deleteContent = false)
        : DialogWindow (title, colour, escapeKeyTriggersCloseButton_, true),
		deleteDialog(deleteContent)
    {
        if (! JUCEApplication::isStandaloneApp())
            setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level

		if(deleteContent)
			setContentOwned (contentComponent_, true);
		else
			setContentNonOwned (contentComponent_, true);
        centreAroundComponent (componentToCentreAround, getWidth(), getHeight());
        setResizable (shouldBeResizable, useBottomRightCornerResizer);
    }
예제 #3
0
    PluginListWindow (MainHostWindow& owner_, AudioPluginFormatManager& pluginFormatManager)
        : DocumentWindow ("Available Plugins",
                          LookAndFeel::getDefaultLookAndFeel().findColour (ResizableWindow::backgroundColourId),
                          DocumentWindow::minimiseButton | DocumentWindow::closeButton),
          owner (owner_)
    {
        const File deadMansPedalFile (getAppProperties().getUserSettings()
                                        ->getFile().getSiblingFile ("RecentlyCrashedPluginsList"));

        setContentOwned (new PluginListComponent (pluginFormatManager,
                                                  owner.knownPluginList,
                                                  deadMansPedalFile,
                                                  getAppProperties().getUserSettings(), true), true);

        setResizable (true, false);
        setResizeLimits (300, 400, 800, 1500);
        setTopLeftPosition (60, 60);

        restoreWindowStateFromString (getAppProperties().getUserSettings()->getValue ("listWindowPos"));
        setVisible (true);
    }
//==============================================================================
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 (name, instructions, chooserComponent);
    setContentOwned (content, false);

    setResizable (true, true);
    setResizeLimits (300, 300, 1200, 1000);

    content->okButton.addListener (this);
    content->cancelButton.addListener (this);
    content->newFolderButton.addListener (this);
    content->chooserComponent.addListener (this);

    FileChooserDialogBox::selectionChanged();
}
예제 #5
0
//==============================================================================
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]
}
예제 #6
0
FileLocationEditorWindow::FileLocationEditorWindow(int posX, int posY, 
                                                   ApplicationCommandManager* acm, 
                                                   UndoManager& um)
    : DocumentWindow("File Locations",
                     Colour::greyLevel(0.6f),
                     DocumentWindow::allButtons,
                     true)
{
    setUsingNativeTitleBar (true);
    
    setContentOwned(new FileLocationEditor(um, acm), true);
    
    restoreWindowPosition(posX, posY);

    Component::setVisible(true);
    setResizable(true, false);

    setWantsKeyboardFocus (false);

    setResizeLimits(400, 200, 32000, 32000);
}
예제 #7
0
void AudioProcessorEditor::setResizeLimits (int newMinimumWidth,
                                            int newMinimumHeight,
                                            int newMaximumWidth,
                                            int newMaximumHeight) noexcept
{
    // if you've set up a custom constrainer then these settings won't have any effect..
    jassert (constrainer == &defaultConstrainer || constrainer == nullptr);

    const bool shouldEnableResize      = (newMinimumWidth != newMaximumWidth || newMinimumHeight != newMaximumHeight);
    const bool shouldHaveCornerResizer = (shouldEnableResize != resizable    || resizableCorner != nullptr);

    setResizable (shouldEnableResize, shouldHaveCornerResizer);

    if (constrainer == nullptr)
        setConstrainer (&defaultConstrainer);

    defaultConstrainer.setSizeLimits (newMinimumWidth, newMinimumHeight,
                                      newMaximumWidth, newMaximumHeight);

    setBoundsConstrained (getBounds());
}
예제 #8
0
void WhoIsOnline::postInit()
{
    Window::postInit();
    const int h = 350;
    const int w = 200;
    setDefaultSize(w, h, ImagePosition::CENTER);

    setVisible(Visible_false);
    setCloseButton(true);
    setResizable(true);
    setStickyButtonLock(true);
    setSaveVisible(true);

    if (setupWindow)
        setupWindow->registerWindowForReset(this);

    mUpdateButton->setEnabled(false);
    mUpdateButton->setDimension(Rect(5, 5, w - 10, 20 + 5));

    mBrowserBox->setOpaque(Opaque_false);
    mScrollArea->setDimension(Rect(5, 20 + 10, w - 10, h - 10 - 30));
    mScrollArea->setSize(w - 10, h - 10 - 30);
    mScrollArea->setSelectable(false);
    mBrowserBox->setLinkHandler(this);

    add(mUpdateButton);
    add(mScrollArea);

    setLocationRelativeTo(getParent());

    loadWindowState();
    enableVisibleSound(true);

    download();

    widgetResized(Event(nullptr));
    config.addListener("updateOnlineList", this);
    config.addListener("groupFriends", this);
    mGroupFriends = config.getBoolValue("groupFriends");
}
예제 #9
0
OutfitWindow::OutfitWindow():
    Window(_("Outfits")),
    mBoxWidth(33),
    mBoxHeight(33),
    mGridWidth(3),
    mGridHeight(3),
    mItemClicked(false),
    mItemMoved(NULL),
    mItemSelected(-1),
    mCurrentOutfit(0)
{
    setWindowName("Outfits");
    setResizable(true);
    setCloseButton(true);
    setDefaultSize(250, 250, 118, 180);

    mPreviousButton = new Button(_("<"), "previous", this);
    mNextButton = new Button(_(">"), "next", this);
    mCurrentLabel = new Label(strprintf(_("Outfit: %d"), 1));
    mCurrentLabel->setAlignment(gcn::Graphics::CENTER);
    mUnequipCheck = new CheckBox(_("Unequip first"),
                                 config.getValue("OutfitUnequip0", true));

    mUnequipCheck->setActionEventId("unequip");
    mUnequipCheck->addActionListener(this);

    place(0, 3, mPreviousButton, 1);
    place(1, 3, mCurrentLabel, 2);
    place(3, 3, mNextButton, 1);
    place(0, 4, mUnequipCheck, 4);

    Layout &layout = getLayout();
    layout.setRowHeight(0, Layout::AUTO_SET);
    layout.setColWidth(4, Layout::CENTER);

    loadWindowState();

    load();
}
예제 #10
0
DebugWindow::DebugWindow() :
    // TRANSLATORS: debug window name
    Window(_("Debug"), Modal_false, nullptr, "debug.xml"),
    mTabs(CREATEWIDGETR(TabbedArea, this)),
    mMapWidget(new MapDebugTab(this)),
    mTargetWidget(new TargetDebugTab(this)),
    mNetWidget(new NetDebugTab(this))
{
    setWindowName("Debug");
    if (setupWindow)
        setupWindow->registerWindowForReset(this);

    setResizable(true);
    setCloseButton(true);
    setSaveVisible(true);
    setStickyButtonLock(true);

    setDefaultSize(400, 300, ImagePosition::CENTER);

    mTabs->setSelectable(false);
    mTabs->getWidgetContainer()->setSelectable(false);
    mTabs->getTabContainer()->setSelectable(false);
    // TRANSLATORS: debug window tab
    mTabs->addTab(std::string(_("Map")), mMapWidget);
    // TRANSLATORS: debug window tab
    mTabs->addTab(std::string(_("Target")), mTargetWidget);
    // TRANSLATORS: debug window tab
    mTabs->addTab(std::string(_("Net")), mNetWidget);

    mTabs->setDimension(Rect(0, 0, 600, 300));

    const int w = mDimension.width;
    const int h = mDimension.height;
    mMapWidget->resize(w, h);
    mTargetWidget->resize(w, h);
    mNetWidget->resize(w, h);
    loadWindowState();
    enableVisibleSound(true);
}
예제 #11
0
void pWindow::setGeometry(Geometry geometry) {
  locked = true;
  Application::processEvents();
  QApplication::syncX();
  Geometry margin = frameMargin();

  setResizable(window.state.resizable);
  qtWindow->move(geometry.x - frameMargin().x, geometry.y - frameMargin().y);
  //qtWindow->adjustSize() fails if larger than 2/3rds screen size
  qtWindow->resize(qtWindow->sizeHint());
  if(window.state.resizable) {
    //required to allow shrinking window from default size
    qtWindow->setMinimumSize(1, 1);
    qtContainer->setMinimumSize(1, 1);
  }

  for(auto& layout : window.state.layout) {
    geometry.x = geometry.y = 0;
    layout.setGeometry(geometry);
  }
  locked = false;
}
예제 #12
0
Minimap::Minimap():
    Window(_("Map")),
    mMapImage(0),
    mWidthProportion(0.5),
    mHeightProportion(0.5)
{
    setWindowName("MiniMap");
    mShow = config.getValue(getWindowName() + "Show", true);
    setDefaultSize(5, 25, 100, 100);
    // set this to false as the minimap window size is changed
    //depending on the map size
    setResizable(false);

    setDefaultVisible(true);
    setSaveVisible(true);

    setStickyButton(true);
    setSticky(false);

    loadWindowState();
    setVisible(mShow, isSticky());
}
예제 #13
0
//==============================================================================
MainAppWindow::MainAppWindow()
:   
// Initialise the base 'DocumentWindow'...
DocumentWindow (
				"The Melody Stochaster",        // Set the text to use for the title
				Colours::azure,					// Set the colour of the window
				DocumentWindow::allButtons,		// Set which buttons are displayed
				true							// This window should be added to the desktop
				)
{
    setResizable (false, false);
	
	setTitleBarHeight (22);
	
	// create the main component, which is described in MainComponent.h
    MainComponent* contentComponent = new MainComponent ();
	
    // This sets the main content component for the window to be whatever MainComponent
    // is. The nature of DocumentWindow means that the contentComponent will fill the main
	// area of the window, and will be deleted automatically when the window is deleted.
    setContentOwned (contentComponent, false);
}
예제 #14
0
ShortcutWindow::ShortcutWindow(const std::string &title,
                               ShortcutContainer *content)
{
    setWindowName(title);
    // no title presented, title bar is padding so window can be moved.
    gcn::Window::setTitleBarHeight(gcn::Window::getPadding());
    setShowTitle(false);
    setResizable(true);
    setDefaultVisible(false);
    setSaveVisible(true);
    setupWindow->registerWindowForReset(this);

    mItems = content;

    const int border = SCROLL_PADDING * 2 + getPadding() * 2;
    setMinWidth(mItems->getBoxWidth() + border);
    setMinHeight(mItems->getBoxHeight() + border);
    setMaxWidth(mItems->getBoxWidth() * mItems->getMaxItems() + border);
    setMaxHeight(mItems->getBoxHeight() * mItems->getMaxItems() + border);

    setDefaultSize(mItems->getBoxWidth() + border, mItems->getBoxHeight() *
                   mItems->getMaxItems() + border, ImageRect::LOWER_RIGHT,
                   mBoxesWidth, 0);

    mBoxesWidth += mItems->getBoxWidth() + border;

    mScrollArea = new ScrollArea(mItems);
    mScrollArea->setPosition(SCROLL_PADDING, SCROLL_PADDING);
    mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
    mScrollArea->setOpaque(false);

    place(0, 0, mScrollArea, 5, 5).setPadding(0);

    Layout &layout = getLayout();
    layout.setRowHeight(0, Layout::AUTO_SET);
    layout.setMargin(0);

    loadWindowState();
}
예제 #15
0
//==============================================================================
MainDPCWindow::MainDPCWindow()
    : DocumentWindow ("TCAT DPC Tool",
                      TCATLookAndFeel::tcatSurround,
                      DocumentWindow::allButtons,
                      true)
{
    int		status;

    status = m_dpc.install( NULL, 0 );
    if (status != DPC_NO_ERROR)
    {
        DBG( String::formatted( "Unable to install DPC Checker (error: %d)", status ));
    }

    status = m_dpc.open();
    if (status != DPC_NO_ERROR)
    {
        DBG( String::formatted( "Unable to open DPC Checker (error: %d)", status ));
    }

    status = m_dpc.setChkTimerDefault( true );
    if (status != DPC_NO_ERROR)
    {
        DBG( String::formatted( "Unable to start DPC Checker (error: %d)", status ));
    }

    commandManager = new ApplicationCommandManager();

    setResizable( false, false ); // resizability is a property of ResizableWindow

    ContentComp* contentComp = new ContentComp( this );

    // sets the main content component for the window to be this tabbed
    // panel. This will be deleted when the window is deleted.
    setContentOwned( contentComp, false );

    setVisible( true );
}
예제 #16
0
EmoteWindow::EmoteWindow() :
    // TRANSLATORS: emotes window name
    Window(_("Emotes"), Modal_false, nullptr, "emotes.xml"),
    mTabs(CREATEWIDGETR(TabbedArea, this)),
    mEmotePage(new EmotePage(this)),
    mColorModel(ColorModel::createDefault(this)),
    mColorPage(CREATEWIDGETR(ColorPage, this, mColorModel, "colorpage.xml")),
    mScrollColorPage(new ScrollArea(this, mColorPage, Opaque_false,
        "emotepage.xml")),
    mFontModel(new NamesModel),
    mFontPage(CREATEWIDGETR(ListBox, this, mFontModel, "")),
    mScrollFontPage(new ScrollArea(this, mFontPage, Opaque_false,
        "fontpage.xml")),
    mImageSet(Theme::getImageSetFromThemeXml("emotetabs.xml", "", 17, 16))
{
    setShowTitle(false);
    setResizable(true);

    if (setupWindow)
        setupWindow->registerWindowForReset(this);

    addMouseListener(this);
}
예제 #17
0
//==============================================================================
MainAppWindow::MainAppWindow()
: DocumentWindow (JUCEApplication::getInstance()->getApplicationName(),
                  Colours::black,
                  DocumentWindow::allButtons)
{
    mainComponent = new MainComponent();
   
	setContentOwned (mainComponent, false);
    setMenuBar(mainComponent);
    
#if JUCE_MAC
    MenuBarModel::setMacMainMenu (mainComponent);
    setMenuBar (0);
#endif
    setUsingNativeTitleBar (true);
   
    setResizable (true, false);
	centreWithSize (650, 425);
    
    setVisible (true);
    setWantsKeyboardFocus(false);

}
예제 #18
0
StorageWindow::StorageWindow(int invSize):
    Window(_("Storage")),
    mMaxSlots(invSize),
    mItemDesc(false)
{
    setWindowName("Storage");
    setResizable(true);
    saveVisibility(false);
    setCloseButton(true);

    setDefaultSize(375, 300, ImageRect::CENTER);

    mRetrieveButton = new Button(_("Retrieve"), "retrieve", this);
    mRetrieveButton->setEnabled(false);

    mCloseButton = new Button(_("Close"), "close", this);

    mItems = new ItemContainer(player_node->getStorage(), "showpopupmenu", this);
    mItems->addSelectionListener(this);

    mInvenScroll = new ScrollArea(mItems);
    mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);

    mUsedSlots = player_node->getStorage()->getNumberOfSlotsUsed();

    mSlotsLabel = new Label(_("Slots:"));

    mSlotsBar = new ProgressBar(1.0f, 100, 20, gcn::Color(225, 200, 25));
    mSlotsBar->setText(strprintf("%d/%d", mUsedSlots, mMaxSlots));
    mSlotsBar->setProgress((float) mUsedSlots / mMaxSlots);

    setMinHeight(130);
    setMinWidth(200);

    fontChanged();
    loadWindowState();
}
예제 #19
0
ShortcutWindow::ShortcutWindow(ShortcutContainer *content):
    Window("", false, NULL, "graphics/gui/gui.xml", true)
{
    // no title presented, title bar is padding so window can be moved.
    gcn::Window::setTitleBarHeight(gcn::Window::getPadding());
    setWindowName(content->getShortcutHandler()->getPrefix());
    setShowTitle(false);
    setResizable(true);

    mItems = content;

    const int border = SCROLL_PADDING * 2 + getPadding() * 2;

    setMinWidth(mItems->getBoxWidth() + border);
    setMinHeight(mItems->getBoxHeight() + border);
    setMaxWidth(mItems->getBoxWidth() * mItems->getMaxShortcuts() + border);
    setMaxHeight(mItems->getBoxHeight() * mItems->getMaxShortcuts() + border);

    setDefaultSize(mItems->getBoxWidth() + border, (mItems->getBoxHeight() *
                   mItems->getMaxShortcuts()) + border, ImageRect::LOWER_RIGHT,
                   -mInstances * (mItems->getBoxWidth() + 2 * getPadding()), 0);

    mInstances++;

    mScrollArea = new ScrollArea(mItems);
    mScrollArea->setPosition(SCROLL_PADDING, SCROLL_PADDING);
    mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
    mScrollArea->setOpaque(false);

    place(0, 0, mScrollArea, 5, 5).setPadding(0);

    Layout &layout = getLayout();
    layout.setRowHeight(0, Layout::AUTO_SET);
    layout.setMargin(0);

    loadWindowState();
}
예제 #20
0
Minimap::Minimap() :
    // TRANSLATORS: mini map window name
    Window(_("Map"), false, nullptr, "map.xml"),
    mWidthProportion(0.5),
    mHeightProportion(0.5),
    mMapImage(nullptr),
    mTextPopup(new TextPopup),
    mMapOriginX(0),
    mMapOriginY(0),
    mCustomMapImage(false),
    mAutoResize(config.getBoolValue("autoresizeminimaps"))
{
    mTextPopup->postInit();

    setWindowName("Minimap");
    mShow = config.getValueBool(getWindowName() + "Show", true);

    config.addListener("autoresizeminimaps", this);

    setDefaultSize(5, 25, 100, 100);
    // set this to false as the minimap window size is changed
    // depending on the map size
    setResizable(true);
    if (setupWindow)
        setupWindow->registerWindowForReset(this);

    setDefaultVisible(true);
    setSaveVisible(true);

    setStickyButton(true);
    setSticky(false);

    loadWindowState();
    setVisible(mShow, isSticky());
    enableVisibleSound(true);
}
예제 #21
0
GcWindow::GcWindow()
{
    qRegisterMetaType<QWidget*>("controls");
    qRegisterMetaType<RideItem*>("ride");
    qRegisterMetaType<GcWinID>("type");
    qRegisterMetaType<QColor>("color");
    qRegisterMetaType<DateRange>("dateRange");
    qRegisterMetaType<bool>("nomenu");
    revealed = false;
    setControls(NULL);
    setRideItem(NULL);
    setTitle("");
    setContentsMargins(0,0,0,0);
    setResizable(false);
    setMouseTracking(true);
    setProperty("color", Qt::white);
    setProperty("nomenu", false);

    // make sure its underneath the toggle button
    menuButton = new QToolButton(this);
    menuButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    menuButton->setCursor(Qt::ArrowCursor);
    menuButton->setPopupMode(QToolButton::InstantPopup);
    menuButton->setFixedSize(15,20);

    menu = new QMenu(this);
    menuButton->setMenu(menu);
    menu->addAction(tr("Close"), this, SLOT(_closeWindow()));

    menuButton->hide();


#ifndef Q_OS_MAC // spacing ..
    menuButton->move(0,0);
#endif
}
예제 #22
0
ServerInfoWindow::ServerInfoWindow(ServerInfo &serverInfo) :
    // TRANSLATORS: servers dialog name
    Window(_("Server info"), Modal_false, nullptr, "serverinfo.xml"),
    LinkHandler(),
    mServerInfo(serverInfo),
    mBrowserBox(new StaticBrowserBox(this, Opaque_true,
        "browserbox.xml")),
    mScrollArea(new ScrollArea(this, mBrowserBox,
        Opaque_true, "serverinfo_background.xml"))
{
    setMinWidth(300);
    setMinHeight(220);
    setContentSize(455, 350);
    setWindowName("ServerInfoWindow");
    setCloseButton(true);
    setResizable(true);
    setStickyButtonLock(true);

    setDefaultSize(500, 400, ImagePosition::CENTER, 0, 0);

    mBrowserBox->setOpaque(Opaque_false);
    mBrowserBox->setLinkHandler(this);
    if (gui != nullptr)
        mBrowserBox->setFont(gui->getHelpFont());
    mBrowserBox->setProcessVars(true);
    mBrowserBox->setEnableTabs(true);

    place(0, 0, mScrollArea, 5, 3).setPadding(3);

    Layout &layout = getLayout();
    layout.setRowHeight(0, LayoutType::SET);

    loadWindowState();
    enableVisibleSound(true);
    widgetResized(Event(nullptr));
}
예제 #23
0
//==============================================================================
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));

}
예제 #24
0
EditServerDialog::EditServerDialog(ServerDialog *parent, ServerInfo server,
                                   int index) :
    Window(_("Edit Server"), true, parent),
    mServerDialog(parent),
    mServer(server),
    mIndex(index)
{
    setWindowName("EditServerDialog");

    Label *nameLabel = new Label(_("Name:"));
    Label *serverAdressLabel = new Label(_("Address:"));
    Label *portLabel = new Label(_("Port:"));
    Label *typeLabel = new Label(_("Server type:"));
    Label *descriptionLabel = new Label(_("Description:"));
    mServerAddressField = new TextField(std::string());
    mPortField = new TextField(std::string());
    mPortField->setNumeric(true);
    mPortField->setRange(1, 65535);

    mTypeListModel = new TypeListModel();
    mTypeField = new DropDown(mTypeListModel);
    mTypeField->setSelected(0); // TmwAthena by default for now.

    mNameField = new TextField(std::string());
    mDescriptionField = new TextField(std::string());

    mOkButton = new Button(_("OK"), "addServer", this);
    mCancelButton = new Button(_("Cancel"), "cancel", this);

    mServerAddressField->addActionListener(this);
    mPortField->addActionListener(this);

    place(0, 0, nameLabel);
    place(1, 0, mNameField, 4).setPadding(3);
    place(0, 1, serverAdressLabel);
    place(1, 1, mServerAddressField, 4).setPadding(3);
    place(0, 2, portLabel);
    place(1, 2, mPortField, 4).setPadding(3);
    place(0, 3, typeLabel);
    place(1, 3, mTypeField).setPadding(3);
    place(0, 4, descriptionLabel);
    place(1, 4, mDescriptionField, 4).setPadding(3);
    place(4, 5, mOkButton);
    place(3, 5, mCancelButton);

    // Do this manually instead of calling reflowLayout so we can enforce a
    // minimum width.
    int width = 0, height = 0;
    getLayout().reflow(width, height);
    if (width < 300)
    {
        width = 300;
        getLayout().reflow(width, height);
    }
    if (height < 120)
    {
        height = 120;
        getLayout().reflow(width, height);
    }

    setContentSize(width, height);

    setMinWidth(getWidth());
    setMinHeight(getHeight());
    setDefaultSize(getWidth(), getHeight(), ImageRect::CENTER);

    setResizable(false);
    addKeyListener(this);

    loadWindowState();

    mNameField->setText(mServer.name);
    mDescriptionField->setText(mServer.description);
    mServerAddressField->setText(mServer.hostname);
    mPortField->setText(toString(mServer.port));

    switch (mServer.type)
    {
#ifdef EATHENA_SUPPORT
        case ServerInfo::EATHENA:
            mTypeField->setSelected(2);
            break;
        case ServerInfo::MANASERV:
#ifdef MANASERV_SUPPORT
            mTypeField->setSelected(3);
            break;
#endif
#else
        case ServerInfo::MANASERV:
#ifdef MANASERV_SUPPORT
            mTypeField->setSelected(2);
            break;
#endif
#endif
        default:
        case ServerInfo::UNKNOWN:
        case ServerInfo::TMWATHENA:
            mTypeField->setSelected(0);
            break;
        case ServerInfo::EVOL:
            mTypeField->setSelected(1);
            break;
    }

    setLocationRelativeTo(getParentWindow());
    setVisible(true);

    mNameField->requestFocus();
}
예제 #25
0
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
StupidWindow::StupidWindow(const String& commandLine, bool startHidden):
DocumentWindow(L"Pedalboard 2", Colours::black, DocumentWindow::allButtons)
{
	//Make sure we've loaded all the available plugin formats before we create
	//the main panel.
	{
		InternalPluginFormat *internalFormat = new InternalPluginFormat;
		//LADSPAPluginFormat *ladspaFormat = new LADSPAPluginFormat;
		//VSTPluginFormat *vstFormat = new VSTPluginFormat;
		//NiallsAudioPluginFormat *napFormat = new NiallsAudioPluginFormat;

		AudioPluginFormatManagerSingleton::getInstance().addFormat(internalFormat);
		//AudioPluginFormatManager::getInstance()->addFormat(napFormat);
		//AudioPluginFormatManager::getInstance()->addFormat(vstFormat);
		//AudioPluginFormatManager::getInstance()->addFormat(ladspaFormat);
	}

	//Load correct colour scheme.
	{
		String scheme = PropertiesSingleton::getInstance().getUserSettings()->getValue(L"colourScheme");

		if(scheme != String::empty)
			ColourScheme::getInstance().loadPreset(scheme);
	}

	LookAndFeel::setDefaultLookAndFeel(laf = new BranchesLAF());
	setResizable(true, false);
	setContentOwned(mainPanel = new MainPanel(&commandManager), true);
	//mainPanel->setCommandManager(&commandManager);
	centreWithSize(1024, 580);
	setUsingNativeTitleBar(true);
	//setDropShadowEnabled(false);
	if(!startHidden)
		setVisible(true);
#ifndef __APPLE__
	setMenuBar(mainPanel);
#endif

	//Attempts to associate our icon with the window's titlebar.
	getPeer()->setIcon(ImageCache::getFromMemory(Images::icon512_png,
												 Images::icon512_pngSize));

	commandManager.registerAllCommandsForTarget(mainPanel);
    commandManager.registerAllCommandsForTarget(JUCEApplication::getInstance());

	commandManager.getKeyMappings()->resetToDefaultMappings();

	loadKeyMappings();

	addKeyListener(commandManager.getKeyMappings());

	restoreWindowStateFromString(PropertiesSingleton::getInstance().getUserSettings()->getValue("WindowState"));

	//See if we can load a .pdl file from the commandline.
	File initialFile(commandLine);

	if(initialFile.existsAsFile())
	{
		if(initialFile.getFileExtension() == L".pdl")
		{
			mainPanel->loadDocument(initialFile);
			mainPanel->setLastDocumentOpened(initialFile);
			mainPanel->setFile(initialFile);
			mainPanel->setChangedFlag(false);
		}
	}
}
예제 #26
0
//==============================================================================
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);
}
예제 #27
0
//==============================================================================
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);
    }
}
예제 #28
0
파일: trade.cpp 프로젝트: kai62656/manabot
TradeWindow::TradeWindow():
    Window(_("Trade: You")),
    mMyInventory(new Inventory(INVENTORY_SIZE)),
    mPartnerInventory(new Inventory(INVENTORY_SIZE)),
    mStatus(PROPOSING)
{
    setWindowName("Trade");
    setResizable(true);
    setCloseButton(true);
    setDefaultSize(386, 180, ImageRect::CENTER);
    setMinWidth(386);
    setMinHeight(180);

    std::string longestName = getFont()->getWidth(_("OK")) >
                                   getFont()->getWidth(_("Trade")) ?
                                   _("OK") : _("Trade");

    mAddButton = new Button(_("Add"), "add", this);
    mOkButton = new Button("", "", this); // Will be filled in later

    int width = std::max(mOkButton->getFont()->getWidth(CAPTION_PROPOSE),
                         mOkButton->getFont()->getWidth(CAPTION_CONFIRMED));
    width = std::max(width, mOkButton->getFont()->getWidth(CAPTION_ACCEPT));
    width = std::max(width, mOkButton->getFont()->getWidth(CAPTION_ACCEPTED));

    mOkButton->setWidth(8 + width);

    mMyItemContainer = new ItemContainer(mMyInventory.get());
    mMyItemContainer->addSelectionListener(this);

    ScrollArea *myScroll = new ScrollArea(mMyItemContainer);
    myScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);

    mPartnerItemContainer = new ItemContainer(mPartnerInventory.get());
    mPartnerItemContainer->addSelectionListener(this);

    ScrollArea *partnerScroll = new ScrollArea(mPartnerItemContainer);
    partnerScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);

    mMoneyLabel = new Label(strprintf(_("You get %s."), ""));
    gcn::Label *mMoneyLabel2 = new Label(_("You give:"));

    mMoneyField = new TextField;
    mMoneyField->setWidth(40);
    mMoneyChangeButton = new Button(_("Change"), "money", this);

    place(1, 0, mMoneyLabel);
    place(0, 1, myScroll).setPadding(3);
    place(1, 1, partnerScroll).setPadding(3);
    ContainerPlacer place;
    place = getPlacer(0, 0);
    place(0, 0, mMoneyLabel2);
    place(1, 0, mMoneyField);
    place(2, 0, mMoneyChangeButton).setHAlign(LayoutCell::LEFT);
    place = getPlacer(0, 2);
    place(0, 0, mAddButton);
    place(1, 0, mOkButton);
    Layout &layout = getLayout();
    layout.extend(0, 2, 2, 1);
    layout.setRowHeight(1, Layout::AUTO_SET);
    layout.setRowHeight(2, 0);
    layout.setColWidth(0, Layout::AUTO_SET);
    layout.setColWidth(1, Layout::AUTO_SET);

    loadWindowState();

    reset();
}
예제 #29
0
MailViewWindow::MailViewWindow(const MailMessage *const message) :
    // TRANSLATORS: mail view window name
    Window(_("View mail"), Modal_false, nullptr, "mailview.xml"),
    ActionListener(),
    mMessage(message),
    // TRANSLATORS: mail view window button
    mGetAttachButton(nullptr),
    // TRANSLATORS: mail view window button
    mCloseButton(new Button(this, _("Close"), "close", this)),
    mPrevButton(new Button(this, "<", "prev", this)),
    mNextButton(new Button(this, ">", "next", this)),
    // TRANSLATORS: mail view window button
    mReplyButton(new Button(this, _("Reply"), "reply", this)),
    // TRANSLATORS: mail view window label
    mTimeLabel(new Label(this, strprintf("%s %s", _("Time:"),
        message->strTime.c_str()))),
    mMoneyLabel(nullptr),
    // TRANSLATORS: mail view window label
    mFromLabel(new Label(this, strprintf("%s %s", _("From:"),
        message->sender.c_str()))),
    // TRANSLATORS: mail view window label
    mSubjectLabel(new Label(this, strprintf("%s %s", _("Subject:"),
        message->title.c_str()))),
    // TRANSLATORS: mail view window label
    mMessageLabel(new Label(this, strprintf("%s %s", _("Message:"),
        message->text.c_str()))),
    // TRANSLATORS: mail view window label
    mItemLabel(nullptr),
    mIcon(nullptr)
{
    setWindowName("MailView");
    setCloseButton(true);
    setResizable(true);
    setSaveVisible(false);
    setStickyButtonLock(true);
    setVisible(Visible_true);

    setDefaultSize(380, 230, ImageRect::CENTER);
    setMinWidth(200);
    setMinHeight(100);
    center();

    ContainerPlacer placer;
    placer = getPlacer(0, 0);

    int n = 0;
    placer(0, n++, mTimeLabel);
    placer(0, n++, mFromLabel);
    placer(0, n++, mSubjectLabel);
    if (message->money)
    {
        // TRANSLATORS: mail view window label
        mMoneyLabel = new Label(this, strprintf("%s %d", _("Money:"),
            message->money));
        placer(0, n++, mMoneyLabel);
    }
    placer(0, n++, mMessageLabel);
    if (message->itemId)
    {
        const ItemInfo &item = ItemDB::get(message->itemId);
        // +++ need use message->cards and ItemColorManager for colors
        Image *const image = resourceManager->getImage(combineDye2(
            paths.getStringValue("itemIcons").append(
            item.getDisplay().image),
            item.getDyeIconColorsString(ItemColor_one)));

        mIcon = new Icon(this, image);
        if (message->itemAmount != 1)
        {
            mItemLabel = new Label(this, std::string(_("Item:")).append(
                " (").append(toString(message->itemAmount)).append(") "));
        }
        else
        {
            mItemLabel = new Label(this, std::string(_("Item:")).append(" "));
        }
        placer(0, n, mItemLabel);
        placer(1, n++, mIcon);
    }
    if (message->money || message->itemId)
    {
        mGetAttachButton = new Button(this, _("Get attach"), "attach", this);
        placer(0, n++, mGetAttachButton);
    }
    ContainerPlacer placer2;
    placer2 = getPlacer(0, n);

    placer2(0, 0, mPrevButton);
    placer2(1, 0, mNextButton);
    placer2(3, 0, mReplyButton);
    placer2(4, 0, mCloseButton);

    loadWindowState();
    enableVisibleSound(true);
}
예제 #30
0
void BuyDialog::init()
{
    setWindowName("Buy");
    setResizable(true);
    setCloseButton(true);
    setStickyButtonLock(true);
    setMinWidth(260);
    setMinHeight(220);
    setDefaultSize(260, 230, ImageRect::CENTER);

    if (setupWindow)
        setupWindow->registerWindowForReset(this);

    mShopItems = new ShopItems;

    mShopItemList = new ShopListBox(this, mShopItems, mShopItems);
    mShopItemList->postInit();
    mScrollArea = new ScrollArea(this, mShopItemList,
        getOptionBool("showbackground"), "buy_background.xml");
    mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);

    mSlider = new Slider(this, 1.0, 1.0);
    mQuantityLabel = new Label(this, strprintf(
        "%d / %d", mAmountItems, mMaxItems));
    mQuantityLabel->setAlignment(Graphics::CENTER);
    // TRANSLATORS: buy dialog label
    mMoneyLabel = new Label(this, strprintf(
        _("Price: %s / Total: %s"), "", ""));

    mAmountField = new IntTextField(this, 1, 1, 123);
    mAmountField->setActionEventId("amount");
    mAmountField->addActionListener(this);
    mAmountField->setSendAlwaysEvents(true);
    mAmountField->setEnabled(false);

    // TRANSLATORS: buy dialog label
    mAmountLabel = new Label(this, _("Amount:"));
    mAmountLabel->adjustSize();

    // TRANSLATORS: This is a narrow symbol used to denote 'increasing'.
    // You may change this symbol if your language uses another.
    mIncreaseButton = new Button(this, _("+"), "inc", this);
    // TRANSLATORS: This is a narrow symbol used to denote 'decreasing'.
    // You may change this symbol if your language uses another.
    mDecreaseButton = new Button(this, _("-"), "dec", this);
    // TRANSLATORS: buy dialog button
    mBuyButton = new Button(this, mNpcId == fromInt(Items, BeingId)
        ? _("Create") :_("Buy"), "buy", this);
    // TRANSLATORS: buy dialog button
    mQuitButton = new Button(this, _("Quit"), "quit", this);
    // TRANSLATORS: buy dialog button
    mAddMaxButton = new Button(this, _("Max"), "max", this);

    mDecreaseButton->adjustSize();
    mDecreaseButton->setWidth(mIncreaseButton->getWidth());

    mIncreaseButton->setEnabled(false);
    mDecreaseButton->setEnabled(false);
    mBuyButton->setEnabled(false);
    mSlider->setEnabled(false);

    mSlider->setActionEventId("slider");
    mSlider->addActionListener(this);

    mShopItemList->setDistributeMousePressed(false);
    mShopItemList->setActionEventId("buy");
    mShopItemList->addActionListener(this);
    mShopItemList->addSelectionListener(this);

    mFilterTextField->setWidth(100);

    ContainerPlacer placer = getPlacer(0, 0);
    placer(0, 0, mScrollArea, 9, 5).setPadding(3);
    placer(0, 5, mDecreaseButton);
    placer(1, 5, mSlider, 4);
    placer(5, 5, mIncreaseButton);
    placer(6, 5, mQuantityLabel, 2);
    placer(8, 5, mAddMaxButton);
    placer(0, 6, mAmountLabel, 2);
    placer(2, 6, mAmountField, 2);
    placer(0, 7, mMoneyLabel, 8);
    if (mSortDropDown)
    {
        placer(0, 8, mSortDropDown, 2);
    }
    else
    {
        // TRANSLATORS: buy dialog label
        mFilterLabel = new Label(this, _("Filter:"));
        mFilterLabel->adjustSize();
        placer(0, 8, mFilterLabel, 2);
    }
    placer(2, 8, mFilterTextField, 2);
    placer(7, 8, mBuyButton);
    placer(8, 8, mQuitButton);

    Layout &layout = getLayout();
    layout.setRowHeight(0, LayoutType::SET);

    center();
    loadWindowState();
    enableVisibleSound(true);

    instances.push_back(this);
    setVisible(Visible_true);

    if (mSortDropDown)
        mSortDropDown->setSelected(config.getIntValue("buySortOrder"));
}