exposurses

Check-in [d4b0749e89]
Login

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

Overview
Comment:Ignore selection of OVER/UNDER
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | temp
Files: files | file ages | folders
SHA3-256: d4b0749e8931c391a1a7e69d71276935416a67d0c082fffc270dfd6f88ad81a4
User & Date: base@atomicules.co.uk 2013-09-15 21:25:57
Context
2013-09-17
22:43
Split out ITEM creation into separate func so can clean on exit As otherwise can't free up the memory, etc. This makes clean up work Yay, pretty much done. Leaf check-in: cf92beadf9 user: base@atomicules.co.uk tags: trunk, temp
2013-09-15
21:25
Ignore selection of OVER/UNDER check-in: d4b0749e89 user: base@atomicules.co.uk tags: trunk, temp
17:22
Add under/over exposure indication in check-in: 216708513b user: base@atomicules.co.uk tags: trunk, temp
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to exposurses.c.

   193    193   				void (*p)(char *);
   194    194   
   195    195   				cur = current_item(*menu);
   196    196   				p = item_userptr(cur);
   197    197   				/* Learning notes - Don't understand this bit */
   198    198   				/* Is this a function pointer? */
   199    199   				p((char *)item_name(cur));
   200         -				
   201         -				switch (selection_counter) {
   202         -					case 1: { /* Exposure selected */
   203         -						selection_counter += 1;
   204         -						menu_counter += 1;
   205         -						move(LINES - 2, 0);
   206         -						clrtoeol();
   207         -						mvprintw(LINES - 2, 0, "Select ISO");
   208         -						refresh();
   209         -						menu = &iso_menu;
   210         -						win = &iso_win;
   211         -					}
   212         -					break;
   213         -					case 2: { /* ISO Selected */
   214         -						selection_counter += 1;
   215         -						menu_counter += 1;
   216         -						move(LINES - 2, 0);
   217         -						clrtoeol();
   218         -						mvprintw(LINES - 2, 0, "Select Shutter or Aperture");
   219         -						refresh();
   220         -						menu = &shutter_menu;
   221         -						win = &shutter_win;
   222         -					}
   223         -					break;
   224         -					case 3: { /* Shutter or Aperture selected */
   225         -						if (strcmp("", shutter_sel) == 0) {
   226         -							char aperture_sel_[4] = "";
   227         -							strncpy(aperture_sel_, aperture_sel+2, 3);
   228         -							/* Using menu_driver to go up/down to force refresh and correct highlighting */
   229         -							menu_driver(shutter_menu, REQ_SCR_UPAGE);
   230         -							menu_driver(shutter_menu, REQ_SCR_DPAGE);
   231         -							/* There is probably a nicer way to format the below */
   232         -							set_menu_pattern(
   233         -								shutter_menu,
   234         -								shutter_array[nearest_match(
   235         -									shutter(exposure(atoi(iso_sel)), strtod(aperture_sel_, NULL)),
   236         -									3,
   237         -									n_shutter
   238         -								)]
   239         -							);
   240         -							menu_driver(shutter_menu, REQ_DOWN_ITEM);
   241         -							menu_driver(shutter_menu, REQ_UP_ITEM);
   242         -							wrefresh(shutter_win);
          200  +				/* need to igore over/under if selected, probably easier than try to prevent selection */
          201  +				if (!((strcmp("OVER", shutter_sel) == 0)
          202  +						|| (strcmp("UNDER", shutter_sel) == 0) 
          203  +						|| (strcmp("OVER", aperture_sel) == 0) 
          204  +						|| (strcmp("UNDER", aperture_sel) == 0))) {
          205  +					switch (selection_counter) {
          206  +						case 1: { /* Exposure selected */
          207  +							selection_counter += 1;
          208  +							menu_counter += 1;
          209  +							move(LINES - 2, 0);
          210  +							clrtoeol();
          211  +							mvprintw(LINES - 2, 0, "Select ISO");
          212  +							refresh();
          213  +							menu = &iso_menu;
          214  +							win = &iso_win;
          215  +						}
          216  +						break;
          217  +						case 2: { /* ISO Selected */
          218  +							selection_counter += 1;
          219  +							menu_counter += 1;
          220  +							move(LINES - 2, 0);
          221  +							clrtoeol();
          222  +							mvprintw(LINES - 2, 0, "Select Shutter or Aperture");
          223  +							refresh();
          224  +							menu = &shutter_menu;
          225  +							win = &shutter_win;
          226  +						}
          227  +						break;
          228  +						case 3: { /* Shutter or Aperture selected */
          229  +							if (strcmp("", shutter_sel) == 0) {
          230  +								char aperture_sel_[4] = "";
          231  +								strncpy(aperture_sel_, aperture_sel+2, 3);
          232  +								/* Using menu_driver to go up/down to force refresh and correct highlighting */
          233  +								menu_driver(shutter_menu, REQ_SCR_UPAGE);
          234  +								menu_driver(shutter_menu, REQ_SCR_DPAGE);
          235  +								/* There is probably a nicer way to format the below */
          236  +								set_menu_pattern(
          237  +									shutter_menu,
          238  +									shutter_array[nearest_match(
          239  +										shutter(exposure(atoi(iso_sel)), strtod(aperture_sel_, NULL)),
          240  +										3,
          241  +										n_shutter
          242  +									)]
          243  +								);
          244  +								menu_driver(shutter_menu, REQ_DOWN_ITEM);
          245  +								menu_driver(shutter_menu, REQ_UP_ITEM);
          246  +								wrefresh(shutter_win);
          247  +							}
          248  +							if (strcmp("", aperture_sel) == 0) {
          249  +								menu_driver(aperture_menu, REQ_SCR_UPAGE);
          250  +								menu_driver(aperture_menu, REQ_SCR_DPAGE);
          251  +								set_menu_pattern(
          252  +									aperture_menu,
          253  +									aperture_array[nearest_match(
          254  +										aperture(exposure(atoi(iso_sel)), fraction_to_double(shutter_sel)),
          255  +										4,
          256  +										n_aperture
          257  +									)]
          258  +								);
          259  +								menu_driver(aperture_menu, REQ_DOWN_ITEM);
          260  +								menu_driver(aperture_menu, REQ_UP_ITEM);
          261  +								wrefresh(aperture_win);
          262  +							}
          263  +							/* clear the selections for next time */
          264  +							strcpy(iso_sel, "");
          265  +							strcpy(shutter_sel, "");
          266  +							strcpy(aperture_sel, "");
          267  +							/* And set defaults back to start */
          268  +							selection_counter = 1;
          269  +							menu_counter = 1;
          270  +							menu = &exposure_menu;
          271  +							win = &exposure_win;
          272  +							move(LINES - 2, 0);
          273  +							clrtoeol();
          274  +							mvprintw(LINES - 2, 0, "Select EV");
          275  +							refresh();
   243    276   						}
   244         -						if (strcmp("", aperture_sel) == 0) {
   245         -							menu_driver(aperture_menu, REQ_SCR_UPAGE);
   246         -							menu_driver(aperture_menu, REQ_SCR_DPAGE);
   247         -							set_menu_pattern(
   248         -								aperture_menu,
   249         -								aperture_array[nearest_match(
   250         -									aperture(exposure(atoi(iso_sel)), fraction_to_double(shutter_sel)),
   251         -									4,
   252         -									n_aperture
   253         -								)]
   254         -							);
   255         -							menu_driver(aperture_menu, REQ_DOWN_ITEM);
   256         -							menu_driver(aperture_menu, REQ_UP_ITEM);
   257         -							wrefresh(aperture_win);
   258         -						}
   259         -						/* clear the selections for next time */
   260         -						strcpy(iso_sel, "");
   261         -						strcpy(shutter_sel, "");
   262         -						strcpy(aperture_sel, "");
   263         -						/* And set defaults back to start */
   264         -						selection_counter = 1;
   265         -						menu_counter = 1;
   266         -						menu = &exposure_menu;
   267         -						win = &exposure_win;
   268         -						move(LINES - 2, 0);
   269         -						clrtoeol();
   270         -						mvprintw(LINES - 2, 0, "Select EV");
   271         -						refresh();
          277  +						break;
   272    278   					}
   273         -					break;
          279  +				}
          280  +				/* If over/under need to clear selection so know which is blank
          281  +				 * when a proper selection is made */
          282  +				if ((strcmp("OVER", shutter_sel) == 0) || (strcmp("UNDER", shutter_sel) == 0)) {
          283  +					strcpy(shutter_sel, "");
          284  +				}
          285  +				if ((strcmp("OVER", aperture_sel) == 0) || (strcmp("UNDER", aperture_sel) == 0)) {
          286  +					strcpy(aperture_sel, "");
   274    287   				}
   275    288   			}
   276    289   			break;
   277    290   		}
   278    291   		wrefresh(*win);
   279    292   	}	
   280    293   	/* Unpost and free all the memory taken up */