wordpad: Add file saving dialog.

This commit is contained in:
Alexander Nicolaysen Sørnes 2007-05-31 15:38:51 +02:00 committed by Alexandre Julliard
parent 69c9565e6f
commit 68ce602381
12 changed files with 45 additions and 6 deletions

View File

@ -25,6 +25,7 @@ BEGIN
MENUITEM "&Neu\tCtrl+N", ID_FILE_NEW MENUITEM "&Neu\tCtrl+N", ID_FILE_NEW
MENUITEM "&Öffnen\tCtrl+O", ID_FILE_OPEN MENUITEM "&Öffnen\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Speichern\tCtrl+S", ID_FILE_SAVE MENUITEM "&Speichern\tCtrl+S", ID_FILE_SAVE
MENUITEM "Speichern &unter...", ID_FILE_SAVEAS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Beenden", ID_FILE_EXIT MENUITEM "&Beenden", ID_FILE_EXIT
END END

View File

@ -25,6 +25,7 @@ BEGIN
MENUITEM "&New\tCtrl+N", ID_FILE_NEW MENUITEM "&New\tCtrl+N", ID_FILE_NEW
MENUITEM "&Open\tCtrl+O", ID_FILE_OPEN MENUITEM "&Open\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
MENUITEM "Save &as . . .", ID_FILE_SAVEAS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "E&xit", ID_FILE_EXIT MENUITEM "E&xit", ID_FILE_EXIT
END END

View File

@ -24,7 +24,8 @@ BEGIN
BEGIN BEGIN
MENUITEM "&Nouveau\tCtrl+N", ID_FILE_NEW MENUITEM "&Nouveau\tCtrl+N", ID_FILE_NEW
MENUITEM "&Ouvrir\tCtrl+O", ID_FILE_OPEN MENUITEM "&Ouvrir\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Sauver\tCtrl+S", ID_FILE_SAVE MENUITEM "&Enregistrer\tCtrl+S", ID_FILE_SAVE
MENUITEM "Enregistrer &sous...", ID_FILE_SAVEAS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Quitter", ID_FILE_EXIT MENUITEM "&Quitter", ID_FILE_EXIT
END END

View File

@ -25,6 +25,7 @@ BEGIN
MENUITEM "&Új\tCtrl+N", ID_FILE_NEW MENUITEM "&Új\tCtrl+N", ID_FILE_NEW
MENUITEM "&Megnyitás\tCtrl+O", ID_FILE_OPEN MENUITEM "&Megnyitás\tCtrl+O", ID_FILE_OPEN
MENUITEM "M&entés\tCtrl+S", ID_FILE_SAVE MENUITEM "M&entés\tCtrl+S", ID_FILE_SAVE
MENUITEM "Mentés má&sként...", ID_FILE_SAVEAS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Kilépés", ID_FILE_EXIT MENUITEM "&Kilépés", ID_FILE_EXIT
END END

View File

@ -26,6 +26,7 @@ BEGIN
MENUITEM "새 파일(&N)\tCtrl+N", ID_FILE_NEW MENUITEM "새 파일(&N)\tCtrl+N", ID_FILE_NEW
MENUITEM "열기(&O)\tCtrl+O", ID_FILE_OPEN MENUITEM "열기(&O)\tCtrl+O", ID_FILE_OPEN
MENUITEM "저장(&S)\tCtrl+S", ID_FILE_SAVE MENUITEM "저장(&S)\tCtrl+S", ID_FILE_SAVE
MENUITEM "다른 이름으로 저장(&A)...", ID_FILE_SAVEAS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "나가기(&X)", ID_FILE_EXIT MENUITEM "나가기(&X)", ID_FILE_EXIT
END END

View File

@ -25,6 +25,7 @@ BEGIN
MENUITEM "&Nieuw\tCtrl+N" ID_FILE_NEW MENUITEM "&Nieuw\tCtrl+N" ID_FILE_NEW
MENUITEM "&Openen\tCtrl+O", ID_FILE_OPEN MENUITEM "&Openen\tCtrl+O", ID_FILE_OPEN
MENUITEM "O&pslaan\tCtrl+S", ID_FILE_SAVE MENUITEM "O&pslaan\tCtrl+S", ID_FILE_SAVE
MENUITEM "Ops&laan als...", ID_FILE_SAVEAS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Afsluiten", ID_FILE_EXIT MENUITEM "&Afsluiten", ID_FILE_EXIT
END END

View File

@ -25,6 +25,7 @@ BEGIN
MENUITEM "&Ny\tCtrl+N", ID_FILE_NEW MENUITEM "&Ny\tCtrl+N", ID_FILE_NEW
MENUITEM "&Åpne\tCtrl+O", ID_FILE_OPEN MENUITEM "&Åpne\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Lagre\tCtrl+S", ID_FILE_SAVE MENUITEM "&Lagre\tCtrl+S", ID_FILE_SAVE
MENUITEM "Lagre &som . . .", ID_FILE_SAVEAS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Avslutt", ID_FILE_EXIT MENUITEM "&Avslutt", ID_FILE_EXIT
END END

View File

@ -26,6 +26,7 @@ BEGIN
MENUITEM "&Nowy\tCtrl+N", ID_FILE_NEW MENUITEM "&Nowy\tCtrl+N", ID_FILE_NEW
MENUITEM "&Otwórz\tCtrl+O", ID_FILE_OPEN MENUITEM "&Otwórz\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Zapisz\tCtrl+S", ID_FILE_SAVE MENUITEM "&Zapisz\tCtrl+S", ID_FILE_SAVE
MENUITEM "Z&apisz jako...", ID_FILE_SAVEAS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Za&koñcz", ID_FILE_EXIT MENUITEM "Za&koñcz", ID_FILE_EXIT
END END

View File

@ -25,6 +25,7 @@ BEGIN
MENUITEM "Ñîçä&àòü\tCtrl+N", ID_FILE_NEW MENUITEM "Ñîçä&àòü\tCtrl+N", ID_FILE_NEW
MENUITEM "&Îòêðûòü\tCtrl+O", ID_FILE_OPEN MENUITEM "&Îòêðûòü\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Ñîõðàíèòü\tCtrl+S", ID_FILE_SAVE MENUITEM "&Ñîõðàíèòü\tCtrl+S", ID_FILE_SAVE
MENUITEM "Ñîõðàíèòü &êàê...", ID_FILE_SAVEAS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Â&ûõîä", ID_FILE_EXIT MENUITEM "Â&ûõîä", ID_FILE_EXIT
END END

View File

@ -27,6 +27,7 @@ BEGIN
MENUITEM "&Yeni\tCtrl+N", ID_FILE_NEW MENUITEM "&Yeni\tCtrl+N", ID_FILE_NEW
MENUITEM "&Aç\tCtrl+O", ID_FILE_OPEN MENUITEM "&Aç\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Kaydet\tCtrl+S", ID_FILE_SAVE MENUITEM "&Kaydet\tCtrl+S", ID_FILE_SAVE
MENUITEM "&Farklý Kaydet...", ID_FILE_SAVEAS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Çýk", ID_FILE_EXIT MENUITEM "&Çýk", ID_FILE_EXIT
END END

View File

@ -20,11 +20,12 @@
#define ID_FILE_OPEN 1001 #define ID_FILE_OPEN 1001
#define ID_FILE_SAVE 1002 #define ID_FILE_SAVE 1002
#define ID_FILE_NEW 1003 #define ID_FILE_NEW 1003
#define ID_FILE_SAVEAS 1004
#define ID_PRINT 1004 #define ID_PRINT 1005
#define ID_PREVIEW 1005 #define ID_PREVIEW 1006
#define ID_FIND 1006 #define ID_FIND 1007
#define ID_ALIGN_LEFT 1100 #define ID_ALIGN_LEFT 1100
#define ID_ALIGN_CENTER 1101 #define ID_ALIGN_CENTER 1101

View File

@ -223,6 +223,29 @@ static void DoSaveFile(LPCWSTR wszSaveFileName)
set_caption(wszFileName); set_caption(wszFileName);
} }
static void DialogSaveFile(void)
{
OPENFILENAMEW sfn;
WCHAR wszFile[MAX_PATH] = {'\0'};
static const WCHAR wszDefExt[] = {'r','t','f','\0'};
ZeroMemory(&sfn, sizeof(sfn));
sfn.lStructSize = sizeof(sfn);
sfn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
sfn.hwndOwner = hMainWnd;
sfn.lpstrFilter = wszFilter;
sfn.lpstrFile = wszFile;
sfn.nMaxFile = MAX_PATH;
sfn.lpstrDefExt = wszDefExt;
if(!GetSaveFileNameW(&sfn))
return;
DoSaveFile(sfn.lpstrFile);
}
static void HandleCommandLine(LPWSTR cmdline) static void HandleCommandLine(LPWSTR cmdline)
{ {
WCHAR delimiter; WCHAR delimiter;
@ -466,9 +489,14 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
case ID_FILE_SAVE: case ID_FILE_SAVE:
if(wszFileName[0]) if(wszFileName[0])
{
DoSaveFile(wszFileName); DoSaveFile(wszFileName);
else break;
MessageBox(hWnd, "Can only save existing for now", "WordPad", MB_OK); }
/* Fall through */
case ID_FILE_SAVEAS:
DialogSaveFile();
break; break;
case ID_PRINT: case ID_PRINT: