void wxSFMultiSelRect::OnEndHandle(wxSFShapeHandle& handle) { // inform all selected shapes about end of the handle dragging if(GetParentCanvas()) { ShapeList lstShapes; GetParentCanvas()->GetSelectedShapes(lstShapes); ShapeList::compatibility_iterator node = lstShapes.GetFirst(); while(node) { node->GetData()->OnEndHandle(handle); node = node->GetNext(); } } }
//************************************************** void wxSFTrigger::RescaleImage(const wxRealPoint& size) { if( GetParentCanvas() ) { wxImage image = m_OriginalImage; if( wxSFShapeCanvas::IsGCEnabled() ) { image.Rescale(int(size.x), int(size.y), wxIMAGE_QUALITY_NORMAL); } else { image.Rescale(int(size.x * GetParentCanvas()->GetScale()), int(size.y * GetParentCanvas()->GetScale()), wxIMAGE_QUALITY_NORMAL); } m_Image = image; } }
bool wxSFMultiSelRect::AnyHeightExceeded(const wxPoint& delta) { if(GetParentCanvas()) { wxSFShapeBase* pShape; ShapeList m_lstSelection; GetParentCanvas()->GetSelectedShapes(m_lstSelection); // first determine whether any shape in the selection exceeds its bounds ShapeList::compatibility_iterator node = m_lstSelection.GetFirst(); while(node) { pShape = node->GetData(); if(!pShape->IsKindOf(CLASSINFO(wxSFLineShape))) if((pShape->GetBoundingBox().GetHeight() + delta.y) <= 1)return true; node = node->GetNext(); } return false; } return true; }
void wxSFEditTextShape::EditLabel() { if( GetParentCanvas() ) { int dx, dy; wxRealPoint shpPos = GetAbsolutePosition(); double scale = GetParentCanvas()->GetScale(); GetParentCanvas()->CalcUnscrolledPosition(0, 0, &dx, &dy); switch( m_nEditType ) { case editINPLACE: { wxRect shpBB = GetBoundingBox(); int style = 0; if( m_fForceMultiline || m_sText.Contains(wxT("\n")) ) { style = wxTE_MULTILINE; // set minimal control size } if( (m_sText == wxEmptyString) || ((style == wxTE_MULTILINE) && (shpBB.GetWidth() < 50)) )shpBB.SetWidth(50); m_nCurrentState = GetStyle(); RemoveStyle(sfsSIZE_CHANGE); m_pTextCtrl = new wxSFContentCtrl(GetParentCanvas(), textCtrlId, this, m_sText, wxPoint(int((shpPos.x * scale) - dx), int((shpPos.y * scale) - dy)), wxSize(int(shpBB.GetWidth() * scale), int(shpBB.GetHeight() * scale)), style); } break; case editDIALOG: { wxString sPrevText = GetText(); wxSFDetachedContentCtrl m_pTextDlg( GetParentCanvas() ); //m_pTextDlg.Move( wxPoint(int((shpPos.x * scale) - dx), int((shpPos.y * scale) - dy)) ); m_pTextDlg.SetContent( sPrevText ); if( m_pTextDlg.ShowModal() == wxID_OK ) { if( m_pTextDlg.GetContent() != sPrevText ) { SetText( m_pTextDlg.GetContent() ); GetParentCanvas()->OnTextChange( this ); GetParentCanvas()->SaveCanvasState(); Update(); GetParentCanvas()->Refresh( false ); } } } break; default: break; } } }
//************************************************** void wxSFBotLineShape::OnEndHandle(wxSFShapeHandle& handle) { wxSFShapeBase *pParent = GetParentCanvas()->GetShapeUnderCursor(); if( pParent ) { wxPoint lpos = /*wxSFShapeCanvas::DP2LP(*/handle.GetPosition()/*)*/; wxRect bbRect = pParent->GetBoundingBox(); int centr = bbRect.GetPosition().x + (bbRect.GetWidth()/2); switch( handle.GetType() ) { case wxSFShapeHandle::hndLINESTART: if( pParent->GetId() == m_nSrcShapeId ) { if(pParent->IsKindOf(CLASSINFO(wxSFIfShape))) { wxSFIfShape *ifShape = (wxSFIfShape*)pParent; wxSFBotLineShape* pLine; ShapeList m_lstLines; if(GetShapeManager()->GetShapes(CLASSINFO(wxSFBotLineShape), m_lstLines)) { ShapeList::compatibility_iterator node = m_lstLines.GetFirst(); while(node) { pLine = (wxSFBotLineShape*)node->GetData(); if(lpos.x <= centr) //True { if( (ifShape->GetId() == pLine->GetSrcShapeId()) && (pLine->GetCondition() == 1) ) return; } else if(lpos.x > centr) //False { if( (ifShape->GetId() == pLine->GetSrcShapeId()) && (pLine->GetCondition() == 0) ) return; } node = node->GetNext(); } } if(lpos.x <= centr) //True { SetCondition(1); } else if(lpos.x > centr) //False { SetCondition(0); } } } break; case wxSFShapeHandle::hndLINEEND: if( pParent->GetId() == m_nTrgShapeId ) { if(pParent->IsKindOf(CLASSINFO(wxSFIfShape))) { wxSFIfShape *ifShape = (wxSFIfShape*)pParent; wxSFBotLineShape* pLine; ShapeList m_lstLines; if(GetShapeManager()->GetShapes(CLASSINFO(wxSFBotLineShape), m_lstLines)) { ShapeList::compatibility_iterator node = m_lstLines.GetFirst(); while(node) { pLine = (wxSFBotLineShape*)node->GetData(); if( pLine->GetTrgShapeId() == pParent->GetId() ) return; node = node->GetNext(); } } } wxSFShapeBase* pSourceShape = GetShapeManager()->FindShape(m_nSrcShapeId); if(pSourceShape->IsKindOf(CLASSINFO(wxSFCycle))) { //if(pSourceShape = pShapeUnder->GetParentShape()) // return; } else { if(!pSourceShape->GetParentShape()) if(pParent->GetParentShape()) return; if(pSourceShape->GetParentShape()) if(!pParent->GetParentShape()) return; if(pSourceShape->GetParentShape()) if(pParent->GetParentShape()) if(pParent->GetParentShape() != pSourceShape->GetParentShape()) return; } if( !LineCanConnect(pParent) ) return; } break; default: break; } } wxSFLineShape::OnEndHandle(handle); }
void wxSFMultiSelRect::OnHandle(wxSFShapeHandle& handle) { wxSFRectShape::OnHandle( handle ); GetParentCanvas()->InvalidateVisibleRect(); }