ReactOS 0.4.15-dev-8419-g7f0e8a3
precomp.h
Go to the documentation of this file.
1/*
2 * PROJECT: PAINT for ReactOS
3 * LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
4 * PURPOSE: The precompiled header
5 * COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen@gmx.net>
6 * Copyright 2018 Stanislav Motylkov <x86corez@gmail.com>
7 * Copyright 2021-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
8 */
9
10#pragma once
11
12#ifdef NDEBUG
13 #undef DBG
14 #undef _DEBUG
15#endif
16
17#include <windef.h>
18#include <winbase.h>
19#include <winuser.h>
20#include <wingdi.h>
21#include <tchar.h>
22#include <atlbase.h>
23#include <atlcom.h>
24#include <atlpath.h>
25#include <atlstr.h>
26#include <atlwin.h>
27#include <atltypes.h>
28#include <windowsx.h>
29#include <commdlg.h>
30#include <commctrl.h>
31#include <stdlib.h>
32#define _USE_MATH_DEFINES /* for M_PI */
33#include <math.h>
34#include <shellapi.h>
35#include <htmlhelp.h>
36#include <strsafe.h>
37#include <ui/CWaitCursor.h>
38
39#include <debug.h>
40
41/* CONSTANTS *******************************************************/
42
43#define GRIP_SIZE 3
44#define MIN_ZOOM 125
45#define MAX_ZOOM 8000
46
47#define MAX_LONG_PATH 512
48
49#define WM_TOOLSMODELTOOLCHANGED (WM_APP + 0)
50#define WM_TOOLSMODELSETTINGSCHANGED (WM_APP + 1)
51#define WM_TOOLSMODELZOOMCHANGED (WM_APP + 2)
52#define WM_PALETTEMODELCOLORCHANGED (WM_APP + 3)
53
54enum HITTEST // hit
55{
56 HIT_NONE = 0, // Nothing hit or outside
67};
68
69/* COMMON FUNCTIONS *************************************************/
70
71void ShowOutOfMemory(void);
73BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName);
74void getBoundaryOfPtStack(RECT& rcBoundary, INT cPoints, const POINT *pPoints);
75
76#define DEG2RAD(degree) (((degree) * M_PI) / 180)
77#define RAD2DEG(radian) ((LONG)(((radian) * 180) / M_PI))
78
79/* This simplifies checking and unchecking menu items */
80#define CHECKED_IF(bChecked) \
81 ((bChecked) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND))
82
83/* This simplifies enabling or graying menu items */
84#define ENABLED_IF(bEnabled) \
85 ((bEnabled) ? (MF_ENABLED | MF_BYCOMMAND) : (MF_GRAYED | MF_BYCOMMAND))
86
87template <typename T>
88inline void Swap(T& a, T& b)
89{
90 T tmp = a;
91 a = b;
92 b = tmp;
93}
94
95/* LOCAL INCLUDES ***************************************************/
96
97#include "resource.h"
98#include "drawing.h"
99#include "dib.h"
100#include "fullscreen.h"
101#include "history.h"
102#include "miniature.h"
103#include "palette.h"
104#include "palettemodel.h"
105#include "registry.h"
106#include "selectionmodel.h"
107#include "sizebox.h"
108#include "canvas.h"
109#include "textedit.h"
110#include "toolbox.h"
111#include "toolsettings.h"
112#include "toolsmodel.h"
113#include "main.h"
114#include "dialogs.h"
115#include "atlimagedx.h"
116
117/* GLOBAL VARIABLES *************************************************/
118
119extern HINSTANCE g_hinstExe;
120
122extern BOOL g_isAFile;
123extern BOOL g_imageSaved;
124extern BOOL g_showGrid;
126
128
133
139
140extern HWND g_hStatusBar;
141extern float g_xDpi;
142extern float g_yDpi;
143extern INT g_fileSize;
145
HWND hWnd
Definition: settings.c:17
HWND g_hStatusBar
Definition: main.cpp:23
ToolsModel toolsModel
Definition: toolsmodel.cpp:10
void getBoundaryOfPtStack(RECT &rcBoundary, INT cPoints, const POINT *pPoints)
CAttributesDialog attributesDialog
Definition: dialogs.cpp:14
CMiniatureWindow miniature
Definition: miniature.cpp:12
CFontsDialog fontsDialog
Definition: dialogs.cpp:16
BOOL g_imageSaved
Definition: main.cpp:21
ImageModel imageModel
Definition: history.cpp:11
RegistrySettings registrySettings
Definition: registry.cpp:14
BOOL g_askBeforeEnlarging
Definition: main.cpp:16
CPaletteWindow paletteWindow
Definition: palette.cpp:19
WCHAR g_szFileName[MAX_LONG_PATH]
Definition: main.cpp:18
CFullscreenWindow fullscreenWindow
Definition: fullscreen.cpp:10
CStretchSkewDialog stretchSkewDialog
Definition: dialogs.cpp:15
BOOL g_showGrid
Definition: main.cpp:22
SelectionModel selectionModel
float g_xDpi
Definition: dib.cpp:11
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1)
Definition: mouse.cpp:49
CToolBox toolBoxContainer
Definition: toolbox.cpp:11
BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName)
Definition: main.cpp:99
HITTEST
Definition: precomp.h:55
@ HIT_NONE
Definition: precomp.h:56
@ HIT_BORDER
Definition: precomp.h:65
@ HIT_LOWER_RIGHT
Definition: precomp.h:64
@ HIT_LOWER_CENTER
Definition: precomp.h:63
@ HIT_UPPER_LEFT
Definition: precomp.h:57
@ HIT_INNER
Definition: precomp.h:66
@ HIT_LOWER_LEFT
Definition: precomp.h:62
@ HIT_UPPER_CENTER
Definition: precomp.h:58
@ HIT_UPPER_RIGHT
Definition: precomp.h:59
@ HIT_MIDDLE_RIGHT
Definition: precomp.h:61
@ HIT_MIDDLE_LEFT
Definition: precomp.h:60
float g_yDpi
Definition: dib.cpp:12
CCanvasWindow canvasWindow
Definition: canvas.cpp:10
SYSTEMTIME g_fileTime
Definition: dib.cpp:13
CMainWindow mainWindow
Definition: main.cpp:25
void ShowOutOfMemory(void)
Definition: main.cpp:34
BOOL g_isAFile
Definition: main.cpp:20
#define MAX_LONG_PATH
Definition: precomp.h:47
CTextEditWindow textEditWindow
Definition: textedit.cpp:12
PaletteModel paletteModel
CToolSettingsWindow toolSettingsWindow
CMirrorRotateDialog mirrorRotateDialog
Definition: dialogs.cpp:13
HINSTANCE g_hinstExe
Definition: main.cpp:17
INT g_fileSize
Definition: dib.cpp:10
unsigned int BOOL
Definition: ntddk_ex.h:94
#define Swap(a, b)
Definition: geom.c:201
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79
#define T
Definition: mbstring.h:31
GLint y0
Definition: linetemp.h:96
GLint x0
Definition: linetemp.h:95
int32_t INT
Definition: typedefs.h:58
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185