VOID DIALOG_EditWrap(VOID) { Globals.bWrapLongLines = !Globals.bWrapLongLines; if (Globals.bWrapLongLines) { EnableMenuItem(Globals.hMenu, CMD_GOTO, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); } else { EnableMenuItem(Globals.hMenu, CMD_GOTO, MF_BYCOMMAND | MF_ENABLED); } DoCreateEditWindow(); }
VOID DIALOG_EditWrap(VOID) { Globals.bWrapLongLines = !Globals.bWrapLongLines; DoCreateEditWindow(); }
/*********************************************************************** * * WinMain */ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE prev, LPTSTR cmdline, int show) { MSG msg; HACCEL hAccel; WNDCLASSEX wndclass; HMONITOR monitor; MONITORINFO info; INT x, y; static const TCHAR className[] = _T("NPClass"); static const TCHAR winName[] = _T("Notepad"); UNREFERENCED_PARAMETER(prev); aFINDMSGSTRING = (ATOM) RegisterWindowMessage(FINDMSGSTRING); ZeroMemory(&Globals, sizeof(Globals)); Globals.hInstance = hInstance; LoadSettings(); ZeroMemory(&wndclass, sizeof(wndclass)); wndclass.cbSize = sizeof(wndclass); wndclass.lpfnWndProc = NOTEPAD_WndProc; wndclass.hInstance = Globals.hInstance; wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_NPICON)); wndclass.hCursor = LoadCursor(0, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndclass.lpszMenuName = MAKEINTRESOURCE(MAIN_MENU); wndclass.lpszClassName = className; wndclass.hIconSm = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_NPICON), IMAGE_ICON, 16, 16, 0); if (!RegisterClassEx(&wndclass)) return FALSE; /* Setup windows */ monitor = MonitorFromRect( &Globals.main_rect, MONITOR_DEFAULTTOPRIMARY ); info.cbSize = sizeof(info); GetMonitorInfoW( monitor, &info ); x = Globals.main_rect.left; y = Globals.main_rect.top; if (Globals.main_rect.left >= info.rcWork.right || Globals.main_rect.top >= info.rcWork.bottom || Globals.main_rect.right < info.rcWork.left || Globals.main_rect.bottom < info.rcWork.top) x = y = CW_USEDEFAULT; Globals.hMainWnd = CreateWindow(className, winName, WS_OVERLAPPEDWINDOW, x, y, Globals.main_rect.right - Globals.main_rect.left, Globals.main_rect.bottom - Globals.main_rect.top, NULL, NULL, Globals.hInstance, NULL); if (!Globals.hMainWnd) { ShowLastError(); ExitProcess(1); } DoCreateEditWindow(); NOTEPAD_InitData(); DIALOG_FileNew(); ShowWindow(Globals.hMainWnd, show); UpdateWindow(Globals.hMainWnd); DragAcceptFiles(Globals.hMainWnd, TRUE); DIALOG_ViewStatusBar(); HandleCommandLine(cmdline); hAccel = LoadAccelerators( hInstance, MAKEINTRESOURCE(ID_ACCEL) ); while (GetMessage(&msg, 0, 0, 0)) { if (!IsDialogMessage(Globals.hFindReplaceDlg, &msg) && !TranslateAccelerator(Globals.hMainWnd, hAccel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return (int) msg.wParam; }