Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | WIP on temp: bafe457 For ref |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | trunk | refs/stash |
Files: | files | file ages | folders |
SHA3-256: |
b1a123e70a60723bacb7f9293b3cbe46 |
User & Date: | base@atomicules.co.uk 2013-09-11 21:33:35 |
Context
2013-09-11
| ||
21:33 | WIP on temp: bafe457 For ref Leaf check-in: b1a123e70a user: base@atomicules.co.uk tags: refs/stash, trunk | |
21:33 | index on temp: bafe457 For ref check-in: d2e1d0e68b user: base@atomicules.co.uk tags: refs/stash, trunk | |
2013-09-10
| ||
13:40 | For ref check-in: de620ef542 user: base@atomicules.co.uk tags: refs/stash, trunk | |
Changes
Changes to Makefile.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # exposurses include config.mk SRC = exposurses.c OBJ = ${SRC:.c=.o} all: options exposurses options: @echo build options: @echo "CC = ${CC}" | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # exposurses include config.mk SRC = exposurses.c OBJ = ${SRC:.c=.o} all: options exposurses options: @echo build options: @echo "CC = ${CC}" exposurses: ${OBJ} @echo CC -o $@ @${CC} -s ${LIBS} ${SRC} -o $@ debug: @echo "Building with debug symbols" @${CC} -g ${LIBS} ${SRC} -o exposurses clean: @echo cleaning @rm -f exposurses ${OBJ} |
Changes to config.mk.
1 2 3 4 5 6 7 | # Customize below to fit your system # paths PREFIX = /usr/local MANPREFIX = ${PREFIX}/share/man # includes and libs | < < < < | 1 2 3 4 5 6 7 8 9 10 11 | # Customize below to fit your system # paths PREFIX = /usr/local MANPREFIX = ${PREFIX}/share/man # includes and libs LIBS=-lmenu -lcurses -lm # compiler and linker CC = cc |
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 147 | /* 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); /* http://stackoverflow.com/a/2620158/208793 */ 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(); } | | > | > > > > > > > > > | | | | < < | | | | | < | > | 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 306 | 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); |
︙ | ︙ |