// ProcessDialog\r
//******************************************************************************\r
\r
-ProcessDialog::ProcessDialog(): wxDialog()\r
+ProcessDialog::ProcessDialog(wxWindow * parent, wxULongLong_t n, wxString szPassword): wxDialog(), nFileCount(n), szPassword(szPassword), fOpen(false)\r
{\r
::wxXmlResource::Get()->Load(L_DIR_S_XRC wxT("dlg_process.xrc"));\r
- ::wxXmlResource::Get()->LoadDialog(this, this->GetParent(), wxT("dlg_process")); \r
+ ::wxXmlResource::Get()->LoadDialog(this, this->GetParent(), wxT("dlg_process"));\r
g_procDlg = this;\r
+ this->hParent = parent;\r
+ this->InitDialog();\r
}\r
\r
ProcessDialog::~ProcessDialog()\r
{\r
+ // ウインドウの機能を有効化。\r
+ MainFrame * frm_main = (MainFrame *) this->hParent;\r
+ frm_main->tree_ctrl->Thaw();\r
+ frm_main->list_ctrl->Thaw();\r
+ frm_main->menubar->EnableTop(0, true);\r
+ frm_main->menubar->EnableTop(1, true);\r
+ frm_main->menubar->EnableTop(2, true);\r
+ frm_main->toolbar->Enable();\r
+\r
+ // 書庫を開く途中に中断した場合、書庫を閉じる処理を行う。\r
+ if (this->fOpen && this->fCancel)\r
+ {\r
+ wxCommandEvent e;\r
+ frm_main->OnArcClose(e);\r
+ }\r
+\r
+#ifdef __WINDOWS__\r
+ if (this->tlTaskbar != NULL)\r
+ {\r
+ this->tlTaskbar->SetProgressState(this->hTBWnd, TBPF_NOPROGRESS);\r
+ this->tlTaskbar->Release();\r
+ }\r
+#endif\r
+ ((MainFrame *) this->hParent)->gFrame->Show(false);\r
g_procDlg = NULL;\r
}\r
\r
\r
void ProcessDialog::OnInit(wxInitDialogEvent &)\r
{\r
+ if (this->nOverwriteMode == wxID_OK)\r
+ {\r
+ // 2回目以降は何もせず終了。\r
+ return;\r
+ }\r
+\r
// XRCと結びつけ。\r
this->ebTarget = XRCCTRL(* this, "ebTarget", wxTextCtrl);\r
this->ebSource = XRCCTRL(* this, "ebSource", wxTextCtrl);\r
TPI_PROCESSINFO piInfo;\r
piInfo.eMessage = TPI_MESSAGE_STATUS;\r
piInfo.eStatus = 0x1000;\r
- piInfo.fiInfo.fnFileName = * this->fnArchive;\r
+ piInfo.fiInfo.fnFileName = ((MainFrame *) this->hParent)->fnArchive;\r
piInfo.fiInfo.nUnpackedSize = this->nFileCount;\r
this->CallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
+\r
+ if (((MainFrame *) this->hParent)->conf.ReadId(CONF_PROCESS_DLG, false))\r
+ {\r
+ // 旧来の進捗ダイアログを表示。\r
+ // ここでOnInitが呼ばれるので、OnInitの最初で無効化している。\r
+ this->Show();\r
+ }\r
+\r
+ // ウインドウの機能を無効化。\r
+ MainFrame * frm_main = (MainFrame *) this->hParent;\r
+ frm_main->tree_ctrl->Freeze();\r
+ frm_main->list_ctrl->Freeze();\r
+ frm_main->menubar->EnableTop(0, false);\r
+ frm_main->menubar->EnableTop(1, false);\r
+ frm_main->menubar->EnableTop(2, false);\r
+ frm_main->toolbar->Enable(false);\r
+#ifdef __WINDOWS__\r
+ // タスクバー。\r
+ this->hTBWnd = this->hParent->GetHandle();\r
+\r
+ ::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (void **) & this->tlTaskbar);\r
+ if (this->tlTaskbar != NULL)\r
+ {\r
+ this->tlTaskbar->HrInit();\r
+ }\r
+#endif\r
}\r
\r
void ProcessDialog::OnClose(wxCloseEvent & e)\r
case TPI_MESSAGE_STATUS:\r
{\r
static int s_nProcess;\r
+#ifdef __WINDOWS__\r
+ static int s_nFileCount;\r
+#endif\r
static wxStopWatch sw;\r
switch (piInfo->eStatus)\r
{\r
case TPI_STATUS_INPROCESS:\r
if (sw.Time() > 500)\r
{\r
- sw.Start();\r
- this->ebSource->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
- this->ebTarget->ChangeValue(piInfo->fnDestination.GetFullPath());\r
- if (piInfo->fiInfo.nUnpackedSize > 10000)\r
+ if (this->IsShownOnScreen())\r
{\r
- this->gFile->SetValue(piInfo->nProcessedSize);\r
+ sw.Start();\r
+ this->ebSource->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
+ this->ebTarget->ChangeValue(piInfo->fnDestination.GetFullPath());\r
+ if (piInfo->fiInfo.nUnpackedSize > 10000)\r
+ {\r
+ this->gFile->SetValue(piInfo->nProcessedSize);\r
+ }\r
+ this->gArchive->SetValue(s_nProcess);\r
+ this->Update();\r
+ ::wxSafeYield(this, true);\r
}\r
- this->gArchive->SetValue(s_nProcess);\r
- this->Update();\r
- ::wxSafeYield(this, true);\r
+ else\r
+ {\r
+ ::wxSafeYield(this->hParent, true);\r
+ }\r
+ ((MainFrame *) this->hParent)->gFrame->SetValue(s_nProcess);\r
+ }\r
+#ifdef __WINDOWS__\r
+ if (this->tlTaskbar != NULL)\r
+ {\r
+ this->tlTaskbar->SetProgressValue(this->hTBWnd, s_nProcess, s_nFileCount);\r
}\r
+#endif\r
break;\r
case TPI_STATUS_ENDPROCESS:\r
s_nProcess++;\r
case 0x1000: // 初期設定。\r
this->ebSource->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
this->Update();\r
+ ((MainFrame *) this->hParent)->gFrame->Show();\r
case 0x1001: // 閲覧時は最初にファイル数が分からないので、ここで設定。\r
this->gArchive->SetRange(piInfo->fiInfo.nUnpackedSize);\r
- this->gArchive->SetValue(0);\r
+ ((MainFrame *) this->hParent)->gFrame->SetRange(piInfo->fiInfo.nUnpackedSize);\r
s_nProcess = 0;\r
+#ifdef __WINDOWS__\r
+ s_nFileCount = piInfo->fiInfo.nUnpackedSize;\r
+#endif\r
sw.Start();\r
+ if (piInfo->eStatus == 0x1001)\r
+ {\r
+ this->fOpen = true;\r
+ }\r
break;\r
case 0x1002: // 各ファイルの処理を開始。\r
if (sw.Time() > 500)\r
{\r
- sw.Start();\r
- this->ebTarget->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
- this->gArchive->SetValue(piInfo->nProcessedSize);\r
- this->Update();\r
- ::wxSafeYield(this, true);\r
+ if (this->IsShownOnScreen())\r
+ {\r
+ sw.Start();\r
+ this->ebTarget->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
+ this->gArchive->SetValue(piInfo->nProcessedSize);\r
+ this->Update();\r
+ ::wxSafeYield(this, true);\r
+ }\r
+ ::wxSafeYield(this->hParent, true);\r
+ }\r
+ ((MainFrame *) this->hParent)->gFrame->SetValue(piInfo->nProcessedSize);\r
+#ifdef __WINDOWS__\r
+ if (this->tlTaskbar != NULL)\r
+ {\r
+ this->tlTaskbar->SetProgressValue(this->hTBWnd, piInfo->nProcessedSize, s_nFileCount);\r
}\r
+#endif\r
break;\r
}\r
break;\r
}\r
case TPI_MESSAGE_ASK:\r
{\r
+#ifdef __WINDOWS__\r
+ if (this->tlTaskbar != NULL)\r
+ {\r
+ this->tlTaskbar->SetProgressState(this->hTBWnd, TBPF_PAUSED);\r
+ }\r
+#endif\r
switch (piInfo->eStatus)\r
{\r
case TPI_PARAM_PASSWORD:\r
{\r
- static wxFileName fnFormer;\r
- static wxString szFormer;\r
- if (piInfo->fiInfo.fnFileName == fnFormer)\r
+ if (piInfo->fiInfo.fnFileName == fnFormer || this->szPassword.IsEmpty())\r
{\r
piInfo->szParam = ::wxGetPasswordFromUser(_("Password for:\n") + piInfo->fiInfo.fnFileName.GetFullPath(), wxT("Lychee"), wxEmptyString, this);\r
if (piInfo->szParam.IsEmpty())\r
{\r
this->fCancel = true;\r
}\r
- szFormer = piInfo->szParam;\r
+ this->szPassword = piInfo->szParam;\r
}\r
else\r
{\r
- piInfo->szParam = szFormer;\r
+ piInfo->szParam = this->szPassword;\r
fnFormer = piInfo->fiInfo.fnFileName;\r
}\r
break;\r
default:\r
return TPI_CALLBACK_UNSUPPORTED;\r
}\r
+#ifdef __WINDOWS__\r
+ if (this->tlTaskbar != NULL)\r
+ {\r
+ this->tlTaskbar->SetProgressState(this->hTBWnd, TBPF_NORMAL);\r
+ }\r
+#endif\r
break;\r
}\r
default:\r