OSDN Git Service

Linux上でのDnD展開で、ファイル名が多バイト文字になっていた場合にコピーに失敗していたバグを修正。
[tpi/lychee.git] / src / lychee / frm_main.cpp
index 417e7a7..b988e9a 100644 (file)
@@ -45,7 +45,7 @@ bool g_fSortAscend;
 // MainFrame\r
 //******************************************************************************\r
 \r
-MainFrame::MainFrame(): wxFrame(), conf(wxEmptyString, wxEmptyString, L_DIR_BIN wxT("lychee.conf"), wxEmptyString, wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH)\r
+MainFrame::MainFrame(): wxFrame()\r
 {\r
 }\r
 \r
@@ -59,34 +59,34 @@ MainFrame::~MainFrame()
        {\r
                int a, b;\r
                this->GetSize(& a, & b);\r
-               this->conf.Write(wxT("Window-Width"), a);\r
-               this->conf.Write(wxT("Window-Height"), b);\r
+               this->conf.WriteId(CONF_WINDOW_WIDTH,  a);\r
+               this->conf.WriteId(CONF_WINDOW_HEIGHT, b);\r
                this->GetPosition(& a, & b);\r
-               this->conf.Write(wxT("Window-X"), a);\r
-               this->conf.Write(wxT("Window-Y"), b);\r
+               this->conf.WriteId(CONF_WINDOW_X, a);\r
+               this->conf.WriteId(CONF_WINDOW_Y, b);\r
        }\r
-       this->conf.Write(wxT("Splitter-Pos"), this->window_splitter->GetSashPosition());\r
+       this->conf.WriteId(CONF_WINDOW_SPLITTER_POS, this->window_splitter->GetSashPosition());\r
 \r
        // ツールバー/ステータスバー関連。\r
-       this->conf.Write(wxT("StatusBar-Show"), this->statusbar->IsShown());\r
-       this->conf.Write(wxT("ToolBar-Show"),   this->toolbar->IsShown());\r
+       this->conf.WriteId(CONF_WINDOW_STATUSBAR, this->statusbar->IsShown());\r
+       this->conf.WriteId(CONF_WINDOW_TOOLBAR,   this->toolbar->IsShown());\r
 \r
        // ListView関連。\r
-       this->conf.Write(wxT("ListView-IconMode"), this->menubar->IsChecked(XRCID("Exe_View_Icons")) ? 1 : this->menubar->IsChecked(XRCID("Exe_View_List")) ? 2 : 0);\r
+       this->conf.WriteId(CONF_LISTVIEW_SHOWMODE, this->menubar->IsChecked(XRCID("Exe_View_Icons")) ? 1 : this->menubar->IsChecked(XRCID("Exe_View_List")) ? 2 : 0);\r
        if (this->menubar->IsChecked(XRCID("Exe_View_Details")))\r
        {\r
-               this->conf.Write(wxT("ListView-C-Filename"), this->list_ctrl->GetColumnWidth(0));\r
-               this->conf.Write(wxT("ListView-C-Unpacked"), this->list_ctrl->GetColumnWidth(1));\r
-               this->conf.Write(wxT("ListView-C-Packed"), this->list_ctrl->GetColumnWidth(2));\r
-               this->conf.Write(wxT("ListView-C-Ratio"), this->list_ctrl->GetColumnWidth(3));\r
-               this->conf.Write(wxT("ListView-C-Method"), this->list_ctrl->GetColumnWidth(4));\r
-               this->conf.Write(wxT("ListView-C-Attr"), this->list_ctrl->GetColumnWidth(5));\r
-               this->conf.Write(wxT("ListView-C-Lastmodified"), this->list_ctrl->GetColumnWidth(6));\r
-               this->conf.Write(wxT("ListView-C-Path"), this->list_ctrl->GetColumnWidth(7));\r
-               this->conf.Write(wxT("ListView-C-Type"), this->list_ctrl->GetColumnWidth(8));\r
-               this->conf.Write(wxT("ListView-C-No"), this->list_ctrl->GetColumnWidth(9));\r
-               this->conf.Write(wxT("ListView-SortColumn"), g_nSortColumn);\r
-               this->conf.Write(wxT("ListView-SortAscend"), g_fSortAscend);\r
+               this->conf.WriteId(CONF_LISTVIEW_C_FILENAME, this->list_ctrl->GetColumnWidth(0));\r
+               this->conf.WriteId(CONF_LISTVIEW_C_UNPACKED, this->list_ctrl->GetColumnWidth(1));\r
+               this->conf.WriteId(CONF_LISTVIEW_C_PACKED,   this->list_ctrl->GetColumnWidth(2));\r
+               this->conf.WriteId(CONF_LISTVIEW_C_RATIO,    this->list_ctrl->GetColumnWidth(3));\r
+               this->conf.WriteId(CONF_LISTVIEW_C_METHOD,   this->list_ctrl->GetColumnWidth(4));\r
+               this->conf.WriteId(CONF_LISTVIEW_C_ATTR,         this->list_ctrl->GetColumnWidth(5));\r
+               this->conf.WriteId(CONF_LISTVIEW_C_LASTMOD,  this->list_ctrl->GetColumnWidth(6));\r
+               this->conf.WriteId(CONF_LISTVIEW_C_PATH,     this->list_ctrl->GetColumnWidth(7));\r
+               this->conf.WriteId(CONF_LISTVIEW_C_TYPE,     this->list_ctrl->GetColumnWidth(8));\r
+               this->conf.WriteId(CONF_LISTVIEW_C_NO,       this->list_ctrl->GetColumnWidth(9));\r
+               this->conf.WriteId(CONF_LISTVIEW_S_COLUMN,   g_nSortColumn);\r
+               this->conf.WriteId(CONF_LISTVIEW_S_ASCEND,   g_fSortAscend);\r
        }\r
 \r
        this->Close(true);\r
@@ -142,11 +142,10 @@ void MainFrame::OnInit(wxInitDialogEvent&)
        this->tcFilter  = XRCCTRL(* this->toolbar, "tcFilter", wxTextCtrl);\r
 \r
        // 設定を読み込み。\r
-       this->SetSize(this->conf.Read(wxT("Window-X"), 0l), this->conf.Read(wxT("Window-Y"), 0l), this->conf.Read(wxT("Window-Width"), 800), this->conf.Read(wxT("Window-Height"), 400));\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
-\r
        {\r
                wxIcon icon;\r
                icon.CopyFromBitmap(wxBitmap(L_DIR_S_ICO wxT("app.png"), wxBITMAP_TYPE_ANY));\r
@@ -154,65 +153,40 @@ 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.Read(wxT("Splitter-Pos"), 200));\r
+       this->window_splitter->SetSashPosition(this->conf.ReadId(CONF_WINDOW_SPLITTER_POS, 200l));\r
 \r
        // リストビュー設定。\r
-       int nIconMode = this->conf.Read(wxT("ListView-IconMode"), 0l);\r
+       int nIconMode = this->conf.ReadId(CONF_LISTVIEW_SHOWMODE, 0l);\r
        e.SetId(nIconMode == 1 ? XRCID("Exe_View_Icons") : (nIconMode == 2 ? XRCID("Exe_View_List") : XRCID("Exe_View_Details")));\r
        this->OnViewMode(e);\r
        // wxGTKでは直接wxLC_VIRTUALを指定しないと反映されない。\r
        this->list_ctrl->SetSingleStyle(wxLC_VIRTUAL);\r
-       this->list_ctrl->InsertColumn(0, _("Filename"),      wxLIST_FORMAT_LEFT,   this->conf.Read(wxT("ListView-C-Filename"), 140));\r
-       this->list_ctrl->InsertColumn(1, _("Unpacked"),      wxLIST_FORMAT_RIGHT,  this->conf.Read(wxT("ListView-C-Unpacked"), 80));\r
-       this->list_ctrl->InsertColumn(2, _("Packed"),        wxLIST_FORMAT_RIGHT,  this->conf.Read(wxT("ListView-C-Packed"), 80));\r
-       this->list_ctrl->InsertColumn(3, _("Ratio"),         wxLIST_FORMAT_RIGHT,  this->conf.Read(wxT("ListView-C-Ratio"), 50));\r
-       this->list_ctrl->InsertColumn(4, _("Method"),        wxLIST_FORMAT_LEFT,   this->conf.Read(wxT("ListView-C-Method"), 60));\r
-       this->list_ctrl->InsertColumn(5, _("Attr"),          wxLIST_FORMAT_LEFT,   this->conf.Read(wxT("ListView-C-Attr"), 50));\r
-       this->list_ctrl->InsertColumn(6, _("Last modified"), wxLIST_FORMAT_RIGHT,  this->conf.Read(wxT("ListView-C-Lastmodified"), 150));\r
-       this->list_ctrl->InsertColumn(7, _("Path"),          wxLIST_FORMAT_LEFT,   this->conf.Read(wxT("ListView-C-Path"), 100));\r
-       this->list_ctrl->InsertColumn(8, _("Type"),          wxLIST_FORMAT_LEFT,   this->conf.Read(wxT("ListView-C-Type"), 100));\r
-       this->list_ctrl->InsertColumn(9, _("No."),           wxLIST_FORMAT_RIGHT,  this->conf.Read(wxT("ListView-C-No"), 35));\r
-       g_nSortColumn = this->conf.Read(wxT("ListView-SortColumn"), 9);\r
-       g_fSortAscend = this->conf.Read(wxT("ListView-SortAscend"), 1) == 1;\r
-       this->list_ctrl->SetDropTarget(new myFileDropTarget(this));\r
+       this->list_ctrl->InsertColumn(0, _("Filename"),      wxLIST_FORMAT_LEFT,   this->conf.ReadId(CONF_LISTVIEW_C_FILENAME, 140l));\r
+       this->list_ctrl->InsertColumn(1, _("Unpacked"),      wxLIST_FORMAT_RIGHT,  this->conf.ReadId(CONF_LISTVIEW_C_UNPACKED,  80l));\r
+       this->list_ctrl->InsertColumn(2, _("Packed"),        wxLIST_FORMAT_RIGHT,  this->conf.ReadId(CONF_LISTVIEW_C_PACKED,    80l));\r
+       this->list_ctrl->InsertColumn(3, _("Ratio"),         wxLIST_FORMAT_RIGHT,  this->conf.ReadId(CONF_LISTVIEW_C_RATIO,     50l));\r
+       this->list_ctrl->InsertColumn(4, _("Method"),        wxLIST_FORMAT_LEFT,   this->conf.ReadId(CONF_LISTVIEW_C_METHOD,    60l));\r
+       this->list_ctrl->InsertColumn(5, _("Attr"),          wxLIST_FORMAT_LEFT,   this->conf.ReadId(CONF_LISTVIEW_C_ATTR,      50l));\r
+       this->list_ctrl->InsertColumn(6, _("Last modified"), wxLIST_FORMAT_RIGHT,  this->conf.ReadId(CONF_LISTVIEW_C_LASTMOD,  150l));\r
+       this->list_ctrl->InsertColumn(7, _("Path"),          wxLIST_FORMAT_LEFT,   this->conf.ReadId(CONF_LISTVIEW_C_PATH,     100l));\r
+       this->list_ctrl->InsertColumn(8, _("Type"),          wxLIST_FORMAT_LEFT,   this->conf.ReadId(CONF_LISTVIEW_C_TYPE,     100l));\r
+       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
 \r
        // ツールバー/ステータスバー設定。\r
        int nStatusBarParts[] = {70, 70, 180, 50, -1};\r
        this->statusbar->SetFieldsCount(5, nStatusBarParts);\r
        this->SetStatusBarPane(-1);\r
-       bool fShow = this->conf.Read(wxT("StatusBar-Show"), 1) == 1;\r
+       bool fShow = this->conf.ReadId(CONF_WINDOW_STATUSBAR, true);\r
        this->menubar->Check(XRCID("Exe_View_StatusBar"), fShow);\r
        this->statusbar->Show(fShow);\r
-       fShow = this->conf.Read(wxT("ToolBar-Show"), 1) == 1;\r
+       fShow = this->conf.ReadId(CONF_WINDOW_TOOLBAR, true);\r
        this->menubar->Check(XRCID("Exe_View_ToolBar"), fShow);\r
        this->toolbar->Show(fShow);\r
-\r
-       // コマンドライン読み込み。\r
-       this->cmdLine.SetSwitchChars(wxT("-"));\r
-       this->cmdLine.AddSwitch(wxT("x"), wxEmptyString, _("(command) Extract filenames in archive."));\r
-       this->cmdLine.AddSwitch(wxT("l"), wxEmptyString, _("(command) List archive(default)."));\r
-       this->cmdLine.AddParam(_("archive"),   wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);\r
-       this->cmdLine.AddParam(_("filenames"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE);\r
-       if (this->cmdLine.Parse() == 0)\r
-       {\r
-               if (this->cmdLine.GetParamCount() == 0)\r
-               {\r
-                       return;\r
-               }\r
-\r
-               // 書庫を開く。\r
-               this->fnArchive = wxFileName(this->cmdLine.GetParam(0));\r
-               this->fnArchive.Normalize(wxPATH_NORM_ALL, this->szCurrentPath);\r
-               this->OnArcOpen(e);\r
-               if (this->cmdLine.Found(wxT("x")))\r
-               {\r
-                       // 書庫を展開。\r
-                       this->OnArcExtract(e);\r
-                       this->Close(true);\r
-               }\r
-       }\r
 }\r
 \r
 // MenuBar\r
@@ -235,16 +209,14 @@ void MainFrame::OnArcCreate(wxCommandEvent& e)
        if (e.GetClientData() == NULL)\r
        {\r
                // 処理対象のファイルを選択。\r
-               wxFileDialog fd(this, _("Choose files to compress"), this->conf.Read(wxT("LastOpenPath"), ::wxGetCwd()));\r
+               wxFileDialog fd(this, _("Choose files to compress"), this->conf.ReadHistory(CONF_HISTORY_PATH, 0));\r
                fd.SetWindowStyleFlag(wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);\r
                if (fd.ShowModal() == wxID_CANCEL)\r
                {\r
                        return;\r
                }\r
                swInfo.fnDestinationDirectory = wxFileName::DirName(fd.GetDirectory());\r
-               this->conf.Write(wxT("LastOpenPath"), fd.GetDirectory());\r
-               this->statusbar->SetStatusText(swInfo.fnDestinationDirectory.GetFullPath(), 4);\r
-\r
+               this->conf.WriteHistory(CONF_HISTORY_PATH, fd.GetDirectory());\r
                fd.GetFilenames(mkDlg.files);\r
        }\r
        else\r
@@ -255,13 +227,8 @@ void MainFrame::OnArcCreate(wxCommandEvent& e)
                for (size_t n = 0; n < mkDlg.files.GetCount(); n++)\r
                {\r
                        wxFileName fn(mkDlg.files[n]);\r
-                       bool fIsDir = fn.DirExists() && ! fn.FileExists();\r
                        fn.MakeRelativeTo(swInfo.fnDestinationDirectory.GetPath());\r
                        mkDlg.files[n] = fn.GetFullPath();\r
-                       if (fIsDir)\r
-                       {\r
-                               mkDlg.files[n] += fn.GetPathSeparator();\r
-                       }\r
                }\r
        }\r
 \r
@@ -273,13 +240,10 @@ void MainFrame::OnArcCreate(wxCommandEvent& e)
        this->fnArchive.SetPath(swInfo.fnDestinationDirectory.GetPath());\r
 \r
        // ダイアログを表示。\r
-       mkDlg.InitDialog();\r
        if (mkDlg.ShowModal() == wxID_CANCEL)\r
        {\r
-               this->statusbar->SetStatusText(wxEmptyString, 4);\r
                return;\r
        }\r
-       this->statusbar->SetStatusText(wxEmptyString, 4);\r
 \r
        // 各種設定。\r
        swInfo.fStoreDirectoryPathes= ! mkDlg.cbIgnorePath->IsChecked();\r
@@ -287,50 +251,55 @@ void MainFrame::OnArcCreate(wxCommandEvent& e)
        swInfo.fSolid               = mkDlg.cbSolid->IsChecked();\r
        swInfo.fMMOptimize          = mkDlg.cbMMOptimize->IsChecked();\r
        swInfo.fEncryptHeader       = mkDlg.cbEncryptHeader->IsChecked();\r
-       swInfo.sCompressLevel       = mkDlg.scLevel->GetValue();\r
-       swInfo.sRecoveryRecord      = mkDlg.scRR->GetValue();\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
        swInfo.szKeyFile            = mkDlg.tcKeyfile->GetValue();\r
        swInfo.szComment            = mkDlg.tcComment->GetValue();\r
-       {\r
-               wxULongLong_t ll;\r
-               mkDlg.cbSplitSize->GetValue().ToULongLong(& ll);\r
-               swInfo.llSplitSize      = ll;\r
-       }\r
+       mkDlg.cbSplitSize->GetValue().ToULongLong(& swInfo.nSplitSize);\r
 \r
        // TPIを読み込み。\r
        int nSelected = mkDlg.chType->GetSelection();\r
-       this->fnArchive = wxFileName(mkDlg.cbDir->GetValue(), mkDlg.cbFileName->GetValue(), swInfo.fMakeSFX ? EXE_EXT : mkDlg.afInfo[nSelected].szSuffix.BeforeFirst(wxT(';')));\r
-       if (! tpi.InitLibrary(mkDlg.afInfo[nSelected].szTPIName, this->fnArchive.GetFullPath(), mkDlg.afInfo[nSelected].llTypeId))\r
+       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
-               ::ErrDlg(wxT("Error: InitLibrary()!"), this);\r
+               wxLogError(_("Error: %s!"), wxT("InitLibrary()!"));\r
                return;\r
        }\r
 \r
        // コールバック関数を設定。\r
        if (! tpi.SetCallbackProc(TPICallbackProc))\r
        {\r
-               ::ErrDlg(wxT("Error: SetCallbackProc()!"), this);\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_ADD, & 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
@@ -349,53 +318,54 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
        if (e.GetId() == XRCID("Arc_Open"))\r
        {\r
                wxFileDialog fd(this);\r
-               fd.SetDirectory(this->conf.Read(wxT("LastOpenPath"), ::wxGetCwd()));\r
+               fd.SetDirectory(this->conf.ReadHistory(CONF_HISTORY_PATH, 0));\r
                fd.SetWindowStyleFlag(wxFD_OPEN | wxFD_FILE_MUST_EXIST);\r
                if (fd.ShowModal() == wxID_CANCEL)\r
                {\r
                        return;\r
                }\r
-               this->conf.Write(wxT("LastOpenPath"), fd.GetDirectory());\r
+               this->conf.WriteHistory(CONF_HISTORY_PATH, fd.GetDirectory());\r
                this->fnArchive = wxFileName(fd.GetPath());\r
        }\r
        this->OnArcClose(e);\r
 \r
        // 進捗ダイアログ表示。\r
        ProcessDialog procDlg;\r
-       procDlg.InitDialog();\r
        procDlg.Show(true);\r
 \r
        // TPIを読み込み、最初のコールバックを送信。\r
        TPI_PROCESSINFO piInfo;\r
-       piInfo.uMessage = TPI_MESSAGE_STATUS;\r
-       piInfo.uStatus = 0x1000;\r
-       piInfo.llProcessedSize = 0;\r
+       piInfo.eMessage = TPI_MESSAGE_STATUS;\r
+       piInfo.eStatus = 0x1000;\r
+       piInfo.nProcessedSize = 0;\r
        piInfo.fiInfo.fnFileName = this->fnArchive;\r
-       piInfo.fiInfo.llUnpackedSize = this->LoadTPI(this->fnArchive.GetFullPath());\r
-       if (piInfo.fiInfo.llUnpackedSize.ToULong() == 0)\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
-               ::ErrDlg(_("No plug-in supporting this archive was found!"), this);\r
+               wxLogError(_("No plug-in supporting this archive was found!"));\r
                return;\r
        }\r
-       TPICallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
-\r
-       // コールバック関数を設定。\r
-       tpi.SetCallbackProc(TPICallbackProc);\r
+       procDlg.CallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
 \r
        // 配列のサイズを確保。\r
-       this->fileinfo.Alloc(piInfo.fiInfo.llUnpackedSize.ToULong());\r
+       this->fileinfo.Alloc(piInfo.fiInfo.nUnpackedSize);\r
 \r
        // 書庫を開く。\r
        if (! tpi.OpenArchive(this->fnArchive.GetFullPath()))\r
        {\r
                procDlg.Show(false);\r
                tpi.FreeLibrary();\r
-               ::ErrDlg(wxT("Error: OpenArchive()!"), this);\r
+               wxLogError(_("Error: %s!"), wxT("OpenArchive()"));\r
                return;\r
        }\r
 \r
+       // 履歴に追加。\r
+       this->conf.WriteHistory(CONF_HISTORY_PATH, this->fnArchive.GetPath());\r
+       this->conf.WriteHistory(CONF_HISTORY_NAME, this->fnArchive.GetFullName());\r
+       this->conf.WriteHistory(CONF_HISTORY_FULL, this->fnArchive.GetFullPath());\r
+\r
        // 書庫のアイコンを取得し、書庫ルートを作成。\r
        g_hIconT.Add(wxBitmap(L_DIR_S_ICO wxT("folder_closed.png"), wxBITMAP_TYPE_ANY));\r
        g_hIconT.Add(wxBitmap(L_DIR_S_ICO wxT("folder_open.png"), wxBITMAP_TYPE_ANY));\r
@@ -412,11 +382,11 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
        // ファイル情報をロード。\r
        if (tpi.GetFileInformation(& piInfo.fiInfo, true))\r
        {\r
-               piInfo.uStatus = 0x1001;\r
+               piInfo.eStatus = 0x1001;\r
                do\r
                {\r
-                       piInfo.llProcessedSize++;\r
-                       if (this->ErrorCheck(TPICallbackProc(TPI_NOTIFY_COMMON, & piInfo)) == TPI_CALLBACK_CANCEL)\r
+                       piInfo.nProcessedSize++;\r
+                       if (this->ErrorCheck(procDlg.CallbackProc(TPI_NOTIFY_COMMON, & piInfo)) == TPI_CALLBACK_CANCEL)\r
                        {\r
                                procDlg.Show(false);\r
                                tpi.CloseArchive();\r
@@ -438,22 +408,22 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
                        // DTV検査。\r
                        if (piInfo.fiInfo.fnFileName.GetPathWithSep().Find(wxT("..")) != wxNOT_FOUND)\r
                        {\r
-                               piInfo.fiInfo.uDanger = TRUE;\r
-                               ::WrnDlg(_("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") + piInfo.fiInfo.szStoredName, this);\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
                        }\r
                        // 空白の連続による拡張子偽装を検査。\r
                        if (piInfo.fiInfo.fnFileName.GetFullName().Find(wxT("        ")) != wxNOT_FOUND)\r
                        {\r
-                               piInfo.fiInfo.uDanger = TRUE;\r
-                               ::WrnDlg(_("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") + piInfo.fiInfo.szStoredName, this);\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
                        }\r
                        // Unicode制御文字を検査。\r
                        for (wxChar c = 0x200c; c <= 0x206f; c++)\r
                        {\r
                                if (piInfo.fiInfo.fnFileName.GetFullName().Find(c) != wxNOT_FOUND)\r
                                {\r
-                                       piInfo.fiInfo.uDanger = TRUE;\r
-                                       ::WrnDlg(_("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") + piInfo.fiInfo.szStoredName, this);\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
                                }\r
                                switch (c)\r
                                {\r
@@ -468,21 +438,22 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
                while (tpi.GetFileInformation(& piInfo.fiInfo, false));\r
        }\r
 \r
+       // GetFileInformationがエラー終了した場合。\r
+       if (tpi.nErrorCode != TPI_ERROR_S_ENDOFDATA)\r
+       {\r
+               wxLogError(_("Error: %s!"), wxT("GetFileInformation()"));\r
+       }\r
+\r
        // 書庫の情報を取得。\r
-       TPI_ARCHIVEINFO aiInfo;\r
-       if (! tpi.GetArchiveInformation(& aiInfo))\r
+       if (! tpi.GetArchiveInformation(& this->aiArchive))\r
        {\r
-               procDlg.Show(false);\r
-               tpi.FreeLibrary();\r
-               ::ErrDlg(wxT("Error: GetArchiveInformation()!"), this);\r
-               return;\r
+               wxLogError(_("Error: %s!"), wxT("GetArchiveInformation()"));\r
        }\r
-       this->szComment = aiInfo.szComment;\r
 \r
        // 書庫を閉じる。\r
        if (! tpi.CloseArchive())\r
        {\r
-               ::ErrDlg(wxT("Error: CloseArchive()!"), this);\r
+               wxLogError(_("Error: %s!"), wxT("CloseArchive()"));\r
        }\r
 \r
        // 以下、UI処理。\r
@@ -491,28 +462,29 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
        this->tree_ctrl->ScrollTo(idArchive);\r
        this->tree_ctrl->SelectItem(idArchive);\r
        this->list_ctrl->atDangerItem.SetTextColour(* wxRED);\r
+       this->list_ctrl->atEncryptedItem.SetTextColour(wxColour(wxT("forest green")));\r
 \r
        // ステータスバー設定。\r
-       this->statusbar->SetStatusText(aiInfo.fiInfo.szTypeName, 0);\r
+       this->statusbar->SetStatusText(this->aiArchive.fiInfo.szTypeName, 0);\r
        this->statusbar->SetStatusText(wxString::Format(_("%d file(s)"), this->fileinfo.GetCount()), 1);\r
-       this->statusbar->SetStatusText(aiInfo.llUnpackedSize.ToString() + _(" B -> ") + aiInfo.llPackedSize.ToString() + _(" B"), 2);\r
-       this->statusbar->SetStatusText(wxString::Format(wxT("%3.1f%%"), aiInfo.wCompressRatio / 10.0), 3);\r
+       this->statusbar->SetStatusText(wxString::Format(_("%dB -> %dB"), this->aiArchive.nUnpackedSize, this->aiArchive.nPackedSize), 2);\r
+       this->statusbar->SetStatusText(wxString::Format(wxT("%3.1f%%"), this->aiArchive.wCompressRatio / 10.0), 3);\r
        this->statusbar->SetStatusText(this->fnArchive.GetFullPath(), 4);\r
 \r
        // ツールバー・メニューバー設定。\r
        SetMenuToolState("Arc_Close",   true);\r
-       SetMenuToolState("Arc_Add",     (aiInfo.fiInfo.llSupportedCommand & TPI_COMMAND_ADD)   == TPI_COMMAND_ADD   && aiInfo.fiInfo.fArchive);\r
-       SetMenuToolState("Arc_SFX",     (aiInfo.fiInfo.llSupportedCommand & TPI_COMMAND_SFX)    == TPI_COMMAND_SFX   && aiInfo.nSFXType == 0);\r
-       SetMenuToolState("Arc_UnSFX",   (aiInfo.fiInfo.llSupportedCommand & TPI_COMMAND_UNSFX)  == TPI_COMMAND_UNSFX && aiInfo.nSFXType != 0);\r
-       SetMenuToolState("Arc_Extract", (aiInfo.fiInfo.llSupportedCommand & TPI_COMMAND_EXTRACT)== TPI_COMMAND_EXTRACT);\r
-       SetMenuToolState("Arc_Delete",  (aiInfo.fiInfo.llSupportedCommand & TPI_COMMAND_DELETE) == TPI_COMMAND_DELETE && aiInfo.fiInfo.fArchive);\r
-       SetMenuToolState("Arc_Test",    (aiInfo.fiInfo.llSupportedCommand & TPI_COMMAND_TEST)   == TPI_COMMAND_TEST);\r
-       SetMenuToolState("Arc_Repair",  (aiInfo.fiInfo.llSupportedCommand & TPI_COMMAND_REPAIR) == TPI_COMMAND_REPAIR);\r
+       SetMenuToolState("Arc_Add",     (this->aiArchive.fiInfo.eSupportedCommand & TPI_COMMAND_ADD)   == TPI_COMMAND_ADD   && this->aiArchive.fiInfo.fArchive);\r
+       SetMenuToolState("Arc_SFX",     (this->aiArchive.fiInfo.eSupportedCommand & TPI_COMMAND_SFX)    == TPI_COMMAND_SFX   && ! this->aiArchive.fSFX);\r
+       SetMenuToolState("Arc_UnSFX",   (this->aiArchive.fiInfo.eSupportedCommand & TPI_COMMAND_UNSFX)  == TPI_COMMAND_UNSFX && this->aiArchive.fSFX);\r
+       SetMenuToolState("Arc_Extract", (this->aiArchive.fiInfo.eSupportedCommand & TPI_COMMAND_EXTRACT)== TPI_COMMAND_EXTRACT);\r
+       SetMenuToolState("Arc_Delete",  (this->aiArchive.fiInfo.eSupportedCommand & TPI_COMMAND_DELETE) == TPI_COMMAND_DELETE && this->aiArchive.fiInfo.fArchive);\r
+       SetMenuToolState("Arc_Test",    (this->aiArchive.fiInfo.eSupportedCommand & TPI_COMMAND_TEST)   == TPI_COMMAND_TEST);\r
+       SetMenuToolState("Arc_Repair",  (this->aiArchive.fiInfo.eSupportedCommand & TPI_COMMAND_REPAIR) == TPI_COMMAND_REPAIR);\r
 \r
        procDlg.Show(false);\r
 }\r
 \r
-void MainFrame::OnArcClose(wxCommandEvent&)\r
+void MainFrame::OnArcClose(wxCommandEvent& e)\r
 {\r
        // ツリービュー・リストビュー設定。\r
        this->tree_ctrl->DeleteAllItems();\r
@@ -534,43 +506,96 @@ void MainFrame::OnArcClose(wxCommandEvent&)
                this->statusbar->SetStatusText(wxEmptyString, i);\r
        }\r
        this->fileinfo.Clear();\r
-       this->szComment.Clear();\r
+       this->aiArchive.szComment.Empty();\r
+       this->aiArchive.fnArchive.Clear();\r
+       this->aiArchive.fiInfo.szTypeName.Empty();\r
+       this->aiArchive.fiInfo.szSuffix.Empty();\r
+       this->aiArchive.fiInfo.szEngineName.Empty();\r
+       this->aiArchive.fiInfo.szTPIName.Empty();\r
 \r
        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
 {\r
+       // 作成ダイアログを設定。\r
+       MakeDialog mkDlg;\r
+       ::wxXmlResource::Get()->Load(L_DIR_S_XRC wxT("dlg_make.xrc"));\r
+       ::wxXmlResource::Get()->LoadDialog(& mkDlg, this, wxT("dlg_make"));\r
+       mkDlg.uCommand = TPI_COMMAND_ADD;\r
+\r
        // 処理対象のファイルを選択。\r
-       wxArrayString files;\r
-       wxFileDialog fd(this, _("Choose files to add"), this->conf.Read(wxT("LastOpenPath"), ::wxGetCwd()));\r
+       wxFileDialog fd(this, _("Choose files to add"), this->conf.ReadHistory(CONF_HISTORY_PATH, 0));\r
        fd.SetWindowStyleFlag(wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);\r
        if (fd.ShowModal() == wxID_CANCEL)\r
        {\r
                return;\r
        }\r
-       fd.GetFilenames(files);\r
-       this->conf.Write(wxT("LastOpenPath"), fd.GetDirectory());\r
+       fd.GetFilenames(mkDlg.files);\r
+       this->conf.WriteHistory(CONF_HISTORY_PATH, fd.GetDirectory());\r
+\r
+       // ダイアログを表示。\r
+       if (mkDlg.ShowModal() == wxID_CANCEL)\r
+       {\r
+               return;\r
+       }\r
 \r
        // 各種設定。\r
        TPI_SWITCHES swInfo;\r
-       swInfo.fnDestinationDirectory = wxFileName::DirName(fd.GetDirectory());\r
-       swInfo.fMakeSFX = false;\r
-       swInfo.pCustomSwitches = NULL;\r
+       swInfo.pCustomSwitches       = NULL;\r
+       swInfo.fMakeSFX              = false;\r
+       swInfo.fnDestinationDirectory= wxFileName::DirName(fd.GetDirectory());\r
+       swInfo.fStoreDirectoryPathes = ! mkDlg.cbIgnorePath->IsChecked();\r
+       swInfo.fSolid               = mkDlg.cbSolid->IsChecked();\r
+       swInfo.fMMOptimize          = mkDlg.cbMMOptimize->IsChecked();\r
+       swInfo.fEncryptHeader       = mkDlg.cbEncryptHeader->IsChecked();\r
+       swInfo.nCompressLevel       = mkDlg.scLevel->GetValue();\r
+       swInfo.nRecoveryRecord      = mkDlg.scRR->GetValue();\r
+       swInfo.szPassword           = mkDlg.tcPassword->GetValue();\r
+       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(), 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
-       // 書庫を再読み込み。\r
+       if (mkDlg.cbOpenAfter->IsChecked())\r
+       {\r
+               // 作成先を開く。\r
+               ::wxExecute(DIR_APP + swInfo.fnDestinationDirectory.GetFullPath());\r
+       }\r
+\r
+       if (mkDlg.cbExitAfter->IsChecked())\r
+       {\r
+               // 終了。\r
+               this->Close(true);\r
+       }\r
+\r
+       // 終了しない場合は書庫を再読み込み。\r
        this->OnArcOpen(e);\r
 }\r
 \r
@@ -587,13 +612,12 @@ void MainFrame::OnArcConvert(wxCommandEvent& e)
                return;\r
        }\r
        swInfo.fnDestinationDirectory = wxFileName::DirName(fd.GetDirectory());\r
-       this->conf.Write(wxT("LastOpenPath"), fd.GetDirectory());\r
+       this->conf.WriteHistory(CONF_HISTORY_PATH, fd.GetDirectory());\r
 \r
        wxArrayString files;\r
        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
@@ -616,22 +640,22 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
        MakeDialog mkDlg;\r
        ::wxXmlResource::Get()->Load(L_DIR_S_XRC wxT("dlg_make.xrc"));\r
        ::wxXmlResource::Get()->LoadDialog(& mkDlg, this, wxT("dlg_make"));\r
-       mkDlg.bIsMake = false;\r
-       mkDlg.files   = MakeTargetFileList(this, nMode == 1);\r
+       mkDlg.uCommand = TPI_COMMAND_EXTRACT;\r
+       mkDlg.files    = MakeTargetFileList(this, nMode == 1);\r
 \r
        if (nMode != 0)\r
        {\r
                if (nMode == 1)\r
                {\r
                        // コマンドを取得。\r
-                       ftFile = wxTheMimeTypesManager->GetFileTypeFromExtension(wxFileName(mkDlg.files[0]).GetExt());\r
+                       ftFile = wxTheMimeTypesManager->GetFileTypeFromExtension(wxFileName(mkDlg.files[0], wxPATH_DOS).GetExt());\r
                        if (! ftFile)\r
                        {\r
                                // 種類が取得できないときは設定を読み込む。初期設定ではテキストとみなす。\r
-                               ftFile = wxTheMimeTypesManager->GetFileTypeFromExtension(this->conf.Read(wxT("DefaultExt"), wxT("txt")));\r
+                               ftFile = wxTheMimeTypesManager->GetFileTypeFromExtension(this->conf.ReadId(CONF_DEFAULT_EXT, (wxString) wxT("txt")));\r
                                if (! ftFile)\r
                                {\r
-                                       ::ErrDlg(_("Unable to get the file type!"), this);\r
+                                       wxLogError(_("Unable to get the file type!"));\r
                                        return;\r
                                }\r
                        }\r
@@ -640,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
-                       ::ErrDlg(_("Unable to make the temporary directory!"), this);\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
@@ -672,29 +696,38 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                        swInfo.fnDestinationDirectory = MakeDirPath(swInfo.fnDestinationDirectory, this->fnArchive.GetName(), true);\r
                        if (! swInfo.fnDestinationDirectory.IsOk())\r
                        {\r
-                               ::ErrDlg(_("Unable to make the destination directory!"), this);\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
@@ -709,7 +742,7 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                if (nMode == 1)\r
                {\r
                        // コマンドを実行。\r
-                       asFiles.Add(swInfo.fnDestinationDirectory.GetPathWithSep() + wxFileName(mkDlg.files[0]).GetFullName());\r
+                       asFiles.Add(swInfo.fnDestinationDirectory.GetPathWithSep() + wxFileName(mkDlg.files[0], wxPATH_DOS).GetFullName());\r
                        if (tpi.nErrorCode == TPI_ERROR_SUCCESS)\r
                        {\r
 #ifdef __LINUX__\r
@@ -722,11 +755,15 @@ 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]).GetFullName();\r
+                               wxString szFileName = swInfo.fnDestinationDirectory.GetPathWithSep() + wxFileName(mkDlg.files[i], wxPATH_DOS).GetFullName();\r
                                if (nMode == 2)\r
                                {\r
                                        // リストに追加。\r
@@ -739,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
@@ -772,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
@@ -789,28 +842,50 @@ 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
-       if (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
-               ::MsgDlg(_("This is a correct archive."), & procDlg, wxICON_INFORMATION);\r
+               wxLogMessage(_("This is a correct archive."));\r
        }\r
        else\r
        {\r
                this->ErrorCheck(tpi.nErrorCode);\r
        }\r
-       procDlg.Show(false);\r
 }\r
 \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
@@ -938,23 +1013,36 @@ void MainFrame::OnFilter(wxCommandEvent&)
 \r
 // イベントハンドラ以外。\r
 \r
-wxULongLong MainFrame::LoadTPI(wxString szFileName)\r
+wxULongLong_t MainFrame::LoadTPI(wxString szFileName)\r
 {\r
        // TPIを読み込み。\r
-       wxFileSystem fs;\r
-       fs.ChangePathTo(L_DIR_B_LIB, true);\r
-       wxString szTPIName = fs.FindFirst(wxT("*" TPI_EXT), wxFILE);\r
-       wxULongLong llFileCount = 0;\r
-       while (! szTPIName.IsEmpty())\r
-       {\r
-               // 対応確認。\r
-               if (! tpi.InitLibrary(szTPIName, szFileName, 0) || ! tpi.CheckArchive(szFileName, & llFileCount) || llFileCount == 0)\r
+       wxDir fs(L_DIR_B_LIB);\r
+       wxULongLong_t llFileCount = 0;\r
+       wxString szTPIName;\r
+       if (fs.GetFirst(& szTPIName, wxT("*" TPI_EXT)))\r
+       {\r
+               do\r
                {\r
-                       tpi.FreeLibrary();\r
-                       szTPIName = fs.FindNext();\r
-                       continue;\r
+                       // 初期化。\r
+                       if (! tpi.InitLibrary(L_DIR_B_LIB + szTPIName, szFileName, 0))\r
+                       {\r
+                               tpi.FreeLibrary();\r
+                               continue;\r
+                       }\r
+\r
+                       // コールバック関数を設定。\r
+                       tpi.SetCallbackProc(TPICallbackProc);\r
+\r
+                       // 対応確認。\r
+                       if (! tpi.CheckArchive(szFileName, & llFileCount) || llFileCount == 0)\r
+                       {\r
+                               tpi.FreeLibrary();\r
+                               llFileCount = 0;\r
+                               continue;\r
+                       }\r
+                       break;\r
                }\r
-               break;\r
+               while (fs.GetNext(& szTPIName));\r
        }\r
        return llFileCount;\r
 }\r
@@ -967,14 +1055,14 @@ int MainFrame::ErrorCheck(int nErrorCode)
        case TPI_CALLBACK_CONTINUE:\r
                break;\r
        case TPI_ERROR_D_UNSUPPORTED:\r
-               ::ErrDlg(_("Sorry, this function is not supported yet."), this);\r
+               wxLogError(_("Sorry, this function is not supported yet."));\r
                break;\r
        case TPI_ERROR_D_SKIPPED:\r
        case TPI_CALLBACK_CANCEL:\r
-               ::ErrDlg(_("This operation is canceled by the user."), this);\r
+               wxLogError(_("This operation is canceled by the user."));\r
                break;\r
        default:\r
-               ::ErrDlg(_("Error code: ") + wxString::Format(wxT("%d"), nErrorCode), this);\r
+               wxLogError(_("Error code: %d"), nErrorCode);\r
        }\r
        return nErrorCode;\r
 }\r