void CFileTreeCtrl::OnFileCopyPathToClipboard() { std::wstring sPath = getSelectedFullPath(); CWnd *pWnd = GetParentOwner(); CClipBoard cb; cb.Clear(*pWnd); cb.CopyTo(*pWnd, sPath); }
// フォーム入力イベント void CSettingPubTab::OnChgForm() { // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください /// 適用ボタンの有効化 CWnd *cWnd; cWnd = GetParentOwner(); CSettingDialog *pDlg = (CSettingDialog *)cWnd; pDlg->EnableApply(); }
void CAngleParamsVerticesPage::OnBnClickedVertex3Btn() { myAISContext->LocalContext()->InitSelected(); if (!myAISContext->LocalContext()->MoreSelected()) { AfxMessageBox (_T ("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK); return; } myThirdVertex = TopoDS::Vertex (myAISContext->LocalContext()->SelectedShape()); myAISContext->LocalContext()->ClearSelected(); //Build dimension here TopoDS_Edge anEdge12 = BRepBuilderAPI_MakeEdge (myFirstVertex, mySecondVertex); TopoDS_Edge anEdge23 = BRepBuilderAPI_MakeEdge (mySecondVertex, myThirdVertex); CDimensionDlg *aDimDlg = (CDimensionDlg*)(GetParentOwner()); gp_Pnt aP1 = BRep_Tool::Pnt (myFirstVertex), aP2 = BRep_Tool::Pnt (mySecondVertex), aP3 = BRep_Tool::Pnt (myThirdVertex); GC_MakePlane aPlaneBuilder (aP1,aP2,aP3); Handle(Geom_Plane) aPlane = aPlaneBuilder.Value(); Handle(AIS_AngleDimension) anAngleDim = new AIS_AngleDimension (aP1,aP2,aP3); Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect(); anAspect->MakeArrows3d (Standard_False); anAspect->MakeText3d (aDimDlg->GetTextType()); anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight()); anAspect->MakeTextShaded (aDimDlg->IsText3dShaded()); anAspect->SetCommonColor (aDimDlg->GetDimensionColor()); anAspect->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); if (aDimDlg->IsUnitsDisplayed()) { anAngleDim->SetDisplayUnits (aDimDlg->GetUnits()); if ((anAngleDim->GetDisplayUnits().IsEqual (TCollection_AsciiString ("deg")))) { // No units - for degree is special symbol that is enabled by default anAspect->MakeUnitsDisplayed (Standard_False); } else // radians - no special symbol { anAngleDim->SetDisplaySpecialSymbol (AIS_DSS_No); } } anAngleDim->SetDimensionAspect (anAspect); myAISContext->CloseAllContexts(); myAISContext->Display (anAngleDim); myAISContext->OpenLocalContext(); myAISContext->ActivateStandardMode (TopAbs_VERTEX); }
CMagnifyWnd* CBreedView::MagnifyWnd() { return static_cast<CMagnifyWnd*> (GetParentOwner()); }
void CWnd::FilterToolTipMessage(MSG* pMsg) { // this CWnd has tooltips enabled UINT message = pMsg->message; if ((message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE || message == WM_LBUTTONUP || message == WM_RBUTTONUP || message == WM_MBUTTONUP) && (GetKeyState(VK_LBUTTON) >= 0 && GetKeyState(VK_RBUTTON) >= 0 && GetKeyState(VK_MBUTTON) >= 0)) { AFX_MODULE_THREAD_STATE* pModuleThreadState = AfxGetModuleThreadState(); // make sure that tooltips are not already being handled CWnd* pWnd = CWnd::FromHandle(pMsg->hwnd); while (pWnd != NULL && !(pWnd->m_nFlags & (WF_TOOLTIPS|WF_TRACKINGTOOLTIPS))) { pWnd = pWnd->GetParent(); } if (pWnd != this) { if (pWnd == NULL) { // tooltips not enabled on this CWnd, clear last state data pModuleThreadState->m_pLastHit = NULL; pModuleThreadState->m_nLastHit = static_cast<INT_PTR>(-1); } return; } CToolTipCtrl* pToolTip = pModuleThreadState->m_pToolTip; CWnd* pOwner = GetParentOwner(); if (pToolTip != NULL && pToolTip->GetOwner() != pOwner) { pToolTip->DestroyWindow(); delete pToolTip; pModuleThreadState->m_pToolTip = NULL; pToolTip = NULL; } if (pToolTip == NULL) { pToolTip = new CToolTipCtrl; if (!pToolTip->Create(pOwner, TTS_ALWAYSTIP)) { delete pToolTip; return; } pToolTip->SendMessage(TTM_ACTIVATE, FALSE); pModuleThreadState->m_pToolTip = pToolTip; } ASSERT_VALID(pToolTip); ASSERT(::IsWindow(pToolTip->m_hWnd)); TOOLINFO ti; memset(&ti, 0, sizeof(TOOLINFO)); // determine which tool was hit CPoint point = pMsg->pt; ::ScreenToClient(m_hWnd, &point); TOOLINFO tiHit; memset(&tiHit, 0, sizeof(TOOLINFO)); tiHit.cbSize = sizeof(AFX_OLDTOOLINFO); INT_PTR nHit = OnToolHitTest(point, &tiHit); // build new toolinfo and if different than current, register it CWnd* pHitWnd = nHit == -1 ? NULL : this; if (pModuleThreadState->m_nLastHit != nHit || pModuleThreadState->m_pLastHit != pHitWnd) { if (nHit != -1) { // add new tool and activate the tip ti = tiHit; ti.uFlags &= ~(TTF_NOTBUTTON|TTF_ALWAYSTIP); if (m_nFlags & WF_TRACKINGTOOLTIPS) ti.uFlags |= TTF_TRACK; VERIFY(pToolTip->SendMessage(TTM_ADDTOOL, 0, (LPARAM)&ti)); if ((tiHit.uFlags & TTF_ALWAYSTIP) || IsTopParentActive()) { // allow the tooltip to popup when it should pToolTip->SendMessage(TTM_ACTIVATE, TRUE); if (m_nFlags & WF_TRACKINGTOOLTIPS) pToolTip->SendMessage(TTM_TRACKACTIVATE, TRUE, (LPARAM)&ti); // bring the tooltip window above other popup windows ::SetWindowPos(pToolTip->m_hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOOWNERZORDER); } } else { pToolTip->SendMessage(TTM_ACTIVATE, FALSE); } // relay mouse event before deleting old tool _AfxRelayToolTipMessage(pToolTip, pMsg); // now safe to delete the old tool if (pModuleThreadState->m_pLastInfo != NULL && pModuleThreadState->m_pLastInfo->cbSize >= sizeof(AFX_OLDTOOLINFO)) pToolTip->SendMessage(TTM_DELTOOL, 0, (LPARAM)pModuleThreadState->m_pLastInfo); pModuleThreadState->m_pLastHit = pHitWnd; pModuleThreadState->m_nLastHit = nHit; if (pModuleThreadState->m_pLastInfo == NULL) { pModuleThreadState->m_pLastInfo = new TOOLINFO; memset(pModuleThreadState->m_pLastInfo, 0, sizeof(TOOLINFO)); } *pModuleThreadState->m_pLastInfo = tiHit; } else { if (m_nFlags & WF_TRACKINGTOOLTIPS) { POINT pt; ::GetCursorPos( &pt ); pToolTip->SendMessage(TTM_TRACKPOSITION, 0, MAKELPARAM(pt.x, pt.y)); } else { // relay mouse events through the tooltip if (nHit != -1) _AfxRelayToolTipMessage(pToolTip, pMsg); } } if ((tiHit.lpszText != LPSTR_TEXTCALLBACK) && (tiHit.hinst == 0)) free(tiHit.lpszText); } else if (m_nFlags & (WF_TOOLTIPS|WF_TRACKINGTOOLTIPS)) { // make sure that tooltips are not already being handled CWnd* pWnd = CWnd::FromHandle(pMsg->hwnd); while (pWnd != NULL && pWnd != this && !(pWnd->m_nFlags & (WF_TOOLTIPS|WF_TRACKINGTOOLTIPS))) pWnd = pWnd->GetParent(); if (pWnd != this) return; BOOL bKeys = (message >= WM_KEYFIRST && message <= WM_KEYLAST) || (message >= WM_SYSKEYFIRST && message <= WM_SYSKEYLAST); if ((m_nFlags & WF_TRACKINGTOOLTIPS) == 0 && (bKeys || (message == WM_LBUTTONDOWN || message == WM_LBUTTONDBLCLK) || (message == WM_RBUTTONDOWN || message == WM_RBUTTONDBLCLK) || (message == WM_MBUTTONDOWN || message == WM_MBUTTONDBLCLK) || (message == WM_NCLBUTTONDOWN || message == WM_NCLBUTTONDBLCLK) || (message == WM_NCRBUTTONDOWN || message == WM_NCRBUTTONDBLCLK) || (message == WM_NCMBUTTONDOWN || message == WM_NCMBUTTONDBLCLK))) { CWnd::CancelToolTips(bKeys); } } }
void CLengthParamsEdgesPage::OnBnClickedEdge2Btn() { myAISContext->LocalContext()->InitSelected(); if (!myAISContext->LocalContext()->MoreSelected()) { AfxMessageBox (_T("Choose the edge and press the button again"), MB_ICONINFORMATION | MB_OK); return; } // Workaround for AIS_LocalContext::SelectedShape() mySecondEdge = TopoDS::Edge (CDimensionDlg::SelectedShape()); //mySecondEdge = TopoDS::Edge (myAISContext->LocalContext()->SelectedShape()); myAISContext->LocalContext()->ClearSelected(); // Build plane through three points BRepAdaptor_Curve aCurve1 (myFirstEdge); BRepAdaptor_Curve aCurve2 (mySecondEdge); gp_Pnt aP1=aCurve1.Value (0.1); gp_Pnt aP2=aCurve1.Value (0.9); gp_Pnt aP3=aCurve2.Value (0.5); GC_MakePlane aMkPlane (aP1,aP2,aP3); Handle(Geom_Plane) aPlane = aMkPlane.Value(); CDimensionDlg *aDimDlg = (CDimensionDlg*)(GetParentOwner()); myAISContext->CloseAllContexts(); Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect(); anAspect->MakeArrows3d (Standard_False); anAspect->MakeText3d (aDimDlg->GetTextType()); anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight()); anAspect->MakeTextShaded (aDimDlg->IsText3dShaded()); anAspect->SetCommonColor (aDimDlg->GetDimensionColor()); anAspect->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); if (myIsAngleDimension) { // Build an angle dimension between two non-parallel edges Handle(AIS_AngleDimension) anAngleDim = new AIS_AngleDimension (myFirstEdge, mySecondEdge); anAngleDim->SetDimensionAspect (anAspect); anAngleDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); if (aDimDlg->IsUnitsDisplayed()) { anAngleDim->SetDisplayUnits (aDimDlg->GetUnits ()); if ((anAngleDim->GetDisplayUnits().IsEqual (TCollection_AsciiString ("deg")))) { anAngleDim->DimensionAspect()->MakeUnitsDisplayed (Standard_False); } else { anAngleDim->SetDisplaySpecialSymbol (AIS_DSS_No); } } anAngleDim->SetFlyout (aDimDlg->GetFlyout()); myAISContext->Display (anAngleDim); } else { Handle(AIS_LengthDimension) aLenDim = new AIS_LengthDimension (myFirstEdge, mySecondEdge, aPlane->Pln()); aLenDim->SetDimensionAspect (anAspect); aLenDim->SetFlyout (aDimDlg->GetFlyout()); if (aDimDlg->IsUnitsDisplayed()) { aLenDim->SetDisplayUnits (aDimDlg->GetUnits()); } myAISContext->Display (aLenDim); } myAISContext->OpenLocalContext(); myAISContext->ActivateStandardMode (TopAbs_EDGE); }
void CParamsFacesPage::OnBnClickedFacesbtn2() { // Check if face is selected myAISContext->LocalContext()->InitSelected(); if (!myAISContext->LocalContext()->MoreSelected()) { AfxMessageBox(_T("Choose the face and press the button again"), MB_ICONINFORMATION | MB_OK); return; } // Workaround for AIS_LocalContext::SelectedShape() mySecondFace = TopoDS::Face (CDimensionDlg::SelectedShape()); //mySecondFace = TopoDS::Face (myAISContext->LocalContext()->SelectedShape()); myAISContext->LocalContext()->ClearSelected(); CDimensionDlg *aDimDlg = (CDimensionDlg*)(GetParentOwner()); myAISContext->CloseAllContexts(); Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect(); anAspect->MakeArrows3d (Standard_False); anAspect->MakeText3d (aDimDlg->GetTextType()); anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight()); anAspect->MakeTextShaded (aDimDlg->IsText3dShaded()); anAspect->SetCommonColor (aDimDlg->GetDimensionColor()); anAspect->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed()); if (myIsAngleDimension) { // Build an angle dimension between two non-parallel edges Handle(AIS_AngleDimension) anAngleDim = new AIS_AngleDimension (myFirstFace, mySecondFace); anAngleDim->SetDimensionAspect (anAspect); if (aDimDlg->IsUnitsDisplayed()) { anAngleDim->SetDisplayUnits (aDimDlg->GetUnits ()); if ((anAngleDim->GetDisplayUnits().IsEqual (TCollection_AsciiString ("deg")))) { anAngleDim->DimensionAspect()->MakeUnitsDisplayed (Standard_False); } else { anAngleDim->SetDisplaySpecialSymbol (AIS_DSS_No); } } anAngleDim->SetFlyout (aDimDlg->GetFlyout()); myAISContext->Display (anAngleDim); } else { Handle(AIS_LengthDimension) aLenDim = new AIS_LengthDimension (myFirstFace, mySecondFace); aLenDim->SetDimensionAspect (anAspect); if (aLenDim->DimensionAspect()->IsUnitsDisplayed()) { aLenDim->SetFlyout (aDimDlg->GetFlyout()); aLenDim->SetDisplayUnits (aDimDlg->GetUnits()); } myAISContext->Display (aLenDim); } myAISContext->OpenLocalContext(); myAISContext->ActivateStandardMode (TopAbs_FACE); }