# HG changeset patch # User pyon@macmini # Date 1318652667 -32400 # Node ID 7bf900d47e9e6c2fa4185dae9a8cb0887152c19a start mover2 diff -r 000000000000 -r 7bf900d47e9e .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sat Oct 15 13:24:27 2011 +0900 @@ -0,0 +1,10 @@ +syntax: glob +obj/*.o +img/* +tmp/* +db/* +work/* +*.app/* +.DS_Store +*.conf +*~ diff -r 000000000000 -r 7bf900d47e9e include/common.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/common.h Sat Oct 15 13:24:27 2011 +0900 @@ -0,0 +1,57 @@ +// Filename : common.h +// Last Change: 15-Oct-2011. +// +#ifndef __COMMON__ +#define __COMMON__ + +#include "wx/wxprec.h" + +#ifndef WX_PRECOMP + #include "wx/wx.h" + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#endif + +enum { + // mainframe + ID_MAIN = wxID_HIGHEST + 1, + ID_TEST, + + ID_MENUBARFILE, + ID_MENUITEMPARAM, + ID_MENUITEMAPPDIR, + ID_MENUITEMQUIT, + + ID_BUTTONMKDIR, + ID_TEXTCTRLDIST, + ID_TEXTCTRLGUESS, + ID_LISTCTRLVIEW, + + ID_BUTTONMOVE, + ID_BUTTONDEL, + ID_BUTTONUNDO, + + // param + ID_BUTTONSAVE, +}; +#endif // __COMMON__ + diff -r 000000000000 -r 7bf900d47e9e include/main.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/main.h Sat Oct 15 13:24:27 2011 +0900 @@ -0,0 +1,33 @@ +// Filename : main.h +// Last Change: 15-Oct-2011. +// +#include "wx/wx.h" +#include "wx/config.h" +#include "wx/fileconf.h" + +#include "symbol.h" +// private classes +// Define a new application type, each program should derive a class from wxApp +class MyApp : public wxApp +{ + DECLARE_CLASS( MyApp ) +public: + MyApp(); + ~MyApp(); + + virtual bool OnInit(); + virtual int OnExit(); + void ConfInit(); + + wxFileConfig *config; + wxString conf_file; + wxRect rect; + wxString workdir; + wxString lmin; + wxString lmax; + wxString bmin; + wxString bmax; +}; + +DECLARE_APP(MyApp) + diff -r 000000000000 -r 7bf900d47e9e include/marksheet.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/marksheet.h Sat Oct 15 13:24:27 2011 +0900 @@ -0,0 +1,97 @@ +// Filename : marksheet.h +// Last Change: 06-Oct-2011. +// +#ifndef __MARKSHEET__ +#define __MARKSHEET__ + + +#include "wx/utils.h" +#include "wx/file.h" +#include "wx/string.h" +#include "wx/image.h" + +bool IsBlack( int r, int g, int b ) +{ + if ( r == 0 && g == 0 && b == 0 ) { + return true; + } + return false; +}; + +wxString GuessHhs( wxString& file ) +{ + wxString hhs; + wxImage img( file, wxBITMAP_TYPE_JPEG ); + int sx = 1800; // start x + int sy = 315;; // start y + int bw = 60; // block width + int bh = 50; // block height + int area = bw * bh; + int black = 0; + int x, y; + unsigned char r, g, b; + + int max_n; + float max; + float bk; + for ( int c=0; c<10; c++ ) { + max = 0.0; + max_n = -1; + for ( int n=0; n<10; n++ ) { + + for ( x=sx+bw*c; x $(PROGNAME).app/Contents/Info.plist + + echo -n "APPL????" > $(EXECUTABLE) + + ln -f $(PROGNAME) $(PROGNAME).app/Contents/MacOS/$(PROGNAME) + cp -f wxmac.icns $(PROGNAME).app/Contents/Resources/wxmac.icns + + open $(PROGNAME).app +endif + + +clean: + rm -f $(PROGNAME) $(PROGNAME).exe + rm -f $(OBJDIR)/*.o + rm -rf $(PROGNAME).app + +.PHONY: all clean + diff -r 000000000000 -r 7bf900d47e9e src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main.cpp Sat Oct 15 13:24:27 2011 +0900 @@ -0,0 +1,87 @@ +// Filename : main.cpp +// Last Change: 15-Oct-2011. +// + +#include "common.h" +#include "main.h" +#include "myframe.h" +//#include "testframe.cpp" + +IMPLEMENT_APP(MyApp) + +IMPLEMENT_CLASS( MyApp, wxApp ) + +MyApp::MyApp() +{ +} +MyApp::~MyApp() +{ +} + +bool MyApp::OnInit() +{ + if ( !wxApp::OnInit() ) return false; + + wxImage::AddHandler( new wxJPEGHandler ); + + ConfInit(); + + wxString progname = wxT("A Mover"); + wxString verstr = wxString::Format( wxT(" - v%d.%d ( build %d )"), VER, REV, BLD ); + wxString title = progname + verstr; + + MyFrame *mainframe = new MyFrame( NULL, ID_MAIN, title ); + mainframe->SetSize( rect ); + mainframe->SetMinSize( wxSize( 580, 680 ) ); + mainframe->Show(true); + /* + TestFrame *tf = new TestFrame( NULL, ID_TEST, wxT("A Test") ); + tf->Show(true); + */ + + return true; +} + +int MyApp::OnExit() +{ + config->SetPath( wxT("/Geometry") ); + config->Write( wxT("x"), rect.x ); + config->Write( wxT("y"), rect.y ); + config->Write( wxT("w"), rect.width ); + config->Write( wxT("h"), rect.height ); + + config->SetPath( wxT("/WorkDir") ); + config->Write( wxT("workdir"), workdir ); + + config->SetPath( wxT("/Param") ); + config->Write( wxT("lmin"), lmin ); + config->Write( wxT("lmax"), lmax ); + config->Write( wxT("bmin"), bmin ); + config->Write( wxT("bmax"), bmax ); + + delete config; + + return 0; +} + +void MyApp::ConfInit() +{ + conf_file = wxGetCwd() + wxFILE_SEP_PATH + MYAPPNAME + wxT(".conf"); + config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); + + config->SetPath( wxT("/Geometry") ); + config->Read( wxT("x"), &rect.x ); + config->Read( wxT("y"), &rect.y ); + config->Read( wxT("w"), &rect.width ); + config->Read( wxT("h"), &rect.height ); + + config->SetPath( wxT("/WorkDir") ); + config->Read( wxT("workdir"), &workdir ); + + config->SetPath( wxT("/Param") ); + config->Read( wxT("lmin"), lmin ); + config->Read( wxT("lmax"), lmax ); + config->Read( wxT("bmin"), bmin ); + config->Read( wxT("bmax"), bmax ); +} + diff -r 000000000000 -r 7bf900d47e9e src/myframe.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/myframe.cpp Sat Oct 15 13:24:27 2011 +0900 @@ -0,0 +1,330 @@ +// Filename : myframe.cpp +// Last Change: 15-Oct-2011. +// + +#include "main.h" +#include "myframe.h" + +////////////////////////////////////////////////////////////////////////// +// frame constructor +MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) +{ + this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); + // set the frame icon + //SetIcon(wxICON(sample)); + + // メニューバー + m_menubarFile = new wxMenuBar(); + m_menuFile = new wxMenu(); + wxMenuItem* m_menuItemParam; + m_menuItemParam = new wxMenuItem( m_menuFile, ID_MENUITEMPARAM, wxString( wxT("パラメータ(&P)") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItemParam ); + + wxMenuItem* m_menuItemAppDIr; + m_menuItemAppDIr = new wxMenuItem( m_menuFile, ID_MENUITEMAPPDIR, wxString( wxT("アプリフォルダを開く(&O)") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItemAppDIr ); + + wxMenuItem* m_separator; + m_separator = m_menuFile->AppendSeparator(); // ---- + + wxMenuItem* m_menuItemQuit; + m_menuItemQuit = new wxMenuItem( m_menuFile, ID_MENUITEMQUIT, wxString( wxT("終了(&X)") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItemQuit ); + + m_menubarFile->Append( m_menuFile, wxT("ファイル(&F)") ); + + this->SetMenuBar( m_menubarFile ); + + // コントロール + wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerFrom = new wxBoxSizer( wxHORIZONTAL ); + + m_staticTextWork = new wxStaticText( this, wxID_ANY, wxT("作業フォルダ"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerFrom->Add( m_staticTextWork, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_dirPickerWork = new wxDirPickerCtrl( this, wxID_ANY, wxGetApp().workdir, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE ); + bSizerFrom->Add( m_dirPickerWork, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerTop->Add( bSizerFrom, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizerCcn = new wxBoxSizer( wxHORIZONTAL ); + + m_staticTextDrive = new wxStaticText( this, wxID_ANY, wxT("ドライブ"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerCcn->Add( m_staticTextDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxArrayString drives; + drives.Add(wxT("C:")); + drives.Add(wxT("Y:")); + drives.Add(wxT("Z:")); + m_comboBoxDrive = new wxComboBox( this, wxID_ANY, wxT("C:"), wxDefaultPosition, wxSize(50,-1), drives, 0 ); + bSizerCcn->Add( m_comboBoxDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextDate = new wxStaticText( this, wxID_ANY, wxT("開催日"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerCcn->Add( m_staticTextDate, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_datePicker = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN ); + bSizerCcn->Add( m_datePicker, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextCcn = new wxStaticText( this, wxID_ANY, wxT("合議体"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerCcn->Add( m_staticTextCcn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 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, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(100,-1), ccns, 0 ); + bSizerCcn->Add( m_comboBoxCcn, 0, wxALL, 5 ); + + m_buttonMkDir = new wxButton( this, ID_BUTTONMKDIR, wxT("適用"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerCcn->Add( m_buttonMkDir, 0, wxALL, 5 ); + + bSizerTop->Add( bSizerCcn, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizerDist = new wxBoxSizer( wxHORIZONTAL ); + + m_staticTextDist = new wxStaticText( this, wxID_ANY, wxT("保存フォルダ"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerDist->Add( m_staticTextDist, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlDist = new wxTextCtrl( this, ID_TEXTCTRLDIST, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textCtrlDist->SetMaxLength( 15 ); + bSizerDist->Add( m_textCtrlDist, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerDist->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizerTop->Add( bSizerDist, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizerManip = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerGuess = new wxBoxSizer( wxVERTICAL ); + + m_staticTextName = new wxStaticText( this, wxID_ANY, wxT("氏名"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerGuess->Add( m_staticTextName, 0, wxALL, 5 ); + m_bitmapName = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerGuess->Add( m_bitmapName, 0, wxALL, 5 ); + + m_staticTextHhsno = new wxStaticText( this, wxID_ANY, wxT("被保険者番号"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerGuess->Add( m_staticTextHhsno, 0, wxALL, 5 ); + m_bitmapHHsno = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerGuess->Add( m_bitmapHHsno, 0, wxALL, 5 ); + + m_staticTextGuess = new wxStaticText( this, wxID_ANY, wxT("推定値"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerGuess->Add( m_staticTextGuess, 0, wxALL, 5 ); + m_textCtrlGuess = new wxTextCtrl( this, ID_TEXTCTRLGUESS, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textCtrlGuess->SetMaxLength( 10 ); + bSizerGuess->Add( m_textCtrlGuess, 0, wxALL, 5 ); + + bSizerManip->Add( bSizerGuess, 0, wxEXPAND, 5 ); + + m_listCtrlView = new wxListCtrl( this, ID_LISTCTRLVIEW, wxDefaultPosition, wxDefaultSize, wxLC_ICON ); + bSizerManip->Add( m_listCtrlView, 1, wxALL|wxEXPAND, 5 ); + m_imageList = new wxImageList( 63, 89 ); + m_listCtrlView->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL ); + + wxBoxSizer* bSizerButton = new wxBoxSizer( wxVERTICAL ); + + m_buttonMove = new wxButton( this, ID_BUTTONMOVE, wxT("移動"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButton->Add( m_buttonMove, 0, wxALL, 5 ); + m_buttonDel = new wxButton( this, ID_BUTTONDEL, wxT("削除"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButton->Add( m_buttonDel, 0, wxALL, 5 ); + m_buttonUndo = new wxButton( this, ID_BUTTONUNDO, wxT("戻す"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButton->Add( m_buttonUndo, 0, wxALL, 5 ); + + bSizerManip->Add( bSizerButton, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerTop->Add( bSizerManip, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizerTop ); + this->Layout(); + + // ステータスバー + int widths[] = { -1, 150, 120, 120 }; + m_statusBar = this->CreateStatusBar( WXSIZEOF(widths), wxST_SIZEGRIP ); + m_statusBar->SetStatusWidths( WXSIZEOF(widths), widths ); + m_statusBar->SetStatusText( wxEmptyString, 0 ); + + this->Centre( wxBOTH ); + + ReadyImage(); +} + +// destructor +MyFrame::~MyFrame() +{ +} + +// Event Table +BEGIN_EVENT_TABLE( MyFrame, wxFrame ) + EVT_SIZE( MyFrame::OnSize ) + EVT_MOVE( MyFrame::OnMove ) + /* + EVT_MENU( wxID_EXIT, MyFrame::OnQuit ) + EVT_MENU( wxID_ABOUT, MyFrame::OnAbout ) + EVT_MENU( ID_OPWORK, MyFrame::OnOpenWorkDir ) + EVT_BUTTON( ID_STDIR, MyFrame::SetDir ) + EVT_BUTTON( ID_MKDIR, MyFrame::MakeDir ) + EVT_BUTTON( ID_DOMOVE, MyFrame::MoveImages ) + EVT_LIST_ITEM_ACTIVATED( ID_LIST, MyFrame::OnOpenHhsDir ) + */ + EVT_CLOSE( MyFrame::SaveConfig ) +END_EVENT_TABLE() + +// Event Handlers +/* 移動先フォルダセット */ +void MyFrame::SetDir(wxCommandEvent& WXUNUSED(event)) +{ + wxString dir; + dir.Append( m_comboBoxDrive->GetValue() ); + dir.Append( wxFILE_SEP_PATH ); + wxDateTime dt = m_datePicker->GetValue(); + dir.Append( dt.Format(wxT("%Y%m%d")) ); + dir.Append( wxFILE_SEP_PATH ); + dir.Append( m_comboBoxCcn->GetValue() ); + m_textCtrlDist->SetValue( dir ); +} + +/* 移動先フォルダ作成 */ +void MyFrame::MakeDir(wxCommandEvent& WXUNUSED(event)) +{ + wxString distdir = m_textCtrlDist->GetValue(); + wxString ccn = m_comboBoxCcn->GetValue(); + if ( distdir.Len() < 15 || ccn.IsEmpty() ) { + wxMessageBox(wxT("フォルダを指定してください.")); + return; + } + + wxStringTokenizer tkz( distdir, wxFILE_SEP_PATH ); + wxString d; + while ( tkz.HasMoreTokens() ) { + d.Append( tkz.GetNextToken() ); + d.Append( wxFILE_SEP_PATH ); + if ( !wxDirExists( d ) ) wxMkdir( d ); + } + + wxMessageBox(wxT("移動先フォルダ準備完了")); + wxString cmd = wxT("explorer ") + distdir; + wxExecute( cmd ); +} + +void MyFrame::Do(wxCommandEvent& WXUNUSED(event)) +{ + MoveImage(); + ReadyImage(); +} + +/* 画像をリストコントロールに表示 */ +void MyFrame::ReadyImage() +{ + wxString workdir = m_dirPickerWork->GetPath(); + wxDir dir( workdir ); + if ( !dir.IsOpened() ) return; + + wxString filename; + bool cout = dir.GetFirst( &filename, wxT("*.jpg"), wxDIR_FILES ); + + int i = 0; + m_listCtrlView->DeleteAllItems(); + m_imageList->RemoveAll(); + wxListItem item; + while ( cout ) { + if ( i > 7 ) break; + + wxString imagefile = workdir + wxFILE_SEP_PATH + filename; + if ( i > 1 && IsMarksheet() ) cout = false; + + item.SetId(i); + item.SetMask(wxLIST_MASK_STATE|wxLIST_MASK_TEXT|wxLIST_MASK_IMAGE); + item.SetStateMask(wxLIST_STATE_SELECTED); + item.SetState(wxLIST_STATE_SELECTED); + item.SetImage(i); + item.SetText(filename); + m_listCtrlView->InsertItem( item ); + m_listCtrlView->SetItem( item ); + + wxImage img( imagefile, wxBITMAP_TYPE_JPEG ); + wxBitmap bmp( img.Scale( 63, 89, wxIMAGE_QUALITY_HIGH ) ); + m_imageList->Add( bmp ); + // write log + i++; + cout = dir.GetNext( &filename ); + } + /* + wxImage img_org( s, wxBITMAP_TYPE_JPEG ); + wxImage img_name; + img_name = img_org.GetSubImage( wxRect( wxPoint(328,556), wxSize(626,288) ) ); + img_name = img_name.Scale( 200, 92 ); + */ +} + +/* 画像移動 */ +void MyFrame::MoveImage() +{ + wxString distdir = m_textCtrlDist->GetValue(); + wxString ccn = m_comboBoxCcn->GetValue(); + if ( distdir.IsEmpty() || ccn.IsEmpty() ) { + wxMessageBox(wxT("フォルダを指定してください.")); + return; + } + + distdir.Append( wxFILE_SEP_PATH ); + if ( !wxDirExists( distdir ) ) { + wxMessageBox(wxT("フォルダが存在しません.")); + return; + } + + /* + wxString to = distdir + wxFILE_SEP_PATH + hhs + wxFILE_SEP_PATH + filename; + wxRenameFile( from, to, false ); + */ +} + +// 以下,定型もの +/* アプリフォルダを開く */ +void MyFrame::OnOpenAppDir(wxCommandEvent& WXUNUSED(event)) +{ + wxString appdir = m_dirPickerWork->GetPath(); + wxString execmd = wxT("explorer ") + appdir; + wxExecute( execmd ); +} + +/* サイズ変更 */ +void MyFrame::OnSize(wxSizeEvent& event) +{ + this->Refresh( true, NULL ); + TellLocation(); + event.Skip(); +} +/* ウィンドウ移動 */ +void MyFrame::OnMove(wxMoveEvent& WXUNUSED(event)) +{ + TellLocation(); + return; +} +/* ウィンドウ位置とサイズを表示 */ +void MyFrame::TellLocation( void ) +{ + wxRect r = this->GetRect(); + int x = r.GetX(); + int y = r.GetY(); + int w = r.GetWidth(); + int h = r.GetHeight(); + SetStatusText( wxString::Format(wxT("(%d,%d) %dx%d"),x,y,w,h), 2 ); +} +/* 終了 */ +void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) +{ + Close(true); +} +/* 設定を保存 */ +void MyFrame::SaveConfig(wxCloseEvent& WXUNUSED(event)) +{ + if ( !IsIconized() && !IsMaximized() ) { + wxGetApp().rect = this->GetRect(); + } + wxGetApp().workdir = m_dirPickerWork->GetPath(); + + Destroy(); +} + diff -r 000000000000 -r 7bf900d47e9e src/param.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/param.cpp Sat Oct 15 13:24:27 2011 +0900 @@ -0,0 +1,72 @@ +// Filename : param.cpp +// Last Change: 15-Oct-2011. +// + +#include "main.h" +#include "param.h" + +/////////////////////////////////////////////////////////////////////////// +ParamDialog::ParamDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); + + wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL ); + + wxGridSizer* gSizer = new wxGridSizer( 2, 3, 0, 0 ); + + m_textCtrlLenMIn = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_textCtrlLenMIn, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALIGN_RIGHT|wxALIGN_TOP, 20 ); + + m_staticTextLen = new wxStaticText( this, wxID_ANY, wxT("< レングス <"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_staticTextLen, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_textCtrlLenMax = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_textCtrlLenMax, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlBMin = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_textCtrlBMin, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextBlack = new wxStaticText( this, wxID_ANY, wxT("< 黒色比率 <"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_staticTextBlack, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_textCtrlBmax = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_textCtrlBmax, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextlDummy = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_staticTextlDummy, 0, wxALL, 5 ); + + m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT("キャンセル"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_buttonCancel, 0, wxALL, 5 ); + + m_buttonSave = new wxButton( this, ID_BUTTONSAVE, wxT("設定保存"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer->Add( m_buttonSave, 0, wxALIGN_BOTTOM|wxALIGN_TOP, 10 ); + + bSizer->Add( gSizer, 0, 0, 20 ); + + this->SetSizer( bSizer ); + this->Layout(); + bSizer->Fit( this ); + + this->Centre( wxBOTH ); + + GetParam(); +} + +// destructor +ParamDialog::~ParamDialog() +{ +} +// Event Table +BEGIN_EVENT_TABLE( ParamDialog, wxDialog ) + EVT_BUTTON( ID_BUTTONSAVE, ParamDialog::SaveParam ) +END_EVENT_TABLE() + +/* 現在の設定を読込み */ +void ParamDialog::GetParam(void) +{ +} +/* 設定を保存 */ +void ParamDialog::SaveParam(wxCommandEvent& WXUNUSED(event)) +{ +} + diff -r 000000000000 -r 7bf900d47e9e src/testframe.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/testframe.cpp Sat Oct 15 13:24:27 2011 +0900 @@ -0,0 +1,76 @@ +// Filename : testframe.cpp +// Last Change: 08-Oct-2011. +// +#include "common.h" + +class TestFrame : public wxFrame +{ + DECLARE_EVENT_TABLE() + private: + wxListCtrl* m_listCtrl; + + public: + TestFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLOSE_BOX ); + ~TestFrame(); + + void OnMessage(wxListEvent&); +}; + +// constructor +TestFrame::TestFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) + : wxFrame( parent, id, title, pos, size, style ) +{ + this->SetSize( 400, 600 ); + this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); + + wxBoxSizer* bSizer; + bSizer = new wxBoxSizer( wxVERTICAL ); + + m_listCtrl = new wxListCtrl( this, ID_LSWHITE, wxDefaultPosition, wxDefaultSize, wxLC_REPORT ); + wxListItem itemCol; + itemCol.SetText( wxT("通番") ); + m_listCtrl->InsertColumn( 0, itemCol ); + m_listCtrl->SetColumnWidth( 0, 100 ); + itemCol.SetText( wxT("被保険者番号") ); + m_listCtrl->InsertColumn( 1, itemCol ); + m_listCtrl->SetColumnWidth( 1, 180 ); + itemCol.SetText( wxT("ファイル数") ); + m_listCtrl->InsertColumn( 2, itemCol ); + m_listCtrl->SetColumnWidth( 1, 100 ); + bSizer->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); + + this->SetSizer( bSizer ); + this->Layout(); + + this->Centre( wxBOTH ); + + m_listCtrl->InsertItem( 1, wxT("aaa") ); + m_listCtrl->SetItem( 0, 1, wxT("bbb"), -1 ); + m_listCtrl->InsertItem( 1, wxT("aa2") ); + m_listCtrl->SetItem( 1, 1, wxT("bb2"), -1 ); +} + +// destructor +TestFrame::~TestFrame() +{ +} + +// Event Table +BEGIN_EVENT_TABLE( TestFrame, wxFrame ) + EVT_LIST_ITEM_ACTIVATED( ID_LSWHITE, TestFrame::OnMessage ) +END_EVENT_TABLE() + +// Event Handlers +void TestFrame::OnMessage(wxListEvent& event) +{ + wxListItem item = event.GetItem(); + item.SetColumn(1); + item.SetMask(wxLIST_MASK_TEXT); + //int n = item.GetColumn(); + //wxString msg_n = wxString::Format(wxT("%d"),n); + //wxMessageBox( msg_n ); + m_listCtrl->GetItem( item ); + wxString msg = item.GetText(); + wxMessageBox( msg ); +} + diff -r 000000000000 -r 7bf900d47e9e src/testtune.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/testtune.cpp Sat Oct 15 13:24:27 2011 +0900 @@ -0,0 +1,104 @@ +// Filename : testtune.cpp +// Last Change: 13-Oct-2011. +// + +#include "wx/utils.h" +#include "wx/file.h" +#include "wx/string.h" +#include "wx/app.h" +#include "wx/image.h" + +bool IsBlack( int r, int g, int b ) +{ + if ( r == 0 && g == 0 && b == 0 ) { + return true; + } + return false; +} + +wxString GuessHhs( wxString& file ) +{ + wxString hhs; + wxImage img( file, wxBITMAP_TYPE_JPEG ); + int sx = 1800; // start x + int sy = 315;; // start y + int bw = 60; // block width + int bh = 50; // block height + int area = bw * bh; + int black = 0; + int x, y; + unsigned char r, g, b; + + int max_n; + float max; + float bk; + for ( int c=0; c<10; c++ ) { + max = 0.0; + max_n = -1; + for ( int n=0; n<10; n++ ) { + + for ( x=sx+bw*c; x