void CRender::SelectItemsWithin(const RectF &r) { CComPtr<boost::scoped_lock_ref_counted> lock; CComPtr<IGraphItem> item; CComPtr<IUnknown> unk; CComQIPtr<IRenderer> ir; RectF box; IGraphItemVector results; m_graph->GetChildren(results); for(IGraphItemVector::iterator itr=results.begin(); itr!=results.end(); ++itr) { item=*itr; unk=item->GetPropertyUnknown(0); if(unk) { ir=static_cast<IRenderer*>(unk.p); if(ir!=0) { ir->GetBoundsBox(box); if(box.IntersectsWith(r)) ir->SetSelected(true, true); } } } }
void CRevisionGraphWnd::DrawStripes (GraphicsDevice& graphics, const CSize& offset) { // we need to fill this visible area of the the screen // (even if there is graph in that part) RectF clipRect; if (graphics.graphics) graphics.graphics->GetVisibleClipBounds (&clipRect); // don't show stripes if we don't have multiple roots CSyncPointer<const ILayoutRectList> trees (m_state.GetTrees()); if (trees->GetCount() < 2) return; // iterate over all trees for ( index_t i = 0, count = trees->GetCount(); i < count; ++i) { // screen coordinates covered by the tree CRect tree = trees->GetRect(i); REAL left = tree.left * m_fZoomFactor; REAL right = tree.right * m_fZoomFactor; RectF rect ( left - offset.cx , clipRect.Y , i+1 == count ? clipRect.Width : right - left , clipRect.Height); // relevant? if (rect.IntersectsWith (clipRect)) { // draw the background stripe Color color ( (i & 1) == 0 ? m_Colors.GetColor (CColors::gdpStripeColor1) : m_Colors.GetColor (CColors::gdpStripeColor2)); if (graphics.graphics) { SolidBrush brush (color); graphics.graphics->FillRectangle (&brush, rect); } else if (graphics.pSVG) graphics.pSVG->RoundedRectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height, color, 1, color); } } }