diff options
-rw-r--r-- | testing/toxic/chat.c | 9 | ||||
-rw-r--r-- | testing/toxic/friendlist.c | 1 | ||||
-rw-r--r-- | testing/toxic/main.c | 23 | ||||
-rw-r--r-- | testing/toxic/prompt.c | 2 |
4 files changed, 9 insertions, 26 deletions
diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c index 50aa81b0..b835cf2d 100644 --- a/testing/toxic/chat.c +++ b/testing/toxic/chat.c | |||
@@ -63,8 +63,6 @@ static void chat_onMessage(ToxWindow* self, int num, uint8_t* msg, uint16_t len) | |||
63 | wprintw(ctx->history,"%s",hour); | 63 | wprintw(ctx->history,"%s",hour); |
64 | wprintw(ctx->history,":%s ",min); | 64 | wprintw(ctx->history,":%s ",min); |
65 | wattron(ctx->history, COLOR_PAIR(4)); | 65 | wattron(ctx->history, COLOR_PAIR(4)); |
66 | wprintw(ctx->history, "%s: ", now); | ||
67 | wattron(ctx->history, COLOR_PAIR(4)); | ||
68 | wprintw(ctx->history, "%s: ", nick); | 66 | wprintw(ctx->history, "%s: ", nick); |
69 | wattroff(ctx->history, COLOR_PAIR(4)); | 67 | wattroff(ctx->history, COLOR_PAIR(4)); |
70 | wprintw(ctx->history, "%s\n", msg); | 68 | wprintw(ctx->history, "%s\n", msg); |
@@ -109,17 +107,19 @@ static void chat_onKey(ToxWindow* self, int key) { | |||
109 | } | 107 | } |
110 | else if(key == '\n') { | 108 | else if(key == '\n') { |
111 | 109 | ||
110 | printf("Get times to int"); | ||
112 | int inthour = timeinfo->tm_hour; //Pretty bad, but it gets the job done | 111 | int inthour = timeinfo->tm_hour; //Pretty bad, but it gets the job done |
113 | int intmin = timeinfo->tm_min; | 112 | int intmin = timeinfo->tm_min; |
114 | char min[2]; | 113 | char min[2]; |
115 | char hour[2]; | 114 | char hour[2]; |
115 | printf("Turn to varible"); | ||
116 | sprintf(hour,"%d",inthour); | 116 | sprintf(hour,"%d",inthour); |
117 | if (intmin < 10) { | 117 | if (intmin < 10) { |
118 | sprintf(min,"0%d",intmin); | 118 | sprintf(min,"0%d",intmin); |
119 | } else { | 119 | } else { |
120 | sprintf(min,"%d",intmin); | 120 | sprintf(min,"%d",intmin); |
121 | } | 121 | } |
122 | 122 | printf("Display"); | |
123 | wattron(ctx->history, COLOR_PAIR(2)); | 123 | wattron(ctx->history, COLOR_PAIR(2)); |
124 | wprintw(ctx->history,"%s",hour); | 124 | wprintw(ctx->history,"%s",hour); |
125 | wprintw(ctx->history,":%s ",min); | 125 | wprintw(ctx->history,":%s ",min); |
@@ -147,6 +147,7 @@ static void chat_onKey(ToxWindow* self, int key) { | |||
147 | } | 147 | } |
148 | 148 | ||
149 | static void chat_onDraw(ToxWindow* self) { | 149 | static void chat_onDraw(ToxWindow* self) { |
150 | curs_set(1); | ||
150 | int x, y; | 151 | int x, y; |
151 | ChatContext* ctx = (ChatContext*) self->x; | 152 | ChatContext* ctx = (ChatContext*) self->x; |
152 | 153 | ||
@@ -158,7 +159,7 @@ static void chat_onDraw(ToxWindow* self) { | |||
158 | 159 | ||
159 | wclear(ctx->linewin); | 160 | wclear(ctx->linewin); |
160 | mvwhline(ctx->linewin, 0, 0, '_', COLS); | 161 | mvwhline(ctx->linewin, 0, 0, '_', COLS); |
161 | mvwprintw(ctx->linewin, 1, 0, "%s\n", ctx->line); | 162 | mvwprintw(self->window, y-1, 0, "%s\n", ctx->line); |
162 | 163 | ||
163 | wrefresh(self->window); | 164 | wrefresh(self->window); |
164 | } | 165 | } |
diff --git a/testing/toxic/friendlist.c b/testing/toxic/friendlist.c index f9a413f9..b4b619a2 100644 --- a/testing/toxic/friendlist.c +++ b/testing/toxic/friendlist.c | |||
@@ -113,6 +113,7 @@ static void friendlist_onKey(ToxWindow* self, int key) { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | static void friendlist_onDraw(ToxWindow* self) { | 115 | static void friendlist_onDraw(ToxWindow* self) { |
116 | curs_set(0); | ||
116 | size_t i; | 117 | size_t i; |
117 | 118 | ||
118 | wclear(self->window); | 119 | wclear(self->window); |
diff --git a/testing/toxic/main.c b/testing/toxic/main.c index c596b708..bcfc487f 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c | |||
@@ -280,26 +280,6 @@ void prepare_window(WINDOW* w) { | |||
280 | wresize(w, LINES-2, COLS); | 280 | wresize(w, LINES-2, COLS); |
281 | } | 281 | } |
282 | 282 | ||
283 | /* | ||
284 | * Draws cursor relative to input on prompt window. | ||
285 | * Removes cursor on friends window and chat windows. | ||
286 | * | ||
287 | * TODO: Make it work for chat windows | ||
288 | */ | ||
289 | void position_cursor(WINDOW* w, char* title) | ||
290 | { | ||
291 | curs_set(1); | ||
292 | if (strcmp(title, "[prompt]") == 0) { // main/prompt window | ||
293 | int x, y; | ||
294 | getyx(w, y, x); | ||
295 | move(y, x); | ||
296 | } | ||
297 | else if (strcmp(title, "[friends]") == 0) // friends window | ||
298 | curs_set(0); | ||
299 | else // any other window (i.e chat) | ||
300 | curs_set(0); | ||
301 | } | ||
302 | |||
303 | int main(int argc, char* argv[]) { | 283 | int main(int argc, char* argv[]) { |
304 | int ch; | 284 | int ch; |
305 | ToxWindow* a; | 285 | ToxWindow* a; |
@@ -317,9 +297,8 @@ int main(int argc, char* argv[]) { | |||
317 | a = &windows[w_active]; | 297 | a = &windows[w_active]; |
318 | prepare_window(a->window); | 298 | prepare_window(a->window); |
319 | a->blink = false; | 299 | a->blink = false; |
320 | a->onDraw(a); | ||
321 | draw_bar(); | 300 | draw_bar(); |
322 | position_cursor(a->window, a->title); | 301 | a->onDraw(a); |
323 | 302 | ||
324 | // Handle input. | 303 | // Handle input. |
325 | ch = getch(); | 304 | ch = getch(); |
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index 8536b940..e80bdab0 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -140,6 +140,7 @@ static void execute(ToxWindow* self, char* cmd) { | |||
140 | break; | 140 | break; |
141 | case -2: | 141 | case -2: |
142 | wprintw(self->window, "Please add a message to your request.\n"); | 142 | wprintw(self->window, "Please add a message to your request.\n"); |
143 | break; | ||
143 | case -3: | 144 | case -3: |
144 | break; | 145 | break; |
145 | wprintw(self->window, "That appears to be your own ID.\n"); | 146 | wprintw(self->window, "That appears to be your own ID.\n"); |
@@ -288,6 +289,7 @@ static void prompt_onKey(ToxWindow* self, int key) { | |||
288 | } | 289 | } |
289 | 290 | ||
290 | static void prompt_onDraw(ToxWindow* self) { | 291 | static void prompt_onDraw(ToxWindow* self) { |
292 | curs_set(1); | ||
291 | int x, y; | 293 | int x, y; |
292 | 294 | ||
293 | getyx(self->window, y, x); | 295 | getyx(self->window, y, x); |