Esempio n. 1
0
// Set the selection in the treeview
void MediaBrowser::setSelection(const std::string& selection)
{
	if (!_isPopulated)
	{
		populate();
	}

	// Make sure the treestore is finished loading
	_populator->waitUntilFinished();

	// If the selection string is empty, collapse the treeview and return with
	// no selection
	if (selection.empty())
	{
		_treeView->Collapse(_treeStore->GetRoot());
		return;
	}

	// Find the requested element
	wxDataViewItem item = _treeStore->FindString(selection, _columns.fullName);

	if (item.IsOk())
	{
		_treeView->Select(item);
		_treeView->EnsureVisible(item);
		handleSelectionChange();
	}
}
Esempio n. 2
0
void PrefabSelector::onTreeStorePopulationFinished(wxutil::TreeModel::PopulationFinishedEvent& ev)
{
	_treeStore = ev.GetTreeModel();

	wxDataViewItem preselectItem;

	if (!_lastPrefab.empty())
	{
		// Find and select the classname
		preselectItem = _treeStore->FindString(_lastPrefab, _columns.vfspath);
	}

	_treeView->AssociateModel(_treeStore.get());

	if (preselectItem.IsOk())
	{
		_treeView->Select(preselectItem);
		_treeView->EnsureVisible(preselectItem);

		handleSelectionChange();
	}

    _populator.reset();

    // Auto-size the first level
    _treeView->TriggerColumnSizeEvent();
}
Esempio n. 3
0
int PrefabSelector::ShowModal()
{
	if (!_populated)
	{
		// Populate the tree
		populatePrefabs();
	}
	else
	{
		// Preselect the item, tree is already loaded
		// Find and select the classname
		wxDataViewItem preselectItem = _treeStore->FindString(_lastPrefab, _columns.vfspath);

		if (preselectItem.IsOk())
		{
			_treeView->Select(preselectItem);
			_treeView->EnsureVisible(preselectItem);

			handleSelectionChange();
		}
	}

	// Enter the main loop
	int returnCode = DialogBase::ShowModal();

	_preview->setRootNode(scene::INodePtr());

	_panedPosition.saveToPath(RKEY_SPLIT_POS);

    // Remember the most recently used path
    registry::setValue<std::string>(RKEY_LAST_CUSTOM_PREFAB_PATH, _customPath->getValue());

	return returnCode;
}
toTreeWidget::toTreeWidget(QWidget *parent,
                           const char *name,
                           Qt::WFlags f)
        : QTreeWidget(parent)
{
    if (name)
        setObjectName(name);

    connect(this,
            SIGNAL(itemSelectionChanged()),
            this,
            SLOT(handleSelectionChange()));

    connect(this,
            SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
            this,
            SLOT(handleDoubleClick(QTreeWidgetItem *, int)));

    connect(this,
            SIGNAL(itemClicked(QTreeWidgetItem *, int)),
            this,
            SLOT(handleClick(QTreeWidgetItem *, int)));

    connect(this,
            SIGNAL(itemExpanded(QTreeWidgetItem *)),
            this,
            SLOT(handleExpanded(QTreeWidgetItem *)));

    connect(this,
            SIGNAL(itemCollapsed(QTreeWidgetItem *)),
            this,
            SLOT(handleCollapsed(QTreeWidgetItem *)));

    connect(this,
            SIGNAL(itemActivated(QTreeWidgetItem *, int)),
            this,
            SLOT(handleActivated(QTreeWidgetItem *, int)));

    columnResize = NoColumn;      // q3listview default
}
Esempio n. 5
0
void MediaBrowser::_onSelectionChanged(wxTreeEvent& ev)
{
	handleSelectionChange();
}
Esempio n. 6
0
ZoneViewlet::ZoneViewlet(QMainWindow *mainWindow, QObject *parent):
    QObject(parent)
{
    // Initialize zones menu and associated actions

    zonesMenu = synthclone::getChild<QMenu>(mainWindow, "zonesMenu");

    applyEffectsAction = synthclone::getChild<QAction>
        (mainWindow, "applyEffectsZonesAction");
    connect(applyEffectsAction, SIGNAL(triggered()),
            SIGNAL(applyEffectsRequest()));

    buildTargetsAction = synthclone::getChild<QAction>
        (mainWindow, "buildTargetsAction");
    connect(buildTargetsAction, SIGNAL(triggered()),
            SIGNAL(buildTargetsRequest()));

    clearEffectJobsAction = synthclone::getChild<QAction>
        (mainWindow, "clearEffectJobsAction");
    connect(clearEffectJobsAction, SIGNAL(triggered()),
            SIGNAL(clearEffectJobsRequest()));

    clearSamplerJobsAction = synthclone::getChild<QAction>
        (mainWindow, "clearSamplerJobsAction");
    connect(clearSamplerJobsAction, SIGNAL(triggered()),
            SIGNAL(clearSamplerJobsRequest()));

    clearSamplerJobsButton = synthclone::getChild<QPushButton>
        (mainWindow, "clearSamplerJobsButton");
    connect(clearSamplerJobsButton, SIGNAL(clicked()),
            SIGNAL(clearSamplerJobsRequest()));

    clearSelectionAction = synthclone::getChild<QAction>
        (mainWindow, "clearZonesSelectionAction");
    connect(clearSelectionAction, SIGNAL(triggered()),
            SIGNAL(clearSelectionRequest()));

    copyAction = synthclone::getChild<QAction>(mainWindow, "copyZonesAction");
    connect(copyAction, SIGNAL(triggered()), SIGNAL(copyRequest()));

    cutAction = synthclone::getChild<QAction>(mainWindow, "cutZonesAction");
    connect(cutAction, SIGNAL(triggered()), SIGNAL(cutRequest()));

    deleteAction = synthclone::getChild<QAction>
        (mainWindow, "deleteZonesAction");
    connect(deleteAction, SIGNAL(triggered()), SIGNAL(deleteRequest()));

    insertAction = synthclone::getChild<QAction>
        (mainWindow, "insertZoneAction");
    connect(insertAction, SIGNAL(triggered()), SIGNAL(insertRequest()));

    invertSelectionAction = synthclone::getChild<QAction>
        (mainWindow, "invertZoneSelectionAction");
    connect(invertSelectionAction, SIGNAL(triggered()),
            SIGNAL(invertSelectionRequest()));

    pasteAction = synthclone::getChild<QAction>(mainWindow, "pasteZonesAction");
    connect(pasteAction, SIGNAL(triggered()), SIGNAL(pasteRequest()));

    playDrySampleAction = synthclone::getChild<QAction>
        (mainWindow, "playDrySampleZonesAction");
    connect(playDrySampleAction, SIGNAL(triggered()),
            SIGNAL(playDrySampleRequest()));

    playWetSampleAction =
        synthclone::getChild<QAction>(mainWindow, "playWetSampleZonesAction");
    connect(playWetSampleAction, SIGNAL(triggered()),
            SIGNAL(playWetSampleRequest()));

    removeEffectJobAction =
        synthclone::getChild<QAction>(mainWindow, "removeEffectJobZonesAction");
    connect(removeEffectJobAction, SIGNAL(triggered()),
            SIGNAL(removeEffectJobRequest()));

    removeSamplerJobAction = synthclone::getChild<QAction>
        (mainWindow, "removeSamplerJobZonesAction");
    connect(removeSamplerJobAction, SIGNAL(triggered()),
            SIGNAL(removeSamplerJobRequest()));

    sampleAction = synthclone::getChild<QAction>
        (mainWindow, "getSampleZonesAction");
    connect(sampleAction, SIGNAL(triggered()), SIGNAL(sampleRequest()));

    selectAllAction = synthclone::getChild<QAction>
        (mainWindow, "selectAllZonesAction");
    connect(selectAllAction, SIGNAL(triggered()), SIGNAL(selectAllRequest()));

    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_AFTERTOUCH,
                               "aftertouchColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_CHANNEL,
                               "channelColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_CHANNEL_PRESSURE,
                               "channelPressureColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_DRY_SAMPLE,
                               "drySampleColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_NOTE,
                               "noteColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_RELEASE_TIME,
                               "releaseTimeColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_SAMPLE_TIME,
                               "sampleTimeColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_STATUS,
                               "statusColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_VELOCITY,
                               "velocityColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_WET_SAMPLE,
                               "wetSampleColumnShowAction");
    initializeControlColumnShowActions("controlColumnsMenu1", 0, 0x10);
    initializeControlColumnShowActions("controlColumnsMenu2", 0x10, 0x20);
    initializeControlColumnShowActions("controlColumnsMenu3", 0x20, 0x30);
    initializeControlColumnShowActions("controlColumnsMenu4", 0x30, 0x40);
    initializeControlColumnShowActions("controlColumnsMenu5", 0x40, 0x50);
    initializeControlColumnShowActions("controlColumnsMenu6", 0x50, 0x60);
    initializeControlColumnShowActions("controlColumnsMenu7", 0x60, 0x70);
    initializeControlColumnShowActions("controlColumnsMenu8", 0x70, 0x80);

    menuViewlet = new MenuViewlet(zonesMenu);

    // Setup zones table view

    connect(&tableDelegate,
            SIGNAL(aftertouchChangeRequest(int, synthclone::MIDIData)),
            SIGNAL(aftertouchChangeRequest(int, synthclone::MIDIData)));
    connect(&tableDelegate,
            SIGNAL(channelChangeRequest(int, synthclone::MIDIData)),
            SIGNAL(channelChangeRequest(int, synthclone::MIDIData)));
    connect(&tableDelegate,
            SIGNAL(channelPressureChangeRequest(int, synthclone::MIDIData)),
            SIGNAL(channelPressureChangeRequest(int, synthclone::MIDIData)));
    connect(&tableDelegate,
            SIGNAL(controlValueChangeRequest(int, synthclone::MIDIData,
                                             synthclone::MIDIData)),
            SIGNAL(controlValueChangeRequest(int, synthclone::MIDIData,
                                             synthclone::MIDIData)));
    connect(&tableDelegate,
            SIGNAL(noteChangeRequest(int, synthclone::MIDIData)),
            SIGNAL(noteChangeRequest(int, synthclone::MIDIData)));
    connect(&tableDelegate,
            SIGNAL(releaseTimeChangeRequest(int, synthclone::SampleTime)),
            SIGNAL(releaseTimeChangeRequest(int, synthclone::SampleTime)));
    connect(&tableDelegate,
            SIGNAL(sampleTimeChangeRequest(int, synthclone::SampleTime)),
            SIGNAL(sampleTimeChangeRequest(int, synthclone::SampleTime)));
    connect(&tableDelegate,
            SIGNAL(velocityChangeRequest(int, synthclone::MIDIData)),
            SIGNAL(velocityChangeRequest(int, synthclone::MIDIData)));

    itemPrototype = new StandardItem();
    connect(&tableModel, SIGNAL(sortRequest(int, bool)),
            SLOT(handleSortRequest(int, bool)));
    tableModel.setColumnCount(ZONETABLECOLUMN_BASE_TOTAL);
    tableModel.setRowCount(0);
    tableModel.setItemPrototype(itemPrototype);
    tableModel.setHeaderData(ZONETABLECOLUMN_AFTERTOUCH, Qt::Horizontal,
                             tr("Aftertouch"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_CHANNEL, Qt::Horizontal,
                             tr("Channel"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_CHANNEL_PRESSURE, Qt::Horizontal,
                             tr("Channel Pressure"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_DRY_SAMPLE, Qt::Horizontal,
                             tr("Dry Sample"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_NOTE, Qt::Horizontal,
                             tr("Note"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_RELEASE_TIME, Qt::Horizontal,
                             tr("Release Time"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_SAMPLE_TIME, Qt::Horizontal,
                             tr("Sample Time"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_STATUS, Qt::Horizontal,
                             tr("Status"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_VELOCITY, Qt::Horizontal,
                             tr("Velocity"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_WET_SAMPLE, Qt::Horizontal,
                             tr("Wet Sample"), Qt::DisplayRole);
    for (synthclone::MIDIData i = 0; i < 0x80; i++) {
        int column = ZONETABLECOLUMN_CONTROL_0 + i;
        tableModel.setHeaderData(column, Qt::Horizontal,
                                 synthclone::getMIDIControlString(i),
                                 Qt::DisplayRole);
    }

    tableView = synthclone::getChild<QTableView>(mainWindow, "zoneTableView");
    tableView->installEventFilter(&contextMenuEventFilter);
    tableView->setItemDelegate(&tableDelegate);
    tableView->setModel(&tableModel);
    connect(tableView->selectionModel(),
            SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
            SLOT(handleSelectionChange(QItemSelection, QItemSelection)));

    connect(&contextMenuEventFilter, SIGNAL(contextMenuRequest(int, int)),
            SLOT(handleContextMenuRequest(int, int)));

    emitZoneSelectRequest = true;
}
Esempio n. 7
0
void PrefabSelector::onSelectionChanged(wxDataViewEvent& ev)
{
	handleSelectionChange();
}