void CtrlrEditor::performMidiChannelChange(const int menuItemID)
{
	if (isPanelActive())
	{
		if (menuItemID >= 0x6100 && menuItemID <= 0x6111)
		{
			getActivePanel()->setProperty (Ids::panelMidiInputChannelDevice, menuItemID - 0x6100);
		}
		else if (menuItemID >= 0x6200 && menuItemID <= 0x6211)
		{
			getActivePanel()->setProperty (Ids::panelMidiOutputChannelDevice, menuItemID - 0x6200);
		}
		else if (menuItemID >= 0x6300 && menuItemID <= 0x6311)
		{
			getActivePanel()->setProperty (Ids::panelMidiControllerChannelDevice, menuItemID - 0x6300);
		}
		else if (menuItemID >= 0x6400 && menuItemID <= 0x6411)
		{
			getActivePanel()->setProperty (Ids::panelMidiInputChannelHost, menuItemID - 0x6400);
		}
		else if (menuItemID >= 0x6500 && menuItemID <= 0x6511)
		{
			getActivePanel()->setProperty (Ids::panelMidiOutputChannelHost, menuItemID - 0x6500);
		}
	}
}
void LLPanelOutfitsInventory::onClipboardAction(const LLSD& userdata)
{
    std::string command_name = userdata.asString();
    getActivePanel()->getRootFolder()->doToSelected(getActivePanel()->getModel(),command_name);
    updateListCommands();
    updateVerbs();
}
void CtrlrEditor::performMidiThruChange(const int menuItemID)
{
	const Identifier optionId = CtrlrPanel::getMidiOptionIdentifier((const CtrlrPanelMidiOption)(menuItemID - MENU_OFFSET_MIDI));

	if (isPanelActive() && optionId != Ids::null)
	{
		getActivePanel()->setProperty (optionId, !getActivePanel()->getProperty(optionId));
	}
}
Ejemplo n.º 4
0
BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata)
{
	U32 sort_order_mask = getActivePanel()->getSortOrder();
	const std::string command_name = userdata.asString();
	if (command_name == "sort_by_name")
	{
		return ~sort_order_mask & LLInventoryFilter::SO_DATE;
	}

	if (command_name == "sort_by_recent")
	{
		return sort_order_mask & LLInventoryFilter::SO_DATE;
	}

	if (command_name == "sort_folders_by_name")
	{
		return sort_order_mask & LLInventoryFilter::SO_FOLDERS_BY_NAME;
	}

	if (command_name == "sort_system_folders_to_top")
	{
		return sort_order_mask & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
	}

	return FALSE;
}
void CtrlrEditor::performMidiHostOptionChange(const int menuItemID)
{
	if (isPanelActive())
	{
		getActivePanel()->setMidiOptionBool ((const CtrlrPanelMidiOption)(menuItemID - MENU_OFFSET_MIDI), !getActivePanel()->getMidiOptionBool((const CtrlrPanelMidiOption)(menuItemID - MENU_OFFSET_MIDI)));
	}
}
void CtrlrEditor::performMidiOptionChange(const int menuItemID)
{
	if (menuItemID == optMidiSnapshotOnLoad)
	{
		if (isPanelActive())
		{
			getActivePanel()->setProperty (Ids::panelMidiSnapshotAfterLoad, !getPanelProperty(Ids::panelMidiSnapshotAfterLoad));
		}
	}
	else if (menuItemID == optMidiSnapshotOnProgramChange)
	{
		if (isPanelActive())
		{
			getActivePanel()->setProperty (Ids::panelMidiSnapshotAfterProgramChange, !getPanelProperty(Ids::panelMidiSnapshotAfterProgramChange));
		}
	}
}
void CtrlrEditor::performProgramChange(const int menuItemID)
{
	_DBG("CtrlrEditor::performProgramChange");
	if (isPanelActive())
	{
		getActivePanel()->getCtrlrMIDILibrary().setProgram (menuItemID);
	}
}
void CtrlrEditor::performMidiDeviceChange(const int menuItemID)
{
	if (isPanelActive())
	{
		if (menuItemID > MENU_OFFSET_MIDI_DEV_IN && menuItemID < MENU_OFFSET_MIDI_DEV_OUT)
		{
			getActivePanel()->setProperty(Ids::panelMidiInputDevice, owner.getCtrlrMidiDeviceManager().getDeviceName(menuItemID - MENU_OFFSET_MIDI_DEV_IN - 2, CtrlrMidiDeviceManager::inputDevice));
		}
		else if (menuItemID > MENU_OFFSET_MIDI_DEV_OUT && menuItemID < MENU_OFFSET_MIDI_DEV_CTRLR)
		{
			getActivePanel()->setProperty(Ids::panelMidiOutputDevice, owner.getCtrlrMidiDeviceManager().getDeviceName(menuItemID - MENU_OFFSET_MIDI_DEV_OUT - 2, CtrlrMidiDeviceManager::outputDevice));
		}
		else if (menuItemID > MENU_OFFSET_MIDI_DEV_CTRLR && menuItemID < MENU_OFFSET_MIDI_HOST_IN)
		{
			getActivePanel()->setProperty(Ids::panelMidiControllerDevice, owner.getCtrlrMidiDeviceManager().getDeviceName(menuItemID - MENU_OFFSET_MIDI_DEV_CTRLR - 2, CtrlrMidiDeviceManager::controllerDevice));
		}
	}
}
Ejemplo n.º 9
0
void LLPanelMainInventory::setSortBy(const LLSD& userdata)
{
	std::string sort_field = userdata.asString();
	if (sort_field == "name")
	{
		U32 order = getActivePanel()->getSortOrder();
		getActivePanel()->setSortOrder( order & ~LLInventoryFilter::SO_DATE );
			
		gSavedSettings.setBOOL("Inventory.SortByName", TRUE );
		gSavedSettings.setBOOL("Inventory.SortByDate", FALSE );
	}
	else if (sort_field == "date")
	{
		U32 order = getActivePanel()->getSortOrder();
		getActivePanel()->setSortOrder( order | LLInventoryFilter::SO_DATE );

		gSavedSettings.setBOOL("Inventory.SortByName", FALSE );
		gSavedSettings.setBOOL("Inventory.SortByDate", TRUE );
	}
	else if (sort_field == "foldersalwaysbyname")
	{
		U32 order = getActivePanel()->getSortOrder();
		if ( order & LLInventoryFilter::SO_FOLDERS_BY_NAME )
		{
			order &= ~LLInventoryFilter::SO_FOLDERS_BY_NAME;

			gSavedSettings.setBOOL("Inventory.FoldersAlwaysByName", FALSE );
		}
		else
		{
			order |= LLInventoryFilter::SO_FOLDERS_BY_NAME;

			gSavedSettings.setBOOL("Inventory.FoldersAlwaysByName", TRUE );
		}
		getActivePanel()->setSortOrder( order );
	}
	else if (sort_field == "systemfolderstotop")
	{
		U32 order = getActivePanel()->getSortOrder();
		if ( order & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP )
		{
			order &= ~LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;

			gSavedSettings.setBOOL("Inventory.SystemFoldersToTop", FALSE );
		}
		else
		{
			order |= LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;

			gSavedSettings.setBOOL("Inventory.SystemFoldersToTop", TRUE );
		}
		getActivePanel()->setSortOrder( order );
	}
}
void CtrlrEditor::sliderValueChanged (Slider* slider)
{
	if (slider->getName() == "Snapshot delay")
	{
		if (isPanelActive())
		{
			getActivePanel()->setProperty(Ids::panelMidiSnapshotDelay, slider->getValue());
		}
	}
}
void LLInventoryView::resetFilters()
{
	LLFloaterInventoryFinder *finder = getFinder();
	getActivePanel()->getFilter()->resetDefault();
	if (finder)
	{
		finder->updateElementsFromFilter();
	}

	setFilterTextFromFilter();
}
bool LLPanelOutfitsInventory::hasItemsSelected()
{
    bool has_items_selected = false;
    LLFolderView *folder = getActivePanel()->getRootFolder();
    if (folder)
    {
        std::set<LLUUID> selection_set;
        folder->getSelectionList(selection_set);
        has_items_selected = (selection_set.size() > 0);
    }
    return has_items_selected;
}
Ejemplo n.º 13
0
void CtrlrManager::restoreEditorState()
{
	Rectangle<int> r;

	if (getProperty(Ids::ctrlrEditorBounds).toString() == String::empty)
	{
		if (getInstanceMode() == InstanceSingle || getInstanceMode() == InstanceSingleRestriced)
		{
			if (getActivePanel() && getActivePanel()->getEditor())
			{
				Rectangle<int> r1 = VAR2RECT(getActivePanel()->getEditor()->getProperty (Ids::uiPanelCanvasRectangle));
				r = r1.withHeight (r1.getHeight());
			}
		}
	}
	else
	{
		r = VAR2RECT(getProperty(Ids::ctrlrEditorBounds, "0 0 720 480"));
	}

	ctrlrEditor->setSize (r.getWidth(), r.getHeight());
}
Ejemplo n.º 14
0
void LLPanelMainInventory::setSortBy(const LLSD& userdata)
{
	U32 sort_order_mask = getActivePanel()->getSortOrder();
	std::string sort_type = userdata.asString();
	if (sort_type == "name")
	{
		sort_order_mask &= ~LLInventoryFilter::SO_DATE;
	}
	else if (sort_type == "date")
	{
		sort_order_mask |= LLInventoryFilter::SO_DATE;
	}
	else if (sort_type == "foldersalwaysbyname")
	{
		if ( sort_order_mask & LLInventoryFilter::SO_FOLDERS_BY_NAME )
		{
			sort_order_mask &= ~LLInventoryFilter::SO_FOLDERS_BY_NAME;
		}
		else
		{
			sort_order_mask |= LLInventoryFilter::SO_FOLDERS_BY_NAME;
		}
	}
	else if (sort_type == "systemfolderstotop")
	{
		if ( sort_order_mask & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP )
		{
			sort_order_mask &= ~LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
		}
		else
		{
			sort_order_mask |= LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
		}
	}

	getActivePanel()->setSortOrder(sort_order_mask);
	gSavedSettings.setU32("InventorySortOrder", sort_order_mask);
}
Ejemplo n.º 15
0
bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata)
{
	LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
	if (current_item) 
	{
		LLViewerInventoryItem *inv_item = current_item->getInventoryItem();
		if(inv_item)
		{
			bool can_save = inv_item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED);
			LLInventoryType::EType curr_type = current_item->getListener()->getInventoryType();
			return can_save && (curr_type == LLInventoryType::IT_TEXTURE || curr_type == LLInventoryType::IT_SNAPSHOT);
		}
	}
	return false;
}
Ejemplo n.º 16
0
void LLPanelMainInventory::saveTexture(const LLSD& userdata)
{
	LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
	if (!current_item)
	{
		return;
	}
	
	const LLUUID& item_id = current_item->getListener()->getUUID();
	LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(item_id), TAKE_FOCUS_YES);
	if (preview_texture)
	{
		preview_texture->openToSave();
	}
}
Ejemplo n.º 17
0
void LLSidepanelInventory::clearSelections(bool clearMain, bool clearInbox)
{
	if (clearMain)
	{
		LLInventoryPanel * inv_panel = getActivePanel();
		
		if (inv_panel)
		{
			inv_panel->clearSelection();
		}
	}
	
	if (clearInbox && mInboxEnabled && (mInventoryPanelInbox != NULL))
	{
		mInventoryPanelInbox->clearSelection();
	}
	
	updateVerbs();
}
Ejemplo n.º 18
0
bool CtrlrEditor::isPanelActive(const bool checkRestrictedInstance)
{
	if (getActivePanel())
	{
		if (checkRestrictedInstance)
		{
			if (owner.getInstanceMode() == InstanceSingleRestriced)
			{
				return (false);
			}

			return (true);
		}
		else
		{
			return (true);
		}
	}

	return (false);
}
void CtrlrEditor::getCommandInfo (CommandID commandID, ApplicationCommandInfo &result)
{
	const String globalCategory ("Global");
	const String panelCategory ("Panel");

	switch (commandID)
	{
		case doSaveState:
			result.setInfo ("Save CTRLR state", "Saves the CTRLR state to disk", globalCategory, 0);
			result.addDefaultKeypress ('s', ModifierKeys::commandModifier | ModifierKeys::altModifier);
			break;

		case doOpenPanel:
			result.setInfo ("Open Panel", "Open a panel from a file", globalCategory, 0);
			result.addDefaultKeypress ('o', ModifierKeys::commandModifier);
			break;

		case doNewPanel:
			result.setInfo ("New Panel", "Create a new empty panel", globalCategory, 0);
			result.addDefaultKeypress ('n', ModifierKeys::commandModifier);
			break;

		case showGlobalSettingsDialog:
			result.setInfo ("Preferences", "Show global CTRLR preferences", globalCategory, 0);
			result.addDefaultKeypress ('p', ModifierKeys::commandModifier);
			break;

		case showMidiMonitor:
			result.setInfo ("MIDI Monitor", "A small MIDI monitor that will display received and sent data", globalCategory, 0);
			result.addDefaultKeypress ('m', ModifierKeys::commandModifier);
			break;

		case showLogViewer:
			result.setInfo ("Log viewer", "You can view diagnostic messages here, useful when debugging problems", globalCategory, 0);
			result.addDefaultKeypress ('l', ModifierKeys::commandModifier);
			break;

		case showMidiCalculator:
			result.setInfo ("MIDI Calculator", "A useful tool to translate Heximal, Binary, Decimal values", globalCategory, 0);
			result.addDefaultKeypress ('j', ModifierKeys::commandModifier);
			break;

		case showAboutDialog:
			result.setInfo ("About", "About CTRLR", globalCategory, 0);
			result.addDefaultKeypress ('a', ModifierKeys::commandModifier);
			break;

		case showKeyboardMappingDialog:
			result.setInfo ("Keyboard mapping", "Change default keyboard mappings", globalCategory, 0);
			result.addDefaultKeypress ('k', ModifierKeys::commandModifier);
			break;

		case doViewPropertyDisplayIDs:
			result.setInfo ("Property IDs/Names", "View property names or property IDs", panelCategory, 0);
			result.setTicked (isPanelActive() ? (bool)getActivePanel()->getProperty(Ids::panelPropertyDisplayIDs) : false);
			result.setActive (isPanelActive());
			break;

		case doZoomIn:
			result.setInfo ("Zoom In", "Zoom in the panel", panelCategory, 0);
			result.addDefaultKeypress ('+', ModifierKeys::commandModifier);
			result.setActive (isPanelActive());
			break;

		case doZoomOut:
			result.setInfo ("Zoom Out", "Zoom out the panel", panelCategory, 0);
			result.addDefaultKeypress ('-', ModifierKeys::commandModifier);
			result.setActive (isPanelActive());
			break;

		case doCopy:
			result.setInfo ("Copy", "Copy selected components to clipboard", panelCategory, 0);
			result.addDefaultKeypress ('c', ModifierKeys::commandModifier);
			result.setActive (isPanelActive(true));
			break;

		case doCut:
			result.setInfo ("Cut", "Cut selected components to clipboard", panelCategory, 0);
			result.addDefaultKeypress ('x', ModifierKeys::commandModifier);
			result.setActive (isPanelActive(true));
			break;

		case doPaste:
			result.setInfo ("Paste", "Paste components from clipboard", panelCategory, 0);
			result.addDefaultKeypress ('v', ModifierKeys::commandModifier);
			result.setActive (isPanelActive(true));
			break;

		case doUndo:
			result.setInfo ("Undo", "Undo last transaction", panelCategory, 0);
			result.addDefaultKeypress ('z', ModifierKeys::commandModifier);
			result.setActive (isPanelActive(true));
			break;

		case doRedo:
			result.setInfo ("Redo", "Redo last transaction", panelCategory, 0);
			result.addDefaultKeypress ('y', ModifierKeys::commandModifier);
			result.setActive (isPanelActive(true));
			break;

		case doSave:
			result.setInfo ("Save", "Save panel to a file", panelCategory, 0);
			result.addDefaultKeypress ('s', ModifierKeys::commandModifier);
			result.setActive (isPanelActive(true));
			break;

		case doClose:
			result.setInfo ("Close", "Close the current panel", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case doSaveAs:
			result.setInfo ("Save As", "Save panel as a new file", panelCategory, 0);
			result.addDefaultKeypress ('s', ModifierKeys::commandModifier | ModifierKeys::shiftModifier);
			result.setActive (isPanelActive(true));
			break;

		case doSaveVersioned:
			result.setInfo ("Save versioned", "Save panel to a new versioned file", panelCategory, 0);
			result.addDefaultKeypress ('s', ModifierKeys::altModifier | ModifierKeys::shiftModifier);
			result.setActive (isPanelActive(true));
			break;

		case doPanelMode:
			result.setInfo ("Panel mode", "Switches panel from and to EDIT mode", panelCategory, 0);
			result.addDefaultKeypress ('e', ModifierKeys::commandModifier);
			result.setActive (isPanelActive(true));
			break;

		case doPanelLock:
			result.setInfo ("Panel lock", "Locks components in edit mode", panelCategory, 0);
			result.addDefaultKeypress ('l', ModifierKeys::commandModifier);
			result.setActive (isPanelActive(true));
			if (isPanelActive(true))
			{
				result.setTicked ((bool)getActivePanelEditor()->getProperty(Ids::uiPanelLock));
			}
			break;

		case doPanelDisableCombosOnEdit:
			result.setInfo ("Disable combos on edit", "Combo boxes will not open when editing panel", panelCategory, 0);
			result.setActive (isPanelActive(true));
			if (isPanelActive(true))
			{
				result.setTicked ((bool)getActivePanelEditor()->getProperty(Ids::uiPanelDisableCombosOnEdit));
			}
			break;

		case showLuaEditor:
			result.setInfo ("LUA Editor", "Show/hide the LUA editor window", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case doRefreshDeviceList:
			result.setInfo ("Refresh devices", "Refresh the list of devices available in the OS", panelCategory, 0);
			result.setActive (true);
			break;

		case showLuaConsole:
			result.setInfo ("LUA Console", "Show/hide the LUA console", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case showComparatorTables:
			result.setInfo ("Comparator tables", "Show/hide the dump for the comparator tables", panelCategory, 0);
			result.setActive (isPanelActive());
			break;

		case showMidiLibrary:
			result.setInfo ("MIDI Library", "Show/hide the MIDI LIbrary window", panelCategory, 0);
			result.setActive (isPanelActive());
			result.addDefaultKeypress ('l', ModifierKeys::altModifier | ModifierKeys::shiftModifier);
			break;

		case showLayers:
			result.setInfo ("Layer editor", "Show/hide the layer editor", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case showModulatorList:
			result.setInfo ("Modulator list", "Show/hide the modulator list window", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case showBufferEditor:
			result.setInfo ("Buffer Editor", "Show/hide the buffer editor", panelCategory, 0);
			result.addDefaultKeypress ('b', ModifierKeys::commandModifier);
			result.setActive (isPanelActive(true));
			break;

		case doSendSnapshot:
			result.setInfo ("Send Snapshot", "Send all values from the panel as their defines MIDI messages", panelCategory, 0);
			result.setActive (isPanelActive());
			break;

		case doSnapshotStore:
			result.setInfo ("Program snapshot", "Save the current panel state as a snapshot", panelCategory, 0);
			result.setActive (isPanelActive());
			break;

		case doRefreshPropertyLists:
			result.setInfo ("Refresh property lists", "Refreshes all dynamic lists that occur in the property pane", panelCategory, 0);
			result.setActive (isPanelActive());
			break;

		case doExportFileText:
			result.setInfo ("Export XML", "Export panel to a XML file with no compression, might be very large", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case doExportFileZText:
			result.setInfo ("Export compressed XML", "Export panel to a zlib compressed XML file", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case doExportFileBin:
			result.setInfo ("Export binary", "Export panel to a binary file, unlike XML is unreadable but loads faster", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case doExportFileZBin:
			result.setInfo ("Export compressed binary", "Export panel to a zlib compressed binary file", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case doExportFileZBinRes:
			result.setInfo ("Export compressed binary + resources", "Export panel to a zlib compressed binary file with resources included", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case doExportFileInstance:
			result.setInfo ("Export instance", "Exports the panel as a standalone instance (executable/loadable file)", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case doExportFileInstanceRestricted:
			result.setInfo ("Export restricted instance", "Exports the panel as a standalone restricted instance (executable/loadable file). It won't be editable.", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case doExportGenerateUID:
			result.setInfo ("Re-generate UID ["+getPanelProperty(Ids::panelUID).toString()+"]", "Each panel has a Unique ID that can be re-generated", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case optMidiInputFromHost:
			result.setInfo ("Input from plugin host", "Accept MIDI events from host and process them", panelCategory, 0);
			result.setActive (!JUCEApplication::isStandaloneApp());
			result.setTicked (isPanelActive() ? getActivePanel()->getMidiOptionBool((const CtrlrPanelMidiOption)optMidiInputFromHost) : false);
			break;

		case doShowMidiSettingsDialog:
			result.setInfo("Settings", "Show a more user friendly MIDI settings dialog", panelCategory, 0);
			result.setActive (isPanelActive(true));
			break;

		case optMidiInputFromHostCompare:
			result.setInfo ("Input from host to comparator", "This option tells Ctrlr to route all incomming MIDI events from the MIDI host to the Comparator engine, messages that will match modulators in the panel will be treated as comming from a MIDI device", panelCategory, 0);
			result.setActive (!JUCEApplication::isStandaloneApp());
			result.setTicked (isPanelActive() ? getActivePanel()->getMidiOptionBool((const CtrlrPanelMidiOption)optMidiInputFromHostCompare) : false);
			break;

		case optMidiOutuptToHost:
			result.setInfo ("Output to plugin host", "All MIDI output goes to the MIDI host (if supported by the plugin format and the host)", panelCategory, 0);
			result.setActive (!JUCEApplication::isStandaloneApp());
			result.setTicked (isPanelActive() ? getActivePanel()->getMidiOptionBool((const CtrlrPanelMidiOption)optMidiOutuptToHost) : false);
			break;

		case optMidiSnapshotOnLoad:
			result.setInfo ("Snapshot on load", "After the panel is loaded a Snapshot will be sent", panelCategory, 0);
			result.setActive (isPanelActive());
			result.setTicked (getPanelProperty(Ids::panelMidiSnapshotAfterLoad));
			break;

		case optMidiSnapshotOnProgramChange:
			result.setInfo ("Snapshot on program change", "After each program change event on the panel a Snapshot will be sent", panelCategory, 0);
			result.setActive (isPanelActive());
			result.setTicked (getPanelProperty(Ids::panelMidiSnapshotAfterProgramChange));
			break;

		case optMidiThruD2D:
			result.setInfo ("Input device -> Output device", "Send all MIDI messages comming from the MIDI input device via the MIDI output device", panelCategory, 0);
			result.setActive (isPanelActive());
			if (isPanelActive())
				result.setTicked (getActivePanel()->getMidiOptionBool (panelMidiThruD2D));
			break;

		case optMidiThruD2H:
			result.setInfo ("Input device -> Plugin host", "Send all MIDI messages from the MIDI input device to the plugin host (if supported by the plugin format and the host)", panelCategory, 0);
			result.setActive (isPanelActive() && (JUCEApplication::isStandaloneApp() == false));
			if (isPanelActive())
				result.setTicked (getActivePanel()->getMidiOptionBool (panelMidiThruD2H));

			break;

		case optMidiThruH2D:
			result.setInfo ("Plugin host -> Output device", "Send all MIDI messages comming from the plugin host the MIDI output device", panelCategory, 0);
			result.setActive (isPanelActive() && (JUCEApplication::isStandaloneApp() == false));
			if (isPanelActive())
				result.setTicked (getActivePanel()->getMidiOptionBool (panelMidiThruH2D));
			break;

		case optMidiThruH2H:
			result.setInfo ("Plugin host -> Plugin host", "Send all MIDI messages comming from the plugin host back to it (if supported by the plugin format and the host)", panelCategory, 0);
			result.setActive (isPanelActive() && (JUCEApplication::isStandaloneApp() == false));
			if (isPanelActive())
				result.setTicked (getActivePanel()->getMidiOptionBool (panelMidiThruH2H));
			break;

		case optMidiThruD2DChannelize:
			result.setInfo ("Change channel: Input device -> Output device", "Change the channel of MIDI messages comming in on the MIDI input device to the MIDI channel set for the output device", panelCategory, 0);
			result.setActive (isPanelActive() && (JUCEApplication::isStandaloneApp() == false));
			if (isPanelActive())
				result.setTicked (getActivePanel()->getMidiOptionBool (panelMidiThruD2DChannelize));
			break;

		case optMidiThruD2HChannelize:
			result.setInfo ("Change channel: Input device -> Plugin host", "Change the channel of MIDI messages comming in on the MIDI input device to the MIDI channel set for the output to plugin host", panelCategory, 0);
			result.setActive (isPanelActive() && (JUCEApplication::isStandaloneApp() == false));
			if (isPanelActive())
				result.setTicked (getActivePanel()->getMidiOptionBool (panelMidiThruD2HChannelize));
			break;

		case optMidiThruH2DChannelize:
			result.setInfo ("Change channel: Plugin host -> Output device", "Change the channel of MIDI messages comming in from the plugin host to the MIDI channel set for the output device", panelCategory, 0);
			result.setActive (isPanelActive() && (JUCEApplication::isStandaloneApp() == false));
			if (isPanelActive())
				result.setTicked (getActivePanel()->getMidiOptionBool (panelMidiThruH2DChannelize));
			break;

		case optMidiThruH2HChannelize:
			result.setInfo ("Change channel: Plugin host -> Plugin host", "Change the channel of MIDI messages comming in from the plugin host to the MIDI channel set for the output to plugin host", panelCategory, 0);
			result.setActive (isPanelActive() && (JUCEApplication::isStandaloneApp() == false));
			if (isPanelActive())
				result.setTicked (getActivePanel()->getMidiOptionBool (panelMidiThruH2HChannelize));
			break;

		case doCrash:
			result.setInfo ("Crash Ctrlr", "Simulate Ctrlr crashing to see what happens", globalCategory, 0);
			result.setActive (true);
			break;

		case doDumpVstTables:
			result.setInfo ("Dump Memory Info", "Dump information stored in memory in some readable format", globalCategory, 0);
			result.setActive (true);
			break;

		case doRegisterExtension:
			result.setInfo ("Register file extensions", "Register Ctrlr to hanle .panel file extension", globalCategory, 0);
			result.setActive (true);
			break;

        case doKeyGenerator:
            result.setInfo ("Key Generator", "Generate a private key for signing panels", globalCategory, 0);
            result.setActive (true);
            break;

        case doProgramWizard:
            result.setInfo ("Program wizard", "Wizard to generate program requests", globalCategory, 0);
            result.setActive (true);
            break;

		case doQuit:
			result.setInfo ("Quit", "Quit Ctrlr", globalCategory, 0);
			result.setActive (JUCEApplication::isStandaloneApp());
			break;
	}
}
bool CtrlrEditor::perform (const InvocationInfo &info)
{
	// _DBG("CtrlrEditor::perform commandID="+STR(info.commandID));
	switch (info.commandID)
	{
		case showKeyboardMappingDialog:
			performShowKeyboardMappingDialog(info.commandID);
			break;

		case showMidiMonitor:
			owner.getWindowManager().toggle(CtrlrManagerWindowManager::MidiMonWindow, true);
			break;

		case showLogViewer:
			owner.getWindowManager().toggle(CtrlrManagerWindowManager::LogViewer, true);
			break;

		case showMidiCalculator:
			owner.getWindowManager().toggle(CtrlrManagerWindowManager::MIDICalculator, true);
			break;

		case doSaveState:
			owner.saveStateToDisk();
			break;

		case doOpenPanel:
			owner.openPanelFromFile(nullptr);
			break;

		case doNewPanel:
			owner.addPanel(ValueTree());
			break;

		case doRefreshPropertyLists:
			if (isPanelActive())
			{
				if (getActivePanel()->getEditor(false))
				{
					CtrlrPanelProperties *props = getActivePanel()->getEditor(false)->getPropertiesPanel();
					if (props)
					{
						props->refreshAll();
					}
				}
			}
			break;

		case showGlobalSettingsDialog:
			owner.getWindowManager().showModalDialog ("Ctrlr/Settings", ScopedPointer <CtrlrSettings> (new CtrlrSettings(owner)), true, this);
			break;

		case showAboutDialog:
			owner.getWindowManager().showModalDialog ("Ctrlr/About", ScopedPointer <CtrlrAbout> (new CtrlrAbout(owner)), false, this);
			break;

		case doZoomIn:
			if (getActivePanelEditor())
			{
				getActivePanelEditor()->setProperty(Ids::uiPanelZoom, (double)getActivePanelEditor()->getProperty(Ids::uiPanelZoom) + 0.1);
			}
			break;

		case doZoomOut:
			if (getActivePanelEditor())
			{
				getActivePanelEditor()->setProperty(Ids::uiPanelZoom, (double)getActivePanelEditor()->getProperty(Ids::uiPanelZoom) - 0.1);
			}
			break;

		case doCopy:
			getActivePanel()->getCanvas()->copy();
			break;

		case doCut:
			getActivePanel()->getCanvas()->cut();
			break;

		case doPaste:
			getActivePanel()->getCanvas()->paste();
			break;

		case doUndo:
			getActivePanel()->undo();
			break;

		case doRedo:
			getActivePanel()->redo();
			break;

		case doSave:
			getActivePanel()->savePanel();
			break;

		case doClose:
			if (AlertWindow::showYesNoCancelBox (AlertWindow::QuestionIcon, "Close panel", "Are you sure you want to close this panel", "Yes", "No", "Cancel", this) == 1)
			{
				owner.removePanel (getActivePanelEditor());
			}
			break;

		case doSaveAs:
			getActivePanel()->savePanelAs(doExportFileText);
			break;

		case doSaveVersioned:
			getActivePanel()->savePanelVersioned();
			break;

		case doExportFileText:
		case doExportFileZText:
		case doExportFileBin:
		case doExportFileZBin:
		case doExportFileZBinRes:
		case doExportFileInstance:
		case doExportFileInstanceRestricted:
		case doExportGenerateUID:
			getActivePanel()->savePanelAs (info.commandID);
			break;

		case doViewPropertyDisplayIDs:
			if (getActivePanel()) getActivePanel()->setProperty (Ids::panelPropertyDisplayIDs, !getActivePanel()->getProperty(Ids::panelPropertyDisplayIDs));
			break;

		case doPanelMode:
			if (getActivePanelEditor()) getActivePanelEditor()->setProperty (Ids::uiPanelEditMode, !getActivePanelEditor()->getProperty(Ids::uiPanelEditMode));
			break;

		case doPanelLock:
			if (getActivePanelEditor()) getActivePanelEditor()->setProperty (Ids::uiPanelLock, !(bool)getActivePanelEditor()->getProperty(Ids::uiPanelLock));
			break;

		case doPanelDisableCombosOnEdit:
			if (getActivePanelEditor()) getActivePanelEditor()->setProperty (Ids::uiPanelDisableCombosOnEdit, !(bool)getActivePanelEditor()->getProperty(Ids::uiPanelDisableCombosOnEdit));
			break;

		case showLuaEditor:
			if (getActivePanel()) getActivePanel()->getPanelWindowManager().toggle (CtrlrPanelWindowManager::LuaMethodEditor, true);
			break;

		case showLuaConsole:
			if (getActivePanel()) getActivePanel()->getPanelWindowManager().toggle (CtrlrPanelWindowManager::LuaConsole, true);
			break;

		case showComparatorTables:
			if (getActivePanel()) getActivePanel()->dumpComparatorTables();
			break;

		case showMidiLibrary:
			if (getActivePanel()) getActivePanel()->getPanelWindowManager().toggle (CtrlrPanelWindowManager::MIDILibrary, true);
			break;

		case showModulatorList:
			if (getActivePanel()) getActivePanel()->getPanelWindowManager().toggle (CtrlrPanelWindowManager::ModulatorList, true);
			break;

		case showLayers:
			if (getActivePanel()) getActivePanel()->getPanelWindowManager().toggle (CtrlrPanelWindowManager::LayerEditor, true);
			break;

		case doSendSnapshot:
			if (getActivePanel()) getActivePanel()->sendSnapshot();
			break;

		case doSnapshotStore:
			if (getActivePanel()) getActivePanel()->getCtrlrMIDILibrary().snapshot();
			break;

		case showBufferEditor:
			if (getActivePanel()) getActivePanel()->getPanelWindowManager().toggle (CtrlrPanelWindowManager::BufferEditor, true);
			break;

		case showMidiToolbar:
			if (getActivePanel())
				if (getActivePanel()->getEditor())
				{
					getActivePanel()->getEditor()->toggleMIDIToolbar ();
					resized();
				}
			break;

		case doSaveSaveToCurrentProgram:
		case doSaveSaveToNewProgram:
		case doNewBank:
			break;

		case doIdentityRequest:
			if (isPanelActive())
			{
			}
			break;

		case doEditBufferRequest:
			if (isPanelActive())
			{
			}
			break;

		case doCurrentBankRequest:
			if (isPanelActive())
			{
			}
			break;

		case doCurrentProgramRequest:
			if (isPanelActive())
			{
			}
			break;

		case doAllProgramsRequest:
			if (isPanelActive())
			{
			}
			break;

		case optMidiInputFromHost:
		case optMidiInputFromHostCompare:
		case optMidiOutuptToHost:
			if (info.invocationMethod == ApplicationCommandTarget::InvocationInfo::direct)
				performMidiHostOptionChange(info.commandID);
			break;

		case optMidiSnapshotOnLoad:
		case optMidiSnapshotOnProgramChange:
			if (info.invocationMethod == ApplicationCommandTarget::InvocationInfo::direct)
				performMidiOptionChange(info.commandID);
			break;

		case optMidiThruD2D:
		case optMidiThruD2H:
		case optMidiThruH2D:
		case optMidiThruH2H:
		case optMidiThruD2DChannelize:
		case optMidiThruD2HChannelize:
		case optMidiThruH2DChannelize:
		case optMidiThruH2HChannelize:
			if (info.invocationMethod == ApplicationCommandTarget::InvocationInfo::direct)
				performMidiThruChange(info.commandID);
			break;

		case doCrash:
			invalidCtrlrPtr->cancelPendingUpdate();
			break;

		case doDumpVstTables:
			owner.getVstManager().dump();
			if (isPanelActive())
			{
				getActivePanel()->dump();
			}
			break;

		case doQuit:
			JUCEApplication::quit();

		case doRegisterExtension:
			tempResult = owner.getNativeObject().registerFileHandler();
			if (tempResult.wasOk())
			{
				INFO("Register file handler", "Registration successful");
			}
			else
			{
				WARN("Registration failed");
			}
			break;

        case doKeyGenerator:
            performKeyGenerator();
            break;

		default:
			break;
	}

	return (true);
}
BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
{
    const std::string command_name = userdata.asString();
    if (command_name == "delete" || command_name == "remove")
    {
        BOOL can_delete = FALSE;
        LLFolderView *folder = getActivePanel()->getRootFolder();
        if (folder)
        {
            std::set<LLUUID> selection_set;
            folder->getSelectionList(selection_set);
            can_delete = (selection_set.size() > 0);
            for (std::set<LLUUID>::iterator iter = selection_set.begin();
                    iter != selection_set.end();
                    ++iter)
            {
                const LLUUID &item_id = (*iter);
                LLFolderViewItem *item = folder->getItemByID(item_id);
                can_delete &= item->getListener()->isItemRemovable();
            }
            return can_delete;
        }
        return FALSE;
    }
    if (command_name == "remove_link")
    {
        BOOL can_delete = FALSE;
        LLFolderView *folder = getActivePanel()->getRootFolder();
        if (folder)
        {
            std::set<LLUUID> selection_set;
            folder->getSelectionList(selection_set);
            can_delete = (selection_set.size() > 0);
            for (std::set<LLUUID>::iterator iter = selection_set.begin();
                    iter != selection_set.end();
                    ++iter)
            {
                const LLUUID &item_id = (*iter);
                LLViewerInventoryItem *item = gInventory.getItem(item_id);
                if (!item || !item->getIsLinkType())
                    return FALSE;
            }
            return can_delete;
        }
        return FALSE;
    }
    if (command_name == "rename" ||
            command_name == "delete_outfit")
    {
        return (getCorrectListenerForAction() != NULL) && hasItemsSelected();
    }

    if (command_name == "wear")
    {
        if (isCOFPanelActive())
        {
            return FALSE;
        }
    }
    if (command_name == "make_outfit")
    {
        return TRUE;
    }

    if (command_name == "edit" ||
            command_name == "add"
       )
    {
        return (getCorrectListenerForAction() != NULL);
    }
    return TRUE;
}
BOOL LLPanelOutfitsInventory::isCOFPanelActive() const
{
    return (getActivePanel()->getName() == COF_TAB_NAME);
}
Ejemplo n.º 23
0
BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
{
	const std::string command_name = userdata.asString();
	if (command_name == "delete")
	{
		BOOL can_delete = FALSE;
		LLFolderView* root = getActivePanel()->getRootFolder();
		if (root)
		{
			can_delete = TRUE;
			std::set<LLUUID> selection_set = root->getSelectionList();
			if (selection_set.empty()) return FALSE;
			for (std::set<LLUUID>::iterator iter = selection_set.begin();
				 iter != selection_set.end();
				 ++iter)
			{
				const LLUUID &item_id = (*iter);
				LLFolderViewItem *item = root->getItemByID(item_id);
				const LLFolderViewEventListener *listener = item->getListener();
				llassert(listener);
				if (!listener) return FALSE;
				can_delete &= listener->isItemRemovable();
				can_delete &= !listener->isItemInTrash();
			}
			return can_delete;
		}
		return FALSE;
	}
	if (command_name == "save_texture")
	{
		return isSaveTextureEnabled(userdata);
	}
	if (command_name == "find_original")
	{
		LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
		if (!current_item) return FALSE;
		const LLUUID& item_id = current_item->getListener()->getUUID();
		const LLViewerInventoryItem *item = gInventory.getItem(item_id);
		if (item && item->getIsLinkType() && !item->getIsBrokenLink())
		{
			return TRUE;
		}
		return FALSE;
	}

	if (command_name == "find_links")
	{
		LLFolderView* root = getActivePanel()->getRootFolder();
		std::set<LLUUID> selection_set = root->getSelectionList();
		if (selection_set.size() != 1) return FALSE;
		LLFolderViewItem* current_item = root->getCurSelectedItem();
		if (!current_item) return FALSE;
		const LLUUID& item_id = current_item->getListener()->getUUID();
		const LLInventoryObject *obj = gInventory.getObject(item_id);
		if (obj && !obj->getIsLinkType() && LLAssetType::lookupCanLink(obj->getType()))
		{
			return TRUE;
		}
		return FALSE;
	}
	// This doesn't currently work, since the viewer can't change an assetID an item.
	if (command_name == "regenerate_link")
	{
		LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
		if (!current_item) return FALSE;
		const LLUUID& item_id = current_item->getListener()->getUUID();
		const LLViewerInventoryItem *item = gInventory.getItem(item_id);
		if (item && item->getIsBrokenLink())
		{
			return TRUE;
		}
		return FALSE;
	}

	if (command_name == "share")
	{
		LLSidepanelInventory* parent = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
		return parent ? parent->canShare() : FALSE;
	}

	return TRUE;
}
Ejemplo n.º 24
0
void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
{
	if (!isActionEnabled(userdata))
		return;

	const std::string command_name = userdata.asString();
	if (command_name == "new_window")
	{
		newWindow();
	}
	if (command_name == "sort_by_name")
	{
		const LLSD arg = "name";
		setSortBy(arg);
	}
	if (command_name == "sort_by_recent")
	{
		const LLSD arg = "date";
		setSortBy(arg);
	}
	if (command_name == "show_filters")
	{
		toggleFindOptions();
	}
	if (command_name == "reset_filters")
	{
		resetFilters();
	}
	if (command_name == "close_folders")
	{
		closeAllFolders();
	}
	if (command_name == "empty_trash")
	{
		const std::string notification = "ConfirmEmptyTrash";
		gInventory.emptyFolderType(notification, LLFolderType::FT_TRASH);
	}
	if (command_name == "empty_lostnfound")
	{
		const std::string notification = "ConfirmEmptyLostAndFound";
		gInventory.emptyFolderType(notification, LLFolderType::FT_LOST_AND_FOUND);
	}
	if (command_name == "save_texture")
	{
		saveTexture(userdata);
	}
	// This doesn't currently work, since the viewer can't change an assetID an item.
	if (command_name == "regenerate_link")
	{
		LLInventoryPanel *active_panel = getActivePanel();
		LLFolderViewItem* current_item = active_panel->getRootFolder()->getCurSelectedItem();
		if (!current_item)
		{
			return;
		}
		const LLUUID item_id = current_item->getListener()->getUUID();
		LLViewerInventoryItem *item = gInventory.getItem(item_id);
		if (item)
		{
			item->regenerateLink();
		}
		active_panel->setSelection(item_id, TAKE_FOCUS_NO);
	}
	if (command_name == "find_original")
	{
		LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
		if (!current_item)
		{
			return;
		}
		current_item->getListener()->performAction(getActivePanel()->getModel(), "goto");
	}

	if (command_name == "find_links")
	{
		LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
		if (!current_item)
		{
			return;
		}
		const LLUUID& item_id = current_item->getListener()->getUUID();
		const std::string &item_name = current_item->getListener()->getName();
		mFilterSubString = item_name;
		LLInventoryFilter *filter = mActivePanel->getFilter();
		filter->setFilterSubString(item_name);
		mFilterEditor->setText(item_name);

		mFilterEditor->setFocus(TRUE);
		filter->setFilterUUID(item_id);
		filter->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
		filter->setFilterLinks(LLInventoryFilter::FILTERLINK_ONLY_LINKS);
	}
}