Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | 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. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c2741c67e786c6913fc647bd699e16a1 |
User & Date: | base@atomicules.co.uk 2013-09-18 11:01:38 |
Original User & Date: | base@atomicules.co.uk 2013-09-18 11:01:39 |
2013-09-18
| ||
11:01 |
Fix menu numbering (from adding exposure menu in)
Didn't change functionality (it was still working), but just gives | |
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 | |
Changes to exposurses.c.
︙ | ︙ | |||
86 87 88 89 90 91 92 | 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); | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | 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(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] = ""; |
︙ | ︙ | |||
129 130 131 132 133 134 135 | 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); | | | | | | > > > > > > > > > > > > > > > | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | 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(4, "EV"); iso_win = add_window(45, "ISO"); shutter_win = add_window(86, "Shutter"); aperture_win = add_window(127, "Aperture"); set_menu_win(exposure_menu, exposure_win); set_menu_win(iso_menu, iso_win); set_menu_win(shutter_menu, shutter_win); set_menu_win(aperture_menu, aperture_win); set_menu_sub(exposure_menu, derwin(exposure_win, 6, 38, 3, 1)); set_menu_sub(iso_menu, derwin(iso_win, 6, 38, 3, 1)); set_menu_sub(shutter_menu, derwin(shutter_win, 6, 38, 3, 1)); set_menu_sub(aperture_menu, derwin(aperture_win, 6, 38, 3, 1)); post_menu(exposure_menu); post_menu(iso_menu); post_menu(shutter_menu); post_menu(aperture_menu); wrefresh(exposure_win); wrefresh(iso_win); wrefresh(shutter_win); wrefresh(aperture_win); 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(); |
︙ | ︙ | |||
274 275 276 277 278 279 280 | 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, " * "); | < | < < < | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | 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, " * "); return local_menu; } WINDOW *add_window(int xpos, char *title) { WINDOW *local_win; local_win = newwin(10, 40, 4, xpos); keypad(local_win, TRUE); 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); return local_win; } void remove_menu(ITEM **items, MENU *men, int n) { int i; unpost_menu(men); |
︙ | ︙ |