Add xterm-256color as a valid terminal.
[eco.git] / view.c
blob21d145367b1cf2a47b5129bb68c4f0c08ba3db2a
1 /*
2 * Copyright (C) 2008 Diego Hernan Borghetti.
3 * Eco
4 */
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
10 #include "term.h"
11 #include "screen.h"
12 #include "buffer.h"
13 #include "view.h"
14 #include "config.h"
17 E_View *e_view_new(E_Screen *sc)
19 E_View *v;
21 v= (E_View *)malloc(sizeof(E_View));
22 v->next= NULL;
23 v->prev= NULL;
25 /* by default, all the screen. */
26 v->row= 0;
27 v->col= 0;
28 v->nrow= sc->nrow;
29 v->ncol= sc->ncol;
30 v->rrow= sc->nrow;
31 v->rcol= sc->ncol;
32 v->b= NULL;
33 v->search[0]= '\0';
35 v->stfg= e_config_get_int("View", "foreground");
36 v->stbg= e_config_get_int("View", "background");
37 if (v->stfg == -1)
38 v->stfg= E_TR_GREEN;
39 if (v->stbg == -1)
40 v->stbg= E_TR_BLACK;
42 v->stbuf[0]= '\0';
43 v->stcol= v->col;
44 v->strow= v->rrow;
45 v->stused= 0;
46 v->stmsg= 0;
47 v->flag= 0;
48 return(v);
51 void e_view_free(E_View *v)
53 free((void *)v);
56 void e_view_move(E_View *v, int row, int col)
58 v->row= row;
59 v->col= col;
60 v->rrow= row + v->nrow;
61 v->rcol= col;
62 v->strow= v->rrow;
63 v->stcol= v->rcol;
64 e_view_redraw(v);
67 void e_view_resize(E_View *v, int nrow, int ncol)
69 v->nrow= nrow;
70 v->ncol= ncol;
71 v->rrow= v->row + nrow;
72 v->rcol= v->col + ncol;
73 v->strow= v->rrow;
74 v->stcol= v->col;
75 e_view_redraw(v);
78 void e_view_redraw(E_View *v)
80 if (!(v->flag & VIEW_REDRAW))
81 v->flag |= VIEW_REDRAW;
84 void e_view_show(E_View *v)
86 if (!(v->flag & VIEW_SHOW))
87 v->flag |= VIEW_SHOW;
90 void e_view_unshow(E_View *v)
92 if (v->flag & VIEW_SHOW)
93 v->flag &= ~VIEW_SHOW;