============================================================================= MsgCommand() - Handles WM_COMMAND
| 1791 | // |
| 1792 | // |
| 1793 | LRESULT MsgCommand ( HWND hwnd, WPARAM wParam, LPARAM lParam ) |
| 1794 | { |
| 1795 | switch ( LOWORD ( wParam ) ) { |
| 1796 | case IDM_FILE_NEW: |
| 1797 | FileLoad ( FALSE, TRUE, FALSE, FALSE, L"" ); |
| 1798 | break; |
| 1799 | case IDM_FILE_OPEN: |
| 1800 | FileLoad ( FALSE, FALSE, FALSE, FALSE, L"" ); |
| 1801 | break; |
| 1802 | case ID_FILE_OPEN__NEXT: |
| 1803 | case IDT_FILE_OPEN_NEXT: |
| 1804 | HL_Open_nextFs_file(hwnd, szCurFile , TRUE); |
| 1805 | break; |
| 1806 | case ID_FILE_OPEN__PREVIOUS: |
| 1807 | case IDT_FILE_OPEN_PREV: |
| 1808 | HL_Open_nextFs_file(hwnd, szCurFile, FALSE); |
| 1809 | break; |
| 1810 | case IDM_FILE_REVERT: { |
| 1811 | if ( lstrlen ( szCurFile ) ) { |
| 1812 | WCHAR tchCurFile2[MAX_PATH]; |
| 1813 | int iCurPos = ( int ) SendMessage ( hwndEdit, SCI_GETCURRENTPOS, 0, 0 ); |
| 1814 | int iAnchorPos = ( int ) SendMessage ( hwndEdit, SCI_GETANCHOR, 0, 0 ); |
| 1815 | int iVisTopLine = ( int ) SendMessage ( hwndEdit, SCI_GETFIRSTVISIBLELINE, 0, 0 ); |
| 1816 | int iDocTopLine = ( int ) SendMessage ( hwndEdit, SCI_DOCLINEFROMVISIBLE, ( WPARAM ) iVisTopLine, 0 ); |
| 1817 | int iXOffset = ( int ) SendMessage ( hwndEdit, SCI_GETXOFFSET, 0, 0 ); |
| 1818 | if ( ( bModified || iEncoding != iOriginalEncoding ) && MsgBox ( MBOKCANCEL, IDS_ASK_REVERT ) != IDOK ) { |
| 1819 | return ( 0 ); |
| 1820 | } |
| 1821 | lstrcpy ( tchCurFile2, szCurFile ); |
| 1822 | iWeakSrcEncoding = iEncoding; |
| 1823 | if ( FileLoad ( TRUE, FALSE, TRUE, FALSE, tchCurFile2 ) ) { |
| 1824 | if ( SendMessage ( hwndEdit, SCI_GETLENGTH, 0, 0 ) >= 4 ) { |
| 1825 | char tch[5] = ""; |
| 1826 | SendMessage ( hwndEdit, SCI_GETTEXT, 5, ( LPARAM ) tch ); |
| 1827 | if ( lstrcmpiA ( tch, ".LOG" ) != 0 ) { |
| 1828 | int iNewTopLine; |
| 1829 | SendMessage ( hwndEdit, SCI_SETSEL, iAnchorPos, iCurPos ); |
| 1830 | SendMessage ( hwndEdit, SCI_ENSUREVISIBLE, ( WPARAM ) iDocTopLine, 0 ); |
| 1831 | iNewTopLine = ( int ) SendMessage ( hwndEdit, SCI_GETFIRSTVISIBLELINE, 0, 0 ); |
| 1832 | SendMessage ( hwndEdit, SCI_LINESCROLL, 0, ( LPARAM ) iVisTopLine - iNewTopLine ); |
| 1833 | SendMessage ( hwndEdit, SCI_SETXOFFSET, ( WPARAM ) iXOffset, 0 ); |
| 1834 | } |
| 1835 | } |
| 1836 | } |
| 1837 | } |
| 1838 | } |
| 1839 | break; |
| 1840 | case IDM_FILE_SAVE: |
| 1841 | FileSave ( TRUE, FALSE, FALSE, FALSE, FALSE ); |
| 1842 | break; |
| 1843 | case IDM_FILE_SAVEAS: |
| 1844 | FileSave ( TRUE, FALSE, TRUE, FALSE, FALSE ); |
| 1845 | break; |
| 1846 | case ID_FILE_RENAMETO: |
| 1847 | FileSave ( TRUE, FALSE, TRUE, FALSE , TRUE ); |
| 1848 | break; |
| 1849 | case IDM_FILE_SAVECOPY: |
| 1850 | FileSave ( TRUE, FALSE, TRUE, TRUE , FALSE ); |
no test coverage detected