34 static WINDOW *logWnd, *logWnd_border; |
35 static WINDOW *logWnd, *logWnd_border; |
35 static PANEL *rosterPanel, *chatPanel, *inputPanel; |
36 static PANEL *rosterPanel, *chatPanel, *inputPanel; |
36 static PANEL *logPanel, *logPanel_border; |
37 static PANEL *logPanel, *logPanel_border; |
37 static int maxY, maxX; |
38 static int maxY, maxX; |
38 static window_entry_t *currentWindow; |
39 static window_entry_t *currentWindow; |
|
40 |
|
41 static int chatmode; |
39 |
42 |
40 static char inputLine[INPUTLINE_LENGTH]; |
43 static char inputLine[INPUTLINE_LENGTH]; |
41 static char *ptr_inputline; |
44 static char *ptr_inputline; |
42 |
45 |
43 |
46 |
340 int n, width, i; |
343 int n, width, i; |
341 window_entry_t *tmp = scr_SearchWindow(winId); |
344 window_entry_t *tmp = scr_SearchWindow(winId); |
342 if (tmp != NULL) { |
345 if (tmp != NULL) { |
343 top_panel(tmp->panel); |
346 top_panel(tmp->panel); |
344 currentWindow = tmp; |
347 currentWindow = tmp; |
|
348 chatmode = TRUE; |
|
349 tmp->pending_msg = FALSE; |
345 width = scr_WindowHeight(tmp->win); |
350 width = scr_WindowHeight(tmp->win); |
346 for (n = 0; n < tmp->nlines; n++) { |
351 for (n = 0; n < tmp->nlines; n++) { |
347 mvwprintw(tmp->win, n + 1, 1, ""); |
352 mvwprintw(tmp->win, n + 1, 1, ""); |
348 for (i = 0; i < width - 2; i++) |
353 for (i = 0; i < width - 2; i++) |
349 waddch(tmp->win, ' '); |
354 waddch(tmp->win, ' '); |
377 int dont_show = FALSE; |
382 int dont_show = FALSE; |
378 |
383 |
379 |
384 |
380 tmp = scr_SearchWindow(winId); |
385 tmp = scr_SearchWindow(winId); |
381 |
386 |
382 if ((!force_show) && ((!currentWindow || (currentWindow != tmp)))) |
387 if (!chatmode) |
|
388 dont_show = TRUE; |
|
389 else if ((!force_show) && ((!currentWindow || (currentWindow != tmp)))) |
383 dont_show = TRUE; |
390 dont_show = TRUE; |
384 scr_LogPrint("dont_show=%d", dont_show); |
391 scr_LogPrint("dont_show=%d", dont_show); |
385 |
392 |
386 if (tmp == NULL) { |
393 if (tmp == NULL) { |
387 tmp = scr_CreatePanel(winId, 20, 0, CHAT_WIN_HEIGHT, maxX - 20, dont_show); |
394 tmp = scr_CreatePanel(winId, 20, 0, CHAT_WIN_HEIGHT, maxX - 20, dont_show); |
425 } |
432 } |
426 } |
433 } |
427 |
434 |
428 if (!dont_show) { |
435 if (!dont_show) { |
429 top_panel(tmp->panel); |
436 top_panel(tmp->panel); |
|
437 tmp->pending_msg = TRUE; |
430 width = scr_WindowHeight(tmp->win); |
438 width = scr_WindowHeight(tmp->win); |
431 for (n = 0; n < tmp->nlines; n++) { |
439 for (n = 0; n < tmp->nlines; n++) { |
432 mvwprintw(tmp->win, n + 1, 1, ""); |
440 mvwprintw(tmp->win, n + 1, 1, ""); |
433 for (i = 0; i < width - 2; i++) |
441 for (i = 0; i < width - 2; i++) |
434 waddch(tmp->win, ' '); |
442 waddch(tmp->win, ' '); |
459 } |
467 } |
460 |
468 |
461 void scr_DrawMainWindow(void) |
469 void scr_DrawMainWindow(void) |
462 { |
470 { |
463 /* Draw main panels */ |
471 /* Draw main panels */ |
464 rosterWnd = newwin(maxY-1, 20, 0, 0); |
472 rosterWnd = newwin(CHAT_WIN_HEIGHT, 20, 0, 0); |
465 rosterPanel = new_panel(rosterWnd); |
473 rosterPanel = new_panel(rosterWnd); |
466 scr_draw_box(rosterWnd, 0, 0, maxY-1, 20, COLOR_GENERAL, 0, 0); |
474 scr_draw_box(rosterWnd, 0, 0, CHAT_WIN_HEIGHT, 20, COLOR_GENERAL, 0, 0); |
467 mvwprintw(rosterWnd, 0, (20 - strlen(i18n("Roster"))) / 2, |
475 mvwprintw(rosterWnd, 0, (20 - strlen(i18n("Roster"))) / 2, |
468 i18n("Roster")); |
476 i18n("Roster")); |
469 |
477 |
470 chatWnd = newwin(CHAT_WIN_HEIGHT, maxX - 20, 0, 20); |
478 chatWnd = newwin(CHAT_WIN_HEIGHT, maxX - 20, 0, 20); |
471 chatPanel = new_panel(chatWnd); |
479 chatPanel = new_panel(chatWnd); |
473 //mvwprintw(chatWnd, 0, |
481 //mvwprintw(chatWnd, 0, |
474 // ((maxX - 20) - strlen(i18n("Status Window"))) / 2, |
482 // ((maxX - 20) - strlen(i18n("Status Window"))) / 2, |
475 // i18n("Status Window")); |
483 // i18n("Status Window")); |
476 //wbkgd(chatWnd, COLOR_PAIR(COLOR_GENERAL)); |
484 //wbkgd(chatWnd, COLOR_PAIR(COLOR_GENERAL)); |
477 |
485 |
478 logWnd_border = newwin(LOG_WIN_HEIGHT, maxX - 20, CHAT_WIN_HEIGHT, 20); |
486 logWnd_border = newwin(LOG_WIN_HEIGHT, maxX, CHAT_WIN_HEIGHT, 0); |
479 logPanel_border = new_panel(logWnd_border); |
487 logPanel_border = new_panel(logWnd_border); |
480 scr_draw_box(logWnd_border, 0, 0, LOG_WIN_HEIGHT, maxX - 20, COLOR_GENERAL, 0, 0); |
488 scr_draw_box(logWnd_border, 0, 0, LOG_WIN_HEIGHT, maxX, COLOR_GENERAL, 0, 0); |
481 // mvwprintw(logWnd_border, 0, |
489 // mvwprintw(logWnd_border, 0, |
482 // ((maxX - 20) - strlen(i18n("Log Window"))) / 2, |
490 // ((maxX - 20) - strlen(i18n("Log Window"))) / 2, |
483 // i18n("Log Window")); |
491 // i18n("Log Window")); |
484 //logWnd = newwin(LOG_WIN_HEIGHT - 2, maxX-20 - 2, CHAT_WIN_HEIGHT+1, 20+1); |
492 //logWnd = newwin(LOG_WIN_HEIGHT - 2, maxX-20 - 2, CHAT_WIN_HEIGHT+1, 20+1); |
485 logWnd = derwin(logWnd_border, LOG_WIN_HEIGHT-2, maxX-20-2, 1, 1); |
493 logWnd = derwin(logWnd_border, LOG_WIN_HEIGHT-2, maxX-2, 1, 1); |
486 logPanel = new_panel(logWnd); |
494 logPanel = new_panel(logWnd); |
487 wbkgd(logWnd, COLOR_PAIR(COLOR_GENERAL)); |
495 wbkgd(logWnd, COLOR_PAIR(COLOR_GENERAL)); |
488 //wattrset(logWnd, COLOR_PAIR(COLOR_GENERAL)); |
496 //wattrset(logWnd, COLOR_PAIR(COLOR_GENERAL)); |
489 wprintw(logWnd, "Here we are\n"); |
497 wprintw(logWnd, "Here we are\n"); |
490 scr_LogPrint("Here we are :-)"); |
498 scr_LogPrint("Here we are :-)"); |
741 break; |
752 break; |
742 case KEY_END: |
753 case KEY_END: |
743 case 5: |
754 case 5: |
744 for (; *ptr_inputline; ptr_inputline++) ; |
755 for (; *ptr_inputline; ptr_inputline++) ; |
745 break; |
756 break; |
746 case 21: // Ctrl-u |
757 case 21: // Ctrl-u |
747 strcpy(inputLine, ptr_inputline); |
758 strcpy(inputLine, ptr_inputline); |
748 ptr_inputline = inputLine; |
759 ptr_inputline = inputLine; |
749 break; |
760 break; |
750 case KEY_EOL: |
761 case KEY_EOL: |
751 case 11: // Ctrl-k |
762 case 11: // Ctrl-k |
752 *ptr_inputline = 0; |
763 *ptr_inputline = 0; |
|
764 break; |
|
765 case 27: // ESC |
|
766 currentWindow = NULL; |
|
767 chatmode = FALSE; |
|
768 top_panel(chatPanel); |
|
769 top_panel(inputPanel); |
753 break; |
770 break; |
754 default: |
771 default: |
755 scr_LogPrint("Unkown key=%o", key); |
772 scr_LogPrint("Unkown key=%o", key); |
756 } |
773 } |
757 //scr_LogPrint("[%02x]", key); |
774 //scr_LogPrint("[%02x]", key); |