sources/interface.cpp

branch
protocol5
changeset 80
f992b027374b
parent 78
c1d43ade656e
child 84
3bd32eec3d57
equal deleted inserted replaced
79:62cfb7b97fc0 80:f992b027374b
153 ::use_default_colors(); 153 ::use_default_colors();
154 InputHistory.clear(); 154 InputHistory.clear();
155 InputHistory << ""; 155 InputHistory << "";
156 OutputLines.clear(); 156 OutputLines.clear();
157 OutputLines << ColoredLine(); 157 OutputLines << ColoredLine();
158 Title = format (APPNAME " %1 (%2)", full_version_string(), changeset_date_string());
159 158
160 for (int i = 0; i < NUM_COLORS; ++i) 159 for (int i = 0; i < NUM_COLORS; ++i)
161 for (int j = 0; j < NUM_COLORS; ++j) 160 for (int j = 0; j < NUM_COLORS; ++j)
162 { 161 {
163 init_pair ((i * NUM_COLORS + j), 162 init_pair ((i * NUM_COLORS + j),
172 171
173 // ------------------------------------------------------------------------------------------------- 172 // -------------------------------------------------------------------------------------------------
174 // 173 //
175 void Interface::render_titlebar() 174 void Interface::render_titlebar()
176 { 175 {
177 if (Title.length() <= COLS) 176 String message = Title;
177
178 if (Title.is_empty())
179 message = format (APPNAME " %1 (%2)", full_version_string(), changeset_date_string());
180
181 if (message.length() <= COLS)
178 { 182 {
179 int pair = color_pair (WHITE, BLUE); 183 int pair = color_pair (WHITE, BLUE);
180 int startx = (COLS - Title.length()) / 2; 184 int startx = (COLS - message.length()) / 2;
181 int endx = startx + Title.length(); 185 int endx = startx + message.length();
182 attron (pair); 186 attron (pair);
183 mvprintw (0, startx, "%s", Title.chars()); 187 mvprintw (0, startx, "%s", message.chars());
184 mvhline (0, 0, ' ', startx); 188 mvhline (0, 0, ' ', startx);
185 mvhline (0, endx, ' ', COLS - endx); 189 mvhline (0, endx, ' ', COLS - endx);
186 attroff (pair); 190 attroff (pair);
187 } 191 }
188 192
953 input.replace (0, part.length(), complete); 957 input.replace (0, part.length(), complete);
954 CursorPosition = complete.length(); 958 CursorPosition = complete.length();
955 NeedInputRender = true; 959 NeedInputRender = true;
956 } 960 }
957 } 961 }
962
963 // -------------------------------------------------------------------------------------------------
964 //
965 void Interface::disconnected()
966 {
967 Title = "";
968 update_statusbar();
969 render_titlebar();
970 }

mercurial