exposurses

Check-in [0ecf3fd90c]
Login

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

Overview
Comment:Add initial left/right menu navigation not at all DRY though at the moment.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 0ecf3fd90cc608d8bdfdfd5ab92e1a31dd72f781af34313d4f09cbce1d8842f5
User & Date: base@atomicules.co.uk 2013-08-17 19:35:05
Context
2013-08-24
15:52
Ensure two different menus have been selected before executing check-in: 5f0ed62195 user: base@atomicules.co.uk tags: origin/master, trunk
2013-08-17
19:35
Add initial left/right menu navigation not at all DRY though at the moment. check-in: 0ecf3fd90c user: base@atomicules.co.uk tags: origin/master, trunk
12:23
Add exposure equations (don't do anything yet though) check-in: 2264820974 user: base@atomicules.co.uk tags: origin/master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to exposurses.c.

51
52
53
54
55
56
57

58
59
60
61
62
63
64
65
66
67



68
69
70
71
72
73
74
...
151
152
153
154
155
156
157



158
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
WINDOW *iso_win;
WINDOW *shutter_win;
WINDOW *aperture_win;

void selection(char *name);
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
int exposure(int iso);

double shutter(int exposure, int aperture);
double aperture(int exposure, int shutter);

int main(){
	int c;
	MENU **menu;
	WINDOW **win;
	int n_iso, i;
	int n_shutter, j;
	int n_aperture, k;




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

	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();





	while((c = getch())){
		switch(c){
			case KEY_LEFT:




				menu = &iso_menu;
				win = &iso_win;
					break;
			case KEY_RIGHT:
				menu = &shutter_menu;
				win = &shutter_win;
				 break;







			case KEY_DOWN:
				menu_driver(*menu, REQ_DOWN_ITEM);






			break;
			case KEY_UP:
				menu_driver(*menu, REQ_UP_ITEM);


			break;







			case KEY_NPAGE:
				menu_driver(*menu, REQ_SCR_DPAGE);
			break;
			case KEY_PPAGE:
				menu_driver(*menu, REQ_SCR_UPAGE);
			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);







>










>
>
>







 







>
>
>




>
>
>
>
|
|
|
|
|
|
|
>
>
>
>
>
>
>
|
<
>
>
>
>
>
>
|
|
<
>
>
|
>
>
>
>
>
>
>
|
|
|
|
|
|


>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
...
155
156
157
158
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
WINDOW *iso_win;
WINDOW *shutter_win;
WINDOW *aperture_win;

void selection(char *name);
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
int exposure(int iso);
int selection_counter;
double shutter(int exposure, int aperture);
double aperture(int exposure, int shutter);

int main(){
	int c;
	MENU **menu;
	WINDOW **win;
	int n_iso, i;
	int n_shutter, j;
	int n_aperture, k;
    int menu_counter;
    menu_counter = 1;
    selection_counter = 0;

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

	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 */
			{
                selection_counter += 1;
				ITEM *cur;
				void (*p)(char *);

				cur = current_item(*menu);
				p = item_userptr(cur);
				p((char *)item_name(cur));
				pos_menu_cursor(*menu);