Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Makes the basic menu interaction work (select 2, set other)
Track the selected values, but for now still do the dummy row shift |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
10d5131043c1de03c377b5892e7a556d |
User & Date: | base@atomicules.co.uk 2013-08-25 21:50:00 |
Context
2013-08-25
| ||
22:02 | Whitespace / retabbing changes check-in: de652712ec user: base@atomicules.co.uk tags: origin/master, trunk | |
21:50 |
Makes the basic menu interaction work (select 2, set other)
Track the selected values, but for now still do the dummy row shift | |
2013-08-24
| ||
15:53 | Whitespace changes for consistent formatting check-in: 8669035245 user: base@atomicules.co.uk tags: origin/master, trunk | |
Changes
Changes to exposurses.c.
︙ | ︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 | void selection(char *name); void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); int exposure(int iso); int selection_counter; double shutter(int exposure, int aperture); double aperture(int exposure, int shutter); int main() { int c; MENU **menu; WINDOW **win; int n_iso, i; int n_shutter, j; int n_aperture, k; | > > > > > < < | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | void selection(char *name); void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); int exposure(int iso); int selection_counter; double shutter(int exposure, int aperture); double aperture(int exposure, int shutter); char iso_sel[5] = ""; char shutter_sel[7] = ""; char aperture_sel[6] = ""; int menu_counter = 1; int main() { int c; MENU **menu; WINDOW **win; int n_iso, i; int n_shutter, j; int n_aperture, k; int menu_sel_last; selection_counter = 0; /* Initialize curses */ initscr(); start_color(); cbreak(); noecho(); |
︙ | ︙ | |||
207 208 209 210 211 212 213 | case KEY_DOWN: menu_driver(*menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(*menu, REQ_UP_ITEM); break; case 10: { /* ENTER */ | > > | > > > > > > > | > > > > > | < > | > | < < > > > > > | > > | | > > > > > > | | | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | case KEY_DOWN: menu_driver(*menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(*menu, REQ_UP_ITEM); break; case 10: { /* ENTER */ ITEM *cur; void (*p)(char *); cur = current_item(*menu); p = item_userptr(cur); p((char *)item_name(cur)); pos_menu_cursor(*menu); if (selection_counter == 0) { menu_sel_last = menu_counter; selection_counter += 1; } if (menu_counter != menu_sel_last) selection_counter += 1; if (selection_counter == 2) { /* calculate the other menu */ /* how to get missing menu? */ if (strcmp("", iso_sel) == 0) { /* Test setting item in menu */ set_top_row(iso_menu, 3); /* This works, but plain refreshing doesn't work properly */ /* But cheating and using menu_driver to go up/down does */ menu_driver(iso_menu, REQ_DOWN_ITEM); menu_driver(iso_menu, REQ_UP_ITEM); wrefresh(iso_win); } if (strcmp("", shutter_sel) == 0) { set_top_row(shutter_menu, 3); menu_driver(shutter_menu, REQ_DOWN_ITEM); menu_driver(shutter_menu, REQ_UP_ITEM); wrefresh(shutter_win); } if (strcmp("", aperture_sel) == 0) { set_top_row(aperture_menu, 3); menu_driver(aperture_menu, REQ_DOWN_ITEM); menu_driver(aperture_menu, REQ_UP_ITEM); wrefresh(aperture_win); } /* clear the selections for next time */ selection_counter = 0; strcpy(iso_sel, ""); strcpy(shutter_sel, ""); strcpy(aperture_sel, ""); break; } break; } } wrefresh(*win); } /* Unpost and free all the memory taken up */ unpost_menu(iso_menu); unpost_menu(shutter_menu); unpost_menu(aperture_menu); |
︙ | ︙ | |||
269 270 271 272 273 274 275 | wattron(win, color); mvwprintw(win, y, x, "%s", string); wattroff(win, color); refresh(); } void selection(char *name) { | | | | | | | | > > > > > | < < < < < < < < < < < < < < | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | wattron(win, color); mvwprintw(win, y, x, "%s", string); wattroff(win, color); refresh(); } void selection(char *name) { switch(menu_counter) { case 1: strcpy(iso_sel, name); break; case 2: strcpy(shutter_sel, name); break; case 3: strcpy(aperture_sel, name); break; break; break; } } int exposure (int iso) { int ev100; ev100 = 15; return ev100 + (log (iso / 100) / log (2)); } |
︙ | ︙ |