OSDN Git Service

書庫を読み込み/操作している途中でのキャンセルを可能にした。
authorsirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Sat, 3 Oct 2009 08:50:38 +0000 (08:50 +0000)
committersirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Sat, 3 Oct 2009 08:50:38 +0000 (08:50 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@17 9df91469-1e22-0410-86e7-ea8537beb833

src/frontend/dlg_process.cpp
src/frontend/frm_main.cpp

index 763f841..7ec8681 100644 (file)
@@ -66,7 +66,6 @@ void ProcessDialog::OnInit(wxInitDialogEvent &)
 void ProcessDialog::OnBtnCancel(wxCommandEvent &)\r
 {\r
        this->fCancel = true;\r
-       this->Close(true);\r
 }\r
 \r
 //******************************************************************************\r
@@ -97,12 +96,13 @@ int __stdcall TPICallbackProc(unsigned int _uMsg, void * _pStructure)
                g_procDlg->ebTarget->ChangeValue(piInfo->fnDestination.GetFullPath());\r
                g_procDlg->gauge->SetRange(piInfo->fiInfo.llUnpackedSize.ToULong());\r
                g_procDlg->gauge->SetValue(0);\r
-               g_procDlg->Update();\r
+               ::wxSafeYield(g_procDlg, true);\r
                break;\r
        case TPI_STATUS_INPROCESS:\r
                if (piInfo->fiInfo.llUnpackedSize > 10000 && s_nGaugeCounter++ > 100)\r
                {\r
                        g_procDlg->gauge->SetValue(piInfo->llProcessedSize.ToULong());\r
+                       ::wxSafeYield(g_procDlg, true);\r
                        s_nGaugeCounter = 0;\r
                }\r
                break;\r
@@ -120,7 +120,7 @@ int __stdcall TPICallbackProc(unsigned int _uMsg, void * _pStructure)
                if (piInfo->llProcessedSize > g_procDlg->gauge->GetValue() + 100)\r
                {\r
                        g_procDlg->ebTarget->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
-                       g_procDlg->Update();\r
+                       ::wxSafeYield(g_procDlg, true);\r
                }\r
                break;\r
        case 0x1002:\r
index 161f00c..0746977 100644 (file)
@@ -331,6 +331,7 @@ void MainFrame::OnArcClose(wxCommandEvent&)
                this->statusbar->SetStatusText(wxEmptyString, i);
        }
        this->fileinfo.Clear();
+
        g_hIconT.RemoveAll();
        g_hIconLL.RemoveAll();
        g_hIconLS.RemoveAll();
@@ -651,6 +652,13 @@ void MainFrame::LoadArc(wxString szFileName)
                return;
        }
 
+       // \90i\92»\83_\83C\83A\83\8d\83O\95\\8e¦\81B
+       ProcessDialog procDlg;
+       ::wxXmlResource::Get()->Load(FE_DIR_S_XRC wxT("dlg_process.xrc"));
+       ::wxXmlResource::Get()->LoadDialog(& procDlg, this, wxT("dlg_process"));        
+       procDlg.InitDialog();
+       procDlg.Show(true);
+
        // TPI\82ð\93Ç\82Ý\8d\9e\82Ý\81B
        wxFileSystem fs;
        fs.ChangePathTo(FE_DIR_B_LIB, true);
@@ -669,18 +677,12 @@ void MainFrame::LoadArc(wxString szFileName)
        }
        if (nFileCount == -1)
        {
+               procDlg.Show(false);
                tpi.FreeLibrary();
                ::wxMessageBox(wxT("Fault : No plug-in supporting this archive was found!"));
                return;
        }
 
-       // \90i\92»\83_\83C\83A\83\8d\83O\95\\8e¦\81B\82½\82¾\82µ\81A\83t\83@\83C\83\8b\90\94\82ª\91½\82¢\82Æ\82«\82Í\91¬\93x\82ð\97D\90æ\82µ\82Ä\95\\8e¦\82µ\82È\82¢\81B
-       ProcessDialog procDlg;
-       ::wxXmlResource::Get()->Load(FE_DIR_S_XRC wxT("dlg_process.xrc"));
-       ::wxXmlResource::Get()->LoadDialog(& procDlg, this, wxT("dlg_process"));        
-       procDlg.InitDialog();
-       procDlg.Show(true);
-
        // \8dÅ\8f\89\82Ì\83R\81[\83\8b\83o\83b\83N\82ð\91\97\90M\81B
        TPI_PROCESSINFO piInfo;
        piInfo.uMessage = TPI_MESSAGE_STATUS;
@@ -770,7 +772,15 @@ void MainFrame::LoadArc(wxString szFileName)
                        // \8fî\95ñ\82ð\95Û\91\82µ\82Ä\83J\83E\83\93\83g\83A\83b\83v\81B
                        this->fileinfo.Add(piInfo.fiInfo);
                        piInfo.uStatus = 0x1002;
-                       TPICallbackProc(TPI_NOTIFY_COMMON, & piInfo);
+                       if (TPICallbackProc(TPI_NOTIFY_COMMON, & piInfo) == TPI_CALLBACK_CANCEL)
+                       {
+                               procDlg.Show(false);
+                               tpi.CloseArchive(hArc);
+                               wxCommandEvent e;
+                               this->OnArcClose(e);
+                               ::wxMessageBox(wxT("Fault : Canceled by user!"));
+                               return;
+                       }
                }
                while (tpi.GetFileInformation(hArc, & piInfo.fiInfo, false) == TPI_ERROR_SUCCESS);
        }