//--------------------------------------------------------------------------- #include #include #include #include #include #include #include // 2001.4.11 By GreenFish #include // 2001.4.11 By GreenFish #include "LogData.h" #include "Common.h" #pragma hdrstop #include "Main.h" #include "FileManager_F.h" #include "Exception.h" #include "MainMenu.h" #include "Define.h" #include "TPrint_F.h" #include "FullView.h" #include "TPLayerImage.h" #include "NewCanvas.h" #if defined(TEXSTYLIST) #include "Jacquard.h" //2001.7.26 lhskys Jacquard ¿¡¼­ ¹«Á¶°ÇÀúÀå ¹æÁö #include "Palette.h" #endif //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "RzShellCtrls" #pragma link "RzTreeVw" #pragma link "RzButton" #pragma link "RzPanel" #pragma link "RzCmboBx" #pragma link "RzEdit" #pragma link "RzRadChk" #pragma link "ZipBuilder" #pragma link "ZipIntSFX" #pragma link "RzLabel" #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] #define IDS_ISALLVIEW StringTable[34] #define IDS_VIEW StringTable[35] #define IDS_PATH StringTable[36] //gabriel: default file ext index #define DefaultExtensionIndex 9 TFileManagerForm *FileManagerForm; DWORD limit_size = 25000000; //DWORD limit_size = 2500000000000; //--------------------------------------------------------------------------- int __fastcall CompareProc(void * Item1, void * Item2); //--------------------------------------------------------------------------- __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(DirectoryBin, Language, "FileManager"); SetSmallFont(Font); SetSmallFont(ListView->Font); SetSmallFont(DirectoryListBox->Font); Caption = IDS_FCAPTION; rztbRead->Caption = IDS_COMMON_READ; rztbMerge->Caption = IDS_COMMON_MERGE; rztbSave->Caption = IDS_COMMON_SAVE; rztbSaveAs->Caption = IDS_COMMON_SAVEAS; rztbDelete->Caption = IDS_COMMON_DELETE; rztbRename->Caption = IDS_COMMON_RENAME; rztbNewFolder->Caption = IDS_MFOLDER; rztbView->Caption = IDS_VIEW; rztbExit->Caption = IDS_COMMON_EXIT; //lbDrive->Caption = IDS_COMMON_DRIVE; lbFileType->Caption = IDS_FILETYPE; lbDirectory->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; miLargeView->Caption = IDS_LARGE; miSmallView->Caption = IDS_SMALL; miListView->Caption = IDS_LIST; miReportView->Caption = IDS_REPORT; miAllView->Caption = IDS_ISALLVIEW; miPreview->Caption = IDS_PREVIEW; lbPath->Caption = IDS_PATH; SearchSpeedBtn->Hint = IDS_SEARCH; //=================================================================== IniFile = new TIniFile(AppDataItem + "\\Main.ini"); if (IniFile) { #ifdef TEXSTYLIST //============================================ 2001.4.11. by lhskys congi¿¡¼­ Open ³Ö±â if(MainForm->FILEOPEN){ IniDirName = String(DirectoryTexStyleOpen); if(IniDirName == String(""))IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); MainForm->FILEOPEN = false; } else { IniDirName = String(IniFile->ReadString("FileManager", "DirectoryName", "C:\\")); } // IniDirName = IniFile->ReadString("FileManager", "DirectoryName", "C:\\"); //=========================================== #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; /* InitExtension(); ExtIndex = TGraphicFileFormat(FilterComboBox->ItemIndex+1); */ StatusBar->Panels->Items[0]->Width = 90;//Splitter1->Left + 12; // StatusBar->Panels->Items[3]->Width = 110; StatusBar->Panels->Items[1]->Width = 430; StatusBar->Panels->Items[2]->Width = (StatusBar->Width - StatusBar->Panels->Items[0]->Width - StatusBar->Panels->Items[1]->Width)*3/7; StatusBar->Panels->Items[3]->Width = (StatusBar->Width - StatusBar->Panels->Items[0]->Width - StatusBar->Panels->Items[1]->Width)*4/7; // 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(ITEM_READ); //ComboBoxView->ItemIndex = type; ViewItemIndex = type; //ComboBoxViewChange(this); switch (type) { case 0: ListView->ViewStyle = vsIcon; miLargeView->Checked = true; StartLargeImage = true; miAllView->Visible = true; miPreview->Visible = false; break; case 1: ListView->ViewStyle = vsSmallIcon; miSmallView->Checked = true; StartLargeImage = false; miAllView->Visible = false; miPreview->Visible = true; break; case 2: ListView->ViewStyle = vsList; miListView->Checked = true; StartLargeImage = false; miAllView->Visible = false; miPreview->Visible = true; break; case 3: ListView->ViewStyle = vsReport; miReportView->Checked = true; StartLargeImage = false; miAllView->Visible = false; miPreview->Visible = true; break; } reading = false; Ascend[0] = false; Ascend[1] = false; Ascend[2] = false; Ascend[3] = false; #ifdef TEXSTYLIST ListView->PopupMenu = PopupMenuTexFile; #else ListView->PopupMenu = PopupMenuFile; #endif if (SetCurrentDir(IniDirName) == false) { DirectoryListBox->SelectedPathName = String("C:\\"); FDirectory = String("C:\\"); } else { DirectoryListBox->SelectedPathName = IniDirName; FDirectory = String(DirectoryListBox->SelectedPathName); } //FDrive = DriveComboBox->Drive; FFilter = FilterComboBox->Filter; // FFilterIndex = FilterComboBox->ItemIndex; //========================= #ifdef TEXSTYLIST //============================= 2001.4.11. by lhskys congi¿¡¼­ Down °áÁ¤ if(MainForm->Readdown){ rztbRead->Down = true; rztbReadClick(this); //SpeedButtonRead->Down = true; //SpeedButtonReadClick(this); } else if(!MainForm->Readdown){ if(Select == "MERGE" && MainForm->MDIChildCount > 0){ rztbMerge->Down = true; rztbMergeClick(this); //SpeedButtonMerge->Down = true; //SpeedButtonMergeClick(this); } else if(Select == "READ"){ rztbRead->Down = true; rztbReadClick(this); //SpeedButtonRead->Down = true; //SpeedButtonReadClick(this); } else if(MainForm->MDIChildCount == 0){ rztbRead->Down = true; rztbReadClick(this); //SpeedButtonRead->Down = true; //SpeedButtonReadClick(this); } } //============================= #endif view_thumb = true; // limit_size = 25000000; PreviewBox->Visible = false; BPP = NULL; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormActivate(TObject *Sender) { if (SetCurrentDir(IniDirName) == false) { DirectoryListBox->SelectedPathName = "C:\\"; } else { if (reading == false) { DirectoryListBox->SelectedPathName = 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; FDirectory = String(DirectoryListBox->SelectedPathName); FFilter = FilterComboBox->Filter; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormCreate(TObject *Sender) { BEGIN_LOG("FileManager_F"); if (!FileList) FileList = new TList; TPException ec = EC_NONE; if ((ProgressBar = new TStatusProgress(StatusBar, 2))==NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); EXCEPTION_MESSAGE_OK(ec); } ProgressBar->Maximum = 100; DirectoryListBox->Enabled = true; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::InitExtension() { switch (InitExt) { #if defined(TEXSTYLIST) #ifdef TRIAL case gffTEX_TRIAL: FMask = "*.ttex"; break; case gffVST_TRIAL: FMask = "*.tvst"; break; case gffWEA_TRIAL: FMask = "*.twea"; break; case gffKNT_TRIAL: FMask = "*.tknt"; break; case gffTFC_TRIAL: FMask = "*.ttfc"; break; #endif case gffTEX: FMask = "*.tex"; break; case gffBMP: FMask = "*.bmp"; break; case gffTIF: FMask = "*.tif"; break; case gffVST: FMask = "*.vst"; break; case gffTFC: FMask = "*.tfc"; break; case gffWEA: FMask = "*.wea"; break; case gffWAV: FMask = "*.wav"; break; case gffKNT: FMask = "*.knt"; break; case gffPCT: FMask = "*.pct"; break; case gffPCX: FMask = "*.pcx"; break; case gffPNG: FMask = "*.png"; break; case gffPSD: FMask = "*.psd"; break; case gffRAS: FMask = "*.ras"; break; case gffTGA: FMask = "*.tga"; break; case gffJPG: FMask = "*.jpg"; break; case gffEPS: FMask = "*.eps"; break; case gffDXF: FMask = "*.dxf"; break; case gffSVG: FMask = "*.svg"; break; // for SVG by maxleo21c (2006/06/17) case gffALL: FMask = "*.*"; break; #ifndef TRIAL case gffTEX10: FMask = "*.tex"; break; case gffTFC10: FMask = "*.tfc"; break; case gffVST10: FMask = "*.vst"; break; #endif // case gffOldTEX : FMask = "*.tex"; break; // case gffOldTFC: FMask = "*.tfc"; break; #endif } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormDestroy(TObject *Sender) { BEGIN_LOG("FileManager_F"); TIniFile *IniFile=NULL; SmallImageList->Clear(); ExitData(); /*delete temp_Button; delete temp_Panel;*/ DeleteVersionList(); IniFile = new TIniFile(AppDataItem + "\\Main.ini"); if (IniFile) { IniFile->WriteString("FileManager", "DirectoryName", DirectoryListBox->SelectedPathName); //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", ViewItemIndex); delete IniFile; } if (MoveCopyList) {delete MoveCopyList; MoveCopyList = NULL;} #ifdef TEXSTYLIST MainMenuForm->ExitFileManager(); #endif if (FileList) { ClearFileList(); delete FileList; FileList = NULL; } if (ProgressBar){ delete ProgressBar; ProgressBar = NULL; } END_LOG; } //--------------------------------------------------------------------------- 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; int LastSpace = 10; int Space = 5; // Panel2 w = (Panel2->Width - (lbDrive->Width + lbFileType->Width + Space*2 + LastSpace)) / 2; DriveComboBox->Width = w; FilterComboBox->Width = w; lbFileType->Left = DriveComboBox->Left + w + 2; FilterComboBox->Left = lbFileType->Left + lbFileType->Width; // Panel3 LabelDirectory->Width = Panel3->Width-(LabelDirectory->Left+ComboBoxView->Width+isPreview->Width + LastSpace + Space*2); isPreview->Left = LabelDirectory->Left + LabelDirectory->Width; isAllView->Left = LabelDirectory->Left + LabelDirectory->Width; ComboBoxView->Left = isPreview->Left + isPreview->Width + Space; // Panel4 Edit4->Width = Panel4->Width - (Edit4->Left+SpeedButton4->Width+ProgressBar->Width+ AllSearch->Width+CompressCheckBox->Width + LastSpace); ProgressBar->Left = Edit4->Left + Edit4->Width + Space; AllSearch->Left = ProgressBar->Left + ProgressBar->Width + Space; SpeedButton4->Left = AllSearch->Left + AllSearch->Width + Space; CompressCheckBox->Left = SpeedButton4->Left + SpeedButton4->Width + Space; */ if (ProgressBar) ProgressBar->Resize(); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormShow(TObject *Sender) { BEGIN_LOG("FileManager_F"); Graphics::TBitmap *Bitmap=NULL; Bitmap = new Graphics::TBitmap; #if defined(TEXSTYLIST) switch (FExtension) { case 0: IconImageList->GetBitmap(18, Bitmap); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FMask = "*.cmb"; break; case 1: IconImageList->GetBitmap(19, Bitmap); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FMask = "*.jqd"; break; case 2: IconImageList->GetBitmap(20, Bitmap); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FMask = "*.stp"; break; case 3: IconImageList->GetBitmap(2, Bitmap); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FMask = "*.t3d"; break; case 5: IconImageList->GetBitmap(15, Bitmap); //n3d SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 22; FMask = "*.n3d"; break; case 6: // added by maxleo21c (05.02.18) IconImageList->GetBitmap(25, Bitmap); //mcw SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FMask = "*.mcw"; break; case 7: //gabriel IconImageList->GetBitmap(22, Bitmap); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FMask = "*.mtl"; break; case 8: //gabriel IconImageList->GetBitmap(23, Bitmap); SmallImageList->Add(Bitmap,NULL); FilterComboBox->ItemIndex = 0; FMask = "*.wal"; break; default: #ifdef TRIAL IconImageList->GetBitmap(0, Bitmap); //tex SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(1, Bitmap); //tfc SmallImageList->Add(Bitmap,NULL); // IconImageList->GetBitmap(2, Bitmap); //t3d // SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(3, Bitmap); //wav SmallImageList->Add(Bitmap,NULL); SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(4, Bitmap); //knt SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(26, Bitmap); //vst SmallImageList->Add(Bitmap,NULL); #endif IconImageList->GetBitmap(0, Bitmap); //tex SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(1, Bitmap); //tfc SmallImageList->Add(Bitmap,NULL); // IconImageList->GetBitmap(2, Bitmap); //t3d // SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(3, Bitmap); //wea SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(21, Bitmap); //wav SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(4, Bitmap); //knt SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(26, Bitmap); //vst SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(5, Bitmap); //bmp SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(24, Bitmap); //jpg SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(6, Bitmap); //pct SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(7, Bitmap); //pcx SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(8, Bitmap); //png SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(9, Bitmap); //psd SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(10, Bitmap); //ras SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(11, Bitmap); //tga SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(12, Bitmap); //tif SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(27, Bitmap); //eps SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(13, Bitmap); //dxf SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(14, Bitmap); //svg SmallImageList->Add(Bitmap,NULL); // for SVG by maxleo21c(06.06.17) // IconImageList->GetBitmap(28, Bitmap); //pil // SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(0, Bitmap); //tex 10.0 SmallImageList->Add(Bitmap,NULL); IconImageList->GetBitmap(1, Bitmap); //tfc 10.0 SmallImageList->Add(Bitmap,NULL); // #ifndef NOTN3D // IconImageList->GetBitmap(15, Bitmap); //n3d // SmallImageList->Add(Bitmap,NULL); // #endif FilterComboBox->ItemIndex = InitExt - 1; InitExtension(); } SearchExtIndex(ExtractFileExt(FMask)); #endif delete Bitmap; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FilterComboBoxChange(TObject *Sender) { BEGIN_LOG("FileManager_F"); FMask = FilterComboBox->Mask; ChangeFunction(); Input->Text = ""; #if defined(TEXSTYLIST) if (ExtIndex == gffALL) { //AllSearch->Checked = true; if(StartLargeImage){ //ComboBoxView->ItemIndex == 0){ ShowMessage(IDS_MESSAGE_NOTSEEALLFILE); FilterComboBox->ItemIndex = FilterComboBoxItemIndex; END_LOG; return; } } FilterComboBoxItemIndex = FilterComboBox->ItemIndex; #endif ImagePreview(-1); if(!isCreating) { InitData(true); view_thumb = true; } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ChangeFunction() { BEGIN_LOG("FileManager_F"); if (FOnRead) rztbRead->Enabled = true; //SpeedButtonRead->Enabled = true; else rztbRead->Enabled = false; //SpeedButtonRead->Enabled = false; if (FOnMerge) rztbMerge->Enabled = true; //SpeedButtonMerge->Enabled = true; else rztbMerge->Enabled = false; //SpeedButtonMerge->Enabled = false; if (FOnFileName) { if (FOnSave) rztbSave->Enabled = true; //SpeedButtonSave->Enabled = true; else rztbSave->Enabled = false; //SpeedButtonSave->Enabled = false; } else { rztbSave->Enabled = false; //SpeedButtonSave->Enabled = false; } //ExtIndex = TGraphicFileFormat(FilterComboBox->ItemIndex+1); SearchExtIndex(ExtractFileExt(FMask)); #if defined(TEXSTYLIST) if(!MainForm->T3D_Item){ #ifdef TRIAL if(ExtIndex == gffT3D_TRIAL){ // ShowMessage("Not Use 3D File !!"); FilterComboBox->ItemIndex = 0; Close(); } #endif if(ExtIndex == gffT3D){ // ShowMessage("Not Use 3D File !!"); FilterComboBox->ItemIndex = 0; Close(); } } #endif #ifdef TEXSTYLIST if (ExtIndex == gffT3D || ExtIndex == gffWEA || ExtIndex == gffWAV || ExtIndex == gffKNT || /*ExtIndex == gffPIL ||*/ ExtIndex == gffDXF) { if(FExtension == 3 && ExtIndex == gffT3D) { rztbMerge->Enabled = false; //SpeedButtonMerge->Enabled = false; //TMenu3DForm::sbMainClick ¸¦ ¼öÁ¤Çϸ鼭 ¹Ù²Û °Í. rztbRead->Down = true; //SpeedButtonRead->Down=true; InitItem(ITEM_READ); rztbSave->Enabled = true; //SpeedButtonSave->Enabled = true; //Layer ¿¡¼­ 3d¸¦ ÀÐÀ» ¶§ ¹®Á¦°¡ À־ ¹Ù²Ù°Ô µÈ °Í. rztbSaveAs->Enabled = true; //SpeedButtonSaveAs->Enabled = true; } else if (FilterComboBox->Enabled ==true) { //k3dogs 20010103ÀÏÀÚ¿Í ºñ±³Çغ¼ °Í. rztbMerge->Enabled = false; //SpeedButtonMerge->Enabled = false; //TMenu3DForm::sbMainClick ¸¦ ¼öÁ¤Çϸ鼭 ¹Ù²Û °Í. rztbRead->Down = true; //SpeedButtonRead->Down=true; InitItem(ITEM_READ); rztbSave->Enabled = false; //SpeedButtonSave->Enabled = false; //Layer ¿¡¼­ 3d¸¦ ÀÐÀ» ¶§ ¹®Á¦°¡ À־ ¹Ù²Ù°Ô µÈ °Í. rztbSaveAs->Enabled = false; //SpeedButtonSaveAs->Enabled = false; } } else if (ExtIndex == gffSVG && FilterComboBox->Enabled) {// For SVG - by maxleo21c (2006/06/77) rztbMerge->Enabled = false; //SpeedButtonMerge->Enabled = false; rztbRead->Down = true; //SpeedButtonRead->Down = true; rztbRead->Enabled = true; //SpeedButtonRead->Enabled = true; rztbSave->Enabled = true; //SpeedButtonSave->Enabled = true; rztbSaveAs->Enabled = true; //SpeedButtonSaveAs->Enabled = true; } #ifdef TRIAL else if (ExtIndex == gffT3D_TRIAL || ExtIndex == gffWEA_TRIAL || ExtIndex == gffKNT_TRIAL) { if(FExtension == 3 && ExtIndex == gffT3D_TRIAL) { rztbMerge->Enabled = false; //SpeedButtonMerge->Enabled = false; //TMenu3DForm::sbMainClick ¸¦ ¼öÁ¤Çϸ鼭 ¹Ù²Û °Í. rztbRead->Down = true; //SpeedButtonRead->Down=true; InitItem(ITEM_READ); rztbSave->Enabled = true; //SpeedButtonSave->Enabled = true; //Layer ¿¡¼­ 3d¸¦ ÀÐÀ» ¶§ ¹®Á¦°¡ À־ ¹Ù²Ù°Ô µÈ °Í. rztbSaveAs->Enabled = true; //SpeedButtonSaveAs->Enabled = true; } else if (FilterComboBox->Enabled ==true) { //k3dogs 20010103ÀÏÀÚ¿Í ºñ±³Çغ¼ °Í. rztbMerge->Enabled = false; //SpeedButtonMerge->Enabled = false; //TMenu3DForm::sbMainClick ¸¦ ¼öÁ¤Çϸ鼭 ¹Ù²Û °Í. rztbRead->Enabled = true; //SpeedButtonRead->Down=true; InitItem(ITEM_READ); rztbSave->Enabled = false; //SpeedButtonSave->Enabled = false; //Layer ¿¡¼­ 3d¸¦ ÀÐÀ» ¶§ ¹®Á¦°¡ À־ ¹Ù²Ù°Ô µÈ °Í. rztbSaveAs->Enabled = false; //SpeedButtonSaveAs->Enabled = false; } } #endif else { if (FOnMerge) rztbMerge->Enabled = true; //SpeedButtonMerge->Enabled = true; if (FOnSave) { rztbSave->Enabled = true; //SpeedButtonSave->Enabled = true; rztbSaveAs->Enabled = true; //SpeedButtonSaveAs->Enabled = true; } else rztbSaveAs->Enabled = true; //SpeedButtonSaveAs->Enabled = false; } #endif //StartLargeImage = true; #if defined(TEXSTYLIST) if(JacquardForm){ //2001.7.26 lhskys Jacquard ¿¡¼­ if(!JacquardForm->j_use){ //¹«Á¶°Ç ÀúÀå ¹æÁö...... rztbSaveAs->Enabled = false; //SpeedButtonSaveAs->Enabled = false; rztbSave->Enabled = false; //SpeedButtonSave->Enabled = false; } } #endif #if defined(TEXSTYLIST) #ifdef NOTN3D #else if(ExtIndex==gffN3D){ // n3d¸¦ À§ÇØ Æ¯º°È÷ Ãß°¡ rztbMerge->Enabled = false; //SpeedButtonMerge->Enabled = false; rztbRead->Down = true; //SpeedButtonRead->Down=true; InitItem(ITEM_READ); 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 { rztbSave->Enabled = false; //SpeedButtonSave->Enabled = false; rztbSaveAs->Enabled = false; //SpeedButtonSaveAs->Enabled = false; } } else { rztbSave->Enabled = false; //SpeedButtonSave->Enabled = false; rztbSaveAs->Enabled = false; //SpeedButtonSaveAs->Enabled = false; } } #endif #endif END_LOG; } //--------------------------------------------------------------------------- /* void __fastcall TFileManagerForm::ComboBoxViewChange(TObject *Sender) { #if defined(TEXSTYLIST) if (ExtIndex == gffALL) { if(StartLargeImage){ //ComboBoxView->ItemIndex == 0){ ShowMessage(IDS_MESSAGE_NOTSEELARGEVIEW); ComboBoxView->ItemIndex = ViewItemIndex; return; } } #endif isAllView->Visible = false; isPreview->Visible = true; isPreview->Caption = IDS_PREVIEW; if (isPreview->Checked) PreviewBox->BringToFront(); else PreviewBox->SendToBack(); if (StartLargeImage){ //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; isAllView->Visible = true; isPreview->Visible = false; PreviewBox->SendToBack(); ImagePreview(-1); return; }else if (ComboBoxView->ItemIndex == 1) { ChangeViewType(); ListView->ViewStyle = vsSmallIcon; ViewItemIndex = 1; }else if (ComboBoxView->ItemIndex == 2) { ChangeViewType(); ListView->ViewStyle = vsList; ViewItemIndex = 2; }else { ChangeViewType(); ListView->ViewStyle = vsReport; ViewItemIndex = 3; } StartLargeImage = true; ImagePreview(-1); } */ //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Run() { BEGIN_LOG("FileManager_F"); bool saveWorkArea = false; int btn; String wfn, cmfn, cmfn2; TCursor cur; switch (Item) { case ITEM_READ: cur = Screen->Cursor; Screen->Cursor = crHourGlass; SearchCount = 0; SearchName = Input->Text; if(IncludeSearchData())goto next1; /* if(AllSearch->Checked){ SearchCount = 0; SearchName = Input->Text; if(IncludeSearchData())goto next1; } else if(SearchData()) goto next1; */ ShowMessage(IDS_MESSAGE_FILENOTFOUND); // InitData(true); next1: Screen->Cursor = cur; break; case ITEM_SAVE: ListViewDblClick(this); break; case ITEM_SAVEAS: { #ifdef TRIAL #ifdef TEXSTYLIST if(ExtIndex >= gffTEX) #endif { Application->MessageBox(IDS_COMMON_TRIAL_SAVE_NOT_SUPPORTED.c_str(), L"", MB_OK); return; } #endif if (FOnFileName) { cur = Screen->Cursor; Screen->Cursor = crHourGlass; wfn = FOnFileName(Input->Text, ExtIndex); for (int i=0; iCount; i++) { String *str = (String *)FileList->Items[i]; cmfn = LowerCase(*str); cmfn2 = WideLowerCase(wfn); if (cmfn == cmfn2) { int btn = EXCEPTION_MESSAGE2_OKCANCEL(EC_FILE_EXIST_ALREADY, (IDS_MESSAGE_REALLYFILESAVE).c_str()); if (btn == mrOk) { if (FOnSave){ //MakeBackupFile(fn); SaveOnTexpiaFile(wfn); } goto next; } else { goto next; } } } if (FOnSave) { SaveOnTexpiaFile(wfn); } next: Screen->Cursor = cur; } InitData(false); view_thumb = true; rztbRead->Down = true; InitItem(ITEM_READ); break; } case ITEM_MAKEFOLDER: //DirectoryListBox->Update(); rztbRead->Down = true; InitItem(ITEM_READ); break; case ITEM_RENAME: if (FOnFileName) { if (ListView->Selected && Input->Text != String("")) { if (RenameFile(FileName, FOnFileName(Input->Text, ExtIndex)) == false) EXCEPTION_MESSAGE_OK(EC_FILE_EXIST_ALREADY); } else { EXCEPTION_MESSAGE_OK(EC_CHOOSEFILE); } } //FileListBox->Update(); InitData(false); view_thumb = true; rztbRead->Down = true; InitItem(ITEM_READ); break; } if(Rename && rztbRename->Down && Input->Text.Length() > 0){ //2001.7.2 by lhskys Rename F2 ±â´É Ãß°¡ if (FOnFileName) { if (ListView->Selected) { if (RenameFile(FileName, FOnFileName(Input->Text, ExtIndex)) == false) EXCEPTION_MESSAGE_OK(EC_FILE_EXIST_ALREADY); } else { EXCEPTION_MESSAGE_OK(EC_CHOOSEFILE); } } //FileListBox->Update(); InitData(false); view_thumb = true; rztbRead->Down = true; InitItem(ITEM_READ); Rename = false; } END_LOG; } //--------------------------------------------------------------------------- /* void __fastcall TFileManagerForm::DirectoryListBox_Change(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::ListViewMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { BEGIN_LOG("FileManager_F"); if (ListView->Selected) { int n = ListView->Selected->Index; FileName = ListView->Items->Item[n]->Caption; Rename = true; //2001.7.2 by lhskys Rename F2 ±â´É Ãß°¡ //if(Item == ITEM_RENAME){ //Edit4->Visible && SpeedButtonMakeFolder->Down == false){ if (Item != ITEM_MAKEFOLDER){ RenameFileName = Input->Text; Input->Text = FileName; } //else if(Edit4->Visible)Edit4->Text =""; //if(Item == ITEM_RENAME || Item == ITEM_SAVEAS) Input->SetFocus(); } else FileName = String(""); END_LOG; } //--------------------------------------------------------------------------- double __fastcall ExtractSize(String str) { int pos = Sysutils::AnsiPos('K', str); return StrToFloat(str.SubString(1, pos - 1)); } //--------------------------------------------------------------------------- double __fastcall ExtractType(String str) { int pos = Sysutils::AnsiPos('K', str); return StrToFloat(str.SubString(1, pos - 1)); } //--------------------------------------------------------------------------- int __fastcall ExtractDate(String str) { int i, pos; const Char p[4] = { '-', '-', ' ', ':' }; String 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); } //--------------------------------------------------------------------------- int __stdcall ListViewSortProc(long Item1, long Item2, long ParamSort) { if (ParamSort == 0){ if (FileManagerForm->Ascend[ParamSort]){ return CompareText(((TListItem *)Item1)->Caption, ((TListItem *)Item2)->Caption); } else { return -CompareText(((TListItem *)Item1)->Caption, ((TListItem *)Item2)->Caption); } } else if (ParamSort == 1){ double size1, size2; size1 = ExtractSize(String(((TListItem *)Item1)->SubItems->Strings[0])); size2 = ExtractSize(String(((TListItem *)Item2)->SubItems->Strings[0])); if (FileManagerForm->Ascend[ParamSort]) { return size1 - size2; } else { return size2 - size1; } } else { if (FileManagerForm->Ascend[ParamSort]){ return CompareText(((TListItem *)Item1)->SubItems->Strings[ParamSort-1], ((TListItem *)Item2)->SubItems->Strings[ParamSort-1]); } else { return -CompareText(((TListItem *)Item1)->SubItems->Strings[ParamSort-1], ((TListItem *)Item2)->SubItems->Strings[ParamSort-1]); } } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewColumnClick(TObject *Sender, TListColumn *Column) { Ascend[Column->Index] = !Ascend[Column->Index]; ListView->CustomSort(NULL/*ListViewSortProc*/, Column->Index); ListView->Repaint(); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewCompare(TObject *Sender, TListItem *Item1, TListItem *Item2, int Data, int &Compare) { BEGIN_LOG("FileManager_F"); double size1, size2; switch (Data) { case 0: if (Ascend[0]) { //Compare = CompareStr(Item1->Caption, Item2->Caption); Compare = _tcscmp(Item1->Caption.c_str(), Item2->Caption.c_str()); } else { //Compare = CompareStr(Item2->Caption, Item1->Caption); Compare = _tcscmp(Item2->Caption.c_str(), Item1->Caption.c_str()); } 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; } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewEdited(TObject *Sender, TListItem *Item, String &S) { /* if (FOnFileName) { String newname = FOnFileName(S, ExtIndex); if (WideRenameFile(FileName, newname) == false) { EXCEPTION_MESSAGE_OK(EC_FILE_EXIST_ALREADY); return; } Item->Caption = newname; //FileListBox->Update(); } */ } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Splitter1Moved(TObject *Sender) { lbImagePreview->Left = (PreviewBox->Width - lbImagePreview->Width)/2; PreviewImage->Left = (PreviewBox->Width - PreviewImage->Width)/2; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Load256Colors1Click(TObject *Sender) { BEGIN_LOG("FileManager_F"); TCursor cur = Screen->Cursor; TFMReadParameter rp; TPException ec; if (!ListView->Selected) { END_LOG; 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 = FDirectory; //FileListBox->Directory; rp.FileName = FileName; rp.ExtIndex = ExtIndex; rp.bpp = 8; if ((ec = FOnRead(rp, true)) != EC_NONE) EXCEPTION_MESSAGE_OK(ec); } ItemM = (TListItem*)ListView->GetNextItem((TListItem*)ItemM, sdAll, selected ); // ´ÙÀ½ ÆÄÀÏ ¹Þ±â } Screen->Cursor = cur; ModalResult = mrOk; #if defined(TEXSTYLIST) MainImageForm->AutoRepUpdateMenu(true); PaletteForm->StyleUseColor = false; #endif END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::LoadFullColors1Click(TObject *Sender) { BEGIN_LOG("FileManager_F"); TCursor cur = Screen->Cursor; TFMReadParameter rp; TPException ec; if (!ListView->Selected) { END_LOG; 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 = FDirectory; //FileListBox->Directory; rp.FileName = FileName; rp.ExtIndex = ExtIndex; rp.bpp = 24; if ((ec = FOnRead(rp, true)) != EC_NONE) EXCEPTION_MESSAGE_OK(ec); String Directorycolorpath = DirectoryColor+"\\textile.fcr"; if(ExtIndex==gffJPG || ExtIndex==gffBMP || ExtIndex==gffPNG || ExtIndex==gffPSD || ExtIndex==gffRAS || ExtIndex==gffTGA) PaletteForm->DIB256Palette->LoadFromFile(Directorycolorpath.c_str()); } ItemM = (TListItem*)ListView->GetNextItem((TListItem*)ItemM, sdAll, selected ); // ´ÙÀ½ ÆÄÀÏ ¹Þ±â } Screen->Cursor = cur; ModalResult = mrOk; #if defined(TEXSTYLIST) MainImageForm->AutoRepUpdateMenu(true); #endif END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::PopupSaveClick(TObject *Sender) { BEGIN_LOG("FileManager_F"); #ifdef TRIAL #ifdef TEXSTYLIST if(ExtIndex >= gffTEX) #endif { Application->MessageBox(IDS_COMMON_TRIAL_SAVE_NOT_SUPPORTED.c_str(), L"", MB_OK); END_LOG; return; } #endif TCursor cur; int btn; bool saveWorkArea = false; if(Application->MessageBox(IDS_MESSAGE_PUTSAVE.c_str(), IDS_FSAVE.c_str(), MB_OKCANCEL) == IDOK){ cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (FOnSave) { //MakeBackupFile(FileName); SaveOnTexpiaFile(FileName); } 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; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::PopupDeleteClick(TObject *Sender) { //------------------- ´ÙÁß ¼±Åà »èÁ¦µµ ÈÞÁöÅëÀ¸·Î °¡µµ·Ï ó¸® by david 090406 if (!ListView->Selected) return; BEGIN_LOG("FileManager_F"); TListItem *ItemM = ListView->Selected; // ¿©·¯°³ÆÄÀÏ Áö¿ì±â By GreenFish TItemStates selected = TItemStates() << isSelected; int count = 0; while (ItemM) { count++; ItemM = (TListItem*)ListView->GetNextItem((TListItem*)ItemM, sdAll, selected ); } String *FileNames = new String[count]; String fullname; count = 0; ItemM = ListView->Selected; while (ItemM) { int n; if (ItemM) { n = ItemM->Index; FileName = ListView->Items->Item[n]->Caption; } fullname = FullPathName(FDirectory ,FileName); int Attrs = FileGetAttr(fullname); // ÀбâÀü¿ë ¼Ó¼ºÀÌ ÀÖÀ¸¸é ¾ø¿¡¹ö¸°´Ù~ (±ú²ýÀÌ Áö¿öÁü) if (Attrs & faReadOnly) FileSetAttr(fullname, Attrs & !faReadOnly); FileNames[count] = fullname; count++; ItemM = (TListItem*)ListView->GetNextItem((TListItem*)ItemM, sdAll, selected ); } Delete_File(FileNames, count); delete[] FileNames; //------------------- //FileListBox->Update(); InitData(false); view_thumb = true; END_LOG; } //-------------------------------------------------------------------------- void __fastcall TFileManagerForm::PopupMenuTexFilePopup(TObject *Sender) { BEGIN_LOG("FileManager_F"); 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; if (FMask == String("*.mcw")) { Load256Colors1->Visible = false; LoadFullColors1->Visible = false; // added by maxleo21c (05.05.16) N1->Visible = false; } else { Load256Colors1->Visible = true; LoadFullColors1->Visible = true; // added by maxleo21c (05.05.16) N1->Visible = true; } //======= 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 == String("")) { Load256Colors1->Enabled = false; LoadFullColors1->Enabled = false; Save1->Enabled = false; Delete1->Enabled = false; Rename1->Enabled = false; } else { if (FMask == "*.t3d") { Load256Colors1->Enabled = false; LoadFullColors1->Enabled = false; if (FExtension != 3) Save1->Enabled = false; else Save1->Enabled = true; } else if (FMask == "*.n3d") { Load256Colors1->Enabled = false; LoadFullColors1->Enabled = false; if (FExtension != 5) Save1->Enabled = false; else Save1->Enabled = true; } else if (FMask == "*.dxf") { Load256Colors1->Enabled = false; LoadFullColors1->Enabled = true; Save1->Enabled = false; Delete1->Enabled = true; Rename1->Enabled = true; } else if (FMask == "*.svg") {//for SVG by maxleo21c(06.06.17)// Load256Colors1->Enabled = false; LoadFullColors1->Enabled = true; Save1->Enabled = true; Delete1->Enabled = true; Rename1->Enabled = true; } else if (FMask == "*.wea" || FMask == "*.wav" || FMask == "*.knt"){ Load256Colors1->Enabled = true; LoadFullColors1->Enabled = true; Save1->Enabled = false; Delete1->Enabled = true; // } else if (FileListBox->Mask == "*.mcw") { // Load256Colors1->Visible = false; // LoadFullColors1->Visible = false; // added by maxleo21c (05.05.16) } #ifdef TRIAL else if(FMask == "*.tt3d") { Load256Colors1->Enabled = false; LoadFullColors1->Enabled = false; if (FExtension != 3) Save1->Enabled = false; else Save1->Enabled = true; } else if (FMask == "*.twea" || FMask == "*.tknt"){ Load256Colors1->Enabled = true; LoadFullColors1->Enabled = true; Save1->Enabled = false; Delete1->Enabled = true; } #endif else { Load256Colors1->Enabled = true; LoadFullColors1->Enabled = true; Save1->Enabled = true; Delete1->Enabled = true; } } END_LOG; } //--------------------------------------------------------------------------- /* void __fastcall TFileManagerForm::DirectoryDeleteClick(TObject *Sender) { int i; Char *str=NULL; String Astr1, Astr2; Astr1 = FDirectory; Delete_Folder(Astr1); /* 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; String 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 (String(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::DirectoryListBox_DblClick(TObject *Sender) { int i, same, length; Char *str=NULL; String Astr1, Astr2, dn, s; /* if (Item == ITEM_DELETE || Item == ITEM_RENAME) { 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 == ITEM_DELETE) Delete_Folder(dn); else if (Item == ITEM_RENAME) { length = dn.Length(); str = dn.c_str(); while(length) { if (String(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(ITEM_READ); } } //--------------------------------------------------------------------------- */ // Private Method //--------------------------------------------------------------------------- bool __fastcall TFileManagerForm::SaveOnTexpiaFile(String FileName) { BEGIN_LOG("FileManager_F"); TPException ec = EC_NONE; if (FileExists(FDirectory + String("\\") + FileName)){ MakeBackupFile(FDirectory, FileName); } #if defined(TEXSTYLIST) TGraphicFileFormat saveExtIndex = ExtIndex; #ifndef TRIAL if (saveExtIndex == gffTEX) { if (FilterComboBoxItemIndex == 18) saveExtIndex = gffTEX10; } else if (saveExtIndex == gffTFC) { if (FilterComboBoxItemIndex == 19) saveExtIndex = gffTFC10; } else if (saveExtIndex == gffVST) { if (FilterComboBoxItemIndex == 20) saveExtIndex = gffVST10; } else if (saveExtIndex == gffT3D) { if (FilterComboBoxItemIndex == 1) saveExtIndex = gffT3D10; } #endif if (FExtension > DefaultExtensionIndex) { //gabriel: <-- 8 if (saveExtIndex != gffTEX // && saveExtIndex != gffOldTEX #ifndef TRIAL && saveExtIndex != gffTEX10 #else && saveExtIndex != gffTEX_TRIAL #endif ) { if (CompressCheckBox->Checked) ec = FOnSave(FDirectory, FileName, saveExtIndex, cmZLib); else ec = FOnSave(FDirectory, FileName, saveExtIndex, cmNone); } else ec = EC_CANNOT_SAVE256; } else { if (CompressCheckBox->Checked) ec = FOnSave(FDirectory, FileName, saveExtIndex, cmZLib); else ec = FOnSave(FDirectory, FileName, saveExtIndex, cmNone); } #else if (CompressCheckBox->Checked) ec = FOnSave(FDirectory, FileName, ExtIndex, cmZLib); else ec = FOnSave(FDirectory, FileName, ExtIndex, cmNone); #endif if (ec == EC_NONE){ END_LOG; return true; } else { BackupFileRollback(FDirectory, FileName); // backup folder¿¡ backupÇØµÐ ÆÄÀÏÀ» µ¹·Á³õ´Â´Ù. EXCEPTION_MESSAGE_OK(ec); END_LOG; return false; } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::InitItem(FMItem i) { Item = i; switch (Item) { case ITEM_READ: break; case ITEM_MERGE: break; case ITEM_SAVE: Input->Text = ""; break; case ITEM_SAVEAS: break; case ITEM_DELETE: break; case ITEM_RENAME: //Input->Text = ""; break; case ITEM_MAKEFOLDER: Input->Text = ""; break; } if (miPreview->Checked && miPreview->Visible) { if (ListView->Selected) { int n = ListView->Selected->Index; if (ViewItemIndex != 0 && miPreview->Checked) ImagePreview(n); } else ImagePreview(-1); } /* Item = i; switch (Item) { case ITEM_READ: 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 ITEM_MERGE: Panel->Height = Panel1->Height + Panel2->Height + Panel3->Height; if(Edit4->Visible)Edit4->Text =""; break; case ITEM_SAVE: case ITEM_SAVEAS: Label4->Caption = IDS_FILENAME; if (Item == ITEM_SAVE) { SpeedButton4->Caption = IDS_COMMON_SAVE; if(Edit4->Visible)Edit4->Text =""; }else if (Item == ITEM_SAVEAS) 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 ITEM_DELETE: if(Edit4->Visible)Edit4->Text =""; break; case ITEM_MAKEFOLDER: 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 ITEM_RENAME: 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, String searchKey) { BEGIN_LOG("FileManager_F"); TFileInfor *fi = NULL; FILEINFO FileInfo; TTexpiaBitmap *TexBitmap = NULL; int i, imgindex; TListItem *pItem=NULL; TTexVersion *ver = NULL; //String fn, time; //String temp_fn; String temp_Dir; String time; String wfn, wtemp_fn, wPath; //-- 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; String ext; bool exist_file = false; TGraphicFileFormat gff; Graphics::TBitmap *higher_ver_file = NULL; ProgressBar->Position = 0; ProgressBar->Maximum = 100; #if defined(TEXSTYLIST) if(!MainForm->T3D_Item){ #ifdef TRIAL if(ExtIndex == gffT3D_TRIAL){ FilterComboBox->ItemIndex = 0; Close(); } #endif if(ExtIndex == gffT3D){ FilterComboBox->ItemIndex = 0; Close(); } } #endif if (isCheck && FDirectory==DirectoryListBox->SelectedPathName && FFilter==FilterComboBox->Filter && FFilterIndex==FilterComboBox->ItemIndex) { END_LOG; return; } ExitData(); FDirectory = String(DirectoryListBox->SelectedPathName); FFilter = FilterComboBox->Filter; FFilterIndex = FilterComboBox->ItemIndex; if (!FileList) FileList = new TList; GetFileList(FDirectory, FilterComboBox->Mask, searchKey); int count = FileList->Count; if(StartLargeImage){ if(count > 0) { String Title_Caption = Caption; Caption = IDS_WAITING; InitLargeData(false); Caption = Title_Caption; END_LOG; return; } if ((fi = new TFileInfor)==NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if ((fi->Bitmap = new Graphics::TBitmap)==NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } DeleteVersionList(); VersionList = new TList; if(BPP) delete[] BPP; BPP = new int[count]; // FileManager¿¡¼­ ¸¶¿ì½º ¿À¹ö½Ã Full/256 ¸ðµå ¾Ë·ÁÁÖ±â À§ÇØ ÀúÀåÇÏ´Â BPP ¹è¿­ for (i = 0 ; i < count; i++) { *(BPP+i) = 0; } // ¿ì¼± ÃʱâÈ­¸¦ ÀüºÎ 0À¸·Î ½ÃÄÑÁØ´Ù. for (i = 0, imgindex = 0; i < count; i++) { //String *wTemp = (String *)FileList->Items[i]; //wfn = DirectoryListBox->SelectedPathName + String("\\")+ *wTemp; String *wTemp = (String *)FileList->Items[i]; wfn =*wTemp; wPath = FullPathName(FDirectory, wfn); exist_file = false; if (StartLargeImage){ //if(ComboBoxView->ItemIndex == 0) { #if defined(TEXSTYLIST) #ifdef NOTN3D if (ExtIndex == gffDXF) { 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 ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } else if (ExtIndex == gffSVG) { // svg´Â tag¸¦ ¸ø ¸¸µç´Ù. DXF¿Í ƒˆ°Ô ó¸® fi->Bitmap->PixelFormat = pf24bit; // for SVG - by maxleo21c (2006/06/17) 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 ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } else if (ExtIndex == gffTEX || ExtIndex == gffTFC || ExtIndex == gffT3D || ExtIndex == gffWEA || ExtIndex == gffWAV || ExtIndex == gffKNT //|| ExtIndex == gffPIL //|| ExtIndex == gffOldTEX || ExtIndex == gffOldTFC || ExtIndex == gffVST || ExtIndex == gffCMB || ExtIndex == gffJQD || ExtIndex == gffSTP || ExtIndex == gffMCW || ExtIndex == gffMTL || ExtIndex == gffWAL #ifdef TRIAL || ExtIndex == gffTEX_TRIAL || ExtIndex == gffTFC_TRIAL || ExtIndex == gffT3D_TRIAL || ExtIndex == gffWEA_TRIAL || ExtIndex == gffKNT_TRIAL || ExtIndex == gffVST_TRIAL #endif ) { #else if (ExtIndex == gffDXF) { 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 ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } else if (ExtIndex == gffSVG) { // svg´Â tag¸¦ ¸ø ¸¸µç´Ù. DXF¿Í ƒˆ°Ô ó¸® fi->Bitmap->PixelFormat = pf24bit; // for SVG - by maxleo21c (2006/06/17) 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 ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } else if (ExtIndex == gffTEX || ExtIndex == gffTFC || ExtIndex == gffT3D || ExtIndex == gffWEA || ExtIndex == gffWAV || ExtIndex == gffKNT /*|| ExtIndex == gffPIL || ExtIndex == gffOldTEX || ExtIndex == gffOldTFC*/ || ExtIndex == gffN3D || ExtIndex == gffVST ) { #endif if ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; gff = ExtIndex; #ifdef TRIAL if(ExtIndex == gffTEX_TRIAL || ExtIndex == gffTFC_TRIAL || ExtIndex == gffT3D_TRIAL || ExtIndex == gffWEA_TRIAL || ExtIndex == gffKNT_TRIAL || ExtIndex == gffVST_TRIAL) { ec = LoadFromTexpiaTag(hFile, fi, gff, ver, true); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; }else { ec = LoadFromTexpiaTag(hFile, fi, gff, ver); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; } #else ec = LoadFromTexpiaTag(hFile, fi, gff, ver); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; #endif if(ExtIndex == gffSTP) { // BPP ¹è¿­¿¡ °¢ À̹ÌÁöµéÀÇ ¸ðµå Á¤º¸ ³Ö±â. hFileÀ» CloseÇÏ°í ´Ù½Ã °¡Á®¿ÀÁö ¾ÊÀ¸¸é Á¦´ë·Î °ªµéÀ» ¸ø °®°í¿È if (SetFilePointer(hFile, 0, NULL, FILE_BEGIN) == 0xFFFFFFFF) goto next; TEXPIAFILEHEADER tpfh; TPalette *palette = NULL; DWORD dwRead; WORD BitCount; WORD usecolor; if ((palette = new TPalette)==NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!ReadFile(hFile, &tpfh, sizeof(TEXPIAFILEHEADER), &dwRead, NULL)) { ec = EC_FILE_NOT_READ; SAVE_EXCEPTION(ec); goto fail; } if (ver) *ver = tpfh.Version; if (!ReadFile(hFile, &usecolor, sizeof(WORD), &dwRead, NULL)) { ec = EC_FILE_NOT_READ; SAVE_EXCEPTION(ec); goto fail; } if (ver->Number < 302) palette->LoadFromFileHandle(hFile, 1); else palette->LoadFromFileHandle(hFile, 2); palette->UseColor = usecolor; if (!ReadFile(hFile, &BitCount, sizeof(WORD), &dwRead, NULL)) { ec = EC_FILE_NOT_READ; SAVE_EXCEPTION(ec); goto fail; } BPP[i]=BitCount; // BPP ¹è¿­¿¡ °¢ À̹ÌÁö Á¤º¸ ³Ö±â End } VersionList->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;*/ if (ec = L_FileInfo(wPath.c_str(), &FileInfo, sizeof(FILEINFO), 0, NULL) < 0) goto fail; memsize = FileInfo.SizeMem; //ÀÌ ºÎºÐ ºÎÅÍ Å« size À϶§ ±×¸² Ç¥½Ã ¾ÈÇÔ..... ÄÚµù..... 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); wtemp_fn = String(temp_Dir) + String("\\") + wfn + String(FileAge(wPath)); String wadd = String(FileInfo.SizeDisk) + String(".jpg"); wtemp_fn += wadd; if(FileExists(wtemp_fn)) { exist_file = true; if(!TexBitmap->LoadFromFile(wtemp_fn)) goto next; } else if (!TexBitmap->LoadFromFile(wPath)) 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"; wtemp_fn = String(temp_Dir) + String("\\") + wfn + String(FileAge(wPath)); String wadd = String(FileInfo.SizeDisk) + String(".jpg"); wtemp_fn += wadd; 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(wtemp_fn, FILE_JFIF, 50); SetFileAttributes(wtemp_fn.c_str(), FILE_ATTRIBUTE_HIDDEN); temp_TexBitmap->DeleteDC(dcSrc); dcSrc = NULL; delete temp_TexBitmap; } delete TexBitmap; TexBitmap = NULL; } if ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } #else if ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; gff = ExtIndex; ec = LoadFromTexpiaTag(hFile, fi, gff, ver); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; VersionList->Add(ver); #endif LargeImageList->Add(fi->Bitmap, NULL); } pItem = ListView->Items->Add(); if (hFile == INVALID_HANDLE_VALUE) { if ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } size = GetFileSize(hFile, NULL); pItem->Caption = wfn; 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(wfn)); 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; if (ProgressBar) ProgressBar->Position = (100.0 / count) * (i+1); #if defined(TEXSTYLIST) if(ExtIndex == gffALL) SearchIcon(wfn, 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 (ver) { delete ver; ver = NULL; } } FilterComboBoxItemIndex = FilterComboBox->ItemIndex; GetDiskInfor(); if(fi) delete fi; if (ProgressBar) ProgressBar->End(); END_LOG; return; fail: if (fi) delete fi; EXCEPTION_MESSAGE_OK(ec); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::InitLargeData(bool isCheck) { BEGIN_LOG("FileManager_F"); TFileInfor *fi = NULL; FILEINFO FileInfo; TTexpiaBitmap *TexBitmap = NULL; TTexVersion *ver = NULL; int i, imgindex; TListItem *pItem=NULL; //String fn, time; //String temp_fn; String temp_Dir, time; String wfn, wPath; String wtemp_fn, wtemp_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; String ext; bool exist_file = false; bool view_thumb_value; Graphics::TBitmap *big_size_icon = NULL; TGraphicFileFormat gff; Graphics::TBitmap *higher_ver_file = NULL; ProgressBar->Position = 0; ProgressBar->Maximum = 100; FDirectory = String(DirectoryListBox->SelectedPathName); FFilter = FilterComboBox->Filter; FFilterIndex = FilterComboBox->ItemIndex; //GetFileList(FDirectory, FilterComboBox->Mask); int count = FileList->Count; if ((fi = new TFileInfor)==NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if ((fi->Bitmap = new Graphics::TBitmap)==NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } DeleteVersionList(); VersionList = new TList; if(BPP) delete[] BPP; BPP = new int[count]; // FileManager¿¡¼­ ¸¶¿ì½º ¿À¹ö½Ã Full/256 ¸ðµå ¾Ë·ÁÁÖ±â À§ÇØ ÀúÀåÇÏ´Â BPP ¹è¿­ for (i = 0 ; i < count; i++) { *(BPP+i) = 0; } // ¿ì¼± ÃʱâÈ­¸¦ ÀüºÎ 0À¸·Î ½ÃÄÑÁØ´Ù. ListView->Items->BeginUpdate(); for (i = 0, imgindex = 0; i < count; i++) { //Application->ProcessMessages(); view_thumb_value = view_thumb; exist_file = false; //fn = FileList->Items->Strings[i]; String *wTemp = (String *)FileList->Items[i]; wfn =*wTemp; wPath = FullPathName(FDirectory, wfn); if(StartLargeImage){ //ComboBoxView->ItemIndex == 0) { #if defined(TEXSTYLIST) //dxf, svg, mtl, wal µîÀº notn3d, n3d¿Í »ó°üÀÌ ¾ø±â ¶§¹®¿¡ Áߺ¹Çؼ­ ó¸®ÇÒ Çʿ䰡 ¾ø´Ù. //µû¶ó¼­ define ¹ÛÀ¸·Î ¼Ò½º¸¦ À̵¿Çß´Ù. if (ExtIndex == gffDXF) { 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 ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } else if (ExtIndex == gffSVG) { // for SVG by maxleo21c(06.06.17) 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 ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } else if (ExtIndex == gffMTL || ExtIndex == gffWAL) { TEXPIAFILEHEADER tpfh; DWORD dwRead; if ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; //if ((hFile = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, // FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; if (!ReadFile(hFile, &tpfh, sizeof(TEXPIAFILEHEADER), &dwRead, NULL)) { ec = EC_FILE_NOT_READ; goto fail; } if (tpfh.BitsPerPixel == 24 && tpfh.Version.Texpia == 'P' && tpfh.Version.Method == 'T' && tpfh.Version.Number == 300) { if (SetFilePointer(hFile, 0, NULL, FILE_BEGIN)==0xFFFFFFFF) { ec = EC_FILE_NOT_READ; goto fail; } ver = new TTexVersion; gff = ExtIndex; ec = LoadFromTexpiaTag(hFile, fi, gff, ver); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; VersionList->Add(ver); } else { // 090527 upper version if (tpfh.Version.Texpia == 'P' && tpfh.Version.Method == 'T' && tpfh.Version.Number > TextileFileVersion) { ec = EC_FILE_NOT_OPEN_NEWERVERSION; goto fail; } if (ExtIndex == gffMTL) { //String dr = DirectoryListBox->SelectedPathName, s_temp; String dr = FDirectory; String s_temp; dr += String("\\"); TZipStream *ZipStream; if (hFile) CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; s_temp = wfn.SubString(1, wfn.Length() - 3); s_temp += "zip"; RenameFile(dr + wfn, dr + s_temp); //RenameFile(dr + fn, dr + s_temp); // ZipMaster ZipBuilder1->ZipFileName = (String(dr + s_temp)).c_str(); ZipBuilder1->Verbose = true; ZipStream = ZipBuilder1->ExtractFileToStream("tag.bmp"); if (ZipStream) { ZipStream->Position = 0; fi->Bitmap->LoadFromStream(ZipStream); } RenameFile(dr + s_temp, dr + wfn); //RenameFile(dr + s_temp, dr + fn); // ZipMaster } else { //ExtIndex == gffWAL int t_version; Byte *t_ptr; fi->Bitmap->Width = 80; fi->Bitmap->Height = 100; fi->Bitmap->PixelFormat = pf24bit; fi->Bitmap->Canvas->Brush->Color = clWhite; fi->Bitmap->Canvas->FillRect(Rect(0, 0, 80, 100)); if (SetFilePointer(hFile, 0, NULL, FILE_BEGIN)==0xFFFFFFFF) { ec = EC_FILE_NOT_READ; goto fail; } if (!ReadFile(hFile, &t_version, sizeof(int), &dwRead, NULL)) { ec = EC_FILE_NOT_READ; goto fail; } //tag bitmap width = 80 / height = 100 for (int y = 0; y < 100; y++) { t_ptr = (Byte *)fi->Bitmap->ScanLine[y]; if (!ReadFile(hFile, t_ptr, sizeof(Byte) * 320, &dwRead, NULL)) { ec = EC_FILE_NOT_READ; goto fail; } } } } } #ifdef NOTN3D else if (ExtIndex == gffTEX || ExtIndex == gffTFC || ExtIndex == gffT3D || ExtIndex == gffWEA || ExtIndex == gffWAV || ExtIndex == gffKNT //|| ExtIndex == gffPIL || ExtIndex == gffTEX10 || ExtIndex == gffTFC10 //|| ExtIndex == gffOldTEX || ExtIndex == gffOldTFC || ExtIndex == gffVST || ExtIndex == gffDXF || ExtIndex == gffCMB || ExtIndex == gffJQD || ExtIndex == gffSTP || ExtIndex == gffMCW #ifdef TRIAL || ExtIndex == gffTEX_TRIAL || ExtIndex == gffTFC_TRIAL || ExtIndex == gffT3D_TRIAL || ExtIndex == gffWEA_TRIAL || ExtIndex == gffKNT_TRIAL || ExtIndex == gffVST_TRIAL #endif ) { #else else if (ExtIndex == gffTEX || ExtIndex == gffTFC || ExtIndex == gffT3D || ExtIndex == gffWEA || ExtIndex == gffWAV || ExtIndex == gffKNT //|| ExtIndex == gffPIL #ifndef TRIAL || ExtIndex == gffTEX10 || ExtIndex == gffTFC10 #endif //|| ExtIndex == gffOldTEX || ExtIndex == gffOldTFC || ExtIndex == gffVST || ExtIndex == gffDXF || ExtIndex == gffN3D || ExtIndex == gffCMB || ExtIndex == gffJQD || ExtIndex == gffSTP || ExtIndex == gffMCW ) { #endif if(view_thumb_value) { if ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; gff = ExtIndex; #ifdef TRIAL if(ExtIndex == gffTEX_TRIAL || ExtIndex == gffTFC_TRIAL || ExtIndex == gffT3D_TRIAL || ExtIndex == gffWEA_TRIAL || ExtIndex == gffKNT_TRIAL || ExtIndex == gffVST_TRIAL) { ec = LoadFromTexpiaTag(hFile, fi, gff, ver, true); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; }else { ec = LoadFromTexpiaTag(hFile, fi, gff, ver); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; } #else ec = LoadFromTexpiaTag(hFile, fi, gff, ver); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; #endif if(ExtIndex == gffSTP) { // BPP ¹è¿­¿¡ °¢ À̹ÌÁöµéÀÇ ¸ðµå Á¤º¸ ³Ö±â. hFileÀ» CloseÇÏ°í ´Ù½Ã °¡Á®¿ÀÁö ¾ÊÀ¸¸é Á¦´ë·Î °ªµéÀ» ¸ø °®°í¿È if (SetFilePointer(hFile, 0, NULL, FILE_BEGIN) == 0xFFFFFFFF) goto next; TEXPIAFILEHEADER tpfh; TPalette *palette = NULL; DWORD dwRead; WORD BitCount; WORD usecolor; if ((palette = new TPalette)==NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if (!ReadFile(hFile, &tpfh, sizeof(TEXPIAFILEHEADER), &dwRead, NULL)) { ec = EC_FILE_NOT_READ; SAVE_EXCEPTION(ec); goto fail; } if (ver) *ver = tpfh.Version; if (!ReadFile(hFile, &usecolor, sizeof(Word), &dwRead, NULL)) { ec = EC_FILE_NOT_READ; SAVE_EXCEPTION(ec); goto fail; } if (ver->Number < 302) palette->LoadFromFileHandle(hFile, 1); else palette->LoadFromFileHandle(hFile, 2); palette->UseColor = usecolor; if (!ReadFile(hFile, &BitCount, sizeof(WORD), &dwRead, NULL)) { ec = EC_FILE_NOT_READ; SAVE_EXCEPTION(ec); goto fail; } BPP[i]=BitCount; // BPP ¹è¿­¿¡ °¢ À̹ÌÁö Á¤º¸ ³Ö±â End } VersionList->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, HALFTONE);//COLORONCOLOR); ver = new TTexVersion; ver->Texpia = '\0'; ver->Method = '\0'; ver->Number = 0; VersionList->Add(ver); } } else { if ((ec = L_FileInfo(wPath.c_str(), &FileInfo, sizeof(FILEINFO), 0, NULL)) < 0) continue; // ¸øÀÐÀ¸¸é ´ÙÀ½ ÆÄÀÏ·Î ³Ñ¾î°¡¾ßÇØ¼­ continue //goto fail; memsize = FileInfo.SizeMem; //if ((ec = L_FileInfo(fn.c_str(), &FileInfo, sizeof(FILEINFO), 0, NULL)) < 0) continue; // ¸øÀÐÀ¸¸é ´ÙÀ½ ÆÄÀÏ·Î ³Ñ¾î°¡¾ßÇØ¼­ continue //goto fail; //memsize = FileInfo.SizeMem; //ÀÌ ºÎºÐ ºÎÅÍ Å« size À϶§ ±×¸² Ç¥½Ã ¾ÈÇÔ..... ÄÚµù..... // Added isAllView by maxleo21c (04.12.07) Å«»çÀÌÁîµµ º¸À̱â À§Çؼ­ ¸¸µé¾ú´Ù. 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 + "\\" + wfn + FileAge(fn) + FileInfo.SizeDisk + ".jpg"; //wtemp_fn = String(temp_Dir) + String("\\") + wfn + WideFileAge(wfn); //wtemp_fn = String(temp_Dir) + String("\\") + wfn + String(FileAge(wfn)); wtemp_fn = String(temp_Dir) + String("\\") + wfn + String(FileAge(wPath)); String wadd = String(FileInfo.SizeDisk) + String(".jpg"); wtemp_fn = wtemp_fn + wadd; if(FileExists(wtemp_fn)) { exist_file = true; if(!TexBitmap->LoadFromFile(wtemp_fn)) goto next; } else if (!TexBitmap->LoadFromFile(wPath)) 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, HALFTONE);//COLORONCOLOR); if(view_thumb_value) { if(memsize < limit_size)// || isAllView->Checked) { 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"; wtemp_fn = String(temp_Dir) + String("\\") + wfn + String(FileAge(wPath)); String wadd = String(FileInfo.SizeDisk) + String(".jpg"); wtemp_fn += wadd; //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(wtemp_fn, FILE_JFIF, 50); SetFileAttributes(wtemp_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(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } #else if ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; gff = ExtIndex; ec = LoadFromTexpiaTag(hFile, fi, gff, ver); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; VersionList->Add(ver); #endif LargeImageList->Add(fi->Bitmap, NULL); } pItem = ListView->Items->Add(); if (hFile == INVALID_HANDLE_VALUE) { if ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } size = GetFileSize(hFile, NULL); pItem->Caption = wfn; 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(wfn)); 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; if (ProgressBar) ProgressBar->Position = (100.0 / count) * (i+1); #if defined(TEXSTYLIST) if(ExtIndex == gffALL)SearchIcon(wfn, 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; } if (ver) { delete ver; ver = NULL; } } if (ProgressBar) ProgressBar->End(); ListView->Items->EndUpdate(); FilterComboBoxItemIndex = FilterComboBox->ItemIndex; GetDiskInfor(); if(fi) delete fi; if(hFile) CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; END_LOG; return; fail: if (fi) delete fi; if(hFile) CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; EXCEPTION_MESSAGE_OK(ec); END_LOG; } //--------------------------------------------------------------------------- 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(String FileName) { BEGIN_LOG("FileManager_F"); SHFILEOPSTRUCT shfile; String asFrom; Char *ucFrom; memset(&shfile, 0, sizeof(SHFILEOPSTRUCT)); shfile.hwnd = Handle; shfile.wFunc = FO_DELETE; asFrom = FullPathName(FDirectory, FileName); if ((ucFrom = (Char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Char)*(asFrom.Length()+2))) == NULL) goto fail; _tcscpy(ucFrom, asFrom.c_str()); shfile.pFrom = ucFrom; shfile.fFlags = FOF_ALLOWUNDO ; SHFileOperation(&shfile); HeapFree(GetProcessHeap(), 0, ucFrom); END_LOG; return; fail: END_LOG; } //--------------------------------------------------------------------------- ///´ÙÁß ÆÄÀÏ »èÁ¦ ÇÔ¼ö by david 090406 /*pFrom Á¶ÀÛÀÇ ´ë»óÀÌ µÈ´Ù1°³ÀÌ»óÀÇ ÆÄÀϸíÀÌ °Ý³³µÈ ¹öÆÛÀÇ ÁÖ¼Ò¸¦ ÁöÁ¤ÇÕ´Ï´Ù. ÀÌ·¯ÇÑ ÆÄÀϸíÀº Ç® ÆÐ½º ÁöÁ¤µÇ¾î ÀÖÁö ¾ÊÀ¸¸é ¾ÈµË´Ï´Ù.ÆÄÀÏ¸í¿¡ ¡°*¡± µîÀÇ, Ç¥ÁØMS-DOS¿ÍÀϵå Ä«µå¸¦ ÁöÁ¤ÇÒ ¼ö ÀÖ½À´Ï´Ù. °¢°¢ÀÇ ÆÄÀϸíÀº1°³ÀÇ NULL ¹®ÀÚ·Î ´Ü¶ôÁö¾îÁöÁö ¾ÊÀ¸¸é ¾ÈµË´Ï´Ù. ¶Ç, ¸¶Áö¸· ÆÄÀϸíÀÇ µÚ¿¡´Â double NULL Character ("\0\0")°¡ µé¾î°¡¾ß ÇÑ´Ù. Delete_Folder()ÇÔ¼ö¿Í °°ÀÌ SHFILEOPSTRUCTW¸¦ »ç¿ëÇÏÁö ¾ÊÀº ÀÌÀ¯´Â SHFileOperationW¿¡¼­ ¿¡·¯°¡ ¹ß»ýÇϱ⠶§¹®ÀÌ´Ù. ±¸±Û¿¡¼­ °Ë»öÇÑ °á°ú bug°¡ ÀÖ´Ù°í Çϴµ¥ ÆÄÀϸíÀÌ ±æ´Ù¶ó´Â À©µµ¿ì¿¡·¯°¡ ¹ß»ýÇÑ´Ù. SHFILEOPSTRUCT·Î ÇÏ¸é ¿¡·¯°¡ ¹ß»ýÇÏÁö ¾Ê¾Æ¼­ ÇöÀç À¯Áö */ void __fastcall TFileManagerForm::Delete_File(String* wFileNames, int FileCount) { BEGIN_LOG("FileManager_F"); if (FileCount == 1) { Delete_Folder(wFileNames[0]); END_LOG; return; } //API bug·Î ²À Ansi·Î ó¸®Çؾ߸¸ ÇÔ. AnsiString *FileNames = new AnsiString[FileCount]; for (int i = 0 ; i < FileCount; i++) { FileNames[i] = wFileNames[i]; } SHFILEOPSTRUCTA shfile; char *ucFrom = NULL; int length = 0; for (int i = 0; i < FileCount; i++) { length += FileNames[i].Length(); } length += FileCount; memset(&shfile, 0, sizeof(SHFILEOPSTRUCTA)); shfile.hwnd = Handle; shfile.wFunc = FO_DELETE; ucFrom = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, length + 1); for (int i = 0, n = 0; i < FileCount; i++) { for (int j = 0; j < FileNames[i].Length(); j++) { ucFrom[n] = FileNames[i].c_str()[j]; n++; } n++; } delete[] FileNames; if (ucFrom) { shfile.pFrom = ucFrom; shfile.fFlags = FOF_SIMPLEPROGRESS | FOF_ALLOWUNDO | FOF_MULTIDESTFILES; SHFileOperationA(&shfile); HeapFree(GetProcessHeap(), 0, ucFrom); END_LOG; } else { EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Delete_Folder(String FolderName) { BEGIN_LOG("FileManager_F"); SHFILEOPSTRUCT shfile; Char *ucFrom = NULL; memset(&shfile, 0, sizeof(SHFILEOPSTRUCT)); shfile.hwnd = Handle; shfile.wFunc = FO_DELETE; ucFrom = (Char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Char)*(FolderName.Length()+2)); if (ucFrom) { _tcscpy(ucFrom, FolderName.c_str()); shfile.pFrom = ucFrom; shfile.fFlags = FOF_ALLOWUNDO ; SHFileOperation(&shfile); HeapFree(GetProcessHeap(), 0, ucFrom); END_LOG; } else { SAVE_EXCEPTION(EC_MEMORY_LACK); EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::GetDiskInfor() { BEGIN_LOG("FileManager_F"); ULARGE_INTEGER FreeBytesAvailableToCaller; ULARGE_INTEGER TotalNumberOfBytes; ULARGE_INTEGER TotalNumberOfFreeBytes; int FreeSpace, TotalSpace; //Char *szDrive = DirectoryListBox->SelectedPathName.c_str(); String szDrive = DirectoryListBox->SelectedPathName; szDrive = szDrive.SubString(1, 3); /* Char szBuffer[4]; StrLCopy(szBuffer, szDrive, 1); _tcscat(szBuffer, ":\\"); ::GetDiskFreeSpaceEx(szBuffer, &FreeBytesAvailableToCaller, &TotalNumberOfBytes, &TotalNumberOfFreeBytes); */ ::GetDiskFreeSpaceEx(szDrive.c_str(), &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))); StatusBar->Panels->Items[0]->Text = " " +String(ListView->Items->Count) + " Patterns"; END_LOG; } //--------------------------------------------------------------------------- /* void __fastcall TFileManagerForm::DriveChange() { Char drive = DriveComboBox->Drive; String root, dn; int status; bool success, find = false; TSearchRec sr; if (UpperCase(String(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->SelectedPathName = root + dn; } else { dn = root + dn; success = CreateDirectory(dn.c_str(), NULL); if (success == false) { DirectoryListBox->SelectedPathName = root; ShowMessage(IDS_MESSAGE); } else { DirectoryListBox->SelectedPathName = dn; } } } */ //--------------------------------------------------------------------------- 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 ¿¡ È­ÀÏ ¹öÀü Ç¥½Ã static int oldX = -1, oldY = -1; TTexVersion *ver=NULL; TListItem *pItem=NULL; String VerNumber = ""; String Bmp_Mode ; if (X == oldX && Y == oldY) return; if(ViewItemIndex) goto next; if(VersionList->Count) { pItem = (TListItem *)ListView->GetItemAt(X,Y); if(!pItem) goto next; n = pItem->Index; if(VersionList->Count <= n) goto next; ver = (TTexVersion *)VersionList->Items[n]; if(Extension == 2) { if ( BPP[n] == 8 ) Bmp_Mode = " 256 Color "; else if ( BPP[n] == 24 ) Bmp_Mode = " Full Color "; VerNumber += (" Version " + FloatToStr(ver->Number/100.0)+" "+Bmp_Mode); // BPP ±ÛÀÚµµ Ãß°¡ÇØ ÁØ´Ù. by tmddn85 } else { VerNumber += (" Version " + FloatToStr(ver->Number/100.0)); } StatusBar->Panels->Items[3]->Text = VerNumber; } oldX = X; oldY = Y; return; next: StatusBar->Panels->Items[3]->Text = ""; oldX = X; oldY = Y; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Rename1Click(TObject *Sender) //2001.7.2 by lhskys Rename F2 ±â´É Ãß°¡ { int n = ListView->Selected->Index; rztbRename->Down = true; FileName = ListView->Items->Item[n]->Caption; Input->Text = FileName; Input->SetFocus(); Item = ITEM_RENAME; //Label4->Caption = IDS_FILENAME; //SpeedButton4->Caption = IDS_COMMON_RENAME; //SpeedButton4->Enabled = true; //Panel->Height = Panel1->Height + Panel2->Height + Panel3->Height + Panel4->Height; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Preference1Click(TObject *Sender) { if (ListView->SelCount != 1) return; // By GreenFish ÆÄÀÏ µî·ÏÁ¤º¸ Ç¥½ÃÇϱâ BEGIN_LOG("FileManager_F"); 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->Visible = true; //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 = DirectoryListBox->SelectedPathName; //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) ; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ExitPreferButtonClick(TObject *Sender) { FilePreferBox->Visible = false; //SendToBack(); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Copy1Click(TObject *Sender) { if (!ListView->SelCount) return; BEGIN_LOG("FileManager_F"); 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(DirectoryListBox->SelectedPathName , ListView->Items->Item[n]->Caption)); MoveCopyList->Add(ListView->Items->Item[n]->Caption); } ItemM = (TListItem *)ListView->GetNextItem((TListItem *)ItemM, sdAll, selected ); } Paste1->Enabled = true; Paste2->Enabled = true; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Paste1Click(TObject *Sender) { if (!MoveCopyList) return; BEGIN_LOG("FileManager_F"); TCursor cur; cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (bCutMode) { while (MoveCopyList->Count) { String MoveDestination = FullPathName(DirectoryListBox->SelectedPathName, MoveCopyList->Strings[1]); int Attrs = FileGetAttr(MoveCopyList->Strings[0]); // ÀбâÀü¿ë ¼Ó¼ºÀÌ ÀÖÀ¸¸é ¾ø¿¡¹ö¸°´Ù~ (±ú²ýÀÌ Áö¿öÁü) if (!CopyFile(MoveCopyList->Strings[0].c_str() , MoveDestination.c_str(), true)) { if (Application->MessageBox(L"Do you want to overwrite?", L"File already exists", MB_YESNO | MB_ICONQUESTION) == IDYES){ MakeBackupFile(DirectoryListBox->SelectedPathName, MoveCopyList->Strings[1]); 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) { String CopyDestination = FullPathName(DirectoryListBox->SelectedPathName, MoveCopyList->Strings[1]); if (!CopyFile(MoveCopyList->Strings[0].c_str() , CopyDestination.c_str(), true)) { if (Application->MessageBox(L"Do you want to overwrite?",L"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; Screen->Cursor = cur; //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; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::Cut1Click(TObject *Sender) { if (!ListView->SelCount) return; BEGIN_LOG("FileManager_F"); 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(DirectoryListBox->SelectedPathName, ListView->Items->Item[n]->Caption)); MoveCopyList->Add(ListView->Items->Item[n]->Caption); } ItemM = (TListItem *)ListView->GetNextItem((TListItem *)ItemM, sdAll, selected ); } Paste1->Enabled = true; Paste2->Enabled = true; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { if (Key == VK_DELETE) PopupDeleteClick(this); // Delete Key·Î »èÁ¦ if (Key == VK_F2) { //2001.6.30 by lhskys Rename F2 ´ÜÃàŰ........ if(Rename && ListView->Selected){ Item = ITEM_RENAME; int n = ListView->Selected->Index; rztbRename->Down = true; FileName = ListView->Items->Item[n]->Caption; Input->Text = FileName; Input->SetFocus(); //Label4->Caption = IDS_FILENAME; //SpeedButton4->Caption = IDS_COMMON_RENAME; //SpeedButton4->Enabled = true; //Panel->Height = Panel1->Height + Panel2->Height + Panel3->Height + Panel4->Height; } } if (Key == VK_F3) { //if(AllSearch->Checked){ IncludeSearchData(); //} } if (Shift.Contains(ssCtrl) && Key == 'C') { Copy1Click (this); } if (Shift.Contains(ssCtrl) && Key == 'V') { Paste1Click(this); } if (Shift.Contains(ssCtrl) && Key == 'X') { Cut1Click(this); } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { if (Key == VK_ESCAPE) rztbExitClick(this); // Esc Key·Î Exit } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ImagePreview(int index) { // By GreenFish if (index == -1) {PreviewImage->Visible = false; return;} else PreviewImage->Visible = true; BEGIN_LOG("FileManager_F"); // String fn = FileListBox->Items->Strings[index]; String wfn = ListView->Items->Item[index]->Caption; String wPath = FullPathName(FDirectory, wfn); HANDLE hFile = INVALID_HANDLE_VALUE; TTexVersion *ver = NULL; TTexpiaBitmap *TexBitmap = NULL; TFileInfor *fi = NULL; HDC dcSrc = NULL; TPException ec = EC_NONE; TGraphicFileFormat gff; Graphics::TBitmap *higher_ver_file = NULL; #if defined(TEXSTYLIST) String ext = LowerCase(ExtractFileExt(wfn)); //SearchExtIndex(String(ext)); TGraphicFileFormat RealIndex = FindExtension(String(ext)); if(RealIndex == gffNON){ PreviewImage->Visible = false; ShowMessage(IDS_MESSAGE_NOTIMAGEPREVIEW); END_LOG; return; } #endif if ((fi = new TFileInfor)==NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } if ((fi->Bitmap = new Graphics::TBitmap)==NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } #if defined(TEXSTYLIST) #ifdef NOTN3D if (RealIndex == gffDXF) { 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 ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } else if (RealIndex == gffTEX || RealIndex == gffTFC || RealIndex == gffT3D || RealIndex == gffWEA || RealIndex == gffWAV || RealIndex == gffKNT //|| RealIndex == gffPIL //|| RealIndex == gffOldTEX || RealIndex == gffOldTFC || RealIndex == gffVST || RealIndex == gffDXF #ifdef TRIAL || RealIndex == gffTEX_TRIAL || RealIndex == gffTFC_TRIAL || RealIndex == gffT3D_TRIAL || RealIndex == gffWEA_TRIAL || RealIndex == gffKNT_TRIAL || RealIndex == gffVST_TRIAL #endif ) { #else if (RealIndex == gffDXF) { 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 ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; } else if (RealIndex == gffTEX || RealIndex == gffTFC || RealIndex == gffT3D || RealIndex == gffWEA || RealIndex == gffWAV || RealIndex == gffKNT // || RealIndex == gffPIL // || RealIndex == gffOldTEX || RealIndex == gffOldTFC || RealIndex == gffN3D || RealIndex == gffVST || RealIndex == gffDXF) { #endif if ((hFile = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; gff = RealIndex; #ifdef TRIAL if(RealIndex == gffTEX_TRIAL || RealIndex == gffTFC_TRIAL || RealIndex == gffT3D_TRIAL || RealIndex == gffWEA_TRIAL || RealIndex == gffKNT_TRIAL || RealIndex == gffVST_TRIAL) { ec = LoadFromTexpiaTag(hFile, fi, gff, ver, true); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; }else { ec = LoadFromTexpiaTag(hFile, fi, gff, ver); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; } #else ec = LoadFromTexpiaTag(hFile, fi, gff, ver); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; #endif // VersionList->Add(ver); } else { if ((TexBitmap = new TTexpiaBitmap) == NULL) goto next; if (!TexBitmap->LoadFromFile(wPath)) 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, HALFTONE);//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(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) goto next; ver = new TTexVersion; gff = RealIndex; ec = LoadFromTexpiaTag(hFile, fi, gff, ver); if (ec == EC_FILE_NOT_OPEN_NEWERVERSION) { if ((higher_ver_file = new Graphics::TBitmap) == NULL) goto next; higher_ver_file->Width = 80; higher_ver_file->Height = 100; HigherVerImage->GetBitmap(0, higher_ver_file); 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)); StretchBlt(fi->Bitmap->Canvas->Handle, 0, 0, 80, 100, higher_ver_file->Canvas->Handle, 0, 0, 80, 100, SRCCOPY); if(higher_ver_file != NULL) { delete higher_ver_file; higher_ver_file = NULL; } } else if (ec != EC_NONE) goto next; // VersionList->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; END_LOG; return; fail: if (fi) delete fi; if(ver) delete ver; EXCEPTION_MESSAGE_OK(ec); END_LOG; } //--------------------------------------------------------------------------- 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(rztbMerge->Down == false && rztbNewFolder->Down == false) Input->Text = FileName; //else if(Edit4->Visible)Edit4->Text =""; if(rztbRename->Down || rztbSaveAs->Down) Input->SetFocus(); // if (ComboBoxView->ItemIndex != 0 && isPreview->Checked) ImagePreview(n); } else { FileName = String(""); ImagePreview(-1); } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewResize(TObject *Sender) { // ƯÁ¤ °æ¿ì ListView¿¡ mouse on ÇßÀ» ¶§ ListViewResize¸¦ °è¼ÓÇÏ´Â ¹®Á¦¶§¹®¿¡ ´ÙÀ½°ú °°ÀÌ Ã³¸®ÇÔ static oldWidth = ListView->Width; if(oldWidth == ListView->Width) return; oldWidth = ListView->Width; // raize ¼³Ä¡ÈÄ ¿¡·¯¹ß»ýÀ¸·Î º¯°æ (arDefault => Comctrls::arDefault) 06.11.22 ListView->Arrange(Comctrls::arDefault); /* if(miPreview->Checked == true){ if(DirectoryListBox->Height - PreviewBox->Height > 0){ PreviewBox->Top = DirectoryListBox->Height - PreviewBox->Height; } } */ } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::FormClose(TObject *Sender, TCloseAction &Action) { #ifdef TEXSTYLIST MainForm->Readdown = false; MainMenuForm->ExitFileManager(); #endif if(BPP) delete[] BPP ; // ÆÄÀϸŴÏÀú¿¡¼­ °¢ ÆÄÀÏ´ç ¾î¶² ¸ðµåÀÎÁö ¾Ë·ÁÁÖ´Â int ¹è¿­: BPP by tmddn85 } //--------------------------------------------------------------------------- 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() { BEGIN_LOG("FileManager_F"); String fn, Sn, Sfn; int n, count = FileList->Count; //FileListBox->Items->Count; /* int FileNameLength; String LowName, ext; FileNameLength = Edit4->Text.Length(); if(FileNameLength > 4){ LowName = Edit4->Text.LowerCase(); switch (ExtIndex) { #if defined(TEXSTYLIST) case gffTEX: ext = "*.tex"; break; case gffBMP: ext = "*.bmp"; break; case gffTIF: ext = "*.tif"; break; case gffVST: ext = "*.vst"; break; case gffTFC: ext = "*.tfc"; break; case gffT3D: ext = "*.t3d"; break; case gffOldTEX: ext = "*.tex"; break; case gffOldTFC: ext = "*.tfc"; break; #ifndef NOTN3D 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; case gffJPG: ext = "*.jpg"; break; case gffEPS: ext = "*.eps"; break; case gffDXF: ext = "*.dxf"; break; case gffSVG: ext = "*.svg"; break; // for SVG by maxleo21c (2006/06/17) case gffPIL: ext = "*.pil"; break; // case gffGIF: ext = "*.gif"; break; // by mecbong #endif #endif } if(LowName.Pos(ext) == FileNameLength - 3)Sfn = Edit4->Text; else Sfn = FOnFileName(Edit4->Text, ExtIndex); } else Sfn = FOnFileName(Edit4->Text, ExtIndex); */ Sfn = FOnFileName(Input->Text, ExtIndex); for (int i = 0; i < count; i++) { // fn = FileListBox->Items->Strings[i].LowerCase(); fn = WideLowerCase(ListView->Items->Item[i]->Caption);// .LowerCase(); Sn = WideLowerCase(Sfn); 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); END_LOG; return true; } } END_LOG; return false; } //--------------------------------------------------------------------------- bool __fastcall TFileManagerForm::IncludeSearchData() { BEGIN_LOG("FileManager_F"); String fn; int n, count; // = FileList->Count; // FileListBox->Items->Count; int s, len; bool bFind=false; String LowName, ext, name; String temp; NumOfSearchFiles=0; CurrentFileNum=0; count = ListView->Items->Count; for (int i = 0; i < count; i++) { name = LowerCase(ListView->Items->Item[i]->Caption);// .LowerCase(); fn = ExtractFileName(name); if(name != fn) { 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); END_LOG; return false; } temp = CurrentFileNum; temp += String("/"); temp += String(NumOfSearchFiles); StatusBar->Panels->Items[1]->Text = temp; END_LOG; return true; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SearchIcon(String fn, int i) { #if defined(TEXSTYLIST) int ExtIcon = 0; String ext = LowerCase(ExtractFileExt(fn)); //String ext = LowerCase(ExtractFileExt(fn)); if(ext == (String)".tex") ExtIcon = gffTEX; else if(ext == (String)".bmp") ExtIcon = gffBMP; else if(ext == (String)".tif") ExtIcon = gffTIF; else if(ext == (String)".vst") ExtIcon = gffVST; else if(ext == (String)".tfc") ExtIcon = gffTFC; else if(ext == (String)".t3d") ExtIcon = gffT3D; #ifdef NOTN3D #else else if(ext == (String)".n3d") ExtIcon = gffN3D; #endif else if(ext == (String)".wea") ExtIcon = gffWEA; else if(ext == (String)".wav") ExtIcon = gffWAV; else if(ext == (String)".knt") ExtIcon = gffKNT; else if(ext == (String)".pct") ExtIcon = gffPCT; else if(ext == (String)".pcx") ExtIcon = gffPCX; else if(ext == (String)".png") ExtIcon = gffPNG; else if(ext == (String)".psd") ExtIcon = gffPSD; else if(ext == (String)".ras") ExtIcon = gffRAS; else if(ext == (String)".tga") ExtIcon = gffTGA; else if(ext == (String)".jpg") ExtIcon = gffJPG; else if(ext == (String)".eps") ExtIcon = gffEPS; else if(ext == (String)".dxf") ExtIcon = gffDXF; else if(ext == (String)".svg") ExtIcon = gffSVG; // for SVG - by maxleo21c (2006/06/17) // else if(ext == (String)".pil") ExtIcon = gffPIL; #ifdef TRIAL else if(ext == (String)".ttex") ExtIcon = gffTEX_TRIAL; else if(ext == (String)".ttfc") ExtIcon = gffTFC_TRIAL; else if(ext == (String)".tt3d") ExtIcon = gffT3D_TRIAL; else if(ext == (String)".twea") ExtIcon = gffWEA_TRIAL; else if(ext == (String)".tknt") ExtIcon = gffKNT_TRIAL; else if(ext == (String)".tvst") ExtIcon = gffVST_TRIAL; #endif if (ViewItemIndex == 1) { ListView->Items->Item[i]->ImageIndex = ExtIcon-1; ListView->ViewStyle = vsSmallIcon; } else if (ViewItemIndex == 2) { ListView->Items->Item[i]->ImageIndex = ExtIcon-1; ListView->ViewStyle = vsList; } else if (ViewItemIndex == 3) { ListView->Items->Item[i]->ImageIndex = ExtIcon-1; ListView->ViewStyle = vsReport; } #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SearchExtIndex(String ext) { //TGraphicFileFormat extIndex; //03. 7.2 qe ExtIndex ---> extIndex Áö¿ªº¯¼ö·Î º¯°æ. #if defined(TEXSTYLIST) if(ext == ".tex") { ExtIndex = gffTEX; } else if(ext == ".bmp") ExtIndex = gffBMP; else if(ext == ".tif") ExtIndex = gffTIF; else if(ext == ".vst") ExtIndex = gffVST; 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 if(ext == ".dxf") ExtIndex = gffDXF; else if(ext == ".svg") ExtIndex = gffSVG; // for SVG - by maxleo21c (2006/06/17) // else if(ext == ".pil") ExtIndex = gffPIL; else if(ext == ".cmb") ExtIndex = gffCMB; else if(ext == ".jqd") ExtIndex = gffJQD; else if(ext == ".stp") ExtIndex = gffSTP; else if(ext == ".mcw") ExtIndex = gffMCW; else if(ext == ".mtl") ExtIndex = gffMTL; else if(ext == ".wal") ExtIndex = gffWAL; else if (ext == ".*") ExtIndex = gffALL; #ifdef TRIAL else if(ext == ".ttex") ExtIndex = gffTEX_TRIAL; else if(ext == ".ttfc") ExtIndex = gffTFC_TRIAL; else if(ext == ".tt3d") ExtIndex = gffT3D_TRIAL; else if(ext == ".twea") ExtIndex = gffWEA_TRIAL; else if(ext == ".tknt") ExtIndex = gffKNT_TRIAL; else if(ext == ".tvst") ExtIndex = gffVST_TRIAL; #endif else ExtIndex = gffNON; //gffALL; // else if(ext == ".gif") extIndex = gffGIF; // by mecbong #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ChangeViewType() { BEGIN_LOG("FileManager_F"); if(ExtIndex == gffALL) { for(int i = 0 ; i < ListView->Items->Count ; i++) { SearchIcon(ListView->Items->Item[i]->Caption, i); } } else IconSet(FilterComboBox->ItemIndex); END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::AllSearchClick(TObject *Sender) { //if(ExtIndex == gffALL) AllSearch->Checked = true; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::temp_ButtonClick(TObject *Sender) { view_thumb = false; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::SetViewFlag(bool value) { view_thumb = value; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::DeleteVersionList() { BEGIN_LOG("FileManager_F"); TTexVersion *ver=NULL; if (VersionList){ while(VersionList->Count > 0){ ver = (TTexVersion*)(VersionList->Last()); VersionList->Remove(ver); delete ver; } delete VersionList; VersionList = NULL; } END_LOG; } //--------------------------------------------------------------------------- /* void __fastcall TFileManagerForm::makeBackupFile(String fileName) { String backupDir = DefaultDir + "\\Backup"; if(!DirectoryExists(backupDir)) CreateDir(backupDir); String tempFileName = fileName + ".bak"; String fullName = backupDir + "\\" + tempFileName; int result = CopyFile(fileName.c_str() , fullName.c_str(), false); // if (result != 0) return true; // else return false; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::backupFileRollback(String DirName, String fileName) { String backupDir = DefaultDir + "\\Backup"; String tempFileName = fileName + ".bak"; String tempfullName = backupDir + "\\" + tempFileName; if (FileExists(tempfullName)){ String fullName = DirName + "\\" + fileName; CopyFile(tempfullName.c_str(), fullName.c_str(), false); } } */ //--------------------------------------------------------------------------- /* void __fastcall TFileManagerForm::isAllViewClick(TObject *Sender) { if (isAllView->Checked) limit_size = 80000000; else limit_size = 25000000; if (!StartLargeImage) StartLargeImage = true; ComboBoxViewChange(this); } */ //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::GetFileList(String Path, String Filter, String searchKey) { BEGIN_LOG("FileManager_F"); HANDLE hSrch = INVALID_HANDLE_VALUE; WIN32_FIND_DATAW wfd; Char fname[MAX_PATH]; BOOL bResult=TRUE; bool bSearchMode; bool valid; ClearFileList(); if (Path == NULL || Path == String("")) { END_LOG; return; } if(searchKey == String("")) bSearchMode = false; else bSearchMode = true; String wPath = Path + String("\\"+Filter); hSrch=FindFirstFile(wPath.c_str(),&wfd); if (hSrch != INVALID_HANDLE_VALUE){ while(bResult){ if (/*wfd.dwFileAttributes && */ !(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && !(wfd.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) && !(wfd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)){ //!(wfd.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY)){ if(bSearchMode) { if(String(WideLowerCase(wfd.cFileName)).Pos(WideLowerCase(searchKey)) > 0) valid = true; else valid = false; }else valid = true; if(valid) { String* filename = new String(wfd.cFileName); FileList->Add(filename); } } bResult = FindNextFile(hSrch,&wfd); } } else { wPath = Path + String("\\*.*"); hSrch=FindFirstFile(wPath.c_str(),&wfd); if (hSrch != INVALID_HANDLE_VALUE){ while(bResult){ if (/*wfd.dwFileAttributes && */ !(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && !(wfd.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) && !(wfd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)){ //!(wfd.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY)){ if (SameText(ExtractFileExt(wfd.cFileName), ExtractFileExt(String(Filter)))){ if(bSearchMode) { if(String(WideLowerCase(wfd.cFileName)).Pos(WideLowerCase(searchKey)) > 0) valid = true; else valid = false; }else valid = true; if(valid) { String* filename = new String(wfd.cFileName); FileList->Add(filename); } } } bResult = FindNextFile(hSrch,&wfd); } } } FindClose(hSrch); FileList->Sort(CompareProc); END_LOG; } //--------------------------------------------------------------------------- ///Á¤·Ä ÇÔ¼ö /** Unicode 󸮸¦ ÇÑ ÈÄ¿¡ FindNextFile()ÇÔ¼ö¿¡ ÀÇÇØ¼­ °¡Áö°í ¿À´Â ¼ø¼­°¡ ¿¹Àü°ú ´Ù¸£°Ô ó¸®µÇ¾î ¾÷ü¿¡¼­ ºÒ¸¸À» Á¦±â Çß´Ù. ±×·¡¼­ ¾Æ·¡¿Í °°Àº ÇÔ¼ö¸¦ Ãß°¡Çß´Ù. */ int __fastcall CompareProc(void *Item1, void *Item2) { String *wItem1 = (String *)Item1; String *wItem2 = (String *)Item2; String tt1 = *wItem1, tt2 = *wItem2; return _tcscmp(tt1.c_str(), tt2.c_str()); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ClearFileList() { BEGIN_LOG("FileManager_F"); String* file = NULL; if (FileList) { while (FileList->Count > 0) { file = (String*) FileList->Last(); if (file) { FileList->Remove(file); delete file; file = NULL; } } } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::DirectoryListBoxChange(TObject *Sender, TTreeNode *Node) { BEGIN_LOG("FileManager_F"); if (DirectoryListBox->Enabled){ if(DirectoryExists(DirectoryListBox->SelectedPathName)){ //FDrive = tolower(DirectoryListBox->SelectedPathName.SubString(0,1).c_str()[0]); //FileListBox->Directory = DirectoryListBox->SelectedPathName; if (!isCreating){ InitData(true); view_thumb = true; } FDirectory = String(DirectoryListBox->SelectedPathName); LabelDirectory->Caption = FDirectory; Input->Text = ""; } } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::rztbReadClick(TObject *Sender) { InitItem(ITEM_READ); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::rztbMergeClick(TObject *Sender) { InitItem(ITEM_MERGE); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::rztbSaveClick(TObject *Sender) { InitItem(ITEM_SAVE); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::rztbSaveAsClick(TObject *Sender) { Input->SetFocus(); InitItem(ITEM_SAVEAS); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::rztbDeleteClick(TObject *Sender) { InitItem(ITEM_DELETE); /* if (ListView->Selected) { int n = ListView->Selected->Index; FileName = ListView->Items->Item[n]->Caption; Delete_File(FileName); } */ } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::rztbNewFolderClick(TObject *Sender) { DirectoryListBox->CreateNewFolder(true); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ListViewDblClick(TObject *Sender) { BEGIN_LOG("FileManager_F"); int n, btn; bool run = true, saveWorkArea = false; TCursor cur; TFMReadParameter rp; TPException ec = EC_NONE; if (ListView->Selected) { n = ListView->Selected->Index; FileName = ListView->Items->Item[n]->Caption; String ext = LowerCase(ExtractFileExt(FileName)); if (Item==ITEM_READ) { #ifdef TEXSTYLIST //////////////////////////////////////////////////////////////////////// // N3D¿¡¼­ T3D ¸·À½ // by jeegeo if(ExtIndex == gffALL)SearchExtIndex(String(ext)); TGraphicFileFormat RealIndex = FindExtension(String(ext)); if(MainForm->ReadN3D==true&&RealIndex==gffT3D){ ShowMessage("not supported file format"); END_LOG; return; } /////////////////////////////////////////////////////////////////////// #endif cur = Screen->Cursor; Screen->Cursor = crHourGlass; #if defined(TEXSTYLIST) if(RealIndex == gffNON && ext != String(".cmb") && (ext != String(".mcw") || Extension != 6)// added by maxleo21c (05.02.18) && (ext != String(".mtl") || Extension != 7) && (ext != String(".wal") || Extension != 8) ){ //gabriel if(ext != String(".jqd") && ext != String(".stp")){ ShowMessage(IDS_MESSAGE_CANNOTOPENFILE); Screen->Cursor = cur; END_LOG; return; } } #endif if (FOnRead) { rp.DirName = DirectoryListBox->SelectedPathName; // FileListBox->Directory; rp.FileName = FileName; rp.ExtIndex = RealIndex; #if defined(TEXSTYLIST) if (rp.ExtIndex == gffTEX || rp.ExtIndex == gffKNT /*|| rp.ExtIndex == gffOldTEX*/) { // if (ExtIndex == gffTEX || ExtIndex == gffKNT || ExtIndex == gffOldTEX) { //by lhskys 2005.07.21 tex°¡ all ¿¡¼­ 256À¸·Î ¿­¸®°Ô... rp.bpp = 8; //rp.ExtIndex ¿¡´Â gffall ÀÌ ¾Æ´Ñ ½ÇÁ¦ ÆÄÀÏÀÇ Á¤º¸°¡ µé¾îÀֱ⠋š¹®... ec = FOnRead(rp, true); } #ifdef TRIAL else if(rp.ExtIndex == gffTEX_TRIAL || rp.ExtIndex == gffKNT_TRIAL) { rp.bpp = 8; ec = FOnRead(rp, true); } #endif else { rp.bpp = 24; #ifdef NOTN3D if (rp.ExtIndex == gffTFC || rp.ExtIndex == gffT3D || rp.ExtIndex == gffWEA || rp.ExtIndex == gffWAV //|| rp.ExtIndex == gffPIL #ifdef TRIAL || rp.ExtIndex == gffTFC_TRIAL || rp.ExtIndex == gffT3D_TRIAL || rp.ExtIndex == gffWEA_TRIAL #endif ) { #else if (rp.ExtIndex == gffTFC || rp.ExtIndex == gffT3D || rp.ExtIndex == gffN3D || rp.ExtIndex == gffWEA || rp.ExtIndex == gffWAV || /*rp.ExtIndex == gffPIL ||*/ /*rp.ExtIndex == gffVST ||*/ rp.ExtIndex == gffDXF) { #endif ec = FOnRead(rp, true); // ´©°¡ À̰÷¿¡ ³Ö¾ú´ÂÁö ¸ð¸£°Ú´Ù. ÀÌ·³ ¾ÈµÇ´Âµ¥....ÇÏ¿©Æ°°£¿¡ ÁÖ¼®À¸·Î ó¸® // 8.1¿¡´Â ¾ø´Â ºÎºÐÀÌ´Ù. EC_NONEÀº Á¤»óÀûÀÎ »óŸ¦ ÀǹÌÇÏ´Â °ÍÀÌ´Ù. // by maxleo21c (05.06.07) // if (ec == EC_NONE) { // EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); // SAVE_EXCEPTION(ec); // return; // } } else { ec = FOnRead(rp, false); } String Directorycolorpath = DirectoryColor+"\\textile.fcr"; // À̰÷¿¡¼­ Access¹ß»ý MainImageForm == NULLÀÏ °æ¿ì°¡ ¹ß»ýÇÑ´Ù. - by maxleo21c(05.06.4) if(MainImageForm && MainImageForm->iMainImage->uBitmap->BitsPerPixel==24) { // todo : DXF ·Îµå¸¦ À§ÇÑ.. ±èº´Àξ¾°¡ ÄÚµùÇßÀ½..;; ¿©±âÀÖÀ» Äڵ尡 ¾Æ´Ô.. mainimage·Î ¿Å±â¼¼¿ä if(RealIndex==gffJPG || RealIndex==gffBMP || RealIndex==gffPNG || RealIndex==gffPSD || RealIndex==gffTIF || RealIndex==gffRAS || RealIndex==gffTGA || RealIndex==gffDXF) { PaletteForm->DIB256Palette->LoadFromFile(Directorycolorpath.c_str()); MainImageForm->iMainImage->SetBackgroundColor(PaletteForm->DIB256Palette->GetBGCOLORREF(24)); // by celberus } } } #else reading = true; rp.bpp = 8; ec = FOnRead(rp, true); reading = false; #endif } Screen->Cursor = cur; #if defined(TEXSTYLIST) if (ec != EC_NONE){ if(ExtIndex == gffT3D) Application->MessageBox(IDS_INVALIDVISION.c_str(),IDS_MESSAGE_FILEOPEN.c_str(),MB_OK); #ifdef TRIAL else if(ExtIndex == gffT3D_TRIAL) Application->MessageBox(IDS_INVALIDVISION.c_str(),IDS_MESSAGE_FILEOPEN.c_str(),MB_OK); #endif //else if (ec == EC_NO_MESSAGE); else EXCEPTION_MESSAGE_OK(ec); } #else if (ec != EC_NONE)EXCEPTION_MESSAGE_OK(ec); //else if (ec == EC_NO_MESSAGE); #endif if (MainMenuForm->Item != T_STYLECOMBO) ModalResult = mrOk; } else if (Item==ITEM_MERGE) { cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (FOnMerge) { TGraphicFileFormat RealIndex = FindExtension(String(ext)); if (FOnMerge(FullPathName(FDirectory, FileName), RealIndex)) { ModalResult = mrOk; } else { rztbRead->Down = true; InitItem(ITEM_READ); } } Screen->Cursor = cur; } else { switch (Item) { case ITEM_SAVE: #ifdef TRIAL #ifdef TEXSTYLIST if(ExtIndex >= gffTEX) #endif { Application->MessageBox(IDS_COMMON_TRIAL_SAVE_NOT_SUPPORTED.c_str(), L"", MB_OK); END_LOG; return; } #endif if(Application->MessageBox(IDS_MESSAGE_PUTSAVE.c_str(), IDS_FSAVE.c_str(), MB_OKCANCEL) == IDOK){ cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (FOnSave) { //MakeBackupFile(FileListBox->Directory + "\\" + FileName); SaveOnTexpiaFile(FileName); } Screen->Cursor = cur; } break; case ITEM_DELETE: Delete_File(FileName); break; case ITEM_RENAME: Input->Text = RenameFileName; //±âÁ¸ÀÇ Rename ¹æ½Ä º¸Á¸ Run(); run = false; break; } if (run) { //FileListBox->Update(); //InitData(false); InitData(false); view_thumb = true; rztbRead->Down = true; InitItem(ITEM_READ); Input->Text = ""; } } #if defined(TEXSTYLIST) MainImageForm->AutoRepUpdateMenu(true); //2001.4.11. lhskys »õ·Î¿î MainMenu »ý¼º PaletteForm->StyleUseColor = false; #endif } END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::InputKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { if (Key != VK_RETURN) return; if(SearchSpeedBtn->Down == true) //search mode { SearchSpeedBtnClick(SearchSpeedBtn); return; } TCursor cur; String wfn; switch (Item) { case ITEM_READ: cur = Screen->Cursor; Screen->Cursor = crHourGlass; SearchCount = 0; SearchName = Input->Text; if(IncludeSearchData())goto next1; /* if(AllSearch->Checked){ SearchCount = 0; SearchName = Input->Text; if(IncludeSearchData())goto next1; } else if(SearchData())goto next1; */ ShowMessage(IDS_MESSAGE_FILENOTFOUND); next1: Screen->Cursor = cur; break; case ITEM_SAVE: ListViewDblClick(this); break; case ITEM_SAVEAS: { #ifdef TRIAL #ifdef TEXSTYLIST if(ExtIndex >= gffTEX) #endif { Application->MessageBox(IDS_COMMON_TRIAL_SAVE_NOT_SUPPORTED.c_str(), L"", MB_OK); return; } #endif if (FOnFileName) { cur = Screen->Cursor; Screen->Cursor = crHourGlass; wfn = FOnFileName(Input->Text, ExtIndex); for (int i=0; iCount; i++) { String *str = (String *)FileList->Items[i]; String cmfn = WideLowerCase(*str); String cmfn2 = WideLowerCase(wfn); if (cmfn == cmfn2) { int btn = EXCEPTION_MESSAGE2_OKCANCEL(EC_FILE_EXIST_ALREADY, (IDS_MESSAGE_REALLYFILESAVE).c_str()); if (btn == mrOk) { if (FOnSave){ //MakeBackupFile(fn); SaveOnTexpiaFile(wfn); } goto next; } else { goto next; } } } if (FOnSave) { SaveOnTexpiaFile(wfn); } next: Screen->Cursor = cur; } InitData(false); view_thumb = true; rztbRead->Down = true; InitItem(ITEM_READ); break; } case ITEM_MAKEFOLDER: /* CreateDirectory(Input->Text.c_str(), NULL); DirectoryListBox->Update(); SpeedButtonRead->Down = true; InitItem(ITEM_READ); */ break; case ITEM_RENAME: if (FOnFileName) { if (ListView->Selected && Input->Text != String("")) { String dst = FullPathName(FDirectory, FileName); String src = FullPathName(FDirectory, FOnFileName(Input->Text, ExtIndex)); if (RenameFile(dst, src) == false) EXCEPTION_MESSAGE_OK(EC_FILE_EXIST_ALREADY); } else { EXCEPTION_MESSAGE_OK(EC_CHOOSEFILE); } } //FileListBox->Update(); InitData(false); view_thumb = true; rztbRead->Down = true; InitItem(ITEM_READ); break; } if(Rename && rztbRename->Down && Input->Text.Length() > 0){ //2001.7.2 by lhskys Rename F2 ±â´É Ãß°¡ if (FOnFileName) { if (ListView->Selected) { String dst = FullPathName(FDirectory, FileName); String src = FullPathName(FDirectory, FOnFileName(Input->Text, ExtIndex)); if (RenameFile(dst, src) == false) EXCEPTION_MESSAGE_OK(EC_FILE_EXIST_ALREADY); } else { EXCEPTION_MESSAGE_OK(EC_CHOOSEFILE); } } InitData(false); view_thumb = true; rztbRead->Down = true; InitItem(ITEM_READ); Rename = false; } } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::ViewDropDownClick(TObject *Sender) { BEGIN_LOG("FileManager_F"); TMenuItem *miView = (TMenuItem *)Sender; switch(miView->Tag){ case 0: // Large if (ExtIndex == gffALL) { ShowMessage(IDS_MESSAGE_NOTSEELARGEVIEW); END_LOG; return; } StartLargeImage = true; ListView->ViewStyle = vsIcon; if(!isCreating) InitData(false); view_thumb = true; for(int i = 0 ; i < ListView->Items->Count ; i++) { ListView->Items->Item[i]->ImageIndex = i; } miAllView->Visible = true; miPreview->Visible = false; if (miPreview->Checked){ PreviewBox->Visible = false; } break; case 1: // Small StartLargeImage = false; ChangeViewType(); ListView->ViewStyle = vsSmallIcon; miAllView->Visible = false; if (miPreview->Checked){ PreviewBox->Visible = true; } miPreview->Visible = true; break; case 2: // List StartLargeImage = false; ChangeViewType(); ListView->ViewStyle = vsList; miAllView->Visible = false; if (miPreview->Checked){ PreviewBox->Visible = true; } miPreview->Visible = true; break; case 3: // Report StartLargeImage = false; ChangeViewType(); ListView->ViewStyle = vsReport; miAllView->Visible = false; if (miPreview->Checked){ PreviewBox->Visible = true; } miPreview->Visible = true; break; } miLargeView->Checked = false; miSmallView->Checked = false; miListView->Checked = false; miReportView->Checked = false; miView->Checked = true; ViewItemIndex = miView->Tag; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::miLargeViewClick(TObject *Sender) { BEGIN_LOG("FileManager_F"); if (ExtIndex == gffALL) { ShowMessage(IDS_MESSAGE_NOTSEELARGEVIEW); END_LOG; return; } StartLargeImage = true; ListView->ViewStyle = vsIcon; if(!isCreating) InitData(false); view_thumb = true; for(int i = 0 ; i < ListView->Items->Count ; i++) { ListView->Items->Item[i]->ImageIndex = i; } ViewItemIndex = 0; miLargeView->Checked = true; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::miSmallViewClick(TObject *Sender) { BEGIN_LOG("FileManager_F"); StartLargeImage = false; ChangeViewType(); ListView->ViewStyle = vsSmallIcon; ViewItemIndex = 1; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::miListViewClick(TObject *Sender) { BEGIN_LOG("FileManager_F"); StartLargeImage = false; ChangeViewType(); ListView->ViewStyle = vsList; ViewItemIndex = 2; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::miReportViewClick(TObject *Sender) { BEGIN_LOG("FileManager_F"); StartLargeImage = false; ChangeViewType(); ListView->ViewStyle = vsReport; ViewItemIndex = 3; END_LOG; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::rztbRenameClick(TObject *Sender) { InitItem(ITEM_RENAME); //Input->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::rztbExitClick(TObject *Sender) { ModalResult = mrCancel; #ifdef TEXSTYLIST MainForm->Readdown = false; #endif } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::miAllViewClick(TObject *Sender) { miAllView->Checked = !miAllView->Checked; if (miAllView->Checked) limit_size = 25000000000; else limit_size = 50000000; if (!StartLargeImage) StartLargeImage = true; InitData(false); view_thumb = true; } //--------------------------------------------------------------------------- void __fastcall TFileManagerForm::miPreviewClick(TObject *Sender) { miPreview->Checked = !miPreview->Checked; if (miPreview->Checked){ PreviewBox->Visible = true;// BringToFront(); lbImagePreview->Caption = IDS_IMAGEPREVIEW; //if(DirectoryListBox->Height - PreviewBox->Height > 0){ // PreviewBox->Top = DirectoryListBox->Height - PreviewBox->Height; //} } else PreviewBox->Visible = false; // PreviewBox->SendToBack(); } //--------------------------------------------------------------------------- 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 (ViewItemIndex != 0 && miPreview->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::SearchSpeedBtnClick(TObject *Sender) { TSpeedButton *sender = dynamic_cast(Sender); if(Input->Text == String("")) return; if(sender->Down) InitData(false, Input->Text); else{ Input->Text = String(""); InitData(false); } } //---------------------------------------------------------------------------