Changeset f6fae8d
- Timestamp:
- Jun 1, 2010, 12:14:11 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- e294783
- Parents:
- 84a4aca
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
r4e33cb2 rf6fae8d 2731 2731 owl_editwin_clear(e); 2732 2732 owl_editwin_insert_string(e, ptr); 2733 owl_editwin_redisplay(e);2734 2733 } else { 2735 2734 owl_function_beep(); … … 2747 2746 owl_editwin_clear(e); 2748 2747 owl_editwin_insert_string(e, ptr); 2749 owl_editwin_redisplay(e);2750 2748 } else { 2751 2749 owl_function_beep(); … … 2757 2755 buff = skiptokens(buff, 1); 2758 2756 owl_editwin_insert_string(e, buff); 2759 owl_editwin_redisplay(e);2760 2757 return NULL; 2761 2758 } -
editwin.c
r4e33cb2 rf6fae8d 28 28 int cursorx; 29 29 int winlines, wincols, fillcol, wrapcol; 30 WINDOW *curswin; 30 owl_window *win; 31 gulong repaint_id; 32 gulong resized_id; 31 33 int style; 32 34 int lock; … … 40 42 }; 41 43 44 static void oe_set_curswin(owl_editwin *e, owl_window *w, int winlines, int wincols); 45 static void oe_redisplay(owl_window *win, WINDOW *curswin, void *user_data); 42 46 static void oe_reframe(owl_editwin *e); 43 47 static void oe_save_excursion(owl_editwin *e, oe_excursion *x); … … 58 62 static char *oe_chunk(owl_editwin *e, int start, int end); 59 63 static void oe_destroy_cbdata(owl_editwin *e); 64 static void oe_dirty(owl_editwin *e); 65 static void oe_window_resized(owl_window *w, owl_editwin *e); 60 66 61 67 #define INCR 4096 … … 73 79 void owl_editwin_delete(owl_editwin *e) 74 80 { 81 if (e->win) { 82 g_signal_handler_disconnect(e->win, e->repaint_id); 83 g_signal_handler_disconnect(e->win, e->resized_id); 84 } 75 85 owl_free(e->buff); 76 86 owl_free(e->killbuf); … … 91 101 } 92 102 e->index = index; 103 oe_dirty(e); 93 104 } 94 105 … … 105 116 106 117 static void _owl_editwin_init(owl_editwin *e, 107 WINDOW *win,108 118 int winlines, 109 119 int wincols, … … 130 140 e->style=OWL_EDITWIN_STYLE_MULTILINE; 131 141 } 132 owl_editwin_set_curswin(e, win, winlines, wincols);133 142 e->lock=0; 134 143 e->dotsend=0; 135 144 e->echochar='\0'; 136 137 if (win) werase(win); 138 } 139 140 owl_editwin *owl_editwin_new(WINDOW *win, int winlines, int wincols, int style, owl_history *hist) 145 } 146 147 owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist) 141 148 { 142 149 owl_editwin *e = owl_editwin_allocate(); 143 150 144 _owl_editwin_init(e, win, winlines, wincols, style, hist); 151 _owl_editwin_init(e, winlines, wincols, style, hist); 152 oe_set_curswin(e, win, winlines, wincols); 145 153 return e; 146 154 } 147 155 148 void owl_editwin_set_curswin(owl_editwin *e, WINDOW *w, int winlines, int wincols) 149 { 150 e->curswin=w; 156 static void oe_window_resized(owl_window *w, owl_editwin *e) 157 { 158 /* update the sizes */ 159 owl_window_get_position(w, &e->winlines, &e->wincols, NULL, NULL); 160 } 161 162 static void oe_set_curswin(owl_editwin *e, owl_window *w, int winlines, int wincols) 163 { 164 e->win=w; 151 165 e->winlines=winlines; 152 166 e->wincols=wincols; … … 156 170 else 157 171 e->wrapcol = 0; 172 if (e->win) { 173 e->repaint_id = g_signal_connect(w, "redraw", G_CALLBACK(oe_redisplay), e); 174 e->resized_id = g_signal_connect(w, "resized", G_CALLBACK(oe_window_resized), e); 175 owl_window_dirty(e->win); 176 } 158 177 } 159 178 … … 165 184 { 166 185 e->echochar=ch; 167 } 168 169 WINDOW *owl_editwin_get_curswin(owl_editwin *e) 170 { 171 return(e->curswin); 186 oe_dirty(e); 172 187 } 173 188 … … 239 254 e->lock=e->bufflen; 240 255 oe_set_index(e, e->lock); 241 o wl_editwin_redisplay(e);256 oe_dirty(e); 242 257 } 243 258 … … 265 280 266 281 owl_free(e->buff); 267 _owl_editwin_init(e, e-> curswin, e->winlines, e->wincols, e->style, e->hist);282 _owl_editwin_init(e, e->winlines, e->wincols, e->style, e->hist); 268 283 269 284 if (lock > 0) { … … 286 301 { 287 302 e->topindex = -1; 303 oe_dirty(e); 288 304 } 289 305 … … 467 483 468 484 oe_restore_excursion(e, &x); 469 } 470 471 static void oe_addnec(owl_editwin *e, int count) 485 oe_dirty(e); 486 } 487 488 static void oe_addnec(owl_editwin *e, WINDOW *curswin, int count) 472 489 { 473 490 int i; 474 491 475 492 for (i = 0; i < count; i++) 476 waddch( e->curswin, e->echochar);477 } 478 479 static void oe_mvaddnec(owl_editwin *e, int y, int x, int count)480 { 481 wmove( e->curswin, y, x);482 oe_addnec(e, c ount);493 waddch(curswin, e->echochar); 494 } 495 496 static void oe_mvaddnec(owl_editwin *e, WINDOW *curswin, int y, int x, int count) 497 { 498 wmove(curswin, y, x); 499 oe_addnec(e, curswin, count); 483 500 } 484 501 485 502 /* regenerate the text on the curses window */ 486 void owl_editwin_redisplay(owl_editwin *e)503 static void oe_redisplay(owl_window *win, WINDOW *curswin, void *user_data) 487 504 { 488 505 int x = -1, y = -1, t, hard; 489 506 int line, index, lineindex, times = 0; 507 owl_editwin *e = user_data; 490 508 491 509 do { 492 werase( e->curswin);510 werase(curswin); 493 511 494 512 if (e->topindex == -1 || e->index < e->topindex) … … 505 523 if (index - lineindex) { 506 524 if (!e->echochar) 507 mvwaddnstr( e->curswin, line, 0,525 mvwaddnstr(curswin, line, 0, 508 526 e->buff + lineindex, 509 527 index - lineindex); 510 528 else { 511 529 if(lineindex < e->lock) { 512 mvwaddnstr( e->curswin, line, 0,530 mvwaddnstr(curswin, line, 0, 513 531 e->buff + lineindex, 514 532 MIN(index - lineindex, 515 533 e->lock - lineindex)); 516 534 if (e->lock < index) 517 oe_addnec(e, 535 oe_addnec(e, curswin, 518 536 oe_region_width(e, e->lock, index, 519 537 oe_region_width(e, lineindex, e->lock, 0))); 520 538 } else 521 oe_mvaddnec(e, line, 0, oe_region_width(e, lineindex, index, 0));539 oe_mvaddnec(e, curswin, line, 0, oe_region_width(e, lineindex, index, 0)); 522 540 } 523 541 if (!hard) 524 waddch( e->curswin, '\\');542 waddch(curswin, '\\'); 525 543 } 526 544 line++; … … 531 549 } while(x == -1 && times < 3); 532 550 533 wmove( e->curswin, y, x);551 wmove(curswin, y, x); 534 552 e->cursorx = x; 535 owl_global_set_needrefresh(&g);536 553 } 537 554 … … 625 642 if (start <= e->topindex) 626 643 owl_editwin_recenter(e); 644 645 oe_dirty(e); 627 646 628 647 return change; … … 858 877 859 878 e->goal_column = goal_column; 879 oe_dirty(e); 860 880 861 881 return distance; … … 1212 1232 return; 1213 1233 } 1214 owl_editwin_redisplay(e);1215 1234 } 1216 1235 … … 1347 1366 } 1348 1367 1368 static void oe_dirty(owl_editwin *e) 1369 { 1370 if (e->win) owl_window_dirty(e->win); 1371 } 1372 1349 1373 1350 1374 -
functions.c
r4e33cb2 rf6fae8d 1262 1262 touchwin(owl_global_get_curs_recwin(&g)); 1263 1263 touchwin(owl_global_get_curs_sepwin(&g)); 1264 touchwin(owl_global_get_curs_typwin(&g));1265 1264 touchwin(owl_global_get_curs_msgwin(&g)); 1266 1265 … … 1559 1558 { 1560 1559 owl_global_set_typwin_lines(&g, newsize); 1561 owl_ global_set_relayout_pending(&g);1560 owl_mainpanel_layout_contents(&g.mainpanel); 1562 1561 } 1563 1562 … … 1914 1913 1915 1914 owl_editwin_insert_string(tw, line); 1916 owl_editwin_redisplay(tw);1917 1915 1918 1916 owl_global_push_context(&g, OWL_CTX_EDITLINE, tw, "editline"); … … 1941 1939 1942 1940 owl_editwin_set_locktext(tw, line); 1943 1944 owl_editwin_redisplay(tw);1945 1941 1946 1942 owl_global_push_context(&g, OWL_CTX_EDITRESPONSE, tw, "editresponse"); -
global.c
rd2a4534 rf6fae8d 158 158 159 159 void _owl_global_setup_windows(owl_global *g) { 160 int cols, typwin_lines,recwinlines;160 int cols, recwinlines; 161 161 162 162 cols=g->cols; 163 typwin_lines=owl_global_get_typwin_lines(g);164 163 165 164 recwinlines = owl_global_get_recwin_lines(g); … … 169 168 _owl_panel_set_window(&g->seppan, newwin(1, cols, recwinlines, 0)); 170 169 _owl_panel_set_window(&g->msgpan, newwin(1, cols, recwinlines+1, 0)); 171 _owl_panel_set_window(&g->typpan, newwin(typwin_lines, cols, recwinlines+2, 0));172 173 if (g->tw)174 owl_editwin_set_curswin(g->tw, owl_global_get_curs_typwin(g), typwin_lines, g->cols);175 176 wmove(owl_global_get_curs_typwin(g), 0, 0);177 170 } 178 171 … … 306 299 } 307 300 308 WINDOW*owl_global_get_curs_typwin(const owl_global *g) {309 return panel_window(g->typpan);301 owl_window *owl_global_get_curs_typwin(const owl_global *g) { 302 return g->mainpanel.typwin; 310 303 } 311 304 … … 361 354 owl_function_resize_typwin(owl_global_get_typwin_lines(g) + d); 362 355 356 if (g->typwin_erase_id) { 357 g_signal_handler_disconnect(owl_global_get_curs_typwin(g), g->typwin_erase_id); 358 g->typwin_erase_id = 0; 359 } 360 363 361 g->tw = owl_editwin_new(owl_global_get_curs_typwin(g), 364 362 owl_global_get_typwin_lines(g), … … 366 364 style, 367 365 hist); 366 owl_window_set_cursor(owl_global_get_curs_typwin(g)); 368 367 return g->tw; 369 368 } … … 374 373 owl_function_resize_typwin(owl_global_get_typwin_lines(g) - d); 375 374 376 werase(owl_global_get_curs_typwin(g)); 375 if (!g->typwin_erase_id) { 376 g->typwin_erase_id = 377 g_signal_connect(owl_global_get_curs_typwin(g), "redraw", G_CALLBACK(owl_window_erase_cb), NULL); 378 } 379 owl_window_dirty(owl_global_get_curs_typwin(g)); 380 /* owl_window_set_cursor(owl_global_get_curs_sepwin(g)); */ 381 377 382 g->tw = NULL; 378 owl_global_set_needrefresh(g);379 383 } 380 384 … … 494 498 495 499 owl_function_debugmsg("New size is %i lines, %i cols.", g->lines, g->cols); 496 owl_global_set_relayout_pending(g);497 500 } 498 501 … … 517 520 owl_mainwin_redisplay(&(g->mw)); 518 521 sepbar(NULL); 519 if (g->tw)520 owl_editwin_redisplay(g->tw);521 else522 werase(owl_global_get_curs_typwin(g));523 522 524 523 owl_function_full_redisplay(); -
owl.c
ra57f87a rf6fae8d 468 468 /* these are here in case a relayout changes the windows */ 469 469 WINDOW *sepwin = owl_global_get_curs_sepwin(&g); 470 owl_window *typwin = owl_global_get_curs_typwin(&g); 471 472 /* leave the cursor in the appropriate window */ 470 471 /* move the cursor to unmanaged window if necessary */ 473 472 if (!owl_popwin_is_active(owl_global_get_popwin(&g)) 474 473 && owl_global_get_typwin(&g)) { 475 owl_function_set_cursor(typwin);474 /* owl_function_set_cursor(typwin); */ 476 475 } else { 477 476 owl_function_set_cursor(sepwin); -
owl.h
rd2a4534 rf6fae8d 576 576 WINDOW *input_pad; 577 577 owl_mainpanel mainpanel; 578 PANEL *recpan, *seppan, *msgpan, *typpan; 578 gulong typwin_erase_id; 579 PANEL *recpan, *seppan, *msgpan; 579 580 int needrefresh; 580 581 int rightshift; -
variable.c
rd544237 rf6fae8d 400 400 int rv; 401 401 rv = owl_variable_int_set_default(v, newval); 402 if (0 == rv) owl_ global_set_relayout_pending(&g);402 if (0 == rv) owl_mainpanel_layout_contents(&g.mainpanel); 403 403 return(rv); 404 404 }
Note: See TracChangeset
for help on using the changeset viewer.