135{
136 switch (message)
137 {
138
139
141 {
142 if (strlen(
pConsole->messageToBlock) > 0)
143 {
144 if (!_stricmp((LPCSTR)lParam,
pConsole->messageToBlock))
145 {
146
148 break;
149 }
150 }
151
152
153
154 if ((
int)
pConsole->messageList.size() >= 50)
155 {
156
157 if (
pConsole->messageList[0]->icon != NULL) DeleteObject(&
pConsole->messageList[0]->icon);
160 }
161
162
163
165
166 newMessage->
type = (int)wParam;
167
168
169
174 else newMessage->
icon = NULL;
175
176
177
179 {
182 {
183
184 _strtime(message);
185 strncat_s(message, sizeof(message), " -> ", _TRUNCATE);
186 strncat_s(message, sizeof(message), (LPCSTR)lParam, _TRUNCATE);
187 }
188 else strncpy_s(message, sizeof(message), (LPCSTR)lParam, _TRUNCATE);
189 message[sizeof(message)-1] = '\0';
190
191
192 LPSTR ptr;
193 while (ptr = strchr(message, '\r'))
194 {
195
196
197
198 ptr[0] = ' ';
199 }
200 while (ptr = strchr(message, '\n'))
201 {
202 int nLen = strlen(ptr);
203 memmove(ptr, ptr+1, nLen);
204 }
205
206
207 strncpy_s(newMessage->
msg,
sizeof(newMessage->
msg), message, _TRUNCATE);
208 newMessage->
msg[
sizeof(newMessage->
msg)-1] =
'\0';
209
210
211
212
213 char* url = StrStrI(newMessage->
msg,
"http://");
214 if (url == NULL) url = StrStrI(newMessage->
msg,
"https://");
215 if (url == NULL) url = StrStrI(newMessage->
msg,
"file://");
216 if (url == NULL) newMessage->
url[0] =
'\0';
217 else
218 {
219 strncpy_s(newMessage->
url,
sizeof(newMessage->
url), url, _TRUNCATE);
220 newMessage->
url[
sizeof(newMessage->
url)-1] =
'\0';
221
222
224 {
225 char* first = newMessage->
url;
226 char* pipe = StrStrI(newMessage->
url,
"|");
227 if (pipe != NULL) newMessage->
url[pipe-first] =
'\0';
228 else if (newMessage->
url[strlen(newMessage->
url)-1] ==
']') newMessage->
url[strlen(newMessage->
url)-1] =
'\0';
229
230 char updatedMsg[350];
231 updatedMsg[sizeof(updatedMsg) - 1] = '\0';
232 int n = url - newMessage->
msg;
233 strncpy_s(updatedMsg,
sizeof(updatedMsg), newMessage->
msg, n);
234 strcat_s(updatedMsg, " ");
235 strcat_s(updatedMsg, newMessage->
url);
236 strcat_s(updatedMsg, " ");
237 strcat_s(updatedMsg, &url[strlen(newMessage->
url)]);
238 strncpy_s(newMessage->
msg,
sizeof(newMessage->
msg), updatedMsg, _TRUNCATE);
239 newMessage->
msg[
sizeof(newMessage->
msg)-1] =
'\0';
240 }
241
242
243 else if (strchr(newMessage->
url,
' '))
244 {
245 char temp[
sizeof(newMessage->
url)];
247 strcpy(newMessage->
url, temp);
248 switch(newMessage->
url[strlen(newMessage->
url)-1])
249 {
250 case ')':
251 case '>':
252 case ',':
253 {
254 newMessage->
url[strlen(newMessage->
url)-1] =
'\0';
255 }
256 }
257 }
258 }
259 }
260
261
262
263 pConsole->messageList.push_back(newMessage);
264
265
266
268 {
270
271
272
273
274
275
276
277
278
279 }
280 }
281 break;
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
300 case WM_DISPLAYCHANGE:
301 {
303 }
304 break;
305
306 case WM_SETTINGCHANGE:
307 {
308
309
310 if (wParam == SPI_SETWORKAREA)
pConsole->UpdatePosition();
311 return 0;
312 }
313
314
315
317 {
319 {
320
322 ShowWindow(
pConsole->hConsoleWnd, SW_SHOWNOACTIVATE);
324 }
325 else
326 {
327
329 ShowWindow(
pConsole->hConsoleWnd, SW_HIDE);
330 }
331
333
335 }
336 break;
337
338
339
340
341
342
343
344
345
346
347
348
349 case WM_GETMINMAXINFO:
350 {
351 MINMAXINFO *mmi = (MINMAXINFO*)lParam;
352 mmi->ptMaxSize.y =
pConsole->ConsoleHeight;
353 return 0;
354 }
355
356
357
358 case WM_CLOSE:
359 return 0;
360
361
362
363 case WM_MOUSEACTIVATE:
364 return MA_NOACTIVATE;
365
366
367
368
369
370
371
372 case WM_NCHITTEST:
373 {
374 if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) return HTCAPTION;
375 else return HTCLIENT;
376 }
377 break;
378
379
380
381 case WM_LBUTTONDBLCLK:
382 {
383
384 POINT pt;
385 pt.x = LOWORD(lParam);
386 pt.y = HIWORD(lParam);
387
388 int i = 0;
389 for (i; i < (int)
pConsole->messageList.size(); i++)
390 {
391 if (PtInRect(&
pConsole->messageList[i]->r, pt))
break;
392 }
393 if (i == (
int)
pConsole->messageList.size())
break;
394
395
396
397 if (strlen(
pConsole->messageList[i]->url) > 0)
398 {
399 BBExecute(GetDesktopWindow(), NULL,
pConsole->messageList[i]->url, NULL, NULL, SW_SHOWNORMAL,
true);
400 }
401 else
402 {
403
404
405 }
406 }
407 break;
408
409
410
411
412 case WM_LBUTTONDOWN:
413 case WM_LBUTTONUP:
414 case WM_RBUTTONDOWN:
415 case WM_RBUTTONUP:
416 case WM_MBUTTONDOWN:
417 case WM_MBUTTONUP:
418 case WM_XBUTTONDOWN:
419 case WM_XBUTTONUP:
420 case WM_MOUSEWHEEL:
421 case WM_MOUSEHWHEEL:
422 case WM_DROPFILES:
423 {
424 if (message == WM_LBUTTONUP)
425 {
426 POINT pt;
427 pt.x = LOWORD(lParam);
428 pt.y = HIWORD(lParam);
429
430
431 if (PtInRect(&
pConsole->consoleZoomButtonRect, pt))
432 {
434 break;
435 }
436 }
437
438
439 pDesktop->MouseAndDropHandler(
pDesktop->hDesktopWnd, message, wParam, lParam);
440 }
441 break;
442
443
444
445 default:
446 return DefWindowProc(hwnd,message,wParam,lParam);
447
448
449 }
450 return 0;
451}
void WriteBool(LPCSTR fp, LPCSTR keyword, bool value)
Definition BBApi.cpp:3131
Desktop * pDesktop
Definition Blackbox.cpp:37
LPSTR Tokenize(LPCSTR string, LPSTR buf, LPSTR delims)
Definition BBApi.cpp:273
bool IsInString(LPCSTR inputString, LPCSTR searchString)
Definition BBApi.cpp:2519
HINSTANCE BBExecute(HWND Owner, LPCSTR szOperation, LPCSTR szCommand, LPCSTR szArgs, LPCSTR szDirectory, int nShowCmd, bool noErrorMsgs)
Definition BBApi.cpp:1648
Settings * pSettings
Definition Blackbox.cpp:46
#define BB_TOGGLECONSOLE
Definition BBApi.h:173
#define BB_CONSOLEMESSAGE
Definition BBApi.h:165
#define CONSOLE_SEPARATOR
Definition BBApi.h:304
#define CONSOLE_REGULAR_MESSAGE
Definition BBApi.h:297
#define BB_RECONFIGURE
Definition BBApi.h:147
#define CONSOLE_SHELL_MESSAGE
Definition BBApi.h:301
#define CONSOLE_ERROR_MESSAGE
Definition BBApi.h:300
#define MAX_LINE_LENGTH
Definition BBApi.h:64
#define CONSOLE_INFORMATION_MESSAGE
Definition BBApi.h:298
#define CONSOLE_WARNING_MESSAGE
Definition BBApi.h:299
Console * pConsole
Definition Blackbox.cpp:36
void PlaySoundFX(int sound)
Definition Sounds.cpp:40
@ SFX_TOGGLE_ELEMENT
Definition Sounds.h:48
char msg[350]
Definition Console.h:45
int type
Definition Console.h:44
char url[256]
Definition Console.h:47
HICON icon
Definition Console.h:46