Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch temp2 Excluding Merge-Ins
This is equivalent to a diff from 580afe6ab4 to b786f69eac
2013-09-18
| ||
10:33 |
For ref: Try wrapping menu and window creation in single function
Got this so it drew everything ok, but segfaults as soon as a key is | |
2013-09-12
| ||
12:02 |
For ref: That should have always been a pointer
Although this version still no worky Leaf check-in: b786f69eac user: base@atomicules.co.uk tags: temp2, trunk | |
2013-09-11
| ||
21:44 | Add debug options to Makefile check-in: 095cfb3932 user: base@atomicules.co.uk tags: temp2, trunk | |
21:41 | For ref: Wrap menu and window creation in function check-in: 284f5d1a81 user: base@atomicules.co.uk tags: temp2, trunk | |
2013-09-10
| ||
13:40 | For ref check-in: de620ef542 user: base@atomicules.co.uk tags: refs/stash, trunk | |
08:51 |
Make exposure menu functional
- Make it function so that user is constrained to exposure menu This is not very pretty: - I don't like having both the selection_counter and menu_counter. Seems | |
2013-09-03
| ||
12:38 |
Add in EV menu, doesn't function yet though
- Add in free memory bits, also missed some for the other menus check-in: 6c315c3200 user: base@atomicules.co.uk tags: origin/master, trunk | |
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 90 91 92 93 94 95 96 | MENU *aperture_menu; WINDOW *exposure_win; WINDOW *iso_win; WINDOW *shutter_win; WINDOW *aperture_win; void selection(char *name); void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color); 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! */ | > > | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | MENU *aperture_menu; WINDOW *exposure_win; WINDOW *iso_win; WINDOW *shutter_win; WINDOW *aperture_win; void selection(char *name); void add_menu(char **array, ITEM **items, MENU *men, WINDOW *win, int n, int xpos, char *title); 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); 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! */ |
︙ | ︙ | |||
117 118 119 120 121 122 123 | cbreak(); noecho(); keypad(stdscr, TRUE); init_pair(1, COLOR_RED, COLOR_BLACK); init_pair(2, COLOR_CYAN, COLOR_BLACK); /* Create items */ | | < < < < < < < < < < < < < < < < < < < < | < < < < < | < < < < < < < < < | < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | cbreak(); noecho(); keypad(stdscr, TRUE); init_pair(1, COLOR_RED, COLOR_BLACK); init_pair(2, COLOR_CYAN, COLOR_BLACK); /* 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); add_menu(exposure_array, exposure_items, exposure_menu, exposure_win, n_exposure, 4, "EV"); add_menu(iso_array, iso_items, iso_menu, iso_win, n_iso, 45, "ISO"); add_menu(shutter_array, shutter_items, shutter_menu, shutter_win, n_shutter, 86, "Shutter"); add_menu(aperture_array, aperture_items, aperture_menu, aperture_win, n_aperture, 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(); |
︙ | ︙ | |||
251 252 253 254 255 256 257 258 259 260 261 262 263 264 | case 10: { /* ENTER */ ITEM *cur; void (*p)(char *); cur = current_item(*menu); p = item_userptr(cur); /* Learning notes - Don't understand this bit */ p((char *)item_name(cur)); switch (selection_counter) { case 1: { /* Exposure selected */ selection_counter += 1; menu_counter += 1; move(LINES - 2, 0); | > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | case 10: { /* ENTER */ ITEM *cur; void (*p)(char *); cur = current_item(*menu); p = item_userptr(cur); /* Learning notes - Don't understand this bit */ /* Is this a function pointer? */ p((char *)item_name(cur)); switch (selection_counter) { case 1: { /* Exposure selected */ selection_counter += 1; menu_counter += 1; move(LINES - 2, 0); |
︙ | ︙ | |||
331 332 333 334 335 336 337 | } } break; } wrefresh(*win); } /* Unpost and free all the memory taken up */ | | | | | | > | | > | > | | > > | > > > > > > > > > > > > > > | > > | > | | | < | 250 251 252 253 254 255 256 257 258 259 260 261 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 | } } break; } wrefresh(*win); } /* Unpost and free all the memory taken up */ 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(); } void add_menu(char **array, ITEM **items, MENU *men, WINDOW *win, int n, int xpos, char *title) { int i; 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); } men = new_menu((ITEM **)items); win = newwin(10, 40, 4, xpos); keypad(win, TRUE); set_menu_win(men, win); set_menu_sub(men, derwin(win, 6, 38, 3, 1)); set_menu_format(men, 5, 1); set_menu_mark(men, " * "); box(win, 0, 0); print_in_middle(win, 1, 0, 40, title, COLOR_PAIR(1)); mvwaddch(win, 2, 0, ACS_LTEE); mvwhline(win, 2, 1, ACS_HLINE, 38); mvwaddch(win, 2, 39, ACS_RTEE); post_menu(men); wrefresh(win); } void remove_menu(ITEM **items, MENU *men, int n) { int i; unpost_menu(men); free_menu(men); for(i = 0; i < n; ++i) free_item(items[i]); } void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color) { int length, x, y; float temp; if(win == NULL) win = stdscr; |
︙ | ︙ |