wordpad: Add list labelling menu.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-10-10 13:13:05 +01:00 committed by Alexandre Julliard
parent 0df058d847
commit c11d931ea3
3 changed files with 48 additions and 10 deletions

View File

@ -79,6 +79,8 @@ static WCHAR units_inW[MAX_STRING_LEN];
static WCHAR units_inchW[MAX_STRING_LEN];
static WCHAR units_ptW[MAX_STRING_LEN];
static int last_bullet = PFN_BULLET;
static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam );
typedef enum
@ -1886,7 +1888,7 @@ static LRESULT OnCreate( HWND hWnd )
AddButton(hFormatBarWnd, 5, ID_ALIGN_CENTER);
AddButton(hFormatBarWnd, 6, ID_ALIGN_RIGHT);
AddSeparator(hFormatBarWnd);
AddButton(hFormatBarWnd, 7, ID_BULLET);
AddButton(hFormatBarWnd, 7, ID_BULLETONOFF);
SendMessageW(hFormatBarWnd, TB_AUTOSIZE, 0, 0);
@ -1994,7 +1996,7 @@ static LRESULT OnUser( HWND hWnd )
SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_ALIGN_CENTER, (pf.wAlignment == PFA_CENTER));
SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_ALIGN_RIGHT, (pf.wAlignment == PFA_RIGHT));
SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_BULLET, (pf.wNumbering & PFN_BULLET));
SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_BULLETONOFF, pf.wNumbering ? TRUE : FALSE);
return 0;
}
@ -2351,30 +2353,45 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
SendMessageW(hwndEditor, EM_REDO, 0, 0);
return 0;
case ID_BULLETONOFF:
case ID_BULLET:
case ID_NUMBERING:
case ID_LCLETTER:
case ID_UCLETTER:
case ID_LCROMAN:
case ID_UCROMAN:
{
PARAFORMAT2 pf;
WORD new_number = LOWORD(wParam) - ID_BULLET + PFN_BULLET;
pf.cbSize = sizeof(pf);
pf.dwMask = PFM_NUMBERING;
SendMessageW(hwndEditor, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
pf.dwMask = PFM_NUMBERING | PFM_NUMBERINGSTART | PFM_NUMBERINGTAB | PFM_OFFSET | PFM_OFFSETINDENT;
pf.dwMask = PFM_NUMBERING | PFM_NUMBERINGSTART | PFM_NUMBERINGSTYLE | PFM_NUMBERINGTAB | PFM_OFFSET | PFM_OFFSETINDENT;
if(pf.wNumbering == PFN_BULLET)
if(pf.wNumbering && ((pf.wNumbering == new_number) || (LOWORD(wParam) == ID_BULLETONOFF)))
{
pf.wNumbering = 0;
pf.wNumberingStart = 0;
pf.wNumberingStyle = 0;
pf.wNumberingTab = 0;
pf.dxOffset = 0;
pf.dxStartIndent = -360;
} else
{
pf.wNumbering = PFN_BULLET;
pf.dxStartIndent = pf.wNumbering ? 0 : 360;
if (LOWORD(wParam) == ID_BULLETONOFF)
pf.wNumbering = last_bullet;
else
{
pf.wNumbering = new_number;
last_bullet = pf.wNumbering;
}
pf.wNumberingStart = 1;
pf.wNumberingStyle = PFNS_PERIOD;
pf.wNumberingTab = 360;
pf.dxOffset = 360;
pf.dxStartIndent = 360;
}
SendMessageW(hwndEditor, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
@ -2502,7 +2519,14 @@ static LRESULT OnInitPopupMenu( HWND hWnd, WPARAM wParam )
CheckMenuItem(hMenu, ID_ALIGN_LEFT, (nAlignment == PFA_LEFT) ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu, ID_ALIGN_CENTER, (nAlignment == PFA_CENTER) ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu, ID_ALIGN_RIGHT, (nAlignment == PFA_RIGHT) ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu, ID_BULLET, ((pf.wNumbering == PFN_BULLET) ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(hMenu, ID_NUMBERING, ((pf.wNumbering == PFN_ARABIC) ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(hMenu, ID_LCLETTER, ((pf.wNumbering == PFN_LCLETTER) ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(hMenu, ID_UCLETTER, ((pf.wNumbering == PFN_UCLETTER) ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(hMenu, ID_LCROMAN, ((pf.wNumbering == PFN_LCROMAN) ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(hMenu, ID_UCROMAN, ((pf.wNumbering == PFN_UCROMAN) ? MF_CHECKED : MF_UNCHECKED));
EnableMenuItem(hMenu, ID_EDIT_UNDO, SendMessageW(hwndEditor, EM_CANUNDO, 0, 0) ?
MF_ENABLED : MF_GRAYED);
EnableMenuItem(hMenu, ID_EDIT_REDO, SendMessageW(hwndEditor, EM_CANREDO, 0, 0) ?

View File

@ -73,9 +73,15 @@
#define ID_EDIT_CUT 1311
#define ID_EDIT_PASTE 1312
#define ID_EDIT_CLEAR 1313
#define ID_BULLET 1314
#define ID_BULLETONOFF 1314
#define ID_BULLET 1315
#define ID_NUMBERING 1316
#define ID_LCLETTER 1317
#define ID_UCLETTER 1318
#define ID_LCROMAN 1319
#define ID_UCROMAN 1320
#define ID_FONTSETTINGS 1315
#define ID_FONTSETTINGS 1330
#define ID_FORMAT_BOLD 1400
#define ID_FORMAT_ITALIC 1401

View File

@ -81,7 +81,15 @@ BEGIN
POPUP "F&ormat"
BEGIN
MENUITEM "&Font...", ID_FONTSETTINGS
POPUP "&Lists"
BEGIN
MENUITEM "&Bullet points" ID_BULLET
MENUITEM "Numbers" ID_NUMBERING
MENUITEM "Letters - lower case" ID_LCLETTER
MENUITEM "Letters - upper case" ID_UCLETTER
MENUITEM "Roman numerals - lower case" ID_LCROMAN
MENUITEM "Roman numerals - upper case" ID_UCROMAN
END
MENUITEM "&Paragraph..." ID_PARAFORMAT
MENUITEM "&Tabs..." ID_TABSTOPS
POPUP "Backgroun&d"