CHDK_DE Vorschauversion  Trunk Rev. 6014
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
gui_osd_edit.c-Dateireferenz
#include "camera_info.h"
#include "keyboard.h"
#include "histogram.h"
#include "lang.h"
#include "conf.h"
#include "gui.h"
#include "gui_draw.h"
#include "gui_lang.h"
#include "gui_batt.h"
#include "gui_usb.h"
#include "gui_space.h"
#include "gui_osd.h"
#include "module_def.h"
#include "simple_module.h"
+ Include-Abhängigkeitsdiagramm für gui_osd_edit.c:

gehe zum Quellcode dieser Datei

Datenstrukturen

struct  OSD_elem
 

Makrodefinitionen

#define SCX(x)   (FONT_WIDTH*(x)/FONT_REAL_WIDTH)
 
#define SCY(y)   (FONT_HEIGHT*(y)/FONT_REAL_HEIGHT)
 
#define SCL(v, s)   ((scalemul[s]*(v))>>1)
 

Funktionen

void gui_osd_draw ()
 
void osd_font_scale (int dir)
 
int gui_osd_kbd_process ()
 
void gui_osd_menu_kbd_process ()
 
int _run ()
 
int _module_can_unload ()
 
int _module_exit_alt ()
 

Variablen

static OSD_elem osd []
 
static int scalemul [5] = {1,2,4,6,8}
 
static int osd_to_draw
 
static int curr_item
 
static int step
 
static int running = 0
 
gui_handler layoutGuiHandler
 
libsimple_sym _librun
 
ModuleInfo _module_info
 

Makro-Dokumentation

#define SCL (   v,
  s 
)    ((scalemul[s]*(v))>>1)

Definiert in Zeile 52 der Datei gui_osd_edit.c.

#define SCX (   x)    (FONT_WIDTH*(x)/FONT_REAL_WIDTH)

Definiert in Zeile 19 der Datei gui_osd_edit.c.

#define SCY (   y)    (FONT_HEIGHT*(y)/FONT_REAL_HEIGHT)

Definiert in Zeile 20 der Datei gui_osd_edit.c.

Dokumentation der Funktionen

int _module_can_unload ( )

Definiert in Zeile 241 der Datei gui_osd_edit.c.

242 {
243  return running == 0;
244 }
int _module_exit_alt ( )

Definiert in Zeile 246 der Datei gui_osd_edit.c.

247 {
248  running = 0;
249  return 0;
250 }
int _run ( )

Definiert in Zeile 228 der Datei gui_osd_edit.c.

229 {
230  running = 1;
231 
232  osd_to_draw = 1;
233  curr_item = 0;
234  step = 10;
235 
237 
238  return 0;
239 }
void gui_osd_draw ( )

Definiert in Zeile 59 der Datei gui_osd_edit.c.

60 {
61  char osd_buf[64];
62 
63  if (osd_to_draw)
64  {
65  int i;
66  draw_restore();
69  int xscale = osd[curr_item].scale->x;
70  int yscale = osd[curr_item].scale->y;
71 #if (FONT_HEIGHT <= FONT_REAL_HEIGHT)
72  if ( xscale == 0) xscale = 1 ;
73  if ( yscale == 0) yscale = 1 ;
74 #endif
75  for (i=1; i<=2; ++i)
76  {
77  draw_rectangle((osd[curr_item].pos->x>=i)?osd[curr_item].pos->x-i:0, (osd[curr_item].pos->y>=i)?osd[curr_item].pos->y-i:0,
78  (osd[curr_item].pos->x+SCL(osd[curr_item].size.x,xscale))+i-1,
79  (osd[curr_item].pos->y+SCL(osd[curr_item].size.y,yscale))+i-1,
81  }
82  sprintf(osd_buf, " %s: x:%d y:%d s:%d f:%d:%d ", lang_str(osd[curr_item].title), osd[curr_item].pos->x, osd[curr_item].pos->y, step, xscale, yscale);
83  draw_string(0, (osd[curr_item].pos->x<strlen(osd_buf)*FONT_WIDTH+4 && osd[curr_item].pos->y<FONT_HEIGHT+4)?camera_screen.height-FONT_HEIGHT:0,
84  osd_buf, MAKE_COLOR(COLOR_RED, COLOR_WHITE));
85  osd_to_draw = 0;
86  }
87 }
int gui_osd_kbd_process ( )

Definiert in Zeile 143 der Datei gui_osd_edit.c.

144 {
146  {
147  case KEY_LEFT:
148  if (osd[curr_item].pos->x > 0)
149  {
150  osd[curr_item].pos->x-=(osd[curr_item].pos->x>=step)?step:osd[curr_item].pos->x;
151  osd_to_draw = 1;
152  }
153  break;
154  case KEY_RIGHT:
155  if (osd[curr_item].pos->x < camera_screen.width-SCL(osd[curr_item].size.x,0))
156  {
157  osd[curr_item].pos->x+=(camera_screen.width-SCL(osd[curr_item].size.x,0)-osd[curr_item].pos->x>step)?step:camera_screen.width-SCL(osd[curr_item].size.x,0)-osd[curr_item].pos->x;
158  osd_to_draw = 1;
159  } else
160  osd[curr_item].pos->x = camera_screen.width-SCL(osd[curr_item].size.x,0);
161  break;
162  case KEY_UP:
163  if (osd[curr_item].pos->y > 0)
164  {
165  osd[curr_item].pos->y-=(osd[curr_item].pos->y>=step)?step:osd[curr_item].pos->y;
166  osd_to_draw = 1;
167  }
168  break;
169  case KEY_DOWN:
170  if (osd[curr_item].pos->y < camera_screen.height-osd[curr_item].size.y)
171  {
173  osd_to_draw = 1;
174  } else
176  break;
177  case KEY_SET:
178  ++curr_item;
179  if ((osd[curr_item].title == LANG_OSD_LAYOUT_EDITOR_EV_VIDEO) && !camera_info.cam_ev_in_video) curr_item++;
180  if (!osd[curr_item].pos)
181  curr_item = 0;
182  osd_to_draw = 1;
183  break;
184  // many current cams don't have a display button.
185  // Add video as another option, since modules have no way to determine available keys
186  case KEY_VIDEO:
187  case KEY_DISPLAY:
188  step=(step==1)?10:1;
189  osd_to_draw = 1;
190  break;
191  case KEY_SHOOT_HALF:
192  osd_font_scale(0) ;
193  break;
194  case KEY_ZOOM_IN:
195  case JOGDIAL_RIGHT:
196  osd_font_scale(1) ;
197  break;
198  case KEY_ZOOM_OUT:
199  case JOGDIAL_LEFT:
200  osd_font_scale(-1) ;
201  break;
202  }
203  return 0;
204 }
void gui_osd_menu_kbd_process ( )

Definiert in Zeile 208 der Datei gui_osd_edit.c.

209 {
210  running = 0;
212 }
void osd_font_scale ( int  dir)

Definiert in Zeile 89 der Datei gui_osd_edit.c.

90 {
91  int xscale, yscale ;
92 
93  xscale = osd[curr_item].scale->x ;
94  yscale = osd[curr_item].scale->y ;
95  switch ((xscale<<4)+yscale)
96  {
97 #if (FONT_HEIGHT > FONT_REAL_HEIGHT)
98  case 0x00 :
99  case 0x01 :
100  case 0x10 :
101  if ( dir>=0) { xscale=1; yscale=1; } else { xscale=0; yscale=0; }
102  break ;
103 #endif
104  case 0x11 :
105  if ( dir>=0) { xscale=2; yscale=1 ; }
106 #if (FONT_HEIGHT > FONT_REAL_HEIGHT)
107  else { xscale=0; yscale=0; }
108 #endif
109  break ;
110  case 0x21 :
111  if ( dir>=0) { xscale=2; yscale=2; } else { xscale=1; yscale=1; }
112  break ;
113  case 0x22 :
114  if ( dir>=0) { xscale=3; yscale=2; } else { xscale=2; yscale=1; }
115  break ;
116  case 0x32 :
117  if ( dir>=0) { xscale=4; yscale=2; } else { xscale=2; yscale=2; }
118  break ;
119  case 0x42 :
120  if ( dir>=0) { xscale=3; yscale=3; } else { xscale=3; yscale=2; }
121  break ;
122  case 0x33 :
123  if ( dir>=0) { xscale=4; yscale=4; } else { xscale=4; yscale=2; }
124  break ;
125  case 0x44 :
126  if ( dir == -1) { xscale=3; yscale=3; }
127 #if (FONT_HEIGHT > FONT_REAL_HEIGHT)
128  else if ( dir == 0) { xscale=0; yscale=0; }
129 #else
130  else if ( dir == 0) { xscale=1; yscale=1; }
131 #endif
132  break ;
133  default :
134  xscale=0; yscale=0 ;
135  break ;
136  }
137  osd[curr_item].scale->x = xscale ;
138  osd[curr_item].scale->y = yscale ;
139  osd_to_draw = 1;
140 }

Variablen-Dokumentation

libsimple_sym _librun
Initialisierung:

Definiert in Zeile 254 der Datei gui_osd_edit.c.

ModuleInfo _module_info
int curr_item
static

Definiert in Zeile 55 der Datei gui_osd_edit.c.

gui_handler layoutGuiHandler
OSD_elem osd[]
static
Initialisierung:
={
{0}
}

Definiert in Zeile 29 der Datei gui_osd_edit.c.

int osd_to_draw
static

Definiert in Zeile 54 der Datei gui_osd_edit.c.

int running = 0
static

Definiert in Zeile 206 der Datei gui_osd_edit.c.

int scalemul[5] = {1,2,4,6,8}
static

Definiert in Zeile 50 der Datei gui_osd_edit.c.

int step
static

Definiert in Zeile 56 der Datei gui_osd_edit.c.