//--------------------------------------------------------------------------- #include #pragma hdrstop #include "VIllustForm.h" #include "Combination.h" #include "CombiResult.h" #include "MainMenu.h" #include "define.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" //--------------------------------------------------------------------------- #define CENTER_X 150 // ±âÁØÁ¡ÀÌ µé¾î°¥ Á¡ÀÇ ÁÂÇ¥ #define CENTER_Y 50 #define MARGIN_X 50 // ¿©¹é ÁÂÇ¥ #define MARGIN_Y 50 //--------------------------------------------------------------------------- #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; \ } \ //--------------------------------------------------------------------------- #define IDS_STYLEILLUSTLOAD StringTable[0] #define IDS_INFORMATIONS StringTable[1] #define IDS_COMBINATION StringTable[2] #define IDS_TOPSTYLECOMBINATION StringTable[3] #define IDS_BOTTOMSTYLECOMBINATION StringTable[4] #define IDS_OTHERSTYLE StringTable[5] #define IDS_LOAD StringTable[6] #define IDS_WHOLESTYLE StringTable[7] #define IDS_TOPSTYLE StringTable[8] #define IDS_BOTTOMSTYLE StringTable[9] #define IDS_MERGE StringTable[10] #define IDS_READ StringTable[11] #define IDS_IMAGE StringTable[12] #define IDS_PREVIOUS StringTable[13] #define IDS_PICTURECHANGE StringTable[14] #define IDS_FRONT StringTable[15] #define IDS_BACK StringTable[16] #define IDS_DELETE StringTable[17] #define IDS_MESSAGE1 StringTable[18] #define IDS_MESSAGE2 StringTable[19] #define IDS_MESSAGE3 StringTable[20] // 2004.08.17 Ãß°¡ - by monkman #define IDS_SETBASEFOLDER StringTable[21] #define IDS_MESSAGE4 StringTable[22] #define IDS_MESSAGE5 StringTable[23] #define IDS_MESSAGE6 StringTable[24] #define IDS_STYLEOPEN StringTable[25] #define IDS_STYLEMERGE StringTable[26] #define IDS_CHECKLIST StringTable[27] #define IDS_BRINGTHECANVAS StringTable[28] #define IDS_BRINGTHEFILE StringTable[29] #define IDS_SEASON StringTable[30] #define IDS_MAINITEM StringTable[31] #define IDS_TOP StringTable[32] #define IDS_BOTTOM StringTable[33] #define IDS_TOPWHOLETYPE StringTable[34] #define IDS_TOPTYPE StringTable[35] #define IDS_TOPSILHOUETTETYPE StringTable[36] #define IDS_TOPSLEEVETYPE StringTable[37] #define IDS_TOPCOLLARTYPE StringTable[38] #define IDS_BOTTOMWHOLETYPE StringTable[39] #define IDS_BOTTOMSILHOUETTETYPE StringTable[40] #define IDS_BOTTOMBELTTYPE StringTable[41] #define IDS_MESSAGE7 StringTable[42] //#define IDS_CHECK StringTable[2] #define SORT_TOPSILHOUETTE 0 #define SORT_TOPSLEEVE 1 #define SORT_TOPCOLLAR 2 #define SORT_TOPWHOLESTYLE 3 #define SORT_BOTTOMSILHOUETTE 4 #define SORT_BOTTOMBELT 5 #define SORT_BOTTOMWHOLESTYLE 6 #define SSFW_SPRING 0 #define SSFW_SUMMER 1 #define SSFW_FALL 2 #define SSFW_WINTER 3 //--------------------------------------------------------------------------- TStyleIllustForm *StyleIllustForm; //--------------------------------------------------------------------------- __fastcall TStyleIllustForm::TStyleIllustForm(TComponent* Owner) : TForm(Owner) { StringTable.Create(DirectoryItem, Language, "StyleIllustForm"); SetSmallFont(Font); Caption = IDS_STYLEILLUSTLOAD; GroupBoxInformations1->Caption = IDS_INFORMATIONS; GroupBoxInformations2->Caption = IDS_INFORMATIONS; GroupBoxCombination->Caption = IDS_COMBINATION; sbUpStyleCombi->Caption = IDS_TOPSTYLECOMBINATION; sbDownStyleCombi->Caption = IDS_BOTTOMSTYLECOMBINATION; cbOtherStyle->Caption = IDS_OTHERSTYLE; GroupBoxLoad->Caption = IDS_LOAD; rbWholeStyle->Caption = IDS_WHOLESTYLE; rbTopStyle->Caption = IDS_TOPSTYLE; rbBottomStyle->Caption = IDS_BOTTOMSTYLE; sbMerge->Caption = IDS_MERGE; sbRead->Caption = IDS_READ; GroupBoxImage->Caption = IDS_IMAGE; sbBack->Hint = IDS_PREVIOUS; sbDelete->Hint = IDS_DELETE; sbImageChange->Hint = IDS_PICTURECHANGE; sbFrontStyle->Hint = IDS_FRONT; sbBackStyle->Hint = IDS_BACK; PopupOpen->Caption = IDS_STYLEOPEN; PopupMerge->Caption = IDS_STYLEMERGE; MenuItemUpStyleOpen->Caption = IDS_STYLEOPEN; MenuItemUpStyleMerge->Caption = IDS_STYLEMERGE; MenuItemDownStyleOpen->Caption = IDS_STYLEOPEN; MenuItemDownStyleMerge->Caption = IDS_STYLEMERGE; PopupCheck->Caption = IDS_CHECKLIST; PopupBringToImage->Caption = IDS_BRINGTHECANVAS; PopupChange->Caption = IDS_BRINGTHEFILE; // 2004.08.17 Ãß°¡ - by monkman sbChangeBaseDirectory->Hint = IDS_SETBASEFOLDER; LabelPatYearSSFW->Caption = IDS_SEASON; LabelPatDivision->Caption = IDS_MAINITEM; LabelPatUpType->Caption = IDS_TOP; LabelPatDnType->Caption = IDS_BOTTOM; LabelPatUpWhole->Caption = IDS_TOPWHOLETYPE; LabelPatUpSilType->Caption = IDS_TOPTYPE; LabelPatUpSil->Caption = IDS_TOPSILHOUETTETYPE; LabelPatUpSle->Caption = IDS_TOPSLEEVETYPE; LabelPatUpCol->Caption = IDS_TOPCOLLARTYPE; LabelPatDnWhole->Caption = IDS_BOTTOMWHOLETYPE; LabelPatDnSil->Caption = IDS_BOTTOMSILHOUETTETYPE; LabelPatDnBelt->Caption = IDS_BOTTOMBELTTYPE; LabelPatYearSSFW2->Caption = IDS_SEASON; LabelPatDivision2->Caption = IDS_MAINITEM; LabelPatUpType2->Caption = IDS_TOP; LabelPatDnType2->Caption = IDS_BOTTOM; LabelPatUpWhole2->Caption = IDS_TOPWHOLETYPE; LabelPatUpSilType2->Caption = IDS_TOPTYPE; LabelPatUpSil2->Caption = IDS_TOPSILHOUETTETYPE; LabelPatUpSle2->Caption = IDS_TOPSLEEVETYPE; LabelPatUpCol2->Caption = IDS_TOPCOLLARTYPE; LabelPatDnWhole2->Caption = IDS_BOTTOMWHOLETYPE; LabelPatDnSil2->Caption = IDS_BOTTOMSILHOUETTETYPE; LabelPatDnBelt2->Caption = IDS_BOTTOMBELTTYPE; } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::FormCreate(TObject *Sender) { TagList = new TList; FileList = new TStringList; // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ - TList·Î »ý¼º.. - by monkman PatUpWhole = new TList; PatUpSil = new TList; PatUpSle = new TList; PatUpCol = new TList; PatDnWhole = new TList; PatDnSil = new TList; PatDnBelt = new TList; Panel1->Visible = true; Panel2->Visible = false; IllustBitmap = NULL; bSwitch = false; } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::FormDestroy(TObject *Sender) { TFileInfor *fi; ExitForm(); while(TagList->Count>0) { fi = (TFileInfor *) TagList->Last(); if (fi->tBitmap) { delete fi->tBitmap; fi->tBitmap = NULL; } TagList->Remove(fi); delete fi; fi = NULL; } delete TagList; FileList->Clear(); delete FileList; // TListµé ÃʱâÈ­ ClearList(); delete PatUpWhole; delete PatUpSil; delete PatUpSle; delete PatUpCol; delete PatDnWhole; delete PatDnSil; delete PatDnBelt; delete IllustBitmap; } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::FormClose(TObject *Sender, TCloseAction &Action) { // ¾Õ¸éÀÎÁö µÞ¸éÀÎÁö üũÇÏ´Â Ç÷¡±× iFlag = 0; //shFrontStyle->Brush->Color = clRed; //shBackStyle->Brush->Color = clBlack; TFileInfor *fi; // ExitForm(); while(TagList->Count>0) { fi = (TFileInfor *) TagList->Last(); if (fi->tBitmap) { delete fi->tBitmap; fi->tBitmap = NULL; } TagList->Remove(fi); delete fi; fi = NULL; } // if (FileList) { delete FileList; FileList = NULL; } // TListµé ÃʱâÈ­ //ClearList(); // ÃʱâÈ­ÇÏÁö ¾Êµµ·Ï º¯°æ - by monkman (2011.02.18) CombiForm->bIsIllustForm = false; ResultForm->bIsIllustForm = false; } //--------------------------------------------------------------------------- // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ - TList¿¡ ´ã°ÜÀÖ´Â µ¥ÀÌÅ͸¦ Áö¿ò - by monkman void __fastcall TStyleIllustForm::ClearList() { TVecData *data; while (PatUpWhole->Count) { data = (TVecData *)PatUpWhole->First(); delete data; PatUpWhole->Remove(data); } while (PatUpSil->Count) { data = (TVecData *)PatUpSil->First(); delete data; PatUpSil->Remove(data); } while (PatUpSle->Count) { data = (TVecData *)PatUpSle->First(); delete data; PatUpSle->Remove(data); } while (PatUpCol->Count) { data = (TVecData *)PatUpCol->First(); delete data; PatUpCol->Remove(data); } while (PatDnWhole->Count) { data = (TVecData *)PatDnWhole->First(); delete data; PatDnWhole->Remove(data); } while (PatDnSil->Count) { data = (TVecData *)PatDnSil->First(); delete data; PatDnSil->Remove(data); } while (PatDnBelt->Count) { data = (TVecData *)PatDnBelt->First(); delete data; PatDnBelt->Remove(data); } } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::InitForm() { // Style.ini ÆÄÀÏ¿¡¼­ ¾ò¾î¿Â STYPath, STIPath °ª - by monkman (2004.07.30) strRootPath = ""; TIniFile *IniFile = NULL; IniFile = new TIniFile(AppDataItem+"\\Style.ini"); if (IniFile) { strRootPath = IniFile->ReadString("StyleIllustForm", "RootPath", DirectoryBin); strSTIFullPath = IniFile->ReadString("StyleIllustForm", "STIFullPath", ""); if (strSTIFullPath.IsEmpty()) { strSTIFullPath = strRootPath+"\\stiSample"; } strSTYDirectory = IniFile->ReadString("StyleIllustForm", "STYDirectory", strSTYDirectory); if (!DirectoryExists(strRootPath+"\\"+strSTYDirectory)) { if (!DirectoryExists(strRootPath)) { strRootPath = DirectoryBin; IniFile->WriteString("StyleIllustForm", "RootPath", strRootPath); } strSTYDirectory = ""; IniFile->WriteString("StyleIllustForm", "STYDirectory", strSTYDirectory); } if (!DirectoryExists(strSTIFullPath)) { strSTIFullPath = DirectoryBin+"\\stiSample"; IniFile->WriteString("StyleIllustForm", "STIFullPath", strSTIFullPath); } delete IniFile; } IniFile = NULL; // ±âº» °æ·Î ¼ÂÆÃ DirectoryListBox1->Directory = strSTIFullPath; bSwitch = true; DriveComboBox1->Drive = strSTIFullPath.c_str()[0]; bSwitch = false; // ¼±ÅõǾîÀÖ´Â ÆÄÀÏÀÇ °æ·Î - by monkman (2004.07.05) SelectedFilePath = ""; // ¾Õ¸éÀÎÁö µÞ¸éÀÎÁö üũÇÏ´Â Ç÷¡±× iFlag = 0; //shFrontStyle->Brush->Color = clRed; //shBackStyle->Brush->Color = clBlack; // Visible = true; InitData(); // ½ºÅ¸ÀÏ Á¤º¸ ÃʱâÈ­ InitInformation(); // Æû Å©±â Á¶Àý Width = Panel1->Left * 2 + Panel1->Width; Height = Panel1->Top * 2 + Panel1->Height + GetSystemMetrics(SM_CYCAPTION); Left = (Screen->Width - Width); Top = 0; Visible = true; // µð·ºÅ丮 °ü·Ã - by monkman (2004.05.27) FindFolder(strRootPath + "\\*.*"); //comboSource->ItemIndex = 0; // Style.ini ÆÄÀÏ¿¡¼­ ¾ò¾î¿Â STYPath °ª - by monkman (2004.10.12) 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]; } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::ExitForm() { } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::InitData() { HANDLE hSrch, hFile = INVALID_HANDLE_VALUE; WIN32_FIND_DATA wfd; String path, filename; bool result = true; TFileInfor *fi; while(TagList->Count>0) { fi = (TFileInfor *) TagList->Last(); if (fi->tBitmap) { delete fi->tBitmap; fi->tBitmap = NULL; } TagList->Remove(fi); delete fi; fi = NULL; } FileList->Clear(); path = DirectoryListBox1->Directory + "\\*.sti"; if ((hSrch = FindFirstFile(path.c_str(), &wfd)) != INVALID_HANDLE_VALUE) { while (result) { filename = DirectoryListBox1->Directory + "\\" + wfd.cFileName; FileList->Add(filename); result = FindNextFile(hSrch, &wfd); } } FindClose(hSrch); FileList->Sort(); if (FileList->Count) { PatTagFileToRead(); } TagGrid->Repaint(); } //--------------------------------------------------------------------------- // ½ºÅ¸ÀÏ Á¤º¸ ÃʱâÈ­ - by monkman void __fastcall TStyleIllustForm::InitInformation() { // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ ÃʱâÈ­ - by monkman // Year LabelPatYearSSFW->Font->Color = clSilver; LabelIllustYearSSFW->Caption = ""; LabelPatYearSSFW2->Font->Color = clSilver; LabelIllustYearSSFW2->Caption = ""; // Disivion LabelPatDivision->Font->Color = clSilver; LabelIllustDivision->Caption = ""; LabelPatDivision2->Font->Color = clSilver; LabelIllustDivision2->Caption = ""; // Top Type LabelPatUpType->Font->Color = clSilver; LabelIllustUpType->Caption = ""; LabelPatUpType2->Font->Color = clSilver; LabelIllustUpType2->Caption = ""; // Bottom Type LabelPatDnType->Font->Color = clSilver; LabelIllustDnType->Caption = ""; LabelPatDnType2->Font->Color = clSilver; LabelIllustDnType2->Caption = ""; // Top Whole Style LabelPatUpWhole->Font->Color = clSilver; LabelIllustUpWhole->Caption = ""; LabelPatUpWhole2->Font->Color = clSilver; LabelIllustUpWhole2->Caption = ""; // Top Silhouette Tyle LabelPatUpSilType->Font->Color = clSilver; LabelIllustUpSilType->Caption = ""; LabelPatUpSilType2->Font->Color = clSilver; LabelIllustUpSilType2->Caption = ""; // Top Silhouette LabelPatUpSil->Font->Color = clSilver; LabelIllustUpSil->Caption = ""; LabelPatUpSil2->Font->Color = clSilver; LabelIllustUpSil2->Caption = ""; // Top Sleeve LabelPatUpSle->Font->Color = clSilver; LabelIllustUpSle->Caption = ""; LabelPatUpSle2->Font->Color = clSilver; LabelIllustUpSle2->Caption = ""; // Top Collar LabelPatUpCol->Font->Color = clSilver; LabelIllustUpCol->Caption = ""; LabelPatUpCol2->Font->Color = clSilver; LabelIllustUpCol2->Caption = ""; // Bottom Whole Style LabelPatDnWhole->Font->Color = clSilver; LabelIllustDnWhole->Caption = ""; LabelPatDnWhole2->Font->Color = clSilver; LabelIllustDnWhole2->Caption = ""; // Bottom Silhouette LabelPatDnSil->Font->Color = clSilver; LabelIllustDnSil->Caption = ""; LabelPatDnSil2->Font->Color = clSilver; LabelIllustDnSil2->Caption = ""; // Bottom Belt LabelPatDnBelt->Font->Color = clSilver; LabelIllustDnBelt->Caption = ""; LabelPatDnBelt2->Font->Color = clSilver; LabelIllustDnBelt2->Caption = ""; } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::DirectoryListBox1Change(TObject *Sender) { // Style.ini ÆÄÀÏ¿¡ ¾µ STIPath °ª - by monkman (2004.07.30) TIniFile *IniFile = NULL; IniFile = new TIniFile(AppDataItem+"\\Style.ini"); if (IniFile) { strSTIFullPath = DirectoryListBox1->Directory; IniFile->WriteString("StyleIllustForm", "STIFullPath", strSTIFullPath); delete IniFile; } IniFile = NULL; InitData(); // ½ºÅ¸ÀÏ Á¤º¸ ÃʱâÈ­ InitInformation(); TagGrid->Col = 0; TagGrid->Row = 0; } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::DriveComboBox1Change(TObject *Sender) { if (!bSwitch) { DirectoryListBox1->Drive = DriveComboBox1->Drive; // Style.ini ÆÄÀÏ¿¡ ¾µ STIPath °ª - by monkman (2004.07.30) TIniFile *IniFile = NULL; IniFile = new TIniFile(AppDataItem+"\\Style.ini"); if (IniFile) { strSTIFullPath = DirectoryListBox1->Directory; IniFile->WriteString("StyleIllustForm", "STIFullPath", strSTIFullPath); delete IniFile; } IniFile = NULL; } } //--------------------------------------------------------------------------- // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ - File¿¡¼­ Tag ºÎºÐÀ» Àоî¿Â´Ù - by monkman bool __fastcall TStyleIllustForm::PatTagFileToRead() { // ÆÄÀÏ Çì´õ¿ë HANDLE hFile = INVALID_HANDLE_VALUE; DWORD dwRead; char CompareFileType[18] = "StylistIllustFile"; int Version; // ±âŸ String filename, temp; char *tempchar = "\\"; // Tag¿ë TFileInfor *fi; for (int i = 0; i < FileList->Count; i++) { filename = FileList->Strings[i]; // 1. Çì´õ¸¦ Àд´٠// *.sty ÆÄÀÏÀ» ¹öÀü º°·Î ÀÐ°í º¯È¯ÇÑ´Ù - by monkman (2004.03.30) if ((hFile = CreateFile(filename.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto fail; IllustHeader = VecDraw->ReadSTIFileHeader(hFile, filename, &Version); // Version¿¡ µû¶ó ÇØ¾ßÇÒ ÀÛ¾÷ÀÌ ÀÖ´Ù¸é ÀÌ °÷¿¡¼­ ÇÑ´Ù - by monkman (2004.11.03) // 100 : // 200 : // 205 : Gdiplus Àû¿ë ÈÄ º¯°æ (05.03.09) // 206 : groupIndex º¯°æ & gradient fill Ãß°¡ (08.05.08) // 207 : MotiveObject Ãß°¡ - by monkman (2009.04.03) // 500 : (¿µ¿ì ÆÇ¸Å¿ë µ¥ÀÌÅÍ) // 505 : Gdiplus Àû¿ë ÈÄ º¯°æ (05.03.09) // 506 : roupIndex º¯°æ & gradient fill Ãß°¡ (08.05.08) // 507 : MotiveObject Ãß°¡ - by monkman (2009.04.03) if (500 <= Version) { #ifndef NOT_STYLEDATA_LOCK // HASP°ú üũ ÇÑ´Ù if (!STILockValidate(hFile, IllustHeader)) goto fail; else break; #endif /* // ¸Þ½ÃÁö : ÆÄÀÏ Å¸ÀÔÀÌ ´Ù¸¨´Ï´Ù.\nÆÄÀϰæ·Î : String ErrorMsg = String(IDS_MESSAGE1); ErrorMsg = ErrorMsg + filename; MessageDlg(ErrorMsg, mtWarning, TMsgDlgButtons() << mbOK, 0); goto fail; */ } if (!IllustHeader.Version) goto fail; else { // StylistIllustFile ÆÄÀÏÀÌ ¸Â´ÂÁö üũ if (strcmp(IllustHeader.FileType, CompareFileType)) { // ¸Þ½ÃÁö : ÆÄÀÏ Å¸ÀÔÀÌ ´Ù¸¨´Ï´Ù.\nÆÄÀϰæ·Î : //String ErrorMsg = String(IDS_MESSAGE1); //ErrorMsg = ErrorMsg + filename; //MessageDlg(ErrorMsg, mtWarning, TMsgDlgButtons() << mbOK, 0); goto fail; } // 2. Tag¸¦ Àд´٠fi = new TFileInfor; fi->Depth = i; // ÆÄÀÏ ÆÐ½º¸¦ ÀúÀå fi->Path = FileList->Strings[i]; // ÆÄÀÏ À̸§À» ÀúÀå temp = ""; // ¹Ýµå½Ã ÃʱâÈ­ ÇØÁÖ¾î¾ß ÇÑ´Ù.. ÃʱâÈ­¸¦ ÇØÁÖÁö ¾ÊÀ¸¸é °è¼Ó ´©ÀûµÈ´Ù.. filename = fi->Path; while (char(filename[filename.Length()]) != *tempchar) { temp = String(filename[filename.Length()]) + temp; filename.SetLength(filename.Length()-1); } fi->Name = temp; // Tag¸¦ Àбâ À§ÇÑ ÀÛ¾÷ if ((fi->tBitmap = new TTexpiaBitmap) == NULL) { //if (dcTemp) fi->tBitmap->DeleteDC(dcTemp); if (fi) { delete fi; fi = NULL; } } fi->tBitmap->Create(200, 250, 24); fi->tBitmap->LoadFromTexpiaFile(hFile, cmNone); TagList->Add(fi); } fail: CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; } return true; } //--------------------------------------------------------------------------- // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ - FileInfor¿¡¼­ ÀÐÀº Tag¸¦ StringGrid Cell¿¡ »Ñ¸°´Ù - by monkman void __fastcall TStyleIllustForm::TagGridDrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect, TGridDrawState State) { TFileInfor *fi; HDC hDC = NULL; TRect r; String text; int width, height; if ((ARow*3+ACol) < TagList->Count && TagList->Count) { fi = (TFileInfor *) TagList->Items[ARow*3+ACol]; if ((hDC = fi->tBitmap->CreateDC()) == NULL) goto fail; // BitBlt(TagGrid->Canvas->Handle, Rect.Left+5, Rect.Top+5, fi->tBitmap->Width, fi->tBitmap->Height, hDC, 0, 0, SRCCOPY); // fi->tBitmap->DeleteDC(hDC); // ¾î´ÀÂÊÀÌ ÀåÃàÀÎÁö ºñ±³.. ÀåÃà¿¡ µû¶ó ºñÀ²ÀÌ °áÁ¤µÇ°í ±× ºñÀ²¿¡ µû¶ó // ÆäÀÎÆ® ¹Ú½º¿¡ ±×¸°´Ù if (fi->tBitmap->Width >= fi->tBitmap->Height) { width = double(double(fi->tBitmap->Width) * (130.0 / double(fi->tBitmap->Width))) + 0.5; height = double(double(fi->tBitmap->Height) * (130.0 / double(fi->tBitmap->Width))) + 0.5; } else { width = double(double(fi->tBitmap->Width) * (160.0 / double(fi->tBitmap->Height))) + 0.5; height = double(double(fi->tBitmap->Height) * (160.0 / double(fi->tBitmap->Height))) + 0.5; } SetStretchBltMode(TagGrid->Canvas->Handle, COLORONCOLOR); StretchBlt(TagGrid->Canvas->Handle, Rect.Left+2, Rect.Top+2, width-4, height-4, hDC, 0,0, fi->tBitmap->Width, fi->tBitmap->Height, SRCCOPY); fi->tBitmap->DeleteDC(hDC); // ¼¿ ¹øÈ£ text = String(ARow*3+ACol+1); r.Left = Rect.Left+2; r.Top = Rect.Top+162; r.Right = Rect.Left+126; r.Bottom = Rect.Top+186; TagGrid->Canvas->TextRect(r, r.left, r.top, text); // ÆÄÀÏ À̸§ r.Left = Rect.Left+2; r.Top = Rect.Top+175; r.Right = Rect.Left+126; r.Bottom = Rect.Bottom; TagGrid->Canvas->TextRect(r, r.left, r.top, fi->Name); } fail: } //--------------------------------------------------------------------------- // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ - StringGrid¸¦ Ŭ¸¯ÇßÀ» ¶§ ±×¿¡ ´ëÇÑ Á¤º¸ Ãâ·Â - by monkman void __fastcall TStyleIllustForm::TagGridClick(TObject *Sender) { // ÆÄÀÏ Çì´õ¿ë HANDLE hFile = INVALID_HANDLE_VALUE; // µ¥ÀÌÅÍ¿ë TVecData *data; DWORD dwRead; String filename, temp; char *tempchar = "\\"; int Version; TFileInfor*fi; // Panel1ÀÌ È°¼ºÈ­µÇ¾î ÀÖÁö ¾ÊÀ¸¸é ÃʱâÈ­ µÇÁö ¾Ê´Â´Ù - by monkman (2004.04.16) if (!Panel1->Visible) return; // ½ºÅ¸ÀÏ Á¤º¸ ÃʱâÈ­ InitInformation(); // ¸î ¹øÂ° ¼¿À» Âï¾ú´ÂÁö ¼¿¹øÈ£¸¦ ¾ò¾î¿À°í, ±× ¹øÈ£¿¡ ÇØ´çÇÏ´Â ÆÄÀÏÀ» fi¿¡¼­ °¡Á®¿Â ÈÄ // Á¤º¸¸¦ °¡Á®¿Â´Ù if ((row*3+col) < TagList->Count && TagList->Count) { fi = (TFileInfor *) TagList->Items[row*3 + col]; // 1. Çì´õ¸¦ Àд´٠// *.sty ÆÄÀÏÀ» ¹öÀü º°·Î ÀÐ°í º¯È¯ÇÑ´Ù - by monkman (2004.03.30) if ((hFile = CreateFile(fi->Path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto fail; IllustHeader = VecDraw->ReadSTIFileHeader(hFile, fi->Path, &Version); // Version¿¡ µû¶ó ÇØ¾ßÇÒ ÀÛ¾÷ÀÌ ÀÖ´Ù¸é ÀÌ °÷¿¡¼­ ÇÑ´Ù - by monkman (2004.11.03) // 100 : // 200 : // 205 : Gdiplus Àû¿ë ÈÄ º¯°æ (05.03.09) // 206 : groupIndex º¯°æ & gradient fill Ãß°¡ (08.05.08) // 207 : MotiveObject Ãß°¡ - by monkman (2009.04.03) // 500 : (¿µ¿ì ÆÇ¸Å¿ë µ¥ÀÌÅÍ) // 505 : Gdiplus Àû¿ë ÈÄ º¯°æ (05.03.09) // 506 : roupIndex º¯°æ & gradient fill Ãß°¡ (08.05.08) // 507 : MotiveObject Ãß°¡ - by monkman (2009.04.03) if (500 <= Version) { #ifndef NOT_STYLEDATA_LOCK // HASP°ú üũ ÇÑ´Ù if (!STILockValidate(hFile, IllustHeader)) goto fail; #endif /* // ¸Þ½ÃÁö : ÆÄÀÏ Å¸ÀÔÀÌ ´Ù¸¨´Ï´Ù.\nÆÄÀϰæ·Î : String ErrorMsg = String(IDS_MESSAGE1); ErrorMsg = ErrorMsg + filename; MessageDlg(ErrorMsg, mtWarning, TMsgDlgButtons() << mbOK, 0); goto fail; */ } if (!IllustHeader.Version) goto fail; else { if (IllustHeader.Year > 0 || IllustHeader.SSFW != 0) { LabelPatYearSSFW->Font->Color = clWindowText; LabelIllustYearSSFW->Caption = " : "; } if (IllustHeader.Year > 0) { LabelIllustYearSSFW->Caption = LabelIllustYearSSFW->Caption + IntToStr(IllustHeader.Year); } // SeasonÀ» Àд´٠- by monkman (2004.04.13) if (IllustHeader.SSFW != 0) { for (int i=0; i < 8; i++) { if (((IllustHeader.SSFW >> i) & 1) == 1) { switch (i) { // Spring case SSFW_SPRING : LabelIllustYearSSFW->Caption = LabelIllustYearSSFW->Caption + String(" Spring "); break; // Summer case SSFW_SUMMER : LabelIllustYearSSFW->Caption = LabelIllustYearSSFW->Caption + String(" Summer "); break; // Fall case SSFW_FALL : LabelIllustYearSSFW->Caption = LabelIllustYearSSFW->Caption + String(" Fall "); break; // Winter case SSFW_WINTER : LabelIllustYearSSFW->Caption = LabelIllustYearSSFW->Caption + String(" Winter "); break; default : LabelIllustYearSSFW->Caption = ""; break; } } } } LabelPatDivision->Font->Color = clWindowText; LabelIllustDivision->Caption = " : " + CombiForm->DivisionName[IllustHeader.Division]; DSItems.Clear(); switch (IllustHeader.Division) { // Man case DV_MAN : DSItems << VecDraw->Man_Upper; DSItems << VecDraw->Man_Lower; break; // Woman case DV_WOMAN : DSItems << VecDraw->Woman_Upper; DSItems << VecDraw->Woman_Lower; break; // Child case DV_CHILD : DSItems << VecDraw->Child_Upper; DSItems << VecDraw->Child_Lower; break; // Baby case DV_BABY : DSItems << VecDraw->Child_Upper; DSItems << VecDraw->Child_Lower; break; // None default : LabelPatDivision->Caption = "Main Items"; LabelPatDivision->Font->Color = clSilver; LabelIllustDivision->Caption = ""; break; } // Top Type if (DSItems.Contains(EType(IllustHeader.Type1))) { LabelPatUpType->Font->Color = clWindowText; LabelIllustUpType->Caption = " : " + CombiForm->StrType[IllustHeader.Type1]; } // Bottom Type if (DSItems.Contains(EType(IllustHeader.Type2))) { LabelPatDnType->Font->Color = clWindowText; LabelIllustDnType->Caption = " : " + CombiForm->StrType[IllustHeader.Type2]; } // 4byte À̹ǷÎ.. for (int i=0; i < 32; i++) { if (((IllustHeader.UpDown >> i) & 1) == 1) { switch (i) { case SORT_TOPSILHOUETTE: // Top Sihoutette LabelPatUpSilType->Font->Color = clWindowText; switch (IllustHeader.EMethod) { case 1: LabelIllustUpSilType->Caption = " : NORMAL"; break; case 2: LabelIllustUpSilType->Caption = " : 3POINTS"; break; case 3: LabelIllustUpSilType->Caption = " : RAGLAN"; break; default : LabelIllustUpSilType->Caption = ""; break; } LabelPatUpSil->Font->Color = clWindowText; // »óÀÇ ´ëÇ¥ ½ºÅ¸ÀÏÀÌ ¾øÀ» °æ¿ì NoneÀ¸·Î ó¸® - by monkman if (IllustHeader.ESilhouette != 0) { LabelIllustUpSil->Caption = " : " + VecDraw->SilhouetteName[IllustHeader.ESilhouette]; } else { LabelIllustUpSil->Caption = " : None"; } break; case SORT_TOPSLEEVE : // Top Sleeve LabelPatUpSle->Font->Color = clWindowText; if (IllustHeader.ESleeve != 0) { LabelIllustUpSle->Caption = " : " + VecDraw->SleeveName[IllustHeader.ESleeve]; } break; case SORT_TOPCOLLAR : // Top Collar LabelPatUpCol->Font->Color = clWindowText; if (IllustHeader.ECollar != 0) { LabelIllustUpCol->Caption = " : " + VecDraw->CollarName[IllustHeader.ECollar]; } break; case SORT_TOPWHOLESTYLE : // Top Whole Style LabelPatUpWhole->Font->Color = clWindowText; break; case SORT_BOTTOMSILHOUETTE : // Bottom Silhouette LabelPatDnSil->Font->Color = clWindowText; if (IllustHeader.EPants != 0) { LabelIllustDnSil->Caption = " : " + VecDraw->PantsName[IllustHeader.EPants]; } break; case SORT_BOTTOMBELT : // Bottom Belt LabelPatDnBelt->Font->Color = clWindowText; if (IllustHeader.EBelt != 0) { LabelIllustDnBelt->Caption = " : " + VecDraw->BeltName[IllustHeader.EBelt]; } break; case SORT_BOTTOMWHOLESTYLE : // Bottom Whole Style LabelPatDnWhole->Font->Color = clWindowText; break; } } } } fail: CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; } } //--------------------------------------------------------------------------- // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ - StringGrid¸¦ ´õºíŬ¸¯ÇßÀ» ¶§ ÆÄÀÏ¿¡¼­ Á¤º¸¸¦ Àоî¿Í¼­ - by monkman void __fastcall TStyleIllustForm::TagGridMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { TGridCoord grid = TagGrid->MouseCoord(X, Y); if (Button != mbLeft) return; col = grid.X; row = grid.Y; } //--------------------------------------------------------------------------- // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ - StringGrid¸¦ ´õºíŬ¸¯ÇßÀ» ¶§ ÆÄÀÏ¿¡¼­ Á¤º¸¸¦ Àоî¿Í¼­ // VecDraw->pList¿¡ ³Ö¾îÁØ´Ù - by monkman void __fastcall TStyleIllustForm::TagGridDblClick(TObject *Sender) { // ÆÄÀÏ Çì´õ¿ë HANDLE hFile = INVALID_HANDLE_VALUE; // µ¥ÀÌÅÍ¿ë TVecData *data; DWORD dwRead; String filename, temp; char *tempchar = "\\"; TFileInfor* fi; // ±×¸®±â ¿ë int w, h, bpp; int Version; // ½ºÅ¸ÀÏ Á¤º¸ ÃʱâÈ­ InitInformation(); // Header ÃʱâÈ­ VecDraw->InitSTYHeader(&HDPatUpWhole); VecDraw->InitSTYHeader(&HDPatUpSil); VecDraw->InitSTYHeader(&HDPatUpSle); VecDraw->InitSTYHeader(&HDPatUpCol); VecDraw->InitSTYHeader(&HDPatDnWhole); VecDraw->InitSTYHeader(&HDPatDnSil); VecDraw->InitSTYHeader(&HDPatDnBelt); // TListµé ÃʱâÈ­ ClearList(); // »ó, ÇÏÀ§ ÀÚµ¿ Á¶ÇÕ ¹öư ÃʱâÈ­ sbUpStyleCombi->Enabled = false; sbDownStyleCombi->Enabled = false; // ¸î ¹øÂ° ¼¿À» Âï¾ú´ÂÁö ¼¿¹øÈ£¸¦ ¾ò¾î¿À°í, ±× ¹øÈ£¿¡ ÇØ´çÇÏ´Â ÆÄÀÏÀ» fi¿¡¼­ °¡Á®¿Â ÈÄ // Á¤º¸¸¦ °¡Á®¿Â´Ù if ((row*3+col) < TagList->Count && TagList->Count) { fi = (TFileInfor *) TagList->Items[row*3 + col]; // ¼±ÅõǾîÀÖ´Â ÆÄÀÏÀÇ °æ·Î - by monkman (2004.07.05) SelectedFilePath = fi->Path; // 1. Çì´õ¸¦ Àд´٠// *.sty ÆÄÀÏÀ» ¹öÀü º°·Î ÀÐ°í º¯È¯ÇÑ´Ù - by monkman (2004.03.30) if ((hFile = CreateFile(fi->Path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto fail; IllustHeader = VecDraw->ReadSTIFileHeader(hFile, fi->Path, &Version); // Version¿¡ µû¶ó ÇØ¾ßÇÒ ÀÛ¾÷ÀÌ ÀÖ´Ù¸é ÀÌ °÷¿¡¼­ ÇÑ´Ù - by monkman (2004.11.03) // 100 : // 200 : // 205 : Gdiplus Àû¿ë ÈÄ º¯°æ (05.03.09) // 206 : groupIndex º¯°æ & gradient fill Ãß°¡ (08.05.08) // 207 : MotiveObject Ãß°¡ - by monkman (2009.04.03) // 500 : (¿µ¿ì ÆÇ¸Å¿ë µ¥ÀÌÅÍ) // 505 : Gdiplus Àû¿ë ÈÄ º¯°æ (05.03.09) // 506 : roupIndex º¯°æ & gradient fill Ãß°¡ (08.05.08) // 507 : MotiveObject Ãß°¡ - by monkman (2009.04.03) if(Version < 205){ sbImageChange->Enabled = false; } if (500 <= Version) { #ifndef NOT_STYLEDATA_LOCK // HASP°ú üũ ÇÑ´Ù if (!STILockValidate(hFile, IllustHeader)) goto fail; #endif /* // ¸Þ½ÃÁö : ÆÄÀÏ Å¸ÀÔÀÌ ´Ù¸¨´Ï´Ù.\nÆÄÀϰæ·Î : String ErrorMsg = String(IDS_MESSAGE1); ErrorMsg = ErrorMsg + filename; MessageDlg(ErrorMsg, mtWarning, TMsgDlgButtons() << mbOK, 0); goto fail; */ } if (!IllustHeader.Version) goto fail; else { if (IllustHeader.Year > 0 || IllustHeader.SSFW != 0 ) { LabelPatYearSSFW2->Font->Color = clWindowText; LabelIllustYearSSFW2->Caption = " : "; } if (IllustHeader.Year > 0) { LabelIllustYearSSFW2->Caption = LabelIllustYearSSFW2->Caption + IntToStr(IllustHeader.Year); } // SeasonÀ» Àд´٠- by monkman (2004.04.13) if (IllustHeader.SSFW != 0) { for (int i=0; i < 8; i++) { if (((IllustHeader.SSFW >> i) & 1) == 1) { switch (i) { // Spring case SSFW_SPRING : LabelIllustYearSSFW2->Caption = LabelIllustYearSSFW2->Caption + String(" Spr "); break; // Summer case SSFW_SUMMER : LabelIllustYearSSFW2->Caption = LabelIllustYearSSFW2->Caption + String(" Sum "); break; // Fall case SSFW_FALL : LabelIllustYearSSFW2->Caption = LabelIllustYearSSFW2->Caption + String(" Fall "); break; // Winter case SSFW_WINTER : LabelIllustYearSSFW2->Caption = LabelIllustYearSSFW2->Caption + String(" Win "); break; default : LabelIllustYearSSFW2->Caption = ""; break; } } } } LabelPatDivision2->Font->Color = clWindowText; LabelIllustDivision2->Caption = " : " + CombiForm->DivisionName[IllustHeader.Division]; DSItems.Clear(); switch (IllustHeader.Division) { // Man case DV_MAN : DSItems << VecDraw->Man_Upper; DSItems << VecDraw->Man_Lower; break; // Woman case DV_WOMAN : DSItems << VecDraw->Woman_Upper; DSItems << VecDraw->Woman_Lower; break; // Child case DV_CHILD : DSItems << VecDraw->Child_Upper; DSItems << VecDraw->Child_Lower; break; // Baby case DV_BABY : DSItems << VecDraw->Baby_Upper; DSItems << VecDraw->Baby_Lower; break; // None default : LabelPatDivision2->Caption = "Main Items"; LabelPatDivision2->Font->Color = clSilver; LabelIllustDivision2->Caption = ""; break; } // Top Type if (DSItems.Contains(EType(IllustHeader.Type1))) { LabelPatUpType2->Font->Color = clWindowText; LabelIllustUpType2->Caption = " : " + CombiForm->StrType[IllustHeader.Type1]; } // Bottom Type if (DSItems.Contains(EType(IllustHeader.Type2))) { LabelPatDnType2->Font->Color = clWindowText; LabelIllustDnType2->Caption = " : " + CombiForm->StrType[IllustHeader.Type2]; } // 4byte À̹ǷÎ.. for (int i=0; i < 32; i++) { if (((IllustHeader.UpDown >> i) & 1) == 1) { switch (i) { case SORT_TOPSILHOUETTE : // Top Sihoutette LabelPatUpSilType2->Font->Color = clWindowText; switch (IllustHeader.EMethod) { case 1: LabelIllustUpSilType2->Caption = " : NORMAL"; break; case 2: LabelIllustUpSilType2->Caption = " : 3POINTS"; break; case 3: LabelIllustUpSilType2->Caption = " : RAGLAN"; break; default : LabelIllustUpSilType2->Caption = ""; break; } LabelPatUpSil2->Font->Color = clWindowText; // »óÀÇ ´ëÇ¥ ½ºÅ¸ÀÏÀÌ ¾øÀ» °æ¿ì NoneÀ¸·Î ó¸® - by monkman (2004.04.14) if (IllustHeader.ESilhouette != 0) { LabelIllustUpSil2->Caption = " : " + VecDraw->SilhouetteName[IllustHeader.ESilhouette]; } else { LabelIllustUpSil2->Caption = " : None"; } break; case SORT_TOPSLEEVE : // Top Sleeve LabelPatUpSle2->Font->Color = clWindowText; if (IllustHeader.ESleeve != 0) { LabelIllustUpSle2->Caption = " : " + VecDraw->SleeveName[IllustHeader.ESleeve]; } break; case SORT_TOPCOLLAR : // Top Collar LabelPatUpCol2->Font->Color = clWindowText; if (IllustHeader.ECollar != 0) { LabelIllustUpCol2->Caption = " : " + VecDraw->CollarName[IllustHeader.ECollar]; } break; case SORT_TOPWHOLESTYLE : // Top Whole Style LabelPatUpWhole2->Font->Color = clWindowText; // »óÀ§ ÀÚµ¿ Á¶ÇÕ °¡´ÉÇÏ°Ô ¸¸µç´Ù.. sbUpStyleCombi->Enabled = true; break; case SORT_BOTTOMSILHOUETTE : // Down Silhouette LabelPatDnSil2->Font->Color = clWindowText; if (IllustHeader.EPants != 0) { LabelIllustDnSil2->Caption = " : " + VecDraw->PantsName[IllustHeader.EPants]; } break; case SORT_BOTTOMBELT : // Down Belt LabelPatDnBelt2->Font->Color = clWindowText; if (IllustHeader.EBelt != 0) { LabelIllustDnBelt2->Caption = " : " + VecDraw->BeltName[IllustHeader.EBelt]; } break; case SORT_BOTTOMWHOLESTYLE : // Down Whole Style LabelPatDnWhole2->Font->Color = clWindowText; // ÇÏÀ§ ÀÚµ¿ Á¶ÇÕÀÌ °¡´ÉÇÏ°Ô ²û ¸¸µç´Ù.. sbDownStyleCombi->Enabled = true; break; } } } } // 2. Tag¸¦ °Ç³Ê¶Ú´Ù if (SetFilePointer(hFile, 150000, NULL, FILE_CURRENT)== 0xFFFFFFFF) goto fail; else { // 3. Data¸¦ Àд´٠// 4byte À̹ǷÎ.. for (int i=0; i < 32; i++) { if (((IllustHeader.UpDown >> i) & 1) == 1) { switch (i) { case SORT_TOPSILHOUETTE : // Top Silhouette if (!LoadFromIllustFile(HDPatUpSil, hFile, fi->Path, PatUpSil)) goto fail; break; case SORT_TOPSLEEVE : // Top Sleeve if (!LoadFromIllustFile(HDPatUpSle, hFile, fi->Path, PatUpSle)) goto fail; break; case SORT_TOPCOLLAR : // Top Collar if (!LoadFromIllustFile(HDPatUpCol, hFile, fi->Path, PatUpCol)) goto fail; break; case SORT_TOPWHOLESTYLE : // Top Whole Style if (!LoadFromIllustFile(HDPatUpWhole, hFile, fi->Path, PatUpWhole)) goto fail; break; case SORT_BOTTOMSILHOUETTE : // Bottom Silhouette if (!LoadFromIllustFile(HDPatDnSil, hFile, fi->Path, PatDnSil)) goto fail; break; case SORT_BOTTOMBELT : // Bottom Belt if (!LoadFromIllustFile(HDPatDnBelt, hFile, fi->Path, PatDnBelt)) goto fail; break; case SORT_BOTTOMWHOLESTYLE : // Bottom Whole Style if (!LoadFromIllustFile(HDPatDnWhole, hFile, fi->Path, PatDnWhole)) goto fail; break; } } } } // 4. TTexpiaBitmapÀ» ÀÐ°í ±×·ÁÁØ´Ù if (!ReadFile(hFile, &w, sizeof(int), &dwRead, NULL)) goto fail; if (!ReadFile(hFile, &h, sizeof(int), &dwRead, NULL)) goto fail; if (!ReadFile(hFile, &bpp, sizeof(int), &dwRead, NULL)) goto fail; if (IllustBitmap) { delete IllustBitmap; IllustBitmap = NULL; } IllustBitmap = new TTexpiaBitmap; if (!IllustBitmap->Create(w, h, bpp)) goto fail; if (!IllustBitmap->LoadFromTexpiaFile(hFile, cmZLib)) goto fail; if(!IllustBitmap) goto fail; CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; progbarCombination->Position = 0; Panel2->Visible = true; Panel2->Enabled = true; Panel1->Visible = false; Panel1->Enabled = false; Panel2->SetFocus(); // Æû Å©±â Á¶Àý Width = Panel2->Left * 2 + Panel2->Width; Height = Panel2->Top * 2 + Panel2->Height + GetSystemMetrics(SM_CYCAPTION); Left = (Screen->Width - Width); Top = 0; PaintBoxUpStyle->Repaint(); PaintBoxDownStyle->Repaint(); PaintBoxImage->Repaint(); } return; fail: CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; } //--------------------------------------------------------------------------- // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ ºÒ·¯¿À±â ó¸® ºÎºÐ - by monkman bool __fastcall TStyleIllustForm::LoadFromIllustFile(STYLEDATAFILEHEADER &header, HANDLE hFile, String filename, TList *list) { TVecData *data; DWORD dwRead; String temp; int Version; // int linecount, wordcount, lineheight; // TSWordData *srcWordData; // 1. Çì´õ¸¦ Àд´٠// *.sty ÆÄÀÏÀ» ¹öÀü º°·Î ÀÐ°í º¯È¯ÇÑ´Ù - by monkman (2004.03.30) //if ((hFile = CreateFile(filename.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto fail; header = VecDraw->ReadSTYFileHeader(hFile, filename, &Version, false); // ±âÁ¸¿¡ ¹öÀüÀÌ 0À¸·Î ¸¸µé¾îÁø ÆÄÀÏÀÌ À־ ¾î¿ ¼ö ¾øÀÌ Ãß°¡Çß´Ù - by monkman (2010.08.20) if (!((0 == header.Version) || (100 <= header.Version && header.Version <= STYSTIFileVersion) || (500 <= header.Version && header.Version <= (STYSTIFileVersion+300)))) { // »óÀ§ ¹öÀü üũ - by monkman (2009.05.26) MessageDlg(IDS_MESSAGE_NEWERVERSIONFILE, mtInformation, TMsgDlgButtons() << mbOK, 0); goto fail; } for (int i = 0; i < header.Count1; i++) { if ((data = new TVecData(0))==NULL) goto fail; // TVecData(0) : ¾ÕÆÇ, TVecData(1) : µÞÆÇ VecDraw->LoadFromSTYFile(hFile, data, header.Version); list->Add(data); } for (int i = header.Count1; i < (header.Count1 + header.Count2); i++) { if ((data = new TVecData(1))==NULL) goto fail; // TVecData(0) : ¾ÕÆÇ, TVecData(1) : µÞÆÇ VecDraw->LoadFromSTYFile(hFile, data, header.Version); list->Add(data); } return true; fail: return false; } //--------------------------------------------------------------------------- // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ.. ÀÌÀüÀ¸·Î - by monkman void __fastcall TStyleIllustForm::sbBackClick(TObject *Sender) { Panel1->Visible = true; Panel1->Enabled = true; Panel2->Visible = false; Panel2->Enabled = false; // Æû Å©±â Á¶Àý Width = Panel1->Left * 2 + Panel1->Width; Height = Panel1->Top * 2 + Panel1->Height + GetSystemMetrics(SM_CYCAPTION); Left = (Screen->Width - Width); Top = 0; if (IllustBitmap) { delete IllustBitmap; IllustBitmap = NULL; } // À̹ÌÁö¸¦ ¹Ù²Ù¾úÀ»Áö ¸ð¸£¹Ç·Î ÃʱâÈ­ÇÑ´Ù.. InitData(); // ½ºÅ¸ÀÏ Á¤º¸ ÃʱâÈ­ InitInformation(); } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::PaintBoxImagePaint(TObject *Sender) { int width, height; HDC dcSrc = NULL; if ((dcSrc = IllustBitmap->CreateDC())==NULL) goto fail; // ¾î´ÀÂÊÀÌ ÀåÃàÀÎÁö ºñ±³.. ÀåÃà¿¡ µû¶ó ºñÀ²ÀÌ °áÁ¤µÇ°í ±× ºñÀ²¿¡ µû¶ó // ÆäÀÎÆ® ¹Ú½º¿¡ ±×¸°´Ù if (IllustBitmap->Width >= IllustBitmap->Height) { // Á÷Á¢ ±×¸®´Â ºÎºÐº¸´Ù Ŭ¶§¸¸ Ãà¼Ò.. if (IllustBitmap->Width >= PaintBoxImage->Width) { width = double(double(IllustBitmap->Width) * (280.0 / double(IllustBitmap->Width))) + 0.5; height = double(double(IllustBitmap->Height) * (280.0 / double(IllustBitmap->Width))) + 0.5; } else { width = IllustBitmap->Width; height = IllustBitmap->Height; } } else { // Á÷Á¢ ±×¸®´Â ºÎºÐº¸´Ù Ŭ¶§¸¸ Ãà¼Ò.. if (IllustBitmap->Height >= PaintBoxImage->Height) { width = double(double(IllustBitmap->Width) * (350.0 / double(IllustBitmap->Height))) + 0.5; height = double(double(IllustBitmap->Height) * (350.0 / double(IllustBitmap->Height))) + 0.5; } else { width = IllustBitmap->Width; height = IllustBitmap->Height; } } SetStretchBltMode(PaintBoxImage->Canvas->Handle, COLORONCOLOR); StretchBlt(PaintBoxImage->Canvas->Handle, 0,0, width, height, dcSrc, 0,0, IllustBitmap->Width, IllustBitmap->Height, SRCCOPY); if(dcSrc) IllustBitmap->DeleteDC(dcSrc); dcSrc = NULL; fail : } //--------------------------------------------------------------------------- // Top Style void __fastcall TStyleIllustForm::PaintBoxUpStylePaint(TObject *Sender) { if (LabelPatUpWhole2->Font->Color == clWindowText) //VecDraw->ArbitraryDraw(PaintBoxUpStyle->Canvas->Handle, PatUpWhole, PaintBoxUpStyle->Width, PaintBoxUpStyle->Height, iFlag, 3.0/8.0); // ¸ðµç º¤ÅͰ¡ º¸À̵µ·Ï ÁÜ ºñÀ²À» Á¶Á¤Çϰí, °¡¿îµ¥ À§Ä¡Çϵµ·Ï º¯°æ - by monkman (2011.04.07) VecDraw->DrawVector(PaintBoxUpStyle->Canvas->Handle, PatUpWhole, iFlag, 0, 0, PaintBoxUpStyle->Width, PaintBoxUpStyle->Height, 0.0, true); } //--------------------------------------------------------------------------- // Down Style void __fastcall TStyleIllustForm::PaintBoxDownStylePaint(TObject *Sender) { if (LabelPatDnWhole2->Font->Color == clWindowText) //VecDraw->ArbitraryDraw(PaintBoxDownStyle->Canvas->Handle, PatDnWhole, PaintBoxDownStyle->Width, PaintBoxDownStyle->Height, iFlag, 3.0/8.0); // ¸ðµç º¤ÅͰ¡ º¸À̵µ·Ï ÁÜ ºñÀ²À» Á¶Á¤Çϰí, °¡¿îµ¥ À§Ä¡Çϵµ·Ï º¯°æ - by monkman (2011.04.07) VecDraw->DrawVector(PaintBoxDownStyle->Canvas->Handle, PatDnWhole, iFlag, 0, 0, PaintBoxDownStyle->Width, PaintBoxDownStyle->Height, 0.0, true); } //--------------------------------------------------------------------------- // ĵ¹ö½º¸¦ »õ·Î ¿­°í »óÀÇ ÇÕ¼º - by monkman void __fastcall TStyleIllustForm::IllustDataOpen(STYLEDATAFILEHEADER& header, TList *list, ILLUSTDATAFILEHEADER &illustheader) { bool UpWholeStyle = false; bool DownWholeStyle = false; TMainImageForm *Child = NULL; TPException ec = EC_NONE; TPCanvasInfor CanvasInfor; PSTYLEDATAFILEHEADER pheader, pheader2; // Ä«ÇÇ¿ë // »óÇÏÀÇ °ËÃâ °úÁ¤.. 4byte À̹ǷÎ.. for (int i=0; i < 32; i++) { if (((illustheader.UpDown >> i) & 1) == 1) { switch (i) { case SORT_TOPWHOLESTYLE : // Top Whole Style UpWholeStyle = true; break; case SORT_BOTTOMWHOLESTYLE : // Bottom Whole Style DownWholeStyle = true; break; } } } // ¾ÕÆÇ if (iFlag == 0) { if (header.Count1 != 0) VecDraw->InitCombiRead(list, CanvasInfor, iFlag); else return; } // µÞÆÇ else { if (header.Count2 != 0) VecDraw->InitCombiRead(list, CanvasInfor, iFlag); else return; } CanvasInfor.DotsPerInch = 160; CanvasInfor.SizeType = cstFree; CanvasInfor.Width += MARGIN_X*2; CanvasInfor.Height += MARGIN_Y*2; // ·¹À̾ ÆÄÀÏ·Î ÀúÀåµÉ¶§ ÀÛ¾÷±¸¿ªÀº ÀúÀåÀÌ µÇÁö ¾Ê±â ¶§¹®¿¡ // ½ÇÁ¦ ÀÛ¾÷±¸¿ªÀº ´«¿¡ º¸ÀÌÁö ¾ÊÁö¸¸ ³²¾ÆÀÖ´Â °æ¿ì°¡ µÈ´Ù - by monkman (2005.06.16) //if (MainImageForm) MainImageForm->iMainImage->Deactivate(); if ((Child = new TMainImageForm(Application))==NULL) { ec = EC_FORM_NOT_CREATE; goto fail; } if ((ec = Child->InitForm2(CanvasInfor, 24))!=EC_NONE) goto fail; Child->StyleDivision = int(illustheader.Division); if (UpWholeStyle) { Child->StyleType = int(illustheader.Type1); } if (DownWholeStyle) { Child->StyleType = int(illustheader.Type2); } // PaletteForm->FormActivateCOLOR(); if (header.Count1 != 0 || header.Count2 != 0) { VecDraw->InitCombiMerge(list, iFlag, true, false); pheader = &header; pheader2 = new STYLEDATAFILEHEADER; VecDraw->CopySTYHeader(pheader2, *pheader); Child->StyleHeader->Add(pheader2); } // String DirName, FileName; // TGraphicFileFormat ExtIndex; // WORD bpp; Show(); return; fail: if (Child) delete Child; return; } //--------------------------------------------------------------------------- // ĵ¹ö½º¸¦ »õ·Î ¿­°í »óÇÏÀÇ ÇÕ¼º - by monkman void __fastcall TStyleIllustForm::IllustWholeDataOpen(STYLEDATAFILEHEADER& header1, TList *list1, ILLUSTDATAFILEHEADER &illustheader, STYLEDATAFILEHEADER& header2, TList * list2) { // À§Ä¡ º¸Á¤À» À§ÇØ bool UpWholeStyle = false; bool DownWholeStyle = false; TVecData *data, *cdata; long minx = MaxInt, miny = MaxInt, maxx = 0, maxy = 0; // »óÀÇ int cenxTop, cenyTop, sumTopX, sumTopY, diffTopX, diffTopY; // ÇÏÀÇ int cenxBot, cenyBot, sumBotX, sumBotY, diffBotX, diffBotY; // Undo bool sw = true; int upMaxGroupIndex = 0; int existCount = 0; // ÇÕ¼ºÀ» À§ÇØ TMainImageForm *Child = NULL; TPException ec = EC_NONE; TPCanvasInfor CanvasInfor; PSTYLEDATAFILEHEADER pheader, pheader2; // Ä«ÇÇ¿ë // »óÇÏÀÇ °ËÃâ °úÁ¤.. 4byte À̹ǷÎ.. for (int i=0; i < 32; i++) { if (((illustheader.UpDown >> i) & 1) == 1) { switch (i) { case SORT_TOPWHOLESTYLE : // Top Whole Style UpWholeStyle = true; break; case SORT_BOTTOMWHOLESTYLE : // Bottom Whole Style DownWholeStyle = true; break; } } } // None if (!UpWholeStyle && !DownWholeStyle) { return; } // Only Top Whole Style if (UpWholeStyle && !DownWholeStyle) { IllustDataOpen(header1, list1, illustheader); return; } // Only Bottom Whole Style if (!UpWholeStyle && DownWholeStyle) { IllustDataOpen(header2, list2, illustheader); return; } // ÁÂÇ¥ º¸Á¤À» À§ÇÑ °è»ê if (UpWholeStyle && DownWholeStyle) { // »óÀÇ // ¾Õ¸é long minx = MaxInt, miny = MaxInt, maxx = 0, maxy = 0; for (int i = 0; i < list1->Count; i++) { data = (TVecData *)list1->Items[i]; minx = min(minx, data->First.x); minx = min(minx, data->Second.x); maxx = max(maxx, data->First.x); maxx = max(maxx, data->Second.x); miny = min(miny, data->First.y); miny = min(miny, data->Second.y); maxy = max(maxy, data->First.y); maxy = max(maxy, data->Second.y); } sumTopX = maxx + minx; sumTopY = maxy + miny; diffTopX = maxx - minx; diffTopY = maxy - miny; //cenxTop = 400-(minx+maxx)/2; cenyTop = 560-(miny+maxy)/2; // center Á¡ // ÇÏÀÇ minx = MaxInt; miny = MaxInt; maxx = 0; maxy = 0; for (int j = 0; j < list2->Count; j++) { data = (TVecData *)list2->Items[j]; minx = min(minx, data->First.x); minx = min(minx, data->Second.x); maxx = max(maxx, data->First.x); maxx = max(maxx, data->Second.x); miny = min(miny, data->First.y); miny = min(miny, data->Second.y); maxy = max(maxy, data->First.y); maxy = max(maxy, data->Second.y); } sumBotX = maxx + minx; sumBotY = maxx + minx; diffBotX = maxx - minx; diffBotY = maxy - miny; //cenxBot = 400-(minx+maxx)/2; cenyBot = 560-(miny+maxy)/2; // center Á¡ // º¸Á¤ if (diffTopX >= diffBotX) { cenxTop = (MARGIN_X)+(diffTopX/2)-(sumTopX/2); cenyTop = 560-(sumTopY)/2; // center Á¡ cenxBot = (MARGIN_X)+(diffTopX/2)-(sumBotX/2); cenyBot = 560-(sumBotY)/2; // center Á¡ } else { cenxTop = (MARGIN_X)+(diffBotX/2)-(sumTopX/2); cenyTop = 560-(sumTopY)/2; // center Á¡ cenxBot = (MARGIN_X)+(diffBotX/2)-(sumBotX/2); cenyBot = 560-(sumBotY)/2; // center Á¡ } } CanvasInfor.DotsPerInch = 160; CanvasInfor.SizeType = cstFree; if (diffTopX >= diffBotX) { CanvasInfor.Width = (MARGIN_X*2) + diffTopX; } else { CanvasInfor.Width = (MARGIN_X*2) + (diffBotX); } CanvasInfor.Height = (MARGIN_Y*3) + diffTopY + diffBotY; //CanvasInfor.Width = 800; //CanvasInfor.Height = 1120; // ·¹À̾ ÆÄÀÏ·Î ÀúÀåµÉ¶§ ÀÛ¾÷±¸¿ªÀº ÀúÀåÀÌ µÇÁö ¾Ê±â ¶§¹®¿¡ // ½ÇÁ¦ ÀÛ¾÷±¸¿ªÀº ´«¿¡ º¸ÀÌÁö ¾ÊÁö¸¸ ³²¾ÆÀÖ´Â °æ¿ì°¡ µÈ´Ù - by monkman (2005.06.16) //if (MainImageForm) MainImageForm->iMainImage->Deactivate(); if ((Child = new TMainImageForm(Application))==NULL) { ec = EC_FORM_NOT_CREATE; goto fail; } if ((ec = Child->InitForm2(CanvasInfor, 24))!=EC_NONE) goto fail; Child->StyleDivision = int(illustheader.Division); Child->StyleType = int(illustheader.Type1); // °è»êµÈ ÁÂÇ¥·Î ÀÔ·Â.. // »óÀÇ if (header1.Count1 != 0 || header1.Count2 != 0) { pheader = &header1; pheader2 = new STYLEDATAFILEHEADER; VecDraw->CopySTYHeader(pheader2, *pheader); Child->StyleHeader->Add(pheader2); // ¾Õ¸é if (iFlag == 0) { for (int i = 0; i < header1.Count1; i++) { cdata = (TVecData *)list1->Items[i]; if (!cdata->Equal(iFlag)) continue; data = new TVecData(Child->Number); data->Copy(cdata); for (int k = 0; k < cdata->nCount*3 +1; k++) { data->pList[k].x += cenxTop; data->pList[k].y += MARGIN_Y; } SET_RECT; data->HeaderNumber = Child->StyleHeader->Count; Child->V_DATA->Add(data); VecDraw->UndoSave(VU_CREATE, Child->V_DATA->Count-1, sw); sw = false; if(upMaxGroupIndex < data->GroupIndex / 10000) upMaxGroupIndex = data->GroupIndex / 10000; } } // µÞ¸é else { for (int i = header1.Count1; i < (header1.Count1 + header1.Count2); i++) { cdata = (TVecData *)list1->Items[i]; if (!cdata->Equal(iFlag)) continue; data = new TVecData(Child->Number); data->Copy(cdata); for (int k = 0; k < cdata->nCount*3 +1; k++) { data->pList[k].x += cenxTop; data->pList[k].y += MARGIN_Y; } SET_RECT; data->HeaderNumber = Child->StyleHeader->Count*(-1); Child->V_DATA->Add(data); VecDraw->UndoSave(VU_CREATE, Child->V_DATA->Count-1, sw); sw = false; if(upMaxGroupIndex < data->GroupIndex / 10000) upMaxGroupIndex = data->GroupIndex / 10000; } } } existCount = Child->V_DATA->Count; // ÇÏÀÇ if (header2.Count1 != 0 || header2.Count2 != 0) { pheader = &header2; pheader2 = new STYLEDATAFILEHEADER; VecDraw->CopySTYHeader(pheader2, *pheader); Child->StyleHeader->Add(pheader2); // ¾Õ¸é if (iFlag == 0) { for (int j = 0; j < header2.Count1; j++) { cdata = (TVecData *)list2->Items[j]; if (!cdata->Equal(iFlag)) continue; data = new TVecData(Child->Number); data->Copy(cdata); for (int k = 0; k < data->nCount*3 +1; k++) { data->pList[k].x += cenxBot; data->pList[k].y += (MARGIN_Y*2 + diffTopY); } SET_RECT; data->HeaderNumber = Child->StyleHeader->Count; Child->V_DATA->Add(data); VecDraw->UndoSave(VU_CREATE, Child->V_DATA->Count-1, sw); sw = false; } } // µÞ¸é else { for (int j = header2.Count1; j < (header2.Count1 + header2.Count2); j++) { cdata = (TVecData *)list2->Items[j]; if (!cdata->Equal(iFlag)) continue; data = new TVecData(Child->Number); data->Copy(cdata); for (int k = 0; k < data->nCount*3 +1; k++) { data->pList[k].x += cenxBot; data->pList[k].y += (MARGIN_Y*2 + diffTopY); } SET_RECT; data->HeaderNumber = Child->StyleHeader->Count*(-1); Child->V_DATA->Add(data); VecDraw->UndoSave(VU_CREATE, Child->V_DATA->Count-1, sw); sw = false; } } //»óÀÇÀÇ group index¿Í °ãÄ¡Áö ¾Êµµ·Ï... int groupIndexState = upMaxGroupIndex * 10000; for(int k = 1; k <= upMaxGroupIndex ; k++) { bool sw = true; for(int i = existCount; i < Child->V_DATA->Count; i++) { data = (TVecData *)Child->V_DATA->Items[i]; if(data->bSelected) continue; if(data->GroupIndex / 10000 != k) continue; if(sw) { groupIndexState += 10000; sw = false; } data->GroupIndex = ((data->GroupIndex % 10000) & 0x000001ff) + groupIndexState; } } } Show(); return; fail: if (Child) delete Child; return; } //--------------------------------------------------------------------------- // ±âÁ¸ ĵ¹ö½º¿¡ ÇÕ¼º - by monkman void __fastcall TStyleIllustForm::IllustDataMerge(STYLEDATAFILEHEADER &header, TList *list, ILLUSTDATAFILEHEADER &illustheader) { bool UpWholeStyle = false; bool DownWholeStyle = false; PSTYLEDATAFILEHEADER pheader, pheader2; // Ä«ÇÇ¿ë // »óÇÏÀÇ °ËÃâ °úÁ¤.. 4byte À̹ǷÎ.. for (int i=0; i < 32; i++) { if (((illustheader.UpDown >> i) & 1) == 1) { switch (i) { case SORT_TOPWHOLESTYLE : // Top Whole Style UpWholeStyle = true; break; case SORT_BOTTOMWHOLESTYLE : // Bottom Whole Style DownWholeStyle = true; break; } } } // ¾ÕÆÇ if (iFlag == 0) { if (header.Count1 != 0) { VecDraw->InitCombiMerge(list, iFlag, false, false); pheader = &header; pheader2 = new STYLEDATAFILEHEADER; VecDraw->CopySTYHeader(pheader2, *pheader); MainImageForm->StyleHeader->Add(pheader2); } else return; } // µÞÆÇ else { if (header.Count2 != 0) { VecDraw->InitCombiMerge(list, iFlag, false, false); pheader = &header; pheader2 = new STYLEDATAFILEHEADER; VecDraw->CopySTYHeader(pheader2, *pheader); MainImageForm->StyleHeader->Add(pheader2); } else return; } MainImageForm->StyleDivision = int(illustheader.Division); if (UpWholeStyle) { MainImageForm->StyleType = int(illustheader.Type1); } if (DownWholeStyle) { MainImageForm->StyleType = int(illustheader.Type2); } } //--------------------------------------------------------------------------- // ĵ¹ö½º¸¦ »õ·Î ¿­°í »óÇÏÀÇ ÇÕ¼º - by monkman (VecDraw.cppÀÇ InitCombiMerge() Âü°í) void __fastcall TStyleIllustForm::IllustWholeDataMerge(STYLEDATAFILEHEADER& header1, TList *list1, ILLUSTDATAFILEHEADER &illustheader, STYLEDATAFILEHEADER& header2, TList * list2) { TList *DataList = VecDraw->NVector->DataList; // À§Ä¡ º¸Á¤À» À§ÇØ bool UpWholeStyle = false; bool DownWholeStyle = false; TVecData *data, *cdata; long minx = MaxInt, miny = MaxInt, maxx = 0, maxy = 0; // »óÀÇ int cenxTop, cenyTop, sumTopX, sumTopY, diffTopX, diffTopY; // ÇÏÀÇ int cenxBot, cenyBot, sumBotX, sumBotY, diffBotX, diffBotY; // ±×·ìÀÌ °ãÄ¡Áö ¾Êµµ·Ï.. - by monkman (2004.04.21) // ±×·ìÀÌ 22°³°¡ ³Ñ¾î°¡¸é ¹®Á¦°¡ ¹ß»ýÇÑ´Ù // ±×·¸´Ù°í longÀ¸·Î ¹Ù²Ù¸é ÆÄÀÏ ¹öÀüÀ» ¹Ù²Ù¾î¾ß ÇÑ´Ù //int existindex, index; int existcount; int upDownBoundIndex; // ÇÕ¼ºÀ» À§ÇØ TPException ec = EC_NONE; TPCanvasInfor CanvasInfor; PSTYLEDATAFILEHEADER pheader, pheader2; // Ä«ÇÇ¿ë // Undo bool sw = true; // »óÇÏÀÇ °ËÃâ °úÁ¤.. 4byte À̹ǷÎ.. for (int i=0; i < 32; i++) { if (((illustheader.UpDown >> i) & 1) == 1) { switch (i) { case SORT_TOPWHOLESTYLE : // Top Whole Style UpWholeStyle = true; break; case SORT_BOTTOMWHOLESTYLE : // Bottom Whole Style DownWholeStyle = true; break; } } } // None if (!UpWholeStyle && !DownWholeStyle) { return; } // Only Top Whole Style if (UpWholeStyle && !DownWholeStyle) { IllustDataMerge(header1, list1, illustheader); return; } // Only Bottom Whole Style if (!UpWholeStyle && DownWholeStyle) { IllustDataMerge(header2, list2, illustheader); return; } // ÁÂÇ¥ º¸Á¤À» À§ÇÑ °è»ê if (UpWholeStyle && DownWholeStyle) { // »óÀÇ // ¾Õ¸é long minx = MaxInt, miny = MaxInt, maxx = 0, maxy = 0; for (int i = 0; i < list1->Count; i++) { data = (TVecData *)list1->Items[i]; minx = min(minx, data->First.x); minx = min(minx, data->Second.x); maxx = max(maxx, data->First.x); maxx = max(maxx, data->Second.x); miny = min(miny, data->First.y); miny = min(miny, data->Second.y); maxy = max(maxy, data->First.y); maxy = max(maxy, data->Second.y); } sumTopX = maxx + minx; sumTopY = maxy + miny; diffTopX = maxx - minx; diffTopY = maxy - miny; //cenxTop = 400-(minx+maxx)/2; cenyTop = 560-(miny+maxy)/2; // center Á¡ // ÇÏÀÇ minx = MaxInt; miny = MaxInt; maxx = 0; maxy = 0; for (int j = 0; j < list2->Count; j++) { data = (TVecData *)list2->Items[j]; minx = min(minx, data->First.x); minx = min(minx, data->Second.x); maxx = max(maxx, data->First.x); maxx = max(maxx, data->Second.x); miny = min(miny, data->First.y); miny = min(miny, data->Second.y); maxy = max(maxy, data->First.y); maxy = max(maxy, data->Second.y); } sumBotX = maxx + minx; sumBotY = maxx + minx; diffBotX = maxx - minx; diffBotY = maxy - miny; //cenxBot = 400-(minx+maxx)/2; cenyBot = 560-(miny+maxy)/2; // center Á¡ // º¸Á¤ if (diffTopX >= diffBotX) { cenxTop = (diffTopX/2)-(sumTopX/2); //cenyTop = 560-(sumTopY)/2; // center Á¡ cenxBot = (diffTopX/2)-(sumBotX/2); //cenyBot = 560-(sumBotY)/2; // center Á¡ } else { cenxTop = (diffBotX/2)-(sumTopX/2); //cenyTop = 560-(sumTopY)/2; // center Á¡ cenxBot = (diffBotX/2)-(sumBotX/2); //cenyBot = 560-(sumBotY)/2; // center Á¡ } } // ±×·ìÀÌ °ãÄ¡Áö ¾Êµµ·Ï - by monkman (2004.04.21) existcount = DataList->Count; /*group index ±¸Á¶¸¦ ¹Ù²Ù¸é¼­ ÁÖ¼®À¸·Î ¸·À½ for (int i = 0; i < existcount; i++) { // GroupIndex ¸ÂÃçÁÖ±â data = (TVecData *)DataList->Items[i]; if (!data->Equal(MainImageForm->Number)) continue; if (!data->GroupIndex) continue; existindex |= data->GroupIndex; } */ // °è»êµÈ ÁÂÇ¥·Î ÀÔ·Â.. // Merge¸¦ À§Çؼ­.. VecDraw->deSelect(); VecDraw->PasteRange = Rect(50000, 50000, 0, 0); // »óÀÇ if (header1.Count1 != 0 || header1.Count2 != 0) { pheader = &header1; pheader2 = new STYLEDATAFILEHEADER; VecDraw->CopySTYHeader(pheader2, *pheader); MainImageForm->StyleHeader->Add(pheader2); // ¾Õ¸é if (iFlag == 0) { for (int i = 0; i < header1.Count1; i++) { cdata = (TVecData *)list1->Items[i]; if (!cdata->Equal(iFlag)) continue; data = new TVecData(MainImageForm->Number); data->Copy(cdata); for (int k = 0; k < cdata->nCount*3 +1; k++) { data->pList[k].x += cenxTop; //data->pList[k].y += MARGIN_Y; } VecDraw->MaxThick = max(VecDraw->MaxThick, data->PenThick); SET_RECT; VecDraw->PasteRange.left = min(VecDraw->PasteRange.left, min(data->First.x, data->Second.x)); VecDraw->PasteRange.right = max(VecDraw->PasteRange.right, max(data->First.x, data->Second.x)); VecDraw->PasteRange.top = min(VecDraw->PasteRange.top, min(data->First.y, data->Second.y)); VecDraw->PasteRange.bottom = max(VecDraw->PasteRange.bottom, max(data->First.y, data->Second.y)); data->HeaderNumber = MainImageForm->StyleHeader->Count; DataList->Add(data); VecDraw->UndoSave(VU_CREATE, DataList->Count-1, sw); sw = false; } } // µÞ¸é else { for (int i = header1.Count1; i < (header1.Count1 + header1.Count2); i++) { cdata = (TVecData *)list1->Items[i]; if (!cdata->Equal(iFlag)) continue; data = new TVecData(MainImageForm->Number); data->Copy(cdata); for (int k = 0; k < cdata->nCount*3 +1; k++) { data->pList[k].x += cenxTop; //data->pList[k].y += MARGIN_Y; } VecDraw->MaxThick = max(VecDraw->MaxThick, data->PenThick); SET_RECT; VecDraw->PasteRange.left = min(VecDraw->PasteRange.left, min(data->First.x, data->Second.x)); VecDraw->PasteRange.right = max(VecDraw->PasteRange.right, max(data->First.x, data->Second.x)); VecDraw->PasteRange.top = min(VecDraw->PasteRange.top, min(data->First.y, data->Second.y)); VecDraw->PasteRange.bottom = max(VecDraw->PasteRange.bottom, max(data->First.y, data->Second.y)); data->HeaderNumber = MainImageForm->StyleHeader->Count*(-1); DataList->Add(data); VecDraw->UndoSave(VU_CREATE, DataList->Count-1, sw); sw = false; } } } upDownBoundIndex = DataList->Count; // ÇÏÀÇ if (header2.Count1 != 0 || header2.Count2 != 0) { pheader = &header2; pheader2 = new STYLEDATAFILEHEADER; VecDraw->CopySTYHeader(pheader2, *pheader); MainImageForm->StyleHeader->Add(pheader2); // ¾Õ¸é if (iFlag == 0) { for (int j = 0; j < header2.Count1; j++) { cdata = (TVecData *)list2->Items[j]; if (!cdata->Equal(iFlag)) continue; data = new TVecData(MainImageForm->Number); data->Copy(cdata); for (int k = 0; k < data->nCount*3 +1; k++) { data->pList[k].x += cenxBot; data->pList[k].y += (MARGIN_Y + diffTopY); } VecDraw->MaxThick = max(VecDraw->MaxThick, data->PenThick); SET_RECT; VecDraw->PasteRange.left = min(VecDraw->PasteRange.left, min(data->First.x, data->Second.x)); VecDraw->PasteRange.right = max(VecDraw->PasteRange.right, max(data->First.x, data->Second.x)); VecDraw->PasteRange.top = min(VecDraw->PasteRange.top, min(data->First.y, data->Second.y)); VecDraw->PasteRange.bottom = max(VecDraw->PasteRange.bottom, max(data->First.y, data->Second.y)); data->HeaderNumber = MainImageForm->StyleHeader->Count; DataList->Add(data); VecDraw->UndoSave(VU_CREATE, DataList->Count-1, sw); sw = false; } } // µÞ¸é else { for (int j = header2.Count1; j < (header2.Count1 + header2.Count2); j++) { cdata = (TVecData *)list2->Items[j]; if (!cdata->Equal(iFlag)) continue; data = new TVecData(MainImageForm->Number); data->Copy(cdata); for (int k = 0; k < data->nCount*3 +1; k++) { data->pList[k].x += cenxBot; data->pList[k].y += (MARGIN_Y + diffTopY); } VecDraw->MaxThick = max(VecDraw->MaxThick, data->PenThick); SET_RECT; VecDraw->PasteRange.left = min(VecDraw->PasteRange.left, min(data->First.x, data->Second.x)); VecDraw->PasteRange.right = max(VecDraw->PasteRange.right, max(data->First.x, data->Second.x)); VecDraw->PasteRange.top = min(VecDraw->PasteRange.top, min(data->First.y, data->Second.y)); VecDraw->PasteRange.bottom = max(VecDraw->PasteRange.bottom, max(data->First.y, data->Second.y)); data->HeaderNumber = MainImageForm->StyleHeader->Count*(-1); DataList->Add(data); VecDraw->UndoSave(VU_CREATE, DataList->Count-1, sw); sw = false; } } } /*group index ±¸Á¶¸¦ ¹Ù²Ù¸é¼­ ÁÖ¼®À¸·Î ¸·À½ // ±×·ìÀÌ °ãÄ¡Áö ¾Êµµ·Ï - by monkman (2004.04.21) 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 < DataList->Count; i++) { data = (TVecData *)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<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 < upDownBoundIndex; i++) { data = (TVecData *)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; } } srcMaxGroupIndex = 0; for(int i = upDownBoundIndex; i < DataList->Count; i++) { data = (TVecData *)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 = upDownBoundIndex; i < DataList->Count; i++) { data = (TVecData *)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 < DataList->Count; i++) { data = (TVecData *)DataList->Items[i]; data->bSelected = true; // MergeÀΰæ¿ì´Â ¼±ÅÃÀÌ µÈ»óÅ·Π»ý¼º } VecDraw->NVector->bMergeMode = true; VecDraw->NVector->bSelected = true; MainImageForm->StyleDivision = int(illustheader.Division); MainImageForm->StyleType = int(illustheader.Type1); return; } //--------------------------------------------------------------------------- // ĵ¹ö½º¸¦ »õ·Î ¿­°í »óÀÇ ÇÕ¼º - by monkman void __fastcall TStyleIllustForm::PopupUpStyleOpenClick(TObject *Sender) { IllustDataOpen(HDPatUpWhole, PatUpWhole, IllustHeader); } //--------------------------------------------------------------------------- // ±âÁ¸ ĵ¹ö½º¿¡ »óÀÇ ÇÕ¼º - by monkman void __fastcall TStyleIllustForm::PopupUpStyleMergeClick( TObject *Sender) { IllustDataMerge(HDPatUpWhole, PatUpWhole, IllustHeader); } //--------------------------------------------------------------------------- // ĵ¹ö½º¸¦ »õ·Î ¿­°í ÇÏÀÇ ÇÕ¼º - by monkman void __fastcall TStyleIllustForm::PopupDownStyleOpenClick(TObject *Sender) { IllustDataOpen(HDPatDnWhole, PatDnWhole, IllustHeader); } //--------------------------------------------------------------------------- // ±âÁ¸ ĵ¹ö½º¿¡ È÷ÀÇ ÇÕ¼º - by monkman void __fastcall TStyleIllustForm::PopupDownStyleMergeClick( TObject *Sender) { IllustDataMerge(HDPatDnWhole, PatDnWhole, IllustHeader); } //--------------------------------------------------------------------------- // »óÀÇ ÆË¾÷âÀ» ¶ç¿ì±â À§ÇÑ À̺¥Æ® - by monkman void __fastcall TStyleIllustForm::PaintBoxUpStyleMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (Button != mbRight) return; } //--------------------------------------------------------------------------- // ÇÏÀÇ ÆË¾÷âÀ» ¶ç¿ì±â À§ÇÑ À̺¥Æ® - by monkman void __fastcall TStyleIllustForm::PaintBoxDownStyleMouseDown( TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (Button != mbRight) return; } //--------------------------------------------------------------------------- // »óÀÇ ½ºÅ¸ÀÏ Á¶ÇÕ - by monkman void __fastcall TStyleIllustForm::sbUpStyleCombiClick(TObject *Sender) { progbarCombination->Position = 0; // CombiForm°ú ResultForm¿¡ µ¥ÀÌÅ͸¦ º¸³½´Ù.. CombiForm->bIsIllustForm = true; ResultForm->bIsIllustForm = true; // Main Items (Ȥ½Ã ÀÌÀü¿¡ ´Ù¸¥°ÍÀÌ ¼±ÅÃµÈ °ªÀÌ ÀÖÀ»±îºÁ.. ´Ù¸¥ °ÍÀº false·Î..) // °æ·Î ÃʱâÈ­ - by monkman (2004.05.27) //CombiForm->StyleFormComboSourceItemIndex = comboSource->ItemIndex; //CombiForm->InitForm(); progbarCombination->Position = 5; switch (IllustHeader.Division) { case DV_MAN : CombiForm->combobxMainItem->ItemIndex = 0; break; case DV_WOMAN : CombiForm->combobxMainItem->ItemIndex = 1; break; case DV_CHILD : CombiForm->combobxMainItem->ItemIndex = 2; break; case DV_BABY : CombiForm->combobxMainItem->ItemIndex = 3; break; } CombiForm->Division = IllustHeader.Division; //CombiForm->rbClothesClick(this); // Top Style CombiForm->combobxUpperLower->ItemIndex = 0; CombiForm->MainItemChange(NULL); // Items CombiForm->MainType = IllustHeader.Type1; // ¶óµð¿À ¹öư ÃʱâÈ­ CombiForm->combobxItem->ItemIndex = -1; // ¶óµð¿À ¹öưÀÌ Ã¼Å©µÇ¾îÀÖ´ÂÁö È®ÀÎ if (DSItems.Contains(EType(IllustHeader.Type1))) { for (int i = 0; i < CombiForm->combobxItem->Items->Count; i++) { if (CombiForm->combobxItem->Items->Strings[i] == CombiForm->StrType[IllustHeader.Type1]) { CombiForm->combobxItem->ItemIndex = i; break; } } } CombiForm->SubItemChange(NULL); TMouseButton Button; TShiftState ShiftButton; Button = mbLeft; CombiForm->bIsStringGrid1First = true; CombiForm->HDPatUpSil = HDPatUpSil; CombiForm->StringGrid1Click(this); CombiForm->bIsStringGrid2First = true; CombiForm->HDPatUpSle = HDPatUpSle; CombiForm->StringGrid2Click(this); CombiForm->bIsStringGrid3First = true; CombiForm->HDPatUpCol = HDPatUpCol; CombiForm->StringGrid3Click(this); progbarCombination->Position = 100; // Æû Á¶ÀÛ Visible = false; CombiForm->spdbtnBack->Visible = true; // Other Style if (cbOtherStyle->Checked == true) { CombiForm->bIsIllustForm = true; // ÇØ»óµµ¿¡ µû¸¥ Æû Å©±â ÃʱâÈ­ - by monkman (2004.05.02) if (Screen->Width >= 1280 && Screen->Height >= 1024) CombiForm->BorderStyle = bsSingle; else CombiForm->BorderStyle = bsSizeable; CombiForm->Left = (Screen->Width - CombiForm->Width); CombiForm->Top = 0; CombiForm->Show(); // ResultFormÀÇ ½ºÅ¸ÀÏ µ¥ÀÌÅÍ º¹»ç CopyIllustDataToCombiResultForm(); } else { CombiForm->bIsIllustForm = false; // ResultFormÀÇ ½ºÅ¸ÀÏ µ¥ÀÌÅÍ º¹»ç CopyIllustDataToCombiResultForm(); // ÇØ»óµµ¿¡ µû¸¥ Æû Å©±â ÃʱâÈ­ - by monkman (2004.05.02) if (Screen->Width >= 1280 && Screen->Height >= 1024) ResultForm->BorderStyle = bsSingle; else ResultForm->BorderStyle = bsSizeable; ResultForm->Left = (Screen->Width - ResultForm->Width); ResultForm->Top = 0; ResultForm->Show(); ResultForm->InitForm(); ResultForm->Visible = true; } } //--------------------------------------------------------------------------- // ÇÏÀÇ ½ºÅ¸ÀÏ Á¶ÇÕ - by monkman void __fastcall TStyleIllustForm::sbDownStyleCombiClick(TObject *Sender) { progbarCombination->Position = 0; // CombiForm°ú ResultForm¿¡ µ¥ÀÌÅ͸¦ º¸³½´Ù.. CombiForm->bIsIllustForm = true; ResultForm->bIsIllustForm = true; // Main Items (Ȥ½Ã ÀÌÀü¿¡ ´Ù¸¥°ÍÀÌ ¼±ÅÃµÈ °ªÀÌ ÀÖÀ»±îºÁ.. ´Ù¸¥ °ÍÀº false·Î..) // °æ·Î ÃʱâÈ­ - by monkman (2004.05.27) //CombiForm->StyleFormComboSourceItemIndex = comboSource->ItemIndex; //CombiForm->InitForm(); progbarCombination->Position = 5; switch (IllustHeader.Division) { case DV_MAN : CombiForm->combobxMainItem->ItemIndex = 0; break; case DV_WOMAN : CombiForm->combobxMainItem->ItemIndex = 1; break; case DV_CHILD : CombiForm->combobxMainItem->ItemIndex = 2; break; case DV_BABY : CombiForm->combobxMainItem->ItemIndex = 3; break; } CombiForm->Division = IllustHeader.Division; //CombiForm->rbClothesClick(this); // Top Style CombiForm->combobxUpperLower->ItemIndex = 1; CombiForm->MainItemChange(NULL); // Items CombiForm->MainType = IllustHeader.Type2; // ¶óµð¿À ¹öư ÃʱâÈ­ CombiForm->combobxItem->ItemIndex = -1; // ¶óµð¿À ¹öưÀÌ Ã¼Å©µÇ¾îÀÖ´ÂÁö È®ÀÎ if (DSItems.Contains(EType(IllustHeader.Type2))) { for (int i = 0; i < CombiForm->combobxItem->Items->Count; i++) { if (CombiForm->combobxItem->Items->Strings[i] == CombiForm->StrType[IllustHeader.Type2]) { CombiForm->combobxItem->ItemIndex = i; } } } CombiForm->SubItemChange(NULL); CombiForm->bIsStringGrid1First = true; CombiForm->HDPatDnSil = HDPatDnSil; CombiForm->StringGrid1Click(this); CombiForm->bIsStringGrid2First = true; CombiForm->HDPatDnBelt = HDPatDnBelt; CombiForm->StringGrid2Click(this); progbarCombination->Position = 100; // Æû Á¶ÀÛ Visible = false; CombiForm->spdbtnBack->Visible = true; // Other Style if (cbOtherStyle->Checked == true) { CombiForm->bIsIllustForm = true; // ÇØ»óµµ¿¡ µû¸¥ Æû Å©±â ÃʱâÈ­ - by monkman (2004.05.02) if (Screen->Width >= 1280 && Screen->Height >= 1024) CombiForm->BorderStyle = bsSingle; else CombiForm->BorderStyle = bsSizeable; CombiForm->Left = (Screen->Width - CombiForm->Width); CombiForm->Top = 0; CombiForm->Show(); // ResultFormÀÇ ½ºÅ¸ÀÏ µ¥ÀÌÅÍ º¹»ç CopyIllustDataToCombiResultForm(); } else { CombiForm->bIsIllustForm = false; // ÇØ»óµµ¿¡ µû¸¥ Æû Å©±â ÃʱâÈ­ - by monkman (2004.05.02) if (Screen->Width >= 1280 && Screen->Height >= 1024) ResultForm->BorderStyle = bsSingle; else ResultForm->BorderStyle = bsSizeable; ResultForm->Left = (Screen->Width - ResultForm->Width); ResultForm->Top = 0; // ResultFormÀÇ ½ºÅ¸ÀÏ µ¥ÀÌÅÍ º¹»ç CopyIllustDataToCombiResultForm(); ResultForm->Show(); ResultForm->InitForm(); ResultForm->Visible = true; } } //--------------------------------------------------------------------------- // CombiResultÆû¿¡ IllustData¸¦ º¹»ç void __fastcall TStyleIllustForm::CopyIllustDataToCombiResultForm() { TVecData *data, *cdata; // ResultFormÀÇ ½ºÅ¸ÀÏ µ¥ÀÌÅÍ ÃʱâÈ­ ResultForm->ClearList(); // sti ÆÄÀÏÀÇ Çì´õ ResultForm->IllustHeader = IllustHeader; ResultForm->DSItems = DSItems; // Object °¹¼ö ResultForm->HDPatUpWhole = HDPatUpWhole; ResultForm->HDPatUpSil = HDPatUpSil; ResultForm->HDPatUpSle = HDPatUpSle; ResultForm->HDPatUpCol = HDPatUpCol; ResultForm->HDPatDnWhole = HDPatDnWhole; ResultForm->HDPatDnSil = HDPatDnSil; ResultForm->HDPatDnBelt = HDPatDnBelt; // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ // sti ÆÄÀÏÀÇ Çì´õ ResultForm->IllustHeader = IllustHeader; ResultForm->DSItems = DSItems; // Object °¹¼ö ResultForm->HDPatUpWhole = HDPatUpWhole; ResultForm->HDPatUpSil = HDPatUpSil; ResultForm->HDPatUpSle = HDPatUpSle; ResultForm->HDPatUpCol = HDPatUpCol; ResultForm->HDPatDnWhole = HDPatDnWhole; ResultForm->HDPatDnSil = HDPatDnSil; ResultForm->HDPatDnBelt = HDPatDnBelt; // TVecData¸¦ ´ã±âÀ§ÇÑ TList // ÆÐÅÏ¿ë (»óÀÇ) for (int i = 0; i < PatUpWhole->Count; i++) { data = (TVecData *)PatUpWhole->Items[i]; cdata = new TVecData(0); cdata->Copy(data); ResultForm->PatUpWhole->Add(cdata); } for (int i = 0; i < PatUpSil->Count; i++) { data = (TVecData *)PatUpSil->Items[i]; cdata = new TVecData(0); cdata->Copy(data); ResultForm->PatUpSil->Add(cdata); } for (int i = 0; i < PatUpSle->Count; i++) { data = (TVecData *)PatUpSle->Items[i]; cdata = new TVecData(0); cdata->Copy(data); ResultForm->PatUpSle->Add(cdata); } for (int i = 0; i < PatUpCol->Count; i++) { data = (TVecData *)PatUpCol->Items[i]; cdata = new TVecData(0); cdata->Copy(data); ResultForm->PatUpCol->Add(cdata); } // ÆÐÅÏ¿ë (ÇÏÀÇ) for (int i = 0; i < PatDnWhole->Count; i++) { data = (TVecData *)PatDnWhole->Items[i]; cdata = new TVecData(0); cdata->Copy(data); ResultForm->PatDnWhole->Add(cdata); } for (int i = 0; i < PatDnSil->Count; i++) { data = (TVecData *)PatDnSil->Items[i]; cdata = new TVecData(0); cdata->Copy(data); ResultForm->PatDnSil->Add(cdata); } for (int i = 0; i < PatDnBelt->Count; i++) { data = (TVecData *)PatDnBelt->Items[i]; cdata = new TVecData(0); cdata->Copy(data); ResultForm->PatDnBelt->Add(cdata); } } //--------------------------------------------------------------------------- // À̹ÌÁö¸¦ ĵ¹ö½º·Î °¡Á®¿Ã °æ¿ì - ÄÚµùÀÌ Çϳªµµ ¾È µÇ¾îÀÖÀ½ - by monkman (2004.07.05) // PatternFillÀÇ SourceBitmapÀ̳ª SubBitmap µîÀ» ÀÌ¿ëÇØ¾ß ÇÒµí.. void __fastcall TStyleIllustForm::PopupBringToImageClick(TObject *Sender) { // ÆÄÀÏ Çì´õ¿ë HANDLE hFile = INVALID_HANDLE_VALUE; // µ¥ÀÌÅÍ¿ë TVecData *data; DWORD dwRead; String filename; // ±×¸®±â ¿ë int w, h, bpp; int Version; TTexpiaBitmap *LoadBitmap = NULL; TPItemImage *Image = MainImageForm->iMainImage; // 1. Çì´õ¸¦ Àд´٠// *.sty ÆÄÀÏÀ» ¹öÀü º°·Î ÀÐ°í º¯È¯ÇÑ´Ù - by monkman (2004.03.30) if ((hFile = CreateFile(SelectedFilePath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto fail; IllustHeader = VecDraw->ReadSTIFileHeader(hFile, SelectedFilePath, &Version); // Version¿¡ µû¶ó ÇØ¾ßÇÒ ÀÛ¾÷ÀÌ ÀÖ´Ù¸é ÀÌ °÷¿¡¼­ ÇÑ´Ù - by monkman (2004.11.03) // 100 : // 200 : // 205 : Gdiplus Àû¿ë ÈÄ º¯°æ (05.03.09) // 206 : groupIndex º¯°æ & gradient fill Ãß°¡ (08.05.08) // 207 : MotiveObject Ãß°¡ - by monkman (2009.04.03) // 500 : (¿µ¿ì ÆÇ¸Å¿ë µ¥ÀÌÅÍ) // 505 : Gdiplus Àû¿ë ÈÄ º¯°æ (05.03.09) // 506 : roupIndex º¯°æ & gradient fill Ãß°¡ (08.05.08) // 507 : MotiveObject Ãß°¡ - by monkman (2009.04.03) if (500 <= Version) { #ifndef NOT_STYLEDATA_LOCK // HASP°ú üũ ÇÑ´Ù if (!STILockValidate(hFile, IllustHeader)) goto fail; #endif /* // ¸Þ½ÃÁö : ÆÄÀÏ Å¸ÀÔÀÌ ´Ù¸¨´Ï´Ù.\nÆÄÀϰæ·Î : String ErrorMsg = String(IDS_MESSAGE1); ErrorMsg = ErrorMsg + filename; MessageDlg(ErrorMsg, mtWarning, TMsgDlgButtons() << mbOK, 0); goto fail; */ } if (!IllustHeader.Version) goto fail; // 2. Tag¸¦ °Ç³Ê¶Ú´Ù if (SetFilePointer(hFile, 150000, NULL, FILE_CURRENT)== 0xFFFFFFFF) goto fail; else { // 3. Data¸¦ Àд´٠// 4byte À̹ǷÎ.. for (int i=0; i < 32; i++) { if (((IllustHeader.UpDown >> i) & 1) == 1) { switch (i) { case SORT_TOPSILHOUETTE : // Top Silhouette if (!LoadFromIllustFile(HDPatUpSil, hFile, SelectedFilePath, PatUpSil)) goto fail; break; case SORT_TOPSLEEVE : // Top Sleeve if (!LoadFromIllustFile(HDPatUpSle, hFile, SelectedFilePath, PatUpSle)) goto fail; break; case SORT_TOPCOLLAR : // Top Collar if (!LoadFromIllustFile(HDPatUpCol, hFile, SelectedFilePath, PatUpCol)) goto fail; break; case SORT_TOPWHOLESTYLE : // Top Whole Style if (!LoadFromIllustFile(HDPatUpWhole, hFile, SelectedFilePath, PatUpWhole)) goto fail; break; case SORT_BOTTOMSILHOUETTE : // Bottom Silhouette if (!LoadFromIllustFile(HDPatDnSil, hFile, SelectedFilePath, PatDnSil)) goto fail; break; case SORT_BOTTOMBELT : // Bottom Belt if (!LoadFromIllustFile(HDPatDnBelt, hFile, SelectedFilePath, PatDnBelt)) goto fail; break; case SORT_BOTTOMWHOLESTYLE : // Bottom Whole Style if (!LoadFromIllustFile(HDPatDnWhole, hFile, SelectedFilePath, PatDnWhole)) goto fail; break; } } } } // 4. TTexpiaBitmapÀ» ÀÐ°í ±×·ÁÁØ´Ù if (!ReadFile(hFile, &w, sizeof(int), &dwRead, NULL)) goto fail; if (!ReadFile(hFile, &h, sizeof(int), &dwRead, NULL)) goto fail; if (w >= Image->Bitmap->Width || h >= Image->Bitmap->Height) { //"À̹ÌÁö°¡ ĵ¹ö½ºº¸´Ù Ä¿¼­ ¿­¼ö°¡ ¾ø½À´Ï´Ù." Application->MessageBox(IDS_MESSAGE7.c_str(), L"Warning", MB_OK); goto fail; } if (!ReadFile(hFile, &bpp, sizeof(int), &dwRead, NULL)) goto fail; if (LoadBitmap) { delete LoadBitmap; LoadBitmap = NULL; } LoadBitmap = new TTexpiaBitmap; if (!LoadBitmap->Create(w, h, bpp)) goto fail; if (!LoadBitmap->LoadFromTexpiaFile(hFile, cmZLib)) goto fail; if(!LoadBitmap) goto fail; Image->SubEnabled = true; Image->SubBitmap->Create(w, h, bpp); Image->SubMask->Create(w, h, 1); Image->SubBitmap->Copy(LoadBitmap, SRCCOPY); Image->SubMask->FillRect(Rect(0, 0, w, h), 0); MainMenuForm->Item = T_MERGE; if (LoadBitmap) { delete LoadBitmap; LoadBitmap = NULL; } CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; return; fail: if (LoadBitmap) { delete LoadBitmap; LoadBitmap = NULL; } CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; } //--------------------------------------------------------------------------- // À̹ÌÁö¸¦ ¹Ù²Ü °æ¿ì ¸ðµç Á¤º¸¸¦ »õ·Î ÀúÀåÇÑ´Ù.. - by monkman void __fastcall TStyleIllustForm::PopupChangeClick( TObject *Sender) { // ÆÄÀÏ Çì´õ¿ë HANDLE hFile = INVALID_HANDLE_VALUE; // µ¥ÀÌÅÍ¿ë TVecData *data; DWORD dwWrite; TFileInfor* fi; // ±×¸®±â¿ë TTexpiaBitmap *tag = NULL; int width, height, w, h, bpp; HDC dcTagSrc=NULL, dcTagDst=NULL; // À̹ÌÁö ÆÄÀÏ ¹Ù²Ù±â¿ë TTexpiaBitmap *LoadImage = NULL, *CopyImage = NULL; String ext; int length; TPalette *pPalette = NULL; HANDLE fh = INVALID_HANDLE_VALUE; TPException ec = EC_NONE; RGBQUAD rgb[256]; if (LoadImage == NULL) LoadImage = new TTexpiaBitmap; if (CopyImage == NULL) CopyImage = new TTexpiaBitmap; // À̹ÌÁö ÆÄÀÏÀ» Àоî¿À´Â ºÎºÐ.. if (OpenDialogChangeImage->Execute()) { if (FileExists(OpenDialogChangeImage->FileName)) { length = OpenDialogChangeImage->FileName.Length(); ext = ExtractFileExt(OpenDialogChangeImage->FileName); ext = ext.LowerCase(); if (ext == ".bmp") { if (!LoadImage->LoadFromFile(OpenDialogChangeImage->FileName)) {ec = EC_FILE_NOT_READ; goto fail;} }else if (ext == ".tex" || ext == ".tfc" || ext == ".wea" || ext == ".knt") { TEXPIAFILEHEADER tpfh; if ((pPalette = new TPalette)==NULL) { ec = EC_MEMORY_LACK; goto fail; } if ((fh = CreateFile(OpenDialogChangeImage->FileName.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) { ec = EC_MEMORY_LACK; goto fail; } if ((ec = LoadFromTexpiaFile(fh, pPalette, tpfh, LoadImage, FindExtension(ext)))!= EC_NONE) goto fail; CloseHandle(fh); }else { if (!LoadImage->LoadFromFile(OpenDialogChangeImage->FileName)) {ec = EC_FILE_NOT_READ; goto fail;} } // Load µÈ Image¸¦ IllustImage¿¡ º¹»ç if (IllustBitmap == NULL) { IllustBitmap = new TTexpiaBitmap; } else { CopyImage->Copy(IllustBitmap, SRCCOPY); } if (LoadImage->BitsPerPixel == 8) { LoadImage->GetColors(0, 256, rgb); IllustBitmap->Create(LoadImage->Width, LoadImage->Height, LoadImage->BitsPerPixel, rgb); } else { IllustBitmap->Create(LoadImage->Width, LoadImage->Height, LoadImage->BitsPerPixel); } IllustBitmap->Copy(LoadImage, SRCCOPY); PaintBoxImage->Repaint(); // ¸Þ½ÃÁö : "º¯°æµÈ À̹ÌÁö·Î ÀúÀåÇϽðڽÀ´Ï±î?" if (MessageDlg(IDS_MESSAGE2, mtConfirmation, TMsgDlgButtons() << mbYes << mbNo, 0) == mrNo) { if (CopyImage == NULL) { if (IllustBitmap != NULL) delete IllustBitmap; IllustBitmap = NULL; } else { if (IllustBitmap != NULL) { IllustBitmap->Destroy(); } IllustBitmap->Copy(CopyImage, SRCCOPY); } PaintBoxImage->Repaint(); return; } else { if (IllustBitmap) { fi = (TFileInfor *) TagList->Items[row*3 + col]; if ((hFile = CreateFile(fi->Path.c_str(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto fail; // *.sti ÆÄÀÏÀ» ±â·ÏÇÏ´Â ºÎºÐ.. // 1. Çì´õ¸¦ ¾´´Ù if (!WriteFile(hFile, &IllustHeader, sizeof(IllustHeader), &dwWrite, NULL)) goto fail; // 2. Tag¸¦ ¾´´Ù tag = new TTexpiaBitmap; if (!(tag->Create(200, 250, 24))) goto fail; tag->FillRect(Rect(0, 0, 200, 250), clWhite); if ((dcTagDst = tag->CreateDC())==NULL) goto fail; if(!IllustBitmap) return; if ((dcTagSrc = IllustBitmap->CreateDC())==NULL) goto fail; // ¾î´ÀÂÊÀÌ ÀåÃàÀÎÁö ºñ±³.. ÀåÃà¿¡ µû¶ó ºñÀ²ÀÌ °áÁ¤µÇ°í ±× ºñÀ²¿¡ µû¶ó if (IllustBitmap->Width >= IllustBitmap->Height) { width = double(double(IllustBitmap->Width) * (200.0 / double(IllustBitmap->Width))) + 0.5; height = double(double(IllustBitmap->Height) * (200.0 / double(IllustBitmap->Width))) + 0.5; } else { width = double(double(IllustBitmap->Width) * (250.0 / double(IllustBitmap->Height))) + 0.5; height = double(double(IllustBitmap->Height) * (250.0 / double(IllustBitmap->Height))) + 0.5; } SetStretchBltMode(dcTagDst, COLORONCOLOR); StretchBlt(dcTagDst, 0,0, width, height, dcTagSrc, 0,0, IllustBitmap->Width, IllustBitmap->Height, SRCCOPY); IllustBitmap->DeleteDC(dcTagSrc); tag->DeleteDC(dcTagDst); dcTagDst = NULL; if (!tag->SaveToTexpiaFile(hFile, cmNone)) goto fail; if (tag) { delete tag; tag = NULL; } // 3. Data¸¦ ¾´´Ù // 4byte À̹ǷÎ.. for (int i=0; i < 32; i++) { if (((IllustHeader.UpDown >> i) & 1) == 1) { switch (i) { case SORT_TOPSILHOUETTE : // Top Silhouette if (!SaveToIllustFile(HDPatUpSil, hFile, fi->Path, PatUpSil)) goto fail; break; case SORT_TOPSLEEVE : // Top Sleeve if (!SaveToIllustFile(HDPatUpSle, hFile, fi->Path, PatUpSle)) goto fail; break; case SORT_TOPCOLLAR : // Top Collar if (!SaveToIllustFile(HDPatUpCol, hFile, fi->Path, PatUpCol)) goto fail; break; case SORT_TOPWHOLESTYLE : // Top Whole Style if (!SaveToIllustFile(HDPatUpWhole, hFile, fi->Path, PatUpWhole)) goto fail; break; case SORT_BOTTOMSILHOUETTE : // Bottom Silhouette if (!SaveToIllustFile(HDPatDnSil, hFile, fi->Path, PatDnSil)) goto fail; break; case SORT_BOTTOMBELT : // Bottom Belt if (!SaveToIllustFile(HDPatDnBelt, hFile, fi->Path, PatDnBelt)) goto fail; break; case SORT_BOTTOMWHOLESTYLE : // Bottom Whole Style if (!SaveToIllustFile(HDPatDnWhole, hFile, fi->Path, PatDnWhole)) goto fail; break; } } } // 4. TTexpiaBitmapÀ» ¾´´Ù w = IllustBitmap->Width, h = IllustBitmap->Height; bpp = 24; if (!WriteFile(hFile, &w, sizeof(int), &dwWrite, NULL)) goto fail; if (!WriteFile(hFile, &h, sizeof(int), &dwWrite, NULL)) goto fail; if (!WriteFile(hFile, &bpp, sizeof(int), &dwWrite, NULL)) goto fail; if (!IllustBitmap->SaveToTexpiaFile(hFile, cmZLib)) goto fail; CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; } next: delete pPalette; pPalette = NULL; } } } if (LoadImage) { delete LoadImage; LoadImage = NULL; } if (CopyImage) { delete CopyImage; CopyImage = NULL; } PaintBoxImage->Repaint(); return; fail: if (dcTagDst) tag->DeleteDC(dcTagDst); if (tag) { delete tag; tag = NULL; } if (LoadImage) { delete LoadImage; LoadImage = NULL; } if (CopyImage) { delete CopyImage; CopyImage = NULL; } CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; if (fh != INVALID_HANDLE_VALUE) CloseHandle(fh); EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------------- // »çÁøÀ» ÅëÇÑ ½ºÅ¸ÀÏ Á¶ÇÕ ÀúÀå ó¸® ºÎºÐ - by monkman bool __fastcall TStyleIllustForm::SaveToIllustFile(STYLEDATAFILEHEADER header, HANDLE hFile, String filename, TList *list) { TVecData *data; DWORD dwWrite; String temp; // TEXTBOX ¼öÁ¤½Ã ÀÌ ºÎºÐÀ» ¼öÁ¤ - by monkman // int linecount, wordcount, lineheight; // TSWordData *srcWordData; // ±âÁ¸¿¡ ÀÖ´ø °ªÀÌ º¹»çµÇ¹Ç·Î »õ·Î ¸Þ¸ð¸®¸¦ Àâ¾ÆÁÙ Çʿ䰡 ¾ø´Ù.. - by monkman // ¾Æ·¡ ÄÚµåÀÇ ÁÖ¼®À» Ç®¸é Á¶Çսà ¹®Á¦°¡ ¹ß»ýÇÑ´Ù.. // memcpy(header.TraitFrontNumber, TempNumber1, sizeof(int)*80); // memcpy(header.TraitBackNumber, TempNumber2, sizeof(int)*80); header.FileIndex = 0; // ÃʱâÈ­ÇØÁØ´Ù - by monkman (2011.01.04) if (!WriteFile(hFile, &header, sizeof(STYLEDATAFILEHEADER), &dwWrite, NULL)) goto fail; for (int i = 0; i < header.Count1; i++) { data = (TVecData *)list->Items[i]; VecDraw->SaveToSTYFile(hFile, data, header.Version); } for (int i = header.Count1; i < (header.Count1+header.Count2); i++) { data = (TVecData *)list->Items[i]; VecDraw->SaveToSTYFile(hFile, data, header.Version); } return true; fail : return false; } //--------------------------------------------------------------------------- // Merge³ª Read¸¦ À§ÇØ ¶óµð¿À¹öưÀÎ Whole StyleÀ» ¼±ÅÃÇßÀ» ¶§.. void __fastcall TStyleIllustForm::rbWholeStyleClick(TObject *Sender) { rbWholeStyle->Checked = true; rbTopStyle->Checked = false; rbBottomStyle->Checked = false; } //--------------------------------------------------------------------------- // Merge³ª Read¸¦ À§ÇØ ¶óµð¿À¹öưÀÎ Top StyleÀ» ¼±ÅÃÇßÀ» ¶§.. void __fastcall TStyleIllustForm::rbTopStyleClick(TObject *Sender) { rbWholeStyle->Checked = false; rbTopStyle->Checked = true; rbBottomStyle->Checked = false; } //--------------------------------------------------------------------------- // Merge³ª Read¸¦ À§ÇØ ¶óµð¿À¹öưÀÎ Bottom StyleÀ» ¼±ÅÃÇßÀ» ¶§.. void __fastcall TStyleIllustForm::rbBottomStyleClick(TObject *Sender) { rbWholeStyle->Checked = false; rbTopStyle->Checked = false; rbBottomStyle->Checked = true; } //--------------------------------------------------------------------------- // Merge void __fastcall TStyleIllustForm::sbMergeClick(TObject *Sender) { if (rbWholeStyle->Checked == true) { IllustWholeDataMerge(HDPatUpWhole, PatUpWhole, IllustHeader, HDPatDnWhole, PatDnWhole); } if (rbTopStyle->Checked == true) { IllustDataMerge(HDPatUpWhole, PatUpWhole, IllustHeader); } if (rbBottomStyle->Checked == true) { IllustDataMerge(HDPatDnWhole, PatDnWhole, IllustHeader); } } //--------------------------------------------------------------------------- // Read void __fastcall TStyleIllustForm::sbReadClick(TObject *Sender) { if (rbWholeStyle->Checked == true) { IllustWholeDataOpen(HDPatUpWhole, PatUpWhole, IllustHeader, HDPatDnWhole, PatDnWhole); } if (rbTopStyle->Checked == true) { IllustDataOpen(HDPatUpWhole, PatUpWhole, IllustHeader); } if (rbBottomStyle->Checked == true) { IllustDataOpen(HDPatDnWhole, PatDnWhole, IllustHeader); } } //--------------------------------------------------------------------------- // À̹ÌÁö¸¦ ¹Ù²Ù±â.. - by monkman void __fastcall TStyleIllustForm::sbImageChangeClick(TObject *Sender) { //shImageChange->Brush->Color = clRed; sbImageChange->Enabled = false; sbFrontStyle->Enabled = false; sbBackStyle->Enabled = false; PopupChangeClick(this); sbImageChange->Enabled = true; sbFrontStyle->Enabled = true; sbBackStyle->Enabled = true; //shImageChange->Brush->Color = clBlack; } //--------------------------------------------------------------------------- // º¤ÅÍ ½ºÅ¸ÀÏ ¾Õ¸é º¸±â void __fastcall TStyleIllustForm::sbFrontStyleClick(TObject *Sender) { // ¾Õ¸é º¸±â iFlag = 0; //shFrontStyle->Brush->Color = clRed; //shBackStyle->Brush->Color = clBlack; PaintBoxUpStyle->Repaint(); PaintBoxDownStyle->Repaint(); } //--------------------------------------------------------------------------- // º¤ÅÍ ½ºÅ¸ÀÏ µÞ¸é º¸±â void __fastcall TStyleIllustForm::sbBackStyleClick(TObject *Sender) { // µÞ¸é º¸±â iFlag = 1; //shFrontStyle->Brush->Color = clBlack; //shBackStyle->Brush->Color = clRed; PaintBoxUpStyle->Repaint(); PaintBoxDownStyle->Repaint(); } //--------------------------------------------------------------------------- // ÆÄÀÏ »èÁ¦ void __fastcall TStyleIllustForm::sbDeleteClick(TObject *Sender) { TFileInfor*fi; // ½ºÅ¸ÀÏ Á¤º¸ ÃʱâÈ­ InitInformation(); // ¸î ¹øÂ° ¼¿À» Âï¾ú´ÂÁö ¼¿¹øÈ£¸¦ ¾ò¾î¿À°í, ±× ¹øÈ£¿¡ ÇØ´çÇÏ´Â ÆÄÀÏÀ» fi¿¡¼­ °¡Á®¿Â ÈÄ // Á¤º¸¸¦ °¡Á®¿Â´Ù if ((row*3+col) < TagList->Count && TagList->Count) { fi = (TFileInfor *) TagList->Items[row*3 + col]; // ÆÄÀÏÀÌ ÀÖÀ» °æ¿ì if (!fi->Path.IsEmpty()) { // ¼±ÅÃµÈ ÆÄÀÏÀ» »èÁ¦ÇϽðڽÀ´Ï±î? if (MessageDlg(IDS_MESSAGE3, mtConfirmation, TMsgDlgButtons() << mbYes << mbNo, 0) == mrYes) { DeleteFile(fi->Path.c_str()); // À̹ÌÁö¸¦ ¹Ù²Ù¾úÀ»Áö ¸ð¸£¹Ç·Î ÃʱâÈ­ÇÑ´Ù.. InitData(); // ½ºÅ¸ÀÏ Á¤º¸ ÃʱâÈ­ InitInformation(); } } } } //--------------------------------------------------------------------------- bool __fastcall TStyleIllustForm::STILockValidate(HANDLE hFile, ILLUSTDATAFILEHEADER header) { // STY Lock °ü·Ã üũ - by monkman (2004.11.02) DWORD dwRead; double dVersion; short nVolume; BYTE cReadSerialNumber[4][9]; BYTE cReadSeedCode[9]; AnsiString strSerialNumber[4], strSeedCode, strTemp; unsigned int nSerialNumber[4]; unsigned int nSeedCode, nKey; Crypt = new TCrypt; memset(cReadSerialNumber, 0, sizeof(cReadSerialNumber)); memset(cReadSeedCode, 0, sizeof(cReadSeedCode)); memset(nSerialNumber, 0, sizeof(nSerialNumber)); // Header¿¡¼­ ÇÊ¿äÇÑ Á¤º¸µéÀ» º¹»ç // Version : 1.8 (double - 8Byte - ºñ¾Ïȣȭ) // Volume : 1 (short - 2Byte - ºñ¾Ïȣȭ) // SeedCode : 1 (Byte * 9 - 9Byte - '\0'°¡ Ãß°¡µÇ¾úÀ½ - ¾Ïȣȭ(Version°ú Volume·Î..) // Key : 1 (unsigned int - 4Byte - ºñ¾Ïȣȭ) // Header ÀÌÈÄ¿¡ ÇÊ¿äÇÑ Á¤º¸ // SerialNumber : 11538-27371-1260-34147 (Byte * 4 * 9 - 36Byte - ¾Ïȣȭ(Key·Î¸¸..)) memcpy(&dVersion, header.Reserved, sizeof(dVersion)); memcpy(&nVolume, (header.Reserved)+sizeof(dVersion), sizeof(nVolume)); memcpy(cReadSeedCode, (header.Reserved)+sizeof(dVersion)+sizeof(nVolume), sizeof(cReadSeedCode)); memcpy(&nKey, (header.Reserved)+sizeof(dVersion)+sizeof(nVolume)+sizeof(cReadSeedCode), sizeof(nKey)); if (!ReadFile(hFile, cReadSerialNumber, sizeof(cReadSerialNumber), &dwRead, NULL)) goto fail; for (int i = 0; i < 4; i++) { strSerialNumber[i] = strTemp.sprintf(cReadSerialNumber[i]); strSerialNumber[i] = Crypt->DeCode(strSerialNumber[i], 0.0, nKey); nSerialNumber[i] = StrToInt(strSerialNumber[i]); } strSeedCode = strTemp.sprintf(cReadSeedCode); strSeedCode = Crypt->DeCode(strSeedCode, dVersion, nVolume); nSeedCode = StrToInt(strSeedCode); if (Crypt) { delete Crypt; Crypt = NULL; } #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC if (HASP_SerialNumber[0] == (unsigned int)nSerialNumber[0] && HASP_SerialNumber[1] == (unsigned int)nSerialNumber[1] && HASP_SerialNumber[2] == (unsigned int)nSerialNumber[2] && HASP_SerialNumber[3] == (unsigned int)nSerialNumber[3] && HASP_SeedCode == nSeedCode) return true; else return false; #endif #endif fail : if (Crypt) { delete Crypt; Crypt = NULL; } // ¸Þ½ÃÁö : ÇØ´ç ÆÄÀÏ¿¡ ¹®Á¦°¡ À־ ÆÄÀÏÀ» Àоî¿Ã ¼ö ¾ø½À´Ï´Ù. //MessageDlg(IDS_MESSAGE6, mtError, TMsgDlgButtons() << mbOK, 0); return false; } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::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] != '.') { // ÆÐ½º Àç¼³Á¤ _stprintf(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 == "style") { comboSource->Items->Insert(0, wfd.cFileName); } else if (strLowerFileName != "detail" && strLowerFileName != "guideimage" // Stylist¿¡¼­ »ç¿ëÇÏ´Â µð·ºÅ丮ÀÏ °æ¿ì && strLowerFileName != "stisample" && strLowerFileName != "texstylist" && strLowerFileName != "material") { 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 TStyleIllustForm::comboSourceChange(TObject *Sender) { DirectoryStyle = strRootPath + "\\" + comboSource->Items->Strings[comboSource->ItemIndex]; STYDetailSelectedSave(comboSource->Items->Strings[comboSource->ItemIndex]); comboSource->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::sbChangeBaseDirectoryClick( TObject *Sender) { String Msg; String strOldRootPath; shChangeBaseDirectory->Pen->Color = clRed; strOldRootPath = strRootPath; strRootPath = BaseDirectoryDialogFunc("StyleIllustForm", strRootPath); Msg = IDS_MESSAGE4 + strRootPath + IDS_MESSAGE5; if (strOldRootPath.LowerCase() != strRootPath.LowerCase()) { // ¸Þ½ÃÁö : ±âº» Æú´õ°¡ <Æú´õ¸í>·Î º¯°æµÇ¾ú½À´Ï´Ù. MessageDlg(Msg, mtInformation, TMsgDlgButtons() << mbOK, 0); FindFolder(strRootPath + "\\*.*"); if (comboSource->Items->Count >= 0) { comboSource->ItemIndex = 0; DirectoryStyle = strRootPath + "\\" + comboSource->Items->Strings[comboSource->ItemIndex]; } comboSourceChange(this); } shChangeBaseDirectory->Pen->Color = clBlack; } //--------------------------------------------------------------------------- void __fastcall TStyleIllustForm::STYDetailSelectedSave(String strSelectedDetailDirectory) { // Style.ini ÆÄÀÏ¿¡¼­ ¾ò¾î¿Â STYPath °ª - by monkman (2004.10.12) TIniFile *IniFile = NULL; IniFile = new TIniFile(AppDataItem+"\\Style.ini"); if (IniFile) { IniFile->WriteString("StyleIllustForm", "STYDirectory", strSelectedDetailDirectory); delete IniFile; } IniFile = NULL; } //---------------------------------------------------------------------------