2018-04-14 12:42:34 +00:00
|
|
|
/*
|
2023-06-23 11:04:32 +00:00
|
|
|
* PROJECT: PAINT for ReactOS
|
|
|
|
* LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
|
|
|
|
* PURPOSE: Commonly used functions and definitions
|
2023-06-27 18:22:21 +00:00
|
|
|
* COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen@gmx.net>
|
2023-06-23 11:04:32 +00:00
|
|
|
* Copyright 2018 Stanislav Motylkov <x86corez@gmail.com>
|
|
|
|
* Copyright 2021-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
2018-04-14 12:42:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-12-28 01:44:56 +00:00
|
|
|
#define GRIP_SIZE 3
|
|
|
|
#define MIN_ZOOM 125
|
|
|
|
#define MAX_ZOOM 8000
|
|
|
|
|
2023-03-28 13:31:26 +00:00
|
|
|
#define MAX_LONG_PATH 512
|
|
|
|
|
|
|
|
#define WM_TOOLSMODELTOOLCHANGED (WM_APP + 0)
|
|
|
|
#define WM_TOOLSMODELSETTINGSCHANGED (WM_APP + 1)
|
|
|
|
#define WM_TOOLSMODELZOOMCHANGED (WM_APP + 2)
|
|
|
|
#define WM_PALETTEMODELCOLORCHANGED (WM_APP + 3)
|
2021-12-28 01:44:56 +00:00
|
|
|
|
|
|
|
/* this simplifies checking and unchecking menu items */
|
|
|
|
#define CHECKED_IF(a) ((a) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND))
|
|
|
|
|
|
|
|
/* this simplifies enabling or graying menu items */
|
|
|
|
#define ENABLED_IF(a) ((a) ? (MF_ENABLED | MF_BYCOMMAND) : (MF_GRAYED | MF_BYCOMMAND))
|
|
|
|
|
2023-06-24 10:39:07 +00:00
|
|
|
enum HITTEST // hit
|
2023-03-28 13:31:26 +00:00
|
|
|
{
|
|
|
|
HIT_NONE = 0, // Nothing hit or outside
|
|
|
|
HIT_UPPER_LEFT,
|
|
|
|
HIT_UPPER_CENTER,
|
|
|
|
HIT_UPPER_RIGHT,
|
|
|
|
HIT_MIDDLE_LEFT,
|
|
|
|
HIT_MIDDLE_RIGHT,
|
|
|
|
HIT_LOWER_LEFT,
|
|
|
|
HIT_LOWER_CENTER,
|
|
|
|
HIT_LOWER_RIGHT,
|
|
|
|
HIT_BORDER,
|
|
|
|
HIT_INNER,
|
|
|
|
};
|
|
|
|
|
2018-04-14 12:42:34 +00:00
|
|
|
/* FUNCTIONS ********************************************************/
|
|
|
|
|
2023-10-24 17:35:49 +00:00
|
|
|
void ShowOutOfMemory(void);
|
2021-12-27 11:06:21 +00:00
|
|
|
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1);
|
2023-08-09 14:59:34 +00:00
|
|
|
BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName);
|
2023-11-22 22:14:57 +00:00
|
|
|
void getBoundaryOfPtStack(RECT& rcBoundary, INT cPoints, const POINT *pPoints);
|
2023-09-26 13:47:23 +00:00
|
|
|
|
|
|
|
#define DEG2RAD(degree) (((degree) * M_PI) / 180)
|
|
|
|
#define RAD2DEG(radian) ((LONG)(((radian) * 180) / M_PI))
|
2023-11-18 02:19:38 +00:00
|
|
|
|
|
|
|
template <typename T>
|
2023-11-18 02:23:13 +00:00
|
|
|
inline void Swap(T& a, T& b)
|
2023-11-18 02:19:38 +00:00
|
|
|
{
|
|
|
|
T tmp = a;
|
|
|
|
a = b;
|
|
|
|
b = tmp;
|
|
|
|
}
|