-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainFrame.h
More file actions
126 lines (117 loc) · 5.64 KB
/
Copy pathMainFrame.h
File metadata and controls
126 lines (117 loc) · 5.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// MainFrame.h
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Copyright (c) 2019-2023 Adrian Maurer. All rights reserved.
// Distributed under the GPL-3.0 software license (https://opensource.org/licenses/GPL-3.0).
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "CurveView.h"
#include "ImageView.h"
#include "HistogramView.h"
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// CFixedSplitterWnd
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
class CFixedSplitterWnd : public CSplitterWnd
{
// ELEMENT DATA
private:
CSize wndSize;
std::array<bool, 3> curveVisibleArray;
// CONSTRUCTION / DESTRUCTION / ASSIGNMENT
public:
CFixedSplitterWnd();
// OVERRIDES
public:
virtual void RecalcLayout() final;
// MESSAGE MAP FUNCTIONS
protected:
afx_msg void OnSize(UINT, int, int);
afx_msg void OnViewCurve(UINT);
afx_msg void OnUpdateViewCurve(CCmdUI*);
DECLARE_MESSAGE_MAP()
};
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// CMainFrame
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
class CMainFrame : public CFrameWnd
{
// ENUMS
private:
enum class ColorModel {rgb, hsv, hsl, hsg, hsp, cieHcl};
enum class ImageMode {original, modified};
// STATIC DATA
private:
static const std::array<UINT, 6> indicatorArray;
// ELEMENT DATA
private:
CFixedSplitterWnd splitterWnd;
CStatusBar statusBar;
CCurveView* p_curve1View;
CCurveView* p_curve2View;
CCurveView* p_curve3View;
CImageView* p_imageView;
CHistogramView* p_histogramView;
CTrueColorImage image;
CTrueColorImage originalImage;
CTrueColorImage modifiedImage;
HistogramArray originalHistogramArray;
HistogramArray modifiedHistogramArray;
std::array<Guide, 3> guideArray;
std::array<Curve, 3> curveArray;
std::filesystem::path imageFilePath;
int filterIndex;
ColorModel colorModel;
bool instantMode;
bool allowClamping;
ImageMode imageMode;
// CONSTRUCTION / DESTRUCTION / ASSIGNMENT
public:
CMainFrame();
protected:
DECLARE_DYNAMIC(CMainFrame)
// ELEMENT FUNCTIONS
private:
void updateColorModelMenu();
void updateColorModelLabels();
void updateImageFilePathStatusText();
void updateImageSizeStatusText();
void updateCurveTypeStatusText();
void updateImageModeStatusText();
void updateCalcTimeStatusText(const int = -1);
void refreshCurveViews();
void refreshModifiedData();
void createGuideArray();
void calcModifiedImage(const CTrueColorImage&, CTrueColorImage&);
// OVERRIDES
public:
virtual BOOL PreCreateWindow(CREATESTRUCT&) final;
virtual BOOL OnCmdMsg(UINT, int, void*, AFX_CMDHANDLERINFO*) final;
virtual BOOL OnCreateClient(LPCREATESTRUCT, CCreateContext*) final;
// MESSAGE MAP FUNCTIONS
protected:
afx_msg int OnCreate(LPCREATESTRUCT);
afx_msg void OnMenuSelect(UINT, UINT, HMENU);
afx_msg void OnFileLoadImage();
afx_msg void OnFileSaveImageAs();
afx_msg void OnUpdateFileSaveImageAs(CCmdUI*);
afx_msg void OnColorModel(UINT);
afx_msg void OnUpdateColorModel(CCmdUI*);
afx_msg void OnCurveType(UINT);
afx_msg void OnUpdateCurveType(CCmdUI*);
afx_msg void OnOptionsInstantMode();
afx_msg void OnUpdateOptionsInstantMode(CCmdUI*);
afx_msg void OnOptionsAllowClamping();
afx_msg void OnUpdateOptionsAllowClamping(CCmdUI*);
afx_msg void OnViewImage(UINT);
afx_msg void OnViewSwitchImage();
afx_msg void OnUpdateViewImage(CCmdUI*);
afx_msg LRESULT OnCurveChanged(WPARAM, LPARAM);
DECLARE_MESSAGE_MAP()
};
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// CMainFrame - GOBAL FUNCTIONS
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
int getFilterIndex(const std::filesystem::path&);
std::filesystem::path removeImgExt(const std::filesystem::path&);
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------