//--------------------------------------------------------------------------- #include #pragma hdrstop #include #include "Define.h" #include "T3DMapping.h" #include "MainImage.h" #include "Main.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TT3DMappingForm *T3DMappingForm; //--------------------------------------------------------------------------- __fastcall TT3DMappingForm::TT3DMappingForm(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TT3DMappingForm::UpdateItems() { T3DMappingView->Items->Clear(); MappingList->Clear(); TFileInfor *FileInfo = NULL; TListItem *pItem; int imgindex = 0; AnsiString FileName; TTexVersion *ver; HANDLE hFile = INVALID_HANDLE_VALUE; TPException ec = EC_NONE; if ((FileInfo = new TFileInfor)==NULL) { ec = EC_MEMORY_LACK; goto fail; } if ((FileInfo->Bitmap = new Graphics::TBitmap)==NULL) { ec = EC_MEMORY_LACK; goto fail; } for (int i = 1 ; i <= 10 ; i++) { FileName = i; FileName = DirectoryItem + "\\" + FileName + ".tex"; if ((hFile = CreateFile(FileName.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; if (!LoadFromTexpiaTag(hFile, FileInfo, ver)) goto next; MappingList->Add(FileInfo->Bitmap, NULL); pItem = T3DMappingView->Items->Add(); pItem->ImageIndex = imgindex; imgindex++; CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; } if (FileInfo) delete FileInfo; return; fail: EXCEPTION_MESSAGE_OK(ec); next: if (FileInfo) delete FileInfo; return; } //--------------------------------------------------------------------------- void __fastcall TT3DMappingForm::T3DMappingViewDblClick(TObject *Sender) { int n; AnsiString T3DMFileName; if (!T3DMappingView->Selected) return; n = T3DMappingView->Selected->Index; T3DMFileName = n + 1; Edit1->Text = T3DMFileName + ".tex"; } //--------------------------------------------------------------------------- void __fastcall TT3DMappingForm::SpeedButton2Click(TObject *Sender) { UpdateItems(); } //--------------------------------------------------------------------------- void __fastcall TT3DMappingForm::SpeedButton1Click(TObject *Sender) { // } //---------------------------------------------------------------------------