コード例 #1
0
ファイル: mlrVSTGUI.cpp プロジェクト: grimtraveller/mlrVST
//==============================================================================
mlrVSTGUI::mlrVSTGUI (mlrVSTAudioProcessor* owner, const int &newNumChannels, const int &newNumStrips)
    : AudioProcessorEditor (owner),

    // Communication ////////////////////////
    parent(owner),
    // Style / positioning objects //////////
    myLookAndFeel(), overrideLF(),

    // Fonts ///////////////////////////////////////////////////////
    fontSize(12.f), defaultFont("ProggyCleanTT", 18.f, Font::plain),

    // Volume controls //////////////////////////////////////////////////
    masterGainSlider("master gain"), masterSliderLabel("master", "mstr"),
    slidersArray(), slidersMuteBtnArray(),

    // Tempo controls ///////////////////////////////////////
    bpmSlider("bpm slider"), bpmLabel(),
    quantiseSettingsCbox("quantise settings"),
    quantiseLabel("quantise label", "quant."),

    // Buttons //////////////////////////////////
    loadFilesBtn("load samples", "load samples"),
    sampleStripToggle("sample strip toggle", DrawableButton::ImageRaw),
    patternStripToggle("pattern strip toggle", DrawableButton::ImageRaw),
    sampleImg(), patternImg(),

    // Record / Resample / Pattern UI ////////////////////////////////////////
    precountLbl("precount", "precount"), recordLengthLbl("length", "length"), bankLbl("bank", "bank"),
    recordPrecountSldr(), recordLengthSldr(), recordBankSldr(),
    resamplePrecountSldr(), resampleLengthSldr(), resampleBankSldr(),
    patternPrecountSldr(), patternLengthSldr(), patternBankSldr(),
    recordBtn("record", Colours::black, Colours::white),
    resampleBtn("resample", Colours::black, Colours::white),
    patternBtn("pattern", Colours::black, Colours::white),

    // branding
    vstNameLbl("vst label", "mlrVST"),

    // Misc ///////////////////////////////////////////
    lastDisplayedPosition(),
    debugButton("loadfile", DrawableButton::ImageRaw),    // temporary button

    // Presets //////////////////////////////////////////////////
    presetLabel("presets", "presets"), presetCbox(),
    presetPrevBtn("prev", 0.25, Colours::black, Colours::white),
    presetNextBtn("next", 0.75, Colours::black, Colours::white),
    addPresetBtn("add", "add preset"),
    toggleSetlistBtn("setlist"),
    presetPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725),
    presetPanel(presetPanelBounds, owner),


    // Settings ///////////////////////////////////////
    numChannels(newNumChannels), useExternalTempo(true),
    toggleSettingsBtn("settings"),
    settingsPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725),
    settingsPanel(settingsPanelBounds, owner, this),

    // Mappings //////////////////////////////////////
    mappingPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725),
    toggleMappingBtn("mappings"),
    mappingPanel(mappingPanelBounds, owner),

    // SampleStrip controls ///////////////////////////
    sampleStripControlArray(), numStrips(newNumStrips),
    waveformControlHeight( (GUI_HEIGHT - numStrips * PAD_AMOUNT) / numStrips),
    waveformControlWidth(THUMBNAIL_WIDTH),

    // Overlays //////////////////////////////
    patternStripArray(), hintOverlay(owner)
{
    DBG("GUI loaded " << " strips of height " << waveformControlHeight);

    parent->addChangeListener(this);

    // these are compile time constants
    setSize(GUI_WIDTH, GUI_HEIGHT);
    setWantsKeyboardFocus(true);

    int xPosition = PAD_AMOUNT;
    int yPosition = PAD_AMOUNT;

    // set up volume sliders
    buildSliders(xPosition, yPosition);

    // add the bpm slider and quantise settings
    setupTempoUI(xPosition, yPosition);

    // set up the various panels (settings, mapping, etc)
    // and the buttons that control them
    setupPanels(xPosition, yPosition);

    // preset associated UI elements
    setupPresetUI(xPosition, yPosition);


    // useful UI debugging components
    addAndMakeVisible(&debugButton);
    debugButton.addListener(this);
    debugButton.setColour(DrawableButton::backgroundColourId, Colours::blue);
    debugButton.setBounds(50, 300, 50, 25);

    sampleImg.setImage(ImageCache::getFromMemory(BinaryData::waveform_png, BinaryData::waveform_pngSize));
    patternImg.setImage(ImageCache::getFromMemory(BinaryData::pattern_png, BinaryData::pattern_pngSize));

    addAndMakeVisible(&sampleStripToggle);
    sampleStripToggle.addListener(this);
    sampleStripToggle.setImages(&sampleImg);
    sampleStripToggle.setBounds(100, 300, 70, 25);
    displayMode = modeSampleStrips;

    addAndMakeVisible(&loadFilesBtn);
    loadFilesBtn.addListener(this);
    loadFilesBtn.setBounds(50, 350, 100, 25);

    setUpRecordResampleUI();
    buildSampleStripControls(numStrips);
    setupPatternOverlays();

    masterGainSlider.addListener(this);



    // start timer to update play positions, slider values etc.
    startTimer(50);

    addAndMakeVisible(&vstNameLbl);
    vstNameLbl.setBounds(PAD_AMOUNT, 600, 250, 50);
    vstNameLbl.setFont(Font("ProggyCleanTT", 40.f, Font::plain));
    vstNameLbl.setColour(Label::textColourId, Colours::white);

    addChildComponent(&hintOverlay);
    const int overlayHeight = 150;
    hintOverlay.setBounds(0, GUI_HEIGHT/2 - overlayHeight/2, GUI_WIDTH, overlayHeight);

    // This tells the GUI to use a custom "theme"
    LookAndFeel::setDefaultLookAndFeel(&myLookAndFeel);
}
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: Fxrh/rekonq
MainWindow::MainWindow()
        : KXmlGuiWindow()
        , m_view(new MainView(this))
        , m_findBar(new FindBar(this))
        , m_zoomBar(new ZoomBar(this))
        , m_historyPanel(0)
        , m_bookmarksPanel(0)
        , m_webInspectorPanel(0)
        , m_analyzerPanel(0)
        , m_historyBackMenu(0)
        , m_encodingMenu(new KMenu(this))
        , m_bookmarksBar(0)
        , m_popup(new KPassivePopup(this))
        , m_hidePopup(new QTimer(this))
        , m_toolsMenu(0)
{
    // creating a centralWidget containing panel, m_view and the hidden findbar
    QWidget *centralWidget = new QWidget;
    centralWidget->setContentsMargins(0, 0, 0, 0);

    // setting layout
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(m_view);
    layout->addWidget(m_findBar);
    layout->addWidget(m_zoomBar);
    centralWidget->setLayout(layout);

    // central widget
    setCentralWidget(centralWidget);

    // setting size policies
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // then, setup our actions
    setupActions();

    // setting Panels
    setupPanels();

    // setting up rekonq tools
    setupTools();

    // setting up rekonq toolbar(s)
    setupToolbars();

    // a call to KXmlGuiWindow::setupGUI() populates the GUI
    // with actions, using KXMLGUI.
    // It also applies the saved mainwindow settings, if any, and ask the
    // mainwindow to automatically save settings if changed: window size,
    // toolbar position, icon size, etc.
    setupGUI();

    // no menu bar in rekonq: we have other plans..
    menuBar()->setVisible(false);

    // no more status bar..
    setStatusBar(0);

    // give me some time to do all the other stuffs...
    QTimer::singleShot(100, this, SLOT(postLaunch()));

    kDebug() << "MainWindow ctor...DONE";
}