================ rvDebuggerWindow::HandleCommand Handles the WM_COMMAND message for this window ================ */
| 1137 | ================ |
| 1138 | */ |
| 1139 | int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) |
| 1140 | { |
| 1141 | int event = HIWORD(wparam); |
| 1142 | int id = LOWORD(wparam); |
| 1143 | |
| 1144 | // The window menu list needs to be handled specially |
| 1145 | if ( id >= ID_DBG_WINDOWMIN && id <= ID_DBG_WINDOWMAX ) |
| 1146 | { |
| 1147 | mActiveScript = id - ID_DBG_WINDOWMIN; |
| 1148 | UpdateScript ( ); |
| 1149 | return 0; |
| 1150 | } |
| 1151 | |
| 1152 | // The recent file list needs to be handled specially |
| 1153 | if ( LOWORD(wparam) >= ID_DBG_FILE_MRU1 && LOWORD(wparam) < ID_DBG_FILE_MRU1 + rvRegistryOptions::MAX_MRU_SIZE ) |
| 1154 | { |
| 1155 | idStr filename; |
| 1156 | filename = gDebuggerApp.GetOptions().GetRecentFile ( gDebuggerApp.GetOptions().GetRecentFileCount() - (LOWORD(wparam)-ID_DBG_FILE_MRU1) - 1 ); |
| 1157 | if ( !OpenScript ( filename ) ) |
| 1158 | { |
| 1159 | MessageBox ( mWnd, va("Failed to open script '%s'", filename.c_str() ), "Quake 4 Script Debugger", MB_OK ); |
| 1160 | } |
| 1161 | return 0; |
| 1162 | } |
| 1163 | |
| 1164 | switch ( id ) |
| 1165 | { |
| 1166 | case ID_DBG_SEND_COMMAND: |
| 1167 | { |
| 1168 | if ( mClient->IsConnected( ) && GetFocus( ) == mWndConsoleInput ) { |
| 1169 | GETTEXTLENGTHEX textLen; |
| 1170 | int chars; |
| 1171 | textLen.flags = GTL_DEFAULT | GTL_USECRLF; |
| 1172 | textLen.codepage = CP_ACP; |
| 1173 | chars = SendMessage( mWndConsoleInput, EM_GETTEXTLENGTHEX, ( WPARAM ) &textLen, 0 ); |
| 1174 | |
| 1175 | char *text = new char[chars + 1]; |
| 1176 | |
| 1177 | GETTEXTEX getText; |
| 1178 | getText.cb = chars + 1; |
| 1179 | getText.codepage = CP_ACP; |
| 1180 | getText.flags = GT_DEFAULT | GT_USECRLF; |
| 1181 | getText.lpDefaultChar = NULL; |
| 1182 | getText.lpUsedDefChar = NULL; |
| 1183 | SendMessage( mWndConsoleInput, EM_GETTEXTEX, ( WPARAM ) &getText, ( LPARAM ) text ); |
| 1184 | idStr parse = text; |
| 1185 | delete[] text; |
| 1186 | |
| 1187 | mClient->SendCommand( parse.c_str() ); |
| 1188 | |
| 1189 | SendMessage( mWndConsoleInput, EM_SETSEL, 0, -1 ); |
| 1190 | SendMessage( mWndConsoleInput, EM_REPLACESEL, FALSE, ( LPARAM ) "" ); |
| 1191 | UpdateWindow( mWndConsoleInput ); |
| 1192 | } |
| 1193 | break; |
| 1194 | } |
| 1195 | |
| 1196 | case ID_DBG_EDIT_FINDSELECTED: |
no test coverage detected