Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Actually make it work this time.
See this commit: 8d3e66b5ecffa8bcf7691c3f0600840b934beb1a I'm such an idiot. - Remove `set_top_row` when setting the shutter menu to the correct |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
68919dca2202cbca1c44d4be3035d737 |
User & Date: | base@atomicules.co.uk 2013-09-02 09:29:57 |
2013-09-02
| ||
09:47 |
I am King of Fail
I mean, just how? I think I need a few years more sleep or something check-in: 506ba48833 user: base@atomicules.co.uk tags: origin/master, trunk | |
09:29 |
Actually make it work this time.
See this commit: 8d3e66b5ecffa8bcf7691c3f0600840b934beb1a I'm such an idiot. - Remove `set_top_row` when setting the shutter menu to the correct | |
2013-08-31
| ||
07:50 |
Try to standardise on a string length
Since it doesn't matter if it's longer. | |
Changes to exposurses.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* This file based on menu_scroll.c from: http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/intro.html */ #include <curses.h> #include <menu.h> #include <math.h> #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) char *iso_array[] = { "50", "100", "200", | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* This file based on menu_scroll.c from: http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/intro.html */ #include <curses.h> #include <menu.h> #include <math.h> #include <stdlib.h> #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) char *iso_array[] = { "50", "100", "200", |
︙ | ︙ | |||
245 246 247 248 249 250 251 | /* Test finding nearest matching value in array? */ char aperture_sel_[4] = ""; strncpy(aperture_sel_, aperture_sel+2, 3); /* There is probably a nicer way to format the below */ set_menu_pattern( shutter_menu, shutter_array[nearest_match( | | < | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | /* Test finding nearest matching value in array? */ char aperture_sel_[4] = ""; strncpy(aperture_sel_, aperture_sel+2, 3); /* There is probably a nicer way to format the below */ set_menu_pattern( shutter_menu, shutter_array[nearest_match( shutter(strtod(aperture_sel_, NULL), exposure(atoi(iso_sel))), 2 )] ); menu_driver(shutter_menu, REQ_DOWN_ITEM); menu_driver(shutter_menu, REQ_UP_ITEM); wrefresh(shutter_win); } if (strcmp("", aperture_sel) == 0) { /* Tests setting to row number */ set_top_row(aperture_menu, 3); |
︙ | ︙ | |||
361 362 363 364 365 366 367 | array_value_db = fraction_to_double(shutter_array[0]); break; case 3: strncpy(array_value_str, aperture_array[0]+2, 3); array_value_db = strtod(array_value_str, NULL); break; } | | | | | | | | | | | | > > > > > | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | array_value_db = fraction_to_double(shutter_array[0]); break; case 3: strncpy(array_value_str, aperture_array[0]+2, 3); array_value_db = strtod(array_value_str, NULL); break; } diff = fabs(array_value_db - x); /* lots of repetition here but pointers to arrays seem to be a bad thing */ switch(menu) { case 1: for ( n = 1; iso_array[n] != NULL; ++n ) { array_value_db = strtod(iso_array[n], NULL); if (fabs(array_value_db - x) < diff) { diff_idx = n; diff = fabs(array_value_db - x); } } break; case 2: for ( n = 1; shutter_array[n] != NULL; ++n ) { array_value_db = fraction_to_double(shutter_array[n]); if (fabs(array_value_db - x) < diff) { diff_idx = n; diff = fabs(array_value_db - x); } } break; case 3: for ( n = 1; aperture_array[n] != NULL; ++n ) { strncpy(array_value_str, aperture_array[0]+2, 3); array_value_db = strtod(array_value_str, NULL); if (fabs(array_value_db - x) < diff) { diff_idx = n; diff = fabs(array_value_db - x); } } break; } return diff_idx; } double fraction_to_double(char *fraction) { double fraction_as_db; char denominator[9]; char *ptr = strstr(fraction, "/"); if (ptr) { /*then split*/ strncpy(denominator, fraction+2, 5); fraction_as_db = 1 / strtod(denominator, NULL); } else { fraction_as_db = strtod(fraction, NULL); } return fraction_as_db; } /* Debug lines * sprintf(temp, "%f", x); * mvprintw(LINES - 4, 0, temp); * refresh();*/ |