//--------------------------------------------------------------------------- #pragma hdrstop #include "NVector.h" #include "VecDraw.h" #pragma package(smart_init) // --------------------------------------------------------------------------- __fastcall TLineTextBox::TLineTextBox() { lineHeight = 0; LineDataList = new TList; } // --------------------------------------------------------------------------- __fastcall TLineTextBox::~TLineTextBox() { TSWordData *tempWordData = NULL; if (LineDataList) { for (int i = 0; i < LineDataList->Count; i++) { tempWordData = (TSWordData *)LineDataList->Items[i]; if (tempWordData) delete tempWordData; tempWordData=NULL; } LineDataList->Clear(); delete LineDataList; } LineDataList = NULL; // TSWordData *tempWordData; // // ToDo : delete All TSWordData in LineTextBox; // while (LineDataList->Count) { // tempWordData = (TSWordData*)LineDataList->First(); // LineDataList->Remove(tempWordData); // delete tempWordData; // tempWordData = NULL; // } } // --------------------------------------------------------------------------- __fastcall TWordList::TWordList() { LineTextBoxList = new TList; // IsCurved = false; //by linuxjun for CurvedVectorText CurveData = NULL; // by linuxjun for CurvedVectorText } // --------------------------------------------------------------------------- __fastcall TWordList::~TWordList() { TLineTextBox *tempLineTextBox = NULL; if (LineTextBoxList) { for (int i = 0; i < LineTextBoxList->Count; i++) { tempLineTextBox = (TLineTextBox *)LineTextBoxList->Items[i]; if (tempLineTextBox) delete tempLineTextBox; tempLineTextBox=NULL; } LineTextBoxList->Clear(); delete LineTextBoxList; } LineTextBoxList = NULL; // TLineTextBox *tempLineTextBox; // // while (LineTextBoxList->Count) { // tempLineTextBox = (TLineTextBox*)LineTextBoxList->First(); // LineTextBoxList->Remove(tempLineTextBox); // delete tempLineTextBox; // } } // --------------------------------------------------------------------------- void __fastcall TWordList::Add(TSWordData * tsWordData) { TLineTextBox * lineTextBox = (TLineTextBox*)LineTextBoxList->Last(); lineTextBox->LineDataList->Add(tsWordData); return; } // --------------------------------------------------------------------------- void __fastcall TWordList::Add(TLineTextBox * tempTLineDataList) { LineTextBoxList->Add(tempTLineDataList); return; } // --------------------------------------------------------------------------- void __fastcall TWordList::Insert(int index, TSWordData *tsWordData) { TLineTextBox * lineTextBox; int nTemp = 0; int i = 0; if (LineTextBoxList->Count == 0) { return; } for (i = 0; i < LineTextBoxList->Count; i++) { nTemp += ((TLineTextBox*)LineTextBoxList->Items[i])->LineDataList->Count; if (index - nTemp < 0) break; } nTemp -= ((TLineTextBox*)LineTextBoxList->Items[i])->LineDataList->Count; lineTextBox = (TLineTextBox*)LineTextBoxList->Items[i]; lineTextBox->LineDataList->Insert(index - nTemp, tsWordData); } // --------------------------------------------------------------------------- void __fastcall TWordList::Insert(int index, TLineTextBox *tempTLineDataList) { TLineTextBox * lineTextBox; LineTextBoxList->Insert(index, tempTLineDataList); } // --------------------------------------------------------------------------- void __fastcall TWordList::Delete(int index) { TLineTextBox * lineTextBox; TSWordData *tempWordData; int nTemp = 0; int i = 0; if (LineTextBoxList->Count == 0) { return; } for (i = 0; i < LineTextBoxList->Count; i++) { nTemp += ((TLineTextBox*)LineTextBoxList->Items[i])->LineDataList->Count; if (index - nTemp < 0) break; } nTemp -= ((TLineTextBox*)LineTextBoxList->Items[i])->LineDataList->Count; lineTextBox = (TLineTextBox*)LineTextBoxList->Items[i]; tempWordData = (TSWordData*)lineTextBox->LineDataList->Items[index - nTemp]; lineTextBox->LineDataList->Delete(index - nTemp); delete tempWordData; tempWordData = NULL; } // --------------------------------------------------------------------------- void __fastcall TWordList::DeleteLine(int lineIndex) { TLineTextBox *lineTextBox; lineTextBox = GetLineTextBox(lineIndex); LineTextBoxList->Remove(lineTextBox); delete lineTextBox; lineTextBox = NULL; } // --------------------------------------------------------------------------- TSWordData * __fastcall TWordList::Items(int index) { TLineTextBox * lineTextBox; int nTemp = 0; int i = 0; if (LineTextBoxList->Count == 0) { return NULL; } if (index < 0) { return NULL; // by linuxjun for CurvedVectorText } for (i = 0; i < LineTextBoxList->Count; i++) { nTemp += ((TLineTextBox*)LineTextBoxList->Items[i])->LineDataList->Count; if (index - nTemp < 0) { break; } } TSWordData *retdata = NULL; if (index - nTemp < 0) { nTemp -= ((TLineTextBox*)LineTextBoxList->Items[i])->LineDataList->Count; lineTextBox = (TLineTextBox*)LineTextBoxList->Items[i]; retdata = (TSWordData*)lineTextBox->LineDataList->Items[index - nTemp]; return retdata; } else { // Error Handling //Index Out Of Bounds Exception. // lineTextBox = (TLineTextBox *)LineTextBoxList->First(); // return (TSWordData *)lineTextBox->LineDataList->First(); return NULL; } } // --------------------------------------------------------------------------- TSWordData * __fastcall TWordList::Last() { TLineTextBox * lineTextBox = (TLineTextBox*)LineTextBoxList->Last(); if (lineTextBox == NULL) { return NULL; } return(TSWordData*)lineTextBox->LineDataList->Last(); } // --------------------------------------------------------------------------- int __fastcall TWordList::GetCount() { int nTemp = 0; for (int i = 0; i < LineTextBoxList->Count; i++) { nTemp += ((TLineTextBox*)LineTextBoxList->Items[i])->LineDataList->Count; } return nTemp; } // --------------------------------------------------------------------------- int __fastcall TWordList::GetLineCount() { if (LineTextBoxList) { return LineTextBoxList->Count; } return 0; } // --------------------------------------------------------------------------- int __fastcall TWordList::GetIndexInLine(int index) { TLineTextBox * lineTextBox; int nTemp = 0; int i = 0; if (LineTextBoxList->Count == 0) { return 0; } for (i = 0; i < LineTextBoxList->Count; i++) { nTemp += ((TLineTextBox*)LineTextBoxList->Items[i])->LineDataList->Count; if (index - nTemp < 0) goto BreakPoint; } nTemp -= ((TLineTextBox*)LineTextBoxList->Items[i - 1])->LineDataList->Count; return index - nTemp; BreakPoint: nTemp -= ((TLineTextBox*)LineTextBoxList->Items[i])->LineDataList->Count; return index - nTemp; } // --------------------------------------------------------------------------- TLineTextBox * __fastcall TWordList::GetLineTextBox(int line) { // -->by linuxjun for CurvedVectorText TLineTextBox *textbox = NULL; if (line >= LineTextBoxList->Count) { if (LineTextBoxList->Count > 0) { textbox = (TLineTextBox*) LineTextBoxList->Items[LineTextBoxList->Count - 1]; return textbox; } else { return NULL; } // <--by linuxjun for CurvedVectorText } else { textbox = (TLineTextBox*)LineTextBoxList->Items[line]; return textbox; } } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- ///////////// Class of TVecData // --------------------------------------------------------------------------- __fastcall TVecData::TVecData(int inst) { Instance = inst; bSelected = false; bFill = false; bWinding = false; bPatternFill = false; bModified = false; bClosed = false; bLocked = false; Bitmap = NULL; TBitmap = NULL; TBitmapSource = NULL; MaskBitmap = NULL; PenStyle = P_SOLID; PenThick = 0; // [0]: Start [1]: End // 0: Flat, Round(±âÁ¸) 1: ArrowAnchor 2: DiamondAnchor 3: RoundAnchor 4: SquareAnchor ArrowCap = NULL; CapStyle[0] = 0; // ÃʱâÈ­ ºÎºÐ - ÃʱâÈ­°¡ ¾ÈµÇ¾î ÀϺΠÁ¡¼±¿¡¼­ È­»ìÇ¥·Î Ç¥½ÃµÇ´Â CapStyle[1] = 0; // °æ¿ì°¡ ¹ß»ýÇÏ´Â °Í °°¾Æ Ãß°¡ ÇßÀ½ - 070917 by maxleo21c Color = clBlack; // Color : ¼±ÀÇ »ö Brush = clWhite; // Brush : Ä¥ÇÏ´Â »ö nCount = 0; GroupIndex = 0; TextString = ""; pList = NULL; HeaderNumber = 0; PatternAngle = 0; PatternAdjustX = 0; PatternAdjustY = 0; RatioX = 100; // ScaleÀ» ó¸®Çϱâ À§Çؼ­ - added by maxleo21c (2004/05/12) RatioY = 100; pMask = NULL; // Point MaskÃʱâÈ­ isSameColor = 0; // added by maxleo21c (°°Àº PatternÀÎÁö ¾Ë±â À§Çؼ­~) isSameImage = 0; // added by maxleo21c (°°Àº PatternÀÎÁö ¾Ë±â À§Çؼ­~) ListOfAllLine = NULL; // ±ÛÀÚ °¢°¢ÀÇ Font¸¦ ÀúÀåÇϱâ À§Çؼ­ by maxleo21c (04.10.19) ParentTextBox = NULL; // by linuxjun for CurvedVectorText TextAngle = 0.0; // TextBoxÀÇ °¢µµ¸¦ ³ªÅ¸³¿ ProportionWordDataList = new TList; ProportionLineList = new TList; bAntialiasing = true; // 2005 Vector upgrade Shin 0315 // shin gradientFill bGradientFill = false; gradientItem = 0; gAngle = 0; gradientColorCount = 0; gradientColors = NULL; // by embakum ¸ðƼºê ¹Ýº¹ 2009.02.09 bMotive = false; ChildList = NULL; ChildCount = 0; motivecount = 0; proportion = 1.0; gap = 0; mode = 0; centerX = 0; centerY = 0; childwidth = 0; childheight = 0; // 2009 Vector Upgrade =-= [ Begin ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // ¹ÝÀü °Å¿ï¿¡¼­ ùÁ¡°ú ³¡Á¡ÀÌ ¿¬°áµÇ´Â °ÍÀÎÁö üũÇϱâ À§ÇÑ º¯¼ö - by monkman (2009.11.27) bFirstJoin = false; bLastJoin = false; // =-=-=-=-=-=-=-=-=-=-=-= [ End ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #ifdef WORKSHEET MaterialType = 0; #endif } // --------------------------------------------------------------------------- __fastcall TVecData::~TVecData() { HeapFree(GetProcessHeap(), 0, pList); HeapFree(GetProcessHeap(), 0, pMask); HeapCompact(GetProcessHeap(), 0); if (TBitmap) { delete TBitmap; TBitmap = NULL; } if (TBitmapSource) { delete TBitmapSource; TBitmapSource = NULL; } if (MaskBitmap) { delete MaskBitmap; MaskBitmap = NULL; } // For TextBox by maxleo21c (04.10.19) if (ListOfAllLine) { delete ListOfAllLine; ListOfAllLine = NULL; } // È®´ë/Ãà¼Ò½Ã »ç¿ëµÇ´Â ³»¿ë TSWordData *tsWordData; int *line; if (ProportionWordDataList) { for (int i = 0; i < ProportionWordDataList->Count; i++) { tsWordData = (TSWordData*)ProportionWordDataList->Items[i]; if (tsWordData) delete tsWordData; tsWordData = NULL; } ProportionWordDataList->Clear(); delete ProportionWordDataList; } ProportionWordDataList = NULL; if (ProportionLineList) { for (int i = 0; i < ProportionLineList->Count; i++) { line = (int*)ProportionLineList->Items[i]; if (line) delete line; line = NULL; } ProportionLineList->Clear(); delete ProportionLineList; } ProportionLineList = NULL; if (gradientColors) delete[]gradientColors; // shin gradientFill gradientColors = NULL; if (ChildList) DeleteChildList(); // embakum 20090217 ¸ðƼºê¹Ýº¹ ProportionWordDataList = NULL; ProportionLineList = NULL; // 2009 Vector Upgrade =-= [ Begin ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // ¹ÝÀü °Å¿ï¿¡¼­ ùÁ¡°ú ³¡Á¡ÀÌ ¿¬°áµÇ´Â °ÍÀÎÁö üũÇϱâ À§ÇÑ º¯¼ö - by monkman (2009.11.27) bFirstJoin = false; bLastJoin = false; // =-=-=-=-=-=-=-=-=-=-=-= [ End ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- if (ArrowCap){ delete ArrowCap; ArrowCap = NULL; } #ifdef WORKSHEET MaterialType = 0; #endif } // --------------------------------------------------------------------------- void __fastcall TVecData::DeleteChildList() // embakum 20090217 ¸ðƼºê¹Ýº¹ { TVecData *Item = NULL; if (ChildList) { for (int i = 0; i < ChildList->Count; i++) { Item = (TVecData*)ChildList->Items[i]; if (Item) delete Item; Item = NULL; } ChildList->Clear(); delete ChildList; } ChildList = NULL; } // --------------------------------------------------------------------------- bool __fastcall TVecData::Equal(int inst) { return Instance == inst; } // --------------------------------------------------------------------------- void __fastcall TVecData::Set(int inst) { Instance = inst; } // --------------------------------------------------------------------------- // -->by linuxjun for CurvedVectorText int __fastcall TVecData::GetInstNum() { return Instance; } // <--by linuxjun for CurvedVectorText // --------------------------------------------------------------------------- void __fastcall TVecData::Copy(TVecData *src) { Kind = src->Kind; First.x = src->First.x; First.y = src->First.y; Second.x = src->Second.x; Second.y = src->Second.y; PenStyle = src->PenStyle; PenThick = src->PenThick; PenEndCap = src->PenEndCap; // Áö±ÝÀº »ç¿ëÇÏÁö ¾Ê´Â´Ù PenJoin = src->PenJoin; // Áö±ÝÀº »ç¿ëÇÏÁö ¾Ê´Â´Ù nCount = src->nCount; bRound = src->bRound; bFill = src->bFill; Color = src->Color; Brush = src->Brush; Font = src->Font; bPatternFill = src->bPatternFill; bWinding = src->bWinding; bClosed = src->bClosed; GroupIndex = src->GroupIndex; bLocked = src->bLocked; PatternAngle = src->PatternAngle; PatternAdjustX = src->PatternAdjustX; PatternAdjustY = src->PatternAdjustY; RatioX = src->RatioX; // ScaleÀ» ó¸®Çϱâ À§Çؼ­ - added by maxleo21c (2004/05/12) RatioY = src->RatioY; TraitSet = src->TraitSet; HeaderNumber = src->HeaderNumber; bAntialiasing = src->bAntialiasing; // 2005 Vector Upgrade Shin 0315 CapStyle[0] = src->CapStyle[0]; CapStyle[1] = src->CapStyle[1]; if (src->CapStyle[0] > 0 && src->ArrowCap){ if (ArrowCap == NULL) ArrowCap = new TArrowCap; ArrowCap->LineCapWidthScale = src->ArrowCap->LineCapWidthScale; ArrowCap->LineCapWidth = src->ArrowCap->LineCapWidth; ArrowCap->LineCapHeight = src->ArrowCap->LineCapHeight; ArrowCap->LineCapLine = src->ArrowCap->LineCapLine; ArrowCap->bFillLineCap = src->ArrowCap->bFillLineCap; ArrowCap->bShowArrowBoth = src->ArrowCap->bShowArrowBoth; } // shin gradientfill bGradientFill = src->bGradientFill; gradientItem = src->gradientItem; gAngle = src->gAngle; gradientColorCount = src->gradientColorCount; for (int i = 0; i < 7; i++) { DashValues[i] = src->DashValues[i]; } // ¾îÂ÷ÇÇ º¹»çµÉ °ÍÀ̹ǷΠÀÖ´Ù¸é delete ÇÑ´Ù if (pList != NULL) { HeapFree(GetProcessHeap(), 0, pList); } pList = NULL; if (pMask != NULL) { HeapFree(GetProcessHeap(), 0, pMask); } pMask = NULL; if (src->Kind == V_LINE || src->Kind == V_CURVE) { pList = (DPOINT*)HeapAlloc(GetProcessHeap(), 0, sizeof(DPOINT) * (nCount * 3 + 1)); // for (int j = 0; j < src->nCount*3+1; j++) { // pList[j].x = src->pList[j].x; // pList[j].y = src->pList[j].y; // } memcpy(pList, src->pList, sizeof(DPOINT) * (nCount * 3 + 1)); pMask = (BYTE*)HeapAlloc(GetProcessHeap(), 0, (nCount * 3 + 1) % 8 == 0 ? (nCount * 3 + 1) / 8 : (nCount * 3 + 1) / 8 + 1); memcpy(pMask, src->pMask, (nCount * 3 + 1) % 8 == 0 ? (nCount * 3 + 1) / 8 : (nCount * 3 + 1) / 8 + 1); } if (src->Kind == V_TEXT) for (int j = 0; j < src->nCount; j++) TextString = src->TextString; // ¾îÂ÷ÇÇ º¹»çµÉ °ÍÀ̹ǷΠÀÖ´Ù¸é delete ÇÑ´Ù if (ListOfAllLine) { delete ListOfAllLine; } // by linuxjun for CurvedVectorText ListOfAllLine = NULL; if (src->Kind == V_TEXTBOX) // by maxleo21c { CharH = src->CharH; // ±ÛÀÚÀÇ Å©±â CharW = src->CharW; TextAngle = src->TextAngle; // TextBoxÀÇ Angle·Î »ç¿ëµÊ StartPoint.x = src->StartPoint.x; // ù±ÛÀÚ°¡ ÀÖ´Â À§Ä¡ StartPoint.y = src->StartPoint.y; CenterPoint.x = src->CenterPoint.x; // BoxÀÇ ¹«°ÔÁß½ÉÁ¡ CenterPoint.y = src->CenterPoint.y; int count; // °¢°¢ÀÇ ¶óÀÎÀ» ÀúÀåÇϰí ÀÖ´Â ºÎºÐÀ» Copy TSWordData *tsWordData, *newWordData; TLineTextBox *tempLineTextBox; if (src->ListOfAllLine->LineCount > 0) { ListOfAllLine = new TWordList; // ListOfAllLine->IsCurved = src->ListOfAllLine->IsCurved; //by linuxjun for CurvedVectorText /* //by linuxjun for CurvedVectorText ÀÏ´ÜÀº ¸·¾ÆµÒ °ð ¹®Á¦ ¾øÀÌ µ¹¾Æ°¡°Ô ¼öÁ¤ÇؾßÇÔ if(ListOfAllLine->CurveData){delete ListOfAllLine->CurveData;ListOfAllLine->CurveData=NULL;}//by linuxjun for CurvedVectorText ListOfAllLine->CurveData = new TVecData(MainImageForm->Number);//by linuxjun for CurvedVectorText ListOfAllLine->CurveData->Copy(src->ListOfAllLine->CurveData);//by linuxjun for CurvedVectorText */ for (int i = 0; i < src->ListOfAllLine->LineCount; i++) { tempLineTextBox = new TLineTextBox; count = src->ListOfAllLine->GetLineTextBox(i)->LineDataList->Count; for (int j = 0; j < count; j++) { newWordData = new TSWordData; tsWordData = (TSWordData*)src->ListOfAllLine->GetLineTextBox(i) ->LineDataList->Items[j]; newWordData->Selected = false; newWordData->bNameChanged = tsWordData->bNameChanged; // 2005 Vector Upgrade Shin 0315 newWordData->Color = tsWordData->Color; newWordData->PPoint.x = tsWordData->PPoint.x; newWordData->PPoint.y = tsWordData->PPoint.y; newWordData->Interval = tsWordData->Interval; newWordData->UsedByte = tsWordData->UsedByte; _tcscpy(newWordData->Word, tsWordData->Word); newWordData->WidthGap = tsWordData->WidthGap; // º¯°æµÉ ±ÛÀÚ°£°Ý % newWordData->HeightGap = tsWordData->HeightGap; // º¯°æµÉ ÁÙ°£°Ý % newWordData->LFont.lfHeight = tsWordData->LFont.lfHeight; newWordData->LFont.lfWidth = tsWordData->LFont.lfWidth; newWordData->LFont.lfEscapement = tsWordData->LFont.lfEscapement; newWordData->LFont.lfOrientation = tsWordData->LFont.lfOrientation; newWordData->LFont.lfWeight = tsWordData->LFont.lfWeight; newWordData->LFont.lfItalic = tsWordData->LFont.lfItalic; newWordData->LFont.lfUnderline = tsWordData->LFont.lfUnderline; newWordData->LFont.lfStrikeOut = tsWordData->LFont.lfStrikeOut; newWordData->LFont.lfCharSet = tsWordData->LFont.lfCharSet; newWordData->LFont.lfPitchAndFamily = tsWordData->LFont.lfPitchAndFamily; _tcscpy(newWordData->LFont.lfFaceName, tsWordData->LFont.lfFaceName); // by linuxjun for CurvedVectorText(Copy) // ÀÌ ºÎºÐ¿¡ Data TypeÀÌ º¯ÇÑ ºÎºÐ¿¡ ´ëÇØ Copy¸¦ ÇØÁÖ¾î¾ß ÇÔ. // -->by linuxjun for CurvedVectorText newWordData->px = tsWordData->px; newWordData->py = tsWordData->py; newWordData->tx = tsWordData->tx; newWordData->tx = tsWordData->tx; newWordData->nx = tsWordData->nx; newWordData->nx = tsWordData->nx; // <--by linuxjun for CurvedVectorText tempLineTextBox->LineDataList->Add(newWordData); } tempLineTextBox->lineHeight = src->ListOfAllLine->GetLineTextBox(i) ->lineHeight; ListOfAllLine->Add(tempLineTextBox); } // -->by linuxjun for CurvedVectorText if (src->ListOfAllLine->CurveData) { if (ListOfAllLine->CurveData) { ListOfAllLine->CurveData->Copy(src->ListOfAllLine->CurveData); } else { ///* ListOfAllLine->CurveData = new TVecData(Instance); ListOfAllLine->CurveData->Copy(src->ListOfAllLine->CurveData); } // */ ListOfAllLine->CurveData->ParentTextBox = this; VecDraw->MakeTextBoxPointList(this); // by linuxjun for CurvedVectorText //À̵¿º¹»ç½Ã¿¡ ¿¡·¯³ª´Â ºÎºÐ ¼öÁ¤. } // <--by linuxjun for CurvedVectorText } pList = (DPOINT*)HeapAlloc(GetProcessHeap(), 0, sizeof(DPOINT) * 5); memcpy(pList, src->pList, sizeof(DPOINT) * 5); pMask = (BYTE*)HeapAlloc(GetProcessHeap(), 0, 1); memcpy(pMask, src->pMask, 1); } // ¾îÂ÷ÇÇ º¹»çµÉ °ÍÀ̹ǷΠÀÖ´Ù¸é delete ÇÑ´Ù if (ChildList) DeleteChildList(); ChildList = NULL; // V_REPEAT ¸ðƼºê ¹Ýº¹ º¹»ç ±¸Çö embakum if (src->ChildList) { TVecData *child, *temp; ChildList = new TList; for (int i = 0; i < src->ChildList->Count; i++) { child = new TVecData(Instance); temp = (TVecData*)src->ChildList->Items[i]; child->Copy(temp); ChildList->Add(child); } ChildCount = src->ChildCount; bMotive = src->bMotive; mode = src->mode; gap = src->gap; motivecount = src->motivecount; proportion = src->proportion; childwidth = src->childwidth; childheight = src->childheight; centerX = src->centerX; centerY = src->centerY; } // ¾îÂ÷ÇÇ º¹»çµÉ °ÍÀ̹ǷΠÀÖ´Ù¸é delete ÇÑ´Ù if (TBitmap) delete TBitmap; TBitmap = NULL; if (TBitmapSource) delete TBitmapSource; TBitmapSource = NULL; if (MaskBitmap) delete MaskBitmap; MaskBitmap = NULL; if (src->bPatternFill) { HDC dcMaskSrc = NULL, dcMaskDst = NULL, dcPatternSrc = NULL, dcPatternDst = NULL, dcSourceSrc = NULL, dcSourceDst = NULL; MaskBitmap = new TTexpiaBitmap; TBitmap = new TTexpiaBitmap; TBitmapSource = new TTexpiaBitmap; MaskBitmap->Create(src->Second.x - src->First.x, src->Second.y - src->First.y, 1); TBitmap->Create(src->Second.x - src->First.x, src->Second.y - src->First.y, 24); TBitmapSource->Create(src->TBitmapSource->Width, src->TBitmapSource->Height, 24); if ((dcMaskDst = MaskBitmap->CreateDC()) == NULL) goto next; if ((dcPatternDst = TBitmap->CreateDC()) == NULL) goto next; if ((dcSourceDst = TBitmapSource->CreateDC()) == NULL) goto next; if ((dcMaskSrc = src->MaskBitmap->CreateDC()) == NULL) goto next; if ((dcPatternSrc = src->TBitmap->CreateDC()) == NULL) goto next; if ((dcSourceSrc = src->TBitmapSource->CreateDC()) == NULL) goto next; BitBlt(dcMaskDst, 0, 0, MaskBitmap->Width, MaskBitmap->Height, dcMaskSrc, 0, 0, SRCCOPY); BitBlt(dcPatternDst, 0, 0, TBitmap->Width, TBitmap->Height, dcPatternSrc, 0, 0, SRCCOPY); BitBlt(dcSourceDst, 0, 0, TBitmapSource->Width, TBitmapSource->Height, dcSourceSrc, 0, 0, SRCCOPY); next: if (dcMaskDst) MaskBitmap->DeleteDC(dcMaskDst); dcMaskDst = NULL; if (dcPatternDst) TBitmap->DeleteDC(dcPatternDst); dcPatternDst = NULL; if (dcSourceDst) TBitmapSource->DeleteDC(dcSourceDst); dcSourceDst = NULL; if (dcMaskSrc) src->MaskBitmap->DeleteDC(dcMaskSrc); dcMaskSrc = NULL; if (dcPatternSrc) src->TBitmap->DeleteDC(dcPatternSrc); dcPatternSrc = NULL; if (dcSourceSrc) src->TBitmapSource->DeleteDC(dcSourceSrc); dcSourceSrc = NULL; } // ¾îÂ÷ÇÇ º¹»çµÉ °ÍÀ̹ǷΠÀÖ´Ù¸é delete ÇÑ´Ù if (gradientColors) delete[]gradientColors; gradientColors = NULL; // shin gradientfill if (src->bGradientFill) { gradientColors = new RGBQUAD[src->gradientColorCount]; for (int i = 0; i < src->gradientColorCount; i++) { gradientColors[i].rgbRed = src->gradientColors[i].rgbRed; gradientColors[i].rgbGreen = src->gradientColors[i].rgbGreen; gradientColors[i].rgbBlue = src->gradientColors[i].rgbBlue; gradientColors[i].rgbReserved = src->gradientColors[i].rgbReserved; } } // 2009 Vector Upgrade =-= [ Begin ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // ¹ÝÀü °Å¿ï¿¡¼­ ùÁ¡°ú ³¡Á¡ÀÌ ¿¬°áµÇ´Â °ÍÀÎÁö üũÇϱâ À§ÇÑ º¯¼ö - by monkman (2009.11.27) bFirstJoin = src->bFirstJoin; bLastJoin = src->bLastJoin; // =-=-=-=-=-=-=-=-=-=-=-= [ End ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- } // --------------------------------------------------------------------------- void __fastcall TVecData::SetRect() { // VecDataÀÇ ¿Ü°û¼±À» ±¸ÇØ First, Second ¼³Á¤ - by monkman (2007.09.18) First.x = MaxInt; First.y = MaxInt; Second.x = 0; Second.y = 0; if (Kind == V_LINE || Kind == V_CURVE) { for (int i = 0; i < nCount * 3 + 1; i++) { if (pList == NULL) continue; if (First.x > pList[i].x) First.x = pList[i].x; if (First.y > pList[i].y) First.y = pList[i].y; if (Second.x < pList[i].x) Second.x = pList[i].x; if (Second.y < pList[i].y) Second.y = pList[i].y; } } else if (Kind == V_TEXTBOX && !(ListOfAllLine->CurveData)) { for (int i = 0; i < 5; i++) { First.x = min(First.x, pList[i].x); First.y = min(First.y, pList[i].y); Second.x = max(Second.x, pList[i].x); Second.y = max(Second.y, pList[i].y); } } if (ParentTextBox) { int Margin; try { Margin = ParentTextBox->ListOfAllLine->GetLineTextBox(0)->lineHeight * 3; } catch(...) { Margin = 0; } First.x -= Margin; First.y -= Margin; Second.x += Margin; Second.y += Margin; } if (ChildList) { int Margin; Margin = childwidth > childheight ? int(childwidth) : int(childheight); First.x -= Margin; First.y -= Margin; Second.x += Margin; Second.y += Margin; } } // --------------------------------------------------------------------------- void __fastcall TVecData::MoveBy(double disX, double disY) { if (Kind == V_TEXTBOX) { StartPoint.x += disX+0.5; StartPoint.y += disY+0.5; for (int i = 0; i < 5; i++) { pList[i].x += disX; pList[i].y += disY; } CenterPoint.x += disX+0.5; CenterPoint.y += disY+0.5; First.x += disX+0.5; First.y += disY+0.5; Second.x += disX+0.5; Second.y += disY+0.5; } else { First.x += disX+0.5; First.y += disY+0.5; Second.x += disX+0.5; Second.y += disY+0.5; for (int i = 0; i < nCount * 3 + 1; i++) { pList[i].x += disX; pList[i].y += disY; } } } // --------------------------------------------------------------------------- HRGN __fastcall TVecData::GetRegion(HDC dcRegion) { // º¤ÅÍ µ¥ÀÌÅÍÀÇ Á¤È®ÇÑ RegionÀ» ±¸ÇÑ´Ù - by monkman (2011.04.11) HPEN hPen = NULL, hOldPen = NULL; HBRUSH hBrush = NULL, hOldBrush = NULL; int nFillMode; POINT *pPoints = NULL; // pPoints[1024]¸¦ µ¿ÀûÀ¸·Î ÇÒ´ç¹Þµµ·Ï ¼öÁ¤ - by monkman (2011.04.14) HRGN rgnVecData = NULL; RECT rtRegion = TRect(0, 0, 0, 0); if (dcRegion) { hPen = CreatePen(PS_SOLID, (int)this->PenThick, RGB(0, 0, 0)); hOldPen = (HPEN)SelectObject(dcRegion, hPen); hBrush = CreateSolidBrush(RGB(0, 0, 0)); hOldBrush = (HBRUSH)SelectObject(dcRegion, hBrush); pPoints = new POINT[this->nCount * 3 + 1]; if (pPoints) { for (int i = 0; i < this->nCount * 3 + 1; i++) pPoints[i] = this->pList[i].P(); if (this->bClosed) pPoints[this->nCount * 3] = pPoints[0]; BeginPath(dcRegion); MoveToEx(dcRegion, pPoints[0].x, pPoints[0].y, NULL); PolyBezierTo(dcRegion, pPoints + 1, this->nCount * 3); FillPath(dcRegion); EndPath(dcRegion); rgnVecData = PathToRegion(dcRegion); SetPolyFillMode(dcRegion, nFillMode); DeleteObject(SelectObject(dcRegion, hOldPen)); DeleteObject(SelectObject(dcRegion, hOldBrush)); GetRgnBox(rgnVecData, &rtRegion); delete[]pPoints; pPoints = NULL; } } pPoints = NULL; return rgnVecData; } // --------------------------------------------------------------------------- void __fastcall TVecData::SetCapStyle(int i, int Value) { FCapStyle[i] = Value; if (i == 0){ if (Value == 1 || Value == 2){ if (ArrowCap == NULL){ ArrowCap = new TArrowCap; } } else { // Value == 0 if (ArrowCap){ delete ArrowCap; ArrowCap = NULL; } } } } // --------------------------------------------------------------------------- int __fastcall TVecData::GetCapStyle(int i) { return FCapStyle[i]; } // --------------------------------------------------------------------------- // TArrowCap //--------------------------------------------------------------------------- __fastcall TArrowCap::TArrowCap() { SetDefault(); } // --------------------------------------------------------------------------- __fastcall TArrowCap::~TArrowCap() { // } //--------------------------------------------------------------------------- void __fastcall TArrowCap::SetDefault() { bFillLineCap = true; bShowArrowBoth = false; LineCapWidthScale = 1; LineCapWidth = 5; LineCapHeight = 5; LineCapLine = 1; } //--------------------------------------------------------------------------- bool __fastcall TArrowCap::SaveToFile(HANDLE hFile) { DWORD dwWrite; if (!WriteFile(hFile, &bFillLineCap, sizeof(bool), &dwWrite, NULL)) goto fail; if (!WriteFile(hFile, &bShowArrowBoth, sizeof(bool), &dwWrite, NULL)) goto fail; if (!WriteFile(hFile, &LineCapWidthScale, sizeof(double), &dwWrite, NULL)) goto fail; if (!WriteFile(hFile, &LineCapWidth, sizeof(double), &dwWrite, NULL)) goto fail; if (!WriteFile(hFile, &LineCapHeight, sizeof(double), &dwWrite, NULL)) goto fail; if (!WriteFile(hFile, &LineCapLine, sizeof(double), &dwWrite, NULL)) goto fail; return true; fail: return false; } //--------------------------------------------------------------------------- bool __fastcall TArrowCap::LoadFromFile(HANDLE hFile) { DWORD dwRead; if (!ReadFile(hFile, &bFillLineCap, sizeof(bool), &dwRead, NULL)) goto fail; if (!ReadFile(hFile, &bShowArrowBoth, sizeof(bool), &dwRead, NULL)) goto fail; if (!ReadFile(hFile, &LineCapWidthScale, sizeof(double), &dwRead, NULL)) goto fail; if (!ReadFile(hFile, &LineCapWidth, sizeof(double), &dwRead, NULL)) goto fail; if (!ReadFile(hFile, &LineCapHeight, sizeof(double), &dwRead, NULL)) goto fail; // µð¹ö±ë½Å½Â¹Î20190417 // if (!ReadFile(hFile, &LineCapLine, sizeof(double), &dwRead, NULL)) // goto fail; return true; fail: return false; } //--------------------------------------------------------------------------- int __fastcall TArrowCap::GetClipboardSize() { int rtnSize = 0; rtnSize += sizeof(bFillLineCap); rtnSize += sizeof(bShowArrowBoth); rtnSize += sizeof(LineCapWidthScale); rtnSize += sizeof(LineCapWidth); rtnSize += sizeof(LineCapHeight); rtnSize += sizeof(LineCapLine); return rtnSize; } //--------------------------------------------------------------------------- void __fastcall TArrowCap::SaveClipboard(Byte *lpData) { *(bool*)lpData = bFillLineCap; lpData += sizeof(bool); *(bool*)lpData = bShowArrowBoth; lpData += sizeof(bool); *(double*)lpData = LineCapWidthScale; lpData += sizeof(double); *(double*)lpData = LineCapWidth; lpData += sizeof(double); *(double*)lpData = LineCapHeight; lpData += sizeof(double); *(double*)lpData = LineCapLine; lpData += sizeof(double); } //--------------------------------------------------------------------------- int __fastcall TArrowCap::GetClipboard(Byte *lpData) { int rtnSize = 0; bFillLineCap = *(bool*)lpData; lpData += sizeof(bool); rtnSize += sizeof(bool); bShowArrowBoth = *(bool*)lpData; lpData += sizeof(bool); rtnSize += sizeof(bool); LineCapWidthScale = *(double*)lpData; lpData += sizeof(double); rtnSize += sizeof(double); LineCapWidth = *(double*)lpData; lpData += sizeof(double); rtnSize += sizeof(double); LineCapHeight = *(double*)lpData; lpData += sizeof(double); rtnSize += sizeof(double); LineCapLine = *(double*)lpData; lpData += sizeof(double); rtnSize += sizeof(double); return rtnSize; } //--------------------------------------------------------------------------- // TNVector //--------------------------------------------------------------------------- __fastcall TNVector::TNVector() { FDataList = new TList; // ¹ÝÀü °Å¿ï °ü·Ã Ãß°¡ - by monkman(2005.06.10) SelectedList = new TList; BackUpList = new TList; ReflectionList = new TList; Init(); } //--------------------------------------------------------------------------- __fastcall TNVector::~TNVector() { TVecData *data = NULL; // Ŭ·¡½º ¸â¹ö º¯¼ö¸¦ »ç¿ëÇÏÁö ¾Êµµ·Ï ÇÔ - by monkman (2009.04.01) for (int i = 0; i < FDataList->Count; i++) { data = (TVecData *)FDataList->Items[i]; if (data) delete data; data = NULL; } FDataList->Clear(); // ÇѲ¨¹ø¿¡ Áö¿ì´Â °ÍÀ¸·Î ¼öÁ¤ - by monkman (2009.03.31) for (int i = 0; i < SelectedList->Count; i++) { data = (TVecData *)SelectedList->Items[i]; if (data) delete data; data = NULL; } SelectedList->Clear(); // ÇѲ¨¹ø¿¡ Áö¿ì´Â °ÍÀ¸·Î ¼öÁ¤ - by monkman (2009.03.31) for (int i = 0; i < BackUpList->Count; i++) { data = (TVecData *)BackUpList->Items[i]; if (data) delete data; data = NULL; } BackUpList->Clear(); // ÇѲ¨¹ø¿¡ Áö¿ì´Â °ÍÀ¸·Î ¼öÁ¤ - by monkman (2009.03.31) for (int i = 0; i < ReflectionList->Count; i++) { data = (TVecData *)ReflectionList->Items[i]; if (data) delete data; data = NULL; } ReflectionList->Clear(); // ÇѲ¨¹ø¿¡ Áö¿ì´Â °ÍÀ¸·Î ¼öÁ¤ - by monkman(2009.03.31) delete FDataList; delete SelectedList; delete BackUpList; delete ReflectionList; } //--------------------------------------------------------------------------- void __fastcall TNVector::Init() { bFirst = true; bFstLine = true; bFirstMove = true; // bSelected = false; bClosedState = false; bProportion = false; bUndosw = false; bMergeMode = false; bExtend = false; bExtendFirst = false; // bLocked = false; bRotation = false; bPatternMode = false; bSelectedVectorMove = false; bCancelAntialiasing = false; bVectorMove = false; bFontChange = false; step = 0; PatternStep = 0; bDownState = false; bDragState = false; bTextState = false; bMultiSelect = false; bUserInput = false; bUserLength1 = false; bUserLength2 = false; // 2005 Vector Upgrade =-= [ Begin ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // ¹ÝÀü °Å¿ï ±â´É °ü·Ã - by monkman(2005.02.16) bVectorReflectionMode = false; // ¹ÝÀü °Å¿ï »óÅ ¿©ºÎ ReflectionVH = 0; // ¹ÝÀü °Å¿ï ±âÁؼ±ÀÌ ¼öÁ÷ÀÎÁö ¼öÆòÀÎÁö (0:None 1:¼öÁ÷ 2:¼öÆò 3:¼öÁ÷±×¸®´ÂÁß 4:¼öÆò±×¸®´ÂÁß) ReflectionVIndex = -1; ReflectionHIndex = -1; // ¹ÝÀü °Å¿ï ±âÁؼ±ÀÇ ÁÂÇ¥ ReflectFirstIndex = true; // IndexPoint Áߺ¹ ±ÝÁö º¯¼ö bReflectionGuideLineLock = false; // ¹ÝÀü °Å¿ï ±âÁؼ± Àá±Ý (true:Àá±Ý, false:ÇØÁ¦) // =-=-=-=-=-=-=-=-=-=-=-= [ End ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- } //---------------------------------------------------------------------------