reactos/base/applications/charmap/precomp.h
Charles Ambrye 99dd292553
[CHARMAP] Functionality Improvements and Bug Fixes (#2560)
- Resize the window slightly when compiled with REMOVE_ADVANCED to avoid deadspace at the bottom of the window.

- Skip over the non-printable characters by starting with character ' ' + 1.

- Instead of iterating over every cell, simply compute the cell x and y using the CellSize.

- Modify behaviour of charmap to allow large character render on mouse move, only hiding the larger character on double click.

- Simplify math for moving window to be on desktop.
Added FIXME to highlight this doesn't work well on multi-monitor setups.
Changed xPos and yPos to LONG since negative numbers are valid on multi-monitor setups.

- Do not draw invalid glyphs on the map (can happen when switching fonts or filtering existing font).
- Do not allow mouse-over of invalid glyphs.

- Fix bug that caused the Help button to remain enabled as it was being modified before it was even created.
- Do a better job at finding the correct glyph under the mouse.

- Ensure the active cell is cleared correctly.

- Invalidate the rect around the previously active cell to ensure it gets redrawn as inactive.

- Fix bug from CORE-10518 (initial active cell was not being invalidated on scroll).

- Do not try to copy a character to the output if there is no active cell selected.

- Populate the advanced portion of the screen with several built-in code pages (the list is hardcoded so that we don't enumerate everything).

- Add functionality to filter the character map by a code page (called a character set in this program).

- Some fonts list 0x0000 as drawable, even when it isn't, so ignore any valid glyphs that contain it.
2020-06-07 19:34:45 +02:00

95 lines
2 KiB
C

#ifndef __CHARMAP_PRECOMP_H
#define __CHARMAP_PRECOMP_H
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <wingdi.h>
#include "resource.h"
#define SIZEOF(_v) (sizeof(_v) / sizeof(*_v))
#define MAX_GLYPHS 65536
#define XCELLS 20
#define YCELLS 10
#define XLARGE 45
#define YLARGE 25
#define FM_SETFONT (WM_USER + 1)
#define FM_GETCHAR (WM_USER + 2)
#define FM_SETCHAR (WM_USER + 3)
#define FM_GETHFONT (WM_USER + 4)
#define FM_SETCHARMAP (WM_USER + 5)
// the code pages to display in the advanced 'character set' combobox
static const UINT codePages[] = {
864, 775, 863, 855, 737, 856, 862, 861, 852, 869, 850, 858, 865, 860, 866, 857, 437, // OEM code pages
1256, 1257, 1250, 1251, 1253, 1255, 932, 949, 1252, 936, 874, 950, 1254, 1258 // ANSI code pages
};
extern HINSTANCE hInstance;
typedef struct _CELL
{
RECT CellExt;
RECT CellInt;
BOOL bActive;
BOOL bLarge;
WCHAR ch;
} CELL, *PCELL;
typedef struct _MAP
{
HWND hMapWnd;
HWND hParent;
HWND hLrgWnd;
SIZE ClientSize;
SIZE CellSize;
CELL Cells[YCELLS][XCELLS];
PCELL pActiveCell;
HFONT hFont;
LOGFONTW CurrentFont;
INT iYStart;
INT NumRows;
INT CharMap;
USHORT ValidGlyphs[MAX_GLYPHS];
USHORT NumValidGlyphs;
} MAP, *PMAP;
typedef struct {
NMHDR hdr;
WCHAR ch;
} MAPNOTIFY, *LPMAPNOTIFY;
typedef struct {
BOOL IsAdvancedView;
} SETTINGS;
extern SETTINGS Settings;
extern HWND hCharmapDlg;
LRESULT CALLBACK LrgCellWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
VOID ShowAboutDlg(HWND hWndParent);
BOOL RegisterMapClasses(HINSTANCE hInstance);
VOID UnregisterMapClasses(HINSTANCE hInstance);
int WINAPI GetUName(IN WORD wCharCode, OUT LPWSTR lpBuf);
/* charmap.c */
VOID UpdateStatusBar(WCHAR wch);
extern VOID ChangeMapFont(HWND hDlg);
/* settings.c */
extern void LoadSettings(void);
extern void SaveSettings(void);
#endif /* __CHARMAP_PRECOMP_H */