exposurses

Check-in [2264820974]
Login

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

Overview
Comment:Add exposure equations (don't do anything yet though)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 22648209741b0f145563ad08390d8ea21bd7b7355f6f0032238beb8843297659
User & Date: base@atomicules.co.uk 2013-08-17 12:23:42
Context
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
12:18
Rename arrays to free up name for functions check-in: bd27f3bed9 user: base@atomicules.co.uk tags: origin/master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to config.mk.

2
3
4
5
6
7
8
9
10
11
12
13
14
15

# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man

# includes and libs
#INCS = -I. -I/usr/include
LIBS=-lmenu -lcurses

# flags
LDFLAGS = -s ${LIBS}

# compiler and linker
CC = cc







|






2
3
4
5
6
7
8
9
10
11
12
13
14
15

# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man

# includes and libs
#INCS = -I. -I/usr/include
LIBS=-lmenu -lcurses -lm

# flags
LDFLAGS = -s ${LIBS}

# compiler and linker
CC = cc

Changes to exposurses.c.

1
2
3
4

5
6
7
8
9
10
11
..
49
50
51
52
53
54
55



56
57
58
59
60
61
62
...
231
232
233
234
235
236
237
238














239
















/* This file based on menu_scroll.c from:
http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/intro.html */
#include <curses.h>
#include <menu.h>


#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
#define CTRLD 	4

char *iso_array[] = {
	"50",
	"100",
................................................................................
MENU *aperture_menu;
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 main(){
	int c;
	MENU **menu;
	WINDOW **win;
	int n_iso, i;
	int n_shutter, j;
................................................................................
	/* Test setting item in another menu */
	set_top_row(shutter_menu, 3);
	/* This works, but plain refreshing doesn't work properly */
	/* But cheating and using menu_driver to go up/down does */
	menu_driver(shutter_menu, REQ_DOWN_ITEM);
	menu_driver(shutter_menu, REQ_UP_ITEM);
	wrefresh(shutter_win);
	














}




















>







 







>
>
>







 







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
..
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
...
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
273
/* 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>

#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
#define CTRLD 	4

char *iso_array[] = {
	"50",
	"100",
................................................................................
MENU *aperture_menu;
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;
................................................................................
	/* Test setting item in another menu */
	set_top_row(shutter_menu, 3);
	/* This works, but plain refreshing doesn't work properly */
	/* But cheating and using menu_driver to go up/down does */
	menu_driver(shutter_menu, REQ_DOWN_ITEM);
	menu_driver(shutter_menu, REQ_UP_ITEM);
	wrefresh(shutter_win);

	/* Need to think about how to do the interaction
	 *
	 * Select ISO, but then just one or the other of aperture and shutter speed
	 * and on return know that adjusting other menu?A
	 *
	 * Perhaps a global variable/counter and display text saying "select first column"
	 * on enter increment counter, change to "select second column"
	 * then on next enter because of counter value, knows to run equations
	 * And cycle starts again. 
	 * Would do for a start
	 *
	 * Could even do entering numbers to select columns 1, 2, 3
	 *
	 * */
}

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

double shutter (int aperture, int exposure) {
	/* EV = log2 (N^2/t) */
	return pow(aperture, 2) / pow(2, exposure);
}

double aperture (int shutter, int exposure) {
	/* EV = log2 (N^2/t) */
	return shutter * sqrt(pow(2, exposure));
}