예제 #1
0
void wxGxTreeViewBase::OnObjectAdded(wxGxCatalogEvent& event)
{
    wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
	if(!pGxObject)
		return;
    wxGxObject* pParentObject = pGxObject->GetParent();
	wxTreeItemId ParentTreeItemId = m_TreeMap[pParentObject->GetId()];
	if(ParentTreeItemId.IsOk())
	{
		wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(ParentTreeItemId);
		if(pData != NULL)
		{
            wxGxObjectContainer* pGxObjectContainer = wxDynamicCast(pParentObject, wxGxObjectContainer);
            if(pGxObjectContainer->AreChildrenViewable())
            {
			    if(pData->m_bExpandedOnce)
                {
				    AddTreeItem(pGxObject, ParentTreeItemId);
                    SortChildren(ParentTreeItemId);
                }
			    else
                {
				    SetItemHasChildren(ParentTreeItemId, true);
                }
            }
		}
	}
}
예제 #2
0
void wxGxTreeView::OnObjectAdded(wxGxCatalogEvent& event)
{
    wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
	if(!pGxObject)
		return;
    wxGxObject* pParentObject = pGxObject->GetParent();
	wxTreeItemId ParentTreeItemId = m_TreeMap[pParentObject->GetId()];
	if(ParentTreeItemId.IsOk())
	{
		wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(ParentTreeItemId);
		if(pData != NULL)
		{
            wxGxAutoRenamer* pGxAutoRenamer = dynamic_cast<wxGxAutoRenamer*>(pParentObject);
			if(pData->m_bExpandedOnce)
            {
				AddTreeItem(pGxObject, ParentTreeItemId);
                SortChildren(ParentTreeItemId);
                if(pGxAutoRenamer && pGxAutoRenamer->IsBeginRename(this, pGxObject->GetPath()))
                {
                    BeginRename(pGxObject->GetId());
                }
            }
			else
            {
                if(pGxAutoRenamer && pGxAutoRenamer->IsBeginRename(this, pGxObject->GetPath()))
                {
                    Expand(ParentTreeItemId);
				    AddTreeItem(pGxObject, ParentTreeItemId);
                    SortChildren(ParentTreeItemId);
                    BeginRename(pGxObject->GetId());
                }
                else
                {
				    SetItemHasChildren(ParentTreeItemId, true);
                }
            }
		}
	}
}
예제 #3
0
void CEditorMainFrame::InitCtrls()
{
    CreateAuiToolBar();
    CreateAuiNoteBook();
    CreateTreeCtrl();
    CreateGLCanvas();
    CreateTimeBar();
    CreatePropertyGrid();
    CreatSplitter();

    AddPageToBook();
    AddTreeItem();
    m_Manager.Update();
}
예제 #4
0
void CMainDialog::OnInit()
{
	CListUI* pList = static_cast <CListUI*> (m_pm.FindControl(_T ("lstNormal")));
	ASSERT(pList);
	if (pList) {
		pList->SetTextCallback(this);
		for (int i = 0; i < 100; ++i) {
			CListTextElementUI* pItem = new CListTextElementUI;
			m_arstrListString0 [i].Format(_T ("{i list_png.png}{/i}{x 4}%d"), i);
			m_arstrListString1 [i].Format(_T ("%d - 1"), i);
			m_arstrListString2 [i].Format(_T ("%d - 2"), i);
			pList->Add(pItem);
		}
	}

	AddComboboxItem ();
	AddTreeItem ();
}
예제 #5
0
void wxGxTreeViewBase::OnItemExpanding(wxTreeEvent& event)
{
	wxTreeItemId item = event.GetItem();

	if(!item.IsOk())
		return;

	wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(item);
	if(pData != NULL)
	{
        wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(pData->m_nObjectID);
		wxGxObjectContainer* pGxObjectContainer = wxDynamicCast(pGxObject, wxGxObjectContainer);
		if(pGxObjectContainer != NULL)
		{
			wxBusyCursor wait;
			if(pGxObjectContainer->HasChildren() && pGxObjectContainer->AreChildrenViewable())
			{
				if(pData->m_bExpandedOnce == false)
				{
					const wxGxObjectList ObjectList = pGxObjectContainer->GetChildren();
                    wxGxObjectList::const_iterator iter;
                    for (iter = ObjectList.begin(); iter != ObjectList.end(); ++iter)
                    {
                        wxGxObject *current = *iter;
						AddTreeItem(current, item);//false
                        m_pCatalog->ObjectAdded(current->GetId());
                    }
					pData->m_bExpandedOnce = true;
                    SetItemHasChildren(item, GetChildrenCount(item, false) > 0);
                    SortChildren(item);
					return;                    
                }
				else
					return;
			}
			else
			{
				SetItemHasChildren(item, false);
				return;
			}
		}
	}
	SetItemHasChildren(item, false);
}
예제 #6
0
void CTemplateSelectDialog::Refresh()
{
	// Try refreshing the template files.
	bool changed = g_wwhizTemplateManager->Refresh();

	// Delete all the items in the tree.
	m_tree.DeleteAllItems();

	// Get the root tree item.
	CTreeCursor rootCursor = m_tree.GetRootItem();

	// Walk each template file.
	int count = g_wwhizTemplateManager->GetCount();
	for (int i = 0; i < count; i++)
	{
		// Add each template file to the root of the tree.
		WWhizTemplateGroup* file = g_wwhizTemplateManager->GetTemplateGroup(i);
		if (!file->IsActive())
			continue;
		CTreeCursor topCursor = rootCursor.AddTail(file->GetName());
		topCursor.SetData(NULL);

		// Add each template stored in the template file as children.
		for (int index = 0; index < file->GetCount(); index++)
		{
			WWhizTemplate* code = file->Get(index);
			if (code->GetName().GetAt(0) != '-')		// - is private.
				AddTreeItem(topCursor, (UINT)code, code->GetName());
			topCursor.SortChildren();
		}
	}

	// Sort the root.
	rootCursor.SortChildren();

	// Set the input focus to the tree.
	m_tree.SetFocus();
	m_tree.GetRootItem().Select();

	// If there wasn't a refresh, then check the tree state.
	if (!changed)
		changed |= g_wwhizTemplateManager->RestoreTreeState(m_tree);
}
예제 #7
0
CGUIFileBrowserItem* CEDFileSelector::AddItem(CGUIFileBrowserItem* fbi, const char* name, int dir)
{
	CGUIFileBrowserItem* ni;

	char *ff=NULL;
	char *shn;
	int ext;
	
	ff = newstrdup(name);

	shn = KerServices.ConvertFileNameToShort(name,ext,dir,0);

		if(dir && ext!=eEXTpackage)
		{
			if(ext==eEXTlevel)
			{
				if(fbi)
					ni = (CGUIFileBrowserItem*)fbi->AddTreeItem(0,shn,new CGUIRectHost(0,0,styleSet->Get("FBlevel")->GetTexture(0)),ff,true);
				else
					ni = (CGUIFileBrowserItem*)AddTreeItem(0,shn,new CGUIRectHost(0,0,styleSet->Get("FBlevel")->GetTexture(0)),ff,true);
			}
			else
			{
				if(fbi)
					ni = (CGUIFileBrowserItem*)fbi->AddTreeItem(0,shn,new CGUIRectHost(0,0,styleSet->Get("FBdir")->GetTexture(0)),ff,true);
				else
					ni = (CGUIFileBrowserItem*)AddTreeItem(0,shn,new CGUIRectHost(0,0,styleSet->Get("FBdir")->GetTexture(0)),ff,true);
			}
			
			if(ext!=eEXTlevel || filterExt!=eEXTlevel)
			{
				ni->state=1;
				ni->ChangeRoller();
			}
		}else{
			if(ext==filterExt)
			{
				if(ext==eEXTauto)
				{
					if(fbi)
						ni = (CGUIFileBrowserItem*)fbi->AddTreeItem(0,shn,new CGUIRectHost(0,0,styleSet->Get("STD_AUTO_TEX")->GetTexture(0)),ff,true);
					else
						ni = (CGUIFileBrowserItem*)AddTreeItem(0,shn,new CGUIRectHost(0,0,styleSet->Get("STD_AUTO_TEX")->GetTexture(0)),ff,true);
				}
				else
				{
					if(fbi)
						ni = (CGUIFileBrowserItem*)fbi->AddTreeItem(0,shn,new CGUIRectHost(0,0,styleSet->Get("FBscriptfile")->GetTexture(0)),ff,true);
					else
						ni = (CGUIFileBrowserItem*)AddTreeItem(0,shn,new CGUIRectHost(0,0,styleSet->Get("FBscriptfile")->GetTexture(0)),ff,true);
				}
			}
			else
				ni = 0;

		}

	if(ni)
	{
		ni->userTagType = eUTint;
		ni->ut.pInt = ext;

		ni->dir=dir;
		ni->name = ff;
	}else{
		SAFE_DELETE_ARRAY(ff);
	}

	return ni;
}
예제 #8
0
void CSelectPluginDlg::UpdatePluginsList(int32 forceSelect /* = 0*/)
//------------------------------------------------------------------
{
	CVstPluginManager *pManager = theApp.GetPluginManager();

	m_treePlugins.SetRedraw(FALSE);
	m_treePlugins.DeleteAllItems();

	static const struct
	{
		VSTPluginLib::PluginCategory category;
		const WCHAR *description;
	} categories[] =
	{
		{ VSTPluginLib::catEffect,			L"Audio Effects" },
		{ VSTPluginLib::catGenerator,		L"Tone Generators" },
		{ VSTPluginLib::catRestoration,		L"Audio Restauration" },
		{ VSTPluginLib::catSurroundFx,		L"Surround Effects" },
		{ VSTPluginLib::catRoomFx,			L"Room Effects" },
		{ VSTPluginLib::catSpacializer,		L"Spacializers" },
		{ VSTPluginLib::catMastering,		L"Mastering Plugins" },
		{ VSTPluginLib::catAnalysis,		L"Analysis Plugins" },
		{ VSTPluginLib::catOfflineProcess,	L"Offline Processing" },
		{ VSTPluginLib::catShell,			L"Shell Plugins" },
		{ VSTPluginLib::catUnknown,			L"Unsorted" },
		{ VSTPluginLib::catDMO,				L"DirectX Media Audio Effects" },
		{ VSTPluginLib::catSynth,			L"Instrument Plugins" },
	};

	std::bitset<VSTPluginLib::numCategories> categoryUsed;
	HTREEITEM categoryFolders[VSTPluginLib::numCategories];
	for(size_t i = CountOf(categories); i != 0; )
	{
		i--;
		categoryFolders[categories[i].category] = AddTreeItem(categories[i].description, IMAGE_FOLDER, false);
	}

	HTREEITEM noPlug = AddTreeItem(L"No plugin (empty slot)", IMAGE_NOPLUGIN, false);
	HTREEITEM currentPlug = noPlug;
	bool foundCurrentPlug = false;

	const bool nameFilterActive = !m_nameFilter.empty();
	auto currentTags = mpt::String::Split<mpt::ustring>(m_nameFilter, MPT_USTRING(" "));

	if(pManager)
	{
		bool first = true;

		for(auto p : *pManager)
		{
			ASSERT(p);
			const VSTPluginLib &plug = *p;
			if(nameFilterActive)
			{
				// Apply name filter
				bool matches = false;
				// Search in plugin names
				{
					mpt::ustring displayName = mpt::ToLowerCase(plug.libraryName.ToUnicode());
					if(displayName.find(m_nameFilter, 0) != displayName.npos)
					{
						matches = true;
					}
				}
				// Search in plugin tags
				if(!matches)
				{
					mpt::ustring tags = mpt::ToLowerCase(plug.tags);
					for(const auto &tag : currentTags)
					{
						if(!tag.empty() && tags.find(tag, 0) != tags.npos)
						{
							matches = true;
							break;
						}
					}
				}
				// Search in plugin vendors
				if(!matches)
				{
					mpt::ustring vendor = mpt::ToLowerCase(mpt::ToUnicode(plug.vendor));
					if(vendor.find(m_nameFilter, 0) != vendor.npos)
					{
						matches = true;
					}
				}
				if(!matches) continue;
			}

			std::wstring title = plug.libraryName.AsNative();
			if(!plug.IsNativeFromCache())
			{
				title += mpt::String::Print(L" (%1-Bit)", plug.GetDllBits());
			}
			HTREEITEM h = AddTreeItem(title.c_str(), plug.isInstrument ? IMAGE_PLUGININSTRUMENT : IMAGE_EFFECTPLUGIN, true, categoryFolders[plug.category], reinterpret_cast<LPARAM>(&plug));
			categoryUsed[plug.category] = true;

			if(nameFilterActive)
			{
				// If filter is active, expand nodes.
				m_treePlugins.EnsureVisible(h);
				if(first)
				{
					first = false;
					m_treePlugins.SelectItem(h);
				}
			}

			if(forceSelect != 0 && plug.pluginId2 == forceSelect)
			{
				// Forced selection (e.g. just after add plugin)
				currentPlug = h;
				foundCurrentPlug = true;
			}

			if(m_pPlugin && !foundCurrentPlug)
			{
				//Which plugin should be selected?
				if(m_pPlugin->pMixPlugin)
				{
					//Current slot's plugin
					IMixPlugin *pPlugin = m_pPlugin->pMixPlugin;
					if (&pPlugin->GetPluginFactory() == &plug)
					{
						currentPlug = h;
					}
				} else if(m_pPlugin->Info.dwPluginId1 != 0 || m_pPlugin->Info.dwPluginId2 != 0)
				{
					//Plugin with matching ID to current slot's plug
					if(plug.pluginId1 == m_pPlugin->Info.dwPluginId1
						&& plug.pluginId2 == m_pPlugin->Info.dwPluginId2)
					{
						currentPlug = h;
					}
				} else if(plug.pluginId2 == TrackerSettings::Instance().gnPlugWindowLast)
				{
					// Previously selected plugin
					currentPlug = h;
				}

				if(currentPlug == h)
				{
					foundCurrentPlug = true;
				}
			}
		}
	}

	// Remove empty categories
	for(size_t i = 0; i < CountOf(categoryFolders); i++)
	{
		if(!categoryUsed[i])
		{
			m_treePlugins.DeleteItem(categoryFolders[i]);
		}
	}

	m_treePlugins.SetRedraw(TRUE);

	if(!nameFilterActive || currentPlug != noPlug)
	{
		m_treePlugins.SelectItem(currentPlug);
	}
	m_treePlugins.SetItemState(currentPlug, TVIS_BOLD, TVIS_BOLD);
	m_treePlugins.EnsureVisible(currentPlug);
}