diff src/myframe.cpp @ 16:b67c74848dd0

fix bugs.
author pyon@macmini
date Sat, 09 Jul 2011 08:30:00 +0900
parents 5ce7757b4350
children eb3f5c7c990f
line wrap: on
line diff
--- a/src/myframe.cpp	Fri Jul 01 20:13:49 2011 +0900
+++ b/src/myframe.cpp	Sat Jul 09 08:30:00 2011 +0900
@@ -1,5 +1,5 @@
 // Filename   : mainframe.cpp
-// Last Change: 01-Jul-2011.
+// Last Change: 06-Jul-2011.
 //
 #include "wx/html/htmprint.h"
 #include "wx/print.h"
@@ -28,7 +28,7 @@
 {
     // for search history
     hist = wxGetApp().searchhist;
-    histpos = 5;
+    histpos = 10;
 
     // for autocomplete hhs
     wxString gszFile = wxGetCwd() + wxT("/db/ccn.db");
@@ -313,16 +313,7 @@
 			wxExecute( execmd );
 			mf->m_statusBar->SetStatusText( wxEmptyString, 0 );
 
-            // 検索履歴をログに保存
-            wxString logfn = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH + wxT("log.txt");
-            wxTextFile logFile;
-            logFile.Open( logfn );
-            wxDateTime now = wxDateTime::Now();
-            wxString log = now.Format() + wxT(" ") + cmd + wxT(" ") + path[val];
-            logFile.AddLine( log );
-            logFile.Write();
-            logFile.Close();
-
+            WriteLog( cmd, path[val] );
 			break;
 		}
 		// ファイル印刷
@@ -333,6 +324,7 @@
 				break;
 			}
             PrintImages( path[0] );
+            WriteLog( cmd, path[0] );
 			break;
 		}
 		// 制御用コマンド
@@ -427,6 +419,21 @@
     return;
 }
 
+// 検索履歴をログに保存
+void MyCmdBox::WriteLog( wxString& cmd, wxString& path )
+{
+    wxString logfn = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH + wxT("log.txt");
+    wxTextFile logFile;
+    logFile.Open( logfn );
+    wxDateTime now = wxDateTime::Now();
+    wxString log = now.Format( wxT("%Y-%m-%d %H:%M:%S") ) + wxT(" ") + cmd + wxT(" ") + path;
+    logFile.AddLine( log );
+    logFile.Write();
+    logFile.Close();
+
+    return;
+}
+
 //////////////////////////////////////////////////////////////////////////
 // frame constructor
 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title )