//--------------------------------------------------------------------------- #pragma hdrstop #include "LibraryData.h" #include "VecDraw.h" //--------------------------------------------------------------------------- #pragma package(smart_init) //--------------------------------------------------------------------------- namespace LibraryData{ int thumbWidth = 130; int thumbHeight = 130; int method = 2; // º¤ÅÍ ÀúÀå½Ã ÀÛ¾÷±¸¿ª ¿µ¿ª¾È¿¡ µé¾î¿Â º¤ÅÍ´Â ´Ù ÀúÀå //--------------------------------------------------------------------------- // LibraryTag //--------------------------------------------------------------------------- __fastcall LibraryTag::LibraryTag() { TagStrings = new TStringList; } //--------------------------------------------------------------------------- __fastcall LibraryTag::~LibraryTag() { TagStrings->Clear(); delete TagStrings; TagStrings = NULL; } //--------------------------------------------------------------------------- int __fastcall LibraryTag::GetTagCount() { return TagStrings->Count; } //--------------------------------------------------------------------------- void __fastcall LibraryTag::Add(String addStr) { if (Find(addStr) == false){ TagStrings->Add(addStr); } } //--------------------------------------------------------------------------- String __fastcall LibraryTag::GetTagString(int nValue) { String rtnTag = NULL; if (nValue < TagStrings->Count){ rtnTag = TagStrings->Strings[nValue]; } return rtnTag; } //--------------------------------------------------------------------------- bool __fastcall LibraryTag::Find(String findStr) { for (int i = 0; i < TagStrings->Count; i++){ String tag = TagStrings->Strings[i]; int pos = tag.Pos(findStr); if (pos > 0) return true; } return false; } //--------------------------------------------------------------------------- bool __fastcall LibraryTag::Clear() { TagStrings->Clear(); } //--------------------------------------------------------------------------- // FileInfo //--------------------------------------------------------------------------- __fastcall FileInfo::FileInfo() { } //--------------------------------------------------------------------------- __fastcall FileInfo::~FileInfo() { Destroy(); } //--------------------------------------------------------------------------- void __fastcall FileInfo::Initialize() { FKind = NONE; FTag = NULL; FThumbImage = NULL; FFileVersion = 0; FWidth = 0; FHeight = 0; } //--------------------------------------------------------------------------- void __fastcall FileInfo::Destroy() { if (FThumbImage) { delete FThumbImage; FThumbImage = NULL; } if (FTag) { delete FTag; FTag = NULL; } } //--------------------------------------------------------------------------- void __fastcall FileInfo::AddTag(String strTag) { if (!FTag) FTag = new LibraryTag(); FTag->Add(strTag); } //--------------------------------------------------------------------------- bool __fastcall FileInfo::LoadInfoFromFile(HANDLE fh) { DWORD dwRead; ReadFile(fh, &FileVersion, sizeof(int), &dwRead, NULL); ReadFile(fh, &Width, sizeof(int), &dwRead, NULL); ReadFile(fh, &Height, sizeof(int), &dwRead, NULL); if (FTag) { delete FTag; FTag = NULL; } int tagCount = 0; ReadFile(fh, &tagCount, sizeof(int), &dwRead, NULL); if (tagCount > 0){ FTag = new LibraryTag(); for (int i = 0; i < tagCount; i++){ int len = 0; ReadFile(fh, &len, sizeof(int), &dwRead, NULL); Char *tag = new Char[len+1]; memset(tag, 0, len+1); ReadFile(fh, tag, sizeof(Char)*len, &dwRead, NULL); String strTag = String(tag, len); FTag->Add(strTag); delete[] tag; } } if (FThumbImage) delete FThumbImage; FThumbImage = new TTexpiaBitmap; FThumbImage->Create(thumbWidth, thumbHeight, 24); FThumbImage->LoadFromTexpiaFile(fh, cmZLib); return true; } //--------------------------------------------------------------------------- bool __fastcall FileInfo::SaveInfoToFile(HANDLE fh) { DWORD dwWrite; WriteFile(fh, &FileVersion, sizeof(int), &dwWrite, NULL); WriteFile(fh, &Width, sizeof(int), &dwWrite, NULL); WriteFile(fh, &Height, sizeof(int), &dwWrite, NULL); int tagCount = 0; if (FTag) tagCount = FTag->Count; WriteFile(fh, &tagCount, sizeof(int), &dwWrite, NULL); for (int i = 0; i < tagCount; i++){ String tag = FTag->Item[i]; int len = tag.Length(); WriteFile(fh, &len, sizeof(int), &dwWrite, NULL); WriteFile(fh, tag.c_str(), sizeof(Char)*len, &dwWrite, NULL); } FThumbImage->SaveToTexpiaFile(fh, cmZLib); return true; } //--------------------------------------------------------------------------- void __fastcall FileInfo::SetName(String strName) { FName = strName; } //--------------------------------------------------------------------------- void __fastcall FileInfo::SetWidth(int nValue) { FWidth = nValue; } //--------------------------------------------------------------------------- void __fastcall FileInfo::SetHeight(int nValue) { FHeight = nValue; } //--------------------------------------------------------------------------- void __fastcall FileInfo::SetFileVersion(int nValue) { FFileVersion = nValue; } //--------------------------------------------------------------------------- LibKind __fastcall FileInfo::GetKind() { return FKind; } //--------------------------------------------------------------------------- // BitmapInfo //--------------------------------------------------------------------------- __fastcall BitmapInfo::BitmapInfo() { Initialize(); FKind = BMP; FBitsPerPixel = 0; FColorCount = 0; TextileVersion = 0; FDotsPerInch = 160; } //--------------------------------------------------------------------------- __fastcall BitmapInfo::~BitmapInfo() { Destroy(); } //--------------------------------------------------------------------------- void __fastcall BitmapInfo::SetBitsPerPixel(int Value) { FBitsPerPixel = Value; } //--------------------------------------------------------------------------- void __fastcall BitmapInfo::SetColorCount(int Value) { FColorCount = Value; } //--------------------------------------------------------------------------- void __fastcall BitmapInfo::SetTextileVersion(int Value) { FTextileVersion = Value; } //--------------------------------------------------------------------------- void __fastcall BitmapInfo::SetDotsPerInch(int Value) { FDotsPerInch = Value; } //--------------------------------------------------------------------------- bool __fastcall BitmapInfo::LoadFromFile(HANDLE fh) { DWORD dwRead; LoadInfoFromFile(fh); ReadFile(fh, &TextileVersion, sizeof(int), &dwRead, NULL); ReadFile(fh, &FBitsPerPixel, sizeof(int), &dwRead, NULL); ReadFile(fh, &FColorCount, sizeof(int), &dwRead, NULL); return true; } //--------------------------------------------------------------------------- bool __fastcall BitmapInfo::SaveToFile(HANDLE fh) { DWORD dwWrite; SaveInfoToFile(fh); WriteFile(fh, &TextileVersion, sizeof(int), &dwWrite, NULL); WriteFile(fh, &FBitsPerPixel, sizeof(int), &dwWrite, NULL); WriteFile(fh, &FColorCount, sizeof(int), &dwWrite, NULL); return true; } //--------------------------------------------------------------------------- void __fastcall BitmapInfo::MakeThumbImage() { if (FThumbImage) delete FThumbImage; FThumbImage = new TTexpiaBitmap; FThumbImage->Create(thumbWidth, thumbHeight, 24); FThumbImage->FillRect(Rect(0, 0, thumbWidth, thumbHeight), clWhite); if (MainImageForm->WorkArea && MainImageForm->WorkArea->Mask) { int x = MainImageForm->WorkArea->Range.left; int y = MainImageForm->WorkArea->Range.top; int wid = MainImageForm->WorkArea->Range.right - MainImageForm->WorkArea->Range.left; int hei = MainImageForm->WorkArea->Range.bottom - MainImageForm->WorkArea->Range.top; int stx = 0, sty = 0, tw = thumbWidth, th = thumbHeight; CalculateRatio(wid, hei, thumbWidth, thumbHeight, stx, sty, tw, th); MainImageForm->iMainImage->uBitmap->UnionStretchBltCoordination( FThumbImage, stx, sty, tw, th, MainImageForm->iMainImage->uBitmap, x, y, wid, hei, SRCCOPY); } else { int stx = 0, sty = 0, tw = thumbWidth, th = thumbHeight; CalculateRatio(MainImageForm->iMainImage->uBitmap->Width, MainImageForm->iMainImage->uBitmap->Height, thumbWidth, thumbHeight, stx, sty, tw, th); MainImageForm->iMainImage->uBitmap->UnionStretchBltCoordination( FThumbImage, stx, sty, tw, th, MainImageForm->iMainImage->uBitmap, 0, 0, MainImageForm->iMainImage->uBitmap->Width, MainImageForm->iMainImage->uBitmap->Height, SRCCOPY); } } //--------------------------------------------------------------------------- void __fastcall CalculateRatio(int srcWidth, int srcHeight, int dstWidth, int dstHeight, int &rtnposX, int &rtnposY, int &rtnWidth, int &rtnHeight) { double ratiow = (double)srcWidth/dstWidth; double ratioh = (double)srcHeight/dstHeight; if (ratiow > ratioh){ // °¡·Î°¡ ´õ ±æ´Ù rtnWidth = dstWidth; rtnHeight = (double)srcHeight/ratiow; rtnposX = 0; rtnposY = (dstHeight - rtnHeight)/2; } else { rtnWidth = (double)srcWidth/ratioh; rtnHeight = dstHeight; rtnposX = (dstWidth - rtnWidth)/2; rtnposY = 0; } } //--------------------------------------------------------------------------- String __fastcall BitmapInfo::Info(TUnit Unit, int dpi) { double dw = 0; double dh = 0; String strFormat = ""; if (Unit == uDot){ dw = Width; dh = Height; strFormat = "0"; } else if (Unit == uInch){ dw = (double)Width/dpi; dh = (double)Height/dpi; strFormat = "0.00"; } else if (Unit == uCm){ dw = ((double)Width/dpi)*2.54; dh = ((double)Height/dpi)*2.54; strFormat = "0.00"; } String str = FormatFloat(strFormat, dw) + " x " + FormatFloat(strFormat, dh); String add = ""; if (FBitsPerPixel == 8){ add = "(" + IntToStr(FColorCount) + ")"; } else { add = "(F)"; } return str + " " + add; } //--------------------------------------------------------------------------- //String __fastcall BitmapInfo::Info() //{ // String str = "[B] " + IntToStr(Width) + " x " + IntToStr(Height); // String add = ""; // if (FBitsPerPixel == 8){ // add = "(" + IntToStr(FColorCount) + ")"; // } // else { // add = "(F)"; // } // // return str + " " + add; //} //--------------------------------------------------------------------------- // VectorInfo //--------------------------------------------------------------------------- __fastcall VectorInfo::VectorInfo() { Initialize(); FKind = VEC; VectorVersion = 0; } //--------------------------------------------------------------------------- __fastcall VectorInfo::~VectorInfo() { Destroy(); } //--------------------------------------------------------------------------- bool __fastcall VectorInfo::LoadFromFile(HANDLE fh) { DWORD dwRead; LoadInfoFromFile(fh); ReadFile(fh, &FVectorVersion, sizeof(int), &dwRead, NULL); return true; } //--------------------------------------------------------------------------- bool __fastcall VectorInfo::SaveToFile(HANDLE fh) { DWORD dwWrite; SaveInfoToFile(fh); WriteFile(fh, &FVectorVersion, sizeof(int), &dwWrite, NULL); return true; } //--------------------------------------------------------------------------- void __fastcall VectorInfo::MakeThumbImage() { if (FThumbImage) delete FThumbImage; FThumbImage = new TTexpiaBitmap; FThumbImage->Create(thumbWidth, thumbHeight, 24); FThumbImage->FillRect(Rect(0, 0, thumbWidth, thumbHeight), clWhite); HDC dcThumb = NULL; RECT src; if (MainImageForm->WorkArea && MainImageForm->WorkArea->Mask) { src.left = MainImageForm->WorkArea->Range.left; src.top = MainImageForm->WorkArea->Range.top; src.right = MainImageForm->WorkArea->Range.right; src.bottom = MainImageForm->WorkArea->Range.bottom; } else { src.left = 0; src.top = 0; src.right = MainImageForm->iMainImage->uBitmap->Width; src.bottom = MainImageForm->iMainImage->uBitmap->Height; } if ((dcThumb = FThumbImage->CreateDC())==NULL) goto fail; /* * -# Method 00000100(4) : ÇÑ Á¡ÀÌ¶óµµ Area¹Û¿¡ ÀÖÀ¸¸é ÀúÀåÇÏÁö ¾ÊÀ½ * -# Method 00001000(8) : ¼±ÅÃµÈ Object¸¸ ÀúÀåµÊ * -# Method 00010000(16) : Moptive Object ÀúÀåÀ¸·Î ÀÛ¾÷±¸¿ª°ú »ó°ü¾øÀÌ ÀúÀåÇÑ´Ù. * -# Method 00100000(32) : PatternÀ» Á¦¿Ü Çϰí ÀúÀå */ VecDraw->TagDraw(dcThumb, FThumbImage->Width, FThumbImage->Height, src, method); FThumbImage->DeleteDC(dcThumb); dcThumb = NULL; return; fail: if (dcThumb) FThumbImage->DeleteDC(dcThumb); return; } //--------------------------------------------------------------------------- String __fastcall VectorInfo::Info(TUnit Unit, int dpi) { double dw = 0; double dh = 0; String strFormat = ""; if (Unit == uDot){ dw = Width; dh = Height; strFormat = "0"; } else if (Unit == uInch){ dw = (double)Width/dpi; dh = (double)Height/dpi; strFormat = "0.00"; } else if (Unit == uCm){ dw = ((double)Width/dpi)*2.54; dh = ((double)Height/dpi)*2.54; strFormat = "0.00"; } //String str = /*"[V] " +*/ FormatFloat("0.00", dw) + " x " + FloatToStr(dh); String str = FormatFloat(strFormat, dw) + " x " + FormatFloat(strFormat, dh); return str; } //--------------------------------------------------------------------------- void __fastcall VectorInfo::SetVectorVersion(int nVersion) { FVectorVersion = nVersion; } //--------------------------------------------------------------------------- // LibData //--------------------------------------------------------------------------- __fastcall LibData::LibData() { // } //--------------------------------------------------------------------------- __fastcall LibData::~LibData() { // } //--------------------------------------------------------------------------- // LibraryBitmapData //--------------------------------------------------------------------------- __fastcall LibraryBitmapData::LibraryBitmapData() { FInfo = new BitmapInfo(); Palette = NULL; Bitmap = NULL; ConvertBitmap = NULL; } //--------------------------------------------------------------------------- __fastcall LibraryBitmapData::~LibraryBitmapData() { if (FInfo) { delete FInfo; FInfo = NULL; } if (Palette) { delete Palette; Palette = NULL; } if (Bitmap) { delete Bitmap; Bitmap = NULL; } if (ConvertBitmap) { delete ConvertBitmap; ConvertBitmap = NULL; } } //--------------------------------------------------------------------------- TPException __fastcall LibraryBitmapData::SaveToFile(String fn) { TPException ec = EC_NONE; DWORD dwWrite; HANDLE hFile = INVALID_HANDLE_VALUE; if ((hFile = CreateFile(fn.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) return false; LibKind tempKind = LibraryData::BMP; WriteFile(hFile, &tempKind, sizeof(LibraryData::LibKind), &dwWrite, NULL); BitmapInfo *bitmapInfo = (BitmapInfo *)Info; bitmapInfo->SaveToFile(hFile); TTexpiaBitmap *tag = new TTexpiaBitmap; tag->Create(80, 100, 24); if (!SaveToTexpiaFile(hFile, Palette, tpfh, tag, Bitmap)) { ec = EC_FILE_NOT_WRITE; SAVE_EXCEPTION(ec); goto fail; } if (tag) delete tag; CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; return ec; fail: if (tag) delete tag; if (ec == EC_NONE) ec = EC_FILE_NOT_WRITE; return ec; } //--------------------------------------------------------------------------- TPException __fastcall LibraryBitmapData::SaveToFile(HANDLE hFile) { TPException ec = EC_NONE; tpfh.Version = TexVersion('P', 'T', TextileFileVersion); tpfh.CanvasInfor = MainImageForm->CanvasInfor; tpfh.BitsPerPixel = MainImageForm->iMainImage->uBitmap->BitsPerPixel; tpfh.Compress = cmZLib; int width = 0, height = 0; bool hasWorkArea = false; if (MainImageForm->WorkArea && MainImageForm->WorkArea->Mask){ hasWorkArea = true; width = MainImageForm->WorkArea->Range.right - MainImageForm->WorkArea->Range.left; height = MainImageForm->WorkArea->Range.bottom - MainImageForm->WorkArea->Range.top; } else { width = MainImageForm->iMainImage->uBitmap->Width; height = MainImageForm->iMainImage->uBitmap->Height; } //tpfh.CanvasInfor.DotsPerInch = tpfh.CanvasInfor.DotsPerInch; tpfh.CanvasInfor.SetSize(cstFree, width, height); BitmapInfo *bitmapInfo = (BitmapInfo *)Info; bitmapInfo->FileVersion = 1; bitmapInfo->Width = width; bitmapInfo->Height = height; bitmapInfo->MakeThumbImage(); bitmapInfo->TextileVersion = TextileFileVersion; bitmapInfo->BitsPerPixel = MainImageForm->iMainImage->uBitmap->BitsPerPixel; TTexpiaBitmap *tag = new TTexpiaBitmap; tag->Create(80, 100, 24); if (MainImageForm->iMainImage->uBitmap->BitsPerPixel == 8){ RGBQUAD rgb[256]; TPalette *tempPalette = new TPalette; tempPalette->SetPalette(MainImageForm->Palette); tempPalette->ToRGBQUAD(rgb, 256); TUnionBitmap *tempBitmap = new TUnionBitmap; int wid = 0; int hei = 0; if (hasWorkArea) { wid = MainImageForm->WorkArea->Range.right - MainImageForm->WorkArea->Range.left; hei = MainImageForm->WorkArea->Range.bottom - MainImageForm->WorkArea->Range.top; tempBitmap->Create(wid, hei, 8, rgb); tempBitmap->CopyFromRect(MainImageForm->iMainImage->uBitmap, MainImageForm->WorkArea->Range.left, MainImageForm->WorkArea->Range.top, SRCCOPY); } else { wid = MainImageForm->iMainImage->uBitmap->Width; hei = MainImageForm->iMainImage->uBitmap->Height; tempBitmap->Create(wid, hei, 8, rgb); tempBitmap->Copy(MainImageForm->iMainImage->uBitmap, SRCCOPY); } //int start = tempPalette->UseColor + 1; RunRearrange(tempBitmap, tempPalette); bitmapInfo->ColorCount = tempPalette->UseColor; bitmapInfo->SaveToFile(hFile); if (!SaveToTexpiaFile(hFile, tempPalette, tpfh, tag, tempBitmap)) { ec = EC_FILE_NOT_WRITE; SAVE_EXCEPTION(ec); goto fail; } delete tempPalette; delete tempBitmap; } else { bitmapInfo->SaveToFile(hFile); if (hasWorkArea) { if (!SaveToTexpiaFile(hFile, MainImageForm->Palette, tpfh, tag, MainImageForm->iMainImage->uBitmap, &MainImageForm->WorkArea->Range)) { ec = EC_FILE_NOT_WRITE; SAVE_EXCEPTION(ec); goto fail; } } else { if (!SaveToTexpiaFile(hFile, MainImageForm->Palette, tpfh, tag, MainImageForm->iMainImage->uBitmap)) { ec = EC_FILE_NOT_WRITE; SAVE_EXCEPTION(ec); goto fail; } } } if (tag) delete tag; return ec; fail: if (tag) delete tag; if (ec == EC_NONE) ec = EC_FILE_NOT_WRITE; return ec; } //--------------------------------------------------------------------------- bool __fastcall LibraryBitmapData::LoadFromFile(HANDLE hFile) { TPException ec = EC_NONE; TGraphicFileFormat gff; if (!FInfo) FInfo = new LibraryData::BitmapInfo(); FInfo->LoadFromFile(hFile); int bpp = ((BitmapInfo *)FInfo)->BitsPerPixel; if (bpp == 8){ gff = gffTEX; } else { gff = gffTFC; } if (Bitmap) delete Bitmap; Bitmap = new TUnionBitmap; if (Palette) delete Palette; Palette = new TPalette; LoadFromTexpiaFile(hFile, Palette, tpfh, Bitmap, gff); ((BitmapInfo *)FInfo)->DotsPerInch = tpfh.CanvasInfor.DotsPerInch; return true; } //--------------------------------------------------------------------------- // LibraryVectorData //--------------------------------------------------------------------------- __fastcall LibraryVectorData::LibraryVectorData() { FInfo = new VectorInfo(); FDataList = new TList; } //--------------------------------------------------------------------------- __fastcall LibraryVectorData::~LibraryVectorData() { if (FInfo) { delete FInfo; FInfo = NULL; } if (FDataList){ while (FDataList->Count > 0){ TVecData *data = (TVecData *)FDataList->Last(); FDataList->Remove(data); if (data) { delete data; data = NULL; } } delete FDataList; FDataList = NULL; } } //--------------------------------------------------------------------------- TPException __fastcall LibraryVectorData::SaveToFile(String fn) { TPException ec = EC_NONE; DWORD dwWrite; HANDLE hFile = INVALID_HANDLE_VALUE; if ((hFile = CreateFile(fn.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) return false; LibKind tempKind = LibraryData::VEC; WriteFile(hFile, &tempKind, sizeof(LibraryData::LibKind), &dwWrite, NULL); VectorInfo *vecInfo = (VectorInfo *)Info; vecInfo->SaveToFile(hFile); if (!VecDraw->SaveToFile(hFile, FDataList, method, TextileFileVersion, MainImageForm->Number)) { ec = EC_FILE_NOT_WRITE; SAVE_EXCEPTION(ec); goto fail; } CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; return ec; fail: return ec; } //--------------------------------------------------------------------------- TPException __fastcall LibraryVectorData::SaveToFile(HANDLE hFile) { TPException ec = EC_NONE; VectorInfo *vecInfo = (VectorInfo *)Info; vecInfo->FileVersion = 1; int width = 0; int height = 0; if (MainImageForm->WorkArea->Mask){ width = MainImageForm->WorkArea->Range.right - MainImageForm->WorkArea->Range.left; height = MainImageForm->WorkArea->Range.bottom - MainImageForm->WorkArea->Range.top; } else { width = MainImageForm->iMainImage->uBitmap->Width; height = MainImageForm->iMainImage->uBitmap->Height; } vecInfo->Width = width; vecInfo->Height = height; vecInfo->MakeThumbImage(); vecInfo->VectorVersion = 180; vecInfo->SaveToFile(hFile); if (!VecDraw->SaveToFile(hFile, NULL, method, TextileFileVersion, MainImageForm->Number)) { ec = EC_FILE_NOT_WRITE; SAVE_EXCEPTION(ec); goto fail; } return ec; fail: return ec; } //--------------------------------------------------------------------------- bool __fastcall LibraryVectorData::LoadFromFile(HANDLE hFile) { DWORD dwRead; bool isVector = false; FInfo->LoadFromFile(hFile); ReadFile(hFile, &isVector, sizeof(bool), &dwRead, NULL); if (isVector){ VecDraw->LoadFromFile(hFile, FDataList); return true; } else return false; } //--------------------------------------------------------------------------- void __fastcall LibraryVectorData::SetVectorPasteRange(RECT &PasteRange) { TVecData *data; for (int i = 0; i < FDataList->Count; i++) { data = (TVecData*)FDataList->Items[i]; PasteRange.left = min(PasteRange.left, min(data->First.x, data->Second.x)); PasteRange.right = max(PasteRange.right, max(data->First.x, data->Second.x)); PasteRange.top = min(PasteRange.top, min(data->First.y, data->Second.y)); PasteRange.bottom = max(PasteRange.bottom, max(data->First.y, data->Second.y)); } for (int i = 0; i < FDataList->Count; i++) { data = (TVecData*)FDataList->Items[i]; data->First.x -= PasteRange.left; data->Second.x -= PasteRange.left; data->First.y -= PasteRange.top; data->Second.y -= PasteRange.top; if (data->Kind == V_LINE || data->Kind == V_CURVE) { for (int j = 0; j < data->nCount * 3 + 1; j++) { data->pList[j].x -= PasteRange.left; data->pList[j].y -= PasteRange.top; } } if (data->Kind == V_TEXTBOX) { // -->by linuxjun for CurvedVectorText if (!data->ListOfAllLine->CurveData) { // <--by linuxjun for CurvedVectorText data->StartPoint.x -= PasteRange.left; data->StartPoint.y -= PasteRange.top; for (int k = 0; k < 5; k++) { data->pList[k].x -= PasteRange.left; data->pList[k].y -= PasteRange.top; } data->CenterPoint.x = (data->First.x + data->Second.x) / 2; data->CenterPoint.y = (data->First.y + data->Second.y) / 2; // // todo: ij·ÔÀ» ó¸®Çϱâ À§Çؼ­ (¹Ú»óÈÆ) // CenterPoint.x = data->CenterPoint.x; // CenterPoint.y = data->CenterPoint.y; } } } PasteRange = Rect(50000, 50000, 0, 0); for (int i = 0; i < FDataList->Count; i++) { data = (TVecData*)FDataList->Items[i]; if (data->Kind == V_TEXTBOX) { if (data->ListOfAllLine->CurveData) continue; TRect rect; VecDraw->GetRectForMouseMove(data, rect); PasteRange.left = min(PasteRange.left, rect.left); PasteRange.right = max(PasteRange.right, rect.right); PasteRange.top = min(PasteRange.top, rect.top); PasteRange.bottom = max(PasteRange.bottom, rect.bottom); } else { PasteRange.left = min(PasteRange.left, min(data->First.x, data->Second.x) - data->PenThick * 2); PasteRange.right = max(PasteRange.right, max(data->First.x, data->Second.x) + data->PenThick * 2); PasteRange.top = min(PasteRange.top, min(data->First.y, data->Second.y) - data->PenThick * 2); PasteRange.bottom = max(PasteRange.bottom, max(data->First.y, data->Second.y) + data->PenThick * 2); } } } } //namespace