From 79e462f2c07992d800cab814d36c2b66ef29e697 Mon Sep 17 00:00:00 2001 From: sirakaba Date: Thu, 19 Nov 2009 13:46:40 +0000 Subject: [PATCH 1/1] =?utf8?q?Lychee=E3=81=AB=E3=83=AA=E3=83=8D=E3=83=BC?= =?utf8?q?=E3=83=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@121 9df91469-1e22-0410-86e7-ea8537beb833 --- src/lychee/Makefile | 4 +- src/lychee/cls_filedroptarget.cpp | 4 +- src/lychee/cls_listctrl.cpp | 8 +- src/lychee/cls_listctrl.h | 6 +- src/lychee/dlg_make.cpp | 15 +- src/lychee/dlg_process.cpp | 8 +- src/lychee/frm_main.cpp | 104 +- src/lychee/frm_main.h | 16 +- src/lychee/functions.cpp | 16 +- src/lychee/ui/dlg_process.fbp | 2 +- src/lychee/ui/frm_main.fbp | 1986 ++++++++++++++++++------------------- 11 files changed, 1093 insertions(+), 1076 deletions(-) diff --git a/src/lychee/Makefile b/src/lychee/Makefile index 4ae3246..4e1ee0a 100644 --- a/src/lychee/Makefile +++ b/src/lychee/Makefile @@ -8,8 +8,8 @@ LDFLAGS = -s `wx-config --libs` # Define i/o files. DIR_OBJ = ../tmp -OBJS = frontend.o cls_filedroptarget.o cls_listctrl.o dlg_make.o dlg_process.o frm_main.o functions.o ../common/handle/TPIHandle.o -OUT_EXE = ../../bin/frontend +OBJS = lychee.o cls_filedroptarget.o cls_listctrl.o dlg_make.o dlg_process.o frm_main.o functions.o ../common/handle/TPIHandle.o +OUT_EXE = ../../bin/lychee .PHONY: all clean .SUFFIXES: .cpp .o diff --git a/src/lychee/cls_filedroptarget.cpp b/src/lychee/cls_filedroptarget.cpp index 817f10a..5b86ad4 100644 --- a/src/lychee/cls_filedroptarget.cpp +++ b/src/lychee/cls_filedroptarget.cpp @@ -19,7 +19,7 @@ $Id: cls_filedroptarget.cpp,v 1.2 2009/08/09 06:08:51 sirakaba Exp $ *******************************************************************************/ -#include "frontend.h" +#include "lychee.h" #include "frm_main.h" #include "cls_filedroptarget.h" @@ -42,7 +42,7 @@ bool myFileDropTarget::OnDropFiles(wxCoord, wxCoord, const wxArrayString & asFil wxCommandEvent e; // ‘ŒÉ‚ɑΉž‚µ‚Ä‚¢‚é‚©‚Ç‚¤‚©Šm”FB - if (asFiles.Count() == 1 && this->mainFrame->LoadTPI(asFiles[0]) != -1) + if (asFiles.GetCount() == 1 && this->mainFrame->LoadTPI(asFiles[0]) != -1) { // ‘ŒÉ‚ðŠJ‚­B this->mainFrame->fnArchive = wxFileName(asFiles[0]); diff --git a/src/lychee/cls_listctrl.cpp b/src/lychee/cls_listctrl.cpp index e998b74..841dbe7 100644 --- a/src/lychee/cls_listctrl.cpp +++ b/src/lychee/cls_listctrl.cpp @@ -19,7 +19,7 @@ $Id: cls_listctrl.cpp,v 1.6 2009/08/23 03:00:34 sirakaba Exp $ *******************************************************************************/ -#include "frontend.h" +#include "lychee.h" #include "cls_listctrl.h" #include "dlg_make.h" @@ -36,7 +36,7 @@ IMPLEMENT_DYNAMIC_CLASS(myListCtrl, wxListView) // Event Table. //****************************************************************************** -BEGIN_EVENT_TABLE(myListCtrl, wxListCtrl) +BEGIN_EVENT_TABLE(myListCtrl, wxListView) // ListView EVT_LIST_COL_CLICK(XRCID("ListView"), myListCtrl::OnColClick) END_EVENT_TABLE() @@ -108,8 +108,8 @@ void myListCtrl::OnColClick(wxListEvent& e) // ƒ\[ƒgB this->showFileInfo.Sort(& ListCtrlCompareProc); - this->SetItemCount(this->showFileInfo.Count()); - this->RefreshItems(0, this->showFileInfo.Count() - 1); + this->SetItemCount(this->showFileInfo.GetCount()); + this->RefreshItems(0, this->showFileInfo.GetCount() - 1); } //****************************************************************************** diff --git a/src/lychee/cls_listctrl.h b/src/lychee/cls_listctrl.h index f5f0f1a..142e98c 100644 --- a/src/lychee/cls_listctrl.h +++ b/src/lychee/cls_listctrl.h @@ -22,7 +22,7 @@ #ifndef H_LOADED_CLS_LC #define H_LOADED_CLS_LC -class myListCtrl: public wxListCtrl +class myListCtrl: public wxListView { public: virtual wxString OnGetItemText(long, long) const; @@ -33,8 +33,8 @@ public: ArrayTPI_FILEINFO showFileInfo; wxListItemAttr atDangerItem; - myListCtrl(): wxListCtrl(){} - myListCtrl(wxWindow * parent, wxWindowID id, const wxPoint & pos = wxDefaultPosition, const wxSize & size = wxDefaultSize, long style = wxLC_ICON, const wxValidator & validator = wxDefaultValidator, const wxString & name = wxListCtrlNameStr): wxListCtrl(parent, id, pos, size, style, validator, name){} + myListCtrl(): wxListView(){} + myListCtrl(wxWindow * parent, wxWindowID id, const wxPoint & pos = wxDefaultPosition, const wxSize & size = wxDefaultSize, long style = wxLC_ICON, const wxValidator & validator = wxDefaultValidator, const wxString & name = wxListCtrlNameStr): wxListView(parent, id, pos, size, style, validator, name){} DECLARE_DYNAMIC_CLASS(myListCtrl) DECLARE_EVENT_TABLE() diff --git a/src/lychee/dlg_make.cpp b/src/lychee/dlg_make.cpp index afe3525..b82720a 100644 --- a/src/lychee/dlg_make.cpp +++ b/src/lychee/dlg_make.cpp @@ -19,7 +19,7 @@ $Id: dlg_make.cpp,v 1.15 2009/08/30 08:07:17 sirakaba Exp $ *******************************************************************************/ -#include "frontend.h" +#include "lychee.h" #include "dlg_make.h" #include "frm_main.h" @@ -119,7 +119,7 @@ void MakeDialog::OnInit(wxInitDialogEvent&) this->cbFileName->SetValue(((MainFrame *) this->GetParent())->fnArchive.GetFullName()); // “WŠJæ‚ð—\‘ªB‚½‚¾‚µDTVƒXƒLƒƒƒ“‚ÉŽžŠÔ‚ª‚©‚©‚éê‡‚̓XƒLƒbƒv‰Â”\B - if (this->files.Count() < 3000 || ::AskDlg(wxT("This archive contains so many files that it takes long to check Directory Traversal Vulnerability(DTV) problem. If you are sure this archive is safe, you can skip this scanning process. Do you want to scan for DTV problem?"), this) == wxYES) + if (this->files.GetCount() < 3000 || ::AskDlg(wxT("This archive contains so many files that it takes long to check Directory Traversal Vulnerability(DTV) problem. If you are sure this archive is safe, you can skip this scanning process. Do you want to scan for DTV problem?"), this) == wxYES) { wxNotebookEvent e; e.SetSelection(-3); @@ -140,7 +140,7 @@ void MakeDialog::OnInit(wxInitDialogEvent&) { // ‘Ήž‚·‚éŒ`Ž®–¼‚ðŽæ“¾B TPI_FORMATINFO fiInfo; - if (tpi.GetFormatInformation(& fiInfo, true) == TPI_ERROR_SUCCESS) + if (tpi.GetFormatInformation(& fiInfo, true)) { do { @@ -151,7 +151,7 @@ void MakeDialog::OnInit(wxInitDialogEvent&) this->chType->Append(fiInfo.szTypeName); } } - while (tpi.GetFormatInformation(& fiInfo, false) == TPI_ERROR_SUCCESS); + while (tpi.GetFormatInformation(& fiInfo, false)); } tpi.FreeLibrary(); } @@ -167,6 +167,7 @@ void MakeDialog::OnInit(wxInitDialogEvent&) void MakeDialog::OnBtnDefault(wxCommandEvent&) { + this->cbDir->SetValue(((MainFrame *) this->GetParent())->conf.Read(wxT("DefaultPath"), wxEmptyString)); } void MakeDialog::OnBtnDesktop(wxCommandEvent&) @@ -250,7 +251,7 @@ void MakeDialog::OnTabChanged(wxNotebookEvent& e) if (bReallyShow && this->lcFiles->GetItemCount() == 0) { // ƒtƒ@ƒCƒ‹ƒŠƒXƒg‚ð’ljÁB - for (size_t i = 0; i < this->files.Count(); i++) + for (size_t i = 0; i < this->files.GetCount(); i++) { this->lcFiles->InsertItem(i, this->files[i]); } @@ -259,7 +260,7 @@ void MakeDialog::OnTabChanged(wxNotebookEvent& e) if (bIsMake) { // Ši”[ƒpƒX‚𐄑ªB - for (size_t i = 0; i < this->files.Count(); i++) + for (size_t i = 0; i < this->files.GetCount(); i++) { if (bReallyShow) { @@ -274,7 +275,7 @@ void MakeDialog::OnTabChanged(wxNotebookEvent& e) // Šeƒtƒ@ƒCƒ‹‚ɃpƒX‚ð•t‰ÁB bool fDTVWarning = false; - for (size_t i = 0; i < this->files.Count(); i++) + for (size_t i = 0; i < this->files.GetCount(); i++) { wxString szOutputFile = szOutputRootDir + wxFileName::GetPathSeparator(); wxFileName fnStored(this->files[i]); diff --git a/src/lychee/dlg_process.cpp b/src/lychee/dlg_process.cpp index 0eb7477..47c7334 100644 --- a/src/lychee/dlg_process.cpp +++ b/src/lychee/dlg_process.cpp @@ -19,7 +19,7 @@ $Id: dlg_process.cpp,v 1.6 2009/09/01 12:20:49 sirakaba Exp $ *******************************************************************************/ -#include "frontend.h" +#include "lychee.h" #include "dlg_process.h" ProcessDialog * g_procDlg = NULL; @@ -146,7 +146,7 @@ int __stdcall TPICallbackProc(unsigned int _uMsg, void * _pStructure) switch (piInfo->uStatus) { case TPI_PARAM_PASSWORD: - piInfo->szParam = ::wxGetPasswordFromUser(wxT("Password for:\n") + piInfo->fiInfo.fnFileName.GetFullPath(), wxT("Frontend"), wxEmptyString, g_procDlg); + piInfo->szParam = ::wxGetPasswordFromUser(wxT("Password for:\n") + piInfo->fiInfo.fnFileName.GetFullPath(), wxT("Lychee"), wxEmptyString, g_procDlg); if (piInfo->szParam.IsEmpty()) { g_procDlg->fCancel = true; @@ -154,13 +154,13 @@ int __stdcall TPICallbackProc(unsigned int _uMsg, void * _pStructure) break; case TPI_PARAM_NEXTVOLUME: { - wxFileDialog fd(g_procDlg, wxT("Select next volume")); + wxFileDialog fd(g_procDlg, wxT("Select next volume of: ") + piInfo->fiInfo.fnFileName.GetFullName()); fd.SetWindowStyleFlag(wxFD_FILE_MUST_EXIST); if (fd.ShowModal() == wxID_CANCEL) { g_procDlg->fCancel = true; } - piInfo->szParam = fd.GetFilename(); + piInfo->szParam = fd.GetPath(); break; } default: diff --git a/src/lychee/frm_main.cpp b/src/lychee/frm_main.cpp index b6fdc12..f0d63ac 100644 --- a/src/lychee/frm_main.cpp +++ b/src/lychee/frm_main.cpp @@ -19,7 +19,7 @@ $Id: frm_main.cpp,v 1.42 2009/09/05 03:24:58 sirakaba Exp $ *******************************************************************************/ -#include "frontend.h" +#include "lychee.h" #include "frm_main.h" #include "cls_filedroptarget.h" @@ -45,7 +45,7 @@ bool g_fSortAscend; // MainFrame //****************************************************************************** -MainFrame::MainFrame(): wxFrame(), conf(wxEmptyString, wxEmptyString, FE_DIR_BIN wxT("frontend.conf"), wxEmptyString, wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH) +MainFrame::MainFrame(): wxFrame(), conf(wxEmptyString, wxEmptyString, FE_DIR_BIN wxT("lychee.conf"), wxEmptyString, wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH) { } @@ -251,7 +251,7 @@ void MainFrame::OnArcCreate(wxCommandEvent& e) mkDlg.files = * (wxArrayString *) e.GetClientData(); swInfo.fnDestinationDirectory = wxFileName::DirName(wxFileName(mkDlg.files[0]).GetPath()); // ‘Š‘΃pƒX‚É•ÏŠ·B - for (size_t n = 0; n < mkDlg.files.Count(); n++) + for (size_t n = 0; n < mkDlg.files.GetCount(); n++) { wxFileName fn(mkDlg.files[n]); bool fIsDir = fn.DirExists() && ! fn.FileExists(); @@ -308,7 +308,7 @@ void MainFrame::OnArcCreate(wxCommandEvent& e) } // ƒR[ƒ‹ƒoƒbƒNŠÖ”‚ðÝ’èB - if (tpi.SetCallbackProc(TPICallbackProc) != TPI_ERROR_SUCCESS) + if (! tpi.SetCallbackProc(TPICallbackProc)) { ::ErrDlg(wxT("SetCallbackProc()!"), this); } @@ -317,13 +317,13 @@ void MainFrame::OnArcCreate(wxCommandEvent& e) ProcessDialog procDlg; procDlg.InitDialog(); procDlg.Show(true); - int nErrorCode = this->ErrorCheck(tpi.Command(TPI_COMMAND_ADD, & swInfo, this->fnArchive.GetFullPath(), mkDlg.files)); - procDlg.Show(false); - tpi.FreeLibrary(); - if (nErrorCode != TPI_ERROR_SUCCESS) + if (! tpi.Command(TPI_COMMAND_ADD, & swInfo, this->fnArchive.GetFullPath(), mkDlg.files)) { + this->ErrorCheck(tpi.nErrorCode); return; } + procDlg.Show(false); + tpi.FreeLibrary(); if (mkDlg.cbOpenAfter->IsChecked()) { @@ -381,11 +381,17 @@ void MainFrame::OnArcOpen(wxCommandEvent& e) } TPICallbackProc(TPI_NOTIFY_COMMON, & piInfo); + // ƒR[ƒ‹ƒoƒbƒNŠÖ”‚ðÝ’èB + if (! tpi.SetCallbackProc(TPICallbackProc)) + { + ::ErrDlg(wxT("SetCallbackProc()!"), this); + } + // ”z—ñ‚̃TƒCƒY‚ðŠm•ÛB this->fileinfo.Alloc(piInfo.fiInfo.llUnpackedSize.ToULong()); // ‘ŒÉ‚ðŠJ‚­B - if (tpi.OpenArchive(this->fnArchive.GetFullPath()) != TPI_ERROR_SUCCESS) + if (! tpi.OpenArchive(this->fnArchive.GetFullPath())) { procDlg.Show(false); tpi.FreeLibrary(); @@ -407,7 +413,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e) idArcRoot = this->tree_ctrl->AppendItem(idRoot, wxT("-----"), 0, 1); // ƒtƒ@ƒCƒ‹î•ñ‚ðƒ[ƒhB - if (tpi.GetFileInformation(& piInfo.fiInfo, true) == TPI_ERROR_SUCCESS) + if (tpi.GetFileInformation(& piInfo.fiInfo, true)) { piInfo.uStatus = 0x1001; do @@ -462,12 +468,12 @@ void MainFrame::OnArcOpen(wxCommandEvent& e) // î•ñ‚ð•Û‘¶‚µ‚ăJƒEƒ“ƒgƒAƒbƒvB this->fileinfo.Add(piInfo.fiInfo); } - while (tpi.GetFileInformation(& piInfo.fiInfo, false) == TPI_ERROR_SUCCESS); + while (tpi.GetFileInformation(& piInfo.fiInfo, false)); } // ‘ŒÉ‚̏î•ñ‚ðŽæ“¾B TPI_ARCHIVEINFO aiInfo; - if (tpi.GetArchiveInformation(& aiInfo) != TPI_ERROR_SUCCESS) + if (! tpi.GetArchiveInformation(& aiInfo)) { procDlg.Show(false); tpi.FreeLibrary(); @@ -476,17 +482,11 @@ void MainFrame::OnArcOpen(wxCommandEvent& e) } // ‘ŒÉ‚ð•Â‚¶‚éB - if (tpi.CloseArchive() != TPI_ERROR_SUCCESS) + if (! tpi.CloseArchive()) { ::ErrDlg(wxT("CloseArchive()!"), this); } - // ƒR[ƒ‹ƒoƒbƒNŠÖ”‚ðÝ’èB - if (tpi.SetCallbackProc(TPICallbackProc) != TPI_ERROR_SUCCESS) - { - ::ErrDlg(wxT("SetCallbackProc()!"), this); - } - // ˆÈ‰ºAUIˆ—B this->fileinfo.Shrink(); this->tree_ctrl->ExpandAll(); @@ -496,7 +496,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e) // ƒXƒe[ƒ^ƒXƒo[Ý’èB this->statusbar->SetStatusText(aiInfo.fiInfo.szTypeName, 0); - this->statusbar->SetStatusText(wxString::Format(wxT("%d file(s)"), this->fileinfo.Count()), 1); + this->statusbar->SetStatusText(wxString::Format(wxT("%d file(s)"), this->fileinfo.GetCount()), 1); this->statusbar->SetStatusText(aiInfo.llUnpackedSize.ToString() + wxT(" B -> ") + aiInfo.llPackedSize.ToString() + wxT(" B"), 2); this->statusbar->SetStatusText(wxString::Format(wxT("%3.1f%%"), aiInfo.wCompressRatio / 10.0), 3); this->statusbar->SetStatusText(this->fnArchive.GetFullPath(), 4); @@ -565,7 +565,10 @@ void MainFrame::OnArcAdd(wxCommandEvent& e) ProcessDialog procDlg; procDlg.InitDialog(); procDlg.Show(true); - this->ErrorCheck(this->tpi.Command(TPI_COMMAND_ADD, & swInfo, this->fnArchive.GetFullPath(), files)); + if (! this->tpi.Command(TPI_COMMAND_ADD, & swInfo, this->fnArchive.GetFullPath(), files)) + { + this->ErrorCheck(tpi.nErrorCode); + } procDlg.Show(false); // ‘ŒÉ‚ðÄ“ǂݍž‚݁B @@ -593,7 +596,10 @@ void MainFrame::OnArcConvert(wxCommandEvent& e) ProcessDialog procDlg; procDlg.InitDialog(); procDlg.Show(true); - this->ErrorCheck(this->tpi.Command(swInfo.fMakeSFX ? TPI_COMMAND_SFX : TPI_COMMAND_UNSFX, & swInfo, this->fnArchive.GetFullPath(), files)); + if (! this->tpi.Command(swInfo.fMakeSFX ? TPI_COMMAND_SFX : TPI_COMMAND_UNSFX, & swInfo, this->fnArchive.GetFullPath(), files)) + { + this->ErrorCheck(tpi.nErrorCode); + } procDlg.Show(false); } @@ -676,7 +682,10 @@ void MainFrame::OnArcExtract(wxCommandEvent& e) ProcessDialog procDlg; procDlg.InitDialog(); procDlg.Show(true); - int nErrorCode = this->ErrorCheck(this->tpi.Command(TPI_COMMAND_EXTRACT, & swInfo, this->fnArchive.GetFullPath(), mkDlg.files)); + if (! this->tpi.Command(TPI_COMMAND_EXTRACT, & swInfo, this->fnArchive.GetFullPath(), mkDlg.files)) + { + this->ErrorCheck(tpi.nErrorCode); + } procDlg.Show(false); if (nMode == 0) @@ -702,16 +711,16 @@ void MainFrame::OnArcExtract(wxCommandEvent& e) { // ƒRƒ}ƒ“ƒh‚ðŽÀsB asFiles.Add(swInfo.fnDestinationDirectory.GetPathWithSep() + wxFileName(mkDlg.files[0]).GetFullName()); - if (nErrorCode == TPI_ERROR_SUCCESS) + if (tpi.nErrorCode == TPI_ERROR_SUCCESS) { - ::wxExecute(ftFile->GetOpenCommand(asFiles[0]), wxEXEC_SYNC); + ::wxExecute(ftFile->GetOpenCommand(wxT('"') + asFiles[0] + wxT('"')), wxEXEC_SYNC); } } else { // “WŠJ‘ÎÛ‚ðŒˆ’èB wxFileDataObject objFile; - for (size_t i = 0; i < mkDlg.files.Count(); i++) + for (size_t i = 0; i < mkDlg.files.GetCount(); i++) { wxString szFileName = swInfo.fnDestinationDirectory.GetPathWithSep() + wxFileName(mkDlg.files[i]).GetFullName(); if (nMode == 2) @@ -761,12 +770,13 @@ void MainFrame::OnArcDelete(wxCommandEvent& e) // ŠeŽíÝ’èB TPI_SWITCHES swInfo; - wxArrayString files = MakeTargetFileList(this, false); - ProcessDialog procDlg; procDlg.InitDialog(); procDlg.Show(true); - this->ErrorCheck(this->tpi.Command(TPI_COMMAND_DELETE, & swInfo, this->fnArchive.GetFullPath(), files)); + if (! this->tpi.Command(TPI_COMMAND_DELETE, & swInfo, this->fnArchive.GetFullPath(), MakeTargetFileList(this, false))) + { + this->ErrorCheck(tpi.nErrorCode); + } procDlg.Show(false); // ‘ŒÉ‚ðÄ“ǂݍž‚Ý‚·‚éB @@ -775,30 +785,31 @@ void MainFrame::OnArcDelete(wxCommandEvent& e) void MainFrame::OnArcTest(wxCommandEvent&) { - // ŠeŽíÝ’èB - wxArrayString files = MakeTargetFileList(this, false); TPI_SWITCHES swInfo; - ProcessDialog procDlg; procDlg.InitDialog(); procDlg.Show(true); - if (this->ErrorCheck(this->tpi.Command(TPI_COMMAND_TEST, & swInfo, this->fnArchive.GetFullPath(), files)) == TPI_ERROR_SUCCESS) + if (this->tpi.Command(TPI_COMMAND_TEST, & swInfo, this->fnArchive.GetFullPath(), MakeTargetFileList(this, false))) { ::MsgDlg(wxT("This is a correct archive."), & procDlg, wxICON_INFORMATION); } + else + { + this->ErrorCheck(tpi.nErrorCode); + } procDlg.Show(false); } void MainFrame::OnArcRepair(wxCommandEvent&) { - // ŠeŽíÝ’èB - wxArrayString files = MakeTargetFileList(this, false); TPI_SWITCHES swInfo; - ProcessDialog procDlg; procDlg.InitDialog(); procDlg.Show(true); - this->ErrorCheck(this->tpi.Command(TPI_COMMAND_REPAIR, & swInfo, this->fnArchive.GetFullPath(), files)); + if (! this->tpi.Command(TPI_COMMAND_REPAIR, & swInfo, this->fnArchive.GetFullPath(), MakeTargetFileList(this, false))) + { + this->ErrorCheck(tpi.nErrorCode); + } procDlg.Show(false); } @@ -825,7 +836,7 @@ void MainFrame::OnSelectAll(wxCommandEvent &) { for (int i = 0; i < this->list_ctrl->GetItemCount(); i++) { - this->list_ctrl->SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); + this->list_ctrl->Select(i, true); } } @@ -837,9 +848,18 @@ void MainFrame::OnTreeChanged(wxTreeEvent& e) wxString szNodePath = TreeView_GetItemPath(this->tree_ctrl, e.GetItem()); // ƒŠƒXƒgƒrƒ…[‚ð‰Šú‰»B this->list_ctrl->showFileInfo.Clear(); + this->list_ctrl->DeleteAllItems(); g_hIconLL.RemoveAll(); g_hIconLS.RemoveAll(); + // Œ»Ý‚̃AƒCƒeƒ€‚Ì‘I‘ðó‘Ԃ𖳌ø‚É‚µ‚Ä‚¨‚­B + long nSelected = this->list_ctrl->GetFirstSelected(); + while (nSelected != -1) + { + this->list_ctrl->Select(nSelected, false); + nSelected = this->list_ctrl->GetNextSelected(nSelected); + } + // ƒAƒCƒRƒ“Ý’èB this->list_ctrl->SetImageList(& g_hIconLL, wxIMAGE_LIST_NORMAL); this->list_ctrl->SetImageList(& g_hIconLS, wxIMAGE_LIST_SMALL); @@ -868,17 +888,13 @@ void MainFrame::OnTreeChanged(wxTreeEvent& e) // ƒ\[ƒg‚µ‚Ä•\Ž¦B this->list_ctrl->showFileInfo.Sort(& ListCtrlCompareProc); - this->list_ctrl->SetItemCount(this->list_ctrl->showFileInfo.Count()); + this->list_ctrl->SetItemCount(this->list_ctrl->showFileInfo.GetCount()); } void MainFrame::OnTreeBeginDrag(wxTreeEvent& e) { // TODO : ƒAƒCƒeƒ€‚ªŽqŠK‘w‚ðŽ‚Á‚Ä‚¢‚Ä‚à“WŠJ‚Å‚«‚È‚¢B this->tree_ctrl->SelectItem(e.GetItem()); - for (int i = 0; i < this->list_ctrl->GetItemCount(); i++) - { - this->list_ctrl->SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); - } wxCommandEvent e1; e1.SetInt(3); @@ -928,7 +944,7 @@ int MainFrame::LoadTPI(wxString szFileName) while (! szTPIName.IsEmpty()) { // ‘ΉžŠm”FB - if (! tpi.InitLibrary(szTPIName, szFileName, 0) || tpi.CheckArchive(szFileName, & nFileCount) != TPI_ERROR_SUCCESS || nFileCount < 0) + if (! tpi.InitLibrary(szTPIName, szFileName, 0) || ! tpi.CheckArchive(szFileName, & nFileCount) || nFileCount < 0) { tpi.FreeLibrary(); szTPIName = fs.FindNext(); diff --git a/src/lychee/frm_main.h b/src/lychee/frm_main.h index e577ee2..722cc41 100644 --- a/src/lychee/frm_main.h +++ b/src/lychee/frm_main.h @@ -28,14 +28,14 @@ class MainFrame: public wxFrame { public: - wxStatusBar* statusbar; - wxTreeCtrl* tree_ctrl; - myListCtrl* list_ctrl; + wxTreeCtrl * tree_ctrl; + myListCtrl * list_ctrl; ArrayTPI_FILEINFO fileinfo; TPIHandle tpi; + wxFileName fnArchive; + wxFileConfig conf; wxString szCurrentPath; wxCmdLineParser cmdLine; - wxFileName fnArchive; // Event handler. void OnInit( wxInitDialogEvent&); @@ -74,11 +74,11 @@ public: ~MainFrame(); protected: - wxMenuBar* menubar; - wxToolBar* toolbar; - wxSplitterWindow* window_splitter; + wxMenuBar * menubar; + wxToolBar * toolbar; + wxStatusBar * statusbar; + wxSplitterWindow * window_splitter; wxTextCtrl * tcFilter; - wxFileConfig conf; DECLARE_EVENT_TABLE() }; diff --git a/src/lychee/functions.cpp b/src/lychee/functions.cpp index 2fc6a5f..6c61b0f 100644 --- a/src/lychee/functions.cpp +++ b/src/lychee/functions.cpp @@ -23,7 +23,7 @@ // ƒtƒ@ƒCƒ‹“ǂݍž‚Ý //****************************************************************************** -#include "frontend.h" +#include "lychee.h" #include "frm_main.h" #include "dlg_make.h" #include "functions.h" @@ -155,16 +155,16 @@ wxFileName MakeDirPath(wxFileName fnPath, wxString szBase, bool bAct) wxArrayString MakeTargetFileList(MainFrame * frm, bool fOnlyOneFile) { wxArrayString as; - for (int i = 0; i < frm->list_ctrl->GetItemCount(); i++) + const int nState = frm->list_ctrl->GetSelectedItemCount() == 0 ? wxLIST_STATE_DONTCARE : wxLIST_STATE_SELECTED; + long nId = frm->list_ctrl->GetNextItem(-1, wxLIST_NEXT_ALL, nState); + while (nId != -1) { - if (((as.GetCount() < (unsigned) frm->list_ctrl->GetSelectedItemCount()) && (frm->list_ctrl->GetItemState(i, wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED)) || frm->list_ctrl->GetSelectedItemCount() == 0) + as.Add(frm->list_ctrl->showFileInfo[nId].szStoredName); + if (fOnlyOneFile) { - as.Add(frm->list_ctrl->showFileInfo[i].szStoredName); - if (fOnlyOneFile) - { - return as; - } + break; } + nId = frm->list_ctrl->GetNextItem(nId, wxLIST_NEXT_ALL, nState); } return as; diff --git a/src/lychee/ui/dlg_process.fbp b/src/lychee/ui/dlg_process.fbp index 648193b..f597599 100644 --- a/src/lychee/ui/dlg_process.fbp +++ b/src/lychee/ui/dlg_process.fbp @@ -35,7 +35,7 @@ wxDEFAULT_DIALOG_STYLE ProcessDialog - Frontend is processing ... + Lychee is processing ... diff --git a/src/lychee/ui/frm_main.fbp b/src/lychee/ui/frm_main.fbp index 6557d17..f8dc31b 100644 --- a/src/lychee/ui/frm_main.fbp +++ b/src/lychee/ui/frm_main.fbp @@ -1,993 +1,993 @@ - - - - - - XRC - 1 - UTF-8 - connect - frm_main - 1000 - none - 0 - frm_main - - ../../../share/xrc - - 1 - 0 - 0 - - - - - 1 - - - - - wxID_ANY - - - frame_main - - 800, 400 - wxDEFAULT_FRAME_STYLE - MainFrame - Frontend - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - 0 - wxID_ANY - - - - menubar - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - File - m_menu1 - protected - - ../share/ico/16/create.png; Load From File - 0 - 1 - - wxID_NEW - wxITEM_NORMAL - Create archive - Arc_Create - none - - - - - - - ../share/ico/16/open.png; Load From File - 0 - 1 - - wxID_OPEN - wxITEM_NORMAL - Open archive - Arc_Open - none - - - - - - - ../share/ico/16/close.png; Load From File - 0 - 0 - - wxID_CLOSE - wxITEM_NORMAL - Close archive - Arc_Close - none - - - - - - - none - - - ../share/ico/16/add.png; Load From File - 0 - 0 - - wxID_ANY - wxITEM_NORMAL - Add files - Arc_Add - none - Ins - - - - - - ../share/ico/16/sfx.png; Load From File - 0 - 0 - - wxID_ANY - wxITEM_NORMAL - Make SFX - Arc_SFX - none - - - - - - - ../share/ico/16/unsfx.png; Load From File - 0 - 0 - - wxID_ANY - wxITEM_NORMAL - UnSFX - Arc_UnSFX - none - - - - - - - none - - - - 0 - 1 - - wxID_EXIT - wxITEM_NORMAL - Exit - Exe_Exit - none - Ctrl+Q - - - - - - - Archive - m_menu2 - protected - - ../share/ico/16/extract.png; Load From File - 0 - 0 - - wxID_ANY - wxITEM_NORMAL - Extract - Arc_Extract - none - - - - - - - ../share/ico/16/delete.png; Load From File - 0 - 0 - - wxID_ANY - wxITEM_NORMAL - Delete - Arc_Delete - none - Del - - - - - - ../share/ico/16/test.png; Load From File - 0 - 0 - - wxID_ANY - wxITEM_NORMAL - Test - Arc_Test - none - - - - - - - ../share/ico/16/repair.png; Load From File - 0 - 0 - - wxID_ANY - wxITEM_NORMAL - Repair - Arc_Repair - none - - - - - - - - View - m_menu3 - protected - - - 0 - 1 - - wxID_ANY - wxITEM_RADIO - Icons - Exe_View_Icons - none - Ctrl+1 - - - - - - - 1 - 1 - - wxID_ANY - wxITEM_RADIO - Details - Exe_View_Details - none - Ctrl+2 - - - - - - - 0 - 1 - - wxID_ANY - wxITEM_RADIO - List - Exe_View_List - none - Ctrl+3 - - - - - - none - - - - 1 - 1 - - wxID_ANY - wxITEM_CHECK - Show ToolBar - Exe_View_ToolBar - none - - - - - - - - 1 - 1 - - wxID_ANY - wxITEM_CHECK - Show StatusBar - Exe_View_StatusBar - none - - - - - - - none - - - - 0 - 1 - - wxID_SELECTALL - wxITEM_NORMAL - Select All - Exe_View_SelectAll - none - Ctrl+A - - - - - - - - - - 1 - - 1 - - - wxID_ANY - - - statusbar - protected - - - wxST_SIZEGRIP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32, 32 - - 1 - - - - wxID_ANY - - - - toolbar - 0 - protected - - 0 - - wxTB_FLAT|wxTB_HORIZONTAL|wxTB_TEXT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ../share/ico/24/create.png; Load From File - wxID_NEW - wxITEM_NORMAL - Create - Arc_Create - - Create new archive - - - - - - - - ../share/ico/24/open.png; Load From File - wxID_OPEN - wxITEM_NORMAL - Open - Arc_Open - - Open archive - - - - - - - - ../share/ico/24/close.png; Load From File - wxID_CLOSE - wxITEM_NORMAL - Close - Arc_Close - - Close archive - - - - - - - - - ../share/ico/24/add.png; Load From File - wxID_ANY - wxITEM_NORMAL - Add - Arc_Add - - Add files or a folder to this archive - - - - - - - - ../share/ico/24/sfx.png; Load From File - wxID_ANY - wxITEM_NORMAL - Make SFX - Arc_SFX - - Convert to self-extract archive - - - - - - - - ../share/ico/24/unsfx.png; Load From File - wxID_ANY - wxITEM_NORMAL - UnSFX - Arc_UnSFX - - Convert to normal archive - - - - - - - - - ../share/ico/24/extract.png; Load From File - wxID_ANY - wxITEM_NORMAL - Extract - Arc_Extract - - Extract selected files or whole archive - - - - - - - - ../share/ico/24/delete.png; Load From File - wxID_ANY - wxITEM_NORMAL - Delete - Arc_Delete - - Delete selected files from this archive - - - - - - - - ../share/ico/24/test.png; Load From File - wxID_ANY - wxITEM_NORMAL - Test - Arc_Test - - Test selected files or whole archive - - - - - - - - ../share/ico/24/repair.png; Load From File - wxID_ANY - wxITEM_NORMAL - Repair - Arc_Repair - - Repair selected files or whole archive - - - - - - - - - - - 1 - - - 0 - wxID_ANY - - 0 - - tcFilter - protected - - - - - Show only files containing filter string - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizer14 - wxVERTICAL - none - - 0 - wxEXPAND - 1 - - - - 1 - - - - wxID_ANY - - 0 - - window_splitter - protected - - 0.0 - 162 - -1 - - wxSPLIT_VERTICAL - wxSP_3D|wxSP_BORDER|wxSP_LIVE_UPDATE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - 0 - wxID_ANY - - - m_panel1 - protected - - - - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - bSizer19 - wxVERTICAL - none - - 1 - wxALL|wxEXPAND - 1 - - - - 1 - - - 0 - wxID_ANY - - - TreeView - protected - - - wxTR_DEFAULT_STYLE|wxTR_HAS_BUTTONS|wxTR_HIDE_ROOT - - - - - wxSUNKEN_BORDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - 0 - wxID_ANY - - - m_panel2 - protected - - - - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - bSizer20 - wxVERTICAL - none - - 1 - wxALL|wxEXPAND - 1 - - - - 1 - - - 0 - wxID_ANY - - - ListView - protected - - - wxLC_REPORT|wxLC_VIRTUAL - myListCtrl; - - - - wxSUNKEN_BORDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + XRC + 1 + UTF-8 + connect + frm_main + 1000 + none + 0 + frm_main + + ../../../share/xrc + + 1 + 0 + 0 + + + + + 1 + + + + + wxID_ANY + + + frame_main + + 800, 400 + wxDEFAULT_FRAME_STYLE + MainFrame + Lychee + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + + menubar + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + File + m_menu1 + protected + + ../share/ico/16/create.png; Load From File + 0 + 1 + + wxID_NEW + wxITEM_NORMAL + Create archive + Arc_Create + none + + + + + + + ../share/ico/16/open.png; Load From File + 0 + 1 + + wxID_OPEN + wxITEM_NORMAL + Open archive + Arc_Open + none + + + + + + + ../share/ico/16/close.png; Load From File + 0 + 0 + + wxID_CLOSE + wxITEM_NORMAL + Close archive + Arc_Close + none + + + + + + + none + + + ../share/ico/16/add.png; Load From File + 0 + 0 + + wxID_ANY + wxITEM_NORMAL + Add files + Arc_Add + none + Ins + + + + + + ../share/ico/16/sfx.png; Load From File + 0 + 0 + + wxID_ANY + wxITEM_NORMAL + Make SFX + Arc_SFX + none + + + + + + + ../share/ico/16/unsfx.png; Load From File + 0 + 0 + + wxID_ANY + wxITEM_NORMAL + UnSFX + Arc_UnSFX + none + + + + + + + none + + + + 0 + 1 + + wxID_EXIT + wxITEM_NORMAL + Exit + Exe_Exit + none + Ctrl+Q + + + + + + + Archive + m_menu2 + protected + + ../share/ico/16/extract.png; Load From File + 0 + 0 + + wxID_ANY + wxITEM_NORMAL + Extract + Arc_Extract + none + + + + + + + ../share/ico/16/delete.png; Load From File + 0 + 0 + + wxID_ANY + wxITEM_NORMAL + Delete + Arc_Delete + none + Del + + + + + + ../share/ico/16/test.png; Load From File + 0 + 0 + + wxID_ANY + wxITEM_NORMAL + Test + Arc_Test + none + + + + + + + ../share/ico/16/repair.png; Load From File + 0 + 0 + + wxID_ANY + wxITEM_NORMAL + Repair + Arc_Repair + none + + + + + + + + View + m_menu3 + protected + + + 0 + 1 + + wxID_ANY + wxITEM_RADIO + Icons + Exe_View_Icons + none + Ctrl+1 + + + + + + + 1 + 1 + + wxID_ANY + wxITEM_RADIO + Details + Exe_View_Details + none + Ctrl+2 + + + + + + + 0 + 1 + + wxID_ANY + wxITEM_RADIO + List + Exe_View_List + none + Ctrl+3 + + + + + + none + + + + 1 + 1 + + wxID_ANY + wxITEM_CHECK + Show ToolBar + Exe_View_ToolBar + none + + + + + + + + 1 + 1 + + wxID_ANY + wxITEM_CHECK + Show StatusBar + Exe_View_StatusBar + none + + + + + + + none + + + + 0 + 1 + + wxID_SELECTALL + wxITEM_NORMAL + Select All + Exe_View_SelectAll + none + Ctrl+A + + + + + + + + + + 1 + + 1 + + + wxID_ANY + + + statusbar + protected + + + wxST_SIZEGRIP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 16,16 + + 1 + + + + wxID_ANY + + + + toolbar + 0 + protected + + 0 + + wxTB_FLAT|wxTB_HORIZONTAL|wxTB_HORZ_LAYOUT|wxTB_TEXT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ../share/ico/16/create.png; Load From File + wxID_NEW + wxITEM_NORMAL + Create + Arc_Create + + Create new archive + + + + + + + + ../share/ico/16/open.png; Load From File + wxID_OPEN + wxITEM_NORMAL + Open + Arc_Open + + Open archive + + + + + + + + ../share/ico/16/close.png; Load From File + wxID_CLOSE + wxITEM_NORMAL + Close + Arc_Close + + Close archive + + + + + + + + + ../share/ico/16/add.png; Load From File + wxID_ANY + wxITEM_NORMAL + Add + Arc_Add + + Add files or a folder to this archive + + + + + + + + ../share/ico/16/sfx.png; Load From File + wxID_ANY + wxITEM_NORMAL + Make SFX + Arc_SFX + + Convert to self-extract archive + + + + + + + + ../share/ico/16/unsfx.png; Load From File + wxID_ANY + wxITEM_NORMAL + UnSFX + Arc_UnSFX + + Convert to normal archive + + + + + + + + + ../share/ico/16/extract.png; Load From File + wxID_ANY + wxITEM_NORMAL + Extract + Arc_Extract + + Extract selected files or whole archive + + + + + + + + ../share/ico/16/delete.png; Load From File + wxID_ANY + wxITEM_NORMAL + Delete + Arc_Delete + + Delete selected files from this archive + + + + + + + + ../share/ico/16/test.png; Load From File + wxID_ANY + wxITEM_NORMAL + Test + Arc_Test + + Test selected files or whole archive + + + + + + + + ../share/ico/16/repair.png; Load From File + wxID_ANY + wxITEM_NORMAL + Repair + Arc_Repair + + Repair selected files or whole archive + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + 0 + + tcFilter + protected + + + + + Show only files containing filter string + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer14 + wxVERTICAL + none + + 0 + wxEXPAND + 1 + + + + 1 + + + + wxID_ANY + + 0 + + window_splitter + protected + + 0.0 + 162 + -1 + + wxSPLIT_VERTICAL + wxSP_3D|wxSP_BORDER|wxSP_LIVE_UPDATE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + m_panel1 + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer19 + wxVERTICAL + none + + 1 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + TreeView + protected + + + wxTR_DEFAULT_STYLE|wxTR_HAS_BUTTONS|wxTR_HIDE_ROOT + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + m_panel2 + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer20 + wxVERTICAL + none + + 1 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + ListView + protected + + + wxLC_REPORT|wxLC_VIRTUAL + myListCtrl; + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.11.0