wordpad: Prompt for format when selecting new file.
This commit is contained in:
parent
425c2c6424
commit
bbc20456aa
|
@ -93,6 +93,17 @@ BEGIN
|
|||
PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12
|
||||
END
|
||||
|
||||
IDD_NEWFILE DIALOG DISCARDABLE 30, 20, 140, 80
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "New"
|
||||
FONT 10, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "New document type",0,3,2,100,15
|
||||
LISTBOX IDC_NEWFILE,3,12,90,65,LBS_NOINTEGRALHEIGHT
|
||||
PUSHBUTTON "&OK",IDOK,97,12,40,12
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,97,26,40,12
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_RICHTEXT_FILES_RTF, "Rich-Text-Format (*.rtf)"
|
||||
|
@ -101,6 +112,13 @@ BEGIN
|
|||
STRING_ALL_FILES, "Alle Dokumente (*.*)"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_NEWFILE_RICHTEXT, "Rich text document"
|
||||
STRING_NEWFILE_TXT, "Text document"
|
||||
STRING_NEWFILE_TXT_UNICODE, "Unicode text document"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_DEFAULT_FILENAME, "Document"
|
||||
|
|
|
@ -93,6 +93,17 @@ BEGIN
|
|||
PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12
|
||||
END
|
||||
|
||||
IDD_NEWFILE DIALOG DISCARDABLE 30, 20, 140, 80
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "New"
|
||||
FONT 10, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "New document type",0,3,2,100,15
|
||||
LISTBOX IDC_NEWFILE,3,12,90,65,LBS_NOINTEGRALHEIGHT
|
||||
PUSHBUTTON "&OK",IDOK,97,12,40,12
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,97,26,40,12
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)"
|
||||
|
@ -101,6 +112,13 @@ BEGIN
|
|||
STRING_ALL_FILES, "All documents (*.*)"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_NEWFILE_RICHTEXT, "Rich text document"
|
||||
STRING_NEWFILE_TXT, "Text document"
|
||||
STRING_NEWFILE_TXT_UNICODE, "Unicode text document"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_DEFAULT_FILENAME, "Document"
|
||||
|
|
|
@ -93,6 +93,17 @@ BEGIN
|
|||
PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12
|
||||
END
|
||||
|
||||
IDD_NEWFILE DIALOG DISCARDABLE 30, 20, 140, 80
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "New"
|
||||
FONT 10, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "New document type",0,3,2,100,15
|
||||
LISTBOX IDC_NEWFILE,3,12,90,65,LBS_NOINTEGRALHEIGHT
|
||||
PUSHBUTTON "&OK",IDOK,97,12,40,12
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,97,26,40,12
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)"
|
||||
|
@ -101,6 +112,13 @@ BEGIN
|
|||
STRING_ALL_FILES, "All documents (*.*)"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_NEWFILE_RICHTEXT, "Rich text document"
|
||||
STRING_NEWFILE_TXT, "Text document"
|
||||
STRING_NEWFILE_TXT_UNICODE, "Unicode text document"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_DEFAULT_FILENAME, "Document"
|
||||
|
|
|
@ -93,6 +93,17 @@ BEGIN
|
|||
PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12
|
||||
END
|
||||
|
||||
IDD_NEWFILE DIALOG DISCARDABLE 30, 20, 140, 80
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "New"
|
||||
FONT 10, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "New document type",0,3,2,100,15
|
||||
LISTBOX IDC_NEWFILE,3,12,90,65,LBS_NOINTEGRALHEIGHT
|
||||
PUSHBUTTON "&OK",IDOK,97,12,40,12
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,97,26,40,12
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)"
|
||||
|
@ -101,6 +112,13 @@ BEGIN
|
|||
STRING_ALL_FILES, "All documents (*.*)"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_NEWFILE_RICHTEXT, "Rich text document"
|
||||
STRING_NEWFILE_TXT, "Text document"
|
||||
STRING_NEWFILE_TXT_UNICODE, "Unicode text document"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_DEFAULT_FILENAME, "Document"
|
||||
|
|
|
@ -94,6 +94,17 @@ BEGIN
|
|||
PUSHBUTTON "취소(&C)",IDCANCEL,87,26,40,12
|
||||
END
|
||||
|
||||
IDD_NEWFILE DIALOG DISCARDABLE 30, 20, 140, 80
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "New"
|
||||
FONT 10, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "New document type",0,3,2,100,15
|
||||
LISTBOX IDC_NEWFILE,3,12,90,65,LBS_NOINTEGRALHEIGHT
|
||||
PUSHBUTTON "&OK",IDOK,97,12,40,12
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,97,26,40,12
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_RICHTEXT_FILES_RTF, "리치 텍스트 파일형식 (*.rtf)"
|
||||
|
|
|
@ -93,6 +93,17 @@ BEGIN
|
|||
PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12
|
||||
END
|
||||
|
||||
IDD_NEWFILE DIALOG DISCARDABLE 30, 20, 140, 80
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "New"
|
||||
FONT 10, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "New document type",0,3,2,100,15
|
||||
LISTBOX IDC_NEWFILE,3,12,90,65,LBS_NOINTEGRALHEIGHT
|
||||
PUSHBUTTON "&OK",IDOK,97,12,40,12
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,97,26,40,12
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)"
|
||||
|
@ -101,6 +112,13 @@ BEGIN
|
|||
STRING_ALL_FILES, "All documents (*.*)"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_NEWFILE_RICHTEXT, "Rich text document"
|
||||
STRING_NEWFILE_TXT, "Text document"
|
||||
STRING_NEWFILE_TXT_UNICODE, "Unicode text document"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_DEFAULT_FILENAME, "Document"
|
||||
|
|
|
@ -93,6 +93,17 @@ BEGIN
|
|||
PUSHBUTTON "&Avbryt",IDCANCEL,87,26,40,12
|
||||
END
|
||||
|
||||
IDD_NEWFILE DIALOG DISCARDABLE 30, 20, 140, 80
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Ny"
|
||||
FONT 10, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Ny dokumenttype",0,3,2,100,15
|
||||
LISTBOX IDC_NEWFILE,3,12,90,65,LBS_NOINTEGRALHEIGHT
|
||||
PUSHBUTTON "&OK",IDOK,97,12,40,12
|
||||
PUSHBUTTON "&Avbryt",IDCANCEL,97,26,40,12
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_RICHTEXT_FILES_RTF, "Rikt tekstformat (*.rtf)"
|
||||
|
@ -101,6 +112,13 @@ BEGIN
|
|||
STRING_ALL_FILES, "Alle filer (*.*)"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_NEWFILE_RICHTEXT, "Rikt tekstdokument"
|
||||
STRING_NEWFILE_TXT, "Tekstdokument"
|
||||
STRING_NEWFILE_TXT_UNICODE, "Tekstdokument (Unicode)"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_DEFAULT_FILENAME, "Dokument"
|
||||
|
|
|
@ -94,6 +94,17 @@ BEGIN
|
|||
PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12
|
||||
END
|
||||
|
||||
IDD_NEWFILE DIALOG DISCARDABLE 30, 20, 140, 80
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "New"
|
||||
FONT 10, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "New document type",0,3,2,100,15
|
||||
LISTBOX IDC_NEWFILE,3,12,90,65,LBS_NOINTEGRALHEIGHT
|
||||
PUSHBUTTON "&OK",IDOK,97,12,40,12
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,97,26,40,12
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_RICHTEXT_FILES_RTF, "Tekst sformatowany - RTF (*.rtf)"
|
||||
|
@ -102,6 +113,13 @@ BEGIN
|
|||
STRING_ALL_FILES, "Wszystkie dokumenty (*.*)"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_NEWFILE_RICHTEXT, "Rich text document"
|
||||
STRING_NEWFILE_TXT, "Text document"
|
||||
STRING_NEWFILE_TXT_UNICODE, "Unicode text document"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_DEFAULT_FILENAME, "Document"
|
||||
|
|
|
@ -91,6 +91,17 @@ BEGIN
|
|||
PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12
|
||||
END
|
||||
|
||||
IDD_NEWFILE DIALOG DISCARDABLE 30, 20, 140, 80
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "New"
|
||||
FONT 10, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "New document type",0,3,2,100,15
|
||||
LISTBOX IDC_NEWFILE,3,12,90,65,LBS_NOINTEGRALHEIGHT
|
||||
PUSHBUTTON "&OK",IDOK,97,12,40,12
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,97,26,40,12
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)"
|
||||
|
@ -99,6 +110,13 @@ BEGIN
|
|||
STRING_ALL_FILES, "All documents (*.*)"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_NEWFILE_RICHTEXT, "Rich text document"
|
||||
STRING_NEWFILE_TXT, "Text document"
|
||||
STRING_NEWFILE_TXT_UNICODE, "Unicode text document"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_DEFAULT_FILENAME, "Document"
|
||||
|
|
|
@ -95,6 +95,17 @@ BEGIN
|
|||
PUSHBUTTON "&Cancel",IDCANCEL,87,26,40,12
|
||||
END
|
||||
|
||||
IDD_NEWFILE DIALOG DISCARDABLE 30, 20, 140, 80
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "New"
|
||||
FONT 10, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "New document type",0,3,2,100,15
|
||||
LISTBOX IDC_NEWFILE,3,12,90,65,LBS_NOINTEGRALHEIGHT
|
||||
PUSHBUTTON "&OK",IDOK,97,12,40,12
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,97,26,40,12
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)"
|
||||
|
@ -103,6 +114,13 @@ BEGIN
|
|||
STRING_ALL_FILES, "All documents (*.*)"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_NEWFILE_RICHTEXT, "Rich text document"
|
||||
STRING_NEWFILE_TXT, "Text document"
|
||||
STRING_NEWFILE_TXT_UNICODE, "Unicode text document"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
STRING_DEFAULT_FILENAME, "Document"
|
||||
|
|
|
@ -71,6 +71,8 @@
|
|||
#define FILELIST_ENTRIES 4
|
||||
#define FILELIST_ENTRY_LENGTH 33
|
||||
|
||||
#define ID_NEWFILE_ABORT 100
|
||||
|
||||
#define ID_DATETIME 1600
|
||||
|
||||
#define IDC_STATUSBAR 2000
|
||||
|
@ -80,8 +82,10 @@
|
|||
#define IDC_REBAR 2004
|
||||
#define IDC_COMBO 2005
|
||||
#define IDC_DATETIME 2006
|
||||
#define IDC_NEWFILE 2007
|
||||
|
||||
#define IDD_DATETIME 2100
|
||||
#define IDD_NEWFILE 2101
|
||||
|
||||
#define IDB_TOOLBAR 100
|
||||
#define IDB_FORMATBAR 101
|
||||
|
@ -93,6 +97,10 @@
|
|||
#define STRING_TEXT_FILES_UNICODE_TXT 1402
|
||||
#define STRING_RICHTEXT_FILES_RTF 1403
|
||||
|
||||
#define STRING_NEWFILE_RICHTEXT 1404
|
||||
#define STRING_NEWFILE_TXT 1405
|
||||
#define STRING_NEWFILE_TXT_UNICODE 1406
|
||||
|
||||
#define STRING_DEFAULT_FILENAME 1700
|
||||
#define STRING_PROMPT_SAVE_CHANGES 1701
|
||||
#define STRING_SEARCH_FINISHED 1702
|
||||
|
|
|
@ -429,6 +429,16 @@ static void registry_set_filelist(LPCWSTR newFile)
|
|||
registry_read_filelist(hMainWnd);
|
||||
}
|
||||
|
||||
static void clear_formatting(void)
|
||||
{
|
||||
PARAFORMAT2 pf;
|
||||
|
||||
pf.cbSize = sizeof(pf);
|
||||
pf.dwMask = PFM_ALIGNMENT;
|
||||
pf.wAlignment = PFA_LEFT;
|
||||
SendMessageW(hEditorWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
|
||||
}
|
||||
|
||||
static int fileformat_number(WPARAM format)
|
||||
{
|
||||
int number = 0;
|
||||
|
@ -928,6 +938,49 @@ BOOL CALLBACK datetime_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CALLBACK newfile_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch(message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hMainWnd, GWLP_HINSTANCE);
|
||||
WCHAR buffer[MAX_STRING_LEN];
|
||||
HWND hListWnd = GetDlgItem(hWnd, IDC_NEWFILE);
|
||||
|
||||
LoadStringW(hInstance, STRING_NEWFILE_RICHTEXT, (LPWSTR)buffer, MAX_STRING_LEN);
|
||||
SendMessageW(hListWnd, LB_ADDSTRING, 0, (LPARAM)&buffer);
|
||||
LoadStringW(hInstance, STRING_NEWFILE_TXT, (LPWSTR)buffer, MAX_STRING_LEN);
|
||||
SendMessageW(hListWnd, LB_ADDSTRING, 0, (LPARAM)&buffer);
|
||||
LoadStringW(hInstance, STRING_NEWFILE_TXT_UNICODE, (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_NEWFILE);
|
||||
index = SendMessageW(hListWnd, LB_GETCURSEL, 0, 0);
|
||||
|
||||
if(index != LB_ERR)
|
||||
EndDialog(hWnd, MAKELONG(fileformat_flags(index),0));
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hWnd, MAKELONG(ID_NEWFILE_ABORT,0));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND hToolBarWnd, hFormatBarWnd, hReBarWnd;
|
||||
|
@ -1137,13 +1190,30 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
|
||||
case ID_FILE_NEW:
|
||||
{
|
||||
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
|
||||
int ret = DialogBox(hInstance, MAKEINTRESOURCE(IDD_NEWFILE), hWnd,
|
||||
(DLGPROC)newfile_proc);
|
||||
|
||||
if(ret != ID_NEWFILE_ABORT)
|
||||
{
|
||||
if(prompt_save_changes())
|
||||
{
|
||||
SETTEXTEX st;
|
||||
|
||||
set_caption(NULL);
|
||||
wszFileName[0] = '\0';
|
||||
SetWindowTextW(hwndEditor, wszFileName);
|
||||
|
||||
st.flags = ST_DEFAULT;
|
||||
st.codepage = 1200;
|
||||
SendMessageW(hEditorWnd, EM_SETTEXTEX, (WPARAM)&st, 0);
|
||||
|
||||
clear_formatting();
|
||||
|
||||
SendMessageW(hEditorWnd, EM_SETMODIFY, FALSE, 0);
|
||||
fileFormat = SF_RTF;
|
||||
set_fileformat(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue