exposurses

Check-in [b12e9bb5c7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix menu numbering (from adding exposure menu in)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | temp
Files: files | file ages | folders
SHA3-256: b12e9bb5c7e06780e5eb6d07d564a14242baf7bcd8fe5855b75f9127185d8f69
User & Date: base@atomicules.co.uk 2013-09-13 09:31:26
Context
2013-09-15
17:22
Add under/over exposure indication in check-in: 216708513b user: base@atomicules.co.uk tags: trunk, temp
2013-09-13
09:31
Fix menu numbering (from adding exposure menu in) check-in: b12e9bb5c7 user: base@atomicules.co.uk tags: trunk, temp
2013-09-12
11:59
Make the add_menu and add_win subs work Seg faults on exit, but haven't fixed that bit yet. check-in: ecdc9d9bca user: base@atomicules.co.uk tags: trunk, temp
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to exposurses.c.

134
135
136
137
138
139
140

141
142
143
144
145
146
147
...
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
...
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
423
424
425
426
427
	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));
................................................................................
							menu_driver(shutter_menu, REQ_SCR_UPAGE);
							menu_driver(shutter_menu, REQ_SCR_DPAGE);
							/* There is probably a nicer way to format the below */
							set_menu_pattern(
								shutter_menu,
								shutter_array[nearest_match(
									shutter(exposure(atoi(iso_sel)), strtod(aperture_sel_, NULL)),
									2
								)]
							);
							menu_driver(shutter_menu, REQ_DOWN_ITEM);
							menu_driver(shutter_menu, REQ_UP_ITEM);
							wrefresh(shutter_win);
						}
						if (strcmp("", aperture_sel) == 0) {
							menu_driver(aperture_menu, REQ_SCR_UPAGE);
							menu_driver(aperture_menu, REQ_SCR_DPAGE);
							set_menu_pattern(
								aperture_menu,
								aperture_array[nearest_match(
									aperture(exposure(atoi(iso_sel)), fraction_to_double(shutter_sel)),
									3
								)]
							);
							menu_driver(aperture_menu, REQ_DOWN_ITEM);
							menu_driver(aperture_menu, REQ_UP_ITEM);
							wrefresh(aperture_win);
						}
						/* clear the selections for next time */
................................................................................
	int diff_idx = 0;
	char array_value_str[9];
	double array_value_db;
	double diff;

	/* Need a starting value for difference */
	switch(menu) {
		case 1:
			array_value_db = strtod(iso_array[0], NULL);
			break;
		case 2:
			array_value_db = fraction_to_double(shutter_array[0]);
			break;
		case 3:
			strncpy(array_value_str, aperture_array[0]+2, 4);
			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[n]+2, 4);
				array_value_db = strtod(array_value_str, NULL);
				if (fabs(array_value_db - x) < diff) { 
					diff_idx = n;
					diff = fabs(array_value_db - x);
				}







>







 







|













|







 







|
<
<
<


|







|
<
<
<
<
<
<
<
<
<








|







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
...
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
...
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
	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");
	/* Don't know how to avoid the repition below */
	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));
................................................................................
							menu_driver(shutter_menu, REQ_SCR_UPAGE);
							menu_driver(shutter_menu, REQ_SCR_DPAGE);
							/* There is probably a nicer way to format the below */
							set_menu_pattern(
								shutter_menu,
								shutter_array[nearest_match(
									shutter(exposure(atoi(iso_sel)), strtod(aperture_sel_, NULL)),
									3
								)]
							);
							menu_driver(shutter_menu, REQ_DOWN_ITEM);
							menu_driver(shutter_menu, REQ_UP_ITEM);
							wrefresh(shutter_win);
						}
						if (strcmp("", aperture_sel) == 0) {
							menu_driver(aperture_menu, REQ_SCR_UPAGE);
							menu_driver(aperture_menu, REQ_SCR_DPAGE);
							set_menu_pattern(
								aperture_menu,
								aperture_array[nearest_match(
									aperture(exposure(atoi(iso_sel)), fraction_to_double(shutter_sel)),
									4
								)]
							);
							menu_driver(aperture_menu, REQ_DOWN_ITEM);
							menu_driver(aperture_menu, REQ_UP_ITEM);
							wrefresh(aperture_win);
						}
						/* clear the selections for next time */
................................................................................
	int diff_idx = 0;
	char array_value_str[9];
	double array_value_db;
	double diff;

	/* Need a starting value for difference */
	switch(menu) {
		case 3:



			array_value_db = fraction_to_double(shutter_array[0]);
			break;
		case 4:
			strncpy(array_value_str, aperture_array[0]+2, 4);
			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 3:









			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 4:
			for ( n = 1; aperture_array[n] != NULL; ++n ) {
				strncpy(array_value_str, aperture_array[n]+2, 4);
				array_value_db = strtod(array_value_str, NULL);
				if (fabs(array_value_db - x) < diff) { 
					diff_idx = n;
					diff = fabs(array_value_db - x);
				}