# HG changeset patch # User pyon@macmini # Date 1541672143 -32400 # Node ID 36811fd22bd23fceefd3ec7c986f252e6ed07181 # Parent ae89ce4793d8ad4a762851567a6b4c845a7f9f2d v1.4 diff -r ae89ce4793d8 -r 36811fd22bd2 app.conf --- a/app.conf Wed Oct 31 20:10:29 2018 +0900 +++ b/app.conf Thu Nov 08 19:15:43 2018 +0900 @@ -12,4 +12,5 @@ [Misc] splash=-1 +;unlock_key=054fa2ab56938fc46ed69eb7ad93fa4828e4963b8a82f9514c3e2e86940510ed diff -r ae89ce4793d8 -r 36811fd22bd2 doc/Todo --- a/doc/Todo Wed Oct 31 20:10:29 2018 +0900 +++ b/doc/Todo Thu Nov 08 19:15:43 2018 +0900 @@ -42,12 +42,13 @@ ** server ‚Ì‹@”\ **************************************************************** * ’P‚È‚é web-server * ƒo[ƒWƒ‡ƒ“ƒAƒbƒv - + ƒwƒbƒ_‹‘”Û‹@”\‚đ’ljÁ ( ver1.2 ) - + log ‹@”\‚đ’ljÁ ( ver1.3 ) - + log ‹@”\‚đ‹­‰»(user-id) ( ver1.4 ) + + log ‹@”\‚đ‹­‰»(user-id) ( ver1.x ) + + ƒwƒbƒ_‹‘”Û‹@”\‚đ’ljÁ ( ver1.x ) ** grsearcher ‚Ì‹@”\ **************************************************************** * ƒo[ƒWƒ‡ƒ“ƒAƒbƒv + + ƒTƒeƒ‰ƒCƒgƒEƒBƒ“ƒhƒE‚̃}ƒEƒXƒWƒFƒXƒ`ƒƒ[(close) + + ƒLƒƒƒbƒVƒ…‚đŽg‚킞ƒƒ‚ƒŠ‚Ć + client ‚É pw + 10•ȘŠÔ Idle ‚È‚ç password + green-mode ‚Ì“‹Ú ( green, green/b, beige, gray ) diff -r ae89ce4793d8 -r 36811fd22bd2 include/id.h --- a/include/id.h Wed Oct 31 20:10:29 2018 +0900 +++ b/include/id.h Thu Nov 08 19:15:43 2018 +0900 @@ -1,5 +1,5 @@ // Filename : id.h -// Last Change: 2018-10-31 … 16:40:38. +// Last Change: 2018-11-08 –Ű 13:58:34. // #ifndef __ID_H__ @@ -7,8 +7,8 @@ #include -#define RSVER "1.3" -#define RSRELEASE "2018.10.31" +#define RSVER "1.4" +#define RSRELEASE "2018.11.01" enum { /* for mainframe */ @@ -16,7 +16,9 @@ ID_SEARCH, ID_PSEARCH, ID_LIST, + ID_LISTKANA, ID_NBOOK, + ID_SPLIT, // invisible for shortcut-key ID_SLDR, diff -r ae89ce4793d8 -r 36811fd22bd2 include/main.h --- a/include/main.h Wed Oct 31 20:10:29 2018 +0900 +++ b/include/main.h Thu Nov 08 19:15:43 2018 +0900 @@ -1,5 +1,5 @@ // Filename : main.h -// Last Change: 2018-10-31 … 13:21:30. +// Last Change: 2018-11-01 –Ű 11:13:19. // #include #include @@ -18,6 +18,7 @@ wxFileConfig *config; wxString conf_file; int splash = 150; + wxString unlock_key; wxString m_serveraddr; int m_serverport; bool develop; diff -r ae89ce4793d8 -r 36811fd22bd2 include/net.h --- a/include/net.h Wed Oct 31 20:10:29 2018 +0900 +++ b/include/net.h Thu Nov 08 19:15:43 2018 +0900 @@ -1,5 +1,5 @@ // Filename : net.h -// Last Change: 2018-10-31 æ°Ž 10:34:32. +// Last Change: 2018-11-08 朚 10:09:04. // #ifndef __NET_H__ @@ -23,6 +23,7 @@ bool GetDB(); int GetImagesSize( wxString hhs, wxString date ); void GetImages( wxString hhs, wxString date ); + void GetImages2Memory( wxString hhs, wxString date ); }; #endif //__NET_H__ diff -r ae89ce4793d8 -r 36811fd22bd2 include/rsearcher.h --- a/include/rsearcher.h Wed Oct 31 20:10:29 2018 +0900 +++ b/include/rsearcher.h Thu Nov 08 19:15:43 2018 +0900 @@ -1,5 +1,5 @@ // Filename : rsearcher.h -// Last Change: 2018-10-31 … 16:38:57. +// Last Change: 2018-11-08 –Ű 13:51:59. // #ifndef __RSEARCH_H__ @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -125,6 +126,9 @@ MyStaticBitmap* m_staticBitmap5; MyStaticBitmap* m_staticBitmap6; + wxSplitterWindow* m_splitter; + wxPanel* m_panelLeft; + wxPanel* m_panelRight; wxNotebook* m_notebook; wxScrolledWindow* m_scrolledWindow1; wxScrolledWindow* m_scrolledWindow2; @@ -138,6 +142,11 @@ wxDataViewListCtrl* m_dataViewListCtrl; wxDataViewColumn* m_dataViewListColumnNo; wxDataViewColumn* m_dataViewListColumnDate; + wxDataViewColumn* m_dataViewListColumnReady; + wxDataViewListCtrl* m_dataViewListKana; + wxDataViewColumn* m_dataViewListColumnKNo; + wxDataViewColumn* m_dataViewListColumnName; + wxDataViewColumn* m_dataViewListColumnAddr; wxTextCtrl* m_textCtrlLog; wxButton* m_buttonPsearch; wxButton* m_buttonPrint; @@ -177,8 +186,11 @@ void Close( void ); void InDevelop( bool ); + void OnSplitWin( wxSplitterEvent & event ); void OnItemSelected( wxDataViewEvent& event ); void OnItemDClicked( wxDataViewEvent& event ); + void OnKanaItemSelected( wxDataViewEvent& event ); + void OnKanaItemDClicked( wxDataViewEvent& event ); void OnNBookChanged( wxBookCtrlEvent& event ); void OnPasteSearch( wxCommandEvent& event ); void OnPrint( wxCommandEvent& event ); diff -r ae89ce4793d8 -r 36811fd22bd2 searcherR.fbp --- a/searcherR.fbp Wed Oct 31 20:10:29 2018 +0900 +++ b/searcherR.fbp Thu Nov 08 19:15:43 2018 +0900 @@ -2202,5 +2202,1071 @@ + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + ManageDBFrame + + 400,160 + wxCAPTION + ; ; forward_declare + + + + + wxTAB_TRAVERSAL + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerTop + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL + 0 + + 2 + wxBOTH + + + 0 + + fgSizer + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Date + 0 + + 0 + + + 0 + + 1 + m_staticTextDate + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_datePicker + 1 + + + protected + 1 + + Resizable + 1 + + wxDP_DROPDOWN|wxDP_SHOWCENTURY + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + HHS + 0 + + 0 + + + 0 + + 1 + m_staticTextHhs + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + Select a file + + 0 + + 1 + m_filePickerHhs + 1 + + + protected + 1 + + Resizable + 1 + + wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_SMALL|wxFLP_USE_TEXTCTRL + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + *.db + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + CCN + 0 + + 0 + + + 0 + + 1 + m_staticTextCcn + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + Select a file + + 0 + + 1 + m_filePickerCcn + 1 + + + protected + 1 + + Resizable + 1 + + wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_SMALL|wxFLP_USE_TEXTCTRL + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + *.db + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL + 0 + + + bSizerBtn + wxHORIZONTAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + ID_MNGBLD + Build + + 0 + + 0 + + + 0 + + 1 + m_buttonBuild + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Upload + + 0 + + 0 + + + 0 + + 1 + m_buttonUpld + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Exit + + 0 + + 0 + + + 0 + + 1 + m_buttonExit + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r ae89ce4793d8 -r 36811fd22bd2 src/main.cpp --- a/src/main.cpp Wed Oct 31 20:10:29 2018 +0900 +++ b/src/main.cpp Thu Nov 08 19:15:43 2018 +0900 @@ -1,7 +1,8 @@ // Filename : main.cpp -// Last Change: 2018-10-31 æ°Ž 15:18:12. +// Last Change: 2018-11-01 朚 11:39:22. // +#include #include "id.h" #include "main.h" #include "auth.h" @@ -31,6 +32,7 @@ // Main Window MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxEmptyString, wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE ); mainframe->SetServer( m_serveraddr, m_serverport ); + mainframe->InDevelop( true ); if ( !mainframe->GetDB() ) { mainframe->Destroy(); return true; @@ -39,7 +41,30 @@ // Splash Screen SplashScreen( splash ); - // User Dialgo + // Mode + if ( !unlock_key.IsEmpty() ) { + wxIPV4address addr; + addr.Hostname( wxGetFullHostName() ); + + wxString key = wxT( "re:searcher" ) + addr.IPAddress(); + wxArrayString args; + args.Add( wxT( "crypto.exe" ) ); + args.Add( wxT( "-a" ) ); + args.Add( key ); + + wxArrayString output, errors; + wxExecute( wxJoin( args, ' ', '\\' ), output, errors ); + + if ( unlock_key.IsSameAs( output[0] ) ) { + mainframe->SetUser( wxT( "root" ) ); + mainframe->SetTitle( wxT( "Re:Searcher - root" ) ); + mainframe->LoadDB(); + mainframe->Show( true ); + return true; + } + } + + // User Dialog AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "Who are you ?" ), wxDefaultPosition, wxDefaultSize, wxCAPTION ); if ( !authdlg->LoadDB() ) { authdlg->Destroy(); @@ -69,7 +94,6 @@ mainframe->SetUser( authdlg->GetUser() ); mainframe->SetTitle( wxT( "Re:Searcher - " ) + authdlg->GetUser() ); mainframe->LoadDB(); - mainframe->InDevelop( true ); mainframe->Show( true ); } else { mainframe->Destroy(); @@ -114,6 +138,7 @@ config->SetPath( wxT( "/Misc" ) ); config->Read( wxT( "splash" ), &splash ); + config->Read( wxT( "unlock_key" ), &unlock_key ); delete config; } diff -r ae89ce4793d8 -r 36811fd22bd2 src/net.cpp --- a/src/net.cpp Wed Oct 31 20:10:29 2018 +0900 +++ b/src/net.cpp Thu Nov 08 19:15:43 2018 +0900 @@ -1,5 +1,5 @@ // Filename : net.cpp -// Last Change: 2018-10-31 æ°Ž 10:42:06. +// Last Change: 2018-11-08 朚 10:08:45. // #include @@ -103,3 +103,35 @@ get.Close(); } +void RsHttp::GetImages2Memory( wxString hhs, wxString date ) +{ + wxHTTP get; + get.SetTimeout( 30 ); + get.SetFlags( wxSOCKET_WAITALL|wxSOCKET_BLOCK ); + while ( !get.Connect( m_server, m_port ) ) + wxSleep( 1 ); + + wxString url = wxT( "/images/" ) + date + wxT( "/" ) + hhs + wxT( ".tgz" ); + + wxInputStream *http_istream = get.GetInputStream( url ); + if ( get.GetError() == wxPROTO_NOERR ) { + //int size = http_istream->GetSize(); + wxZlibInputStream zlib_istream( http_istream ); // 0: no cache : bad + + wxTarEntry* entry; + wxTarInputStream tar_istream( zlib_istream ); + int i = 1; + while ( ( entry = tar_istream.GetNextEntry() ) != NULL ) { + //wxString name = entry->GetName(); + wxFileOutputStream file_ostream( wxString::Format( wxT( ".cache/%s_%d" ), date, i++ ) ); + file_ostream.Write( tar_istream ); + file_ostream.Close(); + } + } else { + wxMessageBox( wxT( "Re:Searcher Error: get err" ) ); + } + + //wxDELETE( http_istream ); + get.Close(); +} + diff -r ae89ce4793d8 -r 36811fd22bd2 src/rsearcher.cpp --- a/src/rsearcher.cpp Wed Oct 31 20:10:29 2018 +0900 +++ b/src/rsearcher.cpp Thu Nov 08 19:15:43 2018 +0900 @@ -1,5 +1,5 @@ // Filename : rsearcher.cpp -// Last Change: 2018-10-31 æ°Ž 16:39:35. +// Last Change: 2018-11-08 朚 14:47:21. // #include @@ -272,8 +272,11 @@ // Event Table BEGIN_EVENT_TABLE( MainFrame, wxFrame ) + EVT_SPLITTER_DCLICK( ID_SPLIT, MainFrame::OnSplitWin ) EVT_DATAVIEW_SELECTION_CHANGED( ID_LIST, MainFrame::OnItemSelected ) EVT_DATAVIEW_ITEM_ACTIVATED( ID_LIST, MainFrame::OnItemDClicked ) + EVT_DATAVIEW_SELECTION_CHANGED( ID_LISTKANA, MainFrame::OnKanaItemSelected ) + EVT_DATAVIEW_ITEM_ACTIVATED( ID_LISTKANA, MainFrame::OnKanaItemDClicked ) EVT_NOTEBOOK_PAGE_CHANGED( ID_NBOOK, MainFrame::OnNBookChanged ) EVT_BUTTON( ID_PSEARCH, MainFrame::OnPasteSearch ) EVT_BUTTON( wxID_PRINT, MainFrame::OnPrint ) @@ -293,6 +296,13 @@ // Event Handler +void MainFrame::OnSplitWin( wxSplitterEvent& WXUNUSED(event) ) +{ + int w, h; + this->GetSize( &w, &h ); + m_splitter->SetSashPosition( w - 200, true ); +} + void MainFrame::OnItemSelected( wxDataViewEvent& WXUNUSED(event) ) { int r = m_dataViewListCtrl->GetSelectedRow(); @@ -321,6 +331,26 @@ m_dataViewListCtrl->SetTextValue( wxT( "OK" ), r, 2 ); } +void MainFrame::OnKanaItemSelected( wxDataViewEvent& WXUNUSED(event) ) +{ + int r = m_dataViewListKana->GetSelectedRow(); + if ( r == wxNOT_FOUND ) return; +} + +void MainFrame::OnKanaItemDClicked( wxDataViewEvent& WXUNUSED(event) ) +{ + m_dataViewListCtrl->DeleteAllItems(); + wxGetApp().RemoveFile( wxT( ".cache/*" ) ); + LoadBitmaps( wxEmptyString, false ); + + int r = m_dataViewListKana->GetSelectedRow(); + m_searchCtrl->SetValue( m_dataViewListKana->GetTextValue( r, 0 ) ); + m_textCtrlName->SetValue( m_dataViewListKana->GetTextValue( r, 1 ) ); + m_textCtrlAddr->SetValue( m_dataViewListKana->GetTextValue( r, 2 ) ); + m_hhs = m_searchCtrl->GetValue(); + Search(); +} + void MainFrame::OnNBookChanged( wxBookCtrlEvent& WXUNUSED(event) ) { for ( int i = 0; i < m_notebook->GetPageCount(); i++ ) { @@ -399,7 +429,7 @@ void MainFrame::OnHelp( wxCommandEvent& WXUNUSED(event) ) { wxString version, build; - version = wxString::Format( wxT( "Re:Searcher-- version %s / %s\n\n" ), RSVER, RSRELEASE ); + version = wxString::Format( wxT( "Re:Searcher -- version %s / %s\n\n" ), RSVER, RSRELEASE ); build = wxString::Format( wxT( "build with %s\nrunning under %s." ), wxVERSION_STRING, wxGetOsDescription() ); wxMessageBox( version + build, wxT( "Help" ) ); @@ -431,20 +461,33 @@ void MainFrame::CreateControls( void ) { this->SetIcon( wxIcon( wxT( "sample" ) ) ); - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetSizeHints( wxSize( 400, 300 ), wxDefaultSize ); this->SetBackgroundColour( wxColour( 30, 80, 40 ) ); //this->SetBackgroundColour( wxColour( 153, 153, 153 ) ); wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL ); + + m_splitter = new wxSplitterWindow( this, ID_SPLIT, wxDefaultPosition, wxDefaultSize, wxSP_THIN_SASH ); + m_splitter->SetMinimumPaneSize( 20 ); + m_panelLeft = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_panelLeft->SetBackgroundColour( wxColour( 30, 80, 40 ) ); + m_panelRight = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_panelRight->SetBackgroundColour( wxColour( 30, 80, 40 ) ); + + int w, h; + this->GetSize( &w, &h ); + m_splitter->SplitVertically( m_panelLeft, m_panelRight, w - 200 ); // Left + wxBoxSizer* bSizerLeft = new wxBoxSizer( wxVERTICAL ); + wxImageList* imgList = new wxImageList( 16, 16, false, 1 ); wxBitmap bmp( wxT( "image/blue.png" ), wxBITMAP_TYPE_PNG ); imgList->Add( bmp, wxNullBitmap ); bmp.LoadFile( wxT( "image/water.png" ), wxBITMAP_TYPE_PNG ); imgList->Add( bmp, wxNullBitmap ); - m_notebook = new wxNotebook( this, ID_NBOOK, wxDefaultPosition, wxDefaultSize, 0 ); + m_notebook = new wxNotebook( m_panelLeft, ID_NBOOK, wxDefaultPosition, wxDefaultSize, 0 ); m_notebook->SetImageList( imgList ); m_scrolledWindow1 = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); @@ -471,44 +514,51 @@ m_scrolledWindow6->SetScrollRate( 5, 5 ); m_notebook->AddPage( m_scrolledWindow6, wxT( "Image-06" ), false, 0 ); - bSizerTop->Add( m_notebook, 1, wxEXPAND|wxALL, 5 ); + bSizerLeft->Add( m_notebook, 1, wxEXPAND|wxALL, 5 ); + m_panelLeft->SetSizer( bSizerLeft ); // Right wxBoxSizer* bSizerRight = new wxBoxSizer( wxVERTICAL ); - m_searchCtrl = new MySearchCtrl( this, ID_SEARCH, wxEmptyString, wxDefaultPosition, wxSize( -1, 24 ), wxTE_PROCESS_ENTER ); + m_searchCtrl = new MySearchCtrl( m_panelRight, ID_SEARCH, wxEmptyString, wxDefaultPosition, wxSize( -1, 24 ), wxTE_PROCESS_ENTER ); bSizerRight->Add( m_searchCtrl, 0, wxALL, 5 ); m_searchCtrl->SetFocus(); - m_textCtrlName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80, -1 ), wxTE_READONLY ); + m_textCtrlName = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80, -1 ), wxTE_READONLY ); m_textCtrlName->SetBackgroundColour( wxColour( 180, 210, 240 ) ); bSizerRight->Add( m_textCtrlName, 0, wxALL, 5 ); - m_textCtrlAddr = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 160, -1 ), wxTE_READONLY ); + m_textCtrlAddr = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 160, -1 ), wxTE_READONLY ); m_textCtrlAddr->SetBackgroundColour( wxColour( 180, 210, 240 ) ); bSizerRight->Add( m_textCtrlAddr, 0, wxALL|wxEXPAND, 5 ); - m_dataViewListCtrl = new wxDataViewListCtrl( this, ID_LIST, wxDefaultPosition, wxDefaultSize, wxDV_ROW_LINES|wxDV_SINGLE ); - m_dataViewListColumnNo = m_dataViewListCtrl->AppendTextColumn( wxT( "No" ), wxDATAVIEW_CELL_INERT, 30, wxALIGN_RIGHT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); - m_dataViewListColumnDate = m_dataViewListCtrl->AppendTextColumn( wxT( "Date" ), wxDATAVIEW_CELL_INERT, 80, wxALIGN_CENTER, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); - m_dataViewListColumnDate = m_dataViewListCtrl->AppendTextColumn( wxT( "Ready" ), wxDATAVIEW_CELL_INERT, 60, wxALIGN_CENTER, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); - + m_dataViewListCtrl = new wxDataViewListCtrl( m_panelRight, ID_LIST, wxDefaultPosition, wxDefaultSize, wxDV_ROW_LINES|wxDV_SINGLE ); + m_dataViewListColumnNo = m_dataViewListCtrl->AppendTextColumn( wxT( "No" ), wxDATAVIEW_CELL_INERT, 30, wxALIGN_RIGHT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); + m_dataViewListColumnDate = m_dataViewListCtrl->AppendTextColumn( wxT( " Date" ), wxDATAVIEW_CELL_INERT, 80, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); + m_dataViewListColumnReady = m_dataViewListCtrl->AppendTextColumn( wxT( "Ready" ), wxDATAVIEW_CELL_INERT, 60, wxALIGN_CENTER, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); bSizerRight->Add( m_dataViewListCtrl, 1, wxALL|wxEXPAND, 5 ); - m_textCtrlLog = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerRight->Add( m_textCtrlLog, 1, wxALL|wxEXPAND, 5 ); + m_dataViewListKana = new wxDataViewListCtrl( m_panelRight, ID_LISTKANA, wxDefaultPosition, wxDefaultSize, wxDV_ROW_LINES|wxDV_SINGLE ); + m_dataViewListColumnKNo = m_dataViewListKana->AppendTextColumn( wxT( " No" ), wxDATAVIEW_CELL_INERT, 70, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); + m_dataViewListColumnName = m_dataViewListKana->AppendTextColumn( wxT( " Name" ), wxDATAVIEW_CELL_INERT, 80, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); + m_dataViewListColumnAddr = m_dataViewListKana->AppendTextColumn( wxT( " Address" ), wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE ); + bSizerRight->Add( m_dataViewListKana, 1, wxALL|wxEXPAND, 5 ); + + m_textCtrlLog = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1, 40 ), 0 ); + bSizerRight->Add( m_textCtrlLog, 0, wxALL|wxEXPAND, 5 ); - m_slider = new wxSlider( this, ID_SLDR, 1, 1, 5, wxDefaultPosition, wxSize( -1, 200 ), wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_LABELS|wxSL_VERTICAL ); - bSizerRight->Add( m_slider, 0, wxALL, 5 ); - - m_buttonPsearch = new wxButton( this, ID_PSEARCH, wxT( "Paste-Search" ), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonPsearch = new wxButton( m_panelRight, ID_PSEARCH, wxT( "Paste-Search" ), wxDefaultPosition, wxDefaultSize, 0 ); bSizerRight->Add( m_buttonPsearch, 0, wxALL, 5 ); - m_buttonPrint = new wxButton( this, wxID_PRINT, wxT( "Print" ), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonPrint = new wxButton( m_panelRight, wxID_PRINT, wxT( "Print" ), wxDefaultPosition, wxDefaultSize, 0 ); bSizerRight->Add( m_buttonPrint, 0, wxALL, 5 ); - m_buttonLogout = new wxButton( this, ID_LOGOUT, wxT( "Logout" ), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerRight->Add( m_buttonLogout, 0, wxALL, 5 ); + // now building... + m_slider = new wxSlider( m_panelRight, ID_SLDR, 1, 1, 5, wxDefaultPosition, wxSize( -1, 200 ), wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_LABELS|wxSL_VERTICAL ); + //bSizerRight->Add( m_slider, 0, wxALL, 5 ); + + m_buttonLogout = new wxButton( m_panelRight, ID_LOGOUT, wxT( "Logout" ), wxDefaultPosition, wxDefaultSize, 0 ); + //bSizerRight->Add( m_buttonLogout, 0, wxALL, 5 ); // invisible buttons for shortcut-key m_buttonFocus = new wxButton( this, ID_FOCUS, wxT( "Focus" ), wxDefaultPosition, wxDefaultSize, 0 ); @@ -521,18 +571,20 @@ m_buttonDark->Hide(); m_buttonSatellite = new wxButton( this, ID_SWIN, wxT( "Satellite" ), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonSatellite->Hide(); - m_buttonClose = new wxButton( this, wxID_CLOSE, wxT( "Close" ), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonClose = new wxButton( this, wxID_CLOSE, wxT( "Close" ), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonClose->Hide(); - m_buttonHelp = new wxButton( this, wxID_HELP, wxT( "Help" ), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonHelp = new wxButton( this, wxID_HELP, wxT( "Help" ), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonHelp->Hide(); - bSizerTop->Add( bSizerRight, 0, wxEXPAND, 5 ); + m_panelRight->SetSizer( bSizerRight ); + // + bSizerTop->Add( m_splitter, 1, wxEXPAND, 0 ); + this->SetSizer( bSizerTop ); this->Layout(); //this->Centre( wxBOTH ); - m_staticBitmap1 = new MyStaticBitmap( m_scrolledWindow1, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); m_staticBitmap2 = new MyStaticBitmap( m_scrolledWindow2, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); m_staticBitmap3 = new MyStaticBitmap( m_scrolledWindow3, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); @@ -561,6 +613,7 @@ m_textCtrlName->SetValue( wxEmptyString ); m_textCtrlAddr->SetValue( wxEmptyString ); m_dataViewListCtrl->DeleteAllItems(); + m_dataViewListKana->DeleteAllItems(); wxGetApp().RemoveFile( wxT( ".cache/*" ) ); LoadBitmaps( wxEmptyString, false ); @@ -603,6 +656,58 @@ return; } + wxString hiragana = wxT( "ă‚ă„ă†ăˆăŠă‹ăăă‘ă“ă•ă—ă™ă›ăăŸăĄă€ăŠăšăȘにくねたはăČă”ăžă»ăŸăżă‚€ă‚ă‚‚ă‚„ă‚†ă‚ˆă‚‰ă‚Šă‚‹ă‚Œă‚ă‚ă‚’ă‚“ăŒăŽăă’ă”ă–ă˜ăšăœăžă ăąă„ă§ă©ă°ăłă¶ăčăŒă±ăŽă·ășăœăăƒă…ă‡ă‰ă‚ƒă‚…ă‚‡ăŁă€€" ); + wxString katakana = wxT( "スむり゚ă‚Șカキクケコゔシă‚čă‚»ă‚œă‚żăƒăƒ„ăƒ†ăƒˆăƒŠăƒ‹ăƒŒăƒăƒŽăƒăƒ’ăƒ•ăƒ˜ăƒ›ăƒžăƒŸăƒ ăƒĄăƒąăƒ€ăƒŠăƒšăƒ©ăƒȘルハロワăƒČンガゼグă‚Čコザゞă‚șă‚Œă‚Ÿăƒ€ăƒ‚ăƒ…ăƒ‡ăƒ‰ăƒăƒ“ăƒ–ăƒ™ăƒœăƒ‘ăƒ”ăƒ—ăƒšăƒă‚Ąă‚Łă‚„ă‚§ă‚©ăƒŁăƒ„ăƒ§ăƒƒă€€" ); + wxRegEx reHiraGana( wxT( "^[" ) + hiragana + wxT( "]+$" ) ); + wxRegEx reKataKana( wxT( "^[" ) + katakana + wxT( "]+$" ) ); + + bool fuzzy = false; + if ( cmd.Right( 1 ).IsSameAs( wxT( "%" ) ) ) { + cmd.Replace( wxT( "%" ), wxEmptyString, true ); + fuzzy = true; + } + + if ( reHiraGana.Matches( cmd ) || reKataKana.Matches( cmd ) ) { + if ( cmd.Len() < 5 ) { + wxMessageBox( wxT( "too short !" ) ); + return; + } + if ( reHiraGana.Matches( cmd ) ) { + for ( int i = 0; i < hiragana.Len(); i++ ) + cmd.Replace( hiragana[i], katakana[i], true ); + } + + int match_cnt = 0; + HhsHash::iterator it; + for( it = hhash.begin(); it != hhash.end(); ++it ){ + wxString key = it->first, value = it->second->kana; + value.Replace( wxT( " " ), wxEmptyString, true ); + if ( value.IsSameAs( cmd ) || ( fuzzy && value.StartsWith( cmd ) ) ) { + wxVector data; + data.push_back( key ); + data.push_back( it->second->name ); + data.push_back( it->second->addr ); + m_dataViewListKana->AppendItem( data ); + data.clear(); + m_dataViewListKana->ToggleWindowStyle( wxHSCROLL ); + match_cnt++; + } + } + + if ( match_cnt == 1 ) { + m_searchCtrl->SetValue( m_dataViewListKana->GetTextValue( 0, 0 ) ); + m_textCtrlName->SetValue( m_dataViewListKana->GetTextValue( 0, 1 ) ); + m_textCtrlAddr->SetValue( m_dataViewListKana->GetTextValue( 0, 2 ) ); + m_hhs = m_searchCtrl->GetValue(); + Search(); + } + + if ( match_cnt == 0 ) { + wxMessageBox( wxT( "No name matched." ) ); + } + return; + } + wxMessageBox( wxT( "Bad Input !!" ) ); } @@ -818,7 +923,7 @@ Search(); return; } - wxMessageBox( wxT( "Bad Input !!" ) ); + wxMessageBox( wxT( "Bad clipboard data !!" ) ); } void MainFrame::PrintImages( void )