2018-04-14 12:42:34 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: PAINT for ReactOS
|
|
|
|
* LICENSE: LGPL
|
|
|
|
* FILE: base/applications/mspaint/common.h
|
2021-12-28 01:44:56 +00:00
|
|
|
* PURPOSE: Commonly used functions and definitions
|
2018-04-14 12:42:34 +00:00
|
|
|
* PROGRAMMERS: Benedikt Freisen
|
|
|
|
* Stanislav Motylkov
|
2021-12-26 10:49:56 +00:00
|
|
|
* Katayama Hirofumi MZ
|
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
|
|
|
|
|
|
|
|
/* width of the rectangle defined by a RECT structure */
|
|
|
|
#define RECT_WIDTH(a) ((a).right - (a).left)
|
|
|
|
|
|
|
|
/* height of the rectangle defined by a RECT structure */
|
|
|
|
#define RECT_HEIGHT(a) ((a).bottom - (a).top)
|
|
|
|
|
|
|
|
/* 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))
|
|
|
|
|
2018-04-14 12:42:34 +00:00
|
|
|
/* FUNCTIONS ********************************************************/
|
|
|
|
|
2021-12-26 10:49:56 +00:00
|
|
|
BOOL zoomTo(int newZoom, int mouseX, int mouseY);
|
2021-12-27 11:06:21 +00:00
|
|
|
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1);
|
2022-01-01 13:02:36 +00:00
|
|
|
void placeSelWin(void);
|
|
|
|
void updateStartAndLast(LONG x, LONG y);
|
|
|
|
void updateLast(LONG x, LONG y);
|
2021-12-26 10:49:56 +00:00
|
|
|
|
|
|
|
static inline int Zoomed(int xy)
|
|
|
|
{
|
|
|
|
return xy * toolsModel.GetZoom() / 1000;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int UnZoomed(int xy)
|
|
|
|
{
|
|
|
|
return xy * 1000 / toolsModel.GetZoom();
|
|
|
|
}
|