sources/interface.cpp

changeset 115
bb7ef7c33dad
parent 112
c062273efa33
child 116
552909484712
equal deleted inserted replaced
114:0e7f3ecdf65a 115:bb7ef7c33dad
183 int pairnum = 1 + (i * NUM_COLORS + j); 183 int pairnum = 1 + (i * NUM_COLORS + j);
184 int fg = (i == DEFAULT) ? defaultFg : i; 184 int fg = (i == DEFAULT) ? defaultFg : i;
185 int bg = (j == DEFAULT) ? defaultBg : j; 185 int bg = (j == DEFAULT) ? defaultBg : j;
186 186
187 if (::init_pair (pairnum, fg, bg) == ERR) 187 if (::init_pair (pairnum, fg, bg) == ERR)
188 print ("Unable to initialize color pair %d (%d, %d)\n", pairnum, fg, bg); 188 print_warning ("Unable to initialize color pair %d (%d, %d)\n", pairnum, fg, bg);
189 } 189 }
190 } 190 }
191 else 191 else
192 { 192 {
193 print ("This terminal does not appear to support colors.\n"); 193 print_warning ("This terminal does not appear to support colors.\n");
194 } 194 }
195 195
196 render_full(); 196 render_full();
197 refresh(); 197 refresh();
198 NeedRefresh = false; 198 NeedRefresh = false;
525 } 525 }
526 526
527 if (not text.is_empty()) 527 if (not text.is_empty())
528 text += " | "; 528 text += " | ";
529 529
530 text += "Ctrl+N to connect, Ctrl+Q to quit"; 530 text += "Ctrl+N to connect, Ctrl+Q to ";
531 text += (Session.state() == RCON_DISCONNECTED) ? "quit" : "disconnect";
531 532
532 if (text != StatusBarText) 533 if (text != StatusBarText)
533 { 534 {
534 StatusBarText = text; 535 StatusBarText = text;
535 NeedStatusBarRender = true; 536 NeedStatusBarRender = true;
915 print_to_console (message); 916 print_to_console (message);
916 } 917 }
917 918
918 // ------------------------------------------------------------------------------------------------- 919 // -------------------------------------------------------------------------------------------------
919 // 920 //
920 void __cdecl Interface::print (const char* fmtstr, ...) 921 void __cdecl Interface::print_text (const char* fmtstr, ...)
921 { 922 {
922 va_list args; 923 va_list args;
923 va_start (args, fmtstr); 924 va_start (args, fmtstr);
924 vprint (fmtstr, args); 925 vprint (fmtstr, args);
926 va_end (args);
927 }
928
929 // -------------------------------------------------------------------------------------------------
930 //
931 void __cdecl Interface::print (const char* fmtstr, ...)
932 {
933 va_list args;
934 va_start (args, fmtstr);
935 print_to_console (TEXTCOLOR_BrightBlue);
936 vprint (fmtstr, args);
937 print_to_console (TEXTCOLOR_Reset);
925 va_end (args); 938 va_end (args);
926 } 939 }
927 940
928 // ------------------------------------------------------------------------------------------------- 941 // -------------------------------------------------------------------------------------------------
929 // 942 //
1082 Session.disconnect(); 1095 Session.disconnect();
1083 endwin(); 1096 endwin();
1084 throw Exitception(); 1097 throw Exitception();
1085 } 1098 }
1086 else 1099 else
1087 print_error("Unknown command %s\n", command.chars()); 1100 print_error("Unknown command: %s\n", command.chars());
1088 } 1101 }
1089 1102
1090 // ------------------------------------------------------------------------------------------------- 1103 // -------------------------------------------------------------------------------------------------
1091 // 1104 //
1092 void Interface::disconnected() 1105 void Interface::disconnected()

mercurial