Skip to content

Commit 7afd16f

Browse files
committed
Wide variety of changes to make modernize CalChart.
Working towards a more unified syntax for easier reading. Consolidating many of the ancillary data objects for the Show into the Doc to allow greater understanding on what is part of the larger show instead of transient state. Making FieldCanvas easier to understand by changing wording and objects to be consistent (ie, lasso is a type of shape, and how to check if something is in a polygon is a freestanding object). using auto in more places as a more modern programming technique. Changing naming convention of files to CamelCase style that is consistent with the name of the class they are containing inside.
1 parent 4cde94b commit 7afd16f

File tree

84 files changed

+2502
-2395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2502
-2395
lines changed

CMakeLists.txt

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,37 +55,45 @@ FLEX_TARGET (
5555
add_library (
5656
calchart_core
5757
STATIC
58-
${CMAKE_CURRENT_SOURCE_DIR}/src/core/animate.cpp
59-
${CMAKE_CURRENT_SOURCE_DIR}/src/core/animate.h
58+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartAnimation.cpp
59+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartAnimation.h
60+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartAnimationErrors.h
61+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartAnimationSheet.cpp
62+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartAnimationSheet.h
63+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartAnimationCommand.cpp
64+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartAnimationCommand.h
65+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartAnimationCompile.cpp
66+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartAnimationCompile.h
67+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartCoord.cpp
68+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartCoord.h
69+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartMovePointsTool.cpp
70+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartMovePointsTool.h
71+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartSelectTool.cpp
72+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartSelectTool.h
73+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartShapes.cpp
74+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartShapes.h
75+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/CalChartTypes.h
6076
${CMAKE_CURRENT_SOURCE_DIR}/src/core/animate_types.h
61-
${CMAKE_CURRENT_SOURCE_DIR}/src/core/animatecommand.cpp
62-
${CMAKE_CURRENT_SOURCE_DIR}/src/core/animatecommand.h
63-
${CMAKE_CURRENT_SOURCE_DIR}/src/core/animatecompile.cpp
64-
${CMAKE_CURRENT_SOURCE_DIR}/src/core/animatecompile.h
6577
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_continuity.cpp
6678
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_continuity.h
67-
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_coord.cpp
68-
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_coord.h
6979
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_drawcommand.h
7080
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_fileformat.h
7181
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_image.cpp
7282
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_image.h
7383
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_parse_errors.h
7484
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_point.cpp
7585
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_point.h
76-
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_shapes.cpp
77-
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_shapes.h
7886
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_sheet.cpp
7987
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_sheet.h
8088
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_show.cpp
8189
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_show.h
8290
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_text.cpp
8391
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_text.h
84-
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cc_types.h
8592
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cont.cpp
8693
${CMAKE_CURRENT_SOURCE_DIR}/src/core/cont.h
8794
${CMAKE_CURRENT_SOURCE_DIR}/src/core/e7_transition_solver.cpp
8895
${CMAKE_CURRENT_SOURCE_DIR}/src/core/e7_transition_solver.h
96+
${CMAKE_CURRENT_SOURCE_DIR}/src/core/linmath.h
8997
${CMAKE_CURRENT_SOURCE_DIR}/src/core/math_utils.cpp
9098
${CMAKE_CURRENT_SOURCE_DIR}/src/core/math_utils.h
9199
${CMAKE_CURRENT_SOURCE_DIR}/src/core/modes.cpp
@@ -188,6 +196,8 @@ add_executable (
188196
${CMAKE_CURRENT_SOURCE_DIR}/src/AnimationPanel.h
189197
${CMAKE_CURRENT_SOURCE_DIR}/src/AnimationView.cpp
190198
${CMAKE_CURRENT_SOURCE_DIR}/src/AnimationView.h
199+
${CMAKE_CURRENT_SOURCE_DIR}/src/BackgroundImage.cpp
200+
${CMAKE_CURRENT_SOURCE_DIR}/src/BackgroundImage.h
191201
${CMAKE_CURRENT_SOURCE_DIR}/src/CCOmniviewCanvas.cpp
192202
${CMAKE_CURRENT_SOURCE_DIR}/src/CCOmniviewCanvas.h
193203
${CMAKE_CURRENT_SOURCE_DIR}/src/CalChartApp.cpp
@@ -202,6 +212,8 @@ add_executable (
202212
${CMAKE_CURRENT_SOURCE_DIR}/src/CalChartPreferences.h
203213
${CMAKE_CURRENT_SOURCE_DIR}/src/CalChartSizes.cpp
204214
${CMAKE_CURRENT_SOURCE_DIR}/src/CalChartSizes.h
215+
${CMAKE_CURRENT_SOURCE_DIR}/src/CalChartSplash.cpp
216+
${CMAKE_CURRENT_SOURCE_DIR}/src/CalChartSplash.h
205217
${CMAKE_CURRENT_SOURCE_DIR}/src/CalChartToolBar.cpp
206218
${CMAKE_CURRENT_SOURCE_DIR}/src/CalChartToolBar.h
207219
${CMAKE_CURRENT_SOURCE_DIR}/src/CalChartView.cpp
@@ -228,6 +240,8 @@ add_executable (
228240
${CMAKE_CURRENT_SOURCE_DIR}/src/FieldControlsToolBar.h
229241
${CMAKE_CURRENT_SOURCE_DIR}/src/FieldThumbnailBrowser.cpp
230242
${CMAKE_CURRENT_SOURCE_DIR}/src/FieldThumbnailBrowser.h
243+
${CMAKE_CURRENT_SOURCE_DIR}/src/HostAppInterface.cpp
244+
${CMAKE_CURRENT_SOURCE_DIR}/src/HostAppInterface.h
231245
${CMAKE_CURRENT_SOURCE_DIR}/src/PointPicker.cpp
232246
${CMAKE_CURRENT_SOURCE_DIR}/src/PointPicker.h
233247
${CMAKE_CURRENT_SOURCE_DIR}/src/PreferencesContCellSetup.cpp
@@ -244,20 +258,18 @@ add_executable (
244258
${CMAKE_CURRENT_SOURCE_DIR}/src/PreferencesUtils.h
245259
${CMAKE_CURRENT_SOURCE_DIR}/src/PrintContinuityEditor.cpp
246260
${CMAKE_CURRENT_SOURCE_DIR}/src/PrintContinuityEditor.h
261+
${CMAKE_CURRENT_SOURCE_DIR}/src/PrintPostScriptDialog.cpp
262+
${CMAKE_CURRENT_SOURCE_DIR}/src/PrintPostScriptDialog.h
247263
${CMAKE_CURRENT_SOURCE_DIR}/src/SetupInstruments.cpp
248264
${CMAKE_CURRENT_SOURCE_DIR}/src/SetupInstruments.h
249265
${CMAKE_CURRENT_SOURCE_DIR}/src/SetupMarchers.cpp
250266
${CMAKE_CURRENT_SOURCE_DIR}/src/SetupMarchers.h
251-
${CMAKE_CURRENT_SOURCE_DIR}/src/TopFrame.cpp
252-
${CMAKE_CURRENT_SOURCE_DIR}/src/TopFrame.h
253267
${CMAKE_CURRENT_SOURCE_DIR}/src/TransitionSolverFrame.cpp
254268
${CMAKE_CURRENT_SOURCE_DIR}/src/TransitionSolverFrame.h
255269
${CMAKE_CURRENT_SOURCE_DIR}/src/TransitionSolverProgressFrame.cpp
256270
${CMAKE_CURRENT_SOURCE_DIR}/src/TransitionSolverProgressFrame.h
257271
${CMAKE_CURRENT_SOURCE_DIR}/src/TransitionSolverView.cpp
258272
${CMAKE_CURRENT_SOURCE_DIR}/src/TransitionSolverView.h
259-
${CMAKE_CURRENT_SOURCE_DIR}/src/background_image.cpp
260-
${CMAKE_CURRENT_SOURCE_DIR}/src/background_image.h
261273
${CMAKE_CURRENT_SOURCE_DIR}/src/basic_ui.cpp
262274
${CMAKE_CURRENT_SOURCE_DIR}/src/basic_ui.h
263275
${CMAKE_CURRENT_SOURCE_DIR}/src/cc_omniview_constants.h
@@ -268,24 +280,14 @@ add_executable (
268280
${CMAKE_CURRENT_SOURCE_DIR}/src/draw.cpp
269281
${CMAKE_CURRENT_SOURCE_DIR}/src/draw.h
270282
${CMAKE_CURRENT_SOURCE_DIR}/src/draw_utils.h
271-
${CMAKE_CURRENT_SOURCE_DIR}/src/field_canvas_shapes.cpp
272-
${CMAKE_CURRENT_SOURCE_DIR}/src/field_canvas_shapes.h
273-
${CMAKE_CURRENT_SOURCE_DIR}/src/ghost_module.cpp
274-
${CMAKE_CURRENT_SOURCE_DIR}/src/ghost_module.h
275-
${CMAKE_CURRENT_SOURCE_DIR}/src/linmath.h
283+
${CMAKE_CURRENT_SOURCE_DIR}/src/GhostModule.h
276284
${CMAKE_CURRENT_SOURCE_DIR}/src/mode_dialog.cpp
277285
${CMAKE_CURRENT_SOURCE_DIR}/src/mode_dialog.h
278286
${CMAKE_CURRENT_SOURCE_DIR}/src/mode_dialog_canvas.cpp
279287
${CMAKE_CURRENT_SOURCE_DIR}/src/mode_dialog_canvas.h
280288
${CMAKE_CURRENT_SOURCE_DIR}/src/platconf.h
281-
${CMAKE_CURRENT_SOURCE_DIR}/src/precomp.cpp
282-
${CMAKE_CURRENT_SOURCE_DIR}/src/precomp.h
283-
${CMAKE_CURRENT_SOURCE_DIR}/src/print_ps_dialog.cpp
284-
${CMAKE_CURRENT_SOURCE_DIR}/src/print_ps_dialog.h
285289
${CMAKE_CURRENT_SOURCE_DIR}/src/setup_wizards.cpp
286290
${CMAKE_CURRENT_SOURCE_DIR}/src/setup_wizards.h
287-
${CMAKE_CURRENT_SOURCE_DIR}/src/single_instance_ipc.cpp
288-
${CMAKE_CURRENT_SOURCE_DIR}/src/single_instance_ipc.h
289291
${CMAKE_CURRENT_SOURCE_DIR}/src/ui_enums.h
290292
${CalChartDocs}
291293
${CalChartResources}

calchart_cmd/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#include "cc_show.h"
1010
#include "cc_sheet.h"
11-
#include "animate.h"
12-
#include "animatecompile.h"
11+
#include "CalChartAnimation.h"
12+
#include "CalChartAnimationCompile.h"
1313
#include "print_ps.h"
1414
#include "modes.h"
1515
#include "cont.h"

src/AnimationCanvas.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "AnimationCanvas.h"
2424
#include "AnimationView.h"
2525
#include "basic_ui.h"
26-
#include "cc_coord.h"
26+
#include "CalChartCoord.h"
2727
#include "confgr.h"
2828
#include "ui_enums.h"
2929

src/AnimationErrorsPanel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*/
2121

22+
#include "CalChartAnimationErrors.h"
2223
#include "AnimationErrorsPanel.h"
2324
#include "CalChartView.h"
24-
#include "animate_types.h"
2525
#include "basic_ui.h"
2626

2727
#include <wx/artprov.h>
@@ -85,7 +85,7 @@ void AnimationErrorsPanel::OnSelectionChanged(wxTreeListEvent& event)
8585
}
8686

8787
if (auto error = mErrorLookup.find(event.GetItem()); error != mErrorLookup.end()) {
88-
mView->GoToSheetAndSetSelection(std::get<0>(error->second), std::get<1>(error->second));
88+
mView->GoToSheetAndSetSelectionList(std::get<0>(error->second), std::get<1>(error->second));
8989
}
9090
}
9191

@@ -96,7 +96,7 @@ void AnimationErrorsPanel::OnItemActivated(wxTreeListEvent& event)
9696
}
9797

9898
if (auto error = mErrorLookup.find(event.GetItem()); error != mErrorLookup.end()) {
99-
mView->GoToSheetAndSetSelection(std::get<0>(error->second), std::get<1>(error->second));
99+
mView->GoToSheetAndSetSelectionList(std::get<0>(error->second), std::get<1>(error->second));
100100
}
101101
}
102102

src/AnimationErrorsPanel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
*/
2222

23-
#include "animatecompile.h"
23+
#include "CalChartAnimationCompile.h"
2424

2525
#include <map>
2626
#include <vector>

src/AnimationView.cpp

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525
#include "CalChartApp.h"
2626
#include "CalChartSizes.h"
2727
#include "CalChartView.h"
28-
#include "animate.h"
29-
#include "animate_types.h"
30-
#include "cc_shapes.h"
28+
#include "CalChartAnimation.h"
29+
#include "CalChartShapes.h"
3130
#include "cc_sheet.h"
3231
#include "confgr.h"
3332
#include "draw.h"
@@ -38,18 +37,6 @@
3837
#include <wx/filename.h>
3938
#include <wx/stdpaths.h>
4039

41-
template <typename Float>
42-
static auto NormalizeAngle(Float angle)
43-
{
44-
while (angle > 2 * M_PI) {
45-
angle -= (Float)(2 * M_PI);
46-
}
47-
while (angle < 0.0) {
48-
angle += (Float)(2 * M_PI);
49-
}
50-
return angle;
51-
}
52-
5340
AnimationView::AnimationView(CalChartView* view, wxWindow* frame)
5441
: mView(view)
5542
{
@@ -107,12 +94,12 @@ void AnimationView::OnDrawDots(wxDC& dc, CalChartConfiguration const& config)
10794
{
10895
auto checkForCollision = mDrawCollisionWarning;
10996
for (auto info : mAnimation->GetAllAnimateInfo()) {
110-
if (checkForCollision && info.mCollision) {
111-
if (info.mCollision == CalChart::Coord::COLLISION_WARNING) {
97+
if (checkForCollision && (info.mCollision != CalChart::Coord::CollisionType::none)) {
98+
if (info.mCollision == CalChart::Coord::CollisionType::warning) {
11299
auto brushAndPen = config.Get_CalChartBrushAndPen(COLOR_POINT_ANIM_COLLISION_WARNING);
113100
dc.SetBrush(brushAndPen.first);
114101
dc.SetPen(brushAndPen.second);
115-
} else if (info.mCollision == CalChart::Coord::COLLISION_INTERSECT) {
102+
} else if (info.mCollision == CalChart::Coord::CollisionType::intersect) {
116103
auto brushAndPen = config.Get_CalChartBrushAndPen(COLOR_POINT_ANIM_COLLISION);
117104
dc.SetBrush(brushAndPen.first);
118105
dc.SetPen(brushAndPen.second);
@@ -308,12 +295,13 @@ void AnimationView::SelectMarchersInBox(wxPoint const& mouseStart, wxPoint const
308295

309296
auto x_off = mView->GetShowMode().Offset().x;
310297
auto y_off = mView->GetShowMode().Offset().y;
311-
Lasso lasso(Coord(mouseStartTranslated.x - x_off, mouseStartTranslated.y - y_off));
312-
lasso.Append(Coord(mouseStartTranslated.x - x_off, mouseEndTranslated.y - y_off));
313-
lasso.Append(Coord(mouseEndTranslated.x - x_off, mouseEndTranslated.y - y_off));
314-
lasso.Append(Coord(mouseEndTranslated.x - x_off, mouseStartTranslated.y - y_off));
315-
lasso.End();
316-
mView->SelectWithLasso(&lasso, altDown);
298+
auto polygon = CalChart::RawPolygon_t{
299+
Coord(mouseStartTranslated.x - x_off, mouseStartTranslated.y - y_off),
300+
Coord(mouseStartTranslated.x - x_off, mouseEndTranslated.y - y_off),
301+
Coord(mouseEndTranslated.x - x_off, mouseEndTranslated.y - y_off),
302+
Coord(mouseEndTranslated.x - x_off, mouseStartTranslated.y - y_off),
303+
};
304+
mView->SelectWithinPolygon(polygon, altDown);
317305
}
318306

319307
// Keystroke command toggles the timer, but the timer

0 commit comments

Comments
 (0)