]>
Commit | Line | Data |
---|---|---|
50a14534 EB |
1 | |
2 | ff2.c | |
3 | reads thru thing | |
4 | if layer, makes new layer of type | |
5 | adds to aggregate | |
6 | ||
7 | looks at line | |
8 | if starts with '[' creates layer (new interface func?) | |
9 | fgets line with 'this=this' in | |
10 | calls | |
11 | ||
12 | interface { | |
13 | ... | |
14 | params { | |
15 | { "this", PARAM_THIS }, | |
16 | { "that", PARAM_THAT }, | |
17 | }, | |
18 | num params = 2, | |
19 | ||
20 | } | |
21 | ||
22 | set_param(VikLayer*l,gint type_id,gchar *stuff) { switch(type_id) { | |
23 | case PARAM_THIS: | |
24 | layer_set_this(l,stuff); | |
25 | case PARAM_THAT: | |
26 | l->that = atol(stuff) | |
27 | } } | |
28 | ||
29 | checks thru params strlen() check and strncmp() | |
30 | good -> set param | |
31 | ||
32 | *now*, what if I could use all this set_param stuff for dynamic dialog box creation? | |
33 | and default (non-interactive) new layers? | |
34 | ||
35 | param name ID explanation type widget type min/min len max/max len default val | |
36 | colorvelocity VEL lower velocity range CUSTOM CUSTOM | |
37 | line_thickness THICK Track Line Thickness INT SPINBUTTON 1 15 1 | |
38 | # on read, if outside range, gives error. | |
39 | ||
40 | special stuff like color velocity range? | |
41 | ||
42 | union param_val { | |
43 | gchar *s; | |
44 | long l; | |
45 | double d; | |
46 | } | |
47 | ||
48 | color velocity range: | |
49 | [ ] to [ ] | |
50 | ||
51 | so we need a special get_widget_for_param() thingy. | |
52 | then set_param_from_widget() -> gets widget data does its thing | |
53 | ||
54 | tabs? | |
55 | radio boxes? (names) | |
56 | ||
57 | ---- | |
58 | ||
59 | ff2.c | |
60 | ||
61 | typedef struct { | |
62 | Stack *under; | |
63 | gpointer data; | |
64 | } Stack; | |
65 | ||
66 | void pop(Stack **stack) { | |
67 | Stack *tmp = (*stack)->under; | |
68 | g_free ( *stack ); | |
69 | *stack = tmp; | |
70 | } | |
71 | ||
72 | void push(Stack **stack) | |
73 | { | |
74 | Stack *tmp = g_malloc ( sizeof ( Stack ) ); | |
75 | tmp->under = *stack; | |
76 | *stack = tmp; | |
77 | } | |
78 | ||
79 | /* | |
80 | read thru file | |
81 | if "[Layer Type=" | |
82 | push(&stack) | |
83 | new default layer of type (str_to_type) (check interface->name) | |
84 | if "[EndLayer]" | |
85 | VikLayer *vl = stack->data; | |
86 | pop(&stack); | |
87 | vik_aggregate_layer_add_layer(stack->data, vl); | |
88 | if "[LayerData]" | |
89 | vik_layer_data ( VIK_LAYER_DATA(stack->data), f, vp ); | |
90 | ||
91 | */ |