Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Split out ITEM creation into separate func so can clean on exit
I still hadn't got things quite right from when I'd split out the menu Need to make sure they exist as expected as otherwise I can't free up Yay, pretty much done. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d39151ac51fec3bbda902321dafae51d |
User & Date: | base@atomicules.co.uk 2013-09-18 12:49:37 |
2013-09-18
| ||
12:49 | Clean up comments check-in: 946bdcbbb6 user: base@atomicules.co.uk tags: origin/master, trunk | |
12:49 |
Split out ITEM creation into separate func so can clean on exit
I still hadn't got things quite right from when I'd split out the menu Need to make sure they exist as expected as otherwise I can't free up Yay, pretty much done. check-in: d39151ac51 user: base@atomicules.co.uk tags: origin/master, trunk | |
12:49 |
Ignore selection of OVER/UNDER in shutter/aperture menus
Since this seems easier than trying to prevent selection. check-in: 4cc8e33f3c user: base@atomicules.co.uk tags: origin/master, trunk | |
Changes to exposurses.c.
︙ | ︙ | |||
89 90 91 92 93 94 95 | WINDOW *iso_win; WINDOW *shutter_win; WINDOW *aperture_win; void selection(char *name); void remove_menu(ITEM **items, MENU *men, int n); void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); | | > | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | WINDOW *iso_win; WINDOW *shutter_win; WINDOW *aperture_win; void selection(char *name); void remove_menu(ITEM **items, MENU *men, int n); void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); MENU *add_menu(ITEM **items); WINDOW *add_window(int xpos, char *title); ITEM **add_item(char **array, int n); int exposure(int iso); double shutter(int exposure, double aperture); double aperture(int exposure, double shutter); int nearest_match(double x, int menu, int n_array); double fraction_to_double(char *fraction); /* No one will ever need more than 9 bytes! */ char exposure_sel[9] = ""; |
︙ | ︙ | |||
129 130 131 132 133 134 135 | /* Create items */ /* Can't really avoid finding array sizes here */ n_exposure = ARRAY_SIZE(exposure_array); n_iso = ARRAY_SIZE(iso_array); n_shutter = ARRAY_SIZE(shutter_array); n_aperture = ARRAY_SIZE(aperture_array); | > > > > | | | | | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | /* Create items */ /* Can't really avoid finding array sizes here */ n_exposure = ARRAY_SIZE(exposure_array); n_iso = ARRAY_SIZE(iso_array); n_shutter = ARRAY_SIZE(shutter_array); n_aperture = ARRAY_SIZE(aperture_array); exposure_items = add_item(exposure_array, n_exposure); iso_items = add_item(iso_array, n_iso); aperture_items = add_item(aperture_array, n_aperture); shutter_items = add_item(shutter_array, n_shutter); exposure_menu = add_menu(exposure_items); iso_menu = add_menu(iso_items); shutter_menu = add_menu(shutter_items); aperture_menu = add_menu(aperture_items); exposure_win = add_window(4, "EV"); iso_win = add_window(45, "ISO"); shutter_win = add_window(86, "Shutter"); aperture_win = add_window(127, "Aperture"); /* Don't know how to avoid the repition below */ set_menu_win(exposure_menu, exposure_win); set_menu_win(iso_menu, iso_win); |
︙ | ︙ | |||
297 298 299 300 301 302 303 | remove_menu(exposure_items, exposure_menu, n_exposure); remove_menu(iso_items, iso_menu, n_iso); remove_menu(shutter_items, shutter_menu, n_shutter); remove_menu(aperture_items, aperture_menu, n_aperture); endwin(); } | > > | | | | | > > > > > > | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | remove_menu(exposure_items, exposure_menu, n_exposure); remove_menu(iso_items, iso_menu, n_iso); remove_menu(shutter_items, shutter_menu, n_shutter); remove_menu(aperture_items, aperture_menu, n_aperture); endwin(); } /* Below pointer configuration figured out from: * https://github.com/Yurickh/Psycho-Tetris/blob/master/src/menu.c#L9 */ ITEM **add_item(char **array, int n) { int i; ITEM **local_items; local_items = (ITEM **)calloc(n, sizeof(ITEM *)); for(i = 0; i<n; ++i) { local_items[i] = new_item(array[i], array[i]); set_item_userptr(local_items[i], selection); } return local_items; } MENU *add_menu(ITEM **items) { MENU *local_menu; local_menu = new_menu((ITEM **)items); set_menu_format(local_menu, 5, 1); set_menu_mark(local_menu, " * "); return local_menu; } WINDOW *add_window(int xpos, char *title) { |
︙ | ︙ |