コード例 #1
0
ファイル: BundlePane.cpp プロジェクト: khmerlovers/e
void BundlePane::OnMenuExport(wxCommandEvent& WXUNUSED(event)) {
	const wxTreeItemId selItem = m_bundleTree->GetSelection();
	if (!selItem.IsOk()) return;
	
	// Get the item name
	const BundleItemData* data = (BundleItemData*)m_bundleTree->GetItemData(selItem);
	wxString name;
	if (data->IsBundle()) {
		const wxFileName bundlePath = m_plistHandler.GetBundlePath(data->m_bundleId);
		name = bundlePath.GetDirs().Last();
	}
	else {
		const wxFileName bundlePath = m_plistHandler.GetBundleItemPath(data->m_type, data->m_bundleId, data->m_itemId);
		name = bundlePath.GetFullName();
	}

	// Get destination path from user
	const wxString msg = data->IsBundle() ? _("Export Bundle as..") : _("Export Bundle Item as");
	wxFileDialog dlg(this, msg, wxEmptyString, name, wxFileSelectorDefaultWildcardStr, wxFD_SAVE);
	if (dlg.ShowModal() != wxID_OK) return;
	const wxString path = dlg.GetPath();
	if (path.empty()) return;

	// Export the item
	if (data->IsBundle()) {
		wxFileName dstPath;
		dstPath.AssignDir(path);
		m_plistHandler.ExportBundle(dstPath, data->m_bundleId);
	}
	else m_plistHandler.ExportBundleItem(path, data->m_type, data->m_bundleId, data->m_itemId);
}
コード例 #2
0
wxTreeItemId PHPFileLayoutTree::TryGetPrevItem(wxTreeItemId item)
{
    wxCHECK_MSG(item.IsOk(), wxTreeItemId(), wxT("invalid tree item"));

    // find out the starting point
    wxTreeItemId prevItem = GetPrevSibling(item);
    if(!prevItem.IsOk()) {
        prevItem = GetItemParent(item);
        if(prevItem == GetRootItem()) {
            return wxTreeItemId();
        }
    }

    // from there we must be able to navigate until this item
    while(prevItem.IsOk()) {

        ScrollTo(prevItem);

        if(!IsVisible(prevItem)) {
            return wxTreeItemId();
        }

        const wxTreeItemId nextItem = GetNextVisible(prevItem);
        if(!nextItem.IsOk() || nextItem == item) return prevItem;

        prevItem = nextItem;
    }

    return wxTreeItemId();
}
コード例 #3
0
ファイル: treebkg.cpp プロジェクト: czxxjtu/wxPython-1
int wxTreebook::GetPageParent(size_t pagePos) const
{
    wxTreeItemId nodeId = DoInternalGetPage( pagePos );
    wxCHECK_MSG( nodeId.IsOk(), wxNOT_FOUND, wxT("Invalid page index spacified!") );

    const wxTreeItemId parent = GetTreeCtrl()->GetItemParent( nodeId );

    return parent.IsOk() ? DoInternalFindPageById(parent) : wxNOT_FOUND;
}
コード例 #4
0
ファイル: BundlePane.cpp プロジェクト: khmerlovers/e
bool BundlePane::IsTreeItemParentOf(const wxTreeItemId parent, const wxTreeItemId child) const {
	wxASSERT(parent.IsOk() && child.IsOk());

	wxTreeItemId item = m_bundleTree->GetItemParent(child);

	while (item.IsOk()) {
		if (item == parent) return true;
		item = m_bundleTree->GetItemParent(item);
	}

	return false;
}
コード例 #5
0
ファイル: BundlePane.cpp プロジェクト: khmerlovers/e
void BundlePane::OnMenuOpenItem(wxCommandEvent& WXUNUSED(event)) {
	const wxTreeItemId selItem = m_bundleTree->GetSelection();
	if (!selItem.IsOk()) return;

	const BundleItemData* data = (BundleItemData*)m_bundleTree->GetItemData(selItem);
	if (!data || !bundlepane_can_open_item(data->m_type)) return;

	const wxString bundlePath = m_plistHandler.GetBundleItemUri(data->m_type, data->m_bundleId, data->m_itemId);
	if (bundlePath.empty()) return;

	m_parentFrame.Open(bundlePath);
}
コード例 #6
0
ファイル: admindlg.cpp プロジェクト: Undrizzle/yolanda
void ecAdminDialog::OnRemove(wxCommandEvent& event)
{
    wxTreeCtrl* treeCtrl = (wxTreeCtrl*) FindWindow( ecID_ADMIN_DIALOG_TREE) ;

    const wxTreeItemId hTreeItem = treeCtrl->GetSelection ();
    if (! hTreeItem || !hTreeItem.IsOk())
        return;
    
    if (wxYES != wxMessageBox (_("The selected package will be deleted from the repository. Core eCos packages may be restored only by reinstalling eCos.\n\nDo you wish to continue?"),
        _("Remove Package"), wxYES_NO | wxICON_EXCLAMATION))
        return;

    ecAdminItemData* data = (ecAdminItemData*) treeCtrl->GetItemData (hTreeItem);

    if (data) // if a package node is selected
    {
        // remove all package version nodes

        wxString pstrPackage(data->m_string);
        
        bool bStatus = TRUE;
        long cookie;
        wxTreeItemId hChildItem = treeCtrl->GetFirstChild (hTreeItem, cookie);
        while (hChildItem && bStatus)
        {
            const wxTreeItemId hNextChildItem = treeCtrl->GetNextSibling (hChildItem);			
            bStatus = RemovePackageVersion (hChildItem);
            hChildItem = hNextChildItem;
        }
        
        // remove the package node
        
        if (bStatus)
        {
            treeCtrl->Delete (hTreeItem);
        }
    }
    else // a version node is selected
    {
        // remove the version node
        
        const wxTreeItemId hParentItem = treeCtrl->GetParent (hTreeItem);
        wxASSERT (hParentItem && hParentItem.IsOk() );
        if (RemovePackageVersion (hTreeItem) && ! treeCtrl->ItemHasChildren (hParentItem)) // if the only version was deleted
        {
            // remove the package node
            
            treeCtrl->Delete (hParentItem); 
        }
    }
}
コード例 #7
0
ファイル: decklibrarytab.cpp プロジェクト: ErikGartner/ardb
void
DeckLibraryTab::MoreOfAnItem (wxTreeItemId oItemId, long lCount)
{
    wxTreeItemId oChild;
    wxTreeItemIdValue cookie;
    long lCardRef;

    if (!oItemId.IsOk ()) return;

    MyTreeItemData * pData = (MyTreeItemData *) m_pTree->GetItemData (oItemId);
    if (pData != NULL) {
        // we know what to modify
        lCardRef = pData->GetValue ();
        if (lCardRef >= 0) {
            if (lCount > 0) {
                m_pModel->AddToLibrary (lCardRef, lCount, TRUE);
            } else {
                m_pModel->DelFromLibrary (lCardRef, -lCount, TRUE);
            }
        }
    } else {
        // We don't know what to modify, so we'll try with a child
        oChild = m_pTree->GetFirstChild (oItemId, cookie);
        if (oChild.IsOk ()) {
            MoreOfAnItem (oChild, lCount);
        }
    }
}
コード例 #8
0
//---------------------------------------------------------
bool CData_Source_PgSQL::Source_Drop(const wxTreeItemId &Item)
{
	static	wxString	Username = "******", Password = "******";

	CData_Source_PgSQL_Data	*pData	= Item.IsOk() ? (CData_Source_PgSQL_Data *)GetItemData(Item) : NULL; if( pData == NULL )	return( false );

	if( !DLG_Login(Username, Password, _TL("Drop Database")) )
	{
		return( false );
	}

	pData->Set_Username(Username);
	pData->Set_Password(Password);

	if( pData->Get_Type() == TYPE_SOURCE && pData->is_Connected() )
	{
		RUN_MODULE(DB_PGSQL_DB_Drop, true,	// CDatabase_Drop
				SET_PARAMETER("PG_HOST", pData->Get_Host    ())
			&&	SET_PARAMETER("PG_PORT", pData->Get_Port    ())
			&&	SET_PARAMETER("PG_NAME", pData->Get_DBName  ())
			&&	SET_PARAMETER("PG_USER", pData->Get_Username())
			&&	SET_PARAMETER("PG_PWD" , pData->Get_Password())
		);

		return( bResult );
	}

	return( false );
}
コード例 #9
0
//---------------------------------------------------------
bool CData_Source_PgSQL::Source_Create(const wxTreeItemId &Item)
{
	CData_Source_PgSQL_Data	*pData	= Item.IsOk() ? (CData_Source_PgSQL_Data *)GetItemData(Item) : NULL; if( pData == NULL )	return( false );

	if( pData->Get_Type() == TYPE_ROOT
	||  pData->Get_Type() == TYPE_SERVER )
	{
		CSG_Module	*pModule	= SG_Get_Module_Library_Manager().Get_Module("db_pgsql", DB_PGSQL_DB_Create);

		if(	pModule && pModule->On_Before_Execution() )
		{
			if( pData->Get_Type() == TYPE_SERVER )
			{
				pModule->Set_Parameter("PG_HOST", pData->Get_Host());
				pModule->Set_Parameter("PG_PORT", pData->Get_Port());
			}

			if( DLG_Parameters(pModule->Get_Parameters()) )
			{
				pModule->Execute();
			}
		}
	}

	return( true );
}
コード例 #10
0
//---------------------------------------------------------
void CData_Source_PgSQL::Append_Table(const wxTreeItemId &Parent, const SG_Char *Name, int Type, int Image)
{
	CData_Source_PgSQL_Data	*pData	= Parent.IsOk() ? (CData_Source_PgSQL_Data *)GetItemData(Parent) : NULL; if( pData == NULL )	return;

	wxTreeItemId	Item	= AppendItem(Parent, Name, Image, Image, new CData_Source_PgSQL_Data(Type, Name, pData->Get_Server()));

	if( Type == TYPE_GRIDS )
	{
		CSG_Table	Grids;

		RUN_MODULE(DB_PGSQL_Table_Query, false,	// CTable_Query
				SET_PARAMETER("CONNECTION", pData->Get_Server())
			&&	SET_PARAMETER("TABLES"    , Name)
			&&	SET_PARAMETER("TABLE"     , &Grids)
			&&  SET_PARAMETER("FIELDS"    , SG_T("rid, name"))
		);

		if( bResult )
		{
			for(int i=0; i<Grids.Get_Count(); i++)
			{
				AppendItem(Item, Grids[i].asString(1), IMG_GRID, IMG_GRID,
					new CData_Source_PgSQL_Data(TYPE_GRID, CSG_String::Format("%s:rid=%d", Name, Grids[i].asInt(0)), pData->Get_Server())
				);
			}
		}
	}
}
コード例 #11
0
//---------------------------------------------------------
void CData_Source_PgSQL::Source_Open(const wxTreeItemId &Item)
{
	CData_Source_PgSQL_Data	*pData	= Item.IsOk() ? (CData_Source_PgSQL_Data *)GetItemData(Item) : NULL; if( pData == NULL )	return;

	if( pData->Get_Type() == TYPE_ROOT
	||  pData->Get_Type() == TYPE_SERVER )
	{
		CSG_Module	*pModule	= SG_Get_Module_Library_Manager().Get_Module("db_pgsql", DB_PGSQL_Get_Connection);	// CGet_Connection

		if(	pModule && pModule->On_Before_Execution() )
		{
			if( pData->Get_Type() == TYPE_SERVER )
			{
				pModule->Set_Parameter("PG_HOST", pData->Get_Host());
				pModule->Set_Parameter("PG_PORT", pData->Get_Port());
			}

			if( DLG_Parameters(pModule->Get_Parameters()) )
			{
				pModule->Execute();
			}
		}
	}
	else if( pData->is_Connected() )
	{
		Update_Source(Item);
	}
	else if( !Source_Open(pData, true) )
	{
		DLG_Message_Show_Error(_TL("Could not connect to data source."), _TL("Connect to PostgreSQL"));
	}
}
コード例 #12
0
wxTreeItemId CocaSystemTree::findId( const void* nodePointer, wxTreeItemId id ) const
{
    if ( !id.IsOk() ) { return id; }

    if ( nodePointer == getNode( id ) ) { return id; }

    wxTreeItemIdValue cookie = 0;
    id = GetFirstChild( id, cookie );
    for ( ; id.IsOk(); id = GetNextSibling( id ) )
    {
        wxTreeItemId foundId = findId( nodePointer, id );
        if ( foundId.IsOk() ) { return foundId; }
    }

    return id; // is invalid
}
コード例 #13
0
ファイル: mainWindow.cpp プロジェクト: CristinaGajate/Apolo
void  MainWindow::Search(wxTreeItemId search,bool toogle)
{
	wxTreeItemIdValue cookie;
	NodeTree *itemData = search.IsOk() ? (NodeTree *) tree->GetItemData(search)
		:NULL;

	if(itemData->getTipo()==N_World )
		if(itemData->pointer.world->getNumObjects()!=0)
			Search(tree->GetFirstChild(search,cookie),toogle);
	
	if(itemData->menus.menu_positionable)
	{
		if(itemData->menus.menu_composed || itemData->pointer.positionableentity->getOwner()->getClassName()=="World")
		{
			if(toogle)
				itemData->pointer.positionableentity->setDrawReferenceSystem();
			else
				itemData->pointer.positionableentity->setDrawReferenceSystem(false);
		
			if(itemData->menus.menu_composed)
				if(itemData->pointer.composedentity->getNumObjects()>0)
					Search(tree->GetFirstChild(search,cookie),toogle);
		}
	}
	if(tree->GetLastChild(tree->GetItemParent(search))==search)
		return;
	
	Search(tree->GetNextSibling(search),toogle);

}
コード例 #14
0
wxTreeItemId wxSpinTreeCtrl::GetTreeItem(const char *nodeId, wxTreeItemId idParent, wxTreeItemIdValue cookie)
{
    if (! idParent.IsOk())
        return NULL;

    wxSpinTreeItemData *treeData = (wxSpinTreeItemData*)GetItemData(idParent);
    if (treeData && treeData->m_pNode.valid())
    {
        if (strcmp(treeData->m_pNode->id->s_name, nodeId) == 0)
        {
            return idParent;
        }
    }

    if (ItemHasChildren(idParent))
    {
        wxTreeItemId child;
        for (child = GetFirstChild(idParent, cookie); child.IsOk(); child = GetNextChild(idParent, cookie))
        {
            wxTreeItemId targetItem = GetTreeItem(nodeId, child, cookie);
            if (targetItem.IsOk())
                return targetItem;
        }
    }
    return GetTreeItem(nodeId, GetNextSibling(idParent), cookie);
}
コード例 #15
0
bool ClassBrowser::RecursiveSearch(const wxString& search, wxTreeCtrl* tree, const wxTreeItemId& parent, wxTreeItemId& result)
{
    if (!parent.IsOk() || !tree)
        return false;

    // first check the parent item
    if (FoundMatch(search, tree, parent))
    {
        result = parent;
        return true;
    }

    wxTreeItemIdValue cookie;
    wxTreeItemId child = tree->GetFirstChild(parent, cookie);

    if (!child.IsOk())
        return RecursiveSearch(search, tree, FindNext(search, tree, parent), result);

    while (child.IsOk())
    {
        if (FoundMatch(search, tree, child))
        {
            result = child;
            return true;
        }
        if (tree->ItemHasChildren(child))
        {
            if (RecursiveSearch(search, tree, child, result))
                return true;
        }
        child = tree->GetNextChild(parent, cookie);
    }

    return RecursiveSearch(search, tree, FindNext(search, tree, parent), result);
}
コード例 #16
0
wxString DebuggerTreeListCtrlBase::GetItemPath(const wxTreeItemId &item)
{
    wxArrayString pathArr;
    if(item.IsOk() == false)
        return wxT("");

    DbgTreeItemData* data = (DbgTreeItemData*) m_listTable->GetItemData(item);
    if(data && data->_gdbId.IsEmpty()) {
        // not a variable object item
        return m_listTable->GetItemText(item);
    }

    wxTreeItemId parent = item;
    while(parent.IsOk() && m_listTable->GetRootItem() != parent) {
        DbgTreeItemData* itemData = (DbgTreeItemData*) m_listTable->GetItemData(parent);
        if(itemData && !itemData->_isFake) {
            pathArr.Add(m_listTable->GetItemText(parent));
        }
        parent = m_listTable->GetItemParent(parent);
    }

    if(pathArr.IsEmpty())
        return wxT("");

    wxString itemPath;
    for(int i=(int)pathArr.GetCount()-1; i>=0; i--) {
        itemPath << pathArr.Item(i) << wxT(".");
    }
    itemPath.RemoveLast();
    return itemPath;
}
コード例 #17
0
void PanelObjectList::RenameObject(wxTreeItemId id, const char* desc)
{
    if( id.IsOk() )
    {
        m_pTree_Objects->SetItemText( id, desc );
    }
}
コード例 #18
0
wxTreeItemId PHPFileLayoutTree::RecurseSearch(const wxTreeItemId& item, const wxString& word)
{
    if(!item.IsOk()) return wxTreeItemId();

    if(item != GetRootItem()) {
        wxString curtext = GetItemText(item);
        curtext.MakeLower();

        if(curtext.StartsWith(word)) {
            return item;
        }
    }

    if(ItemHasChildren(item)) {
        wxTreeItemIdValue cookie;
        wxTreeItemId child = GetFirstChild(item, cookie);
        while(child.IsOk()) {
            wxTreeItemId selection = RecurseSearch(child, word);
            if(selection.IsOk()) {
                return selection;
            }
            child = GetNextChild(item, cookie);
        }
    }
    return wxTreeItemId();
}
コード例 #19
0
wxTreeItemId luProjTree::findItemByData(const wxTreeItemId& parent, const wxString& data)
{
	if (!parent.IsOk()) return parent;

	ItemData* item = dynamic_cast<ItemData*>(GetItemData(parent));
	if (item && item->GetName() == data)
		return parent;

	if (item) gkPrintf("%s", (const char*)item->GetName());

	if (HasChildren(parent))
	{
		wxTreeItemIdValue cookie;
		wxTreeItemId item = GetFirstChild(parent, cookie);
		while (item.IsOk())
		{
			wxTreeItemId find = findItemByData(item, data); //find is item self or children.
			if (find.IsOk()) return find;

			item = GetNextChild(item, cookie);
		}
	}

	return wxTreeItemId(); //not found
}
コード例 #20
0
void SkillObjectTree::ShowMenu(wxTreeItemId id, const wxPoint& pt)
{
	SkillTreeItemData *item = id.IsOk() ? (SkillTreeItemData *)GetItemData(id): NULL;
	if (item == NULL)
	{
		return;
	}
	
	if (item->GetDesc() == "Skill root item")
	{
		wxMenu menu("");
		menu.Append(feID_MENU_SKILL_NEW_EFFECT, wxT("添加效果"));		
		menu.Append(feID_MENU_SKILL_NEW_CAMERASHAKE, wxT("添加相机震动"));		
		menu.Append(feID_MENU_SKILL_NEW_RIBBON, wxT("添加刀光"));		
		menu.Append(feID_MENU_SKILL_NEW_SOUND, wxT("添加声音"));		
		menu.Append(feID_MENU_SKILL_NEW_SCENELIGHT, wxT("添加场景灯光"));		
		menu.Append(FEID_MENU_SKILL_NEW_BULLETFLOW, wxT("添加导弹"));		
		PopupMenu(&menu, pt);
	}
	else if (item->GetDesc() == "Skill Element")
	{
		wxMenu menu("");
		menu.Append(feID_MENU_SKILL_DELEMENT_ELEMENT, wxT("删除元素"));		
		PopupMenu(&menu, pt);
	}
}
コード例 #21
0
ファイル: debuggertree.cpp プロジェクト: yjdwbj/cb10-05-ide
void DebuggerTree::ShowMenu(wxTreeItemId id, const wxPoint& pt)
{
    wxString caption;
    wxMenu menu(wxEmptyString);

    // if we right-clicked on a pointer, add a "dereference pointer" entry
    wxString itemtext = m_pTree->GetItemText(id);
    if (itemtext.Find(_T('*')) != wxNOT_FOUND)
    {
        menu.Append(idDereferenceValue, wxString::Format(_("Dereference pointer '%s'"), itemtext.BeforeFirst(_T('=')).c_str()));
        menu.AppendSeparator();
    }

    // add watch always visible
    menu.Append(idAddWatch, _("&Add watch"));
    menu.Append(idWatchThis, _("Watch '*&this'"));

    // we have to have a valid id for the following to be enabled
    WatchTreeData* data = dynamic_cast<WatchTreeData*>(m_pTree->GetItemData(id));
    if (id.IsOk() && // valid item
        data && data->m_pWatch) // *is* a watch
    {
        menu.Append(idEditWatch, _("&Edit watch"));
        menu.Append(idDeleteWatch, _("&Delete watch"));
    }
    menu.AppendSeparator();
    menu.Append(idChangeValue, _("&Change value..."));
    menu.AppendSeparator();
    menu.Append(idLoadWatchFile, _("&Load watch file"));
    menu.Append(idSaveWatchFile, _("&Save watch file"));
    menu.AppendSeparator();
    menu.Append(idDeleteAllWatches, _("Delete all watches"));

    PopupMenu(&menu, pt);
}
コード例 #22
0
bool DoRememberExpandedNodes(wxTreeCtrl* tree, const wxTreeItemId& parent, wxArrayString& nodePaths, wxString& path)
{
    // remember expanded tree nodes of this tree
    if (!tree || !parent.IsOk())
        return false;

    wxString originalPath = path;
    bool found = false;

    wxTreeItemIdValue cookie = nullptr;

    wxTreeItemId child = tree->GetFirstChild(parent, cookie);
    while (child.IsOk())
    {
        if (tree->ItemHasChildren(child) && tree->IsExpanded(child))
        {
            found = true;
            path << _T("/") << tree->GetItemText(child);
            DoRememberExpandedNodes(tree, child, nodePaths, path);
            nodePaths.Add(path);
            path = originalPath;
        }
        child = tree->GetNextChild(parent, cookie);
    }
    return found;
}
コード例 #23
0
//---------------------------------------------------------
void CData_Source_PgSQL::Update_Source(const wxTreeItemId &Item)
{
	CData_Source_PgSQL_Data	*pData	= Item.IsOk() ? (CData_Source_PgSQL_Data *)GetItemData(Item) : NULL; if( pData == NULL )	return;

	if( pData->Get_Type() != TYPE_SOURCE )
	{
		return;
	}

	Freeze();

	DeleteChildren(Item);

	//-----------------------------------------------------
	if( !pData->is_Connected() )
	{
		SetItemImage(Item, IMG_SRC_CLOSED, wxTreeItemIcon_Normal);
		SetItemImage(Item, IMG_SRC_CLOSED, wxTreeItemIcon_Selected);
	}
	else
	{
		SetItemImage(Item, IMG_SRC_OPENED, wxTreeItemIcon_Normal);
		SetItemImage(Item, IMG_SRC_OPENED, wxTreeItemIcon_Selected);

		CSG_Table	Tables;

		RUN_MODULE(DB_PGSQL_Table_List, false,	// CTable_List
				SET_PARAMETER("CONNECTION", pData->Get_Value())
			&&	SET_PARAMETER("TABLES"    , &Tables)
		);

		Tables.Set_Index(1, TABLE_INDEX_Ascending, 0, TABLE_INDEX_Ascending);

		for(int i=0; i<Tables.Get_Count(); i++)
		{
			CSG_String	s(Tables[i].asString(1));

			TSG_Shape_Type	Shape;
			TSG_Vertex_Type	Vertex;

			if( CSG_Shapes_OGIS_Converter::to_ShapeType(s, Shape, Vertex) )
			{
				switch( Shape )
				{
				case SHAPE_TYPE_Point:   Append_Table(Item, Tables[i].asString(0), TYPE_SHAPES, IMG_POINT  ); break;
				case SHAPE_TYPE_Points:  Append_Table(Item, Tables[i].asString(0), TYPE_SHAPES, IMG_POINTS ); break;
				case SHAPE_TYPE_Line:    Append_Table(Item, Tables[i].asString(0), TYPE_SHAPES, IMG_LINE   ); break;
				case SHAPE_TYPE_Polygon: Append_Table(Item, Tables[i].asString(0), TYPE_SHAPES, IMG_POLYGON); break;
				}
			}
			else if( !s.Cmp("RASTER" ) ) Append_Table(Item, Tables[i].asString(0), TYPE_GRIDS , IMG_GRIDS  );
			else if( !s.Cmp("TABLE"  ) ) Append_Table(Item, Tables[i].asString(0), TYPE_TABLE , IMG_TABLE  );
		}

		Expand(Item);
	}

	Thaw();
}
コード例 #24
0
void PanelObjectList::SetCustomObjectForCallback_LabelEdit(wxTreeItemId id, void* pObject)
{
    if( id.IsOk() == false ) return;

    TreeItemDataGenericObjectInfo* pData = (TreeItemDataGenericObjectInfo*)m_pTree_Objects->GetItemData( id );
    if( pData )
        pData->m_pObject_LabelEdit = pObject;
}
コード例 #25
0
void ctlCheckTreeView::SetParentImage(wxTreeItemId node, int newimage)
{
	if (node.IsOk())
	{
		SetItemImage(node, newimage);
		SetParentImage(GetItemParent(node), newimage);
	}
}
コード例 #26
0
ファイル: database_view.cpp プロジェクト: vadz/lmi.new
void DatabaseView::UponTreeSelectionChange(wxTreeEvent& event)
{
    wxTreeCtrl& tree_ctrl = tree();
    MultiDimGrid& grid_ctrl = grid();

    // save the current selection
    wxTreeItemId const old_item = event.GetOldItem();
    if(old_item.IsOk())
        {
        database_tree_item_data* old_item_data =
            dynamic_cast<database_tree_item_data*>
                (tree_ctrl.GetItemData(old_item)
                );
        if(old_item_data)
            {
            old_item_data->set_axes_selected(grid_ctrl.GetGridAxisSelection());
            }
        }

    database_tree_item_data* item_data =
        dynamic_cast<database_tree_item_data*>
            (tree_ctrl.GetItemData(event.GetItem())
            );
    if(!item_data)
        {
        return;
        }

    table_adapter().SetTDBValue
        (&document().GetTDBValue(item_data->db_name().Idx)
        );

    bool is_topic = tree_ctrl.GetChildrenCount(event.GetItem());

    set_grid_label_text(item_data->db_name().LongName);

    wxSizer* sizer = grid_ctrl.GetContainingSizer();
    LMI_ASSERT(sizer);
    sizer->Show(&grid_ctrl, !is_topic);
    sizer->Layout();

    // restore axis selection if any
    grid_ctrl.SetGridAxisSelection(item_data->get_axes_selected());
    grid_ctrl.RefreshTableFull();
}
コード例 #27
0
ファイル: globals.cpp プロジェクト: 469306621/Languages
void SaveTreeState(wxTreeCtrl* tree, const wxTreeItemId& parent, wxArrayString& nodePaths)
{
    nodePaths.Clear();
    if (!parent.IsOk() || !tree || !tree->ItemHasChildren(parent) || !tree->IsExpanded(parent))
        return;
    wxString tmp;
    if (!DoRememberExpandedNodes(tree, parent, nodePaths, tmp))
        nodePaths.Add(tmp); // just the tree root
}
コード例 #28
0
void ecBuildOptionsDialog::CreateItems(ecConfigItem *pti, wxTreeItemId hParent)
{
    if (pti->IsPackage() || !hParent.IsOk())
    {
        wxTreeItemId h;

        if (!hParent.IsOk()) // pti->GetItemNameOrMacro() == _("Configuration"))
            h = m_treeCtrl->AddRoot(pti->GetItemNameOrMacro(), 0, -1);
        else
            h = m_treeCtrl->AppendItem(hParent, pti->GetItemNameOrMacro(), 0, -1);

        m_treeCtrl->SetItemData(h, new ecBuildOptionsData(pti));
        // m_Tree.SetItemImage(h,18,18);
        for(ecConfigItem *pChild=pti->FirstChild();pChild;pChild=pChild->NextSibling()){
            CreateItems(pChild,h);
        }
    }
}
コード例 #29
0
ファイル: BundlePane.cpp プロジェクト: khmerlovers/e
void BundlePane::OnTreeEndDrag(wxTreeEvent& event) {
	if (!m_draggedItem.IsOk()) return;

	const wxTreeItemId itemSrc = m_draggedItem;
	const wxTreeItemId itemDst = event.GetItem();
	m_draggedItem = wxTreeItemId();

	if (!itemDst.IsOk()) return; // Invalid destintion
	if (itemSrc == itemDst) return; // Can't drag to self
	if (IsTreeItemParentOf(itemSrc, itemDst)) return; // Can't drag to one of your own children

	wxLogDebug(wxT("Ending Drag over item: %s"), m_bundleTree->GetItemText(itemDst).c_str());

	const BundleItemData* srcData = (BundleItemData*)m_bundleTree->GetItemData(itemSrc);
	const BundleItemData* dstData = (BundleItemData*)m_bundleTree->GetItemData(itemDst);

	if (!dstData->IsMenuItem()) return; // You can only drag items to menu
	if (dstData->m_bundleId != srcData->m_bundleId) return; // Items can only be dragged within same bundle

	// We have to cache uuid of submenus
	const wxString subUuid = (srcData->m_type == BUNDLE_SUBDIR) ? srcData->m_uuid : wxString(wxEmptyString);

	const unsigned int bundleId = srcData->m_bundleId;
	PListDict infoDict = GetEditableMenuPlist(bundleId);
	
	// Insert the item
	Freeze();
	const wxString name = m_bundleTree->GetItemText(itemSrc);
	const wxTreeItemId insertedItem = InsertMenuItem(itemDst, name, new BundleItemData(*srcData), infoDict);

	if (srcData->m_type == BUNDLE_SUBDIR) {
		CopySubItems(itemSrc, insertedItem);
	}

	// Delete source ref
	if (srcData->IsMenuItem()) RemoveMenuItem(itemSrc, false, infoDict);
	Thaw();

	// Save the modified plist
	m_plistHandler.SaveBundle(bundleId);

	// Update menu in editorFrame
	m_syntaxHandler.ReParseBundles(true/*onlyMenu*/);
}
コード例 #30
0
void WorkspaceBrowserF::ShowMenu(wxTreeCtrl* tree, wxTreeItemId id, const wxPoint& pt)
{
// NOTE: local variables are tricky! If you build two local menus
// and attach menu B to menu A, on function exit both menu A and menu B
// will be destroyed. But when destroying menu A, menu B will be destroyed
// again. Its already-freed memory will be accessed, generating a segfault.

// A safer approach is to make all menus heap-based, and delete the topmost
// on exit.

    m_TreeForPopupMenu = tree;
    if ( !id.IsOk() )
        return;

#if wxUSE_MENUS
	wxString caption;
    wxMenu *menu=new wxMenu(wxEmptyString);

	TreeDataF* ctd = (TreeDataF*)tree->GetItemData(id);
	if (ctd)
	{
	    if (ctd->m_SpecialFolder==sfToken)
	    {
            menu->Append(idMenuJumpToImplementation, _("Jump to &implementation"));
	    }
    }

    if (tree == m_TreeTop)
    {
        // only in top tree
        if (menu->GetMenuItemCount() != 0)
            menu->AppendSeparator();

        menu->Append(idMenuRefreshTree, _("&Refresh tree"));

        if (id == m_TreeTop->GetRootItem())
        {
            menu->Append(idMenuForceReparse, _("Re-&parse now"));
        }
    }
    menu->AppendSeparator();
    menu->AppendCheckItem(idMenuDoNotSort, _("Do not sort"));
    menu->Check(idMenuDoNotSort, !m_BrowserOptions.sortAlphabetically);
    menu->AppendCheckItem(idMenuSortAlphabetically, _("Sort alphabetically"));
    menu->Check(idMenuSortAlphabetically, m_BrowserOptions.sortAlphabetically);

    menu->AppendSeparator();
    menu->AppendCheckItem(idMenuBottomTree, _("Display bottom tree"));
    menu->Check(idMenuBottomTree, m_BrowserOptions.visibleBottomTree);


    if (menu->GetMenuItemCount() != 0)
        PopupMenu(menu);
    delete menu; // Prevents memory leak
#endif // wxUSE_MENUS
}