//--------------------------------------------------------------------------- #include #include "Common.h" #pragma hdrstop #include "Texture_F.h" #include "Exception.h" #include "MainImage.h" #include "Palette.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "RzButton" #pragma resource "*.dfm" //--------------------------------------------------------------------------- #define IDS_TEXTUREFORM StringTable[0] #define IDS_FOUNDATION StringTable[1] #define IDS_DERIVATION StringTable[2] #define IDS_SPECIALITY StringTable[3] #define IDS_PLAIN StringTable[4] #define IDS_TWILL StringTable[5] #define IDS_SATIN StringTable[6] #define IDS_SPECIALTEXTURE StringTable[7] //--------------------------------------------------------------------------- TTextureForm *TextureForm; //--------------------------------------------------------------------------- __fastcall TTextureForm::TTextureForm(TComponent* Owner) : TForm(Owner) { //=============================== 2001.6.19 lhskys FormCreate(TObject *Sender)³»¿ë ¿Å±è Texture = NULL; Bitmap = NULL; StringTable.Create(DirectoryBin, Language, "Texture"); //=================================== SetSmallFont(Font); Caption = IDS_TEXTUREFORM; sbFound->Caption = IDS_FOUNDATION; sbDerive->Caption = IDS_DERIVATION; sbSpecial->Caption = IDS_SPECIALITY; PlainText->Caption = IDS_PLAIN; TwillText->Caption = IDS_TWILL; SatinText->Caption = IDS_SATIN; //=================================== } //--------------------------------------------------------------------------- void __fastcall TTextureForm::FormCreate(TObject *Sender) { //=============================== 2001.6.19 lhskys FormCreate(TObject *Sender)³»¿ë ¿Å±è bFree = false; } //--------------------------------------------------------------------------- bool __fastcall TTextureForm::InitForm() { RGBQUAD rgb[2]; Texture = new TTexture; if (Texture->Create(DirectoryTexture) == false) return false; Bitmap = new Graphics::TBitmap; Bitmap->PixelFormat = pf8bit; Bitmap->Width = TextureGrid->DefaultColWidth; Bitmap->Height = TextureGrid->DefaultRowHeight-20; rgb[0].rgbRed = 255; rgb[0].rgbGreen = 255; rgb[0].rgbBlue = 255; rgb[1].rgbRed =0; rgb[1].rgbGreen = 0; rgb[1].rgbBlue = 0; SetDIBColorTable(Bitmap->Canvas->Handle, 0, 2, rgb); TIniFile *IniFile = new TIniFile(AppDataItem + "\\Main.ini"); if (IniFile) { Left = IniFile->ReadInteger("TextureTable", "FormLeft", 10); Top = IniFile->ReadInteger("TextureTable", "FormTop", 50); Width = IniFile->ReadInteger("TextureTable", "FormWidth", 333); Height = IniFile->ReadInteger("TextureTable", "FormHeight", 620); delete IniFile; } if (MainImageForm && MainImageForm->Height < this->Height) {//GetSystemMetrics(SM_CYSCREEN) //1024 x 768 ÇØ»óµµ¸¦ À§ÇÑ Resize Left = 2; Top = 2; Width = 520; Height = 650; } Item = 0; Index = 0; ptsItem = 0; FoundListFill(); Add_Color = true; return true; } //--------------------------------------------------------------------------- void __fastcall TTextureForm::FormDestroy(TObject *Sender) { TIniFile *IniFile = new TIniFile(AppDataItem + "\\Main.ini"); if (IniFile) { if (Left<0) Left = 10; if (Top<0) Top = 10; IniFile->WriteInteger("TextureTable", "FormLeft", Left); IniFile->WriteInteger("TextureTable", "FormTop", Top); IniFile->WriteInteger("TextureTable", "FormWidth", Width); IniFile->WriteInteger("TextureTable", "FormHeight", Height); delete IniFile; } if (Bitmap) delete Bitmap; if (Texture) delete Texture; } //--------------------------------------------------------------------------- void __fastcall TTextureForm::FormResize(TObject *Sender) { int h, lh , spbtnwidth; RGBQUAD rgb[2]; h = Panel1->Height - PlainText->Height - TwillText->Height - SatinText->Height; lh = h/3; PlainListBox->Height = lh; TwillListBox->Height = lh; // TextureGrid->DefaultColWidth = TextureGrid->Width / TextureGrid->ColCount; // TextureGrid->DefaultRowHeight = TextureGrid->Height / TextureGrid->RowCount; /* if(TextureGrid->DefaultColWidth < TextureGrid->DefaultRowHeight) TextureGrid->DefaultRowHeight = TextureGrid->DefaultColWidth; else TextureGrid->DefaultColWidth = TextureGrid->DefaultRowHeight; */ Bitmap->Width = TextureGrid->DefaultColWidth; Bitmap->Height = TextureGrid->DefaultRowHeight-20; //------------------------------------------------------------------------- //while(TextureGrid->ColCount*TextureGrid->RowCount < 25) // TextureGrid->RowCount = TextureGrid->RowCount+1; //------------------------------------------------------------------------- //±âÁ¸¿¡´Â size°¡ 25°³ ÀÌÇÏ·Î Á¦ÇѵǾî À־ 25°³°¡ ³Ñ¾î°¡¸é FormResize¸¦ //ÇÏÁö ¾Ê´Â ÀÌ»ó º¸ÀÌÁö ¾Ê°Ô µÇ¾î ÀÖ¾ú´Ù. ±×·¡¼­ ¼öÁ¤ by david 090122 CalTextureGridRowColCount(); //Row, Col °è»ê Ãß°¡ by david 090803 //------------------------------------------------------------------------- if(TextureGrid->Width < TextureGrid->DefaultColWidth) { // over at least One Column TextureForm->Width = TextureForm->Width + TextureGrid->DefaultColWidth - TextureGrid->Width; TextureGrid->ColCount = 1; } spbtnwidth = (Panel2->Width - 90)/3; //SpeedBtn Width sbFound->Width = spbtnwidth; sbDerive->Width = spbtnwidth; sbSpecial->Width = spbtnwidth; // // sbFound->Left = 0; //SpeedBtn Location // sbDerive->Left = spbtnwidth; // sbSpecial->Left = 2*spbtnwidth; // sbZoomIn->Left = Panel2->Width - 100; // ZoEdit->Left = Panel2->Width - 100 + sbZoomIn->Width; // sbZoomout->Left = Panel2->Width - 100 + sbZoomIn->Width + ZoEdit->Width; rgb[0].rgbRed = 255; rgb[0].rgbGreen = 255; rgb[0].rgbBlue = 255; rgb[1].rgbRed =0; rgb[1].rgbGreen = 0; rgb[1].rgbBlue = 0; SetDIBColorTable(Bitmap->Canvas->Handle, 0, 2, rgb); TextureGrid->Repaint(); } //--------------------------------------------------------------------------- void __fastcall TTextureForm::FormShow(TObject *Sender) { // FoundListFill(); } //--------------------------------------------------------------------------- void __fastcall TTextureForm::sbFoundClick(TObject *Sender) { Item = 0; ptsItem = 0; Index = 0; PlainText->Caption = IDS_PLAIN; TwillText->Enabled = true; SatinText->Enabled = true; FoundListFill(); CalTextureGridRowColCount();//Row, Col °è»ê Ãß°¡ by david 090803 TextureGrid->Repaint(); if (FOnButtonChange) FOnButtonChange(this); } //--------------------------------------------------------------------------- void __fastcall TTextureForm::sbDeriveClick(TObject *Sender) { Item = 1; ptsItem = 0; Index = 0; PlainText->Caption = IDS_PLAIN; TwillText->Enabled = true; SatinText->Enabled = true; DerivListFill(); CalTextureGridRowColCount();//Row, Col °è»ê Ãß°¡ by david 090803 TextureGrid->Repaint(); if (FOnButtonChange) FOnButtonChange(this); } //--------------------------------------------------------------------------- void __fastcall TTextureForm::sbSpecialClick(TObject *Sender) { Item = 2; ptsItem = 0; Index = 0; PlainText->Caption = IDS_SPECIALTEXTURE; TwillText->Enabled = false; SatinText->Enabled = false; SpecialListFill(); CalTextureGridRowColCount();//Row, Col °è»ê Ãß°¡ by david 090803 TextureGrid->Repaint(); if (FOnButtonChange) FOnButtonChange(this); } //---------------------------------------------------------------------------- void __fastcall TTextureForm::ListBoxClick(TObject *Sender) { int nCheckIndex = 0; if ((TListBox *) Sender==PlainListBox) ptsItem = 0; else if ((TListBox *) Sender==TwillListBox) ptsItem = 1; else if ((TListBox *) Sender==SatinListBox) ptsItem = 2; Unselected(); nCheckIndex = ((TListBox *) Sender)->ItemIndex; // ¸®½ºÆ® ¹üÀ§¾È¿¡¼­¸¸ - by monkman (2009.09.17) if (Item == 0 && (0 > nCheckIndex || Texture->f[ptsItem]->Count <= nCheckIndex)) return; else if (Item == 1 && (0 > nCheckIndex || Texture->d[ptsItem]->Count <= nCheckIndex)) return; else if (Item == 2 && (0 > nCheckIndex || Texture->s->Count <= nCheckIndex)) return; Index = nCheckIndex; CalTextureGridRowColCount();//Row, Col °è»ê Ãß°¡ by david 090803 TextureGrid->Row = 0; TextureGrid->Col = 0; TextureGrid->Repaint(); if (FOnListChange) FOnListChange(this); } //---------------------------------------------------------------------------- //Row, Col °è»ê Ãß°¡ by david 090803 void __fastcall TTextureForm::CalTextureGridRowColCount() { // GridÀÇ GridLineWidth¿Í ½ºÅ©·Ñ¹Ù ³Êºñ±îÁö °è»êÇØ¾ß ÇÑ´Ù - by monkman (2010.01.08) TextureGrid->ColCount = (TextureGrid->Width-(TextureGrid->ColCount*TextureGrid->GridLineWidth)-22)/TextureGrid->DefaultColWidth; //Col-Row Count TextureGrid->RowCount = TextureGrid->Height/TextureGrid->DefaultRowHeight; TList *dstTextureItemList = NULL; if (Item == TAFoundation) dstTextureItemList = Texture->f[ptsItem]; else if (Item == TADerivation) dstTextureItemList = Texture->d[ptsItem]; else if (Item == TASpecial) dstTextureItemList = Texture->s; TTextureItem *dstTextureItem = static_cast(dstTextureItemList->Items[Index]); int count = dstTextureItem->data->Count; if (TextureGrid->ColCount*TextureGrid->RowCount > count) { while(TextureGrid->ColCount*TextureGrid->RowCount < count) TextureGrid->RowCount = TextureGrid->RowCount-1; } else { while(TextureGrid->ColCount*TextureGrid->RowCount < count) TextureGrid->RowCount = TextureGrid->RowCount+1; } } //---------------------------------------------------------------------------- void __fastcall TTextureForm::sbZoomInClick(TObject *Sender) { Byte zoom; int temp; zoom = StrToInt(ZoEdit->Text); if (zoom<9) { zoom = zoom+1; temp = (int) zoom; ZoEdit->Text = temp; TextureGrid->Repaint(); if (FOnZoomChange) FOnZoomChange(this); } } //---------------------------------------------------------------------------- void __fastcall TTextureForm::sbZoomoutClick(TObject *Sender) { Byte zoom; int temp; zoom = StrToInt(ZoEdit->Text); if (zoom>1) { zoom = zoom-1; temp = (int) zoom; ZoEdit->Text = temp; TextureGrid->Repaint(); if (FOnZoomChange) FOnZoomChange(this); } } //---------------------------------------------------------------------------- void __fastcall TTextureForm::TextureGridDrawCell(TObject *Sender, int Col, int Row, TRect &Rect, TGridDrawState State) { if (Index!=-1) { switch (Item) { case 0: switch (ptsItem) { case 0: FoundDraw(0, Col, Row, Rect); break; case 1: FoundDraw(1, Col, Row, Rect); break; case 2: FoundDraw(2, Col, Row, Rect); break; } break; case 1: switch (ptsItem) { case 0: DerivDraw(0, Col, Row, Rect); break; case 1: DerivDraw(1, Col, Row, Rect); break; case 2: DerivDraw(2, Col, Row, Rect); break; } break; case 2: SpecialDraw(Col, Row, Rect); break; } } } //----------------------------------------------------------------------------- void __fastcall TTextureForm::TextureGridDblClick(TObject *Sender) { TTextureItem *aTextureItem = NULL; switch (Item) { case TAFoundation: aTextureItem = static_cast(Texture->f[ptsItem]->Items[Index]); break; case TADerivation: aTextureItem = static_cast(Texture->d[ptsItem]->Items[Index]); break; case TASpecial: aTextureItem = static_cast(Texture->s->Items[Index]); break; } int n = TextureGrid->Row*TextureGrid->ColCount+TextureGrid->Col; if (n > aTextureItem->data->Count -1) return; if (FOnChange) FOnChange(this); if (Add_Color){ ColIndex = MainImageForm->Palette->UseColor+1; // MainImageForm->Palette->UseColor = ColIndex; PaletteForm->DIB256Palette->ChoiceIndex = ColIndex; Add_Color = false; } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::Splitter1Moved(TObject *Sender) { TextureGrid->ColCount = TextureGrid->Width/150; //Col-Row Count TextureGrid->RowCount = TextureGrid->Height/150; while(TextureGrid->ColCount*TextureGrid->RowCount < 25) TextureGrid->RowCount = TextureGrid->RowCount+1; if(TextureGrid->Width < 150) { // over at least One Column TextureForm->Width = TextureForm->Width + 150 - TextureGrid->Width; TextureGrid->ColCount = 1; } CalTextureGridRowColCount();//Row, Col °è»ê Ãß°¡ by david 090803 } //--------------------------------------------------------------------------- //// Private Method //////////////////////////////////////////////////////// //--------------------------------------------------------------------------- void __fastcall TTextureForm::FoundListFill() { int i, k, m; PlainListBox->Clear(); TwillListBox->Clear(); SatinListBox->Clear(); for (k=0; k<3; k++) { m = Texture->f[k]->Count; for (i=0; i(Texture->f[k]->Items[i]); switch (k) { case 0: PlainListBox->Items->Add(Format(" %d x %d", OPENARRAY(TVarRec, (aTextureItem->size, aTextureItem->size)))); break; case 1: TwillListBox->Items->Add(Format(" %d x %d", OPENARRAY(TVarRec, (aTextureItem->size, aTextureItem->size)))); break; case 2: SatinListBox->Items->Add(Format(" %d x %d", OPENARRAY(TVarRec, (aTextureItem->size, aTextureItem->size)))); break; } } } PlainListBox->ItemIndex = 0; } //--------------------------------------------------------------------------- void __fastcall TTextureForm::DerivListFill() { int i, k, m; PlainListBox->Clear(); TwillListBox->Clear(); SatinListBox->Clear(); for (k=0; k<3; k++) { m = Texture->d[k]->Count; for (i=0; i(Texture->d[k]->Items[i]); switch (k) { case 0: PlainListBox->Items->Add(aTextureItem->name); break; case 1: TwillListBox->Items->Add(aTextureItem->name); break; case 2: SatinListBox->Items->Add(aTextureItem->name); break; } } } PlainListBox->ItemIndex = 0; } //--------------------------------------------------------------------------- void __fastcall TTextureForm::SpecialListFill() { int i, m; PlainListBox->Clear(); TwillListBox->Clear(); SatinListBox->Clear(); m = Texture->s->Count; for (i=0; i(Texture->s->Items[i]); PlainListBox->Items->Add(aTextureItem->name); } PlainListBox->ItemIndex = 0; } //--------------------------------------------------------------------------- void __fastcall TTextureForm::Unselected() { switch (ptsItem) { case 0: TwillListBox->ItemIndex = -1; SatinListBox->ItemIndex = -1; break; case 1: PlainListBox->ItemIndex = -1; SatinListBox->ItemIndex = -1; break; case 2: PlainListBox->ItemIndex = -1; TwillListBox->ItemIndex = -1; break; } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::FoundDraw(Byte pts, int Col, int Row, TRect dRect) { short dx, dy; TTexBitData *bip; TTextureItem *aTextureItem = static_cast(Texture->f[pts]->Items[Index]); if (Col+Row*TextureGrid->ColCount<=aTextureItem->data->Count-1) { bip = (TTexBitData *) aTextureItem->data->Items[Col+Row*TextureGrid->ColCount]; DrawBitmap(bip); // dy = TextureGrid->DefaultRowHeight; // dx = TextureGrid->DefaultColWidth; TextureGrid->Canvas->Draw(dRect.Left, dRect.Top, Bitmap); LineDraw(Col, Row, dRect, bip); TitleText(Col, Row, dRect, bip); } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::DerivDraw(Byte pts, int Col, int Row, TRect dRect) { short dx, dy; TTexBitData *bip; TTextureItem *aTextureItem = static_cast(Texture->d[pts]->Items[Index]); if (Col+Row*TextureGrid->ColCount<=aTextureItem->data->Count-1) { bip = (TTexBitData *) aTextureItem->data->Items[Col+Row*TextureGrid->ColCount]; DrawBitmap(bip); // dy = TextureGrid->DefaultRowHeight; // dx = TextureGrid->DefaultColWidth; // TextureGrid->Canvas->Draw(Col*(dx+2), Row*(dy+2) , Bitmap); TextureGrid->Canvas->Draw(dRect.Left, dRect.Top, Bitmap); LineDraw(Col, Row, dRect, bip); TitleText(Col, Row, dRect, bip); } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::SpecialDraw(int Col, int Row, TRect dRect) { short dx, dy; TTexBitData *bip; TTextureItem *aTextureItem = static_cast(Texture->s->Items[Index]); if (Col+Row*TextureGrid->ColCount<=aTextureItem->data->Count-1) { bip = (TTexBitData *) aTextureItem->data->Items[Col+Row*TextureGrid->ColCount]; DrawBitmap(bip); // dy = TextureGrid->DefaultRowHeight; // dx = TextureGrid->DefaultColWidth; TextureGrid->Canvas->Draw(dRect.Left, dRect.Top, Bitmap); LineDraw(Col, Row, dRect, bip); TitleText(Col, Row, dRect, bip); } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::DrawBitmap(TTexBitData *bip) { short x, y, j, w, r, rw, zr, tot, spt, zh, zw; Byte zoom, z; Byte *sl, *stp, *temp, *pcx, *pcy; zoom = StrToInt(ZoEdit->Text); stp = bip->pBitmap; pcy = stp; temp = stp; zw = bip->Width*zoom; zh = bip->Height*zoom; w = Bitmap->Width/zw; rw = Bitmap->Width%zw; if (w==0) w = 1; for (y=Bitmap->Height-1; y>=0; y--) { sl =(Byte*) Bitmap->ScanLine[y]; spt = Bitmap->Height-1-y; if ((spt%zoom)pBitmap; for (j=0; jWidth; r++) { zr = r*zoom; for (z=0; z=Bitmap->Width) break; sl[tot] = Byte(*pcx); } pcx = pcx+1; pcy = pcx; } } if ((Bitmap->Width>zw) && (rw!=0)) { pcx = stp; for (r=0; rWidth; r++) { for (z=0; zWidth-rw)+(r*zoom)+z; if (tot>=Bitmap->Width) break; sl[tot] = Byte(*pcx); } pcx = pcx+1; } } } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::LineDraw(int col, int row, TRect dRect, TTexBitData *bip) { short dx, dy, sx, sy, w, h, i, j, vj; Byte zoom; zoom = StrToInt(ZoEdit->Text); if (zoom<4) return; dy = TextureGrid->DefaultRowHeight; dx = TextureGrid->DefaultColWidth; sx = col*(dx+2); sy = row*(dy+2)+Bitmap->Height; w = bip->Width*zoom; h = bip->Height*zoom; if (zoom>6) { for (i=0; iWidth; i++) { if ((i%zoom)==0) { TextureGrid->Canvas->Pen->Color = clBlue; if ((i%w)==0) TextureGrid->Canvas->Pen->Color = clRed; TextureGrid->Canvas->MoveTo(sx+i, sy); TextureGrid->Canvas->LineTo(sx+i, sy-Bitmap->Height); } } for (j=Bitmap->Height-1; j>=0; j--) { vj = Bitmap->Height-1-j; if ((vj%zoom)==0) { TextureGrid->Canvas->Pen->Color = clBlue; if ((vj%h)==0) TextureGrid->Canvas->Pen->Color = clRed; TextureGrid->Canvas->MoveTo(sx, sy-vj); TextureGrid->Canvas->LineTo(sx+Bitmap->Width, sy-vj); } } } else if (zoom>3) { for (i=0; iWidth; i++) { if ((i%w)==0) { TextureGrid->Canvas->Pen->Color = clRed; TextureGrid->Canvas->MoveTo(sx+i, sy); TextureGrid->Canvas->LineTo(sx+i, sy-Bitmap->Height); } } for (j=Bitmap->Height-1; j>=0; j--) { vj = Bitmap->Height-1-j; if ((vj%h)==0) { TextureGrid->Canvas->Pen->Color = clRed; TextureGrid->Canvas->MoveTo(sx, sy-vj); TextureGrid->Canvas->LineTo(sx+Bitmap->Width, sy-vj); } } } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::TitleText(int Col, int Row, TRect dRect, TTexBitData *bip) { int tab; String Name; TRect StrRect; Name = Format("<< %s >> %d x %d", OPENARRAY(TVarRec, (bip->Name, bip->Width, bip->Height))); // Name = Format("<< %d >> %d x %d", OPENARRAY(TVarRec, (Col+1+Row*TextureGrid->ColCount, // bip->Width, bip->Height))); tab = (TextureGrid->DefaultColWidth-TextureGrid->Canvas->TextWidth(Name))/2; if (tab<0) tab = 0; StrRect = Rect(dRect.Left, dRect.Bottom-18, dRect.Left+TextureGrid->DefaultColWidth, dRect.Bottom-2); TextureGrid->Canvas->TextRect(StrRect, dRect.Left+tab, StrRect.Top+2, Name); } //--------------------------------------------------------------------------- //// Public Method //////////////////////////////////////////////////////// //--------------------------------------------------------------------------- // Texture file method // void __fastcall TTextureForm::NewDirectory(int wid) { String name = L""; if (Item != TAFoundation) { if (InputQuery(IDS_COMMON_NEWDIR, IDS_COMMON_INPUTNAME, name) == false) return; } else { name = IntToStr(wid); } if (name != L"") { TList *dstTextureItemList = NULL; if (Item == TAFoundation) dstTextureItemList = Texture->f[ptsItem]; else if (Item == TADerivation) dstTextureItemList = Texture->d[ptsItem]; else if (Item == TASpecial) dstTextureItemList = Texture->s; for (int i = 0; i < dstTextureItemList->Count; i++) { TTextureItem *aTextureItem = static_cast(dstTextureItemList->Items[i]); if (aTextureItem->name == name) { MessageDlg(name+" "+String(IDS_MESSAGE_DIREXIST), mtWarning, TMsgDlgButtons() << mbOK, 0); return; } } Texture->NewDirectory(Item, ptsItem, DirectoryTexture, name); String caption = L""; if (Item == TAFoundation) caption = Format(" %s x %s", OPENARRAY(TVarRec, (name, name))); else caption = name; if (ptsItem == 0) PlainListBox->Items->Add(caption); else if (ptsItem == 1) TwillListBox->Items->Add(caption); else SatinListBox->Items->Add(caption); } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::ExtractData(TTexBitData **bip) { TTextureItem *aTextureItem = NULL; int n = TextureGrid->Row*TextureGrid->ColCount+TextureGrid->Col; if (Item == 0) aTextureItem = (TTextureItem *)Texture->f[ptsItem]->Items[Index]; else if (Item == 1) aTextureItem = (TTextureItem *)Texture->d[ptsItem]->Items[Index]; else if (Item == 2) aTextureItem = (TTextureItem *)Texture->s->Items[Index]; *bip = (TTexBitData *) aTextureItem->data->Items[n]; } //--------------------------------------------------------------------------- void __fastcall TTextureForm::OverWriteTexture() { Texture->SaveTexture(Item, ptsItem, Index); TextureGrid->Repaint(); } //--------------------------------------------------------------------------- void __fastcall TTextureForm::DeleteTexture() { TList *dstTextureItemList = NULL; if (Item == TAFoundation) dstTextureItemList = Texture->f[ptsItem]; else if (Item == TADerivation) dstTextureItemList = Texture->d[ptsItem]; else if (Item == TASpecial) dstTextureItemList = Texture->s; TTextureItem *dstTextureItem = static_cast(dstTextureItemList->Items[Index]); int textureIdx = TextureGrid->Row * TextureGrid->ColCount + TextureGrid->Col; TTexBitData *dstTexBitData = static_cast(dstTextureItem->data->Items[textureIdx]); String str = Format("<< %s >> %d x %d", OPENARRAY(TVarRec, (dstTexBitData->Name, dstTexBitData->Width, dstTexBitData->Height))); if (MessageDlg(IDS_MESSAGE_DELETETEXTURE + str, mtWarning, TMsgDlgButtons() << mbOK << mbCancel, 0) == mrOk) { Texture->DeleteTexture(Item, ptsItem, Index, textureIdx); TextureGrid->Repaint(); } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::DeleteTextureGroup() { TList *dstTextureItemList = NULL; if (Item == TAFoundation) dstTextureItemList = Texture->f[ptsItem]; else if (Item == TADerivation) dstTextureItemList = Texture->d[ptsItem]; else if (Item == TASpecial) dstTextureItemList = Texture->s; TTextureItem *dstTextureItem = static_cast(dstTextureItemList->Items[Index]); String str; if (Item == TAFoundation) str = Format(" \"%d x %d\"", OPENARRAY(TVarRec, (dstTextureItem->size, dstTextureItem->size))); else str = Format(" \"%s\"", OPENARRAY(TVarRec, (dstTextureItem->name))); if (MessageDlg(IDS_MESSAGE_DELETEFILE + str, mtWarning, TMsgDlgButtons() << mbOK << mbCancel, 0) == mrOk) { Texture->DeleteTextureGroup(Item, ptsItem, Index); if (ptsItem == 0) PlainListBox->Items->Delete(Index); else if (ptsItem == 1) TwillListBox->Items->Delete(Index); else SatinListBox->Items->Delete(Index); Index = 0; TextureGrid->Repaint(); } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::RenameTexture() { String name = ""; if (InputQuery(IDS_COMMON_RENAME, IDS_COMMON_INPUTNAME, name)) { if (name != "") { int textureIdx = TextureGrid->Row * TextureGrid->ColCount + TextureGrid->Col; Texture->RenameTexture(Item, ptsItem, Index, textureIdx, name); TextureGrid->Repaint(); } } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::RenameTextureGroup() { String name = ""; if (InputQuery(IDS_COMMON_RENAME, IDS_COMMON_INPUTNAME, name)) { if (name != "") { if (Texture->RenameTextureGroup(Item, ptsItem, Index, name) == true) { if (ptsItem == 0) PlainListBox->Items->Strings[Index] = name; else if (ptsItem == 1) TwillListBox->Items->Strings[Index] = name; else SatinListBox->Items->Strings[Index] = name; } } } } //--------------------------------------------------------------------------- void __fastcall TTextureForm::FormClose(TObject *Sender, TCloseAction &Action) { if (FOnCloseForm) FOnCloseForm(); if (bFree) Action = caFree; } //---------------------------------------------------------------------------