From 4c6c9e596fbcba25225c1696e6d1d044293c5ceb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Wed, 18 Jul 2007 15:50:21 +0200 Subject: [PATCH] wordpad: Add date/time dialog. --- programs/wordpad/De.rc | 15 ++++++++++++ programs/wordpad/En.rc | 15 ++++++++++++ programs/wordpad/Fr.rc | 22 +++++++++++++++++ programs/wordpad/Hu.rc | 22 +++++++++++++++++ programs/wordpad/Ko.rc | 15 ++++++++++++ programs/wordpad/Nl.rc | 22 +++++++++++++++++ programs/wordpad/No.rc | 15 ++++++++++++ programs/wordpad/Pl.rc | 15 ++++++++++++ programs/wordpad/Ru.rc | 22 +++++++++++++++++ programs/wordpad/Tr.rc | 22 +++++++++++++++++ programs/wordpad/resource.h | 5 ++++ programs/wordpad/wordpad.c | 58 +++++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 248 insertions(+) diff --git a/programs/wordpad/De.rc b/programs/wordpad/De.rc index 01e8d318856..ddf57a04228 100644 --- a/programs/wordpad/De.rc +++ b/programs/wordpad/De.rc @@ -58,6 +58,10 @@ BEGIN MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END + POPUP "&Insert" + BEGIN + MENUITEM "&Date and time . . .", ID_DATETIME + END POPUP "F&ormat" BEGIN POPUP "&Hintergrund" @@ -74,6 +78,17 @@ BEGIN END END +IDD_DATETIME DIALOG DISCARDABLE 30, 20, 130, 80 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "Date and time" +FONT 10, "MS Sans Serif" +BEGIN + LTEXT "Available formats",0,3,2,100,15 + LISTBOX IDC_DATETIME,3,12,80,65,LBS_NOINTEGRALHEIGHT + PUSHBUTTON "&OK",IDOK,87,12,40,12 + PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12 +END + STRINGTABLE DISCARDABLE BEGIN STRING_RICHTEXT_FILES_RTF, "Rich-Text-Format (*.rtf)" diff --git a/programs/wordpad/En.rc b/programs/wordpad/En.rc index 4f8a3cfbd93..c7e12e8430c 100644 --- a/programs/wordpad/En.rc +++ b/programs/wordpad/En.rc @@ -58,6 +58,10 @@ BEGIN MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END + POPUP "&Insert" + BEGIN + MENUITEM "&Date and time . . .", ID_DATETIME + END POPUP "F&ormat" BEGIN POPUP "&Background" @@ -74,6 +78,17 @@ BEGIN END END +IDD_DATETIME DIALOG DISCARDABLE 30, 20, 130, 80 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "Date and time" +FONT 10, "MS Sans Serif" +BEGIN + LTEXT "Available formats",0,3,2,100,15 + LISTBOX IDC_DATETIME,3,12,80,65,LBS_NOINTEGRALHEIGHT + PUSHBUTTON "&OK",IDOK,87,12,40,12 + PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12 +END + STRINGTABLE DISCARDABLE BEGIN STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)" diff --git a/programs/wordpad/Fr.rc b/programs/wordpad/Fr.rc index 4ed62809594..00a110b7557 100644 --- a/programs/wordpad/Fr.rc +++ b/programs/wordpad/Fr.rc @@ -58,6 +58,10 @@ BEGIN MENUITEM "&Barre de format", ID_TOGGLE_FORMATBAR MENUITEM "&Barre d'état", ID_TOGGLE_STATUSBAR END + POPUP "&Insert" + BEGIN + MENUITEM "&Date and time . . .", ID_DATETIME + END POPUP "Forma&t" BEGIN POPUP "&Fond" @@ -74,6 +78,24 @@ BEGIN END END +IDD_DATETIME DIALOG DISCARDABLE 30, 20, 130, 80 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "Date and time" +FONT 10, "MS Sans Serif" +BEGIN + LTEXT "Available formats",0,3,2,100,15 + LISTBOX IDC_DATETIME,3,12,80,65,LBS_NOINTEGRALHEIGHT + PUSHBUTTON "&OK",IDOK,87,12,40,12 + PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12 +END + +STRINGTABLE DISCARDABLE +BEGIN + STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)" + STRING_TEXT_FILES_TXT, "Text files (*.txt)" + STRING_ALL_FILES, "All documents (*.*)" +END + STRINGTABLE DISCARDABLE BEGIN STRING_DEFAULT_FILENAME, "Document" diff --git a/programs/wordpad/Hu.rc b/programs/wordpad/Hu.rc index 6f85ce0c39d..95cbf11cdb5 100644 --- a/programs/wordpad/Hu.rc +++ b/programs/wordpad/Hu.rc @@ -58,6 +58,10 @@ BEGIN MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END + POPUP "&Insert" + BEGIN + MENUITEM "&Date and time . . .", ID_DATETIME + END POPUP "F&ormátum" BEGIN POPUP "&Háttér" @@ -74,6 +78,24 @@ BEGIN END END +IDD_DATETIME DIALOG DISCARDABLE 30, 20, 130, 80 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "Date and time" +FONT 10, "MS Sans Serif" +BEGIN + LTEXT "Available formats",0,3,2,100,15 + LISTBOX IDC_DATETIME,3,12,80,65,LBS_NOINTEGRALHEIGHT + PUSHBUTTON "&OK",IDOK,87,12,40,12 + PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12 +END + +STRINGTABLE DISCARDABLE +BEGIN + STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)" + STRING_TEXT_FILES_TXT, "Text files (*.txt)" + STRING_ALL_FILES, "All documents (*.*)" +END + STRINGTABLE DISCARDABLE BEGIN STRING_DEFAULT_FILENAME, "Document" diff --git a/programs/wordpad/Ko.rc b/programs/wordpad/Ko.rc index 5aab506bbdd..e735b8dca3a 100644 --- a/programs/wordpad/Ko.rc +++ b/programs/wordpad/Ko.rc @@ -59,6 +59,10 @@ BEGIN MENUITEM "Çü½Ä¹Ù(&F)", ID_TOGGLE_FORMATBAR MENUITEM "»óŹÙ(&S)", ID_TOGGLE_STATUSBAR END + POPUP "&Insert" + BEGIN + MENUITEM "&Date and time . . .", ID_DATETIME + END POPUP "Çü½Ä(&O)" BEGIN POPUP "¹è°æ(&B)" @@ -75,6 +79,17 @@ BEGIN END END +IDD_DATETIME DIALOG DISCARDABLE 30, 20, 130, 80 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "Date and time" +FONT 10, "MS Sans Serif" +BEGIN + LTEXT "Available formats",0,3,2,100,15 + LISTBOX IDC_DATETIME,3,12,80,65,LBS_NOINTEGRALHEIGHT + PUSHBUTTON "&OK",IDOK,87,12,40,12 + PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12 +END + STRINGTABLE DISCARDABLE BEGIN STRING_RICHTEXT_FILES_RTF, "¸®Ä¡ ÅؽºÆ® ÆÄÀÏÇü½Ä (*.rtf)" diff --git a/programs/wordpad/Nl.rc b/programs/wordpad/Nl.rc index 6ef71ba4a4b..389e1df0f42 100644 --- a/programs/wordpad/Nl.rc +++ b/programs/wordpad/Nl.rc @@ -58,6 +58,10 @@ BEGIN MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END + POPUP "&Insert" + BEGIN + MENUITEM "&Date and time . . .", ID_DATETIME + END POPUP "&Opmaak" BEGIN POPUP "&Achtergrond" @@ -74,6 +78,24 @@ BEGIN END END +IDD_DATETIME DIALOG DISCARDABLE 30, 20, 130, 80 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "Date and time" +FONT 10, "MS Sans Serif" +BEGIN + LTEXT "Available formats",0,3,2,100,15 + LISTBOX IDC_DATETIME,3,12,80,65,LBS_NOINTEGRALHEIGHT + PUSHBUTTON "&OK",IDOK,87,12,40,12 + PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12 +END + +STRINGTABLE DISCARDABLE +BEGIN + STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)" + STRING_TEXT_FILES_TXT, "Text files (*.txt)" + STRING_ALL_FILES, "All documents (*.*)" +END + STRINGTABLE DISCARDABLE BEGIN STRING_DEFAULT_FILENAME, "Document" diff --git a/programs/wordpad/No.rc b/programs/wordpad/No.rc index 9f145a12382..ca60146d59c 100644 --- a/programs/wordpad/No.rc +++ b/programs/wordpad/No.rc @@ -58,6 +58,10 @@ BEGIN MENUITEM "&Formatlinje", ID_TOGGLE_FORMATBAR MENUITEM "&Statuslinje", ID_TOGGLE_STATUSBAR END + POPUP "Sett &inn" + BEGIN + MENUITEM "&Dato og klokkeslett . . .", ID_DATETIME + END POPUP "F&ormat" BEGIN POPUP "&Bakgrunn" @@ -74,6 +78,17 @@ BEGIN END END +IDD_DATETIME DIALOG DISCARDABLE 30, 20, 130, 80 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "Dato og klokkeslett" +FONT 10, "MS Sans Serif" +BEGIN + LTEXT "Tilgjengelige formater",0,3,2,100,15 + LISTBOX IDC_DATETIME,3,12,80,65,LBS_NOINTEGRALHEIGHT + PUSHBUTTON "&OK",IDOK,87,12,40,12 + PUSHBUTTON "&Avbryt",IDCANCEL,87,26,40,12 +END + STRINGTABLE DISCARDABLE BEGIN STRING_RICHTEXT_FILES_RTF, "Rikt tekstformat (*.rtf)" diff --git a/programs/wordpad/Pl.rc b/programs/wordpad/Pl.rc index 41d22b2fa2b..d18855b5593 100644 --- a/programs/wordpad/Pl.rc +++ b/programs/wordpad/Pl.rc @@ -59,6 +59,10 @@ BEGIN MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END + POPUP "&Insert" + BEGIN + MENUITEM "&Date and time . . .", ID_DATETIME + END POPUP "F&ormat" BEGIN POPUP "&T³o" @@ -75,6 +79,17 @@ BEGIN END END +IDD_DATETIME DIALOG DISCARDABLE 30, 20, 130, 80 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "Date and time" +FONT 10, "MS Sans Serif" +BEGIN + LTEXT "Available formats",0,3,2,100,15 + LISTBOX IDC_DATETIME,3,12,80,65,LBS_NOINTEGRALHEIGHT + PUSHBUTTON "&OK",IDOK,87,12,40,12 + PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12 +END + STRINGTABLE DISCARDABLE BEGIN STRING_RICHTEXT_FILES_RTF, "Tekst sformatowany - RTF (*.rtf)" diff --git a/programs/wordpad/Ru.rc b/programs/wordpad/Ru.rc index 6133ec0f111..05927351a5e 100644 --- a/programs/wordpad/Ru.rc +++ b/programs/wordpad/Ru.rc @@ -56,6 +56,10 @@ BEGIN MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END + POPUP "&Insert" + BEGIN + MENUITEM "&Date and time . . .", ID_DATETIME + END POPUP "Ôîð&ìàò" BEGIN POPUP "&Ôîí" @@ -72,6 +76,24 @@ BEGIN END END +IDD_DATETIME DIALOG DISCARDABLE 30, 20, 130, 80 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "Date and time" +FONT 10, "MS Sans Serif" +BEGIN + LTEXT "Available formats",0,3,2,100,15 + LISTBOX IDC_DATETIME,3,12,80,65,LBS_NOINTEGRALHEIGHT + PUSHBUTTON "&OK",IDOK,87,12,40,12 + PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12 +END + +STRINGTABLE DISCARDABLE +BEGIN + STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)" + STRING_TEXT_FILES_TXT, "Text files (*.txt)" + STRING_ALL_FILES, "All documents (*.*)" +END + STRINGTABLE DISCARDABLE BEGIN STRING_DEFAULT_FILENAME, "Document" diff --git a/programs/wordpad/Tr.rc b/programs/wordpad/Tr.rc index 0045ecd8458..0681a8f0b43 100644 --- a/programs/wordpad/Tr.rc +++ b/programs/wordpad/Tr.rc @@ -60,6 +60,10 @@ BEGIN MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END + POPUP "&Insert" + BEGIN + MENUITEM "&Date and time . . .", ID_DATETIME + END POPUP "&Biçim" BEGIN POPUP "&Arkaplan" @@ -76,6 +80,24 @@ BEGIN END END +IDD_DATETIME DIALOG DISCARDABLE 30, 20, 130, 80 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "Date and time" +FONT 10, "MS Sans Serif" +BEGIN + LTEXT "Available formats",0,3,2,100,15 + LISTBOX IDC_DATETIME,3,12,80,65,LBS_NOINTEGRALHEIGHT + PUSHBUTTON "&OK",IDOK,87,12,40,12 + PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12 +END + +STRINGTABLE DISCARDABLE +BEGIN + STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)" + STRING_TEXT_FILES_TXT, "Text files (*.txt)" + STRING_ALL_FILES, "All documents (*.*)" +END + STRINGTABLE DISCARDABLE BEGIN STRING_DEFAULT_FILENAME, "Document" diff --git a/programs/wordpad/resource.h b/programs/wordpad/resource.h index f3f41091498..c058e17c219 100644 --- a/programs/wordpad/resource.h +++ b/programs/wordpad/resource.h @@ -60,12 +60,17 @@ #define BANDID_TOOLBAR 0 #define BANDID_FORMATBAR 1 +#define ID_DATETIME 1600 + #define IDC_STATUSBAR 2000 #define IDC_EDITOR 2001 #define IDC_TOOLBAR 2002 #define IDC_FORMATBAR 2003 #define IDC_REBAR 2004 #define IDC_COMBO 2005 +#define IDC_DATETIME 2006 + +#define IDD_DATETIME 2100 #define IDB_FORMATBAR 100 diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c index 0b11da2ad2a..6cae4a50a13 100644 --- a/programs/wordpad/wordpad.c +++ b/programs/wordpad/wordpad.c @@ -434,6 +434,57 @@ static void toggle_toolbar(int bandId) } } +BOOL CALLBACK datetime_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch(message) + { + case WM_INITDIALOG: + { + WCHAR buffer[MAX_STRING_LEN]; + SYSTEMTIME st; + HWND hListWnd = GetDlgItem(hWnd, IDC_DATETIME); + GetLocalTime(&st); + + GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, 0, (LPWSTR)&buffer, + MAX_STRING_LEN); + SendMessageW(hListWnd, LB_ADDSTRING, 0, (LPARAM)&buffer); + GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &st, 0, (LPWSTR)&buffer, + MAX_STRING_LEN); + SendMessageW(hListWnd, LB_ADDSTRING, 0, (LPARAM)&buffer); + GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, 0, (LPWSTR)&buffer, MAX_STRING_LEN); + SendMessageW(hListWnd, LB_ADDSTRING, 0, (LPARAM)&buffer); + + SendMessageW(hListWnd, LB_SETSEL, TRUE, 0); + } + break; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case IDOK: + { + LRESULT index; + HWND hListWnd = GetDlgItem(hWnd, IDC_DATETIME); + + index = SendMessageW(hListWnd, LB_GETCURSEL, 0, 0); + + if(index != LB_ERR) + { + WCHAR buffer[MAX_STRING_LEN]; + SendMessageW(hListWnd, LB_GETTEXT, index, (LPARAM)&buffer); + SendMessageW(hEditorWnd, EM_REPLACESEL, TRUE, (LPARAM)&buffer); + } + } + /* Fall through */ + + case IDCANCEL: + EndDialog(hWnd, wParam); + return TRUE; + } + } + return FALSE; +} + static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam) { HWND hToolBarWnd, hFormatBarWnd, hReBarWnd; @@ -831,6 +882,13 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam) update_window(); break; + case ID_DATETIME: + { + HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); + DialogBoxW(hInstance, MAKEINTRESOURCEW(IDD_DATETIME), hWnd, (DLGPROC)datetime_proc); + break; + } + default: SendMessageW(hwndEditor, WM_COMMAND, wParam, lParam); break; -- 2.11.4.GIT