Changeset 2367 for neercs/trunk/src/effects.c
- Timestamp:
- Jun 13, 2008, 1:51:07 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/effects.c
r2362 r2367 14 14 */ 15 15 16 #include <stdio.h> 17 #include <stdlib.h> 18 #include <string.h> 16 19 #include <cucul.h> 17 20 #include <caca.h> 18 #include <stdlib.h> 21 #include <config.h> 22 #include <time.h> 19 23 20 24 #include "neercs.h" … … 76 80 77 81 } 82 83 /* FIXME, make this stuff more configurable */ 84 void draw_status(cucul_canvas_t *cv, struct screen_list *screen_list, int pty) 85 { 86 int x = 0, y = cucul_get_canvas_height(cv) - 1; 87 88 89 cucul_set_color_ansi(cv, CUCUL_BLUE, CUCUL_BLUE); 90 cucul_fill_box(cv, 91 x, y, 92 cucul_get_canvas_width(cv), 1, '#'); 93 94 /* Hour */ 95 { 96 time_t now = time ((time_t *) 0); 97 struct tm *t = localtime(&now); 98 char hour[256]; 99 sprintf(hour, "%02d:%02d", t->tm_hour, t->tm_min); 100 101 cucul_set_color_ansi(cv, CUCUL_LIGHTBLUE, CUCUL_BLUE); 102 cucul_printf(cv, x, y, 103 "["); 104 105 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_BLUE); 106 cucul_printf(cv, x+1, y, 107 hour); 108 cucul_set_color_ansi(cv, CUCUL_LIGHTBLUE, CUCUL_BLUE); 109 cucul_printf(cv, x + strlen(hour) + 1, y, 110 "]"); 111 x += 7; 112 113 } 114 115 /* Window */ 116 { 117 char text[256]; 118 sprintf(text, "%d/%d", pty+1, screen_list->count); 119 x++; 120 cucul_set_color_ansi(cv, CUCUL_LIGHTBLUE, CUCUL_BLUE); 121 cucul_printf(cv, x, y, "Window:"); 122 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_BLUE); 123 cucul_printf(cv, x+8, y, text); 124 x+= 8+strlen(text); 125 } 126 127 /* Window Manager */ 128 { 129 char text[256]; 130 131 switch(screen_list->wm_type) 132 { 133 case WM_CARD: 134 strcpy(text, "card"); 135 break; 136 case WM_HSPLIT: 137 strcpy(text, "hsplit"); 138 break; 139 case WM_VSPLIT: 140 strcpy(text, "vsplit"); 141 break; 142 case WM_FULL: 143 default: 144 strcpy(text, "full"); 145 break; 146 147 } 148 149 x++; 150 cucul_set_color_ansi(cv, CUCUL_LIGHTBLUE, CUCUL_BLUE); 151 cucul_printf(cv, x, y, "WM:"); 152 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_BLUE); 153 cucul_printf(cv, x+4, y, text); 154 x+= 4+strlen(text); 155 } 156 157 /* Help (must be the last one )*/ 158 { 159 char text[256]; 160 sprintf(text, "Help: ctrl-a-h"); 161 x = cucul_get_canvas_width(cv) - strlen(text); 162 163 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_BLUE); 164 cucul_printf(cv, x, y, text); 165 } 166 167 168 } 169 170 171 void draw_help(cucul_canvas_t *cv, struct screen_list *screen_list, int pty) 172 { 173 int w = 60, h = 20; 174 int x = (cucul_get_canvas_width(cv) - w) / 2; 175 int y = (cucul_get_canvas_height(cv) - h) / 2; 176 177 178 cucul_set_color_ansi(cv, CUCUL_BLUE, CUCUL_BLUE); 179 cucul_fill_box(cv, 180 x, y, 181 w, h, '#'); 182 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_BLUE); 183 cucul_draw_cp437_box(cv, 184 x, y, 185 w, h); 186 187 x+=2; 188 y++; 189 cucul_printf(cv, (cucul_get_canvas_width(cv) - strlen(PACKAGE_STRING)) / 2, y-1, PACKAGE_STRING); 190 cucul_printf(cv, x, y++, "Copyright (c) 2006-2008 "); 191 cucul_printf(cv, x, y++, " Sam Hocevar <sam@zoy.org>"); 192 cucul_printf(cv, x, y++, " Jean-Yves Lamoureux <jylam@lnxscene.org>"); 193 cucul_printf(cv, x, y++, ""); 194 cucul_printf(cv, x, y++, ""); 195 cucul_printf(cv, x, y++, "All shortcuts are in format 'ctrl-a-X' where X is :"); 196 197 cucul_printf(cv, x, y++, "c:\t Create a new window"); 198 cucul_printf(cv, x, y++, "n:\t Next window"); 199 cucul_printf(cv, x, y++, "p:\t Previous window"); 200 cucul_printf(cv, x, y++, "w:\t Switch window manager"); 201 cucul_printf(cv, x, y++, "c:\t Create new window"); 202 cucul_printf(cv, x, y++, "m:\t Thumbnails"); 203 cucul_printf(cv, x, y++, "h:\t This help"); 204 }
Note: See TracChangeset
for help on using the changeset viewer.