Skip to content

Commit 1aee11b

Browse files
committed
final amount of clean-up.
1 parent ac7d8de commit 1aee11b

File tree

3 files changed

+43
-101
lines changed

3 files changed

+43
-101
lines changed

src/cc_preferences_ui.cpp

Lines changed: 43 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ class PrefCanvas : public ClickDragCtrlScrollCanvas
214214
using super = ClickDragCtrlScrollCanvas;
215215
public:
216216
PrefCanvas(CalChartConfiguration& config, wxWindow *parent);
217-
217+
218218
void OnPaint(wxPaintEvent& event);
219219
private:
220220
void OnEraseBackground(wxEraseEvent& event);
221-
221+
222222
std::unique_ptr<CC_show> mShow;
223223
std::unique_ptr<const ShowMode> mMode;
224224
CalChartConfiguration& mConfig;
@@ -257,7 +257,7 @@ mConfig(config)
257257
sheet->GetPoint(1).SetSymbol(SYMBOL_SOLX);
258258
sheet->GetPoint(2).SetSymbol(SYMBOL_X);
259259
sheet->GetPoint(3).SetSymbol(SYMBOL_SOLX);
260-
260+
261261
for (auto i = 0; i < 4; ++i)
262262
{
263263
sheet->SetAllPositions(field_offset + CC_coord(Int2Coord(i*4), Int2Coord(2)), i);
@@ -295,7 +295,7 @@ PrefCanvas::OnPaint(wxPaintEvent& event)
295295
{
296296
wxBufferedPaintDC dc(this);
297297
PrepareDC(dc);
298-
298+
299299
// draw the background
300300
dc.SetBackgroundMode(wxTRANSPARENT);
301301
dc.SetBackground(mConfig.Get_CalChartBrushAndPen(COLOR_FIELD).first);
@@ -340,7 +340,7 @@ class DrawingSetup : public PreferencePage
340340
{
341341
DECLARE_CLASS( DrawingSetup )
342342
DECLARE_EVENT_TABLE()
343-
343+
344344
public:
345345
DrawingSetup( CalChartConfiguration& config, wxWindow *parent,
346346
wxWindowID id = wxID_ANY,
@@ -354,32 +354,31 @@ class DrawingSetup : public PreferencePage
354354
Create(parent, id, caption, pos, size, style);
355355
}
356356
virtual ~DrawingSetup( ) {}
357-
357+
358358
virtual void Init();
359359
virtual void CreateControls();
360-
360+
361361
// use these to get and set default values
362362
virtual bool TransferDataToWindow();
363363
virtual bool TransferDataFromWindow();
364364
virtual bool ClearValuesToDefault();
365-
365+
366366
private:
367367
void OnCmdSelectColors(wxCommandEvent&);
368368
void OnCmdSelectWidth(wxSpinEvent&);
369369
void OnCmdResetColors(wxCommandEvent&);
370370
void OnCmdResetAll(wxCommandEvent&);
371371
void OnCmdChooseNewColor(wxCommandEvent&);
372372
void OnCmdTextChanged(wxCommandEvent&);
373-
373+
374374
void SetColor(int selection, int width, const wxColour& color);
375375
wxBitmapComboBox* nameBox;
376376
wxSpinCtrl* spin;
377-
377+
378378
wxPen mCalChartPens[COLOR_NUM];
379379
wxBrush mCalChartBrushes[COLOR_NUM];
380-
380+
381381
double mPrintValues[5];
382-
383382
};
384383

385384
enum
@@ -388,11 +387,10 @@ enum
388387
BUTTON_RESTORE,
389388
SPIN_WIDTH,
390389
NEW_COLOR_CHOICE,
391-
A_DOTRATIO,
392-
A_NUMRATIO,
393-
A_PLINERATIO,
394-
A_SLINERATIO,
395-
A_CONTRATIO
390+
DOTRATIO,
391+
NUMRATIO,
392+
PLINERATIO,
393+
SLINERATIO
396394
};
397395

398396

@@ -401,11 +399,10 @@ EVT_BUTTON(BUTTON_SELECT,DrawingSetup::OnCmdSelectColors)
401399
EVT_BUTTON(BUTTON_RESTORE,DrawingSetup::OnCmdResetColors)
402400
EVT_SPINCTRL(SPIN_WIDTH,DrawingSetup::OnCmdSelectWidth)
403401
EVT_COMBOBOX(NEW_COLOR_CHOICE,DrawingSetup::OnCmdChooseNewColor)
404-
EVT_TEXT_ENTER(A_DOTRATIO,DrawingSetup::OnCmdTextChanged)
405-
EVT_TEXT_ENTER(A_NUMRATIO,DrawingSetup::OnCmdTextChanged)
406-
EVT_TEXT_ENTER(A_PLINERATIO,DrawingSetup::OnCmdTextChanged)
407-
EVT_TEXT_ENTER(A_SLINERATIO,DrawingSetup::OnCmdTextChanged)
408-
EVT_TEXT_ENTER(A_CONTRATIO,DrawingSetup::OnCmdTextChanged)
402+
EVT_TEXT_ENTER(DOTRATIO,DrawingSetup::OnCmdTextChanged)
403+
EVT_TEXT_ENTER(NUMRATIO,DrawingSetup::OnCmdTextChanged)
404+
EVT_TEXT_ENTER(PLINERATIO,DrawingSetup::OnCmdTextChanged)
405+
EVT_TEXT_ENTER(SLINERATIO,DrawingSetup::OnCmdTextChanged)
409406
END_EVENT_TABLE()
410407

411408
IMPLEMENT_CLASS( DrawingSetup, PreferencePage )
@@ -414,10 +411,10 @@ void DrawingSetup::CreateControls()
414411
{
415412
wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
416413
SetSizer( topsizer );
417-
414+
418415
wxStaticBoxSizer* boxsizer = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("Color settings")), wxVERTICAL);
419416
topsizer->Add(boxsizer);
420-
417+
421418
wxBoxSizer *horizontalsizer = new wxBoxSizer( wxHORIZONTAL );
422419
nameBox = new wxBitmapComboBox(this, NEW_COLOR_CHOICE, mConfig.GetColorNames().at(0), wxDefaultPosition, wxDefaultSize, COLOR_NUM, mConfig.GetColorNames().data(), wxCB_READONLY|wxCB_DROPDOWN);
423420
horizontalsizer->Add(nameBox, sBasicSizerFlags );
@@ -432,36 +429,35 @@ void DrawingSetup::CreateControls()
432429
nameBox->SetItemBitmap(i, temp_bitmap);
433430
}
434431
nameBox->SetSelection(0);
435-
432+
436433
spin = new wxSpinCtrl(this, SPIN_WIDTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 10, mCalChartPens[nameBox->GetSelection()].GetWidth());
437434
spin->SetValue(mCalChartPens[nameBox->GetSelection()].GetWidth());
438435
horizontalsizer->Add(spin, sBasicSizerFlags );
439436
boxsizer->Add(horizontalsizer, sLeftBasicSizerFlags );
440-
437+
441438
horizontalsizer = new wxBoxSizer( wxHORIZONTAL );
442-
439+
443440
horizontalsizer->Add(new wxButton(this, BUTTON_SELECT, wxT("&Change Color")), sBasicSizerFlags );
444441
horizontalsizer->Add(new wxButton(this, BUTTON_RESTORE, wxT("&Reset Color")), sBasicSizerFlags );
445-
442+
446443
boxsizer->Add(horizontalsizer, sBasicSizerFlags );
447-
444+
448445
boxsizer = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("ratios")), wxVERTICAL);
449446
topsizer->Add(boxsizer);
450-
447+
451448
horizontalsizer = new wxBoxSizer( wxHORIZONTAL );
452449
boxsizer->Add(horizontalsizer, sLeftBasicSizerFlags);
453-
454-
AddTextboxWithCaption(this, horizontalsizer, A_DOTRATIO, wxT("Dot Ratio:"), wxTE_PROCESS_ENTER);
455-
AddTextboxWithCaption(this, horizontalsizer, A_NUMRATIO, wxT("Num Ratio:"), wxTE_PROCESS_ENTER);
456-
AddTextboxWithCaption(this, horizontalsizer, A_PLINERATIO, wxT("P-Line Ratio:"), wxTE_PROCESS_ENTER);
457-
AddTextboxWithCaption(this, horizontalsizer, A_SLINERATIO, wxT("S-Line Ratio:"), wxTE_PROCESS_ENTER);
458-
AddTextboxWithCaption(this, horizontalsizer, A_CONTRATIO, wxT("Continuity Ratio:"), wxTE_PROCESS_ENTER);
459-
450+
451+
AddTextboxWithCaption(this, horizontalsizer, DOTRATIO, wxT("Dot Ratio:"), wxTE_PROCESS_ENTER);
452+
AddTextboxWithCaption(this, horizontalsizer, NUMRATIO, wxT("Num Ratio:"), wxTE_PROCESS_ENTER);
453+
AddTextboxWithCaption(this, horizontalsizer, PLINERATIO, wxT("P-Line Ratio:"), wxTE_PROCESS_ENTER);
454+
AddTextboxWithCaption(this, horizontalsizer, SLINERATIO, wxT("S-Line Ratio:"), wxTE_PROCESS_ENTER);
455+
460456
auto prefCanvas = new PrefCanvas(mConfig, this);
461457
// set scroll rate 1 to 1, so we can have even scrolling of whole field
462458
topsizer->Add(prefCanvas, 1, wxEXPAND);
463459
// mCanvas->SetScrollRate(1, 1);
464-
460+
465461
TransferDataToWindow();
466462
}
467463

@@ -474,7 +470,7 @@ void DrawingSetup::Init()
474470
mCalChartPens[i] = brushAndPen.second;
475471
mCalChartBrushes[i] = brushAndPen.first;
476472
}
477-
473+
478474
mPrintValues[0] = mConfig.Get_DotRatio();
479475
mPrintValues[1] = mConfig.Get_NumRatio();
480476
mPrintValues[2] = mConfig.Get_PLineRatio();
@@ -485,22 +481,19 @@ void DrawingSetup::Init()
485481
bool DrawingSetup::TransferDataToWindow()
486482
{
487483
wxString buf;
488-
wxTextCtrl* text = (wxTextCtrl*) FindWindow(A_DOTRATIO);
484+
wxTextCtrl* text = (wxTextCtrl*) FindWindow(DOTRATIO);
489485
buf.Printf(wxT("%.2f"), mPrintValues[0]);
490486
text->SetValue(buf);
491-
text = (wxTextCtrl*) FindWindow(A_NUMRATIO);
487+
text = (wxTextCtrl*) FindWindow(NUMRATIO);
492488
buf.Printf(wxT("%.2f"), mPrintValues[1]);
493489
text->SetValue(buf);
494-
text = (wxTextCtrl*) FindWindow(A_PLINERATIO);
490+
text = (wxTextCtrl*) FindWindow(PLINERATIO);
495491
buf.Printf(wxT("%.2f"), mPrintValues[2]);
496492
text->SetValue(buf);
497-
text = (wxTextCtrl*) FindWindow(A_SLINERATIO);
493+
text = (wxTextCtrl*) FindWindow(SLINERATIO);
498494
buf.Printf(wxT("%.2f"), mPrintValues[3]);
499495
text->SetValue(buf);
500-
text = (wxTextCtrl*) FindWindow(A_CONTRATIO);
501-
buf.Printf(wxT("%.2f"), mPrintValues[4]);
502-
text->SetValue(buf);
503-
496+
504497
return true;
505498
}
506499

@@ -530,9 +523,9 @@ void DrawingSetup::SetColor(int selection, int width, const wxColour& color)
530523
{
531524
mCalChartPens[selection] = *wxThePenList->FindOrCreatePen(color, width, wxSOLID);
532525
mCalChartBrushes[selection] = *wxTheBrushList->FindOrCreateBrush(color, wxSOLID);
533-
526+
534527
mConfig.Set_CalChartBrushAndPen(static_cast<CalChartColors>(selection), mCalChartBrushes[selection], mCalChartPens[selection]);
535-
528+
536529
// update the namebox list
537530
{
538531
wxBitmap test_bitmap(16, 16);
@@ -585,7 +578,7 @@ void DrawingSetup::OnCmdTextChanged(wxCommandEvent& e)
585578
double value;
586579
if (text->GetValue().ToDouble(&value))
587580
{
588-
switch (id - A_DOTRATIO)
581+
switch (id - DOTRATIO)
589582
{
590583
case 0:
591584
mConfig.Set_DotRatio(value);
@@ -657,10 +650,6 @@ typedef enum
657650
HEADERSIZE,
658651
YARDSSIZE,
659652
TEXTSIZE,
660-
DOTRATIO,
661-
NUMRATIO,
662-
PLINERATIO,
663-
SLINERATIO,
664653
CONTRATIO
665654
} PSPrintingSetUp_IDs;
666655

@@ -700,10 +689,6 @@ void PSPrintingSetUp::CreateControls()
700689
horizontalsizer = new wxBoxSizer( wxHORIZONTAL );
701690
topsizer->Add(horizontalsizer, sLeftBasicSizerFlags );
702691

703-
AddTextboxWithCaption(this, horizontalsizer, DOTRATIO, wxT("Dot Ratio:"));
704-
AddTextboxWithCaption(this, horizontalsizer, NUMRATIO, wxT("Num Ratio:"));
705-
AddTextboxWithCaption(this, horizontalsizer, PLINERATIO, wxT("P-Line Ratio:"));
706-
AddTextboxWithCaption(this, horizontalsizer, SLINERATIO, wxT("S-Line Ratio:"));
707692
AddTextboxWithCaption(this, horizontalsizer, CONTRATIO, wxT("Continuity Ratio:"));
708693

709694
TransferDataToWindow();
@@ -721,10 +706,6 @@ void PSPrintingSetUp::Init()
721706
mPrintValues[0] = mConfig.Get_HeaderSize();
722707
mPrintValues[1] = mConfig.Get_YardsSize();
723708
mPrintValues[2] = mConfig.Get_TextSize();
724-
mPrintValues[3] = mConfig.Get_DotRatio();
725-
mPrintValues[4] = mConfig.Get_NumRatio();
726-
mPrintValues[5] = mConfig.Get_PLineRatio();
727-
mPrintValues[6] = mConfig.Get_SLineRatio();
728709
mPrintValues[7] = mConfig.Get_ContRatio();
729710
}
730711

@@ -754,18 +735,6 @@ bool PSPrintingSetUp::TransferDataToWindow()
754735
text = (wxTextCtrl*) FindWindow(TEXTSIZE);
755736
buf.Printf(wxT("%.2f"), mPrintValues[2]);
756737
text->SetValue(buf);
757-
text = (wxTextCtrl*) FindWindow(DOTRATIO);
758-
buf.Printf(wxT("%.2f"), mPrintValues[3]);
759-
text->SetValue(buf);
760-
text = (wxTextCtrl*) FindWindow(NUMRATIO);
761-
buf.Printf(wxT("%.2f"), mPrintValues[4]);
762-
text->SetValue(buf);
763-
text = (wxTextCtrl*) FindWindow(PLINERATIO);
764-
buf.Printf(wxT("%.2f"), mPrintValues[5]);
765-
text->SetValue(buf);
766-
text = (wxTextCtrl*) FindWindow(SLINERATIO);
767-
buf.Printf(wxT("%.2f"), mPrintValues[6]);
768-
text->SetValue(buf);
769738
text = (wxTextCtrl*) FindWindow(CONTRATIO);
770739
buf.Printf(wxT("%.2f"), mPrintValues[7]);
771740
text->SetValue(buf);
@@ -795,14 +764,6 @@ bool PSPrintingSetUp::TransferDataFromWindow()
795764
text->GetValue().ToDouble(&mPrintValues[1]);
796765
text = (wxTextCtrl*) FindWindow(TEXTSIZE);
797766
text->GetValue().ToDouble(&mPrintValues[2]);
798-
text = (wxTextCtrl*) FindWindow(DOTRATIO);
799-
text->GetValue().ToDouble(&mPrintValues[3]);
800-
text = (wxTextCtrl*) FindWindow(NUMRATIO);
801-
text->GetValue().ToDouble(&mPrintValues[4]);
802-
text = (wxTextCtrl*) FindWindow(PLINERATIO);
803-
text->GetValue().ToDouble(&mPrintValues[5]);
804-
text = (wxTextCtrl*) FindWindow(SLINERATIO);
805-
text->GetValue().ToDouble(&mPrintValues[6]);
806767
text = (wxTextCtrl*) FindWindow(CONTRATIO);
807768
text->GetValue().ToDouble(&mPrintValues[7]);
808769

@@ -817,10 +778,6 @@ bool PSPrintingSetUp::TransferDataFromWindow()
817778
mConfig.Set_HeaderSize(mPrintValues[0]);
818779
mConfig.Set_YardsSize(mPrintValues[1]);
819780
mConfig.Set_TextSize(mPrintValues[2]);
820-
mConfig.Set_DotRatio(mPrintValues[3]);
821-
mConfig.Set_NumRatio(mPrintValues[4]);
822-
mConfig.Set_PLineRatio(mPrintValues[5]);
823-
mConfig.Set_SLineRatio(mPrintValues[6]);
824781
mConfig.Set_ContRatio(mPrintValues[7]);
825782
return true;
826783
}
@@ -837,10 +794,6 @@ bool PSPrintingSetUp::ClearValuesToDefault()
837794
mConfig.Clear_HeaderSize();
838795
mConfig.Clear_YardsSize();
839796
mConfig.Clear_TextSize();
840-
mConfig.Clear_DotRatio();
841-
mConfig.Clear_NumRatio();
842-
mConfig.Clear_PLineRatio();
843-
mConfig.Clear_SLineRatio();
844797
mConfig.Clear_ContRatio();
845798
Init();
846799
return TransferDataToWindow();

src/cont_ui.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,6 @@ void ContinuityEditor::CreateControls()
167167

168168

169169
mUserInput = new FancyTextWin(this, ContinuityEditor_KeyPress, wxEmptyString, wxDefaultPosition, wxSize(50, 300));
170-
171-
wxArrayString autocompletes;
172-
for (auto& i : { wxT("Hello"), wxT("Bye"), wxT("Cat"), wxT("Hela") })
173-
{
174-
autocompletes.Add(i);
175-
}
176-
mUserInput->AutoComplete(autocompletes);
177170

178171
topsizer->Add(mUserInput, 0, wxGROW|wxALL, 5 );
179172

src/modes.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ class ShowMode
6666
kOmniView
6767
} HowToDraw;
6868

69-
//public:
70-
// void Draw(wxDC& dc, const CalChartConfiguration& config) const { DrawHelper(dc, config, kFieldView); }
71-
// void DrawAnim(wxDC& dc, const CalChartConfiguration& config) const { DrawHelper(dc, config, kAnimation); }
72-
// void DrawOmni(wxDC& dc, const CalChartConfiguration& config) const { DrawHelper(dc, config, kOmniView); }
7369
void DrawMode(wxDC& dc, const CalChartConfiguration& config, HowToDraw howToDraw) const;
7470

7571
wxImage GetOmniLinesImage(const CalChartConfiguration& config) const;

0 commit comments

Comments
 (0)