Commit c11d931e authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wordpad: Add list labelling menu.

parent 0df058d8
...@@ -79,6 +79,8 @@ static WCHAR units_inW[MAX_STRING_LEN]; ...@@ -79,6 +79,8 @@ static WCHAR units_inW[MAX_STRING_LEN];
static WCHAR units_inchW[MAX_STRING_LEN]; static WCHAR units_inchW[MAX_STRING_LEN];
static WCHAR units_ptW[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 ); static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam );
typedef enum typedef enum
...@@ -1886,7 +1888,7 @@ static LRESULT OnCreate( HWND hWnd ) ...@@ -1886,7 +1888,7 @@ static LRESULT OnCreate( HWND hWnd )
AddButton(hFormatBarWnd, 5, ID_ALIGN_CENTER); AddButton(hFormatBarWnd, 5, ID_ALIGN_CENTER);
AddButton(hFormatBarWnd, 6, ID_ALIGN_RIGHT); AddButton(hFormatBarWnd, 6, ID_ALIGN_RIGHT);
AddSeparator(hFormatBarWnd); AddSeparator(hFormatBarWnd);
AddButton(hFormatBarWnd, 7, ID_BULLET); AddButton(hFormatBarWnd, 7, ID_BULLETONOFF);
SendMessageW(hFormatBarWnd, TB_AUTOSIZE, 0, 0); SendMessageW(hFormatBarWnd, TB_AUTOSIZE, 0, 0);
...@@ -1994,7 +1996,7 @@ static LRESULT OnUser( HWND hWnd ) ...@@ -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_CENTER, (pf.wAlignment == PFA_CENTER));
SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_ALIGN_RIGHT, (pf.wAlignment == PFA_RIGHT)); 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; return 0;
} }
...@@ -2351,30 +2353,45 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -2351,30 +2353,45 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
SendMessageW(hwndEditor, EM_REDO, 0, 0); SendMessageW(hwndEditor, EM_REDO, 0, 0);
return 0; return 0;
case ID_BULLETONOFF:
case ID_BULLET: case ID_BULLET:
case ID_NUMBERING:
case ID_LCLETTER:
case ID_UCLETTER:
case ID_LCROMAN:
case ID_UCROMAN:
{ {
PARAFORMAT2 pf; PARAFORMAT2 pf;
WORD new_number = LOWORD(wParam) - ID_BULLET + PFN_BULLET;
pf.cbSize = sizeof(pf); pf.cbSize = sizeof(pf);
pf.dwMask = PFM_NUMBERING; pf.dwMask = PFM_NUMBERING;
SendMessageW(hwndEditor, EM_GETPARAFORMAT, 0, (LPARAM)&pf); 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.wNumbering = 0;
pf.wNumberingStart = 0; pf.wNumberingStart = 0;
pf.wNumberingStyle = 0;
pf.wNumberingTab = 0; pf.wNumberingTab = 0;
pf.dxOffset = 0; pf.dxOffset = 0;
pf.dxStartIndent = -360; pf.dxStartIndent = -360;
} else } 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.wNumberingStart = 1;
pf.wNumberingStyle = PFNS_PERIOD;
pf.wNumberingTab = 360; pf.wNumberingTab = 360;
pf.dxOffset = 360; pf.dxOffset = 360;
pf.dxStartIndent = 360;
} }
SendMessageW(hwndEditor, EM_SETPARAFORMAT, 0, (LPARAM)&pf); SendMessageW(hwndEditor, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
...@@ -2502,7 +2519,14 @@ static LRESULT OnInitPopupMenu( HWND hWnd, WPARAM wParam ) ...@@ -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_LEFT, (nAlignment == PFA_LEFT) ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu, ID_ALIGN_CENTER, (nAlignment == PFA_CENTER) ? 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_ALIGN_RIGHT, (nAlignment == PFA_RIGHT) ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu, ID_BULLET, ((pf.wNumbering == PFN_BULLET) ? 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) ? EnableMenuItem(hMenu, ID_EDIT_UNDO, SendMessageW(hwndEditor, EM_CANUNDO, 0, 0) ?
MF_ENABLED : MF_GRAYED); MF_ENABLED : MF_GRAYED);
EnableMenuItem(hMenu, ID_EDIT_REDO, SendMessageW(hwndEditor, EM_CANREDO, 0, 0) ? EnableMenuItem(hMenu, ID_EDIT_REDO, SendMessageW(hwndEditor, EM_CANREDO, 0, 0) ?
......
...@@ -73,9 +73,15 @@ ...@@ -73,9 +73,15 @@
#define ID_EDIT_CUT 1311 #define ID_EDIT_CUT 1311
#define ID_EDIT_PASTE 1312 #define ID_EDIT_PASTE 1312
#define ID_EDIT_CLEAR 1313 #define ID_EDIT_CLEAR 1313
#define ID_BULLET 1314 #define ID_BULLETONOFF 1314
#define ID_BULLET 1315
#define ID_FONTSETTINGS 1315 #define ID_NUMBERING 1316
#define ID_LCLETTER 1317
#define ID_UCLETTER 1318
#define ID_LCROMAN 1319
#define ID_UCROMAN 1320
#define ID_FONTSETTINGS 1330
#define ID_FORMAT_BOLD 1400 #define ID_FORMAT_BOLD 1400
#define ID_FORMAT_ITALIC 1401 #define ID_FORMAT_ITALIC 1401
......
...@@ -81,7 +81,15 @@ BEGIN ...@@ -81,7 +81,15 @@ BEGIN
POPUP "F&ormat" POPUP "F&ormat"
BEGIN BEGIN
MENUITEM "&Font...", ID_FONTSETTINGS MENUITEM "&Font...", ID_FONTSETTINGS
POPUP "&Lists"
BEGIN
MENUITEM "&Bullet points" ID_BULLET 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 "&Paragraph..." ID_PARAFORMAT
MENUITEM "&Tabs..." ID_TABSTOPS MENUITEM "&Tabs..." ID_TABSTOPS
POPUP "Backgroun&d" POPUP "Backgroun&d"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment