//--------------------------------------------------------------------------- #include #include #include #include #include #include #include // 2001.4.11 By GreenFish #include // 2001.4.11 By GreenFish #include "Common.h" #pragma hdrstop #include "Main.h" #include "FileManager_F.h" #include "Exception.h" #include "MainImage.h" //2001.4.11. lhskys »õ·Î¿î MainMenu »ý¼º #include "MainMenu.h" #include "Define.h" #if defined(TEXTILE) #include "Jacquard.h" //2001.7.26 lhskys Jacquard ¿¡¼­ ¹«Á¶°ÇÀúÀå ¹æÁö #include "Palette.h" #endif #if defined(KNIT) #include "FileSize_F.h" #endif //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" #pragma resource "FileIcon.res" #pragma resource "FileIcon2.res" //--------------------------------------------------------------------------- #define IDS_MFOLDER StringTable[0] #define IDS_FILETYPE StringTable[1] #define IDS_DIRECTORY StringTable[2] #define IDS_SEARCH StringTable[3] #define IDS_FILENAME StringTable[4] #define IDS_FOLDERNAME StringTable[5] #define IDS_LARGE StringTable[6] #define IDS_SMALL StringTable[7] #define IDS_LIST StringTable[8] #define IDS_REPORT StringTable[9] #define IDS_REPORT_NAME StringTable[10] #define IDS_REPORT_LAST StringTable[11] #define IDS_MAKE StringTable[12] #define IDS_FCAPTION StringTable[13] #define IDS_COMPRESSION StringTable[14] #define IDS_MESSAGE StringTable[15] #define IDS_PREVIEW StringTable[16] #define IDS_IMAGEPREVIEW StringTable[17] #define IDS_FLOAD StringTable[18] #define IDS_FLOADFULL StringTable[19] #define IDS_FCOPY StringTable[20] #define IDS_FCUT StringTable[21] #define IDS_FPASTE StringTable[22] #define IDS_FSAVE StringTable[23] #define IDS_FDELETE StringTable[24] #define IDS_FRENAME StringTable[25] #define IDS_FPREFERENCE StringTable[26] #define IDS_FILEERASE StringTable[27] #define IDS_FILEDELETE StringTable[28] #define IDS_INVALIDVISION StringTable[29] #define IDS_READSTITCH StringTable[30] #define IDS_READSIZE StringTable[31] #define IDS_ALLSEARCH StringTable[32] #define IDS_WAITING StringTable[33] TFileManagerForm *FileManagerForm; DWORD limit_size = 25000000; //--------------------------------------------------------------------------- __fastcall TFileManagerForm::TFileManagerForm(TComponent* Owner) : TForm(Owner) { //large_view_ing = false; isCreating = true; //======================== 2001.3.27 lhskys FormCreate(TObject *Sender)³»¿ë ¿Å±è TIniFile *IniFile=NULL; int type; //=================================================================== StringTable.Create(DirectoryCommon, Language, "FileManager"); SetSmallFont(Font); SetSmallFont(ListView->Font); SetSmallFont(DirectoryListBox->Font); FDrive = DriveComboBox->Drive; FDirectory = DirectoryListBox->Directory; FFilter = FilterComboBox->Filter; // FFilterIndex = FilterComboBox->ItemIndex; Caption = IDS_FCAPTION; SpeedButtonRead->Caption = IDS_COMMON_READ; SpeedButtonMerge->Caption = IDS_COMMON_MERGE; SpeedButtonSave->Caption = IDS_COMMON_SAVE; SpeedButtonSaveAs->Caption = IDS_COMMON_SAVEAS; SpeedButtonDelete->Caption = IDS_COMMON_DELETE; SpeedButtonMakeFolder->Caption = IDS_MFOLDER; SpeedButtonRename->Caption = IDS_COMMON_RENAME; SpeedButtonExit->Caption = IDS_COMMON_EXIT; Label1->Caption = IDS_COMMON_DRIVE; Label2->Caption = IDS_FILETYPE; Label3->Caption = IDS_DIRECTORY; AllSearch->Caption = IDS_ALLSEARCH; ComboBoxView->Items->Clear(); ComboBoxView->Items->Add(IDS_LARGE); ComboBoxView->Items->Add(IDS_SMALL); ComboBoxView->Items->Add(IDS_LIST); ComboBoxView->Items->Add(IDS_REPORT); CompressCheckBox->Caption = IDS_COMPRESSION; //=================================================================== IniFile = new TIniFile(DirectoryItem + "\\Main.ini"); if (IniFile) { #ifdef TEXTILE //============================================ 2001.4.11. by lhskys congi¿¡¼­ Open ³Ö±â if(MainForm->FILEOPEN){ IniDirName = DirectoryTextileOpen; if(IniDirName == "")IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); MainForm->FILEOPEN = false; }else IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); // IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); //=========================================== #else #ifdef WEAVE //============================================ 2001.4.11. by lhskys congi¿¡¼­ Open ³Ö±â if(MainForm->FILEOPEN){ IniDirName = DirectoryWeaveOpen; if(IniDirName == "")IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); MainForm->FILEOPEN = false; }else IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); // IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); //=========================================== #else #ifdef KNIT //============================================ 2001.4.11. by lhskys congi¿¡¼­ Open ³Ö±â if(MainForm->FILEOPEN){ IniDirName = DirectoryKnitOpen; if(IniDirName == "")IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); MainForm->FILEOPEN = false; }else IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); // IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); //=========================================== #else IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); #endif #endif #endif DirectoryIndex = IniFile->ReadInteger("FileManager", "DirectoryIndex", 0); Left = IniFile->ReadInteger("FileManager", "FormLeft", (Screen->Width-Width)>>1); Top = IniFile->ReadInteger("FileManager", "FormTop", (Screen->Height-Height)>>1); Width = IniFile->ReadInteger("FileManager", "FormWidth", Width); Height = IniFile->ReadInteger("FileManager", "FormHeight", Height); FFilterIndex = IniFile->ReadInteger("FileManager", "Filter", FilterComboBox->ItemIndex); type = IniFile->ReadInteger("FileManager", "ViewType", 0); delete IniFile; } FilterComboBox->ItemIndex = FFilterIndex; InitExt = FFilterIndex + 1; ExtIndex = TGraphicFileFormat(FilterComboBox->ItemIndex+1); StatusBar->Panels->Items[0]->Width = Splitter1->Left + 12; StatusBar->Panels->Items[2]->Width = 120; StatusBar->Panels->Items[1]->Width = StatusBar->Width - StatusBar->Panels->Items[0]->Width - StatusBar->Panels->Items[2]->Width; // InitItem(0); TListColumn *pColumn; pColumn = ListView->Columns->Add(); pColumn->Caption = IDS_REPORT_NAME; pColumn->Width = 300; pColumn = ListView->Columns->Add(); pColumn->Caption = IDS_COMMON_SIZE; pColumn->Width = 100; pColumn = ListView->Columns->Add(); pColumn->Caption = IDS_COMMON_TYPE; pColumn->Width = 100; pColumn = ListView->Columns->Add(); pColumn->Caption = IDS_REPORT_LAST; pColumn->Width = 200; InitItem(0); ComboBoxView->ItemIndex = type; ComboBoxViewItemIndex = type; ComboBoxViewChange(this); switch (type) { case 0: ListView->ViewStyle = vsIcon; break; case 1: ListView->ViewStyle = vsSmallIcon; break; case 2: ListView->ViewStyle = vsList; break; case 3: ListView->ViewStyle = vsReport; } reading = false; Ascend[0] = false; Ascend[1] = false; Ascend[2] = false; Ascend[3] = false; #ifdef TEXTILE ListView->PopupMenu = PopupMenuTexFile; #else ListView->PopupMenu = PopupMenuFile; #endif if (SetCurrentDir(IniDirName) == false) { DirectoryListBox->Directory = "C:\\"; } //========================= #ifdef TEXTILE //============================= 2001.4.11. by lhskys congi¿¡¼­ Down °áÁ¤ if(MainForm->Readdown){ SpeedButtonRead->Down = true; SpeedButtonReadClick(this); }else if(!MainForm->Readdown){ if(Select == "MERGE" && MainForm->MDIChildCount > 0){ SpeedButtonMerge->Down = true; SpeedButtonMergeClick(this); }else if(Select == "READ"){ SpeedButtonRead->Down = true; SpeedButtonReadClick(this); }else if(MainForm->MDIChildCount == 0){ SpeedButtonRead->Down = true; SpeedButtonReadClick(this); } } //============================= #endif view_thumb = true; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormActivate(TObject *Sender) { if (SetCurrentDir(IniDirName) == false) { DirectoryListBox->Directory = "C:\\"; } else { if (reading == false) { DirectoryListBox->Directory = IniDirName; DirectoryListBox->ItemIndex = DirectoryIndex; } } ChangeFunction(); // OnFormShow¿¡¼­ C°¡ ¾Æ´Ñ ´Ù¸¥ µð·ºÅ丮ÀÎ °æ¿ì Large Image¶§¹®¿¡ ·ÎµùÀÌ ´Ê¾îÁö´Â ¹®Á¦¶§¹®¿¡ // FormShow ºÎºÐÀÇ ¼Ò½º¸¦ ÀÌÂÊÀ¸·Î »­ /*if(ComboBoxView->ItemIndex == 0) temp_Panel->Visible = true; InitData(true); view_thumb = true; temp_Panel->Visible = false;*/ isCreating = false; InitData(true); view_thumb = true; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormCreate(TObject *Sender) { // } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::InitExtension() { switch (InitExt) { #if defined(TEXTILE) case gffTEX: FileListBox->Mask = "*.tex"; break; case gffBMP: FileListBox->Mask = "*.bmp"; break; case gffTIF: FileListBox->Mask = "*.tif"; break; // case gffVST: FileListBox->Mask = "*.vst"; break; #ifdef ACADEMY #else case gffTFC: FileListBox->Mask = "*.tfc"; break; // case gffT3D: FileListBox->Mask = "*.t3d"; break; #ifdef NOTN3D #else // case gffN3D: FileListBox->Mask = "*.n3d"; break; #endif case gffWEA: FileListBox->Mask = "*.wea"; break; case gffWAV: FileListBox->Mask = "*.wav"; break; case gffKNT: FileListBox->Mask = "*.knt"; break; case gffPCT: FileListBox->Mask = "*.pct"; break; case gffPCX: FileListBox->Mask = "*.pcx"; break; case gffPNG: FileListBox->Mask = "*.png"; break; case gffPSD: FileListBox->Mask = "*.psd"; break; case gffRAS: FileListBox->Mask = "*.ras"; break; case gffTGA: FileListBox->Mask = "*.tga"; break; #if defined(CARPET) case gffCPT: FileListBox->Mask = "*.cpt"; break; #else case gffJPG: FileListBox->Mask = "*.jpg"; break; case gffEPS: FileListBox->Mask = "*.eps"; break; case gffALL: FileListBox->Mask = "*.*"; break; case gffOldTEX : FileListBox->Mask = "*.tex"; break; case gffOldTFC: FileListBox->Mask = "*.tfc"; break; // case gffGIF: FileListBox->Mask = "*.gif"; break; // by mecbong #endif #endif #elif defined(WEAVE) case gffWEA: FileListBox->Mask = "*.wea"; break; case gffWAV: FileListBox->Mask = "*.wav"; break; case gffALL: FileListBox->Mask = "*.*"; break; #elif defined(KNIT) case gffKNT: FileListBox->Mask = "*.knt"; break; case gffTEX: FileListBox->Mask = "*.tex"; break; #elif defined(PILE) case gffPIL: FileListBox->Mask = "*.pil"; break; #endif } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormDestroy(TObject *Sender) { TIniFile *IniFile=NULL; TTexVersion *ver=NULL; SmallImageList->Clear(); ExitData(); /*delete temp_Button; delete temp_Panel;*/ if (Version){ while(Version->Count > 0){ ver = (TTexVersion*)(Version->Last()); Version->Remove(ver); delete ver; } delete Version; Version = NULL; } IniFile = new TIniFile(DirectoryItem + "\\Main.ini"); if (IniFile) { IniFile->WriteString("FileManager", "DirectoryName", DirectoryListBox->Directory); IniFile->WriteInteger("FileManager", "DirectoryIndex", DirectoryListBox->ItemIndex); IniFile->WriteInteger("FileManager", "FormLeft", Left); IniFile->WriteInteger("FileManager", "FormTop", Top); IniFile->WriteInteger("FileManager", "FormWidth", Width); IniFile->WriteInteger("FileManager", "FormHeight", Height); IniFile->WriteInteger("FileManager", "Filter", FilterComboBox->ItemIndex); IniFile->WriteInteger("FileManager", "ViewType", ComboBoxView->ItemIndex); delete IniFile; } if (MoveCopyList) {delete MoveCopyList; MoveCopyList = NULL;} #ifdef TEXTILE MainMenuForm->ExitFileManeger(); #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormResize(TObject *Sender) { int w = Panel1->Width / 8; SpeedButtonRead->Width = w; SpeedButtonMerge->Left = SpeedButtonRead->Left+w; SpeedButtonMerge->Width = w; SpeedButtonSave->Left = SpeedButtonMerge->Left+w; SpeedButtonSave->Width = w; SpeedButtonSaveAs->Left = SpeedButtonSave->Left+w; SpeedButtonSaveAs->Width = w; SpeedButtonDelete->Left = SpeedButtonSaveAs->Left+w; SpeedButtonDelete->Width = w; SpeedButtonRename->Left = SpeedButtonDelete->Left+w; SpeedButtonRename->Width = w; SpeedButtonMakeFolder->Left = SpeedButtonRename->Left+w; SpeedButtonMakeFolder->Width = w; SpeedButtonExit->Left = SpeedButtonMakeFolder->Left+w; SpeedButtonExit->Width = w; w = (Panel2->Width - (Label1->Width + Label2->Width + 20)) / 2; DriveComboBox->Width = w; FilterComboBox->Width = w; Label2->Left = DriveComboBox->Left + w; FilterComboBox->Left = Label2->Left + Label2->Width; LabelDirectory->Width = Panel3->Width-(LabelDirectory->Left+ComboBoxView->Width+isPreview->Width+16); isPreview->Left = LabelDirectory->Left + LabelDirectory->Width; ComboBoxView->Left = isPreview->Left + isPreview->Width; Edit4->Width = Panel4->Width - (Edit4->Left+SpeedButton4->Width+ProgressBar->Width+ AllSearch->Width+CompressCheckBox->Width+16)+11; ProgressBar->Left = Edit4->Left + Edit4->Width; AllSearch->Left = ProgressBar->Left + ProgressBar->Width; SpeedButton4->Left = AllSearch->Left + AllSearch->Width; CompressCheckBox->Left = SpeedButton4->Left + SpeedButton4->Width; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormShow(TObject *Sender) { Graphics::TBitmap *Bitmap=NULL; Bitmap = new Graphics::TBitmap; #if defined(TEXTILE) switch (FExtension) { case 0: Bitmap->Handle = LoadImage(HInstance,"iconcmb",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FileListBox->Mask = "*.cmb"; break; case 1: Bitmap->Handle = LoadImage(HInstance,"iconjqd",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FileListBox->Mask = "*.jqd"; break; case 2: Bitmap->Handle = LoadImage(HInstance,"iconstp",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FileListBox->Mask = "*.stp"; break; case 3: Bitmap->Handle = LoadImage(HInstance,"icont3d",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 2; FileListBox->Mask = "*.t3d"; break; #if defined(CARPET) case 4: Bitmap->Handle = LoadImage(HInstance,"iconcpt",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FileListBox->Mask = "*.cpt"; break; default: Bitmap->Handle = LoadImage(HInstance,"icontex",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"icontfc",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"icont3d",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconwav",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconknt",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconcpt",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconbmp",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconpct",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconpcx",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconpng",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconpsd",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconras",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"icontga",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"icontif",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = InitExt - 1; InitExtension(); #else case 5: #ifdef NOTN3D #else Bitmap->Handle = LoadImage(HInstance,"iconn3d",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 3; FileListBox->Mask = "*.n3d"; #endif break; default: Bitmap->Handle = LoadImage(HInstance,"icontex",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"icontfc",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); #ifdef NOTN3D #else //if(!MainForm->VN3DItem->Checked){ // Bitmap->Handle = LoadImage(HInstance,"icont3d",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); // SmallImageList->Add(Bitmap,NULL); //} //Bitmap->Handle = LoadImage(HInstance,"iconn3d",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); #endif //SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconwav",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconknt",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); //Bitmap->Handle = LoadImage(HInstance,"iconvst",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); //SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconbmp",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconjpg",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconpct",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconpcx",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconpng",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconpsd",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconras",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"icontga",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"icontif",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"iconeps",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"icontex",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"icontfc",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = InitExt - 1; InitExtension(); #endif } ExtIndex = TGraphicFileFormat(FilterComboBox->ItemIndex+1); #elif defined(WEAVE) if (FExtension){ Bitmap->Handle = LoadImage(HInstance,"iconwav",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = InitExt - 1; InitExtension(); } else { //»ö»çÀü°³ ÆÄÀÏ Bitmap->Handle = LoadImage(HInstance,"iconwav",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FileListBox->Mask = "*.wec"; } ExtIndex = TGraphicFileFormat(FilterComboBox->ItemIndex+1); #elif defined(KNIT) switch (FExtension) { case 0: Bitmap->Handle = LoadImage(HInstance,"iconknt",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); Bitmap->Handle = LoadImage(HInstance,"icontex",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = InitExt - 1; InitExtension(); break; case 2: Bitmap->Handle = LoadImage(HInstance,"iconstp",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FileListBox->Mask = "*.stp"; break; } #elif defined(PILE) Bitmap->Handle = LoadImage(HInstance,"iconpil",IMAGE_BITMAP,16,16,LR_DEFAULTSIZE); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FileListBox->Mask = "*.pil"; #endif delete Bitmap; //InitData(true); /*if(ComboBoxView->ItemIndex == 0) temp_Panel->Visible = true; InitData(true); view_thumb = true; temp_Panel->Visible = false;*/ } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SpeedButtonReadClick(TObject *Sender) { InitItem(0); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SpeedButtonMergeClick(TObject *Sender) { InitItem(1); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SpeedButtonSaveClick(TObject *Sender) { InitItem(2); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SpeedButtonSaveAsClick(TObject *Sender) { Edit4->SetFocus(); InitItem(3); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SpeedButtonDeleteClick(TObject *Sender) { InitItem(4); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SpeedButtonMakeFolderClick(TObject *Sender) { Edit4->SetFocus(); InitItem(5); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SpeedButtonRenameClick(TObject *Sender) { Edit4->SetFocus(); InitItem(6); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SpeedButtonExitClick(TObject *Sender) { ModalResult = mrCancel; #ifdef TEXTILE MainForm->Readdown = false; #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FilterComboBoxChange(TObject *Sender) { #if defined(TEXTILE) if (FilterComboBox->ItemIndex + 1 == gffALL) { AllSearch->Checked = true; if(ComboBoxView->ItemIndex == 0){ ShowMessage(IDS_MESSAGE_NOTSEEALLFILE); FilterComboBox->ItemIndex = FilterComboBoxItemIndex; return; } } FilterComboBoxItemIndex = FilterComboBox->ItemIndex; #endif #if defined(WEAVE) if (FilterComboBox->ItemIndex == 2) { AllSearch->Checked = true; if(ComboBoxView->ItemIndex == 0){ ShowMessage(IDS_MESSAGE_NOTSEEALLFILE); FilterComboBox->ItemIndex = FilterComboBoxItemIndex; return; } } #endif ImagePreview(-1); ChangeFunction(); //InitData(true); /*if(ComboBoxView->ItemIndex == 0) temp_Panel->Visible = true; InitData(true); view_thumb = true; temp_Panel->Visible = false;*/ if(!isCreating) { InitData(true); view_thumb = true; } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ChangeFunction() { if (FOnRead) SpeedButtonRead->Enabled = true; else SpeedButtonRead->Enabled = false; if (FOnMerge) SpeedButtonMerge->Enabled = true; else SpeedButtonMerge->Enabled = false; if (FOnFileName) { if (FOnSave) SpeedButtonSave->Enabled = true; else SpeedButtonSave->Enabled = false; } else { SpeedButtonSave->Enabled = false; } // if(SpeedButtonMerge->Down==false){ //by jeegeo //============================= 2001.4.11. by lhskys congi¿¡¼­ Down °áÁ¤ // SpeedButtonRead->Down=true; // InitItem(0); // } #ifdef TEXTILE #ifndef CARPET if(!MainForm->T3D_Item){ if(FilterComboBox->ItemIndex==2){ // ShowMessage("Not Use 3D File !!"); FilterComboBox->ItemIndex = 0; Close(); } } #endif #endif ExtIndex = TGraphicFileFormat(FilterComboBox->ItemIndex+1); FileListBox->Update(); #ifdef TEXTILE #ifndef ACADEMY if (/*ExtIndex == gffT3D || */ExtIndex == gffWEA || ExtIndex == gffWAV || ExtIndex == gffKNT) { if (FilterComboBox->Enabled ==true) { //k3dogs 20010103ÀÏÀÚ¿Í ºñ±³Çغ¼ °Í. SpeedButtonMerge->Enabled = false; //TMenu3DForm::sbMainClick ¸¦ ¼öÁ¤Çϸ鼭 ¹Ù²Û °Í. SpeedButtonRead->Down=true; InitItem(0); SpeedButtonSave->Enabled = false; //Layer ¿¡¼­ 3d¸¦ ÀÐÀ» ¶§ ¹®Á¦°¡ À־ ¹Ù²Ù°Ô µÈ °Í. SpeedButtonSaveAs->Enabled = false; } // } else { if (FOnMerge) SpeedButtonMerge->Enabled = true; if (FOnSave) { SpeedButtonSave->Enabled = true; SpeedButtonSaveAs->Enabled = true; } else SpeedButtonSaveAs->Enabled = false; } #ifndef CARPET if (ExtIndex == gffJPG) { if (FExtension == 8) { SpeedButtonSave->Enabled = false; SpeedButtonSaveAs->Enabled = false; } else { SpeedButtonSave->Enabled = true; SpeedButtonSaveAs->Enabled = true; } } /* if (ExtIndex == gffGIF) { // by mecbong if (FExtension == 17) { SpeedButtonSave->Enabled = false; SpeedButtonSaveAs->Enabled = false; } else { SpeedButtonSave->Enabled = true; SpeedButtonSaveAs->Enabled = true; } } */ #endif #endif #endif #if defined(KNIT) if (ExtIndex == gffTEX) { ReadStitchSize1->Visible = true; ReadKnitSize1->Visible = true; } else { ReadStitchSize1->Visible = false; ReadKnitSize1->Visible = false; } #endif StartLargeImage = true; #if defined(TEXTILE) if(JacquardForm){ //2001.7.26 lhskys Jacquard ¿¡¼­ if(!JacquardForm->j_use){ //¹«Á¶°Ç ÀúÀå ¹æÁö...... SpeedButtonSaveAs->Enabled = false; SpeedButtonSave->Enabled = false; } } /* blocked by linuxjun for AutoRepeat Save by linuxjun if (MainImageForm && MainImageForm->AutoRepeat) { SpeedButtonSaveAs->Enabled = false; SpeedButtonSave->Enabled = false; } */ #endif #if defined(TEXTILE) #ifdef NOTN3D #else /* if(ExtIndex==gffN3D){ // n3d¸¦ À§ÇØ Æ¯º°È÷ Ãß°¡ SpeedButtonMerge->Enabled = false; SpeedButtonRead->Down=true; InitItem(0); if(MainImageForm){ if(MainImageForm->new3d){ //if (FOnRead) SpeedButtonRead->Enabled = true; //else SpeedButtonRead->Enabled = false; //if (FOnMerge) SpeedButtonMerge->Enabled = true; //else SpeedButtonMerge->Enabled = false; //if (FOnFileName) { // if (FOnSave) SpeedButtonSave->Enabled = true; // else SpeedButtonSave->Enabled = false; //} else { // SpeedButtonSave->Enabled = false; //} } else { SpeedButtonSave->Enabled = false; SpeedButtonSaveAs->Enabled = false; } } else { SpeedButtonSave->Enabled = false; SpeedButtonSaveAs->Enabled = false; } } */ #endif #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ComboBoxViewChange(TObject *Sender) { #if defined(TEXTILE) if (ComboBoxView->ItemIndex + 1 == gffALL) { if(FilterComboBox->ItemIndex == 16){ ShowMessage(IDS_MESSAGE_NOTSEELARGEVIEW); ComboBoxView->ItemIndex = ComboBoxViewItemIndex; return; } } #endif #if defined(WEAVE) if (FilterComboBox->ItemIndex == 2) { AllSearch->Checked = true; if(ComboBoxView->ItemIndex == 0){ ShowMessage(IDS_MESSAGE_NOTSEEALLFILE); FilterComboBox->ItemIndex = FilterComboBoxItemIndex; return; } } #endif isPreview->Visible = true; isPreview->Caption = IDS_PREVIEW; if (isPreview->Checked) PreviewBox->BringToFront(); else PreviewBox->SendToBack(); if (ComboBoxView->ItemIndex == 0) { int i ; ListView->ViewStyle = vsIcon; if(StartLargeImage){ //temp_Panel->Visible = true; if(!isCreating) InitData(false); StartLargeImage = false; view_thumb = true; //temp_Panel->Visible = false; } for(i = 0 ; i < ListView->Items->Count ; i++) { ListView->Items->Item[i]->ImageIndex = i; } //ListView->ViewStyle = vsIcon; isPreview->Visible = false; PreviewBox->SendToBack(); }else if (ComboBoxView->ItemIndex == 1) { ChangeComboBoxAllView(); ListView->ViewStyle = vsSmallIcon; ComboBoxViewItemIndex = 1; }else if (ComboBoxView->ItemIndex == 2) { ChangeComboBoxAllView(); ListView->ViewStyle = vsList; ComboBoxViewItemIndex = 2; }else { ChangeComboBoxAllView(); ListView->ViewStyle = vsReport; ComboBoxViewItemIndex = 3; } ImagePreview(-1); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Edit4Change(TObject *Sender) { if (StrLen(Edit4->Text.c_str())>0) SpeedButton4->Enabled = true; else SpeedButton4->Enabled = false; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Edit4KeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { if (Key==VK_RETURN) SpeedButton4Click(Edit4); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SpeedButton4Click(TObject *Sender) { /* if(large_view_ing) // Large View½Ã Ãë¼Ò¹öư ´­·ÈÀ» ¶§ { view_thumb = false; return; }*/ AnsiString fn, cmfn, cmfn2; TCursor cur; switch (Item) { case 0: cur = Screen->Cursor; Screen->Cursor = crHourGlass; if(AllSearch->Checked){ SearchCount = 0; SearchName = Edit4->Text; if(IncludeSearchData())goto next1; }else if(SearchData())goto next1; ShowMessage(IDS_MESSAGE_FILENOTFOUND); // InitData(true); next1: Screen->Cursor = cur; break; case 2: ListViewDblClick(this); break; case 3: if (FOnFileName) { cur = Screen->Cursor; Screen->Cursor = crHourGlass; fn = FOnFileName(Edit4->Text, ExtIndex); for (int i=0; iItems->Count; i++) { cmfn = FileListBox->Items->Strings[i].LowerCase(); cmfn2 = fn.LowerCase(); if (cmfn == cmfn2) { int btn = EXCEPTION_MESSAGE2_OKCANCEL(EC_FILE_EXIST_ALREADY, (IDS_MESSAGE_REALLYFILESAVE).c_str()); if (btn == mrOk) { if (FOnSave){ SaveOnTexpiaFile(fn); #if defined(WEAVE) MainImageForm->Modify = false; #endif } goto next; } else { goto next; } } } if (FOnSave) { SaveOnTexpiaFile(fn); #if defined(WEAVE) MainImageForm->Modify = false; #endif } next: Screen->Cursor = cur; } //next: FileListBox->Update(); //InitData(false); /*if(ComboBoxView->ItemIndex == 0) temp_Panel->Visible = true; InitData(false); view_thumb = true; temp_Panel->Visible = false;*/ InitData(false); view_thumb = true; SpeedButtonRead->Down = true; InitItem(0); break; case 5: CreateDirectory(Edit4->Text.c_str(), NULL); DirectoryListBox->Update(); SpeedButtonRead->Down = true; InitItem(0); break; case 6: if (FOnFileName) { if (ListView->Selected && Edit4->Text!="") { if (RenameFile(FileName, FOnFileName(Edit4->Text, ExtIndex)) == false) EXCEPTION_MESSAGE_OK(EC_FILE_EXIST_ALREADY); } else { EXCEPTION_MESSAGE_OK(EC_CHOOSEFILE); } } FileListBox->Update(); //InitData(false); /*if(ComboBoxView->ItemIndex == 0) temp_Panel->Visible = true; InitData(false); view_thumb = true; temp_Panel->Visible = false;*/ InitData(false); view_thumb = true; SpeedButtonRead->Down = true; InitItem(0); break; } if(Rename && SpeedButtonRename->Down && StrLen(Edit4->Text.c_str())>0){ //2001.7.2 by lhskys Rename F2 ±â´É Ãß°¡ if (FOnFileName) { if (ListView->Selected) { if (RenameFile(FileName, FOnFileName(Edit4->Text, ExtIndex)) == false) EXCEPTION_MESSAGE_OK(EC_FILE_EXIST_ALREADY); } else { EXCEPTION_MESSAGE_OK(EC_CHOOSEFILE); } } FileListBox->Update(); //InitData(false); /*if(ComboBoxView->ItemIndex == 0) temp_Panel->Visible = true; InitData(false); view_thumb = true; temp_Panel->Visible = false;*/ InitData(false); view_thumb = true; SpeedButtonRead->Down = true; InitItem(0); Rename = false; } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::DirectoryListBoxChange(TObject *Sender) { ImagePreview(-1); //InitData(true); /*if(ComboBoxView->ItemIndex == 0) temp_Panel->Visible = true; InitData(true); view_thumb = true; temp_Panel->Visible = false;*/ if(!isCreating) { InitData(true); view_thumb = true; } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewDblClick(TObject *Sender) { int n; bool run = true; TCursor cur; TFMReadParameter rp; TPException ec = EC_NONE; if (ListView->Selected) { n = ListView->Selected->Index; FileName = ListView->Items->Item[n]->Caption; AnsiString ext = LowerCase(ExtractFileExt(FileName)); if (Item==0) { #if defined(TEXTILE) //////////////////////////////////////////////////////////////////////// // N3D¿¡¼­ T3D ¸·À½ // by jeegeo if(FilterComboBox->ItemIndex + 1 == gffALL)SearchExtIndex(ext); TGraphicFileFormat RealIndex = FindExtension(ext); if(MainForm->ReadN3D==true/*&&RealIndex==gffT3D*/){ ShowMessage("not supported file format"); return; } /////////////////////////////////////////////////////////////////////// #endif #if defined(WEAVE) if(FilterComboBox->ItemIndex == 2)SearchExtIndex(ext); TGraphicFileFormat RealIndex = FindExtension(ext); #endif cur = Screen->Cursor; Screen->Cursor = crHourGlass; #if defined(TEXTILE) if(RealIndex == gffNON && ext != ".cmb"){ if(ext != ".jqd" && ext != ".stp"){ ShowMessage(IDS_MESSAGE_CANNOTOPENFILE); Screen->Cursor = cur; return; } } #endif if (FOnRead) { rp.DirName = FileListBox->Directory; rp.FileName = FileName; rp.ExtIndex = RealIndex; #if defined(TEXTILE) #ifdef ACADEMY rp.bpp = 8; ec = FOnRead(rp); #else if (ExtIndex == gffTEX || ExtIndex == gffKNT || ExtIndex == gffOldTEX) { rp.bpp = 8; ec = FOnRead(rp); } else { rp.bpp = 24; ec = FOnRead(rp); AnsiString Directorycolorpath = DirectoryColor+"\\default.fcr"; if(MainImageForm->iMainImage->uBitmap->BitsPerPixel==24) { if(RealIndex==gffJPG || RealIndex==gffBMP || RealIndex==gffPSD || RealIndex==gffRAS || RealIndex==gffTGA) { PaletteForm->DIB256Palette->LoadFromFile(Directorycolorpath.c_str()); MainImageForm->iMainImage->SetBackgroundColor(PaletteForm->DIB256Palette->GetBGCOLORREF(24)); // by celberus } } } #endif #else reading = true; #if defined(KNIT) rp.Method = 0; rp.DPI = 160; rp.WPI = 12; rp.CPI = 10; #endif rp.bpp = 8; ec = FOnRead(rp); reading = false; #endif } Screen->Cursor = cur; #if defined(TEXTILE) if (ec != EC_NONE){ //if(ExtIndex == gffT3D) Application->MessageBox(IDS_INVALIDVISION.c_str(),IDS_MESSAGE_FILEOPEN.c_str(),MB_OK); //else EXCEPTION_MESSAGE_OK(ec); } #else if (ec != EC_NONE)EXCEPTION_MESSAGE_OK(ec); #endif ModalResult = mrOk; } else if (Item==1) { cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (FOnMerge) { TGraphicFileFormat RealIndex = FindExtension(ext); if (FOnMerge(FileName, RealIndex)) { ModalResult = mrOk; } else { SpeedButtonRead->Down = true; InitItem(0); } } Screen->Cursor = cur; } else { switch (Item) { case 2: if(Application->MessageBox(IDS_MESSAGE_PUTSAVE.c_str(), IDS_FSAVE.c_str(), MB_OKCANCEL) == IDOK){ cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (FOnSave) { SaveOnTexpiaFile(FileName); #if defined(WEAVE) MainImageForm->Modify = false; #endif } Screen->Cursor = cur; } break; case 4: Delete_File(FileName); break; case 6: Edit4->Text = RenameFileName; //±âÁ¸ÀÇ Rename ¹æ½Ä º¸Á¸ SpeedButton4Click(NULL); run = false; break; } if (run) { FileListBox->Update(); //InitData(false); /*if(ComboBoxView->ItemIndex == 0) temp_Panel->Visible = false; InitData(false); view_thumb = true; temp_Panel->Visible = false;*/ InitData(false); view_thumb = true; SpeedButtonRead->Down = true; InitItem(0); } } #if defined(TEXTILE) MainImageForm->AutoRepUpdateMenu(true); //2001.4.11. lhskys »õ·Î¿î MainMenu »ý¼º PaletteForm->StyleUseColor = false; #elif defined(KNIT) MainMenuForm->NewForm(); #endif } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (ListView->Selected) { int n = ListView->Selected->Index; FileName = ListView->Items->Item[n]->Caption; Rename = true; //2001.7.2 by lhskys Rename F2 ±â´É Ãß°¡ if(Edit4->Visible && SpeedButtonMakeFolder->Down == false){ RenameFileName = Edit4->Text; Edit4->Text = FileName;} else if(Edit4->Visible)Edit4->Text =""; if(SpeedButtonRename->Down || SpeedButtonSaveAs->Down)Edit4->SetFocus(); // if (ComboBoxView->ItemIndex != 0 && isPreview->Checked) ImagePreview(n); } else FileName = ""; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewColumnClick(TObject *Sender, TListColumn *Column) { Ascend[Column->Index] = !Ascend[Column->Index]; ListView->CustomSort(NULL, Column->Index); ListView->Repaint(); } //--------------------------------------------------------------------------- double __fastcall ExtractSize(AnsiString str) { int pos = Sysutils::AnsiPos('K', str); return StrToFloat(str.SubString(1, pos - 1)); } //--------------------------------------------------------------------------- double __fastcall ExtractType(AnsiString str) { int pos = Sysutils::AnsiPos('K', str); return StrToFloat(str.SubString(1, pos - 1)); } //--------------------------------------------------------------------------- int __fastcall ExtractDate(AnsiString str) { int i, pos; const char p[4] = { '-', '-', ' ', ':' }; AnsiString value; for (i = 0; i < 4; i++) { pos = Sysutils::AnsiPos(p[i], str); if (pos == 2) { value += ("0"+ str.SubString(1, pos - 1)); } else { value += str.SubString(1, pos - 1); } if (i == 2) { str = str.SubString(pos+2, str.Length()); } else { str = str.SubString(pos+1, str.Length()); } } if (str.Length() > 1) { value += str; } else { value += (str + "0"); } return StrToFloat(value); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewCompare(TObject *Sender, TListItem *Item1, TListItem *Item2, int Data, int &Compare) { double size1, size2; switch (Data) { case 0: if (Ascend[0]) { Compare = CompareStr(Item1->Caption, Item2->Caption); } else { Compare = CompareStr(Item2->Caption, Item1->Caption); } break; case 1: size1 = ExtractSize(Item1->SubItems->Strings[0]); size2 = ExtractSize(Item2->SubItems->Strings[0]); if (Ascend[1]) { Compare = size1 - size2; } else { Compare = size2 - size1; } break; case 2: if (Ascend[2]) { Compare = CompareStr(Item1->SubItems->Strings[1], Item2->SubItems->Strings[1]); if(Compare == 0)Compare = CompareStr(Item1->Caption, Item2->Caption); } else { Compare = CompareStr(Item2->SubItems->Strings[1], Item1->SubItems->Strings[1]); if(Compare == 0)Compare = CompareStr(Item2->Caption, Item1->Caption); } break; case 3: size1 = ExtractDate(Item1->SubItems->Strings[2]); size2 = ExtractDate(Item2->SubItems->Strings[2]); if (Ascend[3]) { Compare = size1 - size2; } else { Compare = size2 - size1; } break; } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewEdited(TObject *Sender, TListItem *Item, AnsiString &S) { if (FOnFileName) { AnsiString newname = FOnFileName(S, ExtIndex); if (RenameFile(FileName, newname) == false) { EXCEPTION_MESSAGE_OK(EC_FILE_EXIST_ALREADY); return; } Item->Caption = newname; FileListBox->Update(); } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Splitter1Moved(TObject *Sender) { StatusBar->Panels->Items[0]->Width = Splitter1->Left + 12; StatusBar->Panels->Items[1]->Width = StatusBar->Width - StatusBar->Panels->Items[0]->Width; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Load256Colors1Click(TObject *Sender) { TCursor cur = Screen->Cursor; TFMReadParameter rp; TPException ec; if (!ListView->Selected) return; TListItem *ItemM = ListView->Selected; // By GreenFish ¿©·¯°³ File Open °¡´É TItemStates selected = TItemStates() << isSelected; // ItemM(ulti) ¿¡ Çϳª¾¿ ÀúÀå while (ItemM) { // ItemM ¿¡ °Ô¼Ó Áý¾î³Ö°í, NULLÀÌ ³ª¿Ã‹š ±îÁö int n; TPException ec = EC_NONE; n = ItemM->Index; FileName = ListView->Items->Item[n]->Caption; Screen->Cursor = crHourGlass; if (FOnRead) { rp.DirName = FileListBox->Directory; rp.FileName = FileName; rp.ExtIndex = ExtIndex; rp.bpp = 8; if ((ec = FOnRead(rp)) != EC_NONE) EXCEPTION_MESSAGE_OK(ec); } ItemM = ListView->GetNextItem(ItemM, sdAll, selected ); // ´ÙÀ½ ÆÄÀÏ ¹Þ±â } Screen->Cursor = cur; ModalResult = mrOk; #if defined(TEXTILE) MainImageForm->AutoRepUpdateMenu(true); #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::LoadFullColors1Click(TObject *Sender) { TCursor cur = Screen->Cursor; TFMReadParameter rp; TPException ec; if (!ListView->Selected) return; TListItem *ItemM = ListView->Selected; TItemStates selected = TItemStates() << isSelected; while (ItemM) { // ItemM ¿¡ °Ô¼Ó Áý¾î³Ö°í, NULLÀÌ ³ª¿Ã‹š ±îÁö int n; TPException ec = EC_NONE; n = ItemM->Index; FileName = ListView->Items->Item[n]->Caption; Screen->Cursor = crHourGlass; if (FOnRead) { rp.DirName = FileListBox->Directory; rp.FileName = FileName; rp.ExtIndex = ExtIndex; rp.bpp = 24; if ((ec = FOnRead(rp)) != EC_NONE) EXCEPTION_MESSAGE_OK(ec); AnsiString Directorycolorpath = DirectoryColor+"\\default.fcr"; if(ExtIndex==gffJPG || ExtIndex==gffBMP || ExtIndex==gffPSD || ExtIndex==gffRAS || ExtIndex==gffTGA) PaletteForm->DIB256Palette->LoadFromFile(Directorycolorpath.c_str()); } ItemM = ListView->GetNextItem(ItemM, sdAll, selected ); // ´ÙÀ½ ÆÄÀÏ ¹Þ±â } Screen->Cursor = cur; ModalResult = mrOk; #if defined(TEXTILE) MainImageForm->AutoRepUpdateMenu(true); #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::PopupSaveClick(TObject *Sender) { TCursor cur; if(Application->MessageBox(IDS_MESSAGE_PUTSAVE.c_str(), IDS_FSAVE.c_str(), MB_OKCANCEL) == IDOK){ cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (FOnSave) { SaveOnTexpiaFile(FileName); #if defined(WEAVE) MainImageForm->Modify = false; #endif } Screen->Cursor = cur; } FileListBox->Update(); //InitData(false); /*if(ComboBoxView->ItemIndex == 0) temp_Panel->Visible = true; InitData(false); view_thumb = true; temp_Panel->Visible = false;*/ InitData(false); view_thumb = true; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::PopupDeleteClick(TObject *Sender) { if (!ListView->Selected) return; if (!(Application->MessageBox(IDS_FILEERASE.c_str(), IDS_FILEDELETE.c_str(), MB_YESNO | MB_ICONQUESTION) == IDYES)) return; TListItem *ItemM = ListView->Selected; // ¿©·¯°³ÆÄÀÏ Áö¿ì±â By GreenFish TItemStates selected = TItemStates() << isSelected; while (ItemM) { int n; if (ItemM) { n = ItemM->Index; FileName = ListView->Items->Item[n]->Caption; } AnsiString fullname = FullPathName(FileListBox->Directory,FileName); int Attrs = FileGetAttr(fullname); // ÀбâÀü¿ë ¼Ó¼ºÀÌ ÀÖÀ¸¸é ¾ø¿¡¹ö¸°´Ù~ (±ú²ýÀÌ Áö¿öÁü) if (Attrs & faReadOnly) FileSetAttr(fullname, Attrs & !faReadOnly); DeleteFile(fullname); ItemM = ListView->GetNextItem(ItemM, sdAll, selected ); } FileListBox->Update(); //InitData(false); /*if(ComboBoxView->ItemIndex == 0) temp_Panel->Visible = true; InitData(false); view_thumb = true; temp_Panel->Visible = false;*/ InitData(false); view_thumb = true; } //-------------------------------------------------------------------------- void __fastcall TFileManagerForm::PopupMenuTexFilePopup(TObject *Sender) { // Load256Colors1->Caption = IDS_FLOAD; // LoadFullColors1->Caption = IDS_FLOADFULL; Copy1->Caption = IDS_FCOPY; Cut1->Caption = IDS_FCUT; Paste1->Caption = IDS_FPASTE; Save1->Caption = IDS_COMMON_SAVE; Delete1->Caption = IDS_FDELETE; Rename1->Caption = IDS_FRENAME; Preference1->Caption = IDS_FPREFERENCE; //======= 2001.3.27 lhskys C++Builder 5 ¿¡¼­ ¸¶¿ì½º ¿ìÃø Ŭ¸¯ÀÌ ¾ÈµÇ´Â°Í ¼öÁ¤... if (ListView->Selected) { // GreenFish ¼öÁ¤ 2001.4.10 int n = ListView->Selected->Index; FileName = ListView->Items->Item[n]->Caption; } //============================= if (FileName=="") { // Load256Colors1->Enabled = false; // LoadFullColors1->Enabled = false; Save1->Enabled = false; Delete1->Enabled = false; Rename1->Enabled = false; } else { if (FileListBox->Mask == "*.t3d") { // Load256Colors1->Enabled = false; // LoadFullColors1->Enabled = false; if (FExtension != 3) Save1->Enabled = false; else Save1->Enabled = true; } else if (FileListBox->Mask == "*.n3d") { // Load256Colors1->Enabled = false; // LoadFullColors1->Enabled = false; if (FExtension != 5) Save1->Enabled = false; else Save1->Enabled = true; } else if (FileListBox->Mask == "*.wea" || FileListBox->Mask == "*.wav" || FileListBox->Mask == "*.knt"){ // Load256Colors1->Enabled = true; // LoadFullColors1->Enabled = true; Save1->Enabled = false; Delete1->Enabled = true; } else { // Load256Colors1->Enabled = true; #ifdef ACADEMY // LoadFullColors1->Enabled = false; #else // LoadFullColors1->Enabled = true; #endif Save1->Enabled = true; Delete1->Enabled = true; } } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::DirectoryDeleteClick(TObject *Sender) { int i; char *str=NULL; AnsiString Astr1, Astr2; for (i=0; iItems->Count; i++) { if (DirectoryListBox->Selected[i]) { Astr1 = DirectoryListBox->Directory; Astr2 = DirectoryListBox->Items->Strings[i]; str = StrPos(Astr1.c_str(), Astr2.c_str()); if (str==NULL) Delete_Folder(Astr2); else Delete_Folder(Astr1); break; } } DirectoryListBox->Update(); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::DirectoryRenameClick(TObject *Sender) { int i, same, length; char *str=NULL; AnsiString Astr1, Astr2, dn, s; if (Edit4->Text == "") ShowMessage(IDS_MESSAGE_INPUTFILE); for (i = 0; i < DirectoryListBox->Items->Count; i++) { if (DirectoryListBox->Selected[i]) { Astr1 = DirectoryListBox->Directory; Astr2 = DirectoryListBox->GetItemPath(i); same = StrComp(Astr1.c_str(), Astr2.c_str()); if (same == 0) dn = Astr1; else dn = Astr2; length = dn.Length(); str = dn.c_str(); while(length) { if (AnsiString(str[length-1]) == "\\") { Astr1 = dn.SubString(1, length); break; } else { length--; } } Astr1 += Edit4->Text; if (MoveFile(dn.c_str(), Astr1.c_str())) { DirectoryListBox->Directory = Astr1; } break; } } DirectoryListBox->Update(); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::DirectoryListBoxDblClick(TObject *Sender) { int i, same, length; char *str=NULL; AnsiString Astr1, Astr2, dn, s; if (Item == 4 || Item == 6) { i = DirectoryListBox->ItemIndex; if (i != -1) { Astr1 = DirectoryListBox->Directory; Astr2 = DirectoryListBox->GetItemPath(i); same = StrComp(Astr1.c_str(), Astr2.c_str()); if (same == 0) dn = Astr1; else dn = Astr2; if (Item == 4) Delete_Folder(dn); else if (Item == 6) { length = dn.Length(); str = dn.c_str(); while(length) { if (AnsiString(str[length-1]) == "\\") { Astr1 = dn.SubString(1, length); break; } else { length--; } } Astr1 += Edit4->Text; if (MoveFile(dn.c_str(), Astr1.c_str())) { DirectoryListBox->Directory = Astr1; } } } DirectoryListBox->Update(); SpeedButtonRead->Down = true; InitItem(0); } } //--------------------------------------------------------------------------- // Private Method //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SaveOnTexpiaFile(AnsiString FileName) { TPException ec = EC_NONE; #if defined(TEXTILE) if (FExtension > 8) { if (ExtIndex != gffTEX && ExtIndex != gffOldTEX) { if (CompressCheckBox->Checked) ec = FOnSave(FileListBox->Directory, FileName, ExtIndex, cmZLib); else ec = FOnSave(FileListBox->Directory, FileName, ExtIndex, cmNone); } else ec = EC_CANNOT_SAVE256; } else { if (CompressCheckBox->Checked) ec = FOnSave(FileListBox->Directory, FileName, ExtIndex, cmZLib); else ec = FOnSave(FileListBox->Directory, FileName, ExtIndex, cmNone); } #else if (CompressCheckBox->Checked) ec = FOnSave(FileListBox->Directory, FileName, ExtIndex, cmZLib); else ec = FOnSave(FileListBox->Directory, FileName, ExtIndex, cmNone); #endif if (ec != EC_NONE) EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::InitItem(int i) { Item = i; switch (Item) { case 0: Label4->Caption = IDS_SEARCH; SpeedButton4->Caption = IDS_SEARCH; if (StrLen(Edit4->Text.c_str())>0) SpeedButton4->Enabled = true; else SpeedButton4->Enabled = false; Panel->Height = Panel1->Height + Panel2->Height + Panel3->Height + Panel4->Height; if(Edit4->Visible)Edit4->Text =""; break; case 1: Panel->Height = Panel1->Height + Panel2->Height + Panel3->Height; if(Edit4->Visible)Edit4->Text =""; break; case 2: case 3: Label4->Caption = IDS_FILENAME; if (Item == 2) { SpeedButton4->Caption = IDS_COMMON_SAVE; if(Edit4->Visible)Edit4->Text =""; }else if (Item == 3) SpeedButton4->Caption = IDS_COMMON_SAVEAS; if (StrLen(Edit4->Text.c_str())>0) SpeedButton4->Enabled = true; else SpeedButton4->Enabled = false; Panel->Height = Panel1->Height + Panel2->Height + Panel3->Height + Panel4->Height; break; case 4: if(Edit4->Visible)Edit4->Text =""; break; case 5: Label4->Caption = IDS_FOLDERNAME; SpeedButton4->Caption = IDS_MAKE; if (StrLen(Edit4->Text.c_str())>0) SpeedButton4->Enabled = true; else SpeedButton4->Enabled = false; Panel->Height = Panel1->Height + Panel2->Height + Panel3->Height + Panel4->Height; if(Edit4->Visible)Edit4->Text =""; break; case 6: Label4->Caption = IDS_FILENAME; SpeedButton4->Caption = IDS_COMMON_RENAME; if (StrLen(Edit4->Text.c_str())>0) SpeedButton4->Enabled = true; else SpeedButton4->Enabled = false; Panel->Height = Panel1->Height + Panel2->Height + Panel3->Height + Panel4->Height; break; } if (isPreview->Checked && isPreview->Visible) { if (ListView->Selected) { int n = ListView->Selected->Index; if (ComboBoxView->ItemIndex != 0 && isPreview->Checked) ImagePreview(n); } else ImagePreview(-1); } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::InitData(bool isCheck) { TFileInfor *fi = NULL; FILEINFO FileInfo; TTexpiaBitmap *TexBitmap = NULL; int i, imgindex; TTexVersion *ver=NULL; TListItem *pItem=NULL; AnsiString fn, time; AnsiString temp_fn; AnsiString temp_Dir; //-- Graphics::TBitmap *icon = NULL; RGBQUAD rgb[256]; HANDLE hFile = INVALID_HANDLE_VALUE; DWORD size, memsize; FILETIME fTime, fLocTime; SYSTEMTIME SysTime; HDC dcSrc = NULL; TPException ec = EC_NONE; AnsiString ext; bool exist_file = false; #ifdef TEXTILE #ifndef CARPET if(!MainForm->T3D_Item){ if(FilterComboBox->ItemIndex==2){ FilterComboBox->ItemIndex = 0; Close(); } } #endif #endif #ifndef CARPET if (isCheck && FDrive==DriveComboBox->Drive && FDirectory==DirectoryListBox->Directory && FFilter==FilterComboBox->Filter && FFilterIndex==FilterComboBox->ItemIndex) return; #endif ExitData(); int count = FileListBox->Items->Count; if(ComboBoxView->ItemIndex == 0){ if(count > 0) { //AnsiString Button_Caption = SpeedButton4->Caption; AnsiString Title_Caption = Caption; //large_view_ing = true; //bool button_status = SpeedButton4->Enabled; //SpeedButton4->Enabled = true; //SpeedButton4->Caption = IDS_COMMON_BUTTONCANCEL; Caption = IDS_WAITING; InitLargeData(false); //SpeedButton4->Caption = Button_Caption; Caption = Title_Caption; //SpeedButton4->Enabled = button_status; //large_view_ing = false; return; } if ((fi = new TFileInfor)==NULL) { ec = EC_MEMORY_LACK; goto fail; } if ((fi->Bitmap = new Graphics::TBitmap)==NULL) { ec = EC_MEMORY_LACK; goto fail; } } if (Version){ while(Version->Count > 0){ ver = (TTexVersion*)(Version->Last()); Version->Remove(ver); delete ver; } delete Version; Version = NULL; } Version = new TList; for (i = 0, imgindex = 0; i < count; i++) { fn = FileListBox->Items->Strings[i]; exist_file = false; if(ComboBoxView->ItemIndex == 0) { #if defined(TEXTILE) #ifdef ACADEMY if (FilterComboBox->ItemIndex+1 == gffTEX) { #else #ifdef NOTN3D if (FilterComboBox->ItemIndex+1 == gffTEX || FilterComboBox->ItemIndex+1 == gffTFC || FilterComboBox->ItemIndex+1 == gffT3D || FilterComboBox->ItemIndex+1 == gffWEA || FilterComboBox->ItemIndex+1 == gffWAV || FilterComboBox->ItemIndex+1 == gffKNT || FilterComboBox->ItemIndex+1 == gffOldTEX || FilterComboBox->ItemIndex+1 == gffOldTFC || FilterComboBox->ItemIndex+1 == gffVST ) { #else if (FilterComboBox->ItemIndex+1 == gffTEX || FilterComboBox->ItemIndex+1 == gffTFC /*|| FilterComboBox->ItemIndex+1 == gffT3D*/ || FilterComboBox->ItemIndex+1 == gffWEA || FilterComboBox->ItemIndex+1 == gffWAV || FilterComboBox->ItemIndex+1 == gffKNT || FilterComboBox->ItemIndex+1 == gffOldTEX || FilterComboBox->ItemIndex+1 == gffOldTFC /*|| FilterComboBox->ItemIndex+1 == gffN3D || FilterComboBox->ItemIndex+1 == gffVST*/) { #endif #endif if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; if (!LoadFromTexpiaTag(hFile, fi, ver)) goto next; Version->Add(ver); } else { /*if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; size = GetFileSize(hFile, NULL); CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE;*/ L_FileInfo(fn.c_str(), &FileInfo, 0, NULL); memsize = FileInfo.SizeMem; if(view_thumb && memsize < limit_size) { /*if ((TexBitmap = new TTexpiaBitmap) == NULL) goto next; if (!TexBitmap->LoadFromFile(fn)) goto next;*/ temp_Dir = DefaultDir + "\\Temp"; if ((TexBitmap = new TTexpiaBitmap) == NULL) goto next; if(!DirectoryExists(temp_Dir)) CreateDir(temp_Dir); temp_fn = temp_Dir + "\\" + fn + FileAge(fn) + FileInfo.SizeDisk + ".jpg"; if(FileExists(temp_fn)) { exist_file = true; if(!TexBitmap->LoadFromFile(temp_fn)) goto next; } else if (!TexBitmap->LoadFromFile(fn)) goto next; } fi->Bitmap->PixelFormat = pf24bit; fi->Bitmap->Width = 80; fi->Bitmap->Height = 100; if (fi->Bitmap->Empty) goto next; fi->Bitmap->Canvas->Brush->Color = clWhite; fi->Bitmap->Canvas->FillRect(Rect(0, 0, 80, 100)); if(view_thumb && memsize < limit_size) if ((dcSrc = TexBitmap->CreateDC())==NULL) goto next; SetStretchBltMode(fi->Bitmap->Canvas->Handle, COLORONCOLOR); if(view_thumb && memsize < limit_size) { StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, dcSrc, 0, 0, TexBitmap->Width, TexBitmap->Height, SRCCOPY); TexBitmap->DeleteDC(dcSrc); dcSrc = NULL; if(!exist_file) { temp_Dir = DefaultDir + "\\Temp"; temp_fn = temp_Dir + "\\" + fn + FileAge(fn) + FileInfo.SizeDisk + ".jpg"; //fi->Bitmap->SaveToFile(temp_fn); TTexpiaBitmap *temp_TexBitmap = NULL; if(!DirectoryExists(temp_Dir)) CreateDir(temp_Dir); if ((temp_TexBitmap = new TTexpiaBitmap) == NULL) goto next; temp_TexBitmap->Create(80, 100, 24); if ((dcSrc = temp_TexBitmap->CreateDC())==NULL) goto next; BitBlt(dcSrc, 0, 0, 80, 100, fi->Bitmap->Canvas->Handle, 0, 0, SRCCOPY); temp_TexBitmap->SaveToFile(temp_fn, FILE_JFIF, 50); SetFileAttributes(temp_fn.c_str(), FILE_ATTRIBUTE_HIDDEN); temp_TexBitmap->DeleteDC(dcSrc); dcSrc = NULL; delete temp_TexBitmap; } delete TexBitmap; TexBitmap = NULL; } if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } #else if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; if (!LoadFromTexpiaTag(hFile, fi, ver)) goto next; Version->Add(ver); #endif LargeImageList->Add(fi->Bitmap, NULL); } pItem = ListView->Items->Add(); if (hFile == INVALID_HANDLE_VALUE) { if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } size = GetFileSize(hFile, NULL); pItem->Caption = fn; if(ListView->ViewStyle == vsIcon){ pItem->ImageIndex = imgindex; imgindex++; } else { pItem->ImageIndex = FilterComboBox->ItemIndex; } pItem->SubItems->Add(FloatToStr(size / 1000.0) + "KB"); if (SetFilePointer(hFile, 0, NULL, FILE_BEGIN) == 0xFFFFFFFF) goto next; ext = UpperCase(ExtractFileExt(fn)); pItem->SubItems->Add(ext); if (GetFileTime(hFile, NULL, NULL, &fTime)) { FileTimeToLocalFileTime(&fTime, &fLocTime); if (FileTimeToSystemTime(&fLocTime, &SysTime)) { time = Format("%d-%d-%d %d:%d", OPENARRAY(TVarRec, (SysTime.wYear, SysTime.wMonth, SysTime.wDay, SysTime.wHour, SysTime.wMinute))); pItem->SubItems->Add(time); } } CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; ProgressBar->Position = (100.0 / count) * (i+1); #if defined(TEXTILE) if(FilterComboBox->ItemIndex + 1 == gffALL) SearchIcon(fn, i); #endif #if defined(WEAVE) if(FilterComboBox->ItemIndex == 2)SearchIcon(fn, i); #endif continue; next: if (hFile != INVALID_HANDLE_VALUE) { CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; } if (TexBitmap) { if (dcSrc) { TexBitmap->DeleteDC(dcSrc); dcSrc = NULL; } delete TexBitmap; TexBitmap = NULL; } } FilterComboBoxItemIndex = FilterComboBox->ItemIndex; GetDiskInfor(); if(fi) delete fi; ProgressBar->Position = 0; FDrive = DriveComboBox->Drive; FDirectory = DirectoryListBox->Directory; FFilter = FilterComboBox->Filter; FFilterIndex = FilterComboBox->ItemIndex; StartLargeImage = true; return; fail: if (fi) delete fi; EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::InitLargeData(bool isCheck) { TFileInfor *fi = NULL; FILEINFO FileInfo; TTexpiaBitmap *TexBitmap = NULL; int i, imgindex; TTexVersion *ver=NULL; TListItem *pItem=NULL; AnsiString fn, time; AnsiString temp_fn; AnsiString temp_Dir; //-- Graphics::TBitmap *icon = NULL; RGBQUAD rgb[256]; HANDLE hFile = INVALID_HANDLE_VALUE; DWORD size, memsize; FILETIME fTime, fLocTime; SYSTEMTIME SysTime; HDC dcSrc = NULL; TPException ec = EC_NONE; AnsiString ext; bool exist_file = false; bool view_thumb_value; Graphics::TBitmap *big_size_icon = NULL; int count = FileListBox->Items->Count; if ((fi = new TFileInfor)==NULL) { ec = EC_MEMORY_LACK; goto fail; } if ((fi->Bitmap = new Graphics::TBitmap)==NULL) { ec = EC_MEMORY_LACK; goto fail; } if (Version){ while(Version->Count > 0){ ver = (TTexVersion*)(Version->Last()); Version->Remove(ver); delete ver; } delete Version; Version = NULL; } Version = new TList; ListView->Items->BeginUpdate(); for (i = 0, imgindex = 0; i < count; i++) { //Application->ProcessMessages(); view_thumb_value = view_thumb; exist_file = false; fn = FileListBox->Items->Strings[i]; if(ComboBoxView->ItemIndex == 0) { #if defined(TEXTILE) #ifdef ACADEMY if (FilterComboBox->ItemIndex+1 == gffTEX) { #else #ifdef NOTN3D if (FilterComboBox->ItemIndex+1 == gffTEX || FilterComboBox->ItemIndex+1 == gffTFC || FilterComboBox->ItemIndex+1 == gffT3D || FilterComboBox->ItemIndex+1 == gffWEA || FilterComboBox->ItemIndex+1 == gffWAV || FilterComboBox->ItemIndex+1 == gffKNT || FilterComboBox->ItemIndex+1 == gffOldTEX || FilterComboBox->ItemIndex+1 == gffOldTFC || FilterComboBox->ItemIndex+1 == gffVST ) { #else if (FilterComboBox->ItemIndex+1 == gffTEX || FilterComboBox->ItemIndex+1 == gffTFC /*|| FilterComboBox->ItemIndex+1 == gffT3D*/ || FilterComboBox->ItemIndex+1 == gffWEA || FilterComboBox->ItemIndex+1 == gffWAV || FilterComboBox->ItemIndex+1 == gffKNT || FilterComboBox->ItemIndex+1 == gffOldTEX || FilterComboBox->ItemIndex+1 == gffOldTFC /*|| FilterComboBox->ItemIndex+1 == gffN3D || FilterComboBox->ItemIndex+1 == gffVST*/) { #endif #endif if(view_thumb_value) { if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; if (!LoadFromTexpiaTag(hFile, fi, ver)) goto next; Version->Add(ver); } else { fi->Bitmap->PixelFormat = pf24bit; fi->Bitmap->Width = 80; fi->Bitmap->Height = 100; if (fi->Bitmap->Empty) goto next; fi->Bitmap->Canvas->Brush->Color = clWhite; fi->Bitmap->Canvas->FillRect(Rect(0, 0, 80, 100)); SetStretchBltMode(fi->Bitmap->Canvas->Handle, COLORONCOLOR); ver = new TTexVersion; ver->Texpia = '\0'; ver->Method = '\0'; ver->Number = 0; Version->Add(ver); } } else { /*if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; size = GetFileSize(hFile, NULL); CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE;*/ L_FileInfo(fn.c_str(), &FileInfo, 0, NULL); memsize = FileInfo.SizeMem; if(view_thumb_value && memsize < limit_size) { temp_Dir = DefaultDir + "\\Temp"; if ((TexBitmap = new TTexpiaBitmap) == NULL) goto next; if(!DirectoryExists(temp_Dir)) CreateDir(temp_Dir); temp_fn = temp_Dir + "\\" + fn + FileAge(fn) + FileInfo.SizeDisk + ".jpg"; if(FileExists(temp_fn)) { exist_file = true; if(!TexBitmap->LoadFromFile(temp_fn)) goto next; } else if (!TexBitmap->LoadFromFile(fn)) goto next; } else if(view_thumb_value && memsize >= limit_size) { if ((big_size_icon = new Graphics::TBitmap) == NULL) goto next; big_size_icon->Width = 80; big_size_icon->Height = 100; UnabledImageList->GetBitmap(0, big_size_icon); } fi->Bitmap->PixelFormat = pf24bit; fi->Bitmap->Width = 80; fi->Bitmap->Height = 100; if (fi->Bitmap->Empty) goto next; fi->Bitmap->Canvas->Brush->Color = clWhite; fi->Bitmap->Canvas->FillRect(Rect(0, 0, 80, 100)); if(view_thumb_value && memsize < limit_size) if ((dcSrc = TexBitmap->CreateDC())==NULL) goto next; SetStretchBltMode(fi->Bitmap->Canvas->Handle, COLORONCOLOR); if(view_thumb_value) { if(memsize < limit_size) { StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, dcSrc, 0, 0, TexBitmap->Width, TexBitmap->Height, SRCCOPY); TexBitmap->DeleteDC(dcSrc); dcSrc = NULL; } else { StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, big_size_icon->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); } if(!exist_file && memsize < limit_size) { temp_Dir = DefaultDir + "\\Temp"; temp_fn = temp_Dir + "\\" + fn + FileAge(fn) + FileInfo.SizeDisk + ".jpg"; //fi->Bitmap->SaveToFile(temp_fn); TTexpiaBitmap *temp_TexBitmap = NULL; if(!DirectoryExists(temp_Dir)) CreateDir(temp_Dir); if ((temp_TexBitmap = new TTexpiaBitmap) == NULL) goto next; temp_TexBitmap->Create(80, 100, 24); if ((dcSrc = temp_TexBitmap->CreateDC())==NULL) goto next; BitBlt(dcSrc, 0, 0, 80, 100, fi->Bitmap->Canvas->Handle, 0, 0, SRCCOPY); temp_TexBitmap->SaveToFile(temp_fn, FILE_JFIF, 50); SetFileAttributes(temp_fn.c_str(), FILE_ATTRIBUTE_HIDDEN); temp_TexBitmap->DeleteDC(dcSrc); dcSrc = NULL; delete temp_TexBitmap; } delete TexBitmap; TexBitmap = NULL; if(big_size_icon != NULL) { delete big_size_icon; big_size_icon = NULL; } } if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } #else if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; if (!LoadFromTexpiaTag(hFile, fi, ver)) goto next; Version->Add(ver); #endif LargeImageList->Add(fi->Bitmap, NULL); } pItem = ListView->Items->Add(); if (hFile == INVALID_HANDLE_VALUE) { if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } size = GetFileSize(hFile, NULL); pItem->Caption = fn; if(ListView->ViewStyle == vsIcon){ pItem->ImageIndex = imgindex; imgindex++; } else { pItem->ImageIndex = FilterComboBox->ItemIndex; } pItem->SubItems->Add(FloatToStr(size / 1000.0) + "KB"); if (SetFilePointer(hFile, 0, NULL, FILE_BEGIN) == 0xFFFFFFFF) goto next; ext = UpperCase(ExtractFileExt(fn)); pItem->SubItems->Add(ext); if (GetFileTime(hFile, NULL, NULL, &fTime)) { FileTimeToLocalFileTime(&fTime, &fLocTime); if (FileTimeToSystemTime(&fLocTime, &SysTime)) { time = Format("%d-%d-%d %d:%d", OPENARRAY(TVarRec, (SysTime.wYear, SysTime.wMonth, SysTime.wDay, SysTime.wHour, SysTime.wMinute))); pItem->SubItems->Add(time); } } CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; ProgressBar->Position = (100.0 / count) * (i+1); #if defined(TEXTILE) if(FilterComboBox->ItemIndex + 1 == gffALL)SearchIcon(fn, i); #endif #if defined(WEAVE) if(FilterComboBox->ItemIndex == 2)SearchIcon(fn, i); #endif continue; next: if (hFile != INVALID_HANDLE_VALUE) { CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; } if (TexBitmap) { if (dcSrc) { TexBitmap->DeleteDC(dcSrc); dcSrc = NULL; } delete TexBitmap; TexBitmap = NULL; } if(big_size_icon != NULL) { delete big_size_icon; big_size_icon = NULL; } } ListView->Items->EndUpdate(); FilterComboBoxItemIndex = FilterComboBox->ItemIndex; GetDiskInfor(); if(fi) delete fi; ProgressBar->Position = 0; FDrive = DriveComboBox->Drive; FDirectory = DirectoryListBox->Directory; FFilter = FilterComboBox->Filter; FFilterIndex = FilterComboBox->ItemIndex; StartLargeImage = true; return; fail: if (fi) delete fi; EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ExitData() { if (ListView->Items->Count) ListView->Items->Clear(); if (LargeImageList->Count) LargeImageList->Clear(); //-- if (SmallImageList->Count) SmallImageList->Clear(); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Delete_File(AnsiString FileName) { SHFILEOPSTRUCT shfile; AnsiString asFrom; char *ucFrom = NULL, *ch = NULL, *ph=NULL; memset(&shfile, 0, sizeof(SHFILEOPSTRUCT)); shfile.hwnd = Handle; shfile.wFunc = FO_DELETE; int len = DirectoryListBox->Directory.Length(); if ((ch = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len + 2)) == NULL) goto fail; strcpy(ch, DirectoryListBox->Directory.c_str()); ph = ch + (len-1); if (*ph == '\\') asFrom = DirectoryListBox->Directory+FileName; else asFrom = DirectoryListBox->Directory+"\\"+FileName; if ((ucFrom = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, asFrom.Length()+2)) == NULL) goto fail; strcpy(ucFrom, asFrom.c_str()); shfile.pFrom = ucFrom; shfile.fFlags = FOF_ALLOWUNDO ; SHFileOperation(&shfile); HeapFree(GetProcessHeap(), 0, ucFrom); HeapFree(GetProcessHeap(), 0, ch); return; fail: if (ch) HeapFree(GetProcessHeap(), 0, ch); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Delete_Folder(AnsiString FolderName) { SHFILEOPSTRUCT shfile; char *ucFrom = NULL; memset(&shfile, 0, sizeof(SHFILEOPSTRUCT)); shfile.hwnd = Handle; shfile.wFunc = FO_DELETE; ucFrom = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FolderName.Length()+2); if (ucFrom) { strcpy(ucFrom, FolderName.c_str()); shfile.pFrom = ucFrom; shfile.fFlags = FOF_ALLOWUNDO ; SHFileOperation(&shfile); HeapFree(GetProcessHeap(), 0, ucFrom); } else { EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::GetDiskInfor() { ULARGE_INTEGER FreeBytesAvailableToCaller; ULARGE_INTEGER TotalNumberOfBytes; ULARGE_INTEGER TotalNumberOfFreeBytes; int FreeSpace, TotalSpace; char *szDrive = DirectoryListBox->Directory.c_str(); char szBuffer[4]; StrLCopy(szBuffer, szDrive, 1); strcat(szBuffer, ":\\"); ::GetDiskFreeSpaceEx(szBuffer, &FreeBytesAvailableToCaller, &TotalNumberOfBytes, &TotalNumberOfFreeBytes); FreeSpace = (FreeBytesAvailableToCaller.HighPart << 12) | (FreeBytesAvailableToCaller.LowPart >> 20); TotalSpace = (TotalNumberOfBytes.HighPart << 12) | (TotalNumberOfBytes.LowPart >> 20); StatusBar->Panels->Items[1]->Text = Format("Current Free Spaces : %d M Bytes, Total Disk Spaces : %d M Bytes", OPENARRAY (TVarRec,(FreeSpace, TotalSpace))); #ifndef CARPET StatusBar->Panels->Items[0]->Text = " " +AnsiString(ListView->Items->Count) + " Patterns"; #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::DriveComboBoxChange(TObject *Sender) { DriveChange(); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::DriveChange() { char drive = DriveComboBox->Drive; AnsiString root, dn; int status; bool success, find = false; TSearchRec sr; if (UpperCase(AnsiString(drive)) != "C") return; root = Format("%s:\\", OPENARRAY(TVarRec, (drive))); dn = "pattern"; status = FindFirst(root + "*.*", faDirectory, sr); while (status == 0) { if (LowerCase(sr.Name) == dn) { find = true; break; } status = FindNext(sr); } FindClose(sr); if (find) { DirectoryListBox->Directory = root + dn; } else { dn = root + dn; success = CreateDirectory(dn.c_str(), NULL); if (success == false) { DirectoryListBox->Directory = root; ShowMessage(IDS_MESSAGE); } else { DirectoryListBox->Directory = dn; } } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ReadKnitSize1Click(TObject *Sender) { #if defined(KNIT) TFileSizeForm *Form=NULL; TFMReadParameter rp; bool run = false; TPException ec; Form = new TFileSizeForm(NULL); if (Form->ShowModal()==mrOk) { if (ExtIndex == gffTEX) run = true; rp.DPI = Form->seResol->Value; rp.WPI = Form->seWPI->Value; rp.CPI = Form->seCPI->Value; } delete Form; if (run) { if (FOnRead) { rp.DirName = FileListBox->Directory; rp.FileName = FileName; rp.ExtIndex = ExtIndex; rp.Method = 1; if ((ec = FOnRead(rp)) != EC_NONE) EXCEPTION_MESSAGE_OK(ec); ModalResult = mrOk; } } MainMenuForm->NewForm(); #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ReadStitchSize1Click(TObject *Sender) { #if defined(KNIT) TFileSizeForm *Form=NULL; TFMReadParameter rp; bool run = false; TPException ec; Form = new TFileSizeForm(NULL); if (Form->ShowModal()==mrOk) { if (ExtIndex == gffTEX) run = true; rp.DPI = Form->seResol->Value; rp.WPI = Form->seWPI->Value; rp.CPI = Form->seCPI->Value; } delete Form; if (run) { if (FOnRead) { rp.DirName = FileListBox->Directory; rp.FileName = FileName; rp.ExtIndex = ExtIndex; rp.Method = 0; if ((ec = FOnRead(rp)) != EC_NONE) EXCEPTION_MESSAGE_OK(ec); ModalResult = mrOk; } } MainMenuForm->NewForm(); #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::IconSet(int k) { int i ; for(i = 0 ; i < ListView->Items->Count ; i++) { ListView->Items->Item[i]->ImageIndex = k; } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { int n; // statusbar ¿¡ È­ÀÏ ¹öÀü Ç¥½Ã TTexVersion *ver=NULL; TListItem *pItem=NULL; AnsiString VerNumber; if(ComboBoxView->ItemIndex) goto next; if(Version->Count) { pItem = ListView->GetItemAt(X,Y); if(!pItem) goto next; n = pItem->Index; if(Version->Count < n) goto next; ver = (TTexVersion *)Version->Items[n]; VerNumber += (" Version " + FloatToStr(ver->Number/100.0)); StatusBar->Panels->Items[2]->Text = VerNumber; } return; next: StatusBar->Panels->Items[2]->Text = ""; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewChange(TObject *Sender, TListItem *Item, TItemChange Change) { if (ListView->SelCount == 1 ){ // ¼±ÅÃÇÑ ¾ÆÀÌÅÛÀÇ °¹¼ö°¡ 1°³À϶§¸¸ Rename1->Enabled = true; // ´ÙÀ½ÀÇ °ÍµéÀÌ °¡´É By GreenFish Rename2->Enabled = true; // (FileÀÇ ´ÙÁß¼±ÅÃÀÌ °¡´ÉÇØÁö¸é¼­ ºÎ°¡) Preference1->Enabled = true; Preference2->Enabled = true; Save1->Enabled = true; Save2->Enabled = true; int n = ListView->Selected->Index; if (ComboBoxView->ItemIndex != 0 && isPreview->Checked) ImagePreview(n); else ImagePreview(-1); }else { Rename1->Enabled = false; Rename2->Enabled = false; Preference1->Enabled = false; Preference2->Enabled = false; Save1->Enabled = false; Save2->Enabled = false; } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Rename1Click(TObject *Sender) //2001.7.2 by lhskys Rename F2 ±â´É Ãß°¡ { int n = ListView->Selected->Index; SpeedButtonRename->Down = true; FileName = ListView->Items->Item[n]->Caption; Label4->Caption = IDS_FILENAME; SpeedButton4->Caption = IDS_COMMON_RENAME; Edit4->Text = FileName; SpeedButton4->Enabled = true; Panel->Height = Panel1->Height + Panel2->Height + Panel3->Height + Panel4->Height; Edit4->SetFocus(); Item = 6; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Preference1Click(TObject *Sender) { if (ListView->SelCount != 1) return; // By GreenFish ÆÄÀÏ µî·ÏÁ¤º¸ Ç¥½ÃÇϱâ TFMReadParameter rp; int n; n = ListView->Selected->Index; FileName = ListView->Items->Item[n]->Caption; HANDLE hFile; FILETIME fLocTime; typedef struct { // ³¯Â¥, ½Ã°£ ±¸Á¶Ã¼ WORD Day:5; WORD Month:4; WORD Year:7; } DOSDATE; typedef struct { WORD Second:5; WORD Minute:6; WORD Hour:5; } DOSTIME; DOSDATE Date, Date2, Date3; DOSTIME Time, Time2, Time3; BY_HANDLE_FILE_INFORMATION info; // info ¿¡ ÆÄÀÏ Á¤º¸µéÀÌ ÀÔ·Â FilePreferBox->BringToFront(); hFile = CreateFile (FileName.c_str() , GENERIC_READ | GENERIC_WRITE , 0 , NULL, OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL , NULL); // File ¹Þ±â GetFileInformationByHandle (hFile , &info); FileTimeToLocalFileTime ( &info.ftCreationTime , &fLocTime); // Áö¿ª ½Ã°£À¸·Î º¯È¯ FileTimeToDosDateTime (&fLocTime , (WORD*)&Date , (WORD*)&Time); // Dos TimeÀ¸·Î º¯È¯ FileTimeToLocalFileTime ( &info.ftLastWriteTime , &fLocTime); FileTimeToDosDateTime (&fLocTime , (WORD*)&Date2 , (WORD*)&Time2); FileTimeToLocalFileTime ( &info.ftLastAccessTime , &fLocTime); FileTimeToDosDateTime (&fLocTime , (WORD*)&Date3 , (WORD*)&Time3); FileNameLabel->Caption = FileName; LocationLabel->Caption = FileListBox->Directory; SizeLabel->Caption = FormatFloat ("#,##0",info.nFileSizeLow) + " Bytes"; if (Date.Month == 0) { CreateLabel->Caption = "(Unknown)"; } else { CreateLabel->Caption = Format ( "%2d-%2d-%d %2d : %2d : %2d",OPENARRAY(TVarRec, (Date.Month, Date.Day, (Date.Year+1980), Time.Hour, Time.Minute, Time.Second))) ; } ChangeLabel->Caption = Format ( "%2d-%2d-%d %2d : %2d : %2d",OPENARRAY(TVarRec, (Date2.Month, Date2.Day, (Date2.Year+1980), Time2.Hour, Time2.Minute, Time2.Second))) ; LastLabel->Caption = Format ( "%2d-%2d-%d" ,OPENARRAY(TVarRec, (Date3.Month, Date3.Day, (Date3.Year+1980)))) ; CloseHandle (hFile) ; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ExitPreferButtonClick(TObject *Sender) { FilePreferBox->SendToBack(); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Copy1Click(TObject *Sender) { if (!ListView->SelCount) return; TListItem *ItemM = ListView->Selected; // ¿©·¯°³ÆÄÀÏ Copy By GreenFish TItemStates selected = TItemStates() << isSelected; bCutMode = false; if (MoveCopyList) delete MoveCopyList; MoveCopyList = new TStringList; while (ItemM) { int n; if (ItemM) { n = ItemM->Index; MoveCopyList->Add(FullPathName(FileListBox->Directory, ListView->Items->Item[n]->Caption)); MoveCopyList->Add(ListView->Items->Item[n]->Caption); } ItemM = ListView->GetNextItem(ItemM, sdAll, selected ); } Paste1->Enabled = true; Paste2->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Paste1Click(TObject *Sender) { if (!MoveCopyList) return; if (bCutMode) { while (MoveCopyList->Count) { AnsiString MoveDestination = FullPathName(FileListBox->Directory,MoveCopyList->Strings[1]); int Attrs = FileGetAttr(MoveCopyList->Strings[0]); // ÀбâÀü¿ë ¼Ó¼ºÀÌ ÀÖÀ¸¸é ¾ø¿¡¹ö¸°´Ù~ (±ú²ýÀÌ Áö¿öÁü) if (!CopyFile (MoveCopyList->Strings[0].c_str() , MoveDestination.c_str(), true)) { if (Application->MessageBox("Do you want to overwrite?","File already exists",MB_YESNO | MB_ICONQUESTION) == IDYES){ CopyFile (MoveCopyList->Strings[0].c_str() , MoveDestination.c_str(), false); if (Attrs & faReadOnly) FileSetAttr(MoveCopyList->Strings[0], Attrs & !faReadOnly); DeleteFile(MoveCopyList->Strings[0].c_str()); } }else { if (Attrs & faReadOnly) FileSetAttr(MoveCopyList->Strings[0], Attrs & !faReadOnly); DeleteFile(MoveCopyList->Strings[0].c_str()); } MoveCopyList->Delete(0); MoveCopyList->Delete(0); } }else { while (MoveCopyList->Count) { AnsiString CopyDestination = FullPathName(FileListBox->Directory,MoveCopyList->Strings[1]); if (!CopyFile (MoveCopyList->Strings[0].c_str() , CopyDestination.c_str(), true)) { if (Application->MessageBox("Do you want to overwrite?","File already exists", MB_YESNO | MB_ICONQUESTION) == IDYES) CopyFile (MoveCopyList->Strings[0].c_str() , CopyDestination.c_str(), false); } MoveCopyList->Delete(0); MoveCopyList->Delete(0); } } delete MoveCopyList; MoveCopyList = NULL; FileListBox->Update(); //InitData(false); /*if(ComboBoxView->ItemIndex == 0) temp_Panel->Visible = false; InitData(false); view_thumb = true; temp_Panel->Visible = false;*/ InitData(false); view_thumb = true; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Cut1Click(TObject *Sender) { if (!ListView->SelCount) return; TListItem *ItemM = ListView->Selected; // ¿©·¯°³ÆÄÀÏ Move By GreenFish TItemStates selected = TItemStates() << isSelected; bCutMode = true; if (MoveCopyList) delete MoveCopyList; MoveCopyList = new TStringList; while (ItemM) { int n; if (ItemM) { n = ItemM->Index; MoveCopyList->Add(FullPathName(FileListBox->Directory, ListView->Items->Item[n]->Caption)); MoveCopyList->Add(ListView->Items->Item[n]->Caption); } ItemM = ListView->GetNextItem(ItemM, sdAll, selected ); } Paste1->Enabled = true; Paste2->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { if (Key == 46) PopupDeleteClick(this); // Delete Key·Î »èÁ¦ if (Key == VK_F2) { //2001.6.30 by lhskys Rename F2 ´ÜÃàŰ........ if(Rename){ Item = 6; int n = ListView->Selected->Index; SpeedButtonRename->Down = true; FileName = ListView->Items->Item[n]->Caption; Label4->Caption = IDS_FILENAME; SpeedButton4->Caption = IDS_COMMON_RENAME; Edit4->Text = FileName; SpeedButton4->Enabled = true; Panel->Height = Panel1->Height + Panel2->Height + Panel3->Height + Panel4->Height; Edit4->SetFocus(); } }else if (Key == VK_F3) { if(AllSearch->Checked){ IncludeSearchData(); } } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewKeyPress(TObject *Sender, char &Key) { int KeyVal = Key; // File ManagerÀÇ ´ÜÃàŰ By GreenFish switch (KeyVal) { case 3 : Copy1Click (this); break; // Ctrl + C case 22: Paste1Click(this); break; // Ctrl + V case 24: Cut1Click(this); break; // Ctrl + X } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { if (Key == 27) SpeedButtonExitClick(this); // Esc Key·Î Exit } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ImagePreview(int index) { // By GreenFish if (index == -1) {PreviewImage->Visible = false; return;} else PreviewImage->Visible = true; // AnsiString fn = FileListBox->Items->Strings[index]; AnsiString fn = ListView->Items->Item[index]->Caption; HANDLE hFile = INVALID_HANDLE_VALUE; TTexVersion *ver = NULL; TTexpiaBitmap *TexBitmap = NULL; TFileInfor *fi = NULL; HDC dcSrc = NULL; TPException ec = EC_NONE; #if defined(TEXTILE) AnsiString ext = LowerCase(ExtractFileExt(fn)); SearchExtIndex(ext); TGraphicFileFormat RealIndex = FindExtension(ext); if(RealIndex == gffNON){ PreviewImage->Visible = false; ShowMessage(IDS_MESSAGE_NOTIMAGEPREVIEW); return; } #endif if ((fi = new TFileInfor)==NULL) { ec = EC_MEMORY_LACK; goto fail; } if ((fi->Bitmap = new Graphics::TBitmap)==NULL) { ec = EC_MEMORY_LACK; goto fail; } #if defined(TEXTILE) #ifdef ACADEMY if (RealIndex == gffTEX) { #else #ifdef NOTN3D if (RealIndex == gffTEX || RealIndex == gffTFC || RealIndex == gffT3D || RealIndex == gffWEA || RealIndex == gffWAV || RealIndex == gffKNT || RealIndex == gffOldTEX || RealIndex == gffOldTFC || RealIndex == gffVST ) { #else if (RealIndex == gffTEX || RealIndex == gffTFC /*|| RealIndex == gffT3D*/ || RealIndex == gffWEA || RealIndex == gffWAV || RealIndex == gffKNT || RealIndex == gffOldTEX || RealIndex == gffOldTFC /*|| RealIndex == gffN3D || RealIndex == gffVST*/) { #endif #endif if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; if (!LoadFromTexpiaTag(hFile, fi, ver)) goto next; // Version->Add(ver); } else { if ((TexBitmap = new TTexpiaBitmap) == NULL) goto next; if (!TexBitmap->LoadFromFile(fn)) goto next; fi->Bitmap->PixelFormat = pf24bit; fi->Bitmap->Width = 80; fi->Bitmap->Height = 100; if (fi->Bitmap->Empty) goto next; fi->Bitmap->Canvas->Brush->Color = clWhite; fi->Bitmap->Canvas->FillRect(Rect(0, 0, 80, 100)); if ((dcSrc = TexBitmap->CreateDC())==NULL) goto next; SetStretchBltMode(fi->Bitmap->Canvas->Handle, COLORONCOLOR); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, dcSrc, 0, 0, TexBitmap->Width, TexBitmap->Height, SRCCOPY); TexBitmap->DeleteDC(dcSrc); dcSrc = NULL; delete TexBitmap; TexBitmap = NULL; } #else if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; if (!LoadFromTexpiaTag(hFile, fi, ver)) goto next; // Version->Add(ver); #endif StretchBlt(PreviewImage->Canvas->Handle,0,0,120,140,fi->Bitmap->Canvas->Handle,0,0,80,100,SRCCOPY); PreviewImage->Invalidate(); if (hFile != INVALID_HANDLE_VALUE){CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE;} next: if(fi) delete fi; if(ver) delete ver; return; fail: if (fi) delete fi; EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::isPreviewClick(TObject *Sender) { if (isPreview->Checked){ PreviewBox->BringToFront(); Label5->Caption = IDS_IMAGEPREVIEW; if(DirectoryListBox->Height - PreviewBox->Height - 60> 0){ PreviewBox->Top = DirectoryListBox->Height - PreviewImage->Height; } }else PreviewBox->SendToBack(); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewKeyUp(TObject *Sender, WORD &Key, TShiftState Shift) { if (ListView->Selected) { FileName = ListView->Items->Item[ListView->Selected->Index]->Caption; Rename = true; //2001.7.2 by lhskys Rename F2 ±â´É Ãß°¡ if(Edit4->Visible && SpeedButtonMakeFolder->Down == false)Edit4->Text = FileName; else if(Edit4->Visible)Edit4->Text =""; if(SpeedButtonRename->Down || SpeedButtonSaveAs->Down)Edit4->SetFocus(); // if (ComboBoxView->ItemIndex != 0 && isPreview->Checked) ImagePreview(n); } else {FileName = ""; ImagePreview(-1);} } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewResize(TObject *Sender) { ListView->Arrange(arDefault); if(isPreview->Checked == true){ if(DirectoryListBox->Height - PreviewBox->Height - 60> 0){ PreviewBox->Top = DirectoryListBox->Height - PreviewImage->Height; } } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormClose(TObject *Sender, TCloseAction &Action) { #ifdef TEXTILE MainForm->Readdown = false; MainMenuForm->ExitFileManeger(); #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::PopupMenuFilePopup(TObject *Sender) { Copy2->Caption = IDS_FCOPY; Cut2->Caption = IDS_FCUT; Paste2->Caption = IDS_FPASTE; Save2->Caption = IDS_FSAVE; Delete2->Caption = IDS_FDELETE; Rename2->Caption = IDS_FRENAME; Preference2->Caption = IDS_FPREFERENCE; ReadStitchSize1->Caption = IDS_READSTITCH; ReadKnitSize1->Caption = IDS_READSIZE; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::PopupMenuDirectoryPopup(TObject *Sender) { DirectoryRename->Caption = IDS_FRENAME; DirectoryDelete->Caption = IDS_FDELETE; } //--------------------------------------------------------------------------- bool __fastcall TFileManagerForm::SearchData() { AnsiString fn, Sn, Sfn; int n, count = FileListBox->Items->Count; int FileNameLength; AnsiString LowName, ext; FileNameLength = Edit4->Text.Length(); if(FileNameLength > 4){ LowName = Edit4->Text.LowerCase(); switch (ExtIndex) { #if defined(TEXTILE) case gffTEX: ext = "*.tex"; break; case gffBMP: ext = "*.bmp"; break; case gffTIF: ext = "*.tif"; break; // case gffVST: ext = "*.vst"; break; #ifdef ACADEMY #else case gffTFC: ext = "*.tfc"; break; // case gffT3D: ext = "*.t3d"; break; case gffOldTEX: ext = "*.tex"; break; case gffOldTFC: ext = "*.tfc"; break; #ifdef NOTN3D #else // case gffN3D: ext = "*.n3d"; break; #endif case gffWEA: ext = "*.wea"; break; case gffWAV: ext = "*.wav"; break; case gffKNT: ext = "*.knt"; break; case gffPCT: ext = "*.pct"; break; case gffPCX: ext = "*.pcx"; break; case gffPNG: ext = "*.png"; break; case gffPSD: ext = "*.psd"; break; case gffRAS: ext = "*.ras"; break; case gffTGA: ext = "*.tga"; break; #if defined(CARPET) case gffCPT: ext = "*.cpt"; break; #else case gffJPG: ext = "*.jpg"; break; case gffEPS: ext = "*.eps"; break; // case gffGIF: ext = "*.gif"; break; // by mecbong #endif #endif #elif defined(WEAVE) case gffWEA: ext = "*.wea"; break; case gffWAV: ext = "*.wav"; break; #elif defined(KNIT) case gffKNT: ext = "*.knt"; break; case gffTEX: ext = "*.tex"; break; #elif defined(PILE) case gffPIL: ext = "*.pil"; break; #endif } if(LowName.Pos(ext) == FileNameLength - 3)Sfn = Edit4->Text; else Sfn = FOnFileName(Edit4->Text, ExtIndex); } else Sfn = FOnFileName(Edit4->Text, ExtIndex); for (int i = 0; i < count; i++) { // fn = FileListBox->Items->Strings[i].LowerCase(); fn = ListView->Items->Item[i]->Caption.LowerCase(); Sn = Sfn.LowerCase(); if(fn == Sn){ if(ListView->Selected){ n = ListView->Selected->Index; ListView->Items->Item[n]->Selected = false; } ListView->Items->Item[i]->Selected = true; ListView->SetFocus(); ListView->Scroll(0,ListView->Selected->DisplayRect(drBounds).Top); return true; } } return false; } //--------------------------------------------------------------------------- bool __fastcall TFileManagerForm::IncludeSearchData() { AnsiString fn; int n, count = FileListBox->Items->Count; int s, len; bool bFind=false; AnsiString LowName, ext, name; AnsiString temp; NumOfSearchFiles=0; CurrentFileNum=0; int i; // for (i = SearchCount; i < count; i++) { for (i = 0; i < count; i++) { // fn = FileListBox->Items->Strings[i].LowerCase(); name = ListView->Items->Item[i]->Caption.LowerCase(); len = name.Length(); //len = (name.Length() - 4); for (int i = 1; i <= len; i++) { fn += name[i]; } s = fn.Pos(SearchName.LowerCase()); fn = ""; if(s){ if(i>=SearchCount && !bFind ){ if(ListView->Selected){ n = ListView->Selected->Index; ListView->Items->Item[n]->Selected = false; } ListView->Items->Item[i]->Selected = true; ListView->SetFocus(); ListView->Scroll(0,ListView->Selected->DisplayRect(drBounds).Top); SearchCount = i+1; bFind=true; NumOfSearchFiles++; CurrentFileNum++; // return true; }else if(i>=SearchCount && bFind){ NumOfSearchFiles++; }else{ NumOfSearchFiles++; CurrentFileNum++; } } } if(!bFind && SearchCount != 0){ ShowMessage(IDS_MESSAGE_OVERFILENOTFOUND); return false; } temp = CurrentFileNum; temp +="/"; temp +=NumOfSearchFiles; // GetDiskInfor(); // StatusBar->Panels->Items[1]->Text += temp; StatusBar->Panels->Items[1]->Text = temp; return true; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SearchIcon(AnsiString fn, int i) { #if defined(TEXTILE) int ExtIcon; AnsiString ext = LowerCase(ExtractFileExt(fn)); if(ext == ".tex") ExtIcon = gffTEX; // else if(ext == ".vst") ExtIcon = gffVST; else if(ext == ".bmp") ExtIcon = gffBMP; else if(ext == ".tif") ExtIcon = gffTIF; #ifdef ACADEMY #else else if(ext == ".tfc") ExtIcon = gffTFC; // else if(ext == ".t3d") ExtIcon = gffT3D; #ifdef NOTN3D #else // else if(ext == ".n3d") ExtIcon = gffN3D; #endif else if(ext == ".wea") ExtIcon = gffWEA; else if(ext == ".wav") ExtIcon = gffWAV; else if(ext == ".knt") ExtIcon = gffKNT; else if(ext == ".pct") ExtIcon = gffPCT; else if(ext == ".pcx") ExtIcon = gffPCX; else if(ext == ".png") ExtIcon = gffPNG; else if(ext == ".psd") ExtIcon = gffPSD; else if(ext == ".ras") ExtIcon = gffRAS; else if(ext == ".tga") ExtIcon = gffTGA; else if(ext == ".jpg") ExtIcon = gffJPG; else if(ext == ".eps") ExtIcon = gffEPS; // else if(ext == ".gif") ExtIcon = gffGIF; // by mecbong if (ComboBoxView->ItemIndex == 1) { // ExtIndex = TGraphicFileFormat(ExtIcon); //03. 7.2 qe ¸·À½ ListView->Items->Item[i]->ImageIndex = ExtIcon-1; ListView->ViewStyle = vsSmallIcon; } else if (ComboBoxView->ItemIndex == 2) { // ExtIndex = TGraphicFileFormat(ExtIcon); //03. 7.2 qe ¸·À½ ListView->Items->Item[i]->ImageIndex = ExtIcon-1; ListView->ViewStyle = vsList; } else if (ComboBoxView->ItemIndex == 3) { // ExtIndex = TGraphicFileFormat(ExtIcon); //03. 7.2 qe ¸·À½ ListView->Items->Item[i]->ImageIndex = ExtIcon-1; ListView->ViewStyle = vsReport; } #endif if(FilterComboBox->ItemIndex + 1 == gffALL) AllSearch->Checked = true; #endif #if defined(WEAVE) int ExtIcon; AnsiString ext = LowerCase(ExtractFileExt(fn)); if(ext == ".wea") ExtIcon = gffWEA; else if(ext == ".wav") ExtIcon = gffWAV; if (ComboBoxView->ItemIndex == 1) { // ExtIndex = TGraphicFileFormat(ExtIcon); ListView->Items->Item[i]->ImageIndex = ExtIcon-1; ListView->ViewStyle = vsSmallIcon; } else if (ComboBoxView->ItemIndex == 2) { // ExtIndex = TGraphicFileFormat(ExtIcon); ListView->Items->Item[i]->ImageIndex = ExtIcon-1; ListView->ViewStyle = vsList; } else if (ComboBoxView->ItemIndex == 3) { // ExtIndex = TGraphicFileFormat(ExtIcon); ListView->Items->Item[i]->ImageIndex = ExtIcon-1; ListView->ViewStyle = vsReport; } if(FilterComboBox->ItemIndex == 2)AllSearch->Checked = true; #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SearchExtIndex(AnsiString ext) { TGraphicFileFormat extIndex; //03. 7.2 qe ExtIndex ---> extIndex Áö¿ªº¯¼ö·Î º¯°æ. #if defined(TEXTILE) if(ext == ".tex") extIndex = gffTEX; // else if(ext == ".vst") extIndex = gffVST; else if(ext == ".bmp") extIndex = gffBMP; else if(ext == ".tif") extIndex = gffTIF; #ifdef ACADEMY #else else if(ext == ".tfc") extIndex = gffTFC; // else if(ext == ".t3d") extIndex = gffT3D; #ifdef NOTN3D #else // else if(ext == ".n3d") extIndex = gffN3D; #endif else if(ext == ".wea") extIndex = gffWEA; else if(ext == ".wav") extIndex = gffWAV; else if(ext == ".knt") extIndex = gffKNT; else if(ext == ".pct") extIndex = gffPCT; else if(ext == ".pcx") extIndex = gffPCX; else if(ext == ".png") extIndex = gffPNG; else if(ext == ".psd") extIndex = gffPSD; else if(ext == ".ras") extIndex = gffRAS; else if(ext == ".tga") extIndex = gffTGA; else if(ext == ".jpg") extIndex = gffJPG; else if(ext == ".eps") extIndex = gffEPS; else extIndex = gffALL; // else if(ext == ".gif") extIndex = gffGIF; // by mecbong #endif #endif #if defined(WEAVE) if(ext == ".wea") extIndex = gffWEA; else if(ext == ".wav") extIndex = gffWAV; #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ChangeComboBoxAllView() { if(FilterComboBox->ItemIndex + 1 == gffALL) { for(int i = 0 ; i < ListView->Items->Count ; i++) { SearchIcon(ListView->Items->Item[i]->Caption, i); } }else IconSet(FilterComboBox->ItemIndex); #if defined(WEAVE) if(FilterComboBox->ItemIndex == 2){ for(int i = 0 ; i < ListView->Items->Count ; i++) { SearchIcon(ListView->Items->Item[i]->Caption, i); } }else IconSet(FilterComboBox->ItemIndex); #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::AllSearchClick(TObject *Sender) { if(FilterComboBox->ItemIndex + 1 == gffALL) AllSearch->Checked = true; #if defined(WEAVE) if(FilterComboBox->ItemIndex == 2)AllSearch->Checked = true; #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::temp_ButtonClick(TObject *Sender) { view_thumb = false; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SetViewFlag(bool value) { view_thumb = value; }