void PNS_ROUTER::markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved ) { for( PNS_ITEM* item : aCurrent.Items() ) { PNS_NODE::OBSTACLES obstacles; aNode->QueryColliding( item, obstacles, PNS_ITEM::ANY ); if( item->OfKind( PNS_ITEM::LINE ) ) { PNS_LINE* l = static_cast<PNS_LINE*>( item ); if( l->EndsWithVia() ) { PNS_VIA v( l->Via() ); aNode->QueryColliding( &v, obstacles, PNS_ITEM::ANY ); } } for( PNS_OBSTACLE& obs : obstacles ) { int clearance = aNode->GetClearance( item, obs.m_item ); std::unique_ptr<PNS_ITEM> tmp( obs.m_item->Clone() ); tmp->Mark( MK_VIOLATION ); DisplayItem( tmp.get(), -1, clearance ); aRemoved.push_back( obs.m_item ); } } }
void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent ) { PNS_NODE::ITEM_VECTOR removed, added; PNS_NODE::OBSTACLES obstacles; if( !aNode ) return; if( Settings().Mode() == RM_MarkObstacles ) markViolations( aNode, aCurrent, removed ); aNode->GetUpdatedItems( removed, added ); for( PNS_ITEM* item : added ) { DisplayItem( item ); } for( PNS_ITEM* item : removed ) { BOARD_CONNECTED_ITEM* parent = item->Parent(); if( parent ) { if( parent->ViewIsVisible() ) m_hiddenItems.insert( parent ); parent->ViewSetVisible( false ); parent->ViewUpdate( KIGFX::VIEW_ITEM::APPEARANCE ); } } }
void DisplayList::add(DisplayObject* ch, bool replace) { int depth = ch->get_depth(); container_type::iterator it = std::find_if(_charsByDepth.begin(), _charsByDepth.end(), DepthGreaterOrEqual(depth)); if (it == _charsByDepth.end() || (*it)->get_depth() != depth) { _charsByDepth.insert(it, DisplayItem(ch)); } else if (replace) *it = DisplayItem(ch); testInvariant(); }
void CUCMDetail::Display() { #ifdef UNICAS_ON T_AS_INFO info[MAX_AS]; char err_msg[100]; int rc; int max = m_ucmd_list.GetItemCount(); rc = uc_as_info((char *)LPCSTR(m_broker), info, MAX_AS, err_msg); for (int i = 0; i < rc; i++) { if (i < max) { DisplayItem(info[i], i, true); } else { DisplayItem(info[i], i); } } if (i < max) { for (int j = i; j < max; j++) { m_ucmd_list.DeleteItem(j); } } if (!m_autoadd) { if (i >= m_max) { m_ucmd_add.EnableWindow(false); } else { m_ucmd_add.EnableWindow(true); } if (i <= m_min) { m_ucmd_drop.EnableWindow(false); } else { m_ucmd_drop.EnableWindow(true); } } else { m_ucmd_add.EnableWindow(false); m_ucmd_drop.EnableWindow(false); } #endif }
void DisplayList::placeDisplayObject(DisplayObject* ch, int depth, as_object* initObj) { assert(!ch->unloaded()); ch->set_invalidated(); ch->set_depth(depth); container_type::iterator it = std::find_if( _charsByDepth.begin(), _charsByDepth.end(), DepthGreaterOrEqual(depth)); if (it == _charsByDepth.end() || (*it)->get_depth() != depth) { // add the new char _charsByDepth.insert(it, DisplayItem(ch)); } else { // remember bounds of old char InvalidatedRanges old_ranges; (*it)->add_invalidated_bounds(old_ranges, true); // make a copy (before replacing) DisplayObject* oldCh = *it; // replace existing char (before calling unload!) *it = DisplayItem(ch); if (oldCh->unload()) { // reinsert removed DisplayObject if needed reinsertRemovedCharacter(oldCh); } else oldCh->destroy(); // extend invalidated bounds ch->extend_invalidated_bounds(old_ranges); } // Give life to this instance ch->stagePlacementCallback(initObj); testInvariant(); }
void PNS_ROUTER::movePlacing( const VECTOR2I& aP, PNS_ITEM* aEndItem ) { eraseView(); m_placer->Move( aP, aEndItem ); PNS_ITEMSET current = m_placer->Traces(); for( const PNS_ITEM* item : current.CItems() ) { if( !item->OfKind( PNS_ITEM::LINE ) ) continue; const PNS_LINE* l = static_cast<const PNS_LINE*>( item ); DisplayItem( l ); if( l->EndsWithVia() ) DisplayItem( &l->Via() ); } //PNS_ITEMSET tmp( ¤t ); updateView( m_placer->CurrentNode( true ), current ); }
void CRemoteTreeView::RefreshItem(wxTreeItemId parent, const CDirectoryListing& listing, bool will_select_parent) { SetItemImages(parent, false); wxTreeItemIdValue cookie; wxTreeItemId child = GetFirstChild(parent, cookie); if (!child || GetItemText(child).empty()) { DisplayItem(parent, listing); return; } CFilterManager filter; wxString const path = listing.path.GetPath(); wxArrayString dirs; for (unsigned int i = 0; i < listing.GetCount(); ++i) { if (!listing[i].is_dir()) continue; if (!filter.FilenameFiltered(listing[i].name, path, true, -1, false, 0, listing[i].time)) dirs.push_back(listing[i].name); } auto const& sortFunc = CFileListCtrlSortBase::GetCmpFunction(m_nameSortMode); dirs.Sort(sortFunc); bool inserted = false; child = GetLastChild(parent); wxArrayString::reverse_iterator iter = dirs.rbegin(); while (child && iter != dirs.rend()) { int cmp = sortFunc(GetItemText(child), *iter); if (!cmp) { CServerPath childPath = listing.path; childPath.AddSegment(*iter); CDirectoryListing subListing; if (m_pState->m_pEngine->CacheLookup(childPath, subListing) == FZ_REPLY_OK) { if (!GetLastChild(child) && HasSubdirs(subListing, filter)) AppendItem(child, _T(""), -1, -1); SetItemImages(child, false); } else SetItemImages(child, true); child = GetPrevSibling(child); ++iter; } else if (cmp > 0) { // Child no longer exists wxTreeItemId sel = GetSelection(); while (sel && sel != child) sel = GetItemParent(sel); wxTreeItemId prev = GetPrevSibling(child); if (!sel || will_select_parent) Delete(child); child = prev; } else if (cmp < 0) { // New directory CServerPath childPath = listing.path; childPath.AddSegment(*iter); CDirectoryListing subListing; if (m_pState->m_pEngine->CacheLookup(childPath, subListing) == FZ_REPLY_OK) { wxTreeItemId childItem = AppendItem(parent, *iter, 0, 2, 0); if (childItem) { SetItemImages(childItem, false); if (HasSubdirs(subListing, filter)) { AppendItem(childItem, _T(""), -1, -1); } } } else { wxTreeItemId childItem = AppendItem(parent, *iter, 1, 3, 0); if (childItem) { SetItemImages(childItem, true); } } ++iter; inserted = true; } } while (child) { // Child no longer exists wxTreeItemId sel = GetSelection(); while (sel && sel != child) sel = GetItemParent(sel); wxTreeItemId prev = GetPrevSibling(child); if (!sel || will_select_parent) Delete(child); child = prev; } while (iter != dirs.rend()) { CServerPath childPath = listing.path; childPath.AddSegment(*iter); CDirectoryListing subListing; if (m_pState->m_pEngine->CacheLookup(childPath, subListing) == FZ_REPLY_OK) { wxTreeItemId childItem = AppendItem(parent, *iter, 0, 2, 0); if (childItem) { SetItemImages(childItem, false); if (HasSubdirs(subListing, filter)) { AppendItem(childItem, _T(""), -1, -1); } } } else { wxTreeItemId childItem = AppendItem(parent, *iter, 1, 3, 0); if (childItem) { SetItemImages(childItem, true); } } ++iter; inserted = true; } if (inserted) SortChildren(parent); }
wxTreeItemId CRemoteTreeView::MakeParent(CServerPath path, bool select) { std::vector<wxString> pieces; pieces.reserve(path.SegmentCount() + 1); while (path.HasParent()) { pieces.push_back(path.GetLastSegment()); path = path.GetParent(); } wxASSERT(!path.GetPath().empty()); pieces.push_back(path.GetPath()); const wxTreeItemId root = GetRootItem(); wxTreeItemId parent = root; for (std::vector<wxString>::const_reverse_iterator iter = pieces.rbegin(); iter != pieces.rend(); ++iter) { if (iter != pieces.rbegin()) path.AddSegment(*iter); wxTreeItemIdValue cookie; wxTreeItemId child = GetFirstChild(parent, cookie); if (child && GetItemText(child).empty()) { Delete(child); child = wxTreeItemId(); if (parent != root) ListExpand(parent); } for (child = GetFirstChild(parent, cookie); child; child = GetNextSibling(child)) { const wxString& text = GetItemText(child); if (text == *iter) break; } if (!child) { CDirectoryListing listing; if (m_pState->m_pEngine->CacheLookup(path, listing) == FZ_REPLY_OK) { child = AppendItem(parent, *iter, 0, 2, path.HasParent() ? 0 : new CItemData(path)); SetItemImages(child, false); } else { child = AppendItem(parent, *iter, 1, 3, path.HasParent() ? 0 : new CItemData(path)); SetItemImages(child, true); } SortChildren(parent); auto nextIter = iter; ++nextIter; if (nextIter != pieces.rend()) DisplayItem(child, listing); } if (select && iter != pieces.rbegin()) { #ifndef __WXMSW__ // Prevent CalculatePositions from being called wxGenericTreeItem *anchor = m_anchor; m_anchor = 0; #endif Expand(parent); #ifndef __WXMSW__ m_anchor = anchor; #endif } parent = child; } return parent; }
HRESULT CFolderViewCommandProvider::s_OnDisplay(IShellItemArray *psiItemArray, IUnknown * /* pv */) { return DisplayItem(psiItemArray, NULL); }
void CRemoteTreeView::RefreshItem(wxTreeItemId parent, const CDirectoryListing& listing, bool will_select_parent) { SetItemImages(parent, false); wxTreeItemIdValue cookie; wxTreeItemId child = GetFirstChild(parent, cookie); if (!child || GetItemText(child) == _T("")) { DisplayItem(parent, listing); return; } CFilterManager filter; const wxString path = listing.path.GetPath(); std::list<wxString> dirs; for (unsigned int i = 0; i < listing.GetCount(); i++) { if (!listing[i].is_dir()) continue; if (!filter.FilenameFiltered(listing[i].name, path, true, -1, false, 0, listing[i].has_date() ? &listing[i].time : 0)) dirs.push_back(listing[i].name); } dirs.sort(sortfunc); bool inserted = false; child = GetLastChild(parent); std::list<wxString>::reverse_iterator iter = dirs.rbegin(); while (child && iter != dirs.rend()) { int cmp = GetItemText(child).CmpNoCase(*iter); if (!cmp) cmp = GetItemText(child).Cmp(*iter); if (!cmp) { CServerPath path = listing.path; path.AddSegment(*iter); CDirectoryListing subListing; if (m_pState->m_pEngine->CacheLookup(path, subListing) == FZ_REPLY_OK) { if (!GetLastChild(child) && HasSubdirs(subListing, filter)) AppendItem(child, _T(""), -1, -1); SetItemImages(child, false); } else SetItemImages(child, true); child = GetPrevSibling(child); iter++; } else if (cmp > 0) { // Child no longer exists wxTreeItemId sel = GetSelection(); while (sel && sel != child) sel = GetItemParent(sel); wxTreeItemId prev = GetPrevSibling(child); if (!sel || will_select_parent) Delete(child); child = prev; } else if (cmp < 0) { // New directory CServerPath path = listing.path; path.AddSegment(*iter); CDirectoryListing subListing; if (m_pState->m_pEngine->CacheLookup(path, subListing) == FZ_REPLY_OK) { wxTreeItemId child = AppendItem(parent, *iter, 0, 2, 0); SetItemImages(child, false); if (HasSubdirs(subListing, filter)) AppendItem(child, _T(""), -1, -1); } else { wxTreeItemId child = AppendItem(parent, *iter, 1, 3, 0); if (child) SetItemImages(child, true); } iter++; inserted = true; } } while (child) { // Child no longer exists wxTreeItemId sel = GetSelection(); while (sel && sel != child) sel = GetItemParent(sel); wxTreeItemId prev = GetPrevSibling(child); if (!sel || will_select_parent) Delete(child); child = prev; } while (iter != dirs.rend()) { CServerPath path = listing.path; path.AddSegment(*iter); CDirectoryListing subListing; if (m_pState->m_pEngine->CacheLookup(path, subListing) == FZ_REPLY_OK) { wxTreeItemId child = AppendItem(parent, *iter, 0, 2, 0); SetItemImages(child, false); if (HasSubdirs(subListing, filter)) AppendItem(child, _T(""), -1, -1); } else { wxTreeItemId child = AppendItem(parent, *iter, 1, 3, 0); SetItemImages(child, true); } iter++; inserted = true; } if (inserted) SortChildren(parent); }
void PNS_ROUTER::DisplayItems( const PNS_ITEMSET& aItems ) { for( const PNS_ITEM* item : aItems.CItems() ) DisplayItem( item ); }
IFACEMETHODIMP DisplayCommand::Invoke(IShellItemArray *psiItemArray, IBindCtx *pbc) { return DisplayItem(psiItemArray, NULL); }