Skip to content

Commit 9cf08c8

Browse files
committed
refactor(headers): modernize ColorCop headers and remove obsolete MFC artifacts
- Drop legacy AFX include guards in ColorCop.h (use #pragma once exclusively) - Remove redundant CColorCopApp:: qualifiers inside class scope - Normalize constructor nullptr usage and modernize byte fields to std::uint8_t - Zero‑initialize several member variables for deterministic startup state - Clean up stray blank lines and normalize method signatures No functional changes; header‑only cleanup for clarity and maintainability.
1 parent 5b829a0 commit 9cf08c8

2 files changed

Lines changed: 16 additions & 22 deletions

File tree

ColorCop.h

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
// ColorCop.h : main header file for the Color Cop application
55
//
66

7-
#if !defined(AFX_HTMLCOP_H__EC2A34E4_4FAA_11D3_81A0_A79013DBA62A__INCLUDED_)
8-
#define AFX_HTMLCOP_H__EC2A34E4_4FAA_11D3_81A0_A79013DBA62A__INCLUDED_
9-
107
#pragma once
118

129
#ifndef __AFXWIN_H__
@@ -21,23 +18,21 @@
2118
// CColorCopApp:
2219
// See ColorCop.cpp for the implementation of this class
2320
//
24-
2521
class CColorCopApp : public CWinApp {
2622
public:
2723
CColorCopDlg dlg;
2824
CColorCopApp();
2925
~CColorCopApp();
3026

31-
3227
protected:
33-
void CColorCopApp::CloseApplication();
34-
void CColorCopApp::LoadDefaultSettings();
35-
CString CColorCopApp::GetTempFolder();
36-
BOOL CColorCopApp::GetShellFolderPath(char * pShellFolder, char * pShellPath);
37-
void CColorCopApp::ClipOrCenterWindowToMonitor(HWND hwnd, UINT flags);
28+
void CloseApplication();
29+
void LoadDefaultSettings();
30+
CString GetTempFolder();
31+
BOOL GetShellFolderPath(char * pShellFolder, char * pShellPath);
32+
void ClipOrCenterWindowToMonitor(HWND hwnd, UINT flags);
3833

3934
// multi mon
40-
void CColorCopApp::ClipOrCenterRectToMonitor(LPRECT prc, UINT flags);
35+
void ClipOrCenterRectToMonitor(LPRECT prc, UINT flags);
4136

4237
bool InstanceRunning();
4338
HANDLE m_hMutex;
@@ -65,5 +60,3 @@ class CColorCopApp : public CWinApp {
6560

6661
//{{AFX_INSERT_LOCATION}} // NOLINT(whitespace/comments)
6762
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
68-
69-
#endif // !defined(AFX_HTMLCOP_H__EC2A34E4_4FAA_11D3_81A0_A79013DBA62A__INCLUDED_) // NOLINT(whitespace/comments)

ColorCopDlg.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CSystemTray;
1717
class CColorCopDlg : public CDialog {
1818
// Construction
1919
public:
20-
explicit CColorCopDlg(CWnd* pParent = NULL); // standard constructor
20+
explicit CColorCopDlg(CWnd* pParent = nullptr); // standard constructor
2121
COLORREF ColorHistory[7];
2222
COLORREF CustColorBank[16];
2323
int m_Appflags;
@@ -82,8 +82,11 @@ class CColorCopDlg : public CDialog {
8282

8383
HACCEL m_hAcceleratorTable; // Accelerator var
8484

85-
// Store for snapback from websafe, unsigned char only takes 1 byte, 0 - 255
86-
unsigned char m_OldRed, m_OldBlue, m_OldGreen;
85+
// Store for snapback from websafe; 1‑byte values (0–255)
86+
std::uint8_t m_OldRed{};
87+
std::uint8_t m_OldGreen{};
88+
std::uint8_t m_OldBlue{};
89+
8790
BOOL bOldClrExist;
8891

8992
BOOL m_isEyedropping;
@@ -114,10 +117,10 @@ class CColorCopDlg : public CDialog {
114117
swatchStruct OrigSwatch;
115118

116119
COLORREF ColorPal[6][7];
117-
int palcol;
120+
int palcol{};
118121

119-
POINT RelativePoint;
120-
POINT RelativePointEnd;
122+
POINT RelativePoint{};
123+
POINT RelativePointEnd{};
121124

122125
CMenu copmenu;
123126
HDC hdc, hdcMem, hdcZoomMem;
@@ -130,8 +133,6 @@ class CColorCopDlg : public CDialog {
130133
CRect magplus, magminus;
131134
RECT CCopRect, CCopsmRect;
132135

133-
134-
135136
HCURSOR m_hEyeCursor;
136137
HCURSOR m_hMagCursor;
137138
HCURSOR m_hStandardCursor;
@@ -148,7 +149,7 @@ class CColorCopDlg : public CDialog {
148149
void CColorCopDlg::FloatPrecisionDown();
149150
void CColorCopDlg::GetScreenBitmap(CPoint point);
150151

151-
void CColorCopDlg::StopCapture(void);
152+
void CColorCopDlg::StopCapture();
152153
void CColorCopDlg::DisplayColor();
153154
void CColorCopDlg::ParseHTML(CString inst);
154155
void CColorCopDlg::ParseDelphi(CString inst);

0 commit comments

Comments
 (0)