comparison src/main.cpp @ 19:3bb803d8c1d7

Implement Mini-mode.
author pyon@macmini
date Sun, 07 Dec 2014 20:48:05 +0900
parents c066fde99517
children 92188f60323d
comparison
equal deleted inserted replaced
18:a8e6e5769e3b 19:3bb803d8c1d7
1 // Filename : main.cpp 1 // Filename : main.cpp
2 // Last Change: 23-Aug-2013. 2 // Last Change: 04-Dec-2014.
3 // 3 //
4 #include "main.h" 4 #include "main.h"
5 #include "myframe.h" 5 #include "myframe.h"
6 #include "miniframe.h"
7 #include "wx/cmdline.h"
6 8
7 IMPLEMENT_APP(MyApp) 9 IMPLEMENT_APP(MyApp)
8 10
9 IMPLEMENT_CLASS( MyApp, wxApp ) 11 IMPLEMENT_CLASS( MyApp, wxApp )
10 12
23 wxImage::AddHandler( new wxPNGHandler ); 25 wxImage::AddHandler( new wxPNGHandler );
24 26
25 InitLog(); 27 InitLog();
26 InitSetting(); 28 InitSetting();
27 29
28 MyFrame *mainframe = new MyFrame( NULL, ID_MAIN, wxT("Searcher 03"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE ); 30 if ( mode == 1 ) {
29 mainframe->SetSize( rect ); 31 MiniFrame *miniframe = new MiniFrame( NULL, ID_MAIN, wxT("Mini Searcher"), wxDefaultPosition, wxSize( 100, 45 ), wxMINIMIZE_BOX|wxSYSTEM_MENU|wxCAPTION|wxCLOSE_BOX|wxCLIP_CHILDREN );
30 mainframe->Show(true); 32 miniframe->Show( true );
33 }
34 else {
35 MyFrame *mainframe = new MyFrame( NULL, ID_MAIN, wxT("Searcher 03"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE );
36 mainframe->SetSize( rect );
37 mainframe->Show( true );
38 }
31 39
32 return true; 40 return true;
33 } 41 }
34 42
35 int MyApp::OnExit() 43 int MyApp::OnExit()
42 { 50 {
43 conf_file = wxGetCwd() + wxFILE_SEP_PATH + wxT("app.conf"); 51 conf_file = wxGetCwd() + wxFILE_SEP_PATH + wxT("app.conf");
44 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); 52 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
45 53
46 config->SetPath( wxT("/Geometry") ); 54 config->SetPath( wxT("/Geometry") );
55 config->Read( wxT("mode"), &mode );
47 config->Read( wxT("x"), &rect.x ); 56 config->Read( wxT("x"), &rect.x );
48 config->Read( wxT("y"), &rect.y ); 57 config->Read( wxT("y"), &rect.y );
49 config->Read( wxT("w"), &rect.width ); 58 config->Read( wxT("w"), &rect.width );
50 config->Read( wxT("h"), &rect.height ); 59 config->Read( wxT("h"), &rect.height );
51 delete config; 60 delete config;