1470d86f1SKatayama Hirofumi MZ /*
2470d86f1SKatayama Hirofumi MZ * PROJECT: PAINT for ReactOS
3470d86f1SKatayama Hirofumi MZ * LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
4470d86f1SKatayama Hirofumi MZ * PURPOSE: The precompiled header
5470d86f1SKatayama Hirofumi MZ * COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen@gmx.net>
62d5bb5ffSKatayama Hirofumi MZ * Copyright 2018 Stanislav Motylkov <x86corez@gmail.com>
72d5bb5ffSKatayama Hirofumi MZ * Copyright 2021-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
8470d86f1SKatayama Hirofumi MZ */
9470d86f1SKatayama Hirofumi MZ
10470d86f1SKatayama Hirofumi MZ #pragma once
11c2c66affSColin Finck
127014cf04SKatayama Hirofumi MZ #ifdef NDEBUG
137014cf04SKatayama Hirofumi MZ #undef DBG
147014cf04SKatayama Hirofumi MZ #undef _DEBUG
157014cf04SKatayama Hirofumi MZ #endif
167014cf04SKatayama Hirofumi MZ
17c2c66affSColin Finck #include <windef.h>
18c2c66affSColin Finck #include <winbase.h>
19c2c66affSColin Finck #include <winuser.h>
20c2c66affSColin Finck #include <wingdi.h>
21c2c66affSColin Finck #include <tchar.h>
22c2c66affSColin Finck #include <atlbase.h>
23c2c66affSColin Finck #include <atlcom.h>
24c2c66affSColin Finck #include <atlpath.h>
25c2c66affSColin Finck #include <atlstr.h>
26c2c66affSColin Finck #include <atlwin.h>
276b6a0457SKatayama Hirofumi MZ #include <atltypes.h>
28c2c66affSColin Finck #include <windowsx.h>
29c2c66affSColin Finck #include <commdlg.h>
30c2c66affSColin Finck #include <commctrl.h>
31c2c66affSColin Finck #include <stdlib.h>
32389d0465SKatayama Hirofumi MZ #define _USE_MATH_DEFINES /* for M_PI */
33389d0465SKatayama Hirofumi MZ #include <math.h>
34c2c66affSColin Finck #include <shellapi.h>
35c2c66affSColin Finck #include <htmlhelp.h>
36d7ece626SKatayama Hirofumi MZ #include <strsafe.h>
37470d86f1SKatayama Hirofumi MZ #include <ui/CWaitCursor.h>
38c2c66affSColin Finck
39b2f8d62cSKatayama Hirofumi MZ #include <debug.h>
40b2f8d62cSKatayama Hirofumi MZ
412d5bb5ffSKatayama Hirofumi MZ /* CONSTANTS *******************************************************/
422d5bb5ffSKatayama Hirofumi MZ
432d5bb5ffSKatayama Hirofumi MZ #define GRIP_SIZE 3
442d5bb5ffSKatayama Hirofumi MZ #define MIN_ZOOM 125
452d5bb5ffSKatayama Hirofumi MZ #define MAX_ZOOM 8000
462d5bb5ffSKatayama Hirofumi MZ
472d5bb5ffSKatayama Hirofumi MZ #define MAX_LONG_PATH 512
482d5bb5ffSKatayama Hirofumi MZ
492d5bb5ffSKatayama Hirofumi MZ #define WM_TOOLSMODELTOOLCHANGED (WM_APP + 0)
502d5bb5ffSKatayama Hirofumi MZ #define WM_TOOLSMODELSETTINGSCHANGED (WM_APP + 1)
512d5bb5ffSKatayama Hirofumi MZ #define WM_TOOLSMODELZOOMCHANGED (WM_APP + 2)
522d5bb5ffSKatayama Hirofumi MZ #define WM_PALETTEMODELCOLORCHANGED (WM_APP + 3)
532d5bb5ffSKatayama Hirofumi MZ
542d5bb5ffSKatayama Hirofumi MZ enum HITTEST // hit
552d5bb5ffSKatayama Hirofumi MZ {
562d5bb5ffSKatayama Hirofumi MZ HIT_NONE = 0, // Nothing hit or outside
572d5bb5ffSKatayama Hirofumi MZ HIT_UPPER_LEFT,
582d5bb5ffSKatayama Hirofumi MZ HIT_UPPER_CENTER,
592d5bb5ffSKatayama Hirofumi MZ HIT_UPPER_RIGHT,
602d5bb5ffSKatayama Hirofumi MZ HIT_MIDDLE_LEFT,
612d5bb5ffSKatayama Hirofumi MZ HIT_MIDDLE_RIGHT,
622d5bb5ffSKatayama Hirofumi MZ HIT_LOWER_LEFT,
632d5bb5ffSKatayama Hirofumi MZ HIT_LOWER_CENTER,
642d5bb5ffSKatayama Hirofumi MZ HIT_LOWER_RIGHT,
652d5bb5ffSKatayama Hirofumi MZ HIT_BORDER,
662d5bb5ffSKatayama Hirofumi MZ HIT_INNER,
672d5bb5ffSKatayama Hirofumi MZ };
682d5bb5ffSKatayama Hirofumi MZ
692d5bb5ffSKatayama Hirofumi MZ /* COMMON FUNCTIONS *************************************************/
702d5bb5ffSKatayama Hirofumi MZ
712d5bb5ffSKatayama Hirofumi MZ void ShowOutOfMemory(void);
722d5bb5ffSKatayama Hirofumi MZ BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1);
732d5bb5ffSKatayama Hirofumi MZ BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName);
742d5bb5ffSKatayama Hirofumi MZ void getBoundaryOfPtStack(RECT& rcBoundary, INT cPoints, const POINT *pPoints);
752d5bb5ffSKatayama Hirofumi MZ
762d5bb5ffSKatayama Hirofumi MZ #define DEG2RAD(degree) (((degree) * M_PI) / 180)
772d5bb5ffSKatayama Hirofumi MZ #define RAD2DEG(radian) ((LONG)(((radian) * 180) / M_PI))
782d5bb5ffSKatayama Hirofumi MZ
79*898fb5f4SKatayama Hirofumi MZ /* This simplifies checking and unchecking menu items */
80*898fb5f4SKatayama Hirofumi MZ #define CHECKED_IF(bChecked) \
81*898fb5f4SKatayama Hirofumi MZ ((bChecked) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND))
82*898fb5f4SKatayama Hirofumi MZ
83*898fb5f4SKatayama Hirofumi MZ /* This simplifies enabling or graying menu items */
84*898fb5f4SKatayama Hirofumi MZ #define ENABLED_IF(bEnabled) \
85*898fb5f4SKatayama Hirofumi MZ ((bEnabled) ? (MF_ENABLED | MF_BYCOMMAND) : (MF_GRAYED | MF_BYCOMMAND))
86*898fb5f4SKatayama Hirofumi MZ
872d5bb5ffSKatayama Hirofumi MZ template <typename T>
Swap(T & a,T & b)882d5bb5ffSKatayama Hirofumi MZ inline void Swap(T& a, T& b)
892d5bb5ffSKatayama Hirofumi MZ {
902d5bb5ffSKatayama Hirofumi MZ T tmp = a;
912d5bb5ffSKatayama Hirofumi MZ a = b;
922d5bb5ffSKatayama Hirofumi MZ b = tmp;
932d5bb5ffSKatayama Hirofumi MZ }
942d5bb5ffSKatayama Hirofumi MZ
952d5bb5ffSKatayama Hirofumi MZ /* LOCAL INCLUDES ***************************************************/
962d5bb5ffSKatayama Hirofumi MZ
972ca3ff5bSKatayama Hirofumi MZ #include "resource.h"
98c2c66affSColin Finck #include "drawing.h"
99c2c66affSColin Finck #include "dib.h"
100c2c66affSColin Finck #include "fullscreen.h"
101c2c66affSColin Finck #include "history.h"
102c2c66affSColin Finck #include "miniature.h"
103c2c66affSColin Finck #include "palette.h"
104c2c66affSColin Finck #include "palettemodel.h"
105c2c66affSColin Finck #include "registry.h"
106c2c66affSColin Finck #include "selectionmodel.h"
107c2c66affSColin Finck #include "sizebox.h"
1086b6a0457SKatayama Hirofumi MZ #include "canvas.h"
109c2c66affSColin Finck #include "textedit.h"
110c2c66affSColin Finck #include "toolbox.h"
111c2c66affSColin Finck #include "toolsettings.h"
112c2c66affSColin Finck #include "toolsmodel.h"
113af4a3facSKatayama Hirofumi MZ #include "main.h"
114361a2ce4SKatayama Hirofumi MZ #include "dialogs.h"
115470d86f1SKatayama Hirofumi MZ #include "atlimagedx.h"
116c2c66affSColin Finck
117470d86f1SKatayama Hirofumi MZ /* GLOBAL VARIABLES *************************************************/
118470d86f1SKatayama Hirofumi MZ
119470d86f1SKatayama Hirofumi MZ extern HINSTANCE g_hinstExe;
120470d86f1SKatayama Hirofumi MZ
121470d86f1SKatayama Hirofumi MZ extern WCHAR g_szFileName[MAX_LONG_PATH];
122470d86f1SKatayama Hirofumi MZ extern BOOL g_isAFile;
123470d86f1SKatayama Hirofumi MZ extern BOOL g_imageSaved;
124470d86f1SKatayama Hirofumi MZ extern BOOL g_showGrid;
125470d86f1SKatayama Hirofumi MZ extern BOOL g_askBeforeEnlarging;
126470d86f1SKatayama Hirofumi MZ
127470d86f1SKatayama Hirofumi MZ extern CMainWindow mainWindow;
128470d86f1SKatayama Hirofumi MZ
129470d86f1SKatayama Hirofumi MZ extern CMirrorRotateDialog mirrorRotateDialog;
130470d86f1SKatayama Hirofumi MZ extern CAttributesDialog attributesDialog;
131470d86f1SKatayama Hirofumi MZ extern CStretchSkewDialog stretchSkewDialog;
132470d86f1SKatayama Hirofumi MZ extern CFontsDialog fontsDialog;
133470d86f1SKatayama Hirofumi MZ
134470d86f1SKatayama Hirofumi MZ extern RegistrySettings registrySettings;
135470d86f1SKatayama Hirofumi MZ extern ImageModel imageModel;
136470d86f1SKatayama Hirofumi MZ extern ToolsModel toolsModel;
137470d86f1SKatayama Hirofumi MZ extern SelectionModel selectionModel;
138470d86f1SKatayama Hirofumi MZ extern PaletteModel paletteModel;
139470d86f1SKatayama Hirofumi MZ
140470d86f1SKatayama Hirofumi MZ extern HWND g_hStatusBar;
141470d86f1SKatayama Hirofumi MZ extern float g_xDpi;
142470d86f1SKatayama Hirofumi MZ extern float g_yDpi;
143470d86f1SKatayama Hirofumi MZ extern INT g_fileSize;
144470d86f1SKatayama Hirofumi MZ extern SYSTEMTIME g_fileTime;
145470d86f1SKatayama Hirofumi MZ
146470d86f1SKatayama Hirofumi MZ extern CFullscreenWindow fullscreenWindow;
147470d86f1SKatayama Hirofumi MZ extern CMiniatureWindow miniature;
148470d86f1SKatayama Hirofumi MZ extern CToolBox toolBoxContainer;
149470d86f1SKatayama Hirofumi MZ extern CToolSettingsWindow toolSettingsWindow;
150470d86f1SKatayama Hirofumi MZ extern CPaletteWindow paletteWindow;
151470d86f1SKatayama Hirofumi MZ extern CCanvasWindow canvasWindow;
152470d86f1SKatayama Hirofumi MZ extern CTextEditWindow textEditWindow;
153