exposurses

Check-in [4cc8e33f3c]
Login

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

Overview
Comment:Ignore selection of OVER/UNDER in shutter/aperture menus Since this seems easier than trying to prevent selection.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 4cc8e33f3c9fdaff2714a8b807bf794125b0c15368eb2ac98f7c2eacd70fe3cc
User & Date: base@atomicules.co.uk 2013-09-18 12:49:36
Original User & Date: base@atomicules.co.uk 2013-09-18 12:49:37
Context
2013-09-18
12:49
Split out ITEM creation into separate func so can clean on exit I still hadn't got things quite right from when I'd split out the menu and window creation functions. The segfault on exit was due to the item pointers I thought existed not actually existing. Need to make sure they exist as expected as otherwise I can't free up the memory, etc. Yay, pretty much done. check-in: d39151ac51 user: base@atomicules.co.uk tags: origin/master, trunk
12:49
Ignore selection of OVER/UNDER in shutter/aperture menus Since this seems easier than trying to prevent selection. check-in: 4cc8e33f3c user: base@atomicules.co.uk tags: origin/master, trunk
12:48
Add under/over exposure indication in to the shutter/aperture menus Keeping the NULLs in makes array indices very confusing, but this seems to be the right thing to do. check-in: 7312ab2b6f user: base@atomicules.co.uk tags: origin/master, trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to exposurses.c.

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