wordpad: Add page setup dialog.
This commit is contained in:
parent
61876c7205
commit
d5bb616913
|
@ -28,6 +28,7 @@ BEGIN
|
|||
MENUITEM "Speichern &unter...", ID_FILE_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print . . .\tCtrl+P", ID_PRINT
|
||||
MENUITEM "Pag&e setup . . .", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Beenden", ID_FILE_EXIT
|
||||
END
|
||||
|
|
|
@ -28,6 +28,7 @@ BEGIN
|
|||
MENUITEM "Save &as . . .", ID_FILE_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print . . .\tCtrl+P", ID_PRINT
|
||||
MENUITEM "Pag&e setup . . .", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit", ID_FILE_EXIT
|
||||
END
|
||||
|
|
|
@ -28,6 +28,7 @@ BEGIN
|
|||
MENUITEM "Enregistrer &sous...", ID_FILE_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print . . .\tCtrl+P", ID_PRINT
|
||||
MENUITEM "Page setup . . .", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Quitter", ID_FILE_EXIT
|
||||
END
|
||||
|
|
|
@ -28,6 +28,7 @@ BEGIN
|
|||
MENUITEM "Mentés má&sként...", ID_FILE_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print . . .\tCtrl+P", ID_PRINT
|
||||
MENUITEM "Page setup . . .", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Kilépés", ID_FILE_EXIT
|
||||
END
|
||||
|
|
|
@ -29,6 +29,7 @@ BEGIN
|
|||
MENUITEM "다른 이름으로 저장(&A)...", ID_FILE_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print . . .\tCtrl+P", ID_PRINT
|
||||
MENUITEM "Pag&e setup . . .", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "나가기(&X)", ID_FILE_EXIT
|
||||
END
|
||||
|
|
|
@ -28,6 +28,7 @@ BEGIN
|
|||
MENUITEM "Ops&laan als...", ID_FILE_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print . . .\tCtrl+P", ID_PRINT
|
||||
MENUITEM "Pag&e setup . . .", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Afsluiten", ID_FILE_EXIT
|
||||
END
|
||||
|
|
|
@ -28,6 +28,7 @@ BEGIN
|
|||
MENUITEM "Lagre &som . . .", ID_FILE_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Skriv ut . . .\tCtrl+P", ID_PRINT
|
||||
MENUITEM "&Utskriftformat . . .", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Avslutt", ID_FILE_EXIT
|
||||
END
|
||||
|
|
|
@ -29,6 +29,7 @@ BEGIN
|
|||
MENUITEM "Z&apisz jako...", ID_FILE_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print . . .\tCtrl+P", ID_PRINT
|
||||
MENUITEM "Pag&e setup . . .", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Za&koñcz", ID_FILE_EXIT
|
||||
END
|
||||
|
|
|
@ -28,6 +28,7 @@ BEGIN
|
|||
MENUITEM "Ñîõðàíèòü &êàê...", ID_FILE_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print . . .\tCtrl+P", ID_PRINT
|
||||
MENUITEM "Pag&e setup . . .", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Â&ûõîä", ID_FILE_EXIT
|
||||
END
|
||||
|
|
|
@ -28,8 +28,10 @@ BEGIN
|
|||
MENUITEM "&Aç...\tCtrl+O", ID_FILE_OPEN
|
||||
MENUITEM "&Kaydet\tCtrl+S", ID_FILE_SAVE
|
||||
MENUITEM "&Farklý Kaydet...", ID_FILE_SAVEAS
|
||||
MENUITEM "Pag&e setup . . .", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print . . .\tCtrl+P", ID_PRINT
|
||||
MENUITEM "Pag&e setup . . .", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Çýk", ID_FILE_EXIT
|
||||
END
|
||||
|
|
|
@ -30,9 +30,10 @@
|
|||
|
||||
#define ID_PRINT 1010
|
||||
#define ID_PREVIEW 1011
|
||||
#define ID_PRINTSETUP 1012
|
||||
|
||||
#define ID_FIND 1012
|
||||
#define ID_FIND_NEXT 1013
|
||||
#define ID_FIND 1013
|
||||
#define ID_FIND_NEXT 1014
|
||||
|
||||
#define ID_ALIGN_LEFT 1100
|
||||
#define ID_ALIGN_CENTER 1101
|
||||
|
|
|
@ -915,6 +915,15 @@ static LONG devunits_to_twips(int units, int dpi)
|
|||
return (LONG)ret;
|
||||
}
|
||||
|
||||
static int centmm_to_twips(int mm)
|
||||
{
|
||||
return MulDiv(mm, 567, 1000);
|
||||
}
|
||||
|
||||
static RECT margins;
|
||||
|
||||
static HGLOBAL devMode;
|
||||
|
||||
static void print(LPPRINTDLGW pd)
|
||||
{
|
||||
FORMATRANGE fr;
|
||||
|
@ -929,10 +938,10 @@ static void print(LPPRINTDLGW pd)
|
|||
width = devunits_to_twips(GetDeviceCaps(fr.hdc, PHYSICALWIDTH), dpiX);
|
||||
height = devunits_to_twips(GetDeviceCaps(fr.hdc, PHYSICALHEIGHT), dpiY);
|
||||
|
||||
fr.rc.left = devunits_to_twips(GetDeviceCaps(fr.hdc, PHYSICALOFFSETX), dpiX);
|
||||
fr.rc.right = width - (fr.rc.left * 2);
|
||||
fr.rc.top = devunits_to_twips(GetDeviceCaps(fr.hdc, PHYSICALOFFSETY), dpiY);
|
||||
fr.rc.bottom = height - (fr.rc.top * 2);
|
||||
fr.rc.left = centmm_to_twips(margins.left);
|
||||
fr.rc.right = width - centmm_to_twips(margins.right);
|
||||
fr.rc.top = centmm_to_twips(margins.top);
|
||||
fr.rc.bottom = height - centmm_to_twips(margins.bottom);
|
||||
fr.rcPage.left = 0;
|
||||
fr.rcPage.right = width;
|
||||
fr.rcPage.top = 0;
|
||||
|
@ -978,6 +987,32 @@ static void print(LPPRINTDLGW pd)
|
|||
SendMessageW(hEditorWnd, EM_FORMATRANGE, FALSE, 0);
|
||||
}
|
||||
|
||||
static void registry_read_margins(void)
|
||||
{
|
||||
margins.top = 2500;
|
||||
margins.bottom = 2500;
|
||||
margins.left = 3100;
|
||||
margins.right = 3100;
|
||||
}
|
||||
|
||||
static void dialog_printsetup(void)
|
||||
{
|
||||
PAGESETUPDLGW ps;
|
||||
|
||||
ZeroMemory(&ps, sizeof(ps));
|
||||
ps.lStructSize = sizeof(ps);
|
||||
ps.hwndOwner = hMainWnd;
|
||||
ps.Flags = PSD_INHUNDREDTHSOFMILLIMETERS | PSD_MARGINS;
|
||||
ps.rtMargin = margins;
|
||||
ps.hDevMode = devMode;
|
||||
|
||||
if(PageSetupDlgW(&ps))
|
||||
{
|
||||
margins = ps.rtMargin;
|
||||
devMode = ps.hDevMode;
|
||||
}
|
||||
}
|
||||
|
||||
static void dialog_print(void)
|
||||
{
|
||||
PRINTDLGW pd;
|
||||
|
@ -990,14 +1025,18 @@ static void dialog_print(void)
|
|||
pd.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE;
|
||||
pd.nMinPage = 1;
|
||||
pd.nMaxPage = 1;
|
||||
pd.hDevMode = devMode;
|
||||
|
||||
SendMessageW(hEditorWnd, EM_GETSEL, (WPARAM)&from, (LPARAM)&to);
|
||||
if(from == to)
|
||||
pd.Flags |= PD_NOSELECTION;
|
||||
|
||||
if(PrintDlgW(&pd))
|
||||
{
|
||||
devMode = pd.hDevMode;
|
||||
print(&pd);
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleCommandLine(LPWSTR cmdline)
|
||||
{
|
||||
|
@ -1660,6 +1699,7 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
registry_read_filelist(hWnd);
|
||||
registry_read_options();
|
||||
registry_read_margins();
|
||||
DragAcceptFiles(hWnd, TRUE);
|
||||
|
||||
return 0;
|
||||
|
@ -1834,6 +1874,10 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
break;
|
||||
|
||||
case ID_PRINTSETUP:
|
||||
dialog_printsetup();
|
||||
break;
|
||||
|
||||
case ID_FORMAT_BOLD:
|
||||
case ID_FORMAT_ITALIC:
|
||||
case ID_FORMAT_UNDERLINE:
|
||||
|
|
Loading…
Reference in New Issue