OSDN Git Service

Linux上でのDnD展開で、ファイル名が多バイト文字になっていた場合にコピーに失敗していたバグを修正。
[tpi/lychee.git] / src / lychee / frm_main.cpp
index c23e818..b988e9a 100644 (file)
@@ -142,7 +142,7 @@ void MainFrame::OnInit(wxInitDialogEvent&)
        this->tcFilter  = XRCCTRL(* this->toolbar, "tcFilter", wxTextCtrl);\r
 \r
        // 設定を読み込み。\r
-       this->SetSize(this->conf.ReadId(CONF_WINDOW_X, 0l), this->conf.ReadId(CONF_WINDOW_Y, 0l), this->conf.ReadId(CONF_WINDOW_WIDTH, 800l), this->conf.ReadId(CONF_WINDOW_HEIGHT, 400l));\r
+       this->SetSize(this->conf.ReadId(CONF_WINDOW_X, 0l), this->conf.ReadId(CONF_WINDOW_Y, 0l), this->conf.ReadId(CONF_WINDOW_WIDTH, 800l), this->conf.ReadId(CONF_WINDOW_HEIGHT, 400l), wxSIZE_ALLOW_MINUS_ONE);\r
        wxTheMimeTypesManager->Initialize(wxMAILCAP_ALL);\r
 \r
        // 初期値設定。\r
@@ -153,6 +153,7 @@ void MainFrame::OnInit(wxInitDialogEvent&)
        }\r
        wxCommandEvent e;\r
        this->OnArcClose(e);\r
+       this->SetDropTarget(new myFileDropTarget(this));\r
 \r
        // スプリッター設定。\r
        this->window_splitter->SetSashPosition(this->conf.ReadId(CONF_WINDOW_SPLITTER_POS, 200l));\r
@@ -175,7 +176,6 @@ void MainFrame::OnInit(wxInitDialogEvent&)
        this->list_ctrl->InsertColumn(9, _("No."),           wxLIST_FORMAT_RIGHT,  this->conf.ReadId(CONF_LISTVIEW_C_NO,        35l));\r
        g_nSortColumn = this->conf.ReadId(CONF_LISTVIEW_S_COLUMN, 9l);\r
        g_fSortAscend = this->conf.ReadId(CONF_LISTVIEW_S_ASCEND, true);\r
-       this->list_ctrl->SetDropTarget(new myFileDropTarget(this));\r
 \r
        // ツールバー/ステータスバー設定。\r
        int nStatusBarParts[] = {70, 70, 180, 50, -1};\r
@@ -240,7 +240,6 @@ void MainFrame::OnArcCreate(wxCommandEvent& e)
        this->fnArchive.SetPath(swInfo.fnDestinationDirectory.GetPath());\r
 \r
        // ダイアログを表示。\r
-       mkDlg.InitDialog();\r
        if (mkDlg.ShowModal() == wxID_CANCEL)\r
        {\r
                return;\r
@@ -252,6 +251,7 @@ void MainFrame::OnArcCreate(wxCommandEvent& e)
        swInfo.fSolid               = mkDlg.cbSolid->IsChecked();\r
        swInfo.fMMOptimize          = mkDlg.cbMMOptimize->IsChecked();\r
        swInfo.fEncryptHeader       = mkDlg.cbEncryptHeader->IsChecked();\r
+       swInfo.fCompressHeader      = mkDlg.cbCompressHeader->IsChecked();\r
        swInfo.nCompressLevel       = mkDlg.scLevel->GetValue();\r
        swInfo.nRecoveryRecord      = mkDlg.scRR->GetValue();\r
        swInfo.szPassword           = mkDlg.tcPassword->GetValue();\r
@@ -264,34 +264,42 @@ void MainFrame::OnArcCreate(wxCommandEvent& e)
        this->fnArchive = wxFileName(mkDlg.cbDir->GetValue(), mkDlg.cbFileName->GetValue());\r
        if (! tpi.InitLibrary(mkDlg.afInfo[nSelected].szTPIName, this->fnArchive.GetFullPath(), mkDlg.afInfo[nSelected].nTypeId))\r
        {\r
-               ::wxLogError(_("Error: %s!"), wxT("InitLibrary()!"));\r
+               wxLogError(_("Error: %s!"), wxT("InitLibrary()!"));\r
                return;\r
        }\r
 \r
        // コールバック関数を設定。\r
        if (! tpi.SetCallbackProc(TPICallbackProc))\r
        {\r
-               ::wxLogError(_("Error: %s!"), wxT("SetCallbackProc()!"));\r
+               wxLogError(_("Error: %s!"), wxT("SetCallbackProc()!"));\r
        }\r
 \r
        // 処理を行う。\r
-       ProcessDialog procDlg;\r
-       procDlg.InitDialog();\r
-       procDlg.Show(true);\r
-       if (! tpi.Command(TPI_COMMAND_CREATE, & swInfo, this->fnArchive.GetFullPath(), mkDlg.files))\r
        {\r
-               this->ErrorCheck(tpi.nErrorCode);\r
-               return;\r
+               ProcessDialog procDlg;\r
+               procDlg.Show(true);\r
+\r
+               // コールバックを送信。\r
+               TPI_PROCESSINFO piInfo;\r
+               piInfo.eMessage = TPI_MESSAGE_STATUS;\r
+               piInfo.eStatus = 0x1000;\r
+               piInfo.fiInfo.fnFileName = this->fnArchive;\r
+               piInfo.fiInfo.nUnpackedSize = mkDlg.files.GetCount();\r
+               procDlg.CallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
+\r
+               if (! tpi.Command(TPI_COMMAND_CREATE, & swInfo, this->fnArchive.GetFullPath(), mkDlg.files))\r
+               {\r
+                       this->ErrorCheck(tpi.nErrorCode);\r
+                       return;\r
+               }\r
+               procDlg.Show(false);\r
        }\r
-       procDlg.Show(false);\r
        tpi.FreeLibrary();\r
 \r
        if (mkDlg.cbOpenAfter->IsChecked())\r
        {\r
                // 作成先を開く。\r
-#ifdef __WINDOWS__\r
-               ::wxExecute(wxT("explorer ") + swInfo.fnDestinationDirectory.GetFullPath());\r
-#endif\r
+               ::wxExecute(DIR_APP + swInfo.fnDestinationDirectory.GetFullPath());\r
        }\r
 \r
        if (mkDlg.cbExitAfter->IsChecked())\r
@@ -323,7 +331,6 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
 \r
        // 進捗ダイアログ表示。\r
        ProcessDialog procDlg;\r
-       procDlg.InitDialog();\r
        procDlg.Show(true);\r
 \r
        // TPIを読み込み、最初のコールバックを送信。\r
@@ -332,15 +339,15 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
        piInfo.eStatus = 0x1000;\r
        piInfo.nProcessedSize = 0;\r
        piInfo.fiInfo.fnFileName = this->fnArchive;\r
-       piInfo.fiInfo.nUnpackedSize = this->LoadTPI(this->fnArchive.GetFullPath());\r
+       piInfo.fiInfo.nUnpackedSize = e.GetExtraLong() != 0 ? e.GetExtraLong() : this->LoadTPI(this->fnArchive.GetFullPath());\r
        if (piInfo.fiInfo.nUnpackedSize == 0)\r
        {\r
                procDlg.Show(false);\r
                tpi.FreeLibrary();\r
-               ::wxLogError(_("No plug-in supporting this archive was found!"));\r
+               wxLogError(_("No plug-in supporting this archive was found!"));\r
                return;\r
        }\r
-       TPICallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
+       procDlg.CallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
 \r
        // 配列のサイズを確保。\r
        this->fileinfo.Alloc(piInfo.fiInfo.nUnpackedSize);\r
@@ -350,7 +357,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
        {\r
                procDlg.Show(false);\r
                tpi.FreeLibrary();\r
-               ::wxLogError(_("Error: %s!"), wxT("OpenArchive()"));\r
+               wxLogError(_("Error: %s!"), wxT("OpenArchive()"));\r
                return;\r
        }\r
 \r
@@ -379,7 +386,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
                do\r
                {\r
                        piInfo.nProcessedSize++;\r
-                       if (this->ErrorCheck(TPICallbackProc(TPI_NOTIFY_COMMON, & piInfo)) == TPI_CALLBACK_CANCEL)\r
+                       if (this->ErrorCheck(procDlg.CallbackProc(TPI_NOTIFY_COMMON, & piInfo)) == TPI_CALLBACK_CANCEL)\r
                        {\r
                                procDlg.Show(false);\r
                                tpi.CloseArchive();\r
@@ -402,13 +409,13 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
                        if (piInfo.fiInfo.fnFileName.GetPathWithSep().Find(wxT("..")) != wxNOT_FOUND)\r
                        {\r
                                piInfo.fiInfo.eDanger = TRUE;\r
-                               ::wxLogWarning(_("This archive may have Directory Traversal Vulnerability(DTV) problem, and some danger files may be extracted to the unexpected system directory! You should use the \"Ignore file pathes\" option when extracting this archive.\nDanger file is:\n%s"), piInfo.fiInfo.fnFileName.GetFullPath().c_str());\r
+                               wxLogWarning(_("This archive may have Directory Traversal Vulnerability(DTV) problem, and some danger files may be extracted to the unexpected system directory! You should use the \"Ignore file pathes\" option when extracting this archive.\nDanger file is:\n%s"), piInfo.fiInfo.fnFileName.GetFullPath().c_str());\r
                        }\r
                        // 空白の連続による拡張子偽装を検査。\r
                        if (piInfo.fiInfo.fnFileName.GetFullName().Find(wxT("        ")) != wxNOT_FOUND)\r
                        {\r
                                piInfo.fiInfo.eDanger = TRUE;\r
-                               ::wxLogWarning(_("This archive may contain extension-disguised files whose real extension is hidden by using many blank charactor and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:\n%s"), piInfo.fiInfo.fnFileName.GetFullPath().c_str());\r
+                               wxLogWarning(_("This archive may contain extension-disguised files whose real extension is hidden by using many blank charactor and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:\n%s"), piInfo.fiInfo.fnFileName.GetFullPath().c_str());\r
                        }\r
                        // Unicode制御文字を検査。\r
                        for (wxChar c = 0x200c; c <= 0x206f; c++)\r
@@ -416,7 +423,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
                                if (piInfo.fiInfo.fnFileName.GetFullName().Find(c) != wxNOT_FOUND)\r
                                {\r
                                        piInfo.fiInfo.eDanger = TRUE;\r
-                                       ::wxLogWarning(_("This archive may contain extension-disguised files whose real extension is hidden by using Unicode control character and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:\n%s"), piInfo.fiInfo.fnFileName.GetFullPath().c_str());\r
+                                       wxLogWarning(_("This archive may contain extension-disguised files whose real extension is hidden by using Unicode control character and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:\n%s"), piInfo.fiInfo.fnFileName.GetFullPath().c_str());\r
                                }\r
                                switch (c)\r
                                {\r
@@ -434,19 +441,19 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
        // GetFileInformationがエラー終了した場合。\r
        if (tpi.nErrorCode != TPI_ERROR_S_ENDOFDATA)\r
        {\r
-               ::wxLogError(_("Error: %s!"), wxT("GetFileInformation()"));\r
+               wxLogError(_("Error: %s!"), wxT("GetFileInformation()"));\r
        }\r
 \r
        // 書庫の情報を取得。\r
        if (! tpi.GetArchiveInformation(& this->aiArchive))\r
        {\r
-               ::wxLogError(_("Error: %s!"), wxT("GetArchiveInformation()"));\r
+               wxLogError(_("Error: %s!"), wxT("GetArchiveInformation()"));\r
        }\r
 \r
        // 書庫を閉じる。\r
        if (! tpi.CloseArchive())\r
        {\r
-               ::wxLogError(_("Error: %s!"), wxT("CloseArchive()"));\r
+               wxLogError(_("Error: %s!"), wxT("CloseArchive()"));\r
        }\r
 \r
        // 以下、UI処理。\r
@@ -477,7 +484,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
        procDlg.Show(false);\r
 }\r
 \r
-void MainFrame::OnArcClose(wxCommandEvent&)\r
+void MainFrame::OnArcClose(wxCommandEvent& e)\r
 {\r
        // ツリービュー・リストビュー設定。\r
        this->tree_ctrl->DeleteAllItems();\r
@@ -509,7 +516,12 @@ void MainFrame::OnArcClose(wxCommandEvent&)
        g_hIconT.RemoveAll();\r
        g_hIconLL.RemoveAll();\r
        g_hIconLS.RemoveAll();\r
-       this->tpi.FreeLibrary();\r
+\r
+       // DnDで書庫を開くときは既に読み込まれているTPIを用いるので、解放してはいけない。\r
+       if (e.GetExtraLong() == 0)\r
+       {\r
+               this->tpi.FreeLibrary();\r
+       }\r
 }\r
 \r
 void MainFrame::OnArcAdd(wxCommandEvent& e)\r
@@ -531,7 +543,6 @@ void MainFrame::OnArcAdd(wxCommandEvent& e)
        this->conf.WriteHistory(CONF_HISTORY_PATH, fd.GetDirectory());\r
 \r
        // ダイアログを表示。\r
-       mkDlg.InitDialog();\r
        if (mkDlg.ShowModal() == wxID_CANCEL)\r
        {\r
                return;\r
@@ -552,21 +563,30 @@ void MainFrame::OnArcAdd(wxCommandEvent& e)
        swInfo.szKeyFile            = mkDlg.tcKeyfile->GetValue();\r
        swInfo.szComment            = mkDlg.tcComment->GetValue();\r
 \r
-       ProcessDialog procDlg;\r
-       procDlg.InitDialog();\r
-       procDlg.Show(true);\r
-       if (! this->tpi.Command(TPI_COMMAND_ADD, & swInfo, this->fnArchive.GetFullPath(), mkDlg.files))\r
+       // 処理を行う。\r
        {\r
-               this->ErrorCheck(tpi.nErrorCode);\r
+               ProcessDialog procDlg;\r
+               procDlg.Show(true);\r
+\r
+               // コールバックを送信。\r
+               TPI_PROCESSINFO piInfo;\r
+               piInfo.eMessage = TPI_MESSAGE_STATUS;\r
+               piInfo.eStatus = 0x1000;\r
+               piInfo.fiInfo.fnFileName = this->fnArchive;\r
+               piInfo.fiInfo.nUnpackedSize = mkDlg.files.GetCount();\r
+               procDlg.CallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
+\r
+               if (! tpi.Command(TPI_COMMAND_ADD, & swInfo, this->fnArchive.GetFullPath(), mkDlg.files))\r
+               {\r
+                       this->ErrorCheck(tpi.nErrorCode);\r
+               }\r
+               procDlg.Show(false);\r
        }\r
-       procDlg.Show(false);\r
 \r
        if (mkDlg.cbOpenAfter->IsChecked())\r
        {\r
                // 作成先を開く。\r
-#ifdef __WINDOWS__\r
-               ::wxExecute(wxT("explorer ") + swInfo.fnDestinationDirectory.GetFullPath());\r
-#endif\r
+               ::wxExecute(DIR_APP + swInfo.fnDestinationDirectory.GetFullPath());\r
        }\r
 \r
        if (mkDlg.cbExitAfter->IsChecked())\r
@@ -598,7 +618,6 @@ void MainFrame::OnArcConvert(wxCommandEvent& e)
        files.Add(fd.GetPath());\r
 \r
        ProcessDialog procDlg;\r
-       procDlg.InitDialog();\r
        procDlg.Show(true);\r
        if (! this->tpi.Command(swInfo.fMakeSFX ? TPI_COMMAND_SFX : TPI_COMMAND_UNSFX, & swInfo, this->fnArchive.GetFullPath(), files))\r
        {\r
@@ -636,7 +655,7 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                                ftFile = wxTheMimeTypesManager->GetFileTypeFromExtension(this->conf.ReadId(CONF_DEFAULT_EXT, (wxString) wxT("txt")));\r
                                if (! ftFile)\r
                                {\r
-                                       ::wxLogError(_("Unable to get the file type!"));\r
+                                       wxLogError(_("Unable to get the file type!"));\r
                                        return;\r
                                }\r
                        }\r
@@ -645,21 +664,21 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                // 作業ディレクトリ作成。\r
                swInfo.fStoreDirectoryPathes = false;\r
                wxString szDestDirBase = nMode == 3 ? this->tree_ctrl->GetItemText(this->tree_ctrl->GetSelection()) : wxT("tpi_tmp");\r
+               wxStandardPaths p;\r
                if (szDestDirBase == wxT("-----"))\r
                {\r
                        // 書庫ルートのときは書庫名にしておく。\r
                        szDestDirBase = this->fnArchive.GetName();\r
                }\r
-               swInfo.fnDestinationDirectory = MakeDirPath(wxFileName::DirName(::wxGetCwd()), szDestDirBase, true);\r
+               swInfo.fnDestinationDirectory = MakeDirPath(wxFileName::DirName(p.GetTempDir()), szDestDirBase, true);\r
                if (! swInfo.fnDestinationDirectory.IsOk())\r
                {\r
-                       ::wxLogError(_("Unable to make the temporary directory!"));\r
+                       wxLogError(_("Unable to make the temporary directory!"));\r
                        return;\r
                }\r
        }\r
        else\r
        {\r
-               mkDlg.InitDialog();\r
                if (mkDlg.ShowModal() == wxID_CANCEL)\r
                {\r
                        return;\r
@@ -677,29 +696,38 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                        swInfo.fnDestinationDirectory = MakeDirPath(swInfo.fnDestinationDirectory, this->fnArchive.GetName(), true);\r
                        if (! swInfo.fnDestinationDirectory.IsOk())\r
                        {\r
-                               ::wxLogError(_("Unable to make the destination directory!"));\r
+                               wxLogError(_("Unable to make the destination directory!"));\r
                                return;\r
                        }\r
                }\r
        }\r
 \r
-       ProcessDialog procDlg;\r
-       procDlg.InitDialog();\r
-       procDlg.Show(true);\r
-       if (! this->tpi.Command(TPI_COMMAND_EXTRACT, & swInfo, this->fnArchive.GetFullPath(), mkDlg.files))\r
+       // 処理を行う。\r
        {\r
-               this->ErrorCheck(tpi.nErrorCode);\r
+               ProcessDialog procDlg;\r
+               procDlg.Show(true);\r
+\r
+               // コールバックを送信。\r
+               TPI_PROCESSINFO piInfo;\r
+               piInfo.eMessage = TPI_MESSAGE_STATUS;\r
+               piInfo.eStatus = 0x1000;\r
+               piInfo.fiInfo.fnFileName = this->fnArchive;\r
+               piInfo.fiInfo.nUnpackedSize = mkDlg.files.GetCount();\r
+               procDlg.CallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
+\r
+               if (! tpi.Command(TPI_COMMAND_EXTRACT, & swInfo, this->fnArchive.GetFullPath(), mkDlg.files))\r
+               {\r
+                       this->ErrorCheck(tpi.nErrorCode);\r
+               }\r
+               procDlg.Show(false);\r
        }\r
-       procDlg.Show(false);\r
 \r
        if (nMode == 0)\r
        {\r
                if (mkDlg.cbOpenAfter->IsChecked())\r
                {\r
                        // 展開先を開く。\r
-#ifdef __WINDOWS__\r
-                       ::wxExecute(wxT("explorer ") + swInfo.fnDestinationDirectory.GetFullPath());\r
-#endif\r
+                       ::wxExecute(DIR_APP + swInfo.fnDestinationDirectory.GetFullPath());\r
                }\r
 \r
                if (mkDlg.cbExitAfter->IsChecked())\r
@@ -727,8 +755,12 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                }\r
                else\r
                {\r
-                       // 展開対象を決定。\r
+                       // 展開対象を決定。wxGTKのwxFileDataObjectでは多バイト文字の扱いに問題があるので代替。\r
+#ifdef __LINUX__\r
+                       myFileDataObject objFile;\r
+#else\r
                        wxFileDataObject objFile;\r
+#endif\r
                        for (size_t i = 0; i < mkDlg.files.GetCount(); i++)\r
                        {\r
                                wxString szFileName = swInfo.fnDestinationDirectory.GetPathWithSep() + wxFileName(mkDlg.files[i], wxPATH_DOS).GetFullName();\r
@@ -744,15 +776,20 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                                objFile.AddFile(swInfo.fnDestinationDirectory.GetPath());\r
                        }\r
 \r
+                       // 自身にドロップされると煩雑なので、一時的にドロップを受け付けないようにしておく。\r
+                       this->SetDropTarget(NULL);\r
+\r
                        // DnD開始。\r
                        wxDropSource dropSource(objFile, this);\r
-                       if (dropSource.DoDragDrop() != wxDragMove)\r
+                       wxDragResult drResult = dropSource.DoDragDrop(wxDrag_DefaultMove);\r
+                       if (drResult != wxDragCancel && drResult != wxDragNone && drResult != wxDragMove)\r
                        {\r
 #ifdef __LINUX__\r
                                // Linuxではまだ処理が終わっていない(コンテキストメニューが表示されている)ので、とりあえず3秒だけ待つ。\r
                                sleep(3);\r
 #endif\r
                        }\r
+                       this->SetDropTarget(new myFileDropTarget(this));\r
                }\r
 \r
                // ファイルと一時ディレクトリを削除。\r
@@ -777,16 +814,27 @@ void MainFrame::OnArcDelete(wxCommandEvent& e)
                return;\r
        }\r
 \r
-       // 各種設定。\r
-       TPI_SWITCHES swInfo;\r
-       ProcessDialog procDlg;\r
-       procDlg.InitDialog();\r
-       procDlg.Show(true);\r
-       if (! this->tpi.Command(TPI_COMMAND_DELETE, & swInfo, this->fnArchive.GetFullPath(), MakeTargetFileList(this, false)))\r
+       // 処理を行う。\r
        {\r
-               this->ErrorCheck(tpi.nErrorCode);\r
+               TPI_SWITCHES swInfo;\r
+               ProcessDialog procDlg;\r
+               procDlg.Show(true);\r
+               wxArrayString asFiles = MakeTargetFileList(this, false);\r
+\r
+               // コールバックを送信。\r
+               TPI_PROCESSINFO piInfo;\r
+               piInfo.eMessage = TPI_MESSAGE_STATUS;\r
+               piInfo.eStatus = 0x1000;\r
+               piInfo.fiInfo.fnFileName = this->fnArchive;\r
+               piInfo.fiInfo.nUnpackedSize = asFiles.GetCount();\r
+               procDlg.CallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
+\r
+               if (! tpi.Command(TPI_COMMAND_DELETE, & swInfo, this->fnArchive.GetFullPath(), asFiles))\r
+               {\r
+                       this->ErrorCheck(tpi.nErrorCode);\r
+               }\r
+               procDlg.Show(false);\r
        }\r
-       procDlg.Show(false);    \r
 \r
        // 書庫を再読み込みする。\r
        this->OnArcOpen(e);\r
@@ -794,15 +842,26 @@ void MainFrame::OnArcDelete(wxCommandEvent& e)
 \r
 void MainFrame::OnArcTest(wxCommandEvent&)\r
 {\r
-       TPI_SWITCHES swInfo;\r
+       // 処理を行う。\r
        ProcessDialog procDlg;\r
-       procDlg.InitDialog();\r
        procDlg.Show(true);\r
-       bool bIsCorrect = this->tpi.Command(TPI_COMMAND_TEST, & swInfo, this->fnArchive.GetFullPath(), MakeTargetFileList(this, false));\r
+       wxArrayString asFiles = MakeTargetFileList(this, false);\r
+\r
+       // コールバックを送信。\r
+       TPI_PROCESSINFO piInfo;\r
+       piInfo.eMessage = TPI_MESSAGE_STATUS;\r
+       piInfo.eStatus = 0x1000;\r
+       piInfo.fiInfo.fnFileName = this->fnArchive;\r
+       piInfo.fiInfo.nUnpackedSize = asFiles.GetCount();\r
+       procDlg.CallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
+\r
+       TPI_SWITCHES swInfo;\r
+       bool bIsCorrect = tpi.Command(TPI_COMMAND_TEST, & swInfo, this->fnArchive.GetFullPath(), asFiles);\r
        procDlg.Show(false);\r
+\r
        if (bIsCorrect)\r
        {\r
-               ::wxLogMessage(_("This is a correct archive."));\r
+               wxLogMessage(_("This is a correct archive."));\r
        }\r
        else\r
        {\r
@@ -812,11 +871,21 @@ void MainFrame::OnArcTest(wxCommandEvent&)
 \r
 void MainFrame::OnArcRepair(wxCommandEvent&)\r
 {\r
-       TPI_SWITCHES swInfo;\r
+       // 処理を行う。\r
        ProcessDialog procDlg;\r
-       procDlg.InitDialog();\r
        procDlg.Show(true);\r
-       if (! this->tpi.Command(TPI_COMMAND_REPAIR, & swInfo, this->fnArchive.GetFullPath(), MakeTargetFileList(this, false)))\r
+       wxArrayString asFiles = MakeTargetFileList(this, false);\r
+\r
+       // コールバックを送信。\r
+       TPI_PROCESSINFO piInfo;\r
+       piInfo.eMessage = TPI_MESSAGE_STATUS;\r
+       piInfo.eStatus = 0x1000;\r
+       piInfo.fiInfo.fnFileName = this->fnArchive;\r
+       piInfo.fiInfo.nUnpackedSize = asFiles.GetCount();\r
+       procDlg.CallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
+\r
+       TPI_SWITCHES swInfo;\r
+       if (! this->tpi.Command(TPI_COMMAND_REPAIR, & swInfo, this->fnArchive.GetFullPath(), asFiles))\r
        {\r
                this->ErrorCheck(tpi.nErrorCode);\r
        }\r
@@ -986,14 +1055,14 @@ int MainFrame::ErrorCheck(int nErrorCode)
        case TPI_CALLBACK_CONTINUE:\r
                break;\r
        case TPI_ERROR_D_UNSUPPORTED:\r
-               ::wxLogError(_("Sorry, this function is not supported yet."));\r
+               wxLogError(_("Sorry, this function is not supported yet."));\r
                break;\r
        case TPI_ERROR_D_SKIPPED:\r
        case TPI_CALLBACK_CANCEL:\r
-               ::wxLogError(_("This operation is canceled by the user."));\r
+               wxLogError(_("This operation is canceled by the user."));\r
                break;\r
        default:\r
-               ::wxLogError(_("Error code: %d"), nErrorCode);\r
+               wxLogError(_("Error code: %d"), nErrorCode);\r
        }\r
        return nErrorCode;\r
 }\r