//--------------------------------------------------------------------------- #include #pragma hdrstop #include "CombiDetail.h" #include "Combination.h" #include "Math.h" #include "define.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TDetailForm *DetailForm; //--------------------------------------------------------------------------- /* #define SET_RECT \ \ data->First.x = MaxInt; data->First.y = MaxInt; \ data->Second.x = 0; data->Second.y = 0; \ for (int i = 0; i < data->nCount*3+1; i++) { \ if (data->First.x > data->pList[i].x) data->First.x = data->pList[i].x; \ if (data->First.y > data->pList[i].y) data->First.y = data->pList[i].y; \ if (data->Second.x < data->pList[i].x) data->Second.x = data->pList[i].x; \ if (data->Second.y < data->pList[i].y) data->Second.y = data->pList[i].y; \ } \ */ //-->by linuxjun for CurvedVectorText #define SET_RECT \ \ data->First.x = MaxInt; data->First.y = MaxInt; \ data->Second.x = 0; data->Second.y = 0; \ if (data->Kind == V_LINE || data->Kind == V_CURVE) { \ for (int i = 0; i < data->nCount*3+1; i++) { \ if (data->pList == NULL) continue; \ if (data->First.x > data->pList[i].x) data->First.x = data->pList[i].x; \ if (data->First.y > data->pList[i].y) data->First.y = data->pList[i].y; \ if (data->Second.x < data->pList[i].x) data->Second.x = data->pList[i].x; \ if (data->Second.y < data->pList[i].y) data->Second.y = data->pList[i].y; \ } \ } else if (data->Kind == V_TEXTBOX && !(data->ListOfAllLine->CurveData)) { \ for (int i = 0; i < 5; i++) { \ if (data->pList == NULL) continue; \ data->First.x = min(data->First.x, data->pList[i].x); \ data->First.y = min(data->First.y, data->pList[i].y); \ data->Second.x = max(data->Second.x, data->pList[i].x); \ data->Second.y = max(data->Second.y, data->pList[i].y); \ } \ } \ if (data->ParentTextBox){ \ int Margin; \ try{ \ Margin = data->ParentTextBox->ListOfAllLine->GetLineTextBox(0)->lineHeight*3; \ }catch(...) { \ Margin = 0; \ } \ data->First.x -= Margin; \ data->First.y -= Margin; \ data->Second.x += Margin; \ data->Second.y += Margin; \ } \ #define IDS_NEW StringTable[0] #define IDS_DELETE StringTable[1] #define IDS_SAVE StringTable[2] #define IDS_NORMAL StringTable[3] #define IDS_MIRROR StringTable[4] #define IDS_FITNORMAL StringTable[5] #define IDS_FITMIRROR StringTable[6] #define IDS_SPREAD StringTable[7] #define IDS_DETAIL StringTable[8] #define IDS_FILEERASE StringTable[9] #define IDS_FILEDELETE StringTable[10] #define IDS_SETBASEFOLDER StringTable[11] #define IDS_NOTPROPER StringTable[12] #define IDS_CREATEFOLDER StringTable[13] #define IDS_DELETEFOLDER StringTable[14] #define IDS_CHANGEBASEFOLDER1 StringTable[15] #define IDS_CHANGEBASEFOLDER2 StringTable[16] #define IDS_ERR_MSG_1 StringTable[17] //ÇØ´çÆÄÀÏ¿¡ ¹®Á¦°¡ ÀÖ¾î ÆÄÀÏÀ» ¿­¼ö ¾ø½À´Ï´Ù. //--------------------------------------------------------------------------- __fastcall TDetailForm::TDetailForm(TComponent* Owner) : TForm(Owner) { StringTable.Create(DirectoryItem, Language, "CombiDetail"); SetSmallFont(Font); sbNewFolder->Hint = IDS_NEW; sbDeleteFolder->Hint = IDS_DELETE; sbSave->Hint = IDS_SAVE; sbDelete->Hint = IDS_DELETE; Normal1->Caption = IDS_NORMAL; Mirror1->Caption = IDS_MIRROR; FitNormal1->Caption = IDS_FITNORMAL; FitMirror1->Caption = IDS_FITMIRROR; Spread1->Caption = IDS_SPREAD; Caption = IDS_DETAIL; // 2005.01.10 Ãß°¡ - by monkman sbChangeBaseDirectory->Hint = IDS_SETBASEFOLDER; StringDetail[1] = "sleeve"; StringDetail[2] = "collar"; StringDetail[3] = "pocket"; StringDetail[4] = "button"; StringDetail[5] = "center"; StringDetail[6] = "belt"; StringDetail[7] = "etc"; // etc Ãß°¡ - by monkman (2004.07.19) CopyFrontList = new TList; CopyBackList = new TList; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::InitForm(int tag, bool replace) { TIniFile *IniFile = NULL; String temp; bool sw = false; switch (StyleType) { case 1: StringType = "coat"; break; case 2: StringType = "jacket"; break; case 3: StringType = "jumper"; break; case 4: StringType = "knit"; break; case 5: StringType = "pants"; break; case 6: StringType = "shirts"; break; case 7: StringType = "top"; break; case 8: StringType = "vest"; break; case 9: StringType = "onepiece"; break; case 10:StringType = "blouse"; break; case 11:StringType = "skirt"; break; case 12:StringType = "cape"; break; case 13:StringType = "rompers"; break; case 100:StringType = "acc"; break; } // Style.ini ÆÄÀÏ¿¡¼­ ¾ò¾î¿Â STYPath, STIPath °ª - by monkman (2005.01.10) strSTYDirectory = ""; IniFile = new TIniFile(AppDataItem+"\\Style.ini"); if (IniFile) { strRootPath = IniFile->ReadString("CombiDetail", "RootPath", DirectoryBin); strSTYDirectory = IniFile->ReadString("CombiDetail", "Directory", strSTYDirectory); if (!DirectoryExists(strRootPath+"\\"+strSTYDirectory)) { if (!DirectoryExists(strRootPath)) { strRootPath = DirectoryBin; IniFile->WriteString("CombiDetail", "RootPath", strRootPath); } strSTYDirectory = ""; IniFile->WriteString("CombiDetail", "Directory", strSTYDirectory); } delete IniFile; } IniFile = NULL; // µð·ºÅ丮 °ü·Ã - by monkman (2004.08.04) DirectoryStyle = strRootPath + "\\Detail"; // µð·ºÅ丮 °ü·Ã - by monkman (2004.05.12) FindFolder(strRootPath + "\\*.*"); //comboSource->ItemIndex = 0; // Style.ini ÆÄÀÏ¿¡¼­ ¾ò¾î¿Â STYPath °ª - by monkman (2005.01.10) comboSource->ItemIndex = comboSource->Items->IndexOf(strSTYDirectory); if (comboSource->ItemIndex < 0) { comboSource->ItemIndex = 0; STYDetailSelectedSave(comboSource->Items->Strings[0]); } DirectoryStyle = strRootPath + "\\" + comboSource->Items->Strings[comboSource->ItemIndex]; lbPath->Caption = DirectoryStyle; SearchFile = new TSearchFile; SearchFile->FileName = "*.*"; SearchFile->FileNameList->Add(String(".tex")); SearchFile->FileNameList->Add(String(".tfc")); SearchFile->FileNameList->Add(String(".sty")); //SearchFile->InitDirectory = DirectoryBin + "\\Detail"; SearchFile->InitDirectory = DirectoryStyle; SearchFile->Make = true; SearchFile->SubDirectory = true; Data1 = new TList; Data2 = new TList; bReplace = replace; UpdateComboBox(1); ComboBox1->ItemIndex = 0; retry: for (int i = 0; i < ComboBox1->Items->Count; i++){ temp = (String)ComboBox1->Items->Strings[i]; if (StringType.LowerCase() == temp.LowerCase()) { ComboBox1->ItemIndex = i; break; } } UpdateComboBox(2); ComboBox2->ItemIndex = 0; for (int i = 0; i < ComboBox2->Items->Count; i++){ temp = (String)ComboBox2->Items->Strings[i]; if (StringDetail[tag].LowerCase() == temp.LowerCase()) { ComboBox2->ItemIndex = i; sw = true; break; } } if (!sw) { // ¾øÀ¸¸é Æú´õ ¿Å°Ü¼­ ã¾Æ°¡±â if (ComboBox1->ItemIndex < ComboBox1->Items->Count-2) { //ComboBox1->ItemIndex++; goto retry; // ÀÌ·² Çʿ䰡 ÀÖ´ÂÁö Àß ¸ð¸£°ÚÀ½.. ÁÖ¼®Ã³¸®.. - by monkman (2004.07.12) ShowMessage(IDS_NOTPROPER.c_str()); } } UpdateItems(); Visible = true; if (comboSource->Items->Count == 0 || ComboBox1->Items->Count == 0 || ComboBox2->Items->Count == 0) { sbNewFolder->Enabled = false; sbDeleteFolder->Enabled = false; sbSave->Enabled = false; sbDelete->Enabled = false; } else { sbNewFolder->Enabled = true; sbDeleteFolder->Enabled = true; sbSave->Enabled = true; sbDelete->Enabled = true; } } //--------------------------------------------------------------------------- void __fastcall TDetailForm::ExitForm() { TDirectoryInfor *di; TFileInfor *fi = NULL; TVecData *data; if (Data1) { while(Data1->Count>0) { di = (TDirectoryInfor *) Data1->Last(); Data1->Remove(di); } delete Data1; Data1 = NULL; } if (Data2) { while(Data2->Count>0) { di = (TDirectoryInfor *) Data2->Last(); if (di->pFileList) { for (int i = 0; i < di->pFileList->Count; i++) { fi = (TFileInfor *) di->pFileList->Items[i]; if (fi->tBitmap) { delete fi->tBitmap; fi->tBitmap = NULL; } } } Data2->Remove(di); } delete Data2; Data2 = NULL; } if (CopyFrontList) { while (CopyFrontList->Count) { data = (TVecData *)CopyFrontList->First(); delete data; CopyFrontList->Remove(data); } delete CopyFrontList; CopyFrontList = NULL; } if (CopyBackList) { while (CopyBackList->Count) { data = (TVecData *)CopyBackList->First(); delete data; CopyBackList->Remove(data); } delete CopyBackList; CopyBackList = NULL; } if (SearchFile) { delete SearchFile; SearchFile = NULL;} } //--------------------------------------------------------------------------- bool __fastcall TDetailForm::UpdateComboBox(int combonumber) { TDirectoryInfor *di, *tdi; TFileInfor *fi; int i, cnt, deleteCnt; switch (combonumber) { case 1: while(Data1->Count>0) { di = (TDirectoryInfor *) Data1->Last(); Data1->Remove(di); } SearchFile->Create(this); di = (TDirectoryInfor *) SearchFile->RootDirectory(); if (di->pDirectoryList) { cnt = di->pDirectoryList->Count; ComboBox1->Items->Clear(); for (i=0; ipDirectoryList->Items[i]; ComboBox1->Items->AddObject(tdi->Name, (TObject *)vsList); Data1->Add(tdi); } }else return false; break; case 2: while(Data2->Count>0) { di = (TDirectoryInfor *) Data2->Last(); Data2->Remove(di); } if (Data1->Count>0) { di = (TDirectoryInfor *) Data1->Items[ComboBox1->ItemIndex]; if (di->pDirectoryList) { // È®ÀåÀÚ °É·¯³»±â - by monkman (2005.01.12) for (int i = 0; i < di->pDirectoryList->Count; i++) { tdi = (TDirectoryInfor *)di->pDirectoryList->Items[i]; if (tdi->pFileList && tdi->pFileList->Count > 0) { deleteCnt = 0; while (deleteCnt < tdi->pFileList->Count) { fi = (TFileInfor *) tdi->pFileList->Items[deleteCnt]; if (ExtractFileExt(fi->Name.LowerCase()) != ".sty" && ExtractFileExt(fi->Name.LowerCase()) != ".tfc") { tdi->pFileList->Remove(fi); delete fi; fi = NULL; } else deleteCnt++; } } } cnt = di->pDirectoryList->Count; ComboBox2->Items->Clear(); for (i=0; ipDirectoryList->Items[i]; ComboBox2->Items->AddObject(tdi->Name, (TObject *)vsList); Data2->Add(tdi); } }else return false; } break; } return true; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::UpdateData() { currentindex1 = ComboBox1->ItemIndex; currentindex2 = ComboBox2->ItemIndex; DeleteOldData(); UpdateComboBox(1); ComboBox1->ItemIndex = currentindex1; UpdateComboBox(2); ComboBox2->ItemIndex = currentindex2; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::UpdateItems() { TDirectoryInfor *di; TFileInfor *fi = NULL; HANDLE hFile = INVALID_HANDLE_VALUE; TPException ec = EC_NONE; TTexVersion ver; RGBQUAD rgb[2]; HDC hDC = NULL; Byte *tb; String temp1, temp2; STYLEDATAFILEHEADER header; TList *TagDataList; DWORD dwRead; TVecData *data; int Version; BYTE *StyleData = NULL; DWORD dwPos; DWORD dwDataSize; if (ComboBox2->ItemIndex == -1) return; di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; if (!di->pFileList) return; // ACC¿Ü¿¡´Â Sleeve, Collar, BeltÀÏ °æ¿ì ÀúÀåÀÌ ºÒ°¡ - by monkman (2004.07.05) temp1 = (String)ComboBox1->Items->Strings[ComboBox1->ItemIndex].LowerCase(); temp2 = (String)ComboBox2->Items->Strings[ComboBox2->ItemIndex].LowerCase(); if ( temp1 != "acc" && (temp2 == "sleeve" || temp2 == "collar" || temp2 == "belt")) { bStyleFile = true; sbSave->Enabled = false; // ¾î¶² ¸ðµå·Î µé¾î¿Íµµ Fit °¡´ÉÇÏ°Ô ¼öÁ¤ - by monkman (2005.01.20) //FitNormal1->Enabled = bReplace; //FitMirror1->Enabled = bReplace; FitNormal1->Enabled = true; FitMirror1->Enabled = true; Spread1->Enabled = false; }else { bStyleFile = false; sbSave->Enabled = true; FitNormal1->Enabled = false; FitMirror1->Enabled = false; Spread1->Enabled = true; } for (int i = 0; i < di->pFileList->Count; i++) { fi = (TFileInfor *) di->pFileList->Items[i]; if ((fi->tBitmap = new TTexpiaBitmap) == NULL) {ec = EC_MEMORY_LACK; goto fail;} if (ExtractFileExt(fi->Name.LowerCase()) == ".sty") { // *.sty ÆÄÀÏÀ» ¹öÀü º°·Î ÀÐ°í º¯È¯ÇÑ´Ù - by monkman (2004.03.30) if ((hFile = CreateFile((SearchFile->InitDirectory + "\\" + fi->Path + "\\" + fi->Name).c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto fail; header = VecDraw->ReadSTYFileHeader(hFile, (SearchFile->InitDirectory + "\\" + fi->Path + "\\" + fi->Name), &Version, true); if (!((100 <= Version && Version <= STYSTIFileVersion) || (500 <= Version && Version <= (STYSTIFileVersion+300)))) { // »óÀ§ ¹öÀü üũ - by monkman (2009.05.26) if (hFile) CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; continue; } if (500 <= Version) { #ifndef NOT_STYLEDATA_LOCK // HASP°ú üũ ÇÑ´Ù if (!VecDraw->CheckSTYLock(hFile, header)) { CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; continue; } else break; #endif } TagDataList = new TList; if (Version == 0 || Version == 100) { // Version 100 ÀÏ °æ¿ì ¸ø Àд ¿¡·¯·Î ±ä±ÞÃß°¡ - by monkman (2005.06.10) dwDataSize = GetFileSize(hFile, NULL) - sizeof(OLDSTYLEDATAFILEHEADER); } else { dwDataSize = GetFileSize(hFile, NULL) - sizeof(STYLEDATAFILEHEADER); } if ((StyleData = (BYTE *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwDataSize))==NULL) goto fail; // ÆÄÀÏÅ©±â¸¸Å­ ¸Þ¸ð¸® ÇÒ´ç VecDraw->ReadSTYFileData(hFile, Version, StyleData, header); dwPos = 0; for (int i = 0; i < header.Count1; i++) { if ((data = new TVecData(0))==NULL) goto fail; VecDraw->LoadFromSTYMemory(&StyleData, &dwPos, data, Version); TagDataList->Add(data); } fi->tBitmap->Create(80, 100, 24); fi->tBitmap->FillRect(Rect(0, 0, 80, 100), clWhite); if ((hDC = fi->tBitmap->CreateDC()) == NULL) goto fail; CombiForm->TagDraw(hDC, TagDataList, -1, 0, 0, 80, 100); fi->tBitmap->DeleteDC(hDC); hDC = NULL; if (TagDataList) { while (TagDataList->Count) { // ±×·ÁÁáÀ¸´Ï ºñ¿öÁÖÀÚ data = (TVecData *)TagDataList->First(); delete data; TagDataList->Remove(data); } } }else { // texÆÄÀÏ if ((hFile = CreateFile((SearchFile->InitDirectory + "\\" + fi->Path + "\\" + fi->Name).c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto fail; TGraphicFileFormat gff = FindExtension(ExtractFileExt(fi->Name)); if (LoadFromTexpiaStyleTag(hFile, fi, gff, &ver) != EC_NONE) goto fail; // *.tfc ÆÄÀÏÀÌ StringGrid¿¡ ¿ª»óÀ¸·Î Ãâ·ÂµÇ´ø°ÍÀ» ÁÖ¼®À¸·Î ¸·¾Æ¼­ ó¸® - by celberus (2004.07.01) //////////////////////////////////////////////////////////////////////////////// // rgb[0].rgbRed = 255; // rgb[0].rgbGreen = 255; // rgb[0].rgbBlue = 255; // rgb[1].rgbRed = 0; // rgb[1].rgbGreen = 0; // rgb[1].rgbBlue = 0; // //======== Tag º¹»çÇØ³õ±â // if ((hDC = fi->tBitmap->CreateDC()) == NULL) {ec = EC_MEMORY_LACK; goto fail;} // SetDIBColorTable(hDC, 0, 2, rgb); // fi->tBitmap->DeleteDC(hDC); // if ((fi->tBitmap->StartScanLine()) == false) {ec = EC_MEMORY_LACK; goto fail;} // for (int y = 0; y < fi->tBitmap->Height; y++) { // tb = fi->tBitmap->GetScanLine(y); // for (int x = 0; x< fi->tBitmap->Width; x++) { // tb[x] = tb[x]-1; // } // fi->tBitmap->PutScanLine(y); // } // fi->tBitmap->StopScanLine(); //////////////////////////////////////////////////////////////////////////////// } if (StyleData) { HeapFree(GetProcessHeap(), 0, StyleData); // ¸Þ¸ð¸® ÇØÁ¦ StyleData = NULL; } CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; } StringGrid1->Repaint(); return; fail: if(fi->tBitmap){ delete fi->tBitmap; fi->tBitmap = NULL; } if (StyleData) { HeapFree(GetProcessHeap(), 0, StyleData); // ¸Þ¸ð¸® ÇØÁ¦ StyleData = NULL; } if (hFile!=INVALID_HANDLE_VALUE) CloseHandle(hFile); if (ec == EC_NONE) EXCEPTION_MESSAGE_OK(EC_FILE_NOT_OPEN); else EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------------- void __fastcall TDetailForm::StringGrid1DrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect, TGridDrawState State) { TDirectoryInfor *di; TFileInfor *fi; HDC hDC = NULL; TRect r; if (ComboBox2->ItemIndex == -1) return; di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; if (di->pFileList) { if (ARow*2 + ACol < di->pFileList->Count) { fi = (TFileInfor *) di->pFileList->Items[ARow*2 + ACol]; if (!fi->tBitmap) goto fail; if ((hDC = fi->tBitmap->CreateDC()) == NULL) goto fail; if (ExtractFileExt(fi->Name.LowerCase()) == ".sty") BitBlt(StringGrid1->Canvas->Handle, Rect.Left+5, Rect.Top+5, fi->tBitmap->Width, fi->tBitmap->Height, hDC, 0, 0, SRCCOPY); else BitBlt(StringGrid1->Canvas->Handle, Rect.Left+5, Rect.Top+5, fi->tBitmap->Width, fi->tBitmap->Height, hDC, 0, 0, SRCCOPY); fi->tBitmap->DeleteDC(hDC); r.Left = Rect.Left+5; r.Top = Rect.Top+110; r.Right = Rect.Left+85; r.Bottom = Rect.Top+130; StringGrid1->Canvas->TextRect(r, Rect.Left+5, Rect.Top+115, fi->Name); } } fail: } //--------------------------------------------------------------------------- void __fastcall TDetailForm::Normal1Click(TObject *Sender) { TDirectoryInfor *di; TFileInfor *fi; String path; if (Data2->Count > 0) { di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; if(di->pFileList) { if (StringGrid1->Row*2 + StringGrid1->Col < di->pFileList->Count) { if (bReplace) VecDraw->DeleteVectorObject(true); fi = (TFileInfor*) di->pFileList->Items[StringGrid1->Row*2 + StringGrid1->Col]; path = SearchFile->InitDirectory + "\\" + fi->Path + "\\" + fi->Name; mirror = false; if (ExtractFileExt(fi->Name.LowerCase()) == ".sty") LoadStyleToMainImage(path); else LoadToMainImage(path); } } } } //--------------------------------------------------------------------------- void __fastcall TDetailForm::Mirror1Click(TObject *Sender) { TDirectoryInfor *di; TFileInfor *fi; String path; if (Data2->Count > 0) { di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; if(di->pFileList) { if (StringGrid1->Row*2 + StringGrid1->Col < di->pFileList->Count) { if (bReplace) VecDraw->DeleteVectorObject(true); fi = (TFileInfor*) di->pFileList->Items[StringGrid1->Row*2 + StringGrid1->Col]; path = SearchFile->InitDirectory + "\\" + fi->Path + "\\" + fi->Name; mirror = true; if (ExtractFileExt(fi->Name.LowerCase()) == ".sty") LoadStyleToMainImage(path); else LoadToMainImage(path); } } } } //--------------------------------------------------------------------------- void __fastcall TDetailForm::FitNormal1Click(TObject *Sender) { PSTYLEDATAFILEHEADER pheader; String temp = (String)ComboBox2->Items->Strings[ComboBox2->ItemIndex]; TDirectoryInfor *di; TFileInfor *fi; String path; Number = VecDraw->CheckStyle(); if (Number == 0) goto fail; if (Data2->Count > 0) { di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; if(di->pFileList) { if (StringGrid1->Row*2 + StringGrid1->Col < di->pFileList->Count) { fi = (TFileInfor*) di->pFileList->Items[StringGrid1->Row*2 + StringGrid1->Col]; path = SearchFile->InitDirectory + "\\" + fi->Path + "\\" + fi->Name; mirror = false; if (temp.LowerCase() == "sleeve") { pheader = (PSTYLEDATAFILEHEADER) MainImageForm->StyleHeader->Items[abs(Number)-1]; // if (!pheader->bSleeve) goto fail; LoadSleeveCollar(path, true); }else if (temp.LowerCase() == "collar") { pheader = (PSTYLEDATAFILEHEADER) MainImageForm->StyleHeader->Items[abs(Number)-1]; // if (!pheader->bCollar) goto fail; LoadSleeveCollar(path, false); }else if (temp.LowerCase() == "belt") { pheader = (PSTYLEDATAFILEHEADER) MainImageForm->StyleHeader->Items[abs(Number)-1]; LoadBelt(path); } } } } return; fail: ShowMessage(IDS_NOTPROPER.c_str()); return; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::FitMirror1Click(TObject *Sender) { PSTYLEDATAFILEHEADER pheader; String temp = (String)ComboBox2->Items->Strings[ComboBox2->ItemIndex]; TDirectoryInfor *di; TFileInfor *fi; String path; Number = VecDraw->CheckStyle(); if (Number == 0) goto fail; if (Data2->Count > 0) { di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; if(di->pFileList) { if (StringGrid1->Row*2 + StringGrid1->Col < di->pFileList->Count) { fi = (TFileInfor*) di->pFileList->Items[StringGrid1->Row*2 + StringGrid1->Col]; path = SearchFile->InitDirectory + "\\" + fi->Path + "\\" + fi->Name; mirror = true; if (temp.LowerCase() == "sleeve") { pheader = (PSTYLEDATAFILEHEADER) MainImageForm->StyleHeader->Items[abs(Number)-1]; // if (!pheader->bSleeve) goto fail; LoadSleeveCollar(path, true); }else if (temp.LowerCase() == "collar") { // todo : ¿©±â¸¦ ¼öÁ¤Çϸé Collar°¡ ¹ÝÀü ¸ÂÃ߱⠵ȴ٠}else if (temp.LowerCase() == "belt") { // todo : ¿©±â¸¦ ¼öÁ¤Çϸé Belt°¡ ¹ÝÀü ¸ÂÃ߱⠵ȴ٠} } } } return; fail: // ¸Þ½ÃÁö : ÀÌ ½ºÅ¸ÀÏÀº ÀûÇÕÇÏÁö ¾Ê½À´Ï´Ù. ShowMessage(IDS_NOTPROPER.c_str()); return; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::Spread1Click(TObject *Sender) { TDirectoryInfor *di; TFileInfor *fi; String path; if (Data2->Count > 0) { di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; if(di->pFileList) { if (StringGrid1->Row*2 + StringGrid1->Col < di->pFileList->Count) { if (bReplace) VecDraw->DeleteVectorObject(true); fi = (TFileInfor*) di->pFileList->Items[StringGrid1->Row*2 + StringGrid1->Col]; path = SearchFile->InitDirectory + "\\" + fi->Path + "\\" + fi->Name; mirror = false; SpreadToMainImage(path); } } } // Focus¸¦ ´Ù¸¥ °÷À¸·Î µ¹·Á¾ß ÇÑ´Ù // ±×·¸Áö ¾ÊÀ¸¸é SpreadÀÇ WheelÀÌ °°ÀÌ ¸Ô¾î ¹ö¸°´Ù - by monkman (2005.05.31) SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TDetailForm::LoadToMainImage(String path) { TEXPIAFILEHEADER tpfh; int x, y; RGBQUAD rgb[256]; TPalette *spalette = NULL; // ¹è°æ ºñÆ®¸ÊÀ» Àбâ À§ÇØ - by monkman (2004.07.19) TTexpiaBitmap *bgTexpia = NULL; TUnionBitmap *bgUnion = NULL; int ec = EC_NONE; HANDLE hFile = INVALID_HANDLE_VALUE; DWORD dwRead; bool vector, layer; WORD BitCount; WORD useColor = 0; String ext; if (VecDraw->SpreadStep) {VecDraw->SpreadStep = 0; MainImageForm->iMainImage->Repaint(); } ext = ExtractFileExt(path); ext = ext.LowerCase(); if ((spalette = new TPalette)==NULL) { ec = EC_MEMORY_LACK; goto fail; } if ((hFile = CreateFile(path.c_str(),GENERIC_READ, 0, NULL, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) { ec = EC_MEMORY_LACK; goto fail; } // Çì´õºÎÅÍ Àоî¿Í¼­ º¤ÅÍÆÄÀÏÀÎÁö º¤ÅÍ+ºñÆ®¸Ê ÆÄÀÏÀÎÁö¸¦ ÆÇ´Ü if (!ReadFile(hFile, &tpfh, sizeof(TEXPIAFILEHEADER), &dwRead, NULL)) goto fail; // if (tpfh.Version.Number == 241) {// Vector¸¸ SaveµÈ ÆÄÀÏ - 240 ¹öÀü tfc·Î ¹Ù²ñ - by monkman (2004.07.19) if (tpfh.Version.Number >= 240) { if (!ReadFile(hFile, &useColor, sizeof(Word), &dwRead, NULL)) goto fail; spalette->UseColor = useColor; if (tpfh.Version.Number == 240) spalette->LoadFromFileHandle(hFile, 1); else spalette->LoadFromFileHandle(hFile, 2); if (!ReadFile(hFile, &BitCount, sizeof(WORD), &dwRead, NULL)) goto fail; if (SetFilePointer(hFile, BitCount==8 ? 8000 : 24000, NULL, FILE_CURRENT)== 0xFFFFFFFF) goto fail; if (tpfh.Version.Number < 303){ if ((bgTexpia = new TTexpiaBitmap) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (!bgTexpia->Create(tpfh.CanvasInfor.Width, tpfh.CanvasInfor.Height, tpfh.BitsPerPixel)) goto fail; // ¹è°æ ºñÆ®¸ÊÀ» Àбâ À§ÇØ - by monkman (2004.07.19) if (!bgTexpia->LoadFromTexpiaFile(hFile, tpfh.Compress)) goto fail; // ¹è°æ ºñÆ®¸ÊÀ» Àбâ À§ÇØ - by monkman (2004.07.19) } else { if ((bgUnion = new TUnionBitmap) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (!bgUnion->Create(tpfh.CanvasInfor.Width, tpfh.CanvasInfor.Height, tpfh.BitsPerPixel)) goto fail; // ¹è°æ ºñÆ®¸ÊÀ» Àбâ À§ÇØ - by monkman (2004.07.19) if (!bgUnion->LoadFromTexpiaFile(hFile, tpfh.Compress)) goto fail; // ¹è°æ ºñÆ®¸ÊÀ» Àбâ À§ÇØ - by monkman (2004.07.19) } if (!ReadFile(hFile, &layer, sizeof(bool), &dwRead, NULL)) goto fail; if (!ReadFile(hFile, &vector, sizeof(bool), &dwRead, NULL)) goto fail; if (vector) VecDraw->InitMerge(hFile, 0, mirror, true); }else { // ÀÏ¹Ý ÆÄÀÏ (ºñÆ®¸Êµµ Àоî¿Â´Ù) // ÆÄÀÏ Çì´õºÎÅÍ ´Ù½Ã Àоî¾ß ÇÏ´Ï Æ÷ÀÎÅÍ µ¹·Á³õ´Â´Ù if ((bgTexpia = new TTexpiaBitmap) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (SetFilePointer(hFile, 0, NULL, FILE_BEGIN)==0xFFFFFFFF) goto fail; if ((ec = LoadFromTexpiaFile(hFile, spalette, tpfh, bgTexpia, FindExtension(ext)))!=EC_NONE) goto fail; if (!ReadFile(hFile, &layer, sizeof(bool), &dwRead, NULL)) goto fail; if (!ReadFile(hFile, &vector, sizeof(bool), &dwRead, NULL)) goto fail; if (vector) VecDraw->InitMerge(hFile, 0, mirror, true); } CloseHandle(hFile); if (spalette) { delete spalette; spalette = NULL; } if (bgTexpia) { delete bgTexpia; bgTexpia = NULL; } if (bgUnion) { delete bgUnion; bgUnion = NULL; } return; fail: if (spalette) { delete spalette; spalette = NULL; } if (bgTexpia) { delete bgTexpia; bgTexpia = NULL; } if (bgUnion) { delete bgUnion; bgUnion = NULL; } } //--------------------------------------------------------------------------- void __fastcall TDetailForm::LoadStyleToMainImage(String path) { HANDLE hFile = INVALID_HANDLE_VALUE; DWORD dwRead; STYLEDATAFILEHEADER header; int ec = EC_NONE; int width; double thick = 0; RECT range = Rect(50000, 50000, 0, 0); TVecData *data; int existindex, existcount, index; bool sw = !bReplace; int Version; BYTE *StyleData = NULL; DWORD dwPos; DWORD dwDataSize; int srcMaxGroupIndex = 0; existcount = VecDraw->NVector->DataList->Count; if (VecDraw->NVector->bMergeMode) VecDraw->DeleteVectorObject(false); VecDraw->deSelect(); VecDraw->NVector->bMergeMode = true; VecDraw->NVector->bSelected = true; if (VecDraw->SpreadStep) {VecDraw->SpreadStep = 0; MainImageForm->iMainImage->Repaint(); } // *.sty ÆÄÀÏÀ» ¹öÀü º°·Î ÀÐ°í º¯È¯ÇÑ´Ù - by monkman (2004.03.30) if ((hFile = CreateFile(path.c_str(),GENERIC_READ, 0, NULL, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) { ec = EC_MEMORY_LACK; goto fail; } header = VecDraw->ReadSTYFileHeader(hFile, path, &Version, true); if (!((100 <= Version && Version <= STYSTIFileVersion) || (500 <= Version && Version <= (STYSTIFileVersion+300)))) { // »óÀ§ ¹öÀü üũ - by monkman (2009.05.26) MessageDlg(IDS_MESSAGE_NEWERVERSIONFILE, mtInformation, TMsgDlgButtons() << mbOK, 0); goto fail; } // Version¿¡ µû¶ó ÇØ¾ßÇÒ ÀÛ¾÷ÀÌ ÀÖ´Ù¸é ÀÌ °÷¿¡¼­ ÇÑ´Ù - by monkman (2004.11.03) if (500 <= Version) { #ifndef NOT_STYLEDATA_LOCK // HASP°ú üũ ÇÑ´Ù if (!VecDraw->CheckSTYLock(hFile, header)) goto fail; #endif } if (Version == 0 || Version == 100) { // Version 100 ÀÏ °æ¿ì ¸ø Àд ¿¡·¯·Î ±ä±ÞÃß°¡ - by monkman (2005.06.10) dwDataSize = GetFileSize(hFile, NULL) - sizeof(OLDSTYLEDATAFILEHEADER); } else { dwDataSize = GetFileSize(hFile, NULL) - sizeof(STYLEDATAFILEHEADER); } if ((StyleData = (BYTE *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwDataSize))==NULL) goto fail; // ÆÄÀÏÅ©±â¸¸Å­ ¸Þ¸ð¸® ÇÒ´ç VecDraw->ReadSTYFileData(hFile, Version, StyleData, header); dwPos = 0; for (int i = 0; i < header.Count1; i++) { if ((data = new TVecData(MainImageForm->Number))==NULL) goto fail; VecDraw->LoadFromSTYMemory(&StyleData, &dwPos, data, Version); data->bSelected = false; VecDraw->NVector->DataList->Add(data); VecDraw->UndoSave(VU_CREATE, VecDraw->NVector->DataList->Count-1, sw); sw = false; thick = max(thick, data->PenThick); range.left = min(range.left, min(data->First.x, data->Second.x)); range.right = max(range.right, max(data->First.x, data->Second.x)); range.top = min(range.top, min(data->First.y, data->Second.y)); range.bottom = max(range.bottom, max(data->First.y, data->Second.y)); } width = range.right - range.left; for (int i = existcount; i < VecDraw->NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if (data->Kind == V_LINE || data->Kind == V_CURVE) { for (int j = 0; j < data->nCount*3+1; j++) { data->pList[j].x -= range.left; data->pList[j].y -= range.top; } } else if (data->Kind == V_TEXTBOX && !data->ListOfAllLine->CurveData) { //07.3.20 by maxleo21c for (int j = 0; j < 5; j++) { data->pList[j].x -= range.left; data->pList[j].y -= range.top; } } // V_TEXTBOXÀÏ °æ¿ì¿¡´Â ó¸®ÇÏ¸é ¾ÈµÈ´Ù. 07.3.20 by maxleo21c if (mirror && data->Kind != V_TEXTBOX) { // ¹Ì·¯ÀÎ °æ¿ì int tempx = data->First.x; data->First.x = width - data->Second.x; data->Second.x = width - tempx; if (data->Kind == V_CURVE || data->Kind == V_LINE) for (int j = 0; j < data->nCount*3 +1; j++) data->pList[j].x = width - data->pList[j].x; } SET_RECT; } if (StyleData) { HeapFree(GetProcessHeap(), 0, StyleData); // ¸Þ¸ð¸® ÇØÁ¦ StyleData = NULL; } CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; VecDraw->PasteRange = range; VecDraw->MaxThick = thick; /* for (int i = 0; i < existcount; i++) { // GroupIndex ¸ÂÃçÁÖ±â data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if (!data->Equal(MainImageForm->Number)) continue; if (!data->GroupIndex) continue; existindex |= data->GroupIndex; } for (int k = 10; k < 32; k++) { // µé¾î°¥ GroupindexÁöÁ¤ for (int i = 10; i < 32; i++) { if (existindex & (1 << i)) continue; index = i; break; } for (int i = existcount; i < VecDraw->NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if (!data->Equal(MainImageForm->Number)) continue; if (data->bSelected) continue; // ÀÌ¹Ì Çѹø ÁöÁ¤µÇ¾îÀÖ´Â °æ¿ì´Â º¸³½´Ù if (!(data->GroupIndex & (1<GroupIndex &= 0x000001ff; data->GroupIndex += 1<bSelected = true; existindex |= 1<NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if(srcMaxGroupIndex < data->GroupIndex / 10000) srcMaxGroupIndex = data->GroupIndex / 10000; } for(int k = 1; k <= srcMaxGroupIndex ; k++) { bool sw = true; for(int i = existcount; i < VecDraw->NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if(!data->Equal(MainImageForm->Number)) continue; if(data->bSelected) continue; if(data->GroupIndex / 10000 != k) continue; if(sw) { MainImageForm->GroupIndexState += 10000; sw = false; } data->GroupIndex = ((data->GroupIndex % 10000) & 0x000001ff) + MainImageForm->GroupIndexState; data->bSelected = true; } } ///// for (int i = existcount; i < VecDraw->NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; data->bSelected = true; // MergeÀΰæ¿ì´Â ¼±ÅÃÀÌ µÈ»óÅ·Π»ý¼º } return; fail: if (StyleData) { HeapFree(GetProcessHeap(), 0, StyleData); // ¸Þ¸ð¸® ÇØÁ¦ StyleData = NULL; } CloseHandle(hFile); return; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::SpreadToMainImage(String path) { TEXPIAFILEHEADER tpfh; RGBQUAD rgb[256]; TPalette *spalette = NULL; TTexpiaBitmap *bgTexpia = NULL; // ¹è°æ ºñÆ®¸ÊÀ» Àбâ À§ÇØ - by monkman (2004.07.19) TUnionBitmap *bgUnion = NULL; // ¹è°æ ºñÆ®¸ÊÀ» Àбâ À§ÇØ - by monkman (2010.04.07) int ec = EC_NONE; HANDLE hFile = INVALID_HANDLE_VALUE; DWORD dwRead; int Version, count; double MaxThick = 0; bool vector, layer; WORD BitCount; TVecData *data = NULL, *childdata = NULL; RECT range = Rect(50000, 50000, 0, 0); TRect rect; WORD useColor; // TEXTBOX ¼öÁ¤½Ã ÀÌ ºÎºÐÀ» ¼öÁ¤ - by monkman // int linecount, wordcount, lineheight; // TSWordData *srcWordData; String ext; if (VecDraw->CopyList) { while (VecDraw->CopyList->Count) { data = (TVecData *)VecDraw->CopyList->First(); delete data; VecDraw->CopyList->Remove(data); } } try { if ((spalette = new TPalette)==NULL) { ec = EC_MEMORY_LACK; goto fail; } ext = ExtractFileExt(path); ext = ext.LowerCase(); if ((hFile = CreateFile(path.c_str(),GENERIC_READ, 0, NULL, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) { ec = EC_MEMORY_LACK; goto fail; } if (!ReadFile(hFile, &tpfh, sizeof(TEXPIAFILEHEADER), &dwRead, NULL)) goto fail; // if (tpfh.Version.Number == 241) {// Vector¸¸ SaveµÈ ÆÄÀÏ - 240 ¹öÀü tfc·Î ¹Ù²ñ - by monkman (2004.07.19) if (tpfh.Version.Number >= 240) { if (!ReadFile(hFile, &useColor, sizeof(Word), &dwRead, NULL)) goto fail; spalette->UseColor = useColor; if (tpfh.Version.Number == 240) spalette->LoadFromFileHandle(hFile, 1); else spalette->LoadFromFileHandle(hFile, 2); if (!ReadFile(hFile, &BitCount, sizeof(WORD), &dwRead, NULL)) goto fail; if (SetFilePointer(hFile, BitCount==8 ? 8000 : 24000, NULL, FILE_CURRENT)== 0xFFFFFFFF) goto fail; if (tpfh.Version.Number < 303){ if ((bgTexpia = new TTexpiaBitmap) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (!bgTexpia->Create(tpfh.CanvasInfor.Width, tpfh.CanvasInfor.Height, tpfh.BitsPerPixel)) goto fail; // ¹è°æ ºñÆ®¸ÊÀ» Àбâ À§ÇØ - by monkman (2004.07.19) if (!bgTexpia->LoadFromTexpiaFile(hFile, tpfh.Compress)) goto fail; // ¹è°æ ºñÆ®¸ÊÀ» Àбâ À§ÇØ - by monkman (2004.07.19) } else { if ((bgUnion = new TUnionBitmap) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if (!bgUnion->Create(tpfh.CanvasInfor.Width, tpfh.CanvasInfor.Height, tpfh.BitsPerPixel)) goto fail; // ¹è°æ ºñÆ®¸ÊÀ» Àбâ À§ÇØ - by monkman (2004.07.19) if (!bgUnion->LoadFromTexpiaFile(hFile, tpfh.Compress)) goto fail; // ¹è°æ ºñÆ®¸ÊÀ» Àбâ À§ÇØ - by monkman (2004.07.19) } if (!ReadFile(hFile, &layer, sizeof(bool), &dwRead, NULL)) goto fail; if (!ReadFile(hFile, &vector, sizeof(bool), &dwRead, NULL)) goto fail; }else { // ÀÏ¹Ý ÆÄÀÏ (ºñÆ®¸Êµµ Àоî¿Â´Ù) // ÆÄÀÏ Çì´õºÎÅÍ ´Ù½Ã Àоî¾ß ÇÏ´Ï Æ÷ÀÎÅÍ µ¹·Á³õ´Â´Ù if (SetFilePointer(hFile, 0, NULL, FILE_BEGIN)==0xFFFFFFFF) goto fail; if ((bgTexpia = new TTexpiaBitmap) == NULL) { ec = EC_MEMORY_LACK; goto fail; } if ((ec = LoadFromTexpiaFile(hFile, spalette, tpfh, bgTexpia, FindExtension(ext)))!=EC_NONE) goto fail; if (!ReadFile(hFile, &layer, sizeof(bool), &dwRead, NULL)) goto fail; if (!ReadFile(hFile, &vector, sizeof(bool), &dwRead, NULL)) goto fail; } // Vector Motive Ãß°¡·Î º¯°æµÈ ºÎºÐ - by monkman (2009.05.08) VecDraw->LoadFromFile(hFile, VecDraw->CopyList); for (int i = 0; i < VecDraw->CopyList->Count; i++) { data = (TVecData *)VecDraw->CopyList->Items[i]; MaxThick = max(MaxThick, data->PenThick+1); range.left = min(range.left, min(data->First.x, data->Second.x)); range.right = max(range.right, max(data->First.x, data->Second.x)); range.top = min(range.top, min(data->First.y, data->Second.y)); range.bottom = max(range.bottom, max(data->First.y, data->Second.y)); if (data->bMotive) { for (int j = 0; j < data->ChildList->Count; j++) { childdata = (TVecData *)data->ChildList->Items[j]; MaxThick = max(MaxThick, childdata->PenThick+1); } VecDraw->GetRectForMouseMove(data, rect); range.top = range.top - rect.Height()/2; range.left = range.left - rect.Width()/2; range.bottom = range.bottom + rect.Height()/2; range.right = range.right + rect.Width()/2; } } CloseHandle(hFile); VecDraw->SpreadStep = 1; VecDraw->PasteRange = range; VecDraw->MaxThick = MaxThick; if (spalette) { delete spalette; spalette = NULL; } if (bgTexpia) { delete bgTexpia; bgTexpia = NULL; } // bitmapÀº ÇÊ¿ä ¾ø´Ù if (bgUnion) { delete bgUnion; bgUnion = NULL; } // bitmapÀº ÇÊ¿ä ¾ø´Ù return; } catch (...) { // fail¿¡¼­ ó¸®Çϱ⠶§¹®¿¡ À̺κп¡ ³ÖÀ» ÇÊ¿ä´Â ¾ø´Ù. 07.3.22 CloseHandle(hFile); if (VecDraw->CopyList) { while (VecDraw->CopyList->Count) { data = (TVecData *)VecDraw->CopyList->First(); delete data; VecDraw->CopyList->Remove(data); } } //ÇØ´çÆÄÀÏ¿¡ ¹®Á¦°¡ ÀÖ¾î ÆÄÀÏÀ» ¿­¼ö ¾ø½À´Ï´Ù. Application->MessageBox(IDS_ERR_MSG_1.c_str(), L"Information", MB_OK); } fail: if (spalette) { delete spalette; spalette = NULL; } if (bgTexpia) { delete bgTexpia; bgTexpia = NULL; } // bitmapÀº ÇÊ¿ä ¾ø´Ù if (bgUnion) { delete bgUnion; bgUnion = NULL; } // bitmapÀº ÇÊ¿ä ¾ø´Ù VecDraw->SpreadStep = 0; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::LoadSleeveCollar(String path, bool bsleeve) { HANDLE hFile = INVALID_HANDLE_VALUE; STYLEDATAFILEHEADER header; PSTYLEDATAFILEHEADER pheader, pheader2; DWORD dwRead; TVecData *data, *temp; // bool sw = true; bool sw = false; int existindex, existcount, index; int Version; BYTE *StyleData = NULL; DWORD dwPos; DWORD dwDataSize; double ColLength1, ColLength2, BColLength1, BColLength2; DPOINT FCenter, FSilSleLeftUp, FSilSleLeftUp1, // 1Àº Á¶ÀýÁ¡ FSilSleLeftDown, FSilSleLeftDown1, FSilSleRightUp, FSilSleRightUp1, FSilSleRightDown, FSilSleRightDown1, FSilColLeft, FSilColRight, FSilSleRightCen, FSilSleRightCen1, FSilSleRightCen2, FSilSleLeftCen, FSilSleLeftCen1, FSilSleLeftCen2, FRaglanLeft, FRaglanRight; DPOINT BCenter, BSilSleLeftUp, BSilSleLeftUp1, // 1Àº Á¶ÀýÁ¡ BSilSleLeftDown, BSilSleLeftDown1, BSilSleRightUp, BSilSleRightUp1, BSilSleRightDown, BSilSleRightDown1, BSilColLeft, BSilColRight, BSilSleRightCen, BSilSleRightCen1, BSilSleRightCen2, BSilSleLeftCen, BSilSleLeftCen1, BSilSleLeftCen2, BRaglanLeft, BRaglanRight; double slex1, sley1, slex2, sley2, revx; // 1: ¿À¸¥ÂÊ ½½¸®ºê 2: »õ·Î »ý¼ºµÇ´Â ¿ÞÂÊ ½½¸®ºê, revx:¹ÝÀüº¹»ç ±âÁØ XÁÂÇ¥ double Bslex1, Bsley1, Bslex2, Bsley2, Brevx; // µÞÆÇ DPOINT FColLeft, FColRight, BColLeft, BColRight; double colx, coly, ratio, Bcolx, Bcoly, Bratio; int srcMaxGroupIndex = 0; FRaglanLeft.DPoint(0,0); FRaglanRight.DPoint(0,0); BRaglanLeft.DPoint(0,0); BRaglanRight.DPoint(0,0); if (CopyFrontList) { while (CopyFrontList->Count) { data = (TVecData *)CopyFrontList->First(); delete data; CopyFrontList->Remove(data); } } if (CopyBackList) { while (CopyBackList->Count) { data = (TVecData *)CopyBackList->First(); delete data; CopyBackList->Remove(data); } } // *.sty ÆÄÀÏÀ» ¹öÀü º°·Î ÀÐ°í º¯È¯ÇÑ´Ù - by monkman (2004.03.30) if ((hFile = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto fail; header = VecDraw->ReadSTYFileHeader(hFile, path, &Version, true); if (!((100 <= Version && Version <= STYSTIFileVersion) || (500 <= Version && Version <= (STYSTIFileVersion+300)))) { // »óÀ§ ¹öÀü üũ - by monkman (2009.05.26) MessageDlg(IDS_MESSAGE_NEWERVERSIONFILE, mtInformation, TMsgDlgButtons() << mbOK, 0); goto fail; } if (500 <= Version) { #ifndef NOT_STYLEDATA_LOCK // HASP°ú üũ ÇÑ´Ù if (!VecDraw->CheckSTYLock(hFile, header)) goto fail; #endif } if (Version == 0 || Version == 100) { // Version 100 ÀÏ °æ¿ì ¸ø Àд ¿¡·¯·Î ±ä±ÞÃß°¡ - by monkman (2005.06.10) dwDataSize = GetFileSize(hFile, NULL) - sizeof(OLDSTYLEDATAFILEHEADER); } else { dwDataSize = GetFileSize(hFile, NULL) - sizeof(STYLEDATAFILEHEADER); } if ((StyleData = (BYTE *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwDataSize))==NULL) goto fail; // ÆÄÀÏÅ©±â¸¸Å­ ¸Þ¸ð¸® ÇÒ´ç VecDraw->ReadSTYFileData(hFile, Version, StyleData, header); dwPos = 0; for (int j = 0; j < header.Count1; j++) { if ((data = new TVecData(0))==NULL) goto fail; VecDraw->LoadFromSTYMemory(&StyleData, &dwPos, data, Version); CopyFrontList->Add(data); } for (int j = 0; j < header.Count2; j++) { if ((data = new TVecData(0))==NULL) goto fail; VecDraw->LoadFromSTYMemory(&StyleData, &dwPos, data, Version); CopyBackList->Add(data); } if (StyleData) { HeapFree(GetProcessHeap(), 0, StyleData); // ¸Þ¸ð¸® ÇØÁ¦ StyleData = NULL; } CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; pheader = (PSTYLEDATAFILEHEADER) MainImageForm->StyleHeader->Items[abs(Number)-1]; pheader2 = &header; /////////===========Style °Å¸£±â #ifndef WORKSHEET if ((pheader->EMethod == DH_RAGLAN || pheader->EMethod == DH_3POINTS) && pheader2->ESleeve != DS_RAGLAN) goto fail2; if ((pheader->EMethod != DH_RAGLAN && pheader->EMethod != DH_3POINTS) && pheader2->ESleeve == DS_RAGLAN) goto fail2; #endif if (Number > 0) { // ¾ÕÆÇÀÇ °æ¿ì //================ ¾ÕÆÇ silhouetteÀÇ data ã±â for (int j = 0; j < VecDraw->NVector->DataList->Count; j++) { // center, trait ã±â temp = (TVecData *) VecDraw->NVector->DataList->Items[j]; if (!temp->Equal(MainImageForm->Number)) continue; if (temp->HeaderNumber != Number) continue; if (temp->TraitSet.Contains(SIL_CENTER)) { FCenter = temp->pList[pheader->TraitFrontNumber[SIL_CENTER]]; } if (temp->TraitSet.Contains(SIL_SLEEVELEFT1)) { int num1 = pheader->TraitFrontNumber[SIL_SLEEVELEFT1]; int num2 = pheader->TraitFrontNumber[SIL_SLEEVELEFT2]; FSilSleLeftUp = temp->pList[num1]; if (num1 > num2) FSilSleLeftUp1 = temp->pList[(num1-num2)<9 ? num1-1 : num1+1]; else FSilSleLeftUp1 = temp->pList[(num2-num1)<9 ? num1+1 : temp->nCount*3-1]; } if (temp->TraitSet.Contains(SIL_SLEEVELEFT2)) { int num1 = pheader->TraitFrontNumber[SIL_SLEEVELEFT1]; int num2 = pheader->TraitFrontNumber[SIL_SLEEVELEFT2]; FSilSleLeftDown = temp->pList[num2]; if (num2 > num1) FSilSleLeftDown1 = temp->pList[(num2-num1)<9 ? num2-1 : num2+1]; else FSilSleLeftDown1 = temp->pList[(num1-num2)<9 ? num2+1 : temp->nCount*3-1]; } if (temp->TraitSet.Contains(SIL_SLEEVELEFT3)) { int num = pheader->TraitFrontNumber[SIL_SLEEVELEFT3]; FSilSleLeftCen = temp->pList[num]; if (num > pheader->TraitFrontNumber[SIL_SLEEVELEFT1]) { FSilSleLeftCen1 = temp->pList[num != 0 ? num-1 : temp->nCount*3-1]; FSilSleLeftCen2 = temp->pList[num != temp->nCount*3 ? num+1 : 1]; }else { FSilSleLeftCen1 = temp->pList[num != temp->nCount*3 ? num+1 : 1]; FSilSleLeftCen2 = temp->pList[num != 0 ? num-1 : temp->nCount*3-1]; } } if (temp->TraitSet.Contains(SIL_SLEEVERIGHT1)) { int num1 = pheader->TraitFrontNumber[SIL_SLEEVERIGHT1]; int num2 = pheader->TraitFrontNumber[SIL_SLEEVERIGHT2]; FSilSleRightUp = temp->pList[num1]; if (num1 > num2) FSilSleRightUp1 = temp->pList[(num1-num2)<9 ? num1-1 : num1+1]; else FSilSleRightUp1 = temp->pList[(num2-num1)<9 ? num1+1 : temp->nCount*3-1]; } if (temp->TraitSet.Contains(SIL_SLEEVERIGHT2)) { int num1 = pheader->TraitFrontNumber[SIL_SLEEVERIGHT1]; int num2 = pheader->TraitFrontNumber[SIL_SLEEVERIGHT2]; FSilSleRightDown = temp->pList[num2]; if (num2 > num1) FSilSleRightDown1 = temp->pList[(num2-num1)<9 ? num2-1 : num2+1]; else FSilSleRightDown1 = temp->pList[(num1-num2)<9 ? num2+1 : temp->nCount*3-1]; } if (temp->TraitSet.Contains(SIL_SLEEVERIGHT3)) { int num = pheader->TraitFrontNumber[SIL_SLEEVERIGHT3]; FSilSleRightCen = temp->pList[num]; if (num > pheader->TraitFrontNumber[SIL_SLEEVERIGHT1]) { FSilSleRightCen1 = temp->pList[num != 0 ? num-1 : temp->nCount*3-1]; FSilSleRightCen2 = temp->pList[num != temp->nCount*3 ? num+1 : 1]; }else { FSilSleRightCen1 = temp->pList[num != temp->nCount*3 ? num+1 : 1]; FSilSleRightCen2 = temp->pList[num != 0 ? num-1 : temp->nCount*3-1]; } } if (temp->TraitSet.Contains(SIL_COLLARLEFT)) { FSilColLeft = temp->pList[pheader->TraitFrontNumber[SIL_COLLARLEFT]]; #ifndef WORKSHEET if (pheader->EMethod == DH_RAGLAN && pheader2->ESleeve == DS_RAGLAN) temp->TraitSet >> SIL_COLLARLEFT; // Raglan ¼Ò¸ÅÀÇ °æ¿ì sil_collar°¡ ¼Ò¸ÅÀÇ ±âÁØÁ¡À¸·Î ´Ù½Ã ÁöÁ¤µÈ´Ù #else // ÀÛ¾÷Áö½Ã¼­ ¶§¹®¿¡ DS_RAGLANÀÌ ¾ø´Ù - by monkman (2011.01.11) if (pheader->EMethod == DH_RAGLAN/* && pheader2->ESleeve == DS_RAGLAN*/) temp->TraitSet >> SIL_COLLARLEFT; // Raglan ¼Ò¸ÅÀÇ °æ¿ì sil_collar°¡ ¼Ò¸ÅÀÇ ±âÁØÁ¡À¸·Î ´Ù½Ã ÁöÁ¤µÈ´Ù #endif } if (temp->TraitSet.Contains(SIL_COLLARRIGHT)) { FSilColRight = temp->pList[pheader->TraitFrontNumber[SIL_COLLARRIGHT]]; #ifndef WORKSHEET if (pheader->EMethod == DH_RAGLAN && pheader2->ESleeve == DS_RAGLAN) temp->TraitSet >> SIL_COLLARLEFT; // Raglan ¼Ò¸ÅÀÇ °æ¿ì sil_collar°¡ ¼Ò¸ÅÀÇ ±âÁØÁ¡À¸·Î ´Ù½Ã ÁöÁ¤µÈ´Ù #else // ÀÛ¾÷Áö½Ã¼­ ¶§¹®¿¡ DS_RAGLANÀÌ ¾ø´Ù - by monkman (2011.01.11) if (pheader->EMethod == DH_RAGLAN/* && pheader2->ESleeve == DS_RAGLAN*/) temp->TraitSet >> SIL_COLLARLEFT; // Raglan ¼Ò¸ÅÀÇ °æ¿ì sil_collar°¡ ¼Ò¸ÅÀÇ ±âÁØÁ¡À¸·Î ´Ù½Ã ÁöÁ¤µÈ´Ù #endif } // if (temp->TraitSet.Contains(SLE_COLLAR)) { // ½½¸®ºê Ä®¶ó µé¾î°¥Á¡ (raglan¿ë) // if (FRaglanRight.x || FRaglanRight.y) FRaglanLeft = temp->pList[pheader2->TraitFrontNumber[SLE_COLLAR]]; // else FRaglanRight = temp->pList[pheader2->TraitFrontNumber[SLE_COLLAR]]; // } } /* if (pheader->EMethod == DH_RAGLAN) { if (FRaglanRight.x < FRaglanLeft.x) { BRaglanRight = FRaglanRight; FRaglanRight = FRaglanLeft; FRaglanLeft = BRaglanRight; } FSilColRight = FRaglanRight; FSilColLeft = FRaglanLeft; } */ ColLength1 = sqrt((FSilColRight.x-FSilColLeft.x)*(FSilColRight.x-FSilColLeft.x)+(FSilColRight.y-FSilColLeft.y)*(FSilColRight.y-FSilColLeft.y)); }else { //================ µÞÆÇ silhouetteÀÇ data ã±â for (int j = 0; j < VecDraw->NVector->DataList->Count; j++) { // center, trait ã±â temp = (TVecData *) VecDraw->NVector->DataList->Items[j]; if (!temp->Equal(MainImageForm->Number)) continue; if (temp->HeaderNumber != Number) continue; if (temp->TraitSet.Contains(SIL_CENTER)) { BCenter = temp->pList[pheader->TraitBackNumber[SIL_CENTER]]; } if (temp->TraitSet.Contains(SIL_SLEEVELEFT1)) { int num1 = pheader->TraitBackNumber[SIL_SLEEVELEFT1]; int num2 = pheader->TraitBackNumber[SIL_SLEEVELEFT2]; BSilSleLeftUp = temp->pList[num1]; if (num1 > num2) BSilSleLeftUp1 = temp->pList[(num1-num2)<9 ? num1-1 : num1+1]; else BSilSleLeftUp1 = temp->pList[(num2-num1)<9 ? num1+1 : temp->nCount*3-1]; } if (temp->TraitSet.Contains(SIL_SLEEVELEFT2)) { int num1 = pheader->TraitBackNumber[SIL_SLEEVELEFT1]; int num2 = pheader->TraitBackNumber[SIL_SLEEVELEFT2]; BSilSleLeftDown = temp->pList[num2]; if (num2 > num1) BSilSleLeftDown1 = temp->pList[(num2-num1)<9 ? num2-1 : num2+1]; else BSilSleLeftDown1 = temp->pList[(num1-num2)<9 ? num2+1 : temp->nCount*3-1]; } if (temp->TraitSet.Contains(SIL_SLEEVELEFT3)) { int num = pheader->TraitFrontNumber[SIL_SLEEVELEFT3]; BSilSleLeftCen = temp->pList[num]; if (num > pheader->TraitFrontNumber[SIL_SLEEVELEFT1]) { BSilSleLeftCen1 = temp->pList[num != 0 ? num-1 : temp->nCount*3-1]; BSilSleLeftCen2 = temp->pList[num != temp->nCount*3 ? num+1 : 1]; }else { BSilSleLeftCen1 = temp->pList[num != temp->nCount*3 ? num+1 : 1]; BSilSleLeftCen2 = temp->pList[num != 0 ? num-1 : temp->nCount*3-1]; } } if (temp->TraitSet.Contains(SIL_SLEEVERIGHT1)) { int num1 = pheader->TraitBackNumber[SIL_SLEEVERIGHT1]; int num2 = pheader->TraitBackNumber[SIL_SLEEVERIGHT2]; BSilSleRightUp = temp->pList[num1]; if (num1 > num2) BSilSleRightUp1 = temp->pList[(num1-num2)<9 ? num1-1 : num1+1]; else BSilSleRightUp1 = temp->pList[(num2-num1)<9 ? num1+1 : temp->nCount*3-1]; } if (temp->TraitSet.Contains(SIL_SLEEVERIGHT2)) { int num1 = pheader->TraitBackNumber[SIL_SLEEVERIGHT1]; int num2 = pheader->TraitBackNumber[SIL_SLEEVERIGHT2]; BSilSleRightDown = temp->pList[num2]; if (num2 > num1) BSilSleRightDown1 = temp->pList[(num2-num1)<9 ? num2-1 : num2+1]; else BSilSleRightDown1 = temp->pList[(num1-num2)<9 ? num2+1 : temp->nCount*3-1]; } if (temp->TraitSet.Contains(SIL_SLEEVERIGHT3)) { int num = pheader->TraitFrontNumber[SIL_SLEEVERIGHT3]; BSilSleRightCen = temp->pList[num]; if (num > pheader->TraitFrontNumber[SIL_SLEEVERIGHT1]) { BSilSleRightCen1 = temp->pList[num != 0 ? num-1 : temp->nCount*3-1]; BSilSleRightCen2 = temp->pList[num != temp->nCount*3 ? num+1 : 1]; }else { BSilSleRightCen1 = temp->pList[num != temp->nCount*3 ? num+1 : 1]; BSilSleRightCen2 = temp->pList[num != 0 ? num-1 : temp->nCount*3-1]; } } if (temp->TraitSet.Contains(SIL_COLLARLEFT)) { BSilColLeft = temp->pList[pheader->TraitBackNumber[SIL_COLLARLEFT]]; // ÀÏ´Ü ÁÖ¼® ó¸® - by monkman (2011.01,11) if (pheader->EMethod == DH_RAGLAN/* && pheader2->ESleeve == DS_RAGLAN*/) temp->TraitSet >> SIL_COLLARLEFT; // Raglan ¼Ò¸ÅÀÇ °æ¿ì sil_collar°¡ ¼Ò¸ÅÀÇ ±âÁØÁ¡À¸·Î ´Ù½Ã ÁöÁ¤µÈ´Ù } if (temp->TraitSet.Contains(SIL_COLLARRIGHT)) { BSilColRight = temp->pList[pheader->TraitBackNumber[SIL_COLLARRIGHT]]; #ifndef WORKSHEET if (pheader->EMethod == DH_RAGLAN && pheader2->ESleeve == DS_RAGLAN) temp->TraitSet >> SIL_COLLARLEFT; // Raglan ¼Ò¸ÅÀÇ °æ¿ì sil_collar°¡ ¼Ò¸ÅÀÇ ±âÁØÁ¡À¸·Î ´Ù½Ã ÁöÁ¤µÈ´Ù #else // ÀÛ¾÷Áö½Ã¼­ ¶§¹®¿¡ DS_RAGLANÀÌ ¾ø´Ù - by monkman (2011.01.11) if (pheader->EMethod == DH_RAGLAN/* && pheader2->ESleeve == DS_RAGLAN*/) temp->TraitSet >> SIL_COLLARLEFT; // Raglan ¼Ò¸ÅÀÇ °æ¿ì sil_collar°¡ ¼Ò¸ÅÀÇ ±âÁØÁ¡À¸·Î ´Ù½Ã ÁöÁ¤µÈ´Ù #endif } // if (temp->TraitSet.Contains(SLE_COLLAR)) { // ½½¸®ºê Ä®¶ó µé¾î°¥Á¡ (raglan¿ë) // if (BRaglanRight.x || BRaglanRight.y) BRaglanLeft = temp->pList[pheader2->TraitFrontNumber[SLE_COLLAR]]; // else BRaglanRight = temp->pList[pheader2->TraitFrontNumber[SLE_COLLAR]]; // } } /* if (pheader->EMethod == DH_RAGLAN) { if (BRaglanRight.x < BRaglanLeft.x) { FRaglanRight = BRaglanRight; BRaglanRight = BRaglanLeft; BRaglanLeft = FRaglanRight; } BSilColRight = BRaglanRight; BSilColLeft = BRaglanLeft; } */ BColLength1 = sqrt((BSilColRight.x-BSilColLeft.x)*(BSilColRight.x-BSilColLeft.x)+(BSilColRight.y-BSilColLeft.y)*(BSilColRight.y-BSilColLeft.y)); } if (bReplace) VecDraw->DeleteVectorObject(true); existcount = VecDraw->NVector->DataList->Count; /* for (int i = 0; i < VecDraw->NVector->DataList->Count; i++) { // GroupIndex ¸ÂÃçÁÖ±â data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if (!data->Equal(MainImageForm->Number)) continue; if (!data->GroupIndex) continue; existindex |= data->GroupIndex; } */ // if (pheader->EMethod == DH_RAGLAN) // if (pheader2->ESleeve != DS_RAGLAN) continue; if (bsleeve) { //============= ½½¸®ºê µ¥ÀÌÅÍ Ã£±â if (Number > 0) { // ¾ÕÆÇÀÇ °æ¿ì for (int k = 0; k < CopyFrontList->Count; k++) { // ¾ÕÆÇ temp = (TVecData *) CopyFrontList->Items[k]; // if (!temp->Equal(j+1)) continue; if (temp->TraitSet.Contains(SLE_BASIS)) { slex1 = temp->pList[pheader2->TraitFrontNumber[SLE_BASIS]].x - FSilSleRightUp.x; sley1 = temp->pList[pheader2->TraitFrontNumber[SLE_BASIS]].y - FSilSleRightUp.y; slex2 = temp->pList[pheader2->TraitFrontNumber[SLE_BASIS]].x - FSilSleLeftUp.x; sley2 = temp->pList[pheader2->TraitFrontNumber[SLE_BASIS]].y - FSilSleLeftUp.y; revx = temp->pList[pheader2->TraitFrontNumber[SLE_BASIS]].x; break; } } }else { for (int k = 0; k < CopyBackList->Count; k++) { // µÞÆÇ temp = (TVecData *) CopyBackList->Items[k]; // if (!temp->Equal(j+1)) continue; if (temp->TraitSet.Contains(SLE_BASIS)) { Bslex1 = temp->pList[pheader2->TraitBackNumber[SLE_BASIS]].x - BSilSleRightUp.x; Bsley1 = temp->pList[pheader2->TraitBackNumber[SLE_BASIS]].y - BSilSleRightUp.y; Bslex2 = temp->pList[pheader2->TraitBackNumber[SLE_BASIS]].x - BSilSleLeftUp.x; Bsley2 = temp->pList[pheader2->TraitBackNumber[SLE_BASIS]].y - BSilSleLeftUp.y; Brevx = temp->pList[pheader2->TraitBackNumber[SLE_BASIS]].x; break; } } } if (!mirror) { // ¿À¸¥ÂÊ ½½¸®ºê if (Number >0) { // ¾ÕÆÇ for (int l = 0; l < CopyFrontList->Count; l++) { int num1 = pheader2->TraitFrontNumber[SLE_BASIS], num2 = pheader2->TraitFrontNumber[SLE_ADJUST]; temp = (TVecData *) CopyFrontList->Items[l]; if ((data = new TVecData(MainImageForm->Number))==NULL) goto fail; data->Copy(temp); for (int m = 0; m < data->nCount*3+1; m++) { data->pList[m].x -= slex1; data->pList[m].y -= sley1; } if (data->TraitSet.Contains(SLE_BASIS)) { // ½½¸®ºê ±âÁØÁ¡ if ((num1>num2 && (num1-num2)==3) || (num1 == 0 && (num2-num1)!=3)) { //Á¶ÀýÁ¡ ¸ÂÃçÁÖ±â (¿ÀºêÁ§Æ® »ý¼º ¹æÇâ¿¡ µû¶ó ´Ù¸§) data->pList[num1 != 0 ? num1-1 : temp->nCount*3-1] = FSilSleRightUp1; }else { data->pList[num1 != temp->nCount*3 ? num1+1 : 1] = FSilSleRightUp1; } } if (temp->TraitSet.Contains(SLE_COLLAR)) { // ½½¸®ºê Ä®¶ó °¡ µé¾î°¡ ÀÖÀ¸¸é ½Ç·ç¿§ Ä®¶ó ±âÁØÁ¡À¸·Î º¯È¯½ÃÄÑÁØ´Ù temp->TraitSet << SIL_COLLARRIGHT; } if (data->TraitSet.Contains(SLE_ADJUST)) { // ½½¸®ºê Á¶ÀýÁ¡ data->pList[num2] = FSilSleRightDown; if (((num2>num1 && (num2-num1)==3) || (num2 == 0 && (num1-num2)!=3))) { data->pList[num2 != 0 ? num2-1 : temp->nCount*3-1] = FSilSleRightDown1; }else { data->pList[num2 != temp->nCount*3 ? num2+1 : 1] = FSilSleRightDown1; } /////////////////////// 3Points SilhouetteÀ϶§~ if (pheader->EMethod == DH_RAGLAN || pheader->EMethod == DH_3POINTS) { data->nCount++; data->pList = (DPOINT *)HeapReAlloc(GetProcessHeap(), 0, data->pList, sizeof(DPOINT)*(data->nCount*3+1)); data->pMask = (BYTE*)HeapReAlloc(GetProcessHeap(), 0, data->pMask, (data->nCount * 3 + 1) % 8 == 0 ? (data->nCount * 3 + 1) / 8 : (data->nCount * 3 + 1) / 8 + 1); HeapCompact(GetProcessHeap(), 0); if (abs(num1-num2) == 3) { if (num1 < num2) { for (int m = data->nCount*3 -3; m > num2-2; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num2+1] = FSilSleRightCen2; data->pList[num2] = FSilSleRightCen; data->pList[num2-1] = FSilSleRightCen1; }else { for (int m = data->nCount*3 -3; m > num1-2; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num1+1] = FSilSleRightCen1; data->pList[num1] = FSilSleRightCen; data->pList[num1-1] = FSilSleRightCen2; } }else { if (num1 < num2) { for (int m = data->nCount*3 -3; m > num2+1; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num2+3+1] = FSilSleRightCen1; data->pList[num2+3] = FSilSleRightCen; data->pList[num2+3-1] = FSilSleRightCen2; }else { for (int m = data->nCount*3 -3; m > num1+1; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num1+3+1] = FSilSleRightCen2; data->pList[num1+3] = FSilSleRightCen; data->pList[num1+3-1] = FSilSleRightCen1; } } } } SET_RECT; data->HeaderNumber = Number; VecDraw->NVector->DataList->Add(data); VecDraw->UndoSave(VU_CREATE, VecDraw->NVector->DataList->Count-1, sw); sw = false; } }else { // µÞÆÇ for (int l = 0; l < CopyBackList->Count; l++) { int num1 = pheader2->TraitBackNumber[SLE_BASIS], num2 = pheader2->TraitBackNumber[SLE_ADJUST]; temp = (TVecData *) CopyBackList->Items[l]; if ((data = new TVecData(MainImageForm->Number))==NULL) goto fail; data->Copy(temp); for (int m = 0; m < data->nCount*3+1; m++) { data->pList[m].x -= Bslex1; data->pList[m].y -= Bsley1; } if (data->TraitSet.Contains(SLE_BASIS)) { // ½½¸®ºê ±âÁØÁ¡ if ((num1>num2 && (num1-num2)==3) || (num1 == 0 && (num2-num1)!=3)) data->pList[num1 != 0 ? num1-1 : temp->nCount*3-1] = BSilSleRightUp1; else data->pList[num1 != temp->nCount*3 ? num1+1 : 1] = BSilSleRightUp1; } if (temp->TraitSet.Contains(SLE_COLLAR)) { // ½½¸®ºê Ä®¶ó °¡ µé¾î°¡ ÀÖÀ¸¸é ½Ç·ç¿§ Ä®¶ó ±âÁØÁ¡À¸·Î º¯È¯½ÃÄÑÁØ´Ù temp->TraitSet << SIL_COLLARRIGHT; } if (data->TraitSet.Contains(SLE_ADJUST)) { // ½½¸®ºê Á¶ÀýÁ¡ int num = pheader2->TraitBackNumber[SLE_ADJUST]; data->pList[num2] = BSilSleRightDown; if (((num2>num1 && (num2-num1)==3) || (num2 == 0 && (num1-num2)!=3))) data->pList[num2 != 0 ? num2-1 : temp->nCount*3-1] = BSilSleRightDown1; else data->pList[num2 != temp->nCount*3 ? num2+1 : 1] = BSilSleRightDown1; /////////////////////// 3Points SilhouetteÀ϶§~ if (pheader->EMethod == DH_RAGLAN || pheader->EMethod == DH_3POINTS) { data->nCount++; data->pList = (DPOINT *)HeapReAlloc(GetProcessHeap(), 0, data->pList, sizeof(DPOINT)*(data->nCount*3+1)); data->pMask = (BYTE*)HeapReAlloc(GetProcessHeap(), 0, data->pMask, (data->nCount * 3 + 1) % 8 == 0 ? (data->nCount * 3 + 1) / 8 : (data->nCount * 3 + 1) / 8 + 1); HeapCompact(GetProcessHeap(), 0); if (abs(num1-num2) == 3) { if (num1 < num2) { for (int m = data->nCount*3 -3; m > num2-2; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num2+1] = BSilSleRightCen2; data->pList[num2] = BSilSleRightCen; data->pList[num2-1] = BSilSleRightCen1; }else { for (int m = data->nCount*3 -3; m > num1-2; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num1+1] = BSilSleRightCen1; data->pList[num1] = BSilSleRightCen; data->pList[num1-1] = BSilSleRightCen2; } }else { if (num1 < num2) { for (int m = data->nCount*3 -3; m > num2+1; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num2+3+1] = BSilSleRightCen1; data->pList[num2+3] = BSilSleRightCen; data->pList[num2+3-1] = BSilSleRightCen2; }else { for (int m = data->nCount*3 -3; m > num1+1; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num1+3+1] = BSilSleRightCen2; data->pList[num1+3] = BSilSleRightCen; data->pList[num1+3-1] = BSilSleRightCen1; } } } } SET_RECT; data->HeaderNumber = Number; VecDraw->NVector->DataList->Add(data); VecDraw->UndoSave(VU_CREATE, VecDraw->NVector->DataList->Count-1, sw); sw = false; } } }else { // ¿ÞÂÊ ½½¸®ºê if (Number >0) { // ¾ÕÆÇ for (int l = 0; l < CopyFrontList->Count; l++) { int num1 = pheader2->TraitFrontNumber[SLE_BASIS], num2 = pheader2->TraitFrontNumber[SLE_ADJUST]; temp = (TVecData *) CopyFrontList->Items[l]; if ((data = new TVecData(MainImageForm->Number))==NULL) goto fail; data->Copy(temp); int tempx = data->First.x; for (int m = 0; m < data->nCount*3+1; m++) { data->pList[m].x = 2*revx - data->pList[m].x - slex2; data->pList[m].y -= sley2; } if (data->TraitSet.Contains(SLE_BASIS)) { // ½½¸®ºê ±âÁØÁ¡ if ((num1>num2 && (num1-num2)==3) || (num1 == 0 && (num2-num1)!=3)) data->pList[num1 != 0 ? num1-1 : temp->nCount*3-1] = FSilSleLeftUp1; else data->pList[num1 != temp->nCount*3 ? num1+1 : 1] = FSilSleLeftUp1; } if (temp->TraitSet.Contains(SLE_COLLAR)) { // ½½¸®ºê Ä®¶ó °¡ µé¾î°¡ ÀÖÀ¸¸é ½Ç·ç¿§ Ä®¶ó ±âÁØÁ¡À¸·Î º¯È¯½ÃÄÑÁØ´Ù temp->TraitSet << SIL_COLLARLEFT; } if (data->TraitSet.Contains(SLE_ADJUST)) { // ½½¸®ºê Á¶ÀýÁ¡ data->pList[num2] = FSilSleLeftDown; if (((num2>num1 && (num2-num1)==3) || (num2 == 0 && (num1-num2)!=3))) data->pList[num2 != 0 ? num2-1 : temp->nCount*3-1] = FSilSleLeftDown1; else data->pList[num2 != temp->nCount*3 ? num2+1 : 1] = FSilSleLeftDown1; /////////////////////// 3Points SilhouetteÀ϶§~ if (pheader->EMethod == DH_RAGLAN || pheader->EMethod == DH_3POINTS) { data->nCount++; data->pList = (DPOINT *)HeapReAlloc(GetProcessHeap(), 0, data->pList, sizeof(DPOINT)*(data->nCount*3+1)); data->pMask = (BYTE*)HeapReAlloc(GetProcessHeap(), 0, data->pMask, (data->nCount * 3 + 1) % 8 == 0 ? (data->nCount * 3 + 1) / 8 : (data->nCount * 3 + 1) / 8 + 1); HeapCompact(GetProcessHeap(), 0); if (abs(num1-num2) == 3) { if (num1 < num2) { for (int m = data->nCount*3 -3; m > num2-2; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num2+1] = FSilSleLeftCen2; data->pList[num2] = FSilSleLeftCen; data->pList[num2-1] = FSilSleLeftCen1; }else { for (int m = data->nCount*3 -3; m > num1-2; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num1+1] = FSilSleLeftCen1; data->pList[num1] = FSilSleLeftCen; data->pList[num1-1] = FSilSleLeftCen2; } }else { if (num1 < num2) { for (int m = data->nCount*3 -3; m > num2+1; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num2+3+1] = FSilSleLeftCen1; data->pList[num2+3] = FSilSleLeftCen; data->pList[num2+3-1] = FSilSleLeftCen2; }else { for (int m = data->nCount*3 -3; m > num1+1; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num1+3+1] = FSilSleLeftCen2; data->pList[num1+3] = FSilSleLeftCen; data->pList[num1+3-1] = FSilSleLeftCen1; } } } } SET_RECT; data->HeaderNumber = Number; VecDraw->NVector->DataList->Add(data); VecDraw->UndoSave(VU_CREATE, VecDraw->NVector->DataList->Count-1, sw); sw = false; } }else { for (int l = 0; l < CopyBackList->Count; l++) { int num1 = pheader2->TraitBackNumber[SLE_BASIS], num2 = pheader2->TraitBackNumber[SLE_ADJUST]; temp = (TVecData *) CopyBackList->Items[l]; if ((data = new TVecData(MainImageForm->Number))==NULL) goto fail; data->Copy(temp); int tempx = data->First.x; for (int m = 0; m < data->nCount*3+1; m++) { data->pList[m].x = 2*Brevx - data->pList[m].x - Bslex2; data->pList[m].y -= Bsley2; } if (data->TraitSet.Contains(SLE_BASIS)) { // ½½¸®ºê ±âÁØÁ¡ if ((num1>num2 && (num1-num2)==3) || (num1 == 0 && (num2-num1)!=3)) data->pList[num1 != 0 ? num1-1 : temp->nCount*3-1] = BSilSleLeftUp1; else data->pList[num1 != temp->nCount*3 ? num1+1 : 1] = BSilSleLeftUp1; } if (temp->TraitSet.Contains(SLE_COLLAR)) { // ½½¸®ºê Ä®¶ó °¡ µé¾î°¡ ÀÖÀ¸¸é ½Ç·ç¿§ Ä®¶ó ±âÁØÁ¡À¸·Î º¯È¯½ÃÄÑÁØ´Ù temp->TraitSet << SIL_COLLARLEFT; } if (data->TraitSet.Contains(SLE_ADJUST)) { // ½½¸®ºê Á¶ÀýÁ¡ data->pList[num2] = BSilSleLeftDown; if (((num2>num1 && (num2-num1)==3) || (num2 == 0 && (num1-num2)!=3))) data->pList[num2 != 0 ? num2-1 : temp->nCount*3-1] = BSilSleLeftDown1; else data->pList[num2 != temp->nCount*3 ? num2+1 : 1] = BSilSleLeftDown1; /////////////////////// 3Points SilhouetteÀ϶§~ if (pheader->EMethod == DH_RAGLAN || pheader->EMethod == DH_3POINTS) { data->nCount++; data->pList = (DPOINT *)HeapReAlloc(GetProcessHeap(), 0, data->pList, sizeof(DPOINT)*(data->nCount*3+1)); data->pMask = (BYTE*)HeapReAlloc(GetProcessHeap(), 0, data->pMask, (data->nCount * 3 + 1) % 8 == 0 ? (data->nCount * 3 + 1) / 8 : (data->nCount * 3 + 1) / 8 + 1); HeapCompact(GetProcessHeap(), 0); if (abs(num1-num2) == 3) { if (num1 < num2) { for (int m = data->nCount*3 -3; m > num2-2; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num2+1] = BSilSleLeftCen2; data->pList[num2] = BSilSleLeftCen; data->pList[num2-1] = BSilSleLeftCen1; }else { for (int m = data->nCount*3 -3; m > num1-2; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num1+1] = BSilSleLeftCen1; data->pList[num1] = BSilSleLeftCen; data->pList[num1-1] = BSilSleLeftCen2; } }else { if (num1 < num2) { for (int m = data->nCount*3 -3; m > num2+1; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num2+3+1] = BSilSleLeftCen1; data->pList[num2+3] = BSilSleLeftCen; data->pList[num2+3-1] = BSilSleLeftCen2; }else { for (int m = data->nCount*3 -3; m > num1+1; m--) { data->pList[m+3] = data->pList[m]; } data->pList[num1+3+1] = BSilSleLeftCen2; data->pList[num1+3] = BSilSleLeftCen; data->pList[num1+3-1] = BSilSleLeftCen1; } } } } SET_RECT; data->HeaderNumber = Number; VecDraw->NVector->DataList->Add(data); VecDraw->UndoSave(VU_CREATE, VecDraw->NVector->DataList->Count-1, sw); sw = false; } } } }else { // Collar //============= Ä®¶ó µ¥ÀÌÅÍ Ã£±â for (int l = 0; l < CopyFrontList->Count; l++) { // ¾ÕÆÇ temp = (TVecData *) CopyFrontList->Items[l]; if (temp->TraitSet.Contains(COL_COLLARLEFT)) { FColLeft = temp->pList[pheader2->TraitFrontNumber[COL_COLLARLEFT]]; colx = FColLeft.x - FSilColLeft.x; coly = FColLeft.y - FSilColLeft.y; } if (temp->TraitSet.Contains(COL_COLLARRIGHT)) FColRight = temp->pList[pheader2->TraitFrontNumber[COL_COLLARRIGHT]]; } for (int l = 0; l < CopyBackList->Count; l++) { // µÞÆÇ temp = (TVecData *) CopyBackList->Items[l]; if (temp->TraitSet.Contains(COL_COLLARLEFT)) { BColLeft = temp->pList[pheader2->TraitBackNumber[COL_COLLARLEFT]]; Bcolx = BColLeft.x - BSilColLeft.x; Bcoly = BColLeft.y - BSilColLeft.y; } if (temp->TraitSet.Contains(COL_COLLARRIGHT)) BColRight = temp->pList[pheader2->TraitBackNumber[COL_COLLARRIGHT]]; } //===== Collar ±æÀÌ¿Í ºñÀ² ±¸Çϱâ ColLength2 = sqrt((FColRight.x-FColLeft.x)*(FColRight.x-FColLeft.x)+(FColRight.y-FColLeft.y)*(FColRight.y-FColLeft.y)); BColLength2 = sqrt((BColRight.x-BColLeft.x)*(BColRight.x-BColLeft.x)+(BColRight.y-BColLeft.y)*(BColRight.y-BColLeft.y)); ratio = ColLength1 / ColLength2; Bratio = BColLength1 / BColLength2; if (Number >0) { // ¾ÕÆÇ for (int l = 0; l < CopyFrontList->Count; l++) { temp = (TVecData *) CopyFrontList->Items[l]; if ((data = new TVecData(MainImageForm->Number))==NULL) goto fail; data->Copy(temp); for (int m = 0; m < data->nCount*3+1; m++) { data->pList[m].x = (data->pList[m].x - FColLeft.x)*ratio + FColLeft.x - colx; data->pList[m].y = (data->pList[m].y - FColLeft.y)*ratio + FColLeft.y - coly; } SET_RECT; data->HeaderNumber = Number; VecDraw->NVector->DataList->Add(data); VecDraw->UndoSave(VU_CREATE, VecDraw->NVector->DataList->Count-1, sw); sw = false; } }else { // µÞÆÇ for (int l = 0; l < CopyBackList->Count; l++) { temp = (TVecData *) CopyBackList->Items[l]; if ((data = new TVecData(MainImageForm->Number))==NULL) goto fail; data->Copy(temp); for (int m = 0; m < data->nCount*3+1; m++) { data->pList[m].x = (data->pList[m].x - BColLeft.x)*Bratio + BColLeft.x - Bcolx; data->pList[m].y = (data->pList[m].y - BColLeft.y)*Bratio + BColLeft.y - Bcoly; } SET_RECT; data->HeaderNumber = Number; VecDraw->NVector->DataList->Add(data); VecDraw->UndoSave(VU_CREATE, VecDraw->NVector->DataList->Count-1, sw); sw = false; } } } /* for (int k = 10; k < 32; k++) { // µé¾î°¥ GroupindexÁöÁ¤ for (int i = 10; i < 32; i++) { if (existindex & (1 << i)) continue; index = i; break; } for (int i = existcount; i < VecDraw->NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if (!data->Equal(MainImageForm->Number)) continue; if (data->bSelected) continue; // ÀÌ¹Ì Çѹø ÁöÁ¤µÇ¾îÀÖ´Â °æ¿ì´Â º¸³½´Ù if (!(data->GroupIndex & (1<GroupIndex &= 0x000001ff; data->GroupIndex += 1<bSelected = true; existindex |= 1<NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if(srcMaxGroupIndex < data->GroupIndex / 10000) srcMaxGroupIndex = data->GroupIndex / 10000; } for(int k = 1; k <= srcMaxGroupIndex ; k++) { bool sw = true; for(int i = existcount; i < VecDraw->NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if(!data->Equal(MainImageForm->Number)) continue; if(data->bSelected) continue; if(data->GroupIndex / 10000 != k) continue; if(sw) { MainImageForm->GroupIndexState += 10000; sw = false; } data->GroupIndex = ((data->GroupIndex % 10000) & 0x000001ff) + MainImageForm->GroupIndexState; data->bSelected = true; } } //// for (int i = existcount; i < VecDraw->NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; data->bSelected = true; // MergeÀΰæ¿ì´Â ¼±ÅÃÀÌ µÈ»óÅ·Π»ý¼º } VecDraw->NVector->bSelected = true; MainImageForm->iMainImage->Repaint(); return; fail: return; fail2: // ¸Þ½ÃÁö : ÀÌ ½ºÅ¸ÀÏÀº ÀûÇÕÇÏÁö ¾Ê½À´Ï´Ù. ShowMessage(IDS_NOTPROPER.c_str()); return; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::LoadBelt(String path) { HANDLE hFile = INVALID_HANDLE_VALUE; STYLEDATAFILEHEADER header; PSTYLEDATAFILEHEADER pheader, pheader2; TVecData *data, *temp; DWORD dwRead; bool sw = true; int existindex, existcount, index; int Version; BYTE *StyleData = NULL; DWORD dwPos; DWORD dwDataSize; double BeltLength1, BeltLength2, BBeltLength1, BBeltLength2; DPOINT FCenter, FSilBeltLeft, FSilBeltRight; DPOINT BCenter, BSilBeltLeft, BSilBeltRight; DPOINT FBeltLeft, FBeltRight, BBeltLeft, BBeltRight; double beltx, belty, ratio, Bbeltx, Bbelty, Bratio; int srcMaxGroupIndex = 0; if (CopyFrontList) { while (CopyFrontList->Count) { data = (TVecData *)CopyFrontList->First(); delete data; CopyFrontList->Remove(data); } } if (CopyBackList) { while (CopyBackList->Count) { data = (TVecData *)CopyBackList->First(); delete data; CopyBackList->Remove(data); } } // *.sty ÆÄÀÏÀ» ¹öÀü º°·Î ÀÐ°í º¯È¯ÇÑ´Ù - by monkman (2004.03.30) if ((hFile = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto fail; header = VecDraw->ReadSTYFileHeader(hFile, path, &Version, true); if (!((100 <= Version && Version <= STYSTIFileVersion) || (500 <= Version && Version <= (STYSTIFileVersion+300)))) { // »óÀ§ ¹öÀü üũ - by monkman (2009.05.26) MessageDlg(IDS_MESSAGE_NEWERVERSIONFILE, mtInformation, TMsgDlgButtons() << mbOK, 0); goto fail; } // Version¿¡ µû¶ó ÇØ¾ßÇÒ ÀÛ¾÷ÀÌ ÀÖ´Ù¸é ÀÌ °÷¿¡¼­ ÇÑ´Ù - by monkman (2004.11.03) if (500 <= Version) { #ifndef NOT_STYLEDATA_LOCK // HASP°ú üũ ÇÑ´Ù if (!VecDraw->CheckSTYLock(hFile, header)) goto fail; #endif } if (Version == 0 || Version == 100) { // Version 100 ÀÏ °æ¿ì ¸ø Àд ¿¡·¯·Î ±ä±ÞÃß°¡ - by monkman (2005.06.10) dwDataSize = GetFileSize(hFile, NULL) - sizeof(OLDSTYLEDATAFILEHEADER); } else { dwDataSize = GetFileSize(hFile, NULL) - sizeof(STYLEDATAFILEHEADER); } if ((StyleData = (BYTE *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwDataSize))==NULL) goto fail; // ÆÄÀÏÅ©±â¸¸Å­ ¸Þ¸ð¸® ÇÒ´ç VecDraw->ReadSTYFileData(hFile, Version, StyleData, header); dwPos = 0; for (int j = 0; j < header.Count1; j++) { if ((data = new TVecData(0))==NULL) goto fail; VecDraw->LoadFromSTYMemory(&StyleData, &dwPos, data, Version); CopyFrontList->Add(data); } for (int j = 0; j < header.Count2; j++) { if ((data = new TVecData(0))==NULL) goto fail; VecDraw->LoadFromSTYMemory(&StyleData, &dwPos, data, Version); CopyBackList->Add(data); } if (StyleData) { HeapFree(GetProcessHeap(), 0, StyleData); // ¸Þ¸ð¸® ÇØÁ¦ StyleData = NULL; } CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; pheader = (PSTYLEDATAFILEHEADER) MainImageForm->StyleHeader->Items[abs(Number)-1]; if (Number > 0) { // ¾ÕÆÇÀÇ °æ¿ì //================ ¾ÕÆÇ silhouetteÀÇ data ã±â for (int j = 0; j < VecDraw->NVector->DataList->Count; j++) { // center, trait ã±â temp = (TVecData *) VecDraw->NVector->DataList->Items[j]; if (!temp->Equal(MainImageForm->Number)) continue; if (temp->HeaderNumber != Number) continue; if (temp->TraitSet.Contains(SIL_CENTER)) { FCenter = temp->pList[pheader->TraitFrontNumber[SIL_CENTER]]; } if (temp->TraitSet.Contains(SIL_BELTLEFT)) { FSilBeltLeft = temp->pList[pheader->TraitFrontNumber[SIL_BELTLEFT]]; } if (temp->TraitSet.Contains(SIL_BELTRIGHT)) { FSilBeltRight = temp->pList[pheader->TraitFrontNumber[SIL_BELTRIGHT]]; } } }else { //================ µÞÆÇ silhouetteÀÇ data ã±â for (int j = 0; j < VecDraw->NVector->DataList->Count; j++) { // center, trait ã±â temp = (TVecData *) VecDraw->NVector->DataList->Items[j]; if (!temp->Equal(MainImageForm->Number)) continue; if (temp->HeaderNumber != Number) continue; if (temp->TraitSet.Contains(SIL_CENTER)) { BCenter = temp->pList[pheader->TraitBackNumber[SIL_CENTER]]; } if (temp->TraitSet.Contains(SIL_BELTLEFT)) { BSilBeltLeft = temp->pList[pheader->TraitBackNumber[SIL_BELTLEFT]]; } if (temp->TraitSet.Contains(SIL_BELTRIGHT)) { BSilBeltRight = temp->pList[pheader->TraitBackNumber[SIL_BELTRIGHT]]; } } } //========== À̵¿(º¸Á¤)¼öÄ¡¿Í Ä®¶óÀÇ È®´ë/Ãà¼Ò ºñÀ²À» À§ÇÑ ±æÀÌ ±¸Çϱâ BeltLength1 = sqrt((FSilBeltRight.x-FSilBeltLeft.x)*(FSilBeltRight.x-FSilBeltLeft.x)+(FSilBeltRight.y-FSilBeltLeft.y)*(FSilBeltRight.y-FSilBeltLeft.y)); BBeltLength1 = sqrt((BSilBeltRight.x-BSilBeltLeft.x)*(BSilBeltRight.x-BSilBeltLeft.x)+(BSilBeltRight.y-BSilBeltLeft.y)*(BSilBeltRight.y-BSilBeltLeft.y)); if (bReplace) VecDraw->DeleteVectorObject(true); existcount = VecDraw->NVector->DataList->Count; /* for (int i = 0; i < VecDraw->NVector->DataList->Count; i++) { // GroupIndex ¸ÂÃçÁÖ±â data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if (!data->Equal(MainImageForm->Number)) continue; if (!data->GroupIndex) continue; existindex |= data->GroupIndex; } */ pheader2 = &header; //=============== º§Æ® µ¥ÀÌÅÍ Ã£±â for (int l = 0; l < CopyFrontList->Count; l++) { // ¾ÕÆÇ temp = (TVecData *) CopyFrontList->Items[l]; if (temp->TraitSet.Contains(BELT_BELTLEFT)) { FBeltLeft = temp->pList[pheader2->TraitFrontNumber[BELT_BELTLEFT]]; beltx = FBeltLeft.x - FSilBeltLeft.x; belty = FBeltLeft.y - FSilBeltLeft.y; } if (temp->TraitSet.Contains(BELT_BELTRIGHT)) FBeltRight = temp->pList[pheader2->TraitFrontNumber[BELT_BELTRIGHT]]; } for (int l = 0; l < CopyBackList->Count; l++) { // µÞÆÇ temp = (TVecData *) CopyBackList->Items[l]; if (temp->TraitSet.Contains(BELT_BELTLEFT)) { BBeltLeft = temp->pList[pheader2->TraitBackNumber[BELT_BELTLEFT]]; Bbeltx = BBeltLeft.x - BSilBeltLeft.x; Bbelty = BBeltLeft.y - BSilBeltLeft.y; } if (temp->TraitSet.Contains(BELT_BELTRIGHT)) BBeltRight = temp->pList[pheader2->TraitBackNumber[BELT_BELTRIGHT]]; } //===== Belt ±æÀÌ¿Í ºñÀ² ±¸Çϱâ BeltLength2 = sqrt((FBeltRight.x-FBeltLeft.x)*(FBeltRight.x-FBeltLeft.x)+(FBeltRight.y-FBeltLeft.y)*(FBeltRight.y-FBeltLeft.y)); BBeltLength2 = sqrt((BBeltRight.x-BBeltLeft.x)*(BBeltRight.x-BBeltLeft.x)+(BBeltRight.y-BBeltLeft.y)*(BBeltRight.y-BBeltLeft.y)); ratio = BeltLength1 / BeltLength2; Bratio = BBeltLength1 / BBeltLength2; //============ º§Æ® ´ëÀÔ if (Number > 0) { // ¾ÕÆÇÀÇ °æ¿ì for (int l = 0; l < CopyFrontList->Count; l++) { temp = (TVecData *) CopyFrontList->Items[l]; if ((data = new TVecData(MainImageForm->Number))==NULL) goto fail; data->Copy(temp); for (int m = 0; m < data->nCount*3+1; m++) { data->pList[m].x = (data->pList[m].x - FBeltLeft.x)*ratio + FBeltLeft.x - beltx; data->pList[m].y = (data->pList[m].y - FBeltLeft.y)*ratio + FBeltLeft.y - belty; } SET_RECT; data->HeaderNumber = Number; VecDraw->NVector->DataList->Add(data); VecDraw->UndoSave(VU_CREATE, VecDraw->NVector->DataList->Count-1, sw); sw = false; } }else { for (int l = 0; l < CopyBackList->Count; l++) { temp = (TVecData *) CopyBackList->Items[l]; if ((data = new TVecData(MainImageForm->Number))==NULL) goto fail; data->Copy(temp); for (int m = 0; m < data->nCount*3+1; m++) { data->pList[m].x = (data->pList[m].x - BBeltLeft.x)*Bratio + BBeltLeft.x - Bbeltx; data->pList[m].y = (data->pList[m].y - BBeltLeft.y)*Bratio + BBeltLeft.y - Bbelty; } SET_RECT; data->HeaderNumber = Number; VecDraw->NVector->DataList->Add(data); VecDraw->UndoSave(VU_CREATE, VecDraw->NVector->DataList->Count-1, sw); sw = false; } } /* for (int k = 10; k < 32; k++) { // µé¾î°¥ GroupindexÁöÁ¤ for (int i = 10; i < 32; i++) { if (existindex & (1 << i)) continue; index = i; break; } for (int i = existcount; i < VecDraw->NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if (!data->Equal(MainImageForm->Number)) continue; if (data->bSelected) continue; // ÀÌ¹Ì Çѹø ÁöÁ¤µÇ¾îÀÖ´Â °æ¿ì´Â º¸³½´Ù if (!(data->GroupIndex & (1<GroupIndex &= 0x000001ff; data->GroupIndex += 1<bSelected = true; existindex |= 1<NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if(srcMaxGroupIndex < data->GroupIndex / 10000) srcMaxGroupIndex = data->GroupIndex / 10000; } for(int k = 1; k <= srcMaxGroupIndex ; k++) { bool sw = true; for(int i = existcount; i < VecDraw->NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; if(!data->Equal(MainImageForm->Number)) continue; if(data->bSelected) continue; if(data->GroupIndex / 10000 != k) continue; if(sw) { MainImageForm->GroupIndexState += 10000; sw = false; } data->GroupIndex = ((data->GroupIndex % 10000) & 0x000001ff) + MainImageForm->GroupIndexState; data->bSelected = true; } } //// for (int i = existcount; i < VecDraw->NVector->DataList->Count; i++) { data = (TVecData *)VecDraw->NVector->DataList->Items[i]; data->bSelected = true; // MergeÀΰæ¿ì´Â ¼±ÅÃÀÌ µÈ»óÅ·Π»ý¼º } VecDraw->NVector->bSelected = true; MainImageForm->iMainImage->Repaint(); return; fail: return; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::StringGrid1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { TGridCoord grid = StringGrid1->MouseCoord(X, Y); TDirectoryInfor *di; TFileInfor *fi; String path; StringGrid1->Col = grid.X; StringGrid1->Row = grid.Y; FitNormal1->Enabled = true; FitMirror1->Enabled = true; if (Button == mbRight) { if (Data2->Count > 0) { di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; if(di->pFileList) { if (StringGrid1->Row*2 + StringGrid1->Col < di->pFileList->Count) { fi = (TFileInfor*) di->pFileList->Items[StringGrid1->Row*2 + StringGrid1->Col]; path = SearchFile->InitDirectory + "\\" + fi->Path + "\\" + fi->Name; if (LowerCase(ExtractFileExt(fi->Name)) == ".tfc") { FitNormal1->Enabled = false; FitMirror1->Enabled = false; } } } } } } //--------------------------------------------------------------------------- void __fastcall TDetailForm::ComboBox1Change(TObject *Sender) { TDirectoryInfor *di; String temp1, temp2; currentindex1 = ComboBox1->ItemIndex; currentindex2 = ComboBox2->ItemIndex; DeleteOldData(); UpdateComboBox(1); ComboBox1->ItemIndex = currentindex1; if (!UpdateComboBox(2)) { ComboBox2->Items->Clear(); ComboBox2->Text = ""; StringGrid1->Repaint(); return; } ComboBox2->ItemIndex = 0; UpdateItems(); StringGrid1->TopRow = 0; // ACC¿Ü¿¡´Â Sleeve, Collar, BeltÀÏ °æ¿ì ÀúÀåÀÌ ºÒ°¡ - by monkman (2004.07.05) temp1 = (String)ComboBox1->Items->Strings[ComboBox1->ItemIndex].LowerCase(); temp2 = (String)ComboBox2->Items->Strings[ComboBox2->ItemIndex].LowerCase(); if ( temp1 != "acc" && (temp2 == "sleeve" || temp2 == "collar" || temp2 == "belt")) { bStyleFile = true; sbSave->Enabled = false; // ¾î¶² ¸ðµå·Î µé¾î¿Íµµ Fit °¡´ÉÇÏ°Ô ¼öÁ¤ - by monkman (2005.01.20) //FitNormal1->Enabled = bReplace; //FitMirror1->Enabled = bReplace; FitNormal1->Enabled = true; FitMirror1->Enabled = true; Spread1->Enabled = false; }else { bStyleFile = false; sbSave->Enabled = true; FitNormal1->Enabled = false; FitMirror1->Enabled = false; Spread1->Enabled = true; } if (comboSource->Items->Count == 0 || ComboBox1->Items->Count == 0 || ComboBox2->Items->Count == 0) { sbNewFolder->Enabled = false; sbDeleteFolder->Enabled = false; sbSave->Enabled = false; sbDelete->Enabled = false; } else { sbNewFolder->Enabled = true; sbDeleteFolder->Enabled = true; sbSave->Enabled = true; sbDelete->Enabled = true; } StringGrid1->Repaint(); } //--------------------------------------------------------------------------- void __fastcall TDetailForm::ComboBox2Change(TObject *Sender) { TDirectoryInfor *di; UpdateData(); UpdateItems(); StringGrid1->TopRow = 0; StringGrid1->Repaint(); } //--------------------------------------------------------------------------- void __fastcall TDetailForm::DeleteOldData() { TDirectoryInfor *di; TFileInfor *fi; if (currentindex2 != -1) { di = (TDirectoryInfor *) Data2->Items[currentindex2]; if (di->pFileList) { for (int j = 0; j < di->pFileList->Count; j++) { fi = (TFileInfor *) di->pFileList->Items[j]; if (fi->tBitmap) { delete fi->tBitmap; fi->tBitmap = NULL; } } } } } //--------------------------------------------------------------------------- void __fastcall TDetailForm::FormDestroy(TObject *Sender) { ExitForm(); } //--------------------------------------------------------------------------- void __fastcall TDetailForm::StringGrid1DblClick(TObject *Sender) { TDirectoryInfor *di; TFileInfor *fi; String path; if (Data2->Count > 0) { di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; if(di->pFileList) { if (StringGrid1->Row*2 + StringGrid1->Col < di->pFileList->Count) { if (bReplace) VecDraw->DeleteVectorObject(true); fi = (TFileInfor*) di->pFileList->Items[StringGrid1->Row*2 + StringGrid1->Col]; path = SearchFile->InitDirectory + "\\" + fi->Path + "\\" + fi->Name; mirror = false; if (ExtractFileExt(fi->Name.LowerCase()) == ".sty") LoadStyleToMainImage(path); else LoadToMainImage(path); } } } } //--------------------------------------------------------------------------- void __fastcall TDetailForm::sbPrevious1Click(TObject *Sender) { TSpeedButton *sb = (TSpeedButton *) Sender; switch (sb->Tag) { case 1: if (ComboBox1->ItemIndex == 0) return; ComboBox1->ItemIndex--; ComboBox1Change(this); break; case 2: if (ComboBox2->ItemIndex == 0) return; ComboBox2->ItemIndex--; ComboBox2Change(this); break; } StringGrid1->TopRow = 0; StringGrid1->Repaint(); } //--------------------------------------------------------------------------- void __fastcall TDetailForm::sbNext1Click(TObject *Sender) { TSpeedButton *sb = (TSpeedButton *) Sender; switch (sb->Tag) { case 1: if (ComboBox1->ItemIndex == Data1->Count-1) return; ComboBox1->ItemIndex++; ComboBox1Change(this); break; case 2: if (ComboBox2->ItemIndex == Data2->Count-1) return; ComboBox2->ItemIndex++; ComboBox2Change(this); break; } StringGrid1->TopRow = 0; StringGrid1->Repaint(); } //--------------------------------------------------------------------------- void __fastcall TDetailForm::sbSaveClick(TObject *Sender) { DWORD dwWrite; HANDLE hFile = INVALID_HANDLE_VALUE; String FullName; TDirectoryInfor *di; TEXPIAFILEHEADER tpfh; TTexpiaBitmap *tag = NULL; TUnionBitmap *bgBitmap = NULL; // *.tex·Î ÀúÀåÇÒ¶§.. - by monkman (2004.07.01) - with celberus //RGBQUAD rgb[256]; HDC dcTemp = NULL; bool layer = false; TRect src; WORD bpp, useColor; String input; TVecData *data, *cdata; RECT bgRect; POINT basePoint; double basePenThick; TList *DataList = VecDraw->NVector->DataList; TList *CopyList = new TList; // *.tex·Î ÀúÀåµÇ´ø °ÍÀ» *.tfc·Î ÀúÀåµÇ°Ô²û ¼öÁ¤ - by monkman (2004.07.01) // ÀúÀåÇÒ ¸®½ºÆ®¸¦ º¹»çÇÑ´Ù - by monkman (2004.07.02) for (int i = 0; i < DataList->Count; i++) { data = (TVecData *)DataList->Items[i]; if (data->Equal(MainImageForm->Number) && data->bSelected) { if (data->ListOfAllLine && data->ListOfAllLine->CurveData) //Curved TextÀº Áö¿øÇÏÁö ¾Ê´Â´Ù. continue; // 07.3.21 by maxleo21c cdata = new TVecData(MainImageForm->Number); cdata->Copy(data); cdata->bSelected = true; CopyList->Add(cdata); } } if (!(VecDraw->NVector->bSelected)) goto fail; if (ComboBox2->ItemIndex == -1) { // ¸Þ½ÃÁö : ¸ÕÀú Æú´õ¸¦ »ý¼ºÇϽʽÿÀ. ShowMessage(IDS_CREATEFOLDER.c_str()) ; goto fail; } di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; // *.tex·Î ÀúÀåµÇ´ø °ÍÀ» *.tfc·Î ÀúÀåµÇ°Ô²û ¼öÁ¤ - by monkman (2004.07.01) if ((input = InputBox("File Save", "Name", "")) == "") goto fail; FullName = SearchFile->InitDirectory + "\\" + di->Path + "\\" + di->Name + "\\" + input + ".tfc"; if (FileExists(FullName)) { // °°Àº À̸§ÀÌ Á¸ÀçÇÒ °æ¿ì - by monkman (2007.02.01) // °°Àº À̸§ÀÌ Á¸ÀçÇÕ´Ï´Ù. µ¤¾î¾²½Ã°Ú½À´Ï±î? if (MessageDlg(IDS_MESSAGE_SAMENAMEOVERWRIGHT, mtConfirmation , TMsgDlgButtons() << mbYes << mbNo, 0) == mrNo) goto fail; } // *.tex·Î ÀúÀåµÇ´ø °ÍÀ» *.tfc·Î ÀúÀåµÇ°Ô²û ¼öÁ¤ - by monkman (2004.07.01) // »ý¼ºÇÒ ¹è°æ BitmapÀÇ Size¸¦ ¾Ë±â À§ÇØ - by monkman (2004.07.01) basePenThick = 0; basePoint.x = MaxInt; basePoint.y = MaxInt; bgRect.left = 0; bgRect.top = 0; bgRect.right = 0; bgRect.bottom = 0; for (int i = 0; i < CopyList->Count; i++) { data = (TVecData *)CopyList->Items[i]; //if (!data->Equal(MainImageForm->Number)) continue; //if (!data->bSelected) continue; SET_RECT; if (basePenThick < data->PenThick) basePenThick = data->PenThick; if (basePoint.x > data->First.x) basePoint.x = data->First.x; if (basePoint.y > data->First.y) basePoint.y = data->First.y; if (bgRect.right < data->Second.x) bgRect.right = data->Second.x; if (bgRect.bottom < data->Second.y) bgRect.bottom = data->Second.y; } bgRect.right = bgRect.right - basePoint.x + basePenThick*2; bgRect.bottom = bgRect.bottom - basePoint.y + basePenThick*2; for (int i = 0; i < CopyList->Count; i++) { data = (TVecData *)CopyList->Items[i]; //if (!data->Equal(MainImageForm->Number)) continue; //if (!data->bSelected) continue; // V_TEXTBOXÀÏ °æ¿ì¿¡´Â ó¸®ÇÏ¸é ¾ÈµÈ´Ù. 07.3.20 by maxleo21c if (data->Kind == V_TEXTBOX) { if (data->ListOfAllLine && data->ListOfAllLine->CurveData) { /* TVecData *CurveData; CurveData = data->ListOfAllLine->CurveData; int Margin; try{ Margin = data->ListOfAllLine->GetLineTextBox(0)->lineHeight*3; }catch(...) { Margin = 0; } CurveData->First.x = (CurveData->First.x - Margin) - basePoint.x + basePenThick; CurveData->Second.x = (CurveData->Second.x + Margin) - basePoint.x + basePenThick; CurveData->First.y = (CurveData->First.y - Margin) - basePoint.y + basePenThick; CurveData->Second.y = (CurveData->Second.y + Margin) - basePoint.y + basePenThick; */ } else { for (int i = 0; i < 5; i++) { data->pList[i].x = data->pList[i].x - basePoint.x + basePenThick; data->pList[i].y = data->pList[i].y - basePoint.y + basePenThick; } } data->StartPoint.x = data->StartPoint.x - basePoint.x + basePenThick; data->StartPoint.y = data->StartPoint.y - basePoint.y + basePenThick; data->CenterPoint.x = data->CenterPoint.x - basePoint.x + basePenThick; data->CenterPoint.y = data->CenterPoint.y - basePoint.y + basePenThick; } else { for (int i = 0; i < data->nCount*3+1; i++) { data->pList[i].x = data->pList[i].x - basePoint.x + basePenThick; data->pList[i].y = data->pList[i].y - basePoint.y + basePenThick; } } SET_RECT; } // *.tex·Î ÀúÀåÇÒ¶§.. - by monkman (2004.07.01) - with celberus //////////////////////////////////////////////////////////////////////////////// // tpfh.Version = TexVersion('P', 'T', 241); // 241ÀÌ¸é º¤Å͸¸ ¼¼À̺êµÈ°Å¿¡¿ä!!! // if ((tag = new TTexpiaBitmap) == NULL) goto fail; // MainImageForm->Palette->ToRGBQUAD(rgb, 256); // if (!(tag->Create(80, 100, 8, rgb))) goto fail; // tag->FillRect(Rect(0, 0, 80, 100), clWhite); // Tag »ý¼º //////////////////////////////////////////////////////////////////////////////// // *.tex·Î ÀúÀåµÇ´ø °ÍÀ» *.tfc·Î ÀúÀåµÇ°Ô²û ¼öÁ¤ - by monkman (2004.07.01) tpfh.Version = TexVersion('P', 'T', TexStylistFileVersion);//240); // 241ÀÌ¸é º¤Å͸¸ ¼¼À̺êµÈ°Å¿¡¿ä!!! tpfh.BitsPerPixel = 24; tpfh.CanvasInfor.DotsPerInch = MainImageForm->CanvasInfor.DotsPerInch; tpfh.CanvasInfor.SetSize(cstFree, bgRect.right, bgRect.bottom); tpfh.Compress = cmZLib; if ((tag = new TTexpiaBitmap) == NULL) goto fail; if ((bgBitmap = new TUnionBitmap) == NULL) goto fail; if (!(tag->Create(80, 100, 24))) goto fail; tag->FillRect(Rect(0, 0, 80, 100), clWhite); // Tag »ý¼º // ¹è°æ ºñÆ®¸Ê »ý¼º ÈÄ ÇϾé°Ô - by monkman (2004.07.01) if (!(bgBitmap->Create(bgRect.right, bgRect.bottom, 24))) goto fail; bgBitmap->FillRect(Rect(0, 0, bgRect.right, bgRect.bottom), clWhite); src = VecDraw->GetObjectRect(); if ((dcTemp = tag->CreateDC()) == NULL) goto fail; VecDraw->TagDraw(dcTemp, tag->Width, tag->Height, src, 8); // Vector Tag±×·ÁÁÖ±â tag->DeleteDC(dcTemp); dcTemp = NULL; if ((hFile = CreateFile(FullName.c_str(), GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto fail; if (!WriteFile(hFile, &tpfh, sizeof(TEXPIAFILEHEADER), &dwWrite, NULL)) goto fail; useColor = MainImageForm->Palette->UseColor; if (!WriteFile(hFile, &useColor, sizeof(Word), &dwWrite, NULL)) goto fail; MainImageForm->Palette->SaveToFileHandle(hFile, 2); bpp = tag->BitsPerPixel; if (!WriteFile(hFile, &bpp, sizeof(WORD), &dwWrite, NULL)) goto fail; if (!tag->SaveToTexpiaFile(hFile, cmNone)) goto fail; // ¹è°æ ºñÆ®¸Ê ±×·ÁÁÖ±â - by monkman (2004.07.01) if (!bgBitmap->SaveToTexpiaFile(hFile, bgRect, tpfh.Compress)) goto fail; if (!WriteFile(hFile, &layer, sizeof(bool), &dwWrite, NULL)) goto fail; // MainImageForm¿¡ ÀÖ´Â DataList ¸»°í ´Ù¸¥ ¸®½ºÆ®µµ ¹ÞÀ» ¼ö ÀÖµµ·Ï ó¸® - by monkman (2004.07.02) // if (bpp == 8) { // VecDraw->SaveToFile(hFile, CopyList, 1, TextileFileVersion10, MainImageForm->Number); // } // else { // VecDraw->SaveToFile(hFile, CopyList, 1, TextileFileVersion10, MainImageForm->Number); // } if (bpp == 8) { VecDraw->SaveToFile(hFile, CopyList, 8, TexStylistFileVersion, MainImageForm->Number); } else { VecDraw->SaveToFile(hFile, CopyList, 8, TexStylistFileVersion, MainImageForm->Number); } CloseHandle(hFile); // º¹»çµÈ ¸®½ºÆ® »èÁ¦ - by monkman (2004.07.02) if (CopyList) { while (CopyList->Count) { data = (TVecData *)CopyList->First(); delete data; CopyList->Remove(data); } delete CopyList; CopyList = NULL; } if (tag) { delete tag; tag = NULL; } // ¹è°æ ºñÆ®¸Ê »èÁ¦ - by monkman (2004.07.01) if (bgBitmap) { delete bgBitmap; bgBitmap = NULL; } UpdateData(); UpdateItems(); return; fail: CloseHandle(hFile); // º¹»çµÈ ¸®½ºÆ® »èÁ¦ - by monkman (2004.07.02) if (CopyList) { while (CopyList->Count) { data = (TVecData *)CopyList->First(); delete data; CopyList->Remove(data); } delete CopyList; CopyList = NULL; } if (tag) { delete tag; tag = NULL; } // ¹è°æ ºñÆ®¸Ê »èÁ¦ - by monkman (2004.07.01) if (bgBitmap) { delete bgBitmap; bgBitmap = NULL; } } //--------------------------------------------------------------------------- void __fastcall TDetailForm::sbDeleteClick(TObject *Sender) { TDirectoryInfor *di; TFileInfor *fi; String path; if (Data2->Count > 0) { di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; if(di->pFileList) { if (StringGrid1->Row*2 + StringGrid1->Col < di->pFileList->Count) { if (!(Application->MessageBox(IDS_FILEERASE.c_str(), IDS_FILEDELETE.c_str(), MB_YESNO | MB_ICONQUESTION) == IDYES)) return; fi = (TFileInfor*) di->pFileList->Items[StringGrid1->Row*2 + StringGrid1->Col]; path = SearchFile->InitDirectory + "\\" + fi->Path + "\\" + fi->Name; DeleteFile(path); } } } UpdateData(); UpdateItems(); StringGrid1->Repaint(); } //--------------------------------------------------------------------------- void __fastcall TDetailForm::sbNewFolderClick(TObject *Sender) { String dn, input; TSpeedButton *sb = (TSpeedButton *) Sender; TDirectoryInfor *di1, *di2; // ACC¿Ü¿¡´Â Sleeve, Collar, BeltÀÏ °æ¿ì ÀúÀåÀÌ ºÒ°¡ - by monkman (2004.07.05) String temp1, temp2; if ((input = InputBox("Create New Folder", "Name", "")) == "") goto fail; switch (sb->Tag) { case 1: dn = SearchFile->InitDirectory + "\\" + input; CreateDirectory(dn.c_str(), NULL); UpdateData(); ComboBox1->ItemIndex = GetCurrentIndex(1, input); UpdateItems(); break; case 2: di1 = (TDirectoryInfor *) Data1->Items[ComboBox1->ItemIndex]; dn = SearchFile->InitDirectory + "\\" + di1->Name + "\\" + input; CreateDirectory(dn.c_str(), NULL); UpdateData(); ComboBox2->ItemIndex = GetCurrentIndex(2, input); UpdateItems(); break; } // ACC¿Ü¿¡´Â Sleeve, Collar, BeltÀÏ °æ¿ì ÀúÀåÀÌ ºÒ°¡ - by monkman (2004.07.05) temp1 = (String)ComboBox1->Items->Strings[ComboBox1->ItemIndex].LowerCase(); temp2 = (String)ComboBox2->Items->Strings[ComboBox2->ItemIndex].LowerCase(); if ( temp1 != "acc" && (temp2 == "sleeve" || temp2 == "collar" || temp2 == "belt")) { bStyleFile = true; sbSave->Enabled = false; //FitNormal1->Enabled = bReplace; //FitMirror1->Enabled = bReplace; FitNormal1->Enabled = true; FitMirror1->Enabled = true; Spread1->Enabled = false; }else { bStyleFile = false; sbSave->Enabled = true; FitNormal1->Enabled = false; FitMirror1->Enabled = false; Spread1->Enabled = true; } StringGrid1->Repaint(); return; fail: return; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::sbDeleteFolderClick(TObject *Sender) { String dn, input; TSpeedButton *sb = (TSpeedButton *) Sender; TDirectoryInfor *di; switch (sb->Tag) { case 1: if (Data1->Count == 0) return; di = (TDirectoryInfor *) Data1->Items[ComboBox1->ItemIndex]; // ¸Þ½ÃÁö : ÇØ´ç Æú´õ¸¦ »èÁ¦ÇϽðڽÀ´Ï±î? if (MessageDlg(IDS_DELETEFOLDER.c_str(), mtWarning, TMsgDlgButtons()<InitDirectory + "\\" + di->Name); UpdateData(); ComboBox1->ItemIndex = 0; UpdateItems(); break; case 2: if (Data2->Count == 0) return; di = (TDirectoryInfor *) Data2->Items[ComboBox2->ItemIndex]; // ¸Þ½ÃÁö : ÇØ´ç Æú´õ¸¦ »èÁ¦ÇϽðڽÀ´Ï±î? if (MessageDlg(IDS_DELETEFOLDER.c_str(), mtWarning, TMsgDlgButtons()<InitDirectory + "\\" + di->Path + "\\" + di->Name); UpdateData(); ComboBox2->ItemIndex = 0; UpdateItems(); break; } StringGrid1->Repaint(); return; fail: return; } //--------------------------------------------------------------------------- int __fastcall TDetailForm::GetCurrentIndex(int combo, String str) { TDirectoryInfor *di; int cnt; switch (combo) { case 1: cnt = Data1->Count; if (cnt>0) { for (int i = 0; i < cnt; i++) { di = (TDirectoryInfor *) Data1->Items[i]; if (di->Name.LowerCase() == str.LowerCase()) { return i; } } } break; case 2: cnt = Data2->Count; if (cnt > 0) { for (int i = 0; i < cnt; i++) { di = (TDirectoryInfor *) Data2->Items[i]; if (di->Name.LowerCase() == str.LowerCase()) { return i; } } } break; } return -1; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::DeleteFolder(String FolderName) { SHFILEOPSTRUCT shfile; Char *ucFrom = NULL; memset(&shfile, 0, sizeof(SHFILEOPSTRUCT)); shfile.hwnd = Handle; shfile.wFunc = FO_DELETE; if ((ucFrom = (Char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Char)*(FolderName.Length()+2))) == NULL) goto fail; _tcscpy(ucFrom, FolderName.c_str()); shfile.pFrom = ucFrom; shfile.fFlags = FOF_ALLOWUNDO ; SHFileOperation(&shfile); HeapFree(GetProcessHeap(), 0, ucFrom); return; fail: EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } //--------------------------------------------------------------------------- void __fastcall TDetailForm::sbChangeBaseDirectoryClick(TObject *Sender) { String Msg; String strOldRootPath; //shChangeBaseDirectory->Brush->Color = clRed; strOldRootPath = strRootPath; strRootPath = BaseDirectoryDialogFunc("CombiDetail", strRootPath); Msg = IDS_CHANGEBASEFOLDER1 + strRootPath + IDS_CHANGEBASEFOLDER2; if (strOldRootPath.LowerCase() != strRootPath.LowerCase()) { // ¸Þ½ÃÁö : ±âº» Æú´õ°¡ <Æú´õ¸í>·Î º¯°æµÇ¾ú½À´Ï´Ù. Application->MessageBox(Msg.c_str(), L"Information", MB_OK); FindFolder(strRootPath + "\\*.*"); if (comboSource->Items->Count >= 0) { comboSource->ItemIndex = 0; DirectoryStyle = strRootPath + "\\" + comboSource->Items->Strings[comboSource->ItemIndex]; lbPath->Caption = DirectoryStyle; } comboSourceChange(this); } //shChangeBaseDirectory->Brush->Color = clBlack; if (comboSource->Items->Count == 0 || ComboBox1->Items->Count == 0 || ComboBox2->Items->Count == 0) { sbNewFolder->Enabled = false; sbDeleteFolder->Enabled = false; sbSave->Enabled = false; sbDelete->Enabled = false; } else { sbNewFolder->Enabled = true; sbDeleteFolder->Enabled = true; sbSave->Enabled = true; sbDelete->Enabled = true; } } //--------------------------------------------------------------------------- void __fastcall TDetailForm::FindFolder(String path) { // path»ó¿¡ µ¿µîÇÏ°Ô Á¸ÀçÇÏ´Â ÇÏÀ§µð·ºÅ丮¸¸ °Ë»öÇÑ´Ù HANDLE hSrch; WIN32_FIND_DATA wfd; Char drive[MAX_PATH]; Char dir[MAX_PATH]; Char newpath[MAX_PATH]; bool bResult = true; String TempDirectory; String strLowerFileName; TempDirectory = comboSource->Items->Strings[comboSource->ItemIndex]; comboSource->Clear(); hSrch=FindFirstFile(path.c_str(), &wfd); while (bResult) { // ÆÐ½º¸¦ µå¶óÀ̺ê, µð·ºÅ丮·Î ºÐ·ù _wsplitpath(path.c_str(), drive, dir, NULL, NULL); // µð·ºÅ丮ÀÎÁö È®ÀÎ if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (wfd.cFileName[0] != '.') { // ÆÐ½º Àç¼³Á¤ wsprintf(newpath, L"%s%s%s\\*.*", drive, dir, wfd.cFileName); if (path.LowerCase() == DirectoryBin.LowerCase() || path.LowerCase() == (DirectoryBin.LowerCase() + "\\*.*")) { strLowerFileName = strLowerFileName.sprintf(wfd.cFileName); strLowerFileName = strLowerFileName.LowerCase(); // Style µð·ºÅ丮ÀÏ °æ¿ì if (strLowerFileName == "detail") { comboSource->Items->Insert(0, wfd.cFileName); } else if (strLowerFileName != "style" && strLowerFileName != "guideimage" // Stylist¿¡¼­ »ç¿ëÇÏ´Â µð·ºÅ丮ÀÏ °æ¿ì && strLowerFileName != "stisample" && strLowerFileName != "texstylist") { comboSource->Items->Add(wfd.cFileName); } } else { comboSource->Items->Add(wfd.cFileName); } } } bResult = FindNextFile(hSrch, &wfd); } FindClose(hSrch); comboSource->ItemIndex = comboSource->Items->IndexOf(TempDirectory); if (comboSource->ItemIndex < 0) comboSource->ItemIndex = 0; } //--------------------------------------------------------------------------- void __fastcall TDetailForm::comboSourceChange(TObject *Sender) { String temp; DirectoryStyle = strRootPath + "\\" + comboSource->Items->Strings[comboSource->ItemIndex]; STYDetailSelectedSave(comboSource->Items->Strings[comboSource->ItemIndex]); SearchFile->InitDirectory = DirectoryStyle; lbPath->Caption = DirectoryStyle; UpdateComboBox(1); ComboBox1->ItemIndex = 0; if (Data1->Count <= 0) { ComboBox1->Clear(); ComboBox1->ItemIndex = -1; } UpdateComboBox(2); ComboBox2->ItemIndex = 0; if (Data2->Count <= 0) { ComboBox2->Clear(); ComboBox2->ItemIndex = -1; } UpdateItems(); if (comboSource->Items->Count == 0 || ComboBox1->Items->Count == 0 || ComboBox2->Items->Count == 0) { sbNewFolder->Enabled = false; sbDeleteFolder->Enabled = false; sbSave->Enabled = false; sbDelete->Enabled = false; } else { sbNewFolder->Enabled = true; sbDeleteFolder->Enabled = true; sbSave->Enabled = true; sbDelete->Enabled = true; } StringGrid1->Repaint(); } //--------------------------------------------------------------------------- void __fastcall TDetailForm::STYDetailSelectedSave(String strSelectedDetailDirectory) { // Style.ini ÆÄÀÏ¿¡¼­ ¾ò¾î¿Â STYPath °ª - by monkman (2004.10.12) TIniFile *IniFile = NULL; IniFile = new TIniFile(AppDataItem+"\\Style.ini"); if (IniFile) { IniFile->WriteString("CombiDetail", "Directory", strSelectedDetailDirectory); delete IniFile; } IniFile = NULL; } //---------------------------------------------------------------------------