Skip to content

Commit 3e332d4

Browse files
committed
reafctor: cleanup MyFrame
1 parent c678ba2 commit 3e332d4

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

include/gui.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class MyFrame : public wxFrame
5252
wxStaticText *slider_sigma2_t;
5353
wxStaticText *slider_t_t;
5454
void addlog(wxString info, const wxColour &color);
55-
void activateRenderLoop(bool on);
5655

5756
private:
5857
bool render_loop_on;
@@ -67,28 +66,25 @@ class MyFrame : public wxFrame
6766
wxButton *iterativeFDoG;
6867
wxComboBox *processingBox;
6968

69+
void SetRenderingState(bool on);
70+
7071
void OnStart(wxCommandEvent &event);
7172
void OnClean(wxCommandEvent &event);
7273
void OnSolveIt(wxCommandEvent &event);
7374
void OnRefineETF(wxCommandEvent &event);
7475
void OnIterativeFDoG(wxCommandEvent &event);
75-
7676
void OnProcessingBox(wxCommandEvent &event);
77-
78-
7977
void OnSliderRho(wxCommandEvent &event);
8078
void OnSliderETFkernel(wxCommandEvent &event);
8179
void OnSliderSigmaM(wxCommandEvent &event);
8280
void OnSliderSigmaC(wxCommandEvent &event);
8381
void OnSliderTau(wxCommandEvent &event);
84-
8582
void OnOpenSrc(wxCommandEvent &event);
8683
void OnSaveResult(wxCommandEvent &event);
87-
8884
void OnExit(wxCommandEvent &event);
8985
void OnAbout(wxCommandEvent &event);
9086
void OnToggleLog(wxCommandEvent &event);
91-
void onIdle(wxIdleEvent &evt);
87+
void OnIdle(wxIdleEvent &evt);
9288
wxDECLARE_EVENT_TABLE();
9389
};
9490

src/gui.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void MyFrame::OnToggleLog(wxCommandEvent &event)
199199
void MyFrame::OnOpenSrc(wxCommandEvent &event)
200200
{
201201
render_loop_on = false;
202-
activateRenderLoop(render_loop_on);
202+
SetRenderingState(render_loop_on);
203203
wxFileDialog openFileDialog(this, _("Open image file"), "", "", "image files (*.bmp;*.png;*.jpg)|*.bmp;*.png;*.jpg",
204204
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
205205
wxString s;
@@ -231,7 +231,7 @@ void MyFrame::OnOpenSrc(wxCommandEvent &event)
231231
this->Layout();
232232

233233
render_loop_on = true;
234-
activateRenderLoop(render_loop_on);
234+
SetRenderingState(render_loop_on);
235235
ETF_iteration = FDoG_iteration = 0;
236236
s.Printf("ETF: %d iterations", ETF_iteration);
237237
SetStatusText(s, 1);
@@ -261,7 +261,7 @@ void MyFrame::OnSaveResult(wxCommandEvent &event)
261261
void MyFrame::OnStart(wxCommandEvent &event)
262262
{
263263
render_loop_on = !render_loop_on;
264-
activateRenderLoop(render_loop_on);
264+
SetRenderingState(render_loop_on);
265265
}
266266

267267
void MyFrame::OnClean(wxCommandEvent &event)
@@ -333,7 +333,7 @@ void MyFrame::OnProcessingBox(wxCommandEvent &event)
333333

334334
addlog("[Mode Changed] " + s, wxColour(*wxBLACK));
335335
drawPane->render();
336-
activateRenderLoop(render_loop_on);
336+
SetRenderingState(render_loop_on);
337337
}
338338

339339
//Slides: Pattern Parameter
@@ -401,23 +401,23 @@ void MyFrame::addlog(wxString info, const wxColour &color)
401401
log->AppendText(s);
402402
}
403403

404-
void MyFrame::activateRenderLoop(bool on)
404+
void MyFrame::SetRenderingState(bool on)
405405
{
406406
if (on) {
407407
start->SetLabel("Stop");
408-
Connect(wxID_ANY, wxEVT_IDLE, wxIdleEventHandler(MyFrame::onIdle));
408+
Connect(wxID_ANY, wxEVT_IDLE, wxIdleEventHandler(MyFrame::OnIdle));
409409
render_loop_on = true;
410410
addlog("-------Start iteration-------", wxColour(*wxBLACK));
411411
return;
412412
}
413413

414414
start->SetLabel("Start");
415-
Disconnect(wxEVT_IDLE, wxIdleEventHandler(MyFrame::onIdle));
415+
Disconnect(wxEVT_IDLE, wxIdleEventHandler(MyFrame::OnIdle));
416416
render_loop_on = false;
417417
addlog("-------Stop iteration-------", wxColour(*wxBLACK));
418418
}
419419

420-
void MyFrame::onIdle(wxIdleEvent &evt)
420+
void MyFrame::OnIdle(wxIdleEvent &evt)
421421
{
422422
if (!render_loop_on) return;
423423
drawPane->render();

0 commit comments

Comments
 (0)