#include "StdAfx.h" #include "itemscaleembellish.h" #include "SigmaDoc.h" #include "SigmaView.h" #include "ItemSelect.h" #include "ActionScaleProperty.h" #include "ActionComboItem.h" CItemScaleEmbellish::CItemScaleEmbellish(CSigmaDoc * ppDoc) : CItem(ppDoc) , coefficient(1) , m_bPersonalEmbellish(TRUE) , m_bOwnerProperties(TRUE) { this->SetType(ITEM_SCALE_EMBELLISH); } CItemScaleEmbellish::~CItemScaleEmbellish(void) { } void CItemScaleEmbellish::ScaleEmbellish(void) { //CPropertiesSheet sheet(IDS_GI_SCALE_EMBELLISH,GetView(),0,FALSE); //sheet.SetItem(this); //if(sheet.DoModal()!=IDOK) return; //ScaleProperty(coefficient,coefficient,m_bPersonalEmbellish,m_bOwnerProperties); //GetDoc()->Invalidate(); } void CItemScaleEmbellish::ScaleProperty(double sx, double sy, BOOL bPersonalEmbellish, BOOL bOwnerProperties) { //CActionBackupXYItem* pAction=new CActionBackupXYItem(GetDoc(), IDS_GI_SCALE_EMBELLISH); //GetDoc()->SetActionItem(pAction); CActionScaleProperty * pAction = new CActionScaleProperty(GetDoc(), IDS_GI_SCALE_EMBELLISH); pAction->SetProperty(sx, sy, bPersonalEmbellish, bOwnerProperties); GetDoc()->SetActionItem(pAction); GetDoc()->GetDraw()->ScaleProperty(sx,sy,bPersonalEmbellish,bOwnerProperties); } void CItemScaleEmbellish::ScaleFont(double dScale) { CItemSelect* pItem=GetDoc()->GetSelectItem(); if (pItem == nullptr) { ScaleProperty(dScale,dScale,TRUE,TRUE); return; } if (pItem->m_selection.GetCount() == 0) { ScaleProperty(dScale, dScale, TRUE, TRUE); } auto pComboAction = std::make_unique(); POSITION pos = pItem->m_selection.GetHeadPosition(); while (pos) { POSITION pt = pItem->m_selection.GetNext(pos); COne* pOne = GetDoc()->GetDraw()->GetAt(pt); //¸´ÖƲãÐÞÊÎ switch (pOne->GetType()) { case DOUBLEFOX_CURVE: case DOUBLEFOX_ARC: case DOUBLEFOX_OTHERDRAW: case DOUBLEFOX_TV: if (pOne->HowToViewCurve != NULL) break; if (pOne->GetLayer()->HowToViewCurve == NULL) break;//²ãÐÞÊÎ pOne->HowToViewCurve = new CHowToViewCurve; *(pOne->HowToViewCurve) = *(pOne->GetLayer()->HowToViewCurve); break; case DOUBLEFOX_XYZ: case DOUBLEFOX_POINT: case DOUBLEFOX_XPOINT: if (pOne->HowToViewPoint != NULL) break; if (pOne->GetLayer()->HowToViewPoint == NULL) break;//²ãÐÞÊÎ pOne->HowToViewPoint = new CHowToViewPoint; *(pOne->HowToViewPoint) = *(pOne->GetLayer()->HowToViewPoint); break; } pOne->ScaleProperty(dScale, dScale, TRUE, TRUE); auto pAction = std::make_unique(GetDoc(), IDS_GI_SCALE_EMBELLISH); pAction->SetCOneProperty(pOne, dScale, dScale, TRUE, TRUE); pComboAction->AddAction(pAction.release()); } if (pComboAction->GetCount() > 0) { GetDoc()->SetActionItem(pComboAction.release()); } }