mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[CHARMAP] Updates to behaviour and UI (#2543)
Purpose ~=~=~=~ This pull request updates charmap to look a bit better (removes gap at bottom of the window), removes the blank space character (0x0020) from the charmap, and also modifies the behaviour of when a larger glyph is rendered (allowing the user to select a new glyph by holding down the mouse button). This better mimics the charmap.exe that is bundled by Microsoft. Proposed changes ~=~=~=~=~=~=~=~= - Remove gap where the advanced button is normally rendered when compiled with REMOVE_ADVANCED (which is the default behaviour). - Skip over the blank space character. - Change behaviour of rendering large glyphs to allow mouse move, and to hide on double click. - Optimize search for glyph under the mouse by using the cellSize instead of PtInRect. * [CHARMAP] Resize the window slightly when compiled with REMOVE_ADVANCED to avoid deadspace at the bottom of the window * [CHARMAP] Skip over the non-printable characters by starting with character ' ' + 1 * [CHARMAP] 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.
This commit is contained in:
parent
ea298746db
commit
d90e1061e1
2 changed files with 54 additions and 50 deletions
|
@ -276,6 +276,8 @@ ChangeView(HWND hWnd)
|
||||||
RECT rcCharmap;
|
RECT rcCharmap;
|
||||||
#ifndef REMOVE_ADVANCED
|
#ifndef REMOVE_ADVANCED
|
||||||
RECT rcAdvanced;
|
RECT rcAdvanced;
|
||||||
|
#else
|
||||||
|
RECT rcCopy;
|
||||||
#endif
|
#endif
|
||||||
RECT rcPanelExt;
|
RECT rcPanelExt;
|
||||||
RECT rcPanelInt;
|
RECT rcPanelInt;
|
||||||
|
@ -284,10 +286,16 @@ ChangeView(HWND hWnd)
|
||||||
UINT xPos, yPos;
|
UINT xPos, yPos;
|
||||||
UINT Width, Height;
|
UINT Width, Height;
|
||||||
UINT DeskTopWidth, DeskTopHeight;
|
UINT DeskTopWidth, DeskTopHeight;
|
||||||
|
#ifdef REMOVE_ADVANCED
|
||||||
|
HWND hCopy;
|
||||||
|
#endif
|
||||||
|
|
||||||
GetClientRect(hCharmapDlg, &rcCharmap);
|
GetClientRect(hCharmapDlg, &rcCharmap);
|
||||||
#ifndef REMOVE_ADVANCED
|
#ifndef REMOVE_ADVANCED
|
||||||
GetClientRect(hAdvancedDlg, &rcAdvanced);
|
GetClientRect(hAdvancedDlg, &rcAdvanced);
|
||||||
|
#else
|
||||||
|
hCopy = GetDlgItem(hCharmapDlg, IDC_COPY);
|
||||||
|
GetClientRect(hCopy, &rcCopy);
|
||||||
#endif
|
#endif
|
||||||
GetWindowRect(hWnd, &rcPanelExt);
|
GetWindowRect(hWnd, &rcPanelExt);
|
||||||
GetClientRect(hWnd, &rcPanelInt);
|
GetClientRect(hWnd, &rcPanelInt);
|
||||||
|
@ -312,6 +320,10 @@ ChangeView(HWND hWnd)
|
||||||
#ifndef REMOVE_ADVANCED
|
#ifndef REMOVE_ADVANCED
|
||||||
if (Settings.IsAdvancedView)
|
if (Settings.IsAdvancedView)
|
||||||
Height += rcAdvanced.bottom;
|
Height += rcAdvanced.bottom;
|
||||||
|
#else
|
||||||
|
/* The lack of advanced button leaves an empty gap at the bottom of the window.
|
||||||
|
Shrink the window height a bit here to accomodate for that lost control. */
|
||||||
|
Height = rcCharmap.bottom + rcCopy.bottom + 10;
|
||||||
#endif
|
#endif
|
||||||
if ((xPos + Width) > DeskTopWidth)
|
if ((xPos + Width) > DeskTopWidth)
|
||||||
xPos += DeskTopWidth - (xPos + Width);
|
xPos += DeskTopWidth - (xPos + Width);
|
||||||
|
|
|
@ -256,7 +256,7 @@ SetFont(PMAP infoPtr,
|
||||||
GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR)
|
GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR)
|
||||||
{
|
{
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i = 0; i < MAX_GLYPHS; i++)
|
for (i = ' ' + 1; i < MAX_GLYPHS; i++)
|
||||||
{
|
{
|
||||||
if (out[i] != 0xffff)
|
if (out[i] != 0xffff)
|
||||||
{
|
{
|
||||||
|
@ -312,64 +312,38 @@ OnClick(PMAP infoPtr,
|
||||||
WORD ptx,
|
WORD ptx,
|
||||||
WORD pty)
|
WORD pty)
|
||||||
{
|
{
|
||||||
POINT pt;
|
|
||||||
INT x, y;
|
INT x, y;
|
||||||
|
|
||||||
pt.x = ptx;
|
x = ptx / max(1, infoPtr->CellSize.cx);
|
||||||
pt.y = pty;
|
y = pty / max(1, infoPtr->CellSize.cy);
|
||||||
|
|
||||||
for (x = 0; x < XCELLS; x++)
|
/* if the cell is not already active */
|
||||||
for (y = 0; y < YCELLS; y++)
|
if (!infoPtr->Cells[y][x].bActive)
|
||||||
{
|
{
|
||||||
if (PtInRect(&infoPtr->Cells[y][x].CellInt,
|
/* set previous active cell to inactive */
|
||||||
pt))
|
if (infoPtr->pActiveCell)
|
||||||
{
|
{
|
||||||
/* if the cell is not already active */
|
/* invalidate normal cells, required when
|
||||||
if (!infoPtr->Cells[y][x].bActive)
|
* moving a small active cell via keyboard */
|
||||||
|
if (!infoPtr->pActiveCell->bLarge)
|
||||||
{
|
{
|
||||||
/* set previous active cell to inactive */
|
InvalidateRect(infoPtr->hMapWnd,
|
||||||
if (infoPtr->pActiveCell)
|
&infoPtr->pActiveCell->CellInt,
|
||||||
{
|
TRUE);
|
||||||
/* invalidate normal cells, required when
|
|
||||||
* moving a small active cell via keyboard */
|
|
||||||
if (!infoPtr->pActiveCell->bLarge)
|
|
||||||
{
|
|
||||||
InvalidateRect(infoPtr->hMapWnd,
|
|
||||||
&infoPtr->pActiveCell->CellInt,
|
|
||||||
TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
infoPtr->pActiveCell->bActive = FALSE;
|
|
||||||
infoPtr->pActiveCell->bLarge = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set new cell to active */
|
|
||||||
infoPtr->pActiveCell = &infoPtr->Cells[y][x];
|
|
||||||
infoPtr->pActiveCell->bActive = TRUE;
|
|
||||||
infoPtr->pActiveCell->bLarge = TRUE;
|
|
||||||
if (infoPtr->hLrgWnd)
|
|
||||||
MoveLargeCell(infoPtr);
|
|
||||||
else
|
|
||||||
CreateLargeCell(infoPtr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* flick between large and small */
|
|
||||||
if (infoPtr->pActiveCell->bLarge)
|
|
||||||
{
|
|
||||||
DestroyWindow(infoPtr->hLrgWnd);
|
|
||||||
infoPtr->hLrgWnd = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CreateLargeCell(infoPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
infoPtr->pActiveCell->bLarge = (infoPtr->pActiveCell->bLarge) ? FALSE : TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
infoPtr->pActiveCell->bActive = FALSE;
|
||||||
|
infoPtr->pActiveCell->bLarge = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set new cell to active */
|
||||||
|
infoPtr->pActiveCell = &infoPtr->Cells[y][x];
|
||||||
|
infoPtr->pActiveCell->bActive = TRUE;
|
||||||
|
infoPtr->pActiveCell->bLarge = TRUE;
|
||||||
|
if (infoPtr->hLrgWnd)
|
||||||
|
MoveLargeCell(infoPtr);
|
||||||
|
else
|
||||||
|
CreateLargeCell(infoPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,12 +551,30 @@ MapWndProc(HWND hwnd,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WM_MOUSEMOVE:
|
||||||
|
{
|
||||||
|
if (wParam & MK_LBUTTON)
|
||||||
|
{
|
||||||
|
OnClick(infoPtr,
|
||||||
|
LOWORD(lParam),
|
||||||
|
HIWORD(lParam));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
{
|
{
|
||||||
NotifyParentOfSelection(infoPtr,
|
NotifyParentOfSelection(infoPtr,
|
||||||
FM_SETCHAR,
|
FM_SETCHAR,
|
||||||
infoPtr->pActiveCell->ch);
|
infoPtr->pActiveCell->ch);
|
||||||
|
|
||||||
|
if (infoPtr->pActiveCell->bLarge)
|
||||||
|
{
|
||||||
|
DestroyWindow(infoPtr->hLrgWnd);
|
||||||
|
infoPtr->hLrgWnd = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
infoPtr->pActiveCell->bLarge = FALSE;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue