mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +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;
|
||||
#ifndef REMOVE_ADVANCED
|
||||
RECT rcAdvanced;
|
||||
#else
|
||||
RECT rcCopy;
|
||||
#endif
|
||||
RECT rcPanelExt;
|
||||
RECT rcPanelInt;
|
||||
|
@ -284,10 +286,16 @@ ChangeView(HWND hWnd)
|
|||
UINT xPos, yPos;
|
||||
UINT Width, Height;
|
||||
UINT DeskTopWidth, DeskTopHeight;
|
||||
#ifdef REMOVE_ADVANCED
|
||||
HWND hCopy;
|
||||
#endif
|
||||
|
||||
GetClientRect(hCharmapDlg, &rcCharmap);
|
||||
#ifndef REMOVE_ADVANCED
|
||||
GetClientRect(hAdvancedDlg, &rcAdvanced);
|
||||
#else
|
||||
hCopy = GetDlgItem(hCharmapDlg, IDC_COPY);
|
||||
GetClientRect(hCopy, &rcCopy);
|
||||
#endif
|
||||
GetWindowRect(hWnd, &rcPanelExt);
|
||||
GetClientRect(hWnd, &rcPanelInt);
|
||||
|
@ -312,6 +320,10 @@ ChangeView(HWND hWnd)
|
|||
#ifndef REMOVE_ADVANCED
|
||||
if (Settings.IsAdvancedView)
|
||||
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
|
||||
if ((xPos + Width) > DeskTopWidth)
|
||||
xPos += DeskTopWidth - (xPos + Width);
|
||||
|
|
|
@ -256,7 +256,7 @@ SetFont(PMAP infoPtr,
|
|||
GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR)
|
||||
{
|
||||
j = 0;
|
||||
for (i = 0; i < MAX_GLYPHS; i++)
|
||||
for (i = ' ' + 1; i < MAX_GLYPHS; i++)
|
||||
{
|
||||
if (out[i] != 0xffff)
|
||||
{
|
||||
|
@ -312,64 +312,38 @@ OnClick(PMAP infoPtr,
|
|||
WORD ptx,
|
||||
WORD pty)
|
||||
{
|
||||
POINT pt;
|
||||
INT x, y;
|
||||
|
||||
pt.x = ptx;
|
||||
pt.y = pty;
|
||||
x = ptx / max(1, infoPtr->CellSize.cx);
|
||||
y = pty / max(1, infoPtr->CellSize.cy);
|
||||
|
||||
for (x = 0; x < XCELLS; x++)
|
||||
for (y = 0; y < YCELLS; y++)
|
||||
/* if the cell is not already active */
|
||||
if (!infoPtr->Cells[y][x].bActive)
|
||||
{
|
||||
if (PtInRect(&infoPtr->Cells[y][x].CellInt,
|
||||
pt))
|
||||
/* set previous active cell to inactive */
|
||||
if (infoPtr->pActiveCell)
|
||||
{
|
||||
/* if the cell is not already active */
|
||||
if (!infoPtr->Cells[y][x].bActive)
|
||||
/* invalidate normal cells, required when
|
||||
* moving a small active cell via keyboard */
|
||||
if (!infoPtr->pActiveCell->bLarge)
|
||||
{
|
||||
/* set previous active cell to inactive */
|
||||
if (infoPtr->pActiveCell)
|
||||
{
|
||||
/* 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;
|
||||
InvalidateRect(infoPtr->hMapWnd,
|
||||
&infoPtr->pActiveCell->CellInt,
|
||||
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;
|
||||
}
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
if (wParam & MK_LBUTTON)
|
||||
{
|
||||
OnClick(infoPtr,
|
||||
LOWORD(lParam),
|
||||
HIWORD(lParam));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_LBUTTONDBLCLK:
|
||||
{
|
||||
NotifyParentOfSelection(infoPtr,
|
||||
FM_SETCHAR,
|
||||
infoPtr->pActiveCell->ch);
|
||||
|
||||
if (infoPtr->pActiveCell->bLarge)
|
||||
{
|
||||
DestroyWindow(infoPtr->hLrgWnd);
|
||||
infoPtr->hLrgWnd = NULL;
|
||||
}
|
||||
|
||||
infoPtr->pActiveCell->bLarge = FALSE;
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue