Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Try separate win and menu functions
instead of trying to wrap everything in one. This way I know I can As opposed to previous attempt where I was (trying) to use variable |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e4268c4b4e059e265512870413710185 |
User & Date: | base@atomicules.co.uk 2013-09-18 11:01:28 |
2013-09-18
| ||
11:01 |
Make the add_menu and add_win subs work
I was still using the "variable pointers" technique, well trying to, and Seg faults on exit, but haven't fixed that bit yet. check-in: c2741c67e7 user: base@atomicules.co.uk tags: origin/master, trunk | |
11:01 |
Try separate win and menu functions
instead of trying to wrap everything in one. This way I know I can As opposed to previous attempt where I was (trying) to use variable | |
10:44 |
Add debug options to Makefile
Not as simple as adding `-g` option as also need to ensure not calling Decided to change so have a `make` and a `make debug` check-in: 86fd753f70 user: base@atomicules.co.uk tags: origin/master, trunk | |
Changes to exposurses.c.
︙ | ︙ | |||
83 84 85 86 87 88 89 | MENU *aperture_menu; WINDOW *exposure_win; WINDOW *iso_win; WINDOW *shutter_win; WINDOW *aperture_win; void selection(char *name); | < > > | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | MENU *aperture_menu; WINDOW *exposure_win; 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(char **array, ITEM **items, int n); WINDOW *add_window(MENU *men, int xpos, char *title); int exposure(int iso); double shutter(int exposure, double aperture); double aperture(int exposure, double shutter); int nearest_match(double x, int menu); double fraction_to_double(char *fraction); /* No one will ever need more than 9 bytes! */ char exposure_sel[9] = ""; |
︙ | ︙ | |||
124 125 126 127 128 129 130 | /* 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); | | | | | > > > > | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | /* 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_menu = add_menu(exposure_array, exposure_items, n_exposure); iso_menu = add_menu(iso_array, iso_items, n_iso); shutter_menu = add_menu(shutter_array, shutter_items, n_shutter); aperture_menu = add_menu(aperture_array, aperture_items, n_aperture); exposure_win = add_window(exposure_menu, 4, "EV"); iso_win = add_window(iso_menu, 45, "ISO"); shutter_win = add_window(shutter_menu, 86, "Shutter"); aperture_win = add_window(aperture_menu, 127, "Aperture"); attron(COLOR_PAIR(2)); mvprintw(LINES - 2, 0, "Select EV"); /*mvprintw(LINES - 2, 0, "Select ISO and then one of Shutter/Aperture to calculate other of Shutter/Aperture");*/ mvprintw(LINES - 1, 0, "Arrow keys to navigate, Enter to select, Q to exit"); attroff(COLOR_PAIR(2)); refresh(); |
︙ | ︙ | |||
257 258 259 260 261 262 263 | 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(); } | | > | > > > > > > > > > | | | | < < | | | | | < | > | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | 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(); } MENU *add_menu(char **array, ITEM **items, int n) { int i; MENU *local_menu; items = (ITEM **)calloc(n, sizeof(ITEM *)); for(i = 0; i<n; ++i) { items[i] = new_item(array[i], array[i]); set_item_userptr(items[i], selection); } local_menu = new_menu((ITEM **)items); set_menu_format(local_menu, 5, 1); set_menu_mark(local_menu, " * "); post_menu(local_menu); return local_menu; } WINDOW *add_window(MENU *men, int xpos, char *title) { WINDOW *local_win; local_win = newwin(10, 40, 4, xpos); keypad(local_win, TRUE); set_menu_win(*men, local_win); set_menu_sub(*men, derwin(local_win, 6, 38, 3, 1)); box(local_win, 0, 0); print_in_middle(local_win, 1, 0, 40, title, COLOR_PAIR(1)); mvwaddch(local_win, 2, 0, ACS_LTEE); mvwhline(local_win, 2, 1, ACS_HLINE, 38); mvwaddch(local_win, 2, 39, ACS_RTEE); wrefresh(local_win); return local_win; } void remove_menu(ITEM **items, MENU *men, int n) { int i; unpost_menu(men); free_menu(men); |
︙ | ︙ |