exposurses

Check-in [dd2fc74444]
Login

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

Overview
Comment:Learning notes and better forced refreshing of menus - Add learning notes - Use scroll page up/down and item up/down to force refresh and stop two items showing as selected
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: dd2fc74444d301def5f9d3abad291abca49ab29fb36b98a473ad0fe26de652aa
User & Date: base@atomicules.co.uk 2013-09-02 14:32:56
Context
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
2013-09-02
14:32
Learning notes and better forced refreshing of menus - Add learning notes - Use scroll page up/down and item up/down to force refresh and stop two items showing as selected check-in: dd2fc74444 user: base@atomicules.co.uk tags: origin/master, trunk
13:27
Enable exit key, change help text to suit check-in: 2dc1212485 user: base@atomicules.co.uk tags: origin/master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to exposurses.c.

1
2
3
4
5
6
7

8
9
10
11
12
13
14
...
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
...
218
219
220
221
222
223
224

225
226
227
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
257
258
259
260


261
262
263
264
265
266
267
/* 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",
	"400",
................................................................................
	attroff(COLOR_PAIR(2));
	refresh();

	/* set default menu */
	menu = &iso_menu;
	win = &iso_win;

	while((c = getch()) != 81) {
		switch(c) {
			case KEY_LEFT:
				if (menu_counter > 1)
					menu_counter -= 1;
				switch(menu_counter) {
					case 1:
						menu = &iso_menu;
................................................................................
				break;
			case 10: { /* ENTER */
				ITEM *cur;
				void (*p)(char *);

				cur = current_item(*menu);
				p = item_userptr(cur);

				p((char *)item_name(cur));
				pos_menu_cursor(*menu);

				if (selection_counter == 0) {
					 menu_sel_last = menu_counter;
					 selection_counter += 1;
				}
				if (menu_counter != menu_sel_last)
					 selection_counter += 1;
				if (selection_counter == 2) { 
					/* calculate the other menu */
					/* how to get missing menu? */
					if (strcmp("", iso_sel) == 0) {
						/* Test searching for item in menu */
						set_menu_pattern(iso_menu, "200");
						/* Using menu_driver to go up/down to force refresh */
						menu_driver(iso_menu, REQ_DOWN_ITEM);
						menu_driver(iso_menu, REQ_UP_ITEM);
						wrefresh(iso_win);
					}
					if (strcmp("", shutter_sel) == 0) {
						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(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) {


						set_menu_pattern(
							aperture_menu,
							aperture_array[nearest_match(
								aperture(exposure(atoi(iso_sel)), fraction_to_double(shutter_sel)),
								3
							)]
						);







>







 







|







 







>

<













<







>
>
>













>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
...
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
...
219
220
221
222
223
224
225
226
227

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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/* 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>

/* Learning notes - This is a macro that is expanded (text substitution) before compiling */
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))

char *iso_array[] = {
	"50",
	"100",
	"200",
	"400",
................................................................................
	attroff(COLOR_PAIR(2));
	refresh();

	/* set default menu */
	menu = &iso_menu;
	win = &iso_win;

	while((c = getch()) != 81) { /* 81 is Q */
		switch(c) {
			case KEY_LEFT:
				if (menu_counter > 1)
					menu_counter -= 1;
				switch(menu_counter) {
					case 1:
						menu = &iso_menu;
................................................................................
				break;
			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));


				if (selection_counter == 0) {
					 menu_sel_last = menu_counter;
					 selection_counter += 1;
				}
				if (menu_counter != menu_sel_last)
					 selection_counter += 1;
				if (selection_counter == 2) { 
					/* calculate the other menu */
					/* how to get missing menu? */
					if (strcmp("", iso_sel) == 0) {
						/* Test searching for item in menu */
						set_menu_pattern(iso_menu, "200");

						menu_driver(iso_menu, REQ_DOWN_ITEM);
						menu_driver(iso_menu, REQ_UP_ITEM);
						wrefresh(iso_win);
					}
					if (strcmp("", shutter_sel) == 0) {
						char aperture_sel_[4] = "";
						strncpy(aperture_sel_, aperture_sel+2, 3);
						/* Using menu_driver to go up/down to force refresh and correct highlighting */
						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
							)]
						);