exposurses

Check-in [de652712ec]
Login

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

Overview
Comment:Whitespace / retabbing changes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: de652712ecd154895123b6d9b613ab046b7aef24799818ef306d38dd0b3bae49
User & Date: base@atomicules.co.uk 2013-08-25 22:02:23
Context
2013-08-26
22:02
More whitespace changes (mainly). What the hell?! check-in: a7ef007409 user: base@atomicules.co.uk tags: origin/master, trunk
2013-08-25
22:02
Whitespace / retabbing changes check-in: de652712ec user: base@atomicules.co.uk tags: origin/master, trunk
21:50
Makes the basic menu interaction work (select 2, set other)

Track the selected values, but for now still do the dummy row shift
thing. check-in: 10d5131043 user: base@atomicules.co.uk tags: origin/master, trunk

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to exposurses.c.

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	int c;
	MENU **menu;
	WINDOW **win;
	int n_iso, i;
	int n_shutter, j;
	int n_aperture, k;
	int menu_sel_last;
    selection_counter = 0;

	/* Initialize curses */
	initscr();
	start_color();
	cbreak();
	noecho();
	keypad(stdscr, TRUE);







|







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	int c;
	MENU **menu;
	WINDOW **win;
	int n_iso, i;
	int n_shutter, j;
	int n_aperture, k;
	int menu_sel_last;
	selection_counter = 0;

	/* Initialize curses */
	initscr();
	start_color();
	cbreak();
	noecho();
	keypad(stdscr, TRUE);
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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

	attron(COLOR_PAIR(2));
	mvprintw(LINES - 2, 0, "Use PageUp and PageDown to scoll down or up a page of items");
	mvprintw(LINES - 1, 0, "Arrow Keys to navigate (F1 to Exit)");
	attroff(COLOR_PAIR(2));
	refresh();

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

	while((c = getch())) {
		switch(c) {
			case KEY_LEFT:
                if (menu_counter > 1)
                    menu_counter -= 1;
                switch(menu_counter) {
                    case 1:
                        menu = &iso_menu;
                        win = &iso_win;
                        break;
                    case 2:
                        menu = &shutter_menu;
                        win = &shutter_win;
                        break;
                    case 3:
                        menu = &aperture_menu;
                        win = &aperture_win;
                        break;
                    break;
                }
			    break;
			case KEY_RIGHT:
                if (menu_counter < 3)
                    menu_counter += 1;
                switch(menu_counter) {
                    case 1:
                        menu = &iso_menu;
                        win = &iso_win;
                        break;
                    case 2:
                        menu = &shutter_menu;
                        win = &shutter_win;
                        break;
                    case 3:
                        menu = &aperture_menu;
                        win = &aperture_win;
                        break;
                    break;
                }
				break;
			case KEY_DOWN:
				menu_driver(*menu, REQ_DOWN_ITEM);
	    		break;
			case KEY_UP:
				menu_driver(*menu, REQ_UP_ITEM);
		    	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 setting item in menu */
						set_top_row(iso_menu, 3);
						/* This works, but plain refreshing doesn't work properly */
						/* But cheating and using menu_driver to go up/down does */
						menu_driver(iso_menu, REQ_DOWN_ITEM);
						menu_driver(iso_menu, REQ_UP_ITEM);
						wrefresh(iso_win);
					}
					if (strcmp("", shutter_sel) == 0) {
						set_top_row(shutter_menu, 3);
						menu_driver(shutter_menu, REQ_DOWN_ITEM);
						menu_driver(shutter_menu, REQ_UP_ITEM);
						wrefresh(shutter_win);
					}
					if (strcmp("", aperture_sel) == 0) {
						set_top_row(aperture_menu, 3);
						menu_driver(aperture_menu, REQ_DOWN_ITEM);
						menu_driver(aperture_menu, REQ_UP_ITEM);
						wrefresh(aperture_win);
					}
					/* clear the selections for next time */
                    selection_counter = 0;
					strcpy(iso_sel, "");
					strcpy(shutter_sel, "");
					strcpy(aperture_sel, "");
					break;
				}
			break;
			}
		}
		wrefresh(*win);
	}	
	/* Unpost and free all the memory taken up */







|
|
|




|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|



|


|

|
|

|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205

206
207
208
209
210
211
212
213
214
215
216
217
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

	attron(COLOR_PAIR(2));
	mvprintw(LINES - 2, 0, "Use PageUp and PageDown to scoll down or up a page of items");
	mvprintw(LINES - 1, 0, "Arrow Keys to navigate (F1 to Exit)");
	attroff(COLOR_PAIR(2));
	refresh();

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

	while((c = getch())) {
		switch(c) {
			case KEY_LEFT:
				if (menu_counter > 1)
					menu_counter -= 1;
				switch(menu_counter) {
					case 1:
						menu = &iso_menu;
						win = &iso_win;
						break;
					case 2:
						menu = &shutter_menu;
						win = &shutter_win;
						break;
					case 3:
						menu = &aperture_menu;
						win = &aperture_win;
						break;

				}
				break;
			case KEY_RIGHT:
				if (menu_counter < 3)
					menu_counter += 1;
				switch(menu_counter) {
					case 1:
						menu = &iso_menu;
						win = &iso_win;
						break;
					case 2:
						menu = &shutter_menu;
						win = &shutter_win;
						break;
					case 3:
						menu = &aperture_menu;
						win = &aperture_win;
						break;

				}
				break;
			case KEY_DOWN:
				menu_driver(*menu, REQ_DOWN_ITEM);
				break;
			case KEY_UP:
				menu_driver(*menu, REQ_UP_ITEM);
				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 setting item in menu */
						 set_top_row(iso_menu, 3);
						 /* This works, but plain refreshing doesn't work properly */
						 /* But cheating and using menu_driver to go up/down does */
						 menu_driver(iso_menu, REQ_DOWN_ITEM);
						 menu_driver(iso_menu, REQ_UP_ITEM);
						 wrefresh(iso_win);
					 }
					 if (strcmp("", shutter_sel) == 0) {
						 set_top_row(shutter_menu, 3);
						 menu_driver(shutter_menu, REQ_DOWN_ITEM);
						 menu_driver(shutter_menu, REQ_UP_ITEM);
						 wrefresh(shutter_win);
					 }
					 if (strcmp("", aperture_sel) == 0) {
						 set_top_row(aperture_menu, 3);
						 menu_driver(aperture_menu, REQ_DOWN_ITEM);
						 menu_driver(aperture_menu, REQ_UP_ITEM);
						 wrefresh(aperture_win);
					 }
					 /* clear the selections for next time */
					 selection_counter = 0;
					 strcpy(iso_sel, "");
					 strcpy(shutter_sel, "");
					 strcpy(aperture_sel, "");
					 break;
				}
			break;
			}
		}
		wrefresh(*win);
	}	
	/* Unpost and free all the memory taken up */
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
			break;
		case 2:
			strcpy(shutter_sel, name);
			break;
		case 3:
			strcpy(aperture_sel, name);
			break;
		break;
	break;
	}
}

int exposure (int iso) {
	int ev100;
	ev100 = 15;
	return ev100 + (log (iso / 100) / log (2));







<
<







306
307
308
309
310
311
312


313
314
315
316
317
318
319
			break;
		case 2:
			strcpy(shutter_sel, name);
			break;
		case 3:
			strcpy(aperture_sel, name);
			break;


	}
}

int exposure (int iso) {
	int ev100;
	ev100 = 15;
	return ev100 + (log (iso / 100) / log (2));