Commit 37748118 authored by Jacob Czekalla's avatar Jacob Czekalla Committed by Alexandre Julliard

notepad: Show goto dialog box.

parent 54590472
......@@ -1278,3 +1278,49 @@ static INT_PTR WINAPI DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wPara
return FALSE;
}
static INT_PTR WINAPI DIALOG_GOTO_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_COMMAND:
{
switch (wParam)
{
case IDOK:
{
int lineValue = GetDlgItemInt(hDlg, IDC_GOTO_LINEVALUE, NULL, FALSE) - 1;
long lineIndex = SendMessageW(Globals.hEdit, EM_LINEINDEX, lineValue, 0);
SendMessageW(Globals.hEdit, EM_SETSEL, lineIndex, lineIndex);
UpdateStatusBar();
EndDialog(hDlg, IDOK);
return TRUE;
}
case IDCANCEL:
{
EndDialog(hDlg, IDCANCEL);
return TRUE;
}
default:
{
break;
}
}
break;
}
case WM_INITDIALOG:
{
int currentLine = SendMessageW(Globals.hEdit, EM_LINEFROMCHAR, -1, 0) + 1;
SetDlgItemInt(hDlg, IDC_GOTO_LINEVALUE, currentLine, FALSE);
break;
}
}
return FALSE;
}
void DIALOG_EditGoTo(void)
{
DialogBoxW(Globals.hInstance, MAKEINTRESOURCEW(DIALOG_GOTO),
Globals.hMainWnd, DIALOG_GOTO_DlgProc);
}
......@@ -39,6 +39,7 @@ VOID DIALOG_EditWrap(VOID);
VOID DIALOG_Search(VOID);
VOID DIALOG_SearchNext(VOID);
VOID DIALOG_Replace(VOID);
void DIALOG_EditGoTo(void);
VOID DIALOG_SelectFont(VOID);
......
......@@ -108,7 +108,7 @@ DWORD get_dpi(void)
return dpi;
}
static void UpdateStatusBar(void)
void UpdateStatusBar(void)
{
int currentLine;
int currentCol = -1;
......@@ -359,6 +359,7 @@ static int NOTEPAD_MenuCommand(WPARAM wParam)
case CMD_SEARCH: DIALOG_Search(); break;
case CMD_SEARCH_NEXT: DIALOG_SearchNext(); break;
case CMD_REPLACE: DIALOG_Replace(); break;
case CMD_GO_TO: DIALOG_EditGoTo(); break;
case CMD_WRAP: DIALOG_EditWrap(); break;
case CMD_FONT: DIALOG_SelectFont(); break;
......
......@@ -77,5 +77,6 @@ extern NOTEPAD_GLOBALS Globals;
VOID SetFileNameAndEncoding(LPCWSTR szFileName, ENCODING enc);
void NOTEPAD_DoFind(FINDREPLACEW *fr);
DWORD get_dpi(void);
void UpdateStatusBar(void);
void updateWindowSize(int width, int height);
LRESULT CALLBACK EDIT_CallBackProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData);
......@@ -55,6 +55,7 @@ POPUP "&Search" {
MENUITEM "&Search...\tCtrl+F", CMD_SEARCH
MENUITEM "&Search next\tF3", CMD_SEARCH_NEXT
MENUITEM "&Replace...\tCtrl+H", CMD_REPLACE
MENUITEM "&Go To...\tCtrl+G", CMD_GO_TO
}
POPUP "&View"
{
......@@ -124,6 +125,18 @@ PUSHBUTTON "Cancel", IDCANCEL, 195, 21, 40, 15, WS_TABSTOP
PUSHBUTTON "&Help", IDHELP, 195, 39, 40, 15, WS_TABSTOP
}
DIALOG_GOTO DIALOG 0, 0, 130, 55
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Go To Line"
{
LTEXT "&Line Number:", 0x140, 10, 07, 68, 12
EDITTEXT IDC_GOTO_LINEVALUE, 10, 19, 110,12, WS_BORDER | WS_TABSTOP | ES_NUMBER
DEFPUSHBUTTON "Go To", IDOK, 35, 35, 40, 15, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 80, 35, 40, 15, WS_TABSTOP
}
IDD_OFN_TEMPLATE DIALOG 50,50,300,15
STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER
FONT 8, "MS Shell Dlg"
......@@ -145,6 +158,7 @@ ID_ACCEL ACCELERATORS
"#msgctxt#accelerator Paste#V", CMD_PASTE, VIRTKEY, CONTROL
"#msgctxt#accelerator Cut#X", CMD_CUT, VIRTKEY, CONTROL
"#msgctxt#accelerator Undo#Z", CMD_UNDO, VIRTKEY, CONTROL
"#msgctxt#accelerator GoTo#G", CMD_GO_TO, VIRTKEY, CONTROL
VK_BACK, CMD_UNDO, VIRTKEY, ALT
VK_F1, CMD_HELP_CONTENTS, VIRTKEY
VK_F3, CMD_SEARCH_NEXT, VIRTKEY
......
......@@ -25,6 +25,7 @@
#define MAIN_MENU 0x201
#define DIALOG_PAGESETUP 0x202
#define ID_ACCEL 0x203
#define DIALOG_GOTO 0x204
#define IDI_NOTEPAD 0x300
......@@ -49,6 +50,7 @@
#define CMD_SEARCH 0x120
#define CMD_SEARCH_NEXT 0x121
#define CMD_REPLACE 0x122
#define CMD_GO_TO 0x192
#define CMD_WRAP 0x119
#define CMD_FONT 0x140
......@@ -64,6 +66,7 @@
#define IDC_PAGESETUP_RIGHTVALUE 0x14A
#define IDC_PAGESETUP_TOPVALUE 0x14D
#define IDC_PAGESETUP_BOTTOMVALUE 0x150
#define IDC_GOTO_LINEVALUE 0x194
/* Strings */
#define STRING_PAGESETUP_HEADERVALUE 0x160
......
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