OSDN Git Service

処理中にパスワードを求められた際、ダイアログを表示してパスワードを入力できるよう変更。
authorsirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Sun, 1 Nov 2009 08:35:27 +0000 (08:35 +0000)
committersirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Sun, 1 Nov 2009 08:35:27 +0000 (08:35 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@84 9df91469-1e22-0410-86e7-ea8537beb833

doc/history.html
src/frontend/dlg_process.cpp

index 4abf896..80354b7 100644 (file)
      <dt>Frontend</dt>\r
      <dd>\r
       <ul>\r
+       <li class="add">処理中にコールバック関数に対してパラメータを要求するTPI_MESSAGE_ASKと、それに関連してパラメータコードを追加。</li>\r
+       <li class="add">コールバック関数からTPIへ現在の処理を行わずに次の処理を行うよう指示するTPI_CALLBACK_SKIPを追加。</li>\r
+       <li class="add">GetFileInformation/GetFormatInformationでデータが終了したことを明示するTPI_ERROR_S_ENDOFDATAを追加。</li>\r
+       <li class="chg">いくつかの定数の値を変更。</li>\r
+      </ul>\r
+     </dd>\r
+     <dt>Frontend</dt>\r
+     <dd>\r
+      <ul>\r
        <li class="add">書庫閲覧時の表示モードに一覧表示モードを追加。</li>\r
        <li class="add">ツールバー/ステータスバーの非表示設定を追加。</li>\r
        <li class="add">書庫閲覧時のフィルタ機能を追加。</li>\r
        <li class="add">書庫閲覧時にツリービューからのDnDに対応。</li>\r
        <li class="add">Delete,Insertキーをそれぞれ削除と追加の動作に割り当て。</li>\r
+       <li class="add">格納ファイルを開く際にファイルの種類を取得できない場合に、特定の拡張子とみなすDefaultExtを設定に追加(初期値はtxt)。</li>\r
+       <li class="chg">処理中にパスワードを求められた際、ダイアログを表示してパスワードを入力できるよう変更。</li>\r
        <li class="chg">ステータスバーの表示形式を変更。</li>\r
        <li class="fix">ツリービューで常に選択状態で表示されるアイテムがあったバグを修正。</li>\r
       </ul>\r
index 94185d2..76361fc 100644 (file)
-/*******************************************************************************\r
-  TPI - flexible but useless plug-in framework.\r
-  Copyright (C) 2002-2009 Silky\r
-\r
-  This library is free software; you can redistribute it and/or modify it under\r
-  the terms of the GNU Lesser General Public License as published by the Free\r
-  Software Foundation; either version 2.1 of the License, or (at your option)\r
-  any later version.\r
-\r
-  This library is distributed in the hope that it will be useful, but WITHOUT\r
-  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or \r
-  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License\r
-  for more details.\r
-\r
-  You should have received a copy of the GNU Lesser General Public License along\r
-  with this library; if not, write to the Free Software Foundation, Inc.,\r
-  51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\r
-\r
-  $Id: dlg_process.cpp,v 1.6 2009/09/01 12:20:49 sirakaba Exp $\r
-*******************************************************************************/\r
-\r
-#include "frontend.h"\r
-#include "dlg_process.h"\r
-\r
-ProcessDialog * g_procDlg = NULL;\r
-\r
-//******************************************************************************\r
-// ProcessDialog\r
-//******************************************************************************\r
-\r
-ProcessDialog::ProcessDialog(): wxDialog()\r
-{\r
+/*******************************************************************************
+  TPI - flexible but useless plug-in framework.
+  Copyright (C) 2002-2009 Silky
+
+  This library is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the Free
+  Software Foundation; either version 2.1 of the License, or (at your option)
+  any later version.
+
+  This library is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  for more details.
+
+  You should have received a copy of the GNU Lesser General Public License along
+  with this library; if not, write to the Free Software Foundation, Inc.,
+  51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+  $Id: dlg_process.cpp,v 1.6 2009/09/01 12:20:49 sirakaba Exp $
+*******************************************************************************/
+
+#include "frontend.h"
+#include "dlg_process.h"
+
+ProcessDialog * g_procDlg = NULL;
+
+//******************************************************************************
+// ProcessDialog
+//******************************************************************************
+
+ProcessDialog::ProcessDialog(): wxDialog()
+{
        ::wxXmlResource::Get()->Load(FE_DIR_S_XRC wxT("dlg_process.xrc"));
        ::wxXmlResource::Get()->LoadDialog(this, this->GetParent(), wxT("dlg_process"));        
-}\r
-\r
-ProcessDialog::~ProcessDialog()\r
-{\r
-       g_procDlg = NULL;\r
-}\r
-\r
-//******************************************************************************\r
-// Event table.\r
-//******************************************************************************\r
-\r
-BEGIN_EVENT_TABLE(ProcessDialog, wxDialog)\r
-       EVT_INIT_DIALOG(ProcessDialog::OnInit)\r
-       EVT_CLOSE(      ProcessDialog::OnClose)\r
-END_EVENT_TABLE()\r
-\r
-//******************************************************************************\r
-// Event handler.\r
-//******************************************************************************\r
-\r
-void ProcessDialog::OnInit(wxInitDialogEvent &)\r
-{\r
-       // XRC\82Æ\8c\8b\82Ñ\82Â\82¯\81B\r
-       this->ebSource          = XRCCTRL(* this, "ebSource",     wxTextCtrl);\r
-       this->ebTarget          = XRCCTRL(* this, "ebTarget",     wxTextCtrl);\r
-       this->gauge             = XRCCTRL(* this, "gauge",        wxGauge);\r
-       this->fCancel           = false;\r
-       g_procDlg = this;\r
-\r
-       ::wxXmlResource::Get()->Unload(FE_DIR_S_XRC wxT("dlg_process.xrc"));\r
-}\r
-\r
-void ProcessDialog::OnClose(wxCloseEvent & e)\r
-{\r
-       if (e.CanVeto() && ::AskDlg(wxT("Really do you want to cancel this operation?"), this) == wxYES)\r
-       {\r
-               this->fCancel = true;\r
-       }\r
-       e.Veto();\r
-}\r
-\r
-//******************************************************************************\r
-//    \83_\83C\83A\83\8d\83O\83v\83\8d\83V\81[\83W\83\83\r
-//******************************************************************************\r
-\r
-int __stdcall TPICallbackProc(unsigned int _uMsg, void * _pStructure)\r
-{\r
-       if (_uMsg != TPI_NOTIFY_COMMON)\r
-       {\r
-               return TPI_CALLBACK_UNSUPPORTED;\r
-       }\r
-\r
-       TPI_PROCESSINFO * piInfo = (TPI_PROCESSINFO *) _pStructure;\r
-       if (g_procDlg == NULL || piInfo == NULL || piInfo->uMessage != TPI_MESSAGE_STATUS || ! g_procDlg->IsShown())\r
-       {\r
-               return TPI_CALLBACK_CONTINUE;\r
-       }\r
-\r
-       static int s_nGaugeCounter = 0;\r
-       switch (piInfo->uStatus)\r
-       {\r
-       case TPI_STATUS_OPENARCHIVE:\r
-               g_procDlg->ebSource->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
-               break;\r
-       case TPI_STATUS_BEGINPROCESS:\r
-               g_procDlg->ebTarget->ChangeValue((piInfo->fnDestination.IsOk() ? piInfo->fnDestination : piInfo->fiInfo.fnFileName).GetFullPath());\r
-               if (piInfo->fiInfo.llUnpackedSize > 10000)\r
-               {\r
-                       g_procDlg->gauge->SetRange(piInfo->fiInfo.llUnpackedSize.ToULong());\r
-                       g_procDlg->gauge->SetValue(0);\r
-               }\r
-               ::wxSafeYield(g_procDlg, true);\r
-               break;\r
-       case TPI_STATUS_INPROCESS:\r
-               if (s_nGaugeCounter++ > 100)\r
-               {\r
-                       if (piInfo->fiInfo.llUnpackedSize > 10000)\r
-                       {\r
-                               g_procDlg->gauge->SetValue(piInfo->llProcessedSize.ToULong());\r
-                       }\r
-                       ::wxSafeYield(g_procDlg, true);\r
-                       s_nGaugeCounter = 0;\r
-               }\r
-               break;\r
-       case TPI_STATUS_ENDPROCESS:\r
-//             g_procDlg->gauge->SetValue(piInfo->fiInfo.llUnpackedSize.ToULong());\r
-               break;\r
-       // \8f\91\8cÉ\83\8d\81[\83h\8e\9e\97p\82Ì\93Æ\8e©\8ed\97l\81B\r
-       case 0x1000:\r
-               g_procDlg->ebSource->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
-               g_procDlg->gauge->SetRange(piInfo->fiInfo.llUnpackedSize.ToULong());\r
-               g_procDlg->gauge->SetValue(0);\r
-               break;\r
-       case 0x1001:\r
-               // \8dX\90V\82µ\82·\82¬\82é\82Æ\92á\91¬\82È\82Ì\82Å100\83t\83@\83C\83\8b\96\88\82É\8dX\90V\82·\82é\81B\r
-               if (piInfo->llProcessedSize > g_procDlg->gauge->GetValue() + 100)\r
-               {\r
-                       g_procDlg->ebTarget->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
-                       g_procDlg->gauge->SetValue(piInfo->llProcessedSize.ToULong());\r
-                       ::wxSafeYield(g_procDlg, true);\r
-               }\r
-               break;\r
-       }\r
-\r
-       return g_procDlg->fCancel ? TPI_CALLBACK_CANCEL : TPI_CALLBACK_CONTINUE;\r
-}\r
+}
+
+ProcessDialog::~ProcessDialog()
+{
+       g_procDlg = NULL;
+}
+
+//******************************************************************************
+// Event table.
+//******************************************************************************
+
+BEGIN_EVENT_TABLE(ProcessDialog, wxDialog)
+       EVT_INIT_DIALOG(ProcessDialog::OnInit)
+       EVT_CLOSE(      ProcessDialog::OnClose)
+END_EVENT_TABLE()
+
+//******************************************************************************
+// Event handler.
+//******************************************************************************
+
+void ProcessDialog::OnInit(wxInitDialogEvent &)
+{
+       // XRC\82Æ\8c\8b\82Ñ\82Â\82¯\81B
+       this->ebSource          = XRCCTRL(* this, "ebSource",     wxTextCtrl);
+       this->ebTarget          = XRCCTRL(* this, "ebTarget",     wxTextCtrl);
+       this->gauge             = XRCCTRL(* this, "gauge",        wxGauge);
+       this->fCancel           = false;
+       g_procDlg = this;
+
+       ::wxXmlResource::Get()->Unload(FE_DIR_S_XRC wxT("dlg_process.xrc"));
+}
+
+void ProcessDialog::OnClose(wxCloseEvent & e)
+{
+       if (e.CanVeto() && ::AskDlg(wxT("Really do you want to cancel this operation?"), this) == wxYES)
+       {
+               this->fCancel = true;
+       }
+       e.Veto();
+}
+
+//******************************************************************************
+//    \83_\83C\83A\83\8d\83O\83v\83\8d\83V\81[\83W\83\83
+//******************************************************************************
+
+int __stdcall TPICallbackProc(unsigned int _uMsg, void * _pStructure)
+{
+       if (_uMsg != TPI_NOTIFY_COMMON)
+       {
+               return TPI_CALLBACK_UNSUPPORTED;
+       }
+
+       TPI_PROCESSINFO * piInfo = (TPI_PROCESSINFO *) _pStructure;
+       if (g_procDlg == NULL || piInfo == NULL || ! g_procDlg->IsShown())
+       {
+               return TPI_CALLBACK_CONTINUE;
+       }
+
+       switch (piInfo->uMessage)
+       {
+       case TPI_MESSAGE_STATUS:
+       {
+               static int s_nGaugeCounter = 0;
+               switch (piInfo->uStatus)
+               {
+               case TPI_STATUS_OPENARCHIVE:
+                       g_procDlg->ebSource->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());
+                       break;
+               case TPI_STATUS_BEGINPROCESS:
+                       g_procDlg->ebTarget->ChangeValue((piInfo->fnDestination.IsOk() ? piInfo->fnDestination : piInfo->fiInfo.fnFileName).GetFullPath());
+                       if (piInfo->fiInfo.llUnpackedSize > 10000)
+                       {
+                               g_procDlg->gauge->SetRange(piInfo->fiInfo.llUnpackedSize.ToULong());
+                               g_procDlg->gauge->SetValue(0);
+                       }
+                       ::wxSafeYield(g_procDlg, true);
+                       break;
+               case TPI_STATUS_INPROCESS:
+                       if (s_nGaugeCounter++ > 100)
+                       {
+                               if (piInfo->fiInfo.llUnpackedSize > 10000)
+                               {
+                                       g_procDlg->gauge->SetValue(piInfo->llProcessedSize.ToULong());
+                               }
+                               ::wxSafeYield(g_procDlg, true);
+                               s_nGaugeCounter = 0;
+                       }
+                       break;
+               case TPI_STATUS_ENDPROCESS:
+//                     g_procDlg->gauge->SetValue(piInfo->fiInfo.llUnpackedSize.ToULong());
+                       break;
+               // \8f\91\8cÉ\83\8d\81[\83h\8e\9e\97p\82Ì\93Æ\8e©\8ed\97l\81B
+               case 0x1000:
+                       g_procDlg->ebSource->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());
+                       g_procDlg->gauge->SetRange(piInfo->fiInfo.llUnpackedSize.ToULong());
+                       g_procDlg->gauge->SetValue(0);
+                       break;
+               case 0x1001:
+                       // \8dX\90V\82µ\82·\82¬\82é\82Æ\92á\91¬\82È\82Ì\82Å100\83t\83@\83C\83\8b\96\88\82É\8dX\90V\82·\82é\81B
+                       if (piInfo->llProcessedSize > g_procDlg->gauge->GetValue() + 100)
+                       {
+                               g_procDlg->ebTarget->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());
+                               g_procDlg->gauge->SetValue(piInfo->llProcessedSize.ToULong());
+                               ::wxSafeYield(g_procDlg, true);
+                       }
+                       break;
+               }
+               break;
+       }
+       case TPI_MESSAGE_ASK:
+       {
+               switch (piInfo->uStatus)
+               {
+               case TPI_PARAM_PASSWORD:
+                       piInfo->szParam = ::wxGetPasswordFromUser(wxT("Password for:\n") + piInfo->fiInfo.fnFileName.GetFullPath(), wxT("Frontend"), wxEmptyString, g_procDlg);
+                       if (piInfo->szParam.IsEmpty())
+                       {
+                               g_procDlg->fCancel = true;
+                       }
+                       break;
+               default:
+                       return TPI_CALLBACK_UNSUPPORTED;
+               }
+               break;
+       }
+       default:
+               return TPI_CALLBACK_UNSUPPORTED;
+       }
+
+       return g_procDlg->fCancel ? TPI_CALLBACK_CANCEL : TPI_CALLBACK_CONTINUE;
+}