From 2d16fe747a9789dc74ba98903567113a53ef8674 Mon Sep 17 00:00:00 2001 From: sirakaba Date: Tue, 9 Nov 2010 13:09:02 +0000 Subject: [PATCH] =?utf8?q?=E5=8D=98=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?utf8?q?=E6=A0=BC=E7=B4=8D=E5=BD=A2=E5=BC=8F=E3=81=AE=E5=87=A6=E7=90=86?= =?utf8?q?=E3=81=AB=E3=81=8A=E3=81=84=E3=81=A6=E3=80=81=E6=9B=B8=E5=BA=AB?= =?utf8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E5=90=8D=E3=81=8B=E3=82=89?= =?utf8?q?=E6=A0=BC=E7=B4=8D=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E5=90=8D?= =?utf8?q?=E3=82=92=E7=94=9F=E6=88=90=E3=81=99=E3=82=8B=E6=A9=9F=E8=83=BD?= =?utf8?q?=E3=82=92=E8=BF=BD=E5=8A=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@428 9df91469-1e22-0410-86e7-ea8537beb833 --- doc/history.html | 3 ++- src/lychee/frm_main.cpp | 7 +++++++ src/plugin/7zArc/7zArc.cpp | 20 +++++++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/doc/history.html b/doc/history.html index c3439ba..ea99ee4 100644 --- a/doc/history.html +++ b/doc/history.html @@ -1,4 +1,4 @@ - + @@ -34,6 +34,7 @@
  • 書庫からクリップボードへファイルをコピーする機能を追加。
  • 書庫を複製する機能を追加。
  • ツリービューとリストビューでコンテキストメニューを表示する機能を追加。
  • +
  • 単ファイル格納形式の処理において、書庫ファイル名から格納ファイル名を生成する機能を追加。
  • ファイルを開く動作でアプリケーションが起動している間も、Lycheeのウインドウを操作できるよう変更。
  • 書庫閲覧時のメモリ使用量を削減。
  • 書庫のアイコンを変更。
  • diff --git a/src/lychee/frm_main.cpp b/src/lychee/frm_main.cpp index 8ff8498..816afd8 100644 --- a/src/lychee/frm_main.cpp +++ b/src/lychee/frm_main.cpp @@ -406,6 +406,13 @@ void MainFrame::OnArcOpen(wxCommandEvent& e) piInfo.fiInfo.fnFileName = wxFileName(szPath.AfterFirst(wxT('/')), piInfo.fiInfo.fnFileName.GetFullName(), wxPATH_DOS); } + // 拡張子のみ設定されている場合。 + if (piInfo.fiInfo.szStoredName.IsEmpty()) + { + piInfo.fiInfo.szStoredName = this->fnArchive.GetName() + wxT('.') + piInfo.fiInfo.fnFileName.GetExt(); + piInfo.fiInfo.fnFileName = wxFileName(piInfo.fiInfo.szStoredName); + } + // ツリービューに反映。 bool fDir = piInfo.fiInfo.dwAttribute & TPI_ATTRIBUTE_DIRECTORY ? true : false; TreeView_CheckNewerItem(this->tree_ctrl, idArcRoot, fDir ? piInfo.fiInfo.fnFileName.GetFullPath() : piInfo.fiInfo.fnFileName.GetPath(), true); diff --git a/src/plugin/7zArc/7zArc.cpp b/src/plugin/7zArc/7zArc.cpp index af94baf..57faf06 100644 --- a/src/plugin/7zArc/7zArc.cpp +++ b/src/plugin/7zArc/7zArc.cpp @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* TPI - flexible but useless plug-in framework. Copyright (C) 2002-2009 Silky @@ -117,13 +117,14 @@ int GetFileInformation2(void * _hArchive, TPI_FILEINFO * _fiInfo, wxULongLong_t if (prop.vt == VT_BSTR) { _fiInfo->szStoredName = WC2String(prop.bstrVal); + _fiInfo->fnFileName = wxFileName(_fiInfo->szStoredName, wxPATH_DOS); } else { hArc->GetProperty(nIndex, kpidExtension, & prop); - _fiInfo->szStoredName = wxT("data") + (prop.vt == VT_BSTR ? wxT(".") + WC2String(prop.bstrVal) : (wxString) wxEmptyString); + _fiInfo->szStoredName.Empty(); + _fiInfo->fnFileName.SetExt(WC2String(prop.bstrVal)); } - _fiInfo->fnFileName = wxFileName(_fiInfo->szStoredName, wxPATH_DOS); hArc->GetProperty(nIndex, kpidMethod, & prop); _fiInfo->szMethod = prop.vt == VT_BSTR ? WC2String(prop.bstrVal) : (wxString) wxEmptyString; hArc->GetProperty(nIndex, kpidComment, & prop); _fiInfo->szComment = prop.vt == VT_BSTR ? WC2String(prop.bstrVal) : (wxString) wxEmptyString; hArc->GetProperty(nIndex, kpidUser, & prop); _fiInfo->szUser = prop.vt == VT_BSTR ? WC2String(prop.bstrVal) : (wxString) wxEmptyString; @@ -384,6 +385,7 @@ public: int nErrorCode; TPI_SWITCHES * swInfo; + wxFileName fnArchive; private: int nMode; @@ -444,6 +446,12 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(unsigned int nIndex, ISequential this->piInfo.eMessage = TPI_MESSAGE_ASK; this->piInfo.eStatus = TPI_PARAM_DEST; GetFileInformation2(this->hArc, & this->piInfo.fiInfo, nIndex); + if (this->piInfo.fiInfo.szStoredName.IsEmpty()) + { + this->piInfo.fiInfo.szStoredName = this->fnArchive.GetName() + wxT('.') + this->piInfo.fiInfo.fnFileName.GetExt(); + this->piInfo.fiInfo.fnFileName = wxFileName(this->piInfo.fiInfo.szStoredName); + } + this->piInfo.fnDestination = wxFileName(swInfo->fnDestinationDirectory.GetFullPath() + wxFileName::GetPathSeparator() + (swInfo->fStoreDirectoryPathes ? this->piInfo.fiInfo.fnFileName.GetPath() : (wxString) wxEmptyString), this->piInfo.fiInfo.fnFileName.GetFullName()); if (g_prProc != NULL && g_prProc(TPI_NOTIFY_COMMON, & this->piInfo) != TPI_CALLBACK_CONTINUE) { @@ -968,10 +976,15 @@ int __stdcall Command // ファイル名からインデックスを取得。 TPI_FILEINFO fiInfo; CRecordVector nIndexes; + wxFileName fnArchive = wxFileName(_szArcName); if (GetFileInformation(hArc, & fiInfo, true) == TPI_ERROR_SUCCESS) { do { + if (fiInfo.szStoredName.IsEmpty()) + { + fiInfo.szStoredName = fnArchive.GetName() + wxT('.') + fiInfo.fnFileName.GetExt(); + } if (_szFiles.Index(fiInfo.szStoredName) != wxNOT_FOUND) { nIndexes.Add(fiInfo.nFileId); @@ -981,6 +994,7 @@ int __stdcall Command } CArchiveExtractCallback * extractCallbackSpec = new CArchiveExtractCallback(hArc,_swInfo); + extractCallbackSpec->fnArchive = fnArchive; CMyComPtr extractCallback(extractCallbackSpec); hArc->Extract(& nIndexes.Front(), nIndexes.Size(), _eCommand == TPI_COMMAND_TEST, extractCallback); nErrorCode = extractCallbackSpec->nErrorCode; -- 2.11.0