Mercurial > mercurial > hgweb_searcher03.cgi
comparison src/mask.cpp @ 1:7b6dab24f4b8
Gui parts complete.
| author | pyon@macmini |
|---|---|
| date | Sun, 04 Aug 2013 21:42:49 +0900 |
| parents | 0c0701a935f8 |
| children | c066fde99517 |
comparison
equal
deleted
inserted
replaced
| 0:0c0701a935f8 | 1:7b6dab24f4b8 |
|---|---|
| 1 // Filename : mask.cpp | 1 // Filename : mask.cpp |
| 2 // Last Change: 21-Jul-2013. | 2 // Last Change: 04-Aug-2013. |
| 3 // | 3 // |
| 4 | 4 |
| 5 #include "mask.h" | 5 #include "mask.h" |
| 6 | 6 |
| 7 MaskDialog::MaskDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) | 7 MaskDialog::MaskDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) |
| 91 | 91 |
| 92 this->SetSizer( bSizerTop ); | 92 this->SetSizer( bSizerTop ); |
| 93 this->Layout(); | 93 this->Layout(); |
| 94 | 94 |
| 95 this->Centre( wxBOTH ); | 95 this->Centre( wxBOTH ); |
| 96 | |
| 97 conf_file = wxGetCwd() + wxFILE_SEP_PATH + wxT("app.conf"); | |
| 98 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); | |
| 99 | |
| 100 GetParams(); | |
| 101 } | 96 } |
| 102 | 97 |
| 103 MaskDialog::~MaskDialog() | 98 MaskDialog::~MaskDialog() |
| 104 { | 99 { |
| 105 delete config; | |
| 106 } | 100 } |
| 107 | 101 |
| 108 // Event Table | 102 // Event Table |
| 109 BEGIN_EVENT_TABLE( MaskDialog, wxDialog ) | 103 BEGIN_EVENT_TABLE( MaskDialog, wxDialog ) |
| 110 EVT_BUTTON( ID_SETPARAM, MaskDialog::SetParams ) | 104 EVT_BUTTON( ID_SETPARAM, MaskDialog::OnSet ) |
| 111 END_EVENT_TABLE() | 105 END_EVENT_TABLE() |
| 112 | 106 |
| 113 void MaskDialog::GetParams( void ) | 107 // Event Handlers & Functions |
| 108 void MaskDialog::OnSet( wxCommandEvent& WXUNUSED(event) ) | |
| 114 { | 109 { |
| 115 wxString x, y, w, h; | 110 wxString buf; |
| 111 buf = m_textCtrlM1x->GetValue(); buf.ToLong( &x, 10 ); | |
| 112 buf = m_textCtrlM1y->GetValue(); buf.ToLong( &y, 10 ); | |
| 113 buf = m_textCtrlM1w->GetValue(); buf.ToLong( &w, 10 ); | |
| 114 buf = m_textCtrlM1h->GetValue(); buf.ToLong( &h, 10 ); | |
| 115 m_mask1.SetPosition( wxPoint( x, y ) ); | |
| 116 m_mask1.SetSize( wxSize( w, h ) ); | |
| 116 | 117 |
| 117 config->SetPath( wxT("/Mask") ); | 118 buf = m_textCtrlM2x->GetValue(); buf.ToLong( &x, 10 ); |
| 119 buf = m_textCtrlM2y->GetValue(); buf.ToLong( &y, 10 ); | |
| 120 buf = m_textCtrlM2w->GetValue(); buf.ToLong( &w, 10 ); | |
| 121 buf = m_textCtrlM2h->GetValue(); buf.ToLong( &h, 10 ); | |
| 122 m_mask2.SetPosition( wxPoint( x, y ) ); | |
| 123 m_mask2.SetSize( wxSize( w, h ) ); | |
| 118 | 124 |
| 119 config->Read( wxT("x1"), &x ); | 125 buf = m_textCtrlM3x->GetValue(); buf.ToLong( &x, 10 ); |
| 120 config->Read( wxT("y1"), &y ); | 126 buf = m_textCtrlM3y->GetValue(); buf.ToLong( &y, 10 ); |
| 121 config->Read( wxT("w1"), &w ); | 127 buf = m_textCtrlM3w->GetValue(); buf.ToLong( &w, 10 ); |
| 122 config->Read( wxT("h1"), &h ); | 128 buf = m_textCtrlM3h->GetValue(); buf.ToLong( &h, 10 ); |
| 129 m_mask3.SetPosition( wxPoint( x, y ) ); | |
| 130 m_mask3.SetSize( wxSize( w, h ) ); | |
| 123 | 131 |
| 124 m_textCtrlM1x->SetValue( x ); | 132 if ( IsModal() ) |
| 125 m_textCtrlM1y->SetValue( y ); | 133 EndModal( wxID_OK ); |
| 126 m_textCtrlM1w->SetValue( w ); | 134 else { |
| 127 m_textCtrlM1h->SetValue( h ); | 135 SetReturnCode( wxID_OK ); |
| 128 | 136 Show( false ); |
| 129 config->Read( wxT("x2"), &x ); | 137 } |
| 130 config->Read( wxT("y2"), &y ); | |
| 131 config->Read( wxT("w2"), &w ); | |
| 132 config->Read( wxT("h2"), &h ); | |
| 133 | |
| 134 m_textCtrlM2x->SetValue( x ); | |
| 135 m_textCtrlM2y->SetValue( y ); | |
| 136 m_textCtrlM2w->SetValue( w ); | |
| 137 m_textCtrlM2h->SetValue( h ); | |
| 138 | |
| 139 config->Read( wxT("x3"), &x ); | |
| 140 config->Read( wxT("y3"), &y ); | |
| 141 config->Read( wxT("w3"), &w ); | |
| 142 config->Read( wxT("h3"), &h ); | |
| 143 | |
| 144 m_textCtrlM3x->SetValue( x ); | |
| 145 m_textCtrlM3y->SetValue( y ); | |
| 146 m_textCtrlM3w->SetValue( w ); | |
| 147 m_textCtrlM3h->SetValue( h ); | |
| 148 } | 138 } |
| 149 | 139 |
| 150 void MaskDialog::SetParams( wxCommandEvent& WXUNUSED(event) ) | 140 void MaskDialog::LoadParams( void ) |
| 151 { | 141 { |
| 152 config->SetPath( wxT("/Mask") ); | 142 m_textCtrlM1x->SetValue( wxString::Format( wxT("%d"), m_mask1.GetX() ) ); |
| 153 | 143 m_textCtrlM1y->SetValue( wxString::Format( wxT("%d"), m_mask1.GetY() ) ); |
| 154 config->Write( wxT("h3"), m_textCtrlM3h->GetValue() ); | 144 m_textCtrlM1w->SetValue( wxString::Format( wxT("%d"), m_mask1.GetWidth() ) ); |
| 155 config->Flush(); | 145 m_textCtrlM1h->SetValue( wxString::Format( wxT("%d"), m_mask1.GetHeight() ) ); |
| 156 | 146 m_textCtrlM2x->SetValue( wxString::Format( wxT("%d"), m_mask2.GetX() ) ); |
| 157 Close(); | 147 m_textCtrlM2y->SetValue( wxString::Format( wxT("%d"), m_mask2.GetY() ) ); |
| 148 m_textCtrlM2w->SetValue( wxString::Format( wxT("%d"), m_mask2.GetWidth() ) ); | |
| 149 m_textCtrlM2h->SetValue( wxString::Format( wxT("%d"), m_mask2.GetHeight() ) ); | |
| 150 m_textCtrlM3x->SetValue( wxString::Format( wxT("%d"), m_mask3.GetX() ) ); | |
| 151 m_textCtrlM3y->SetValue( wxString::Format( wxT("%d"), m_mask3.GetY() ) ); | |
| 152 m_textCtrlM3w->SetValue( wxString::Format( wxT("%d"), m_mask3.GetWidth() ) ); | |
| 153 m_textCtrlM3h->SetValue( wxString::Format( wxT("%d"), m_mask3.GetHeight() ) ); | |
| 158 } | 154 } |
| 159 | 155 |
