changeset 3:a5bddd859104

implement delwhtie
author pyon@macmini
date Tue, 04 Oct 2011 07:43:08 +0900
parents 1ea4f7981ff5
children a505f7417742
files include/common.h include/delwhite.h include/myframe.h sample.rc src/delwhite.cpp src/myframe.cpp
diffstat 6 files changed, 94 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/include/common.h	Sun Oct 02 18:44:03 2011 +0900
+++ b/include/common.h	Tue Oct 04 07:43:08 2011 +0900
@@ -1,5 +1,5 @@
 // Filename   : common.h
-// Last Change: 02-Oct-2011.
+// Last Change: 03-Oct-2011.
 //
 #ifndef __COMMON__
 #define __COMMON__
@@ -19,6 +19,7 @@
     ID_DRIVE,
     ID_DATE,
     ID_CCN,
+    ID_STDIR,
     ID_MKDIR,
     ID_DIR,
     ID_DOMOVE,
--- a/include/delwhite.h	Sun Oct 02 18:44:03 2011 +0900
+++ b/include/delwhite.h	Tue Oct 04 07:43:08 2011 +0900
@@ -1,5 +1,5 @@
 // Filename   : delwhite.h
-// Last Change: 02-Oct-2011.
+// Last Change: 03-Oct-2011.
 //
 #ifndef __DELWHITE__
 #define __DEWHITEL__
@@ -40,6 +40,7 @@
 		FrameDelWhite( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxFRAME_NO_TASKBAR|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
 		~FrameDelWhite();
 
+        void UpdateList(wxCommandEvent&);
         void DeleteImage(wxCommandEvent&);
         void CloseFrame(wxCommandEvent&);
         void LoadImages(void);
--- a/include/myframe.h	Sun Oct 02 18:44:03 2011 +0900
+++ b/include/myframe.h	Tue Oct 04 07:43:08 2011 +0900
@@ -1,5 +1,5 @@
 // Filename   : myframe.h
-// Last Change: 02-Oct-2011.
+// Last Change: 03-Oct-2011.
 //
 #ifndef MYFRAME
 #define MYFRAME
@@ -43,6 +43,7 @@
     wxComboBox*       m_comboBoxMoveDrive;
     wxDatePickerCtrl* m_datePickerCcn;
     wxComboBox*       m_comboBoxCcn;
+    wxButton*         m_buttonSetDir;
     wxButton*         m_buttonMkDir;
 
     wxStaticText*     m_staticTextDummy;
@@ -59,6 +60,8 @@
     void OnQuit( wxCommandEvent& event );
     void OnAbout( wxCommandEvent& event );
     void OnDetectWhite( wxCommandEvent& event );
+    void SetDir( wxCommandEvent& event );
+    void MakeDir( wxCommandEvent& event );
     void SaveConfig( wxCloseEvent& event );
     void TellLocation( void );
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sample.rc	Tue Oct 04 07:43:08 2011 +0900
@@ -0,0 +1,32 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        samples/samples.rc
+// Purpose:     a standard Win32 .rc file for the wxWindows samples
+// Author:      Vadim Zeitlin
+// Modified by:
+// Created:     04.08.03
+// RCS-ID:      $Id: sample.rc 22863 2003-08-14 14:08:53Z VS $
+// Copyright:   (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// this minimal resource file is all what is needed for most of the wxWindows
+// samples
+
+// note that the icon used by the Explorer (i.e. the programs icon) is the
+// first icon in the executable and the icons are sorted both by their order
+// (Win9x) and by alphabetically (!) (NT), so put this icon first and give it
+// a name starting with "a"
+aaaaaaaa ICON "sample.ico"
+
+// this icon is used with wxFrame::SetIcon()
+sample ICON "sample.ico"
+
+// set this to 1 if you don't want to use manifest resource (manifest resource
+// is needed to enable visual styles on Windows XP - see docs/msw/winxp.txt
+// for more information)
+#define wxUSE_NO_MANIFEST 0
+
+// this is not always needed but doesn't hurt (except making the executable
+// very slightly larger): this file contains the standard icons, cursors, ...
+#include "wx/msw/wx.rc"
+
--- a/src/delwhite.cpp	Sun Oct 02 18:44:03 2011 +0900
+++ b/src/delwhite.cpp	Tue Oct 04 07:43:08 2011 +0900
@@ -1,5 +1,5 @@
 // Filename   : delwhite.cpp
-// Last Change: 02-Oct-2011.
+// Last Change: 03-Oct-2011.
 //
 
 #include "delwhite.h"
@@ -17,15 +17,14 @@
 FrameDelWhite::FrameDelWhite( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
 {
 	this->SetSize( 1200, 1000 );
-    //this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
-    //this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) );
+    this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
 	
 	wxBoxSizer* bSizer;
 	bSizer = new wxBoxSizer( wxVERTICAL );
 	
 	m_listCtrl = new wxListCtrl( this, ID_LSWHITE, wxDefaultPosition, wxDefaultSize, wxLC_ICON );
 	bSizer->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 );
-    m_imageList = new wxImageList( 105, 148 );
+    m_imageList = new wxImageList( 63, 89 );
     m_listCtrl->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL );
 	
 	wxBoxSizer* bSizerBtn;
@@ -59,11 +58,17 @@
 // Event Table
 BEGIN_EVENT_TABLE( FrameDelWhite, wxFrame )
     //EVT_LIST_ITEM_SELECTED( ID_LSTCTRL, FramePreview::ChageImage )
+    EVT_CHECKBOX( ID_CHECK, FrameDelWhite::UpdateList )
     EVT_BUTTON( ID_DELETE, FrameDelWhite::DeleteImage )
-    EVT_BUTTON( ID_CANCEL,   FrameDelWhite::CloseFrame  )
+    EVT_BUTTON( ID_CANCEL, FrameDelWhite::CloseFrame  )
 END_EVENT_TABLE()
 
 // Event Handlers
+void FrameDelWhite::UpdateList(wxCommandEvent& WXUNUSED(event))
+{
+    LoadImages();
+}
+
 void FrameDelWhite::DeleteImage(wxCommandEvent& WXUNUSED(event))
 {
     return;
@@ -78,6 +83,8 @@
 // Functions
 void FrameDelWhite::LoadImages( void )
 {
+    m_listCtrl->DeleteAllItems();
+    m_imageList->RemoveAll();
     wxDir dir(m_dir);
     wxString filename;
     if ( !dir.IsOpened() ) return;
@@ -90,7 +97,7 @@
         wxString f = m_dir + wxFILE_SEP_PATH + filename;
         wxFile file( f );
         long len = file.Length();
-        if ( !m_checkBox->IsChecked() && len < 2181468 ) { 
+        if ( !m_checkBox->IsChecked() && len > 150000 ) { 
             cout = dir.GetNext( &filename );
             continue;
         }
@@ -105,7 +112,7 @@
         m_listCtrl->SetItem( item );
 
         wxImage img( f, wxBITMAP_TYPE_JPEG );
-        wxBitmap bmp( img.Scale( 105, 148, wxIMAGE_QUALITY_HIGH ) );
+        wxBitmap bmp( img.Scale( 63, 89, wxIMAGE_QUALITY_HIGH ) );
         m_imageList->Add( bmp );
         cout = dir.GetNext( &filename );
         i++;
--- a/src/myframe.cpp	Sun Oct 02 18:44:03 2011 +0900
+++ b/src/myframe.cpp	Tue Oct 04 07:43:08 2011 +0900
@@ -1,5 +1,5 @@
 // Filename   : mainframe.cpp
-// Last Change: 02-Oct-2011.
+// Last Change: 03-Oct-2011.
 //
 #include "symbol.h"
 #include "common.h"
@@ -39,8 +39,7 @@
 MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title )
     : wxFrame( parent, id, title )
 {
-    //this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-	this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) );
+    this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
     // set the frame icon
     SetIcon(wxICON(sample));
 	
@@ -86,18 +85,29 @@
 	m_staticTextMoveTo = new wxStaticText( this, wxID_ANY, wxT("移動先フォルダ"), wxDefaultPosition, wxDefaultSize, 0 );
 	bSizerMoveTo->Add( m_staticTextMoveTo, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
-	m_comboBoxMoveDrive = new wxComboBox( this, ID_DRIVE, wxT("C:"), wxDefaultPosition, wxSize( 50,-1 ), 0, NULL, 0 ); 
-	bSizerMoveTo->Add( m_comboBoxMoveDrive, 0, wxALL, 5 );
+    wxArrayString drives;
+    drives.Add(wxT("C:"));
+    drives.Add(wxT("Y:"));
+    drives.Add(wxT("Z:"));
+	m_comboBoxMoveDrive = new wxComboBox( this, ID_DRIVE, wxT("C:"), wxDefaultPosition, wxSize( 50,-1 ), drives, 0 ); 
+	bSizerMoveTo->Add( m_comboBoxMoveDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
-	m_datePickerCcn = new wxDatePickerCtrl( this, ID_DATE, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT );
+	m_datePickerCcn = new wxDatePickerCtrl( this, ID_DATE, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN );
 	bSizerMoveTo->Add( m_datePickerCcn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
-	m_comboBoxCcn = new wxComboBox( this, ID_CCN, wxT("1\n2\n3\n"), wxDefaultPosition, wxSize( 100,-1 ), 0, NULL, 0 ); 
-	bSizerMoveTo->Add( m_comboBoxCcn, 0, wxALL, 5 );
+    wxArrayString ccns;
+	ccns.Add(wxT("角館1")); ccns.Add(wxT("角館2")); ccns.Add(wxT("角館3")); ccns.Add(wxT("角館4"));
+	ccns.Add(wxT("西仙1")); ccns.Add(wxT("西仙2")); ccns.Add(wxT("西仙3"));
+	ccns.Add(wxT("千畑1")); ccns.Add(wxT("千畑2")); ccns.Add(wxT("千畑3"));
+	ccns.Add(wxT("大曲1")); ccns.Add(wxT("大曲2")); ccns.Add(wxT("大曲3")); ccns.Add(wxT("大曲4")); ccns.Add(wxT("大曲5")); ccns.Add(wxT("大曲6"));
+	ccns.Add(wxT("六郷1")); ccns.Add(wxT("六郷2")); ccns.Add(wxT("六郷3"));
+	m_comboBoxCcn = new wxComboBox( this, ID_CCN, wxEmptyString, wxDefaultPosition, wxSize( 100,-1 ), ccns, 0 ); 
+	bSizerMoveTo->Add( m_comboBoxCcn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
-	bSizerMoveTo->Add( 0, 0, 0, 0, 5 );
-	
-	m_buttonMkDir = new wxButton( this, ID_MKDIR, wxT("ファルダ作成"), wxDefaultPosition, wxDefaultSize, 0 );
+	m_buttonSetDir = new wxButton( this, ID_STDIR, wxT("フォルダ指定"), wxDefaultPosition, wxDefaultSize, 0 );
+	bSizerMoveTo->Add( m_buttonSetDir, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+	m_buttonMkDir = new wxButton( this, ID_MKDIR, wxT("フォルダ作成"), wxDefaultPosition, wxDefaultSize, 0 );
 	bSizerMoveTo->Add( m_buttonMkDir, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
 	
 	bSizerTop->Add( bSizerMoveTo, 0, 0, 5 );
@@ -145,6 +155,8 @@
     EVT_MENU( wxID_EXIT,  MyFrame::OnQuit )
     EVT_MENU( wxID_ABOUT, MyFrame::OnAbout )
     EVT_BUTTON( ID_DTWHITE, MyFrame::OnDetectWhite )
+    EVT_BUTTON( ID_STDIR, MyFrame::SetDir )
+    EVT_BUTTON( ID_MKDIR, MyFrame::MakeDir )
     EVT_CLOSE( MyFrame::SaveConfig )
 END_EVENT_TABLE()
 
@@ -204,6 +216,23 @@
     dw->Show(true);
 }
 
+/* 移動先フォルダセット */
+void MyFrame::SetDir(wxCommandEvent& WXUNUSED(event))
+{
+    wxString dir;
+    dir.Append( m_comboBoxMoveDrive->GetValue() );
+    dir.Append( wxFILE_SEP_PATH );
+    wxDateTime dt = m_datePickerCcn->GetValue();
+    dir.Append( dt.Format(wxT("%Y%m%d")) );
+    dir.Append( wxFILE_SEP_PATH );
+    dir.Append( m_comboBoxCcn->GetValue() );
+    m_textCtrlMoveDir->SetValue( dir );
+}
+
+void MyFrame::MakeDir(wxCommandEvent& WXUNUSED(event))
+{
+}
+
 /* アプリケーションフォルダを開く */
 /*
 void MyFrame::OnOpenAppDir(wxCommandEvent& WXUNUSED(event))