CHDK_DE Vorschauversion  Trunk Rev. 5573
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
gui_osd.c-Dateireferenz
#include "platform.h"
#include "stdlib.h"
#include "keyboard.h"
#include "lang.h"
#include "conf.h"
#include "console.h"
#include "gui.h"
#include "gui_menu.h"
#include "gui_draw.h"
#include "gui_lang.h"
#include "gui_osd.h"
#include "gui_batt.h"
#include "gui_usb.h"
#include "gui_space.h"
#include "histogram.h"
#include "usb_remote.h"
#include "modules.h"
+ Include-Abhängigkeitsdiagramm für gui_osd.c:

gehe zum Quellcode dieser Datei

Datenstrukturen

struct  EXPO_TYPE
 

Makrodefinitionen

#define CLOCK_FORMAT_24   0
 
#define CLOCK_FORMAT_12   1
 
#define CLOCK_WITHOUT_SEC   1
 
#define CLOCK_WITH_SEC   2
 

Funktionen

const char * gui_video_bitrate_enum (int change, int arg)
 
const char * gui_video_min_bitrate_enum (int change, int arg)
 
static void sprintf_dist (char *buf, int dist)
 
static void sprintf_canon_values (char *buf, short dist)
 
static void gui_osd_calc_expo_param ()
 
void gui_osd_draw_dof (int is_osd_edit)
 
static void gui_print_osd_state_string ()
 
static void gui_print_osd_state_string_int (const char *title, int value)
 
static void gui_print_osd_state_string_chr (const char *title, const char *value)
 
static void gui_print_osd_state_string_float (const char *fmt, int divisor, int value)
 
static void gui_print_osd_misc_string ()
 
static void gui_print_osd_misc_string_int (const char *title, int value)
 
static void gui_print_osd_misc_string_float (const char *fmt, int divisor, int value)
 
static void gui_print_osd_misc_string_canon_values (const char *title, short value)
 
static void gui_print_osd_dof_string_dist (const char *title, int value, short use_good_color)
 
void gui_osd_draw_raw_info (int is_osd_edit)
 
static const char * shooting_get_bracket_type ()
 
static const char * shooting_get_tv_bracket_value ()
 
static const char * shooting_get_av_bracket_value ()
 
void gui_osd_draw_state (int is_osd_edit)
 
static void gui_osd_draw_values (int is_osd_edit, int is_zebra)
 
void gui_osd_draw_clock (int x, int y, twoColors cl, int is_osd_edit)
 
static void gui_osd_draw_movie_time_left ()
 
void gui_osd_draw_ev (int is_osd_edit)
 
static void draw_temp (char *lbl, int val, int yofst)
 
void gui_osd_draw_temp (int is_osd_edit)
 
void gui_osd_draw_ev_video (int is_osd_edit)
 
static int kbd_use_up_down_left_right_as_fast_switch ()
 
static void kbd_shortcut (int button, int *var, int max_value)
 
void gui_kbd_shortcuts ()
 
static int gui_std_kbd_process ()
 
int osd_visible ()
 
void gui_draw_debug_vals_osd ()
 
void gui_draw_osd_elements (int is_osd_edit, int is_zebra)
 
void gui_draw_osd ()
 
static void gui_default_draw (int force_redraw)
 

Variablen

static char osd_buf [64]
 
static EXPO_TYPE expo
 
static short n
 
static short m
 
static const char * expo_shift [] = { "Off", "1/3Ev","2/3Ev", "1Ev", "1 1/3Ev", "1 2/3Ev", "2Ev", "2 1/3Ev", "2 2/3Ev", "3Ev", "3 1/3Ev", "3 2/3Ev", "4Ev"}
 
static unsigned int movie_reset
 
static int half_disp_press = 0
 
gui_handler defaultGuiHandler = { GUI_MODE_NONE, gui_default_draw, gui_std_kbd_process, 0, 0, 0 }
 

Makro-Dokumentation

#define CLOCK_FORMAT_12   1

Definiert in Zeile 439 der Datei gui_osd.c.

#define CLOCK_FORMAT_24   0

Definiert in Zeile 438 der Datei gui_osd.c.

#define CLOCK_WITH_SEC   2

Definiert in Zeile 441 der Datei gui_osd.c.

#define CLOCK_WITHOUT_SEC   1

Definiert in Zeile 440 der Datei gui_osd.c.

Dokumentation der Funktionen

static void draw_temp ( char *  lbl,
int  val,
int  yofst 
)
static

Definiert in Zeile 653 der Datei gui_osd.c.

654 {
655  if (conf.temperature_unit != 0)
656  val = (val*18+320)/10;
657  sprintf(osd_buf,"%s: %i\xb0",lbl, val);
659 }
static void gui_default_draw ( int  force_redraw)
static

Definiert in Zeile 1339 der Datei gui_osd.c.

1340 {
1341 #if CAM_SWIVEL_SCREEN
1342  static int flashlight = 0;
1343 
1345  {
1346  flashlight = 1;
1348  return;
1349  }
1350  else if (flashlight)
1351  {
1352  flashlight = 0;
1354  return;
1355  }
1356 #endif
1357 
1358  if (half_disp_press)
1359  return;
1360 
1361  if (conf.zebra_draw)
1363  return; // if zebra drawn, we're done
1364 
1365 #if !CAM_SHOW_OSD_IN_SHOOT_MENU
1366  if (!(conf.show_osd && (canon_menu_active==(int)&canon_menu_active-4) && (canon_shoot_menu_active==0))) return;
1367 #else
1368  if (!(conf.show_osd && (canon_menu_active==(int)&canon_menu_active-4) /*&& (canon_shoot_menu_active==0)*/ )) return;
1369 #endif
1370 
1371  gui_draw_osd();
1372 
1373 #if CAM_DRAW_EXPOSITION
1375  {
1376  extern char* shooting_get_tv_str();
1377  extern char* shooting_get_av_str();
1378 
1380  strcat(osd_buf,"\" F");
1383  }
1384 #endif
1385 
1386  if (conf.console_show)
1387  console_draw(force_redraw);
1388 }
void gui_draw_debug_vals_osd ( )

Definiert in Zeile 1092 der Datei gui_osd.c.

1093 {
1094 #ifdef OPT_DEBUGGING
1095 
1096 #if defined(OPT_EXMEM_TESTING)
1097  // Only do memory corruption testing if not recording video
1099  {
1100  extern void exmem_testing();
1101  exmem_testing();
1102  }
1103 #endif
1104 
1105 #if defined(OPT_ARAM_TESTING)
1106  extern void aram_testing();
1107  aram_testing();
1108 #endif
1109 
1111 
1112  int DBGMISCVALS_X = ((camera_screen.width/FONT_WIDTH)-17);
1113  int DBGMISCVALS_Y = ((camera_screen.height/FONT_HEIGHT)-6);
1114 
1115  // DEBUG: "Show misc. values"
1116  // change ROW to fit values on screen in draw_txt_string(COLUMN, ROW, ...)
1117  // uncomment call to gui_draw_debug_vals_osd() in gui_redraw() if you want debug values always on top
1118  if (conf.debug_misc_vals_show) {
1119 
1120 #ifdef OPT_VIEWPORT_DEBUG
1121  {
1122  extern char avb_history[32];
1123  extern unsigned char avb_times[32];
1124  unsigned avbtsum = 0;
1125  int n;
1126  for (n=0; n<32; n++) {
1127  avbtsum += avb_times[n];
1128  osd_buf[n] = avb_history[n]+'0';
1129  }
1130  sprintf(osd_buf+24, " FPS x 10: %3u",avbtsum?320000/avbtsum:0);
1131  draw_txt_string(DBGMISCVALS_X-25, DBGMISCVALS_Y-1, osd_buf, col);
1132  }
1133 #endif
1134 
1135  // show value of Memory Address selected with Memory Browser
1136  sprintf(osd_buf, "MEM: %#8x", (void*) (*(int*)conf.mem_view_addr_init)); // show value in Hexadecimal integer
1137  //sprintf(osd_buf, "MEM: %8u", (void*) (*(int*)conf.mem_view_addr_init)); // show value in Decimal integer
1138  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y, osd_buf, col);
1139 
1140  // show Autofocus status (if AF is working)
1141  extern volatile long focus_busy;
1142  sprintf(osd_buf, "FB: %8u", focus_busy);
1143  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+1, osd_buf, col);
1144 
1145  // show Zoom status (if Lens is moving)
1146  extern volatile long zoom_busy;
1147  sprintf(osd_buf, "ZB: %8u", zoom_busy);
1148  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+2, osd_buf, col);
1149 
1150  // show USB-Power status to debug remote / sync
1151  sprintf(osd_buf, "USB: %8u", get_usb_power(1));
1152  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+3, osd_buf, col);
1153 
1154  /*
1155  // some cameras missing zoom_status
1156  sprintf(osd_buf, "ZS: %#8x", zoom_status);
1157  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+4, osd_buf, col);
1158  */
1159 
1160  /*
1161  sprintf(osd_buf, "VP: %#8x", vid_get_viewport_active_buffer());
1162  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+5, osd_buf, col);
1163  */
1164 
1165  /*
1166  // debug keymap, KEYS_MASKx, SD_READONLY_FLAG, USB_MASK
1167  extern long physw_status[3];
1168  sprintf(osd_buf, "PS1: %#8x", physw_status[0]);
1169  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+1, osd_buf, col);
1170 
1171  sprintf(osd_buf, "PS2: %#8x", physw_status[1]);
1172  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+2, osd_buf, col);
1173 
1174  sprintf(osd_buf, "PS3: %#8x", physw_status[2]);
1175  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+3, osd_buf, col);
1176  */
1177 
1178  /*
1179  // user friendlier keymap display with separated bits, grouped by hex digits
1180  // comment out the above FB, ZB and USB related lines when using this
1181  extern long physw_status[3];
1182  #define BITDISP(str, val) { unsigned bdi; \
1183  char dig[4] = {'1','2','4','8'}; \
1184  for(bdi=0; bdi<32; bdi++) { \
1185  str[31-bdi] = (val&(1<<bdi))?dig[bdi&3]:'0'; \
1186  } \
1187  str[32] = 0; \
1188  }
1189  draw_txt_string(DBGMISCVALS_X-20, DBGMISCVALS_Y+1, " [ 7][ 6][ 5][ 4][ 3][ 2][ 1][ 0]", col);
1190  strcpy(osd_buf, "PS1: ");
1191  BITDISP((osd_buf+5), physw_status[0])
1192  draw_txt_string(DBGMISCVALS_X-20, DBGMISCVALS_Y+2, osd_buf, col);
1193 
1194  strcpy(osd_buf, "PS2: ");
1195  BITDISP((osd_buf+5), physw_status[1])
1196  draw_txt_string(DBGMISCVALS_X-20, DBGMISCVALS_Y+3, osd_buf, col);
1197 
1198  strcpy(osd_buf, "PS3: ");
1199  BITDISP((osd_buf+5), physw_status[2])
1200  draw_txt_string(DBGMISCVALS_X-20, DBGMISCVALS_Y+4, osd_buf, col);
1201  */
1202 
1203  /*
1204  long v=get_file_counter();
1205  sprintf(osd_buf, "1:%03d-%04d", (v>>18)&0x3FF, (v>>4)&0x3FFF);
1206  sprintf(osd_buf, "1:%d, %08X", xxxx, eeee);
1207  */
1208  }
1209  {
1210  int r,i, p, len;
1212 
1213  for (i=0;i<10;i++){
1214  r = 0;
1215  p = conf.debug_propcase_page*10+i;
1216  get_property_case(p, &r, 4);
1217  sprintf(osd_buf, "%3d: %d ", p, r);
1218  osd_buf[20]=0;
1220  }
1221  }
1222 
1224  char s[30];
1225  int count;
1226 
1227  for (i=0;i<10;i++){
1228  r = 0;
1229  p = conf.debug_propcase_page*10+i;
1230  if (p>=get_flash_params_count()) {
1231  sprintf(osd_buf, "%3d: This parameter does not exists", p);
1232  } else {
1233  len = get_parameter_size(p);
1234  if ((len==1)||(len==2)||(len==4)){
1235  get_parameter_data(p, &r, len);
1236  sprintf(osd_buf, "%3d: %30d :%2d ", p, r,len);
1237  }
1238  else {
1239  if (len>=sizeof(s)) count=sizeof(s)-1; else count=len;
1240  get_parameter_data(p, &s, count);
1241  s[count]=0;
1242  sprintf(osd_buf, "%3d: %30s :%2d ", p, s,len);
1243  }
1244  }
1246  }
1247  }
1249 
1250  for (i=0;i<10;i++){
1251  p = conf.debug_propcase_page*10+i;
1252  if (p>=uiprop_count) {
1253  sprintf(osd_buf, "%3d: Does not exist ", p);
1254  } else {
1255  r = get_uiprop_value(p);
1256  sprintf(osd_buf, "%3d: %hi ", p, r);
1257  }
1258  osd_buf[20]=0;
1260  }
1261  }
1262  }
1263 
1264 #ifndef CAM_DRYOS
1266  gui_debug_draw_tasklist();
1267 #endif
1268 #endif
1269 }
void gui_draw_osd ( )

Definiert in Zeile 1325 der Datei gui_osd.c.

1326 {
1327  if (half_disp_press)
1328  return;
1329 
1331  gui_draw_osd_elements(0,0);
1332 
1334 
1336 }
void gui_draw_osd_elements ( int  is_osd_edit,
int  is_zebra 
)

Definiert in Zeile 1298 der Datei gui_osd.c.

1299 {
1300  if (!is_osd_edit)
1301  libgrids->gui_grid_draw_osd(is_zebra);
1302 
1303  gui_osd_draw_dof(is_osd_edit);
1304  gui_osd_draw_values(is_osd_edit,is_zebra);
1305 
1306  if (is_osd_edit || is_zebra || osd_visible())
1307  {
1308  gui_osd_draw_state(is_osd_edit);
1309  gui_osd_draw_raw_info(is_osd_edit);
1310  gui_batt_draw_osd(is_osd_edit);
1311  gui_space_draw_osd(is_osd_edit);
1312  gui_osd_draw_temp(is_osd_edit);
1313  gui_osd_draw_clock(0,0,MAKE_COLOR(0,0),is_osd_edit);
1314  if (!is_zebra)
1315  {
1316  gui_usb_draw_osd(is_osd_edit);
1317  gui_osd_draw_ev(is_osd_edit);
1318  }
1319  }
1320 
1321  if (!is_zebra)
1322  gui_osd_draw_ev_video(is_osd_edit);
1323 }
void gui_kbd_shortcuts ( )

Definiert in Zeile 873 der Datei gui_osd.c.

874 {
875  static int half_disp_press_old=0;
876 
878  {
879  if (conf.enable_shortcuts == 1)
880  {
885  }
886 #if !CAM_HAS_MANUAL_FOCUS && CAM_HAS_ZOOM_LEVER
887  // Todo, check for AF and if its running, don't override
892  }
893  } else if (kbd_is_key_pressed(SHORTCUT_SD_ADD)) {
897  }
898  }
899 #endif
900  }
901 
903  if (half_disp_press && !half_disp_press_old)
905 #ifdef CAM_DISP_ALT_TEXT
906  if (half_disp_press)
907  {
908  extern void gui_reset_alt_helper();
910  }
911 #endif
912  half_disp_press_old = half_disp_press;
913 }
static void gui_osd_calc_expo_param ( )
static

Definiert in Zeile 73 der Datei gui_osd.c.

void gui_osd_draw_clock ( int  x,
int  y,
twoColors  cl,
int  is_osd_edit 
)

Definiert in Zeile 443 der Datei gui_osd.c.

444 {
445  if (conf.show_clock || is_osd_edit)
446  {
447  static char *ampm[2][3] = { { " AM", "A", " "}, { " PM", "P", "." } };
448 
449  struct tm *ttm = get_localtime();
450 
451  int w = 0; // Extra width from AM/PM indicator and seconds (if displayed)
452 
453  if ((FG_COLOR(cl) == 0) && (BG_COLOR(cl) == 0)) cl = user_color(conf.osd_color);
454 
455  if ((camera_info.state.is_shutter_half_press == 0) || (conf.clock_halfpress == 0) || is_osd_edit)
456  {
457  unsigned int hour = (ttm->tm_hour);
458  char *ampm_ind = ""; // AM / PM indicator
459 
461  {
462  ampm_ind = ampm[hour/12][conf.clock_indicator]; //(hour >= 12) ? pm : am;
463  w = strlen(ampm_ind);
464  if (hour == 0)
465  hour = 12;
466  else if (hour > 12)
467  hour = hour - 12;
468  }
469 
470  if ((conf.show_clock != CLOCK_WITHOUT_SEC) || is_osd_edit)
471  {
472  sprintf(osd_buf, "%2u:%02u:%02u%s", hour, ttm->tm_min, ttm->tm_sec, ampm_ind);
473  w += 3;
474  }
475  else
476  {
477  sprintf(osd_buf, "%2u:%02u%s", hour, ttm->tm_min, ampm_ind);
478  }
479 
480  if (x) // for gui_4wins.c
481  draw_string(x, y, osd_buf, cl);
482  else
484  }
486  {
487  sprintf(osd_buf, "%02u", ttm->tm_sec);
488  if (conf.clock_pos.x >= 4*FONT_WIDTH) w = 3;
490  }
491  }
492 }
void gui_osd_draw_dof ( int  is_osd_edit)

Definiert in Zeile 90 der Datei gui_osd.c.

91 {
94 
95  if (is_osd_edit ||
100  {
102  twoColors valid_col = MAKE_COLOR(BG_COLOR(col), COLOR_GREEN);
103  int i = 8, j;
104  short f_ex = (conf.show_dof==DOF_SHOW_IN_DOF_EX);
105  draw_osd_string(conf.dof_pos, 0, 0, "S/NL/FL:", col, conf.dof_scale);
107  j = strlen(osd_buf);
109  i = i+j;
110  draw_osd_string(conf.dof_pos, i*FONT_WIDTH, 0, "/", col, conf.dof_scale);
112  j = strlen(osd_buf);
113  draw_osd_string(conf.dof_pos, (++i)*FONT_WIDTH, 0, osd_buf, (f_ex && camera_info.dof_values.distance_valid)?valid_col:col, conf.dof_scale);
114  i = i+j;
115  draw_osd_string(conf.dof_pos, i*FONT_WIDTH, 0, "/", col, conf.dof_scale);
117  draw_osd_string(conf.dof_pos, (++i)*FONT_WIDTH, 0, osd_buf, (f_ex && camera_info.dof_values.distance_valid)?valid_col:col, conf.dof_scale);
118  i = 8;
119  draw_osd_string(conf.dof_pos, 0, FONT_HEIGHT, "DOF/HYP:", col, conf.dof_scale);
121  j = strlen(osd_buf);
123  i = i+j;
124  draw_osd_string(conf.dof_pos, i*FONT_WIDTH, FONT_HEIGHT, "/", col, conf.dof_scale);
126  draw_osd_string(conf.dof_pos, (++i)*FONT_WIDTH, FONT_HEIGHT, osd_buf, (f_ex && camera_info.dof_values.hyperfocal_valid)?valid_col:col, conf.dof_scale);
127  }
128 }
void gui_osd_draw_ev ( int  is_osd_edit)

Definiert in Zeile 630 der Datei gui_osd.c.

631 {
632  static char *s[6] = {" ", "1/6", "1/3", "1/2", "2/3", "5/6"};
633 
634  if ((!camera_info.state.mode_video && camera_info.state.mode_rec && conf.fast_ev) || is_osd_edit)
635  {
636  short ev = shooting_get_ev_correction1();
637 
638  if (ev/96 || (ev==0))
639  sprintf(osd_buf, "EV: %d %s", abs(ev/96), s[abs(ev/16%6)]);
640  else
641  sprintf(osd_buf, "EV: %s ", s[abs(ev/16%6)]);
642 
643  if (ev>0)
644  osd_buf[4]='+';
645  else if (ev<0)
646  osd_buf[4]='-';
647 
649  }
650 }
void gui_osd_draw_ev_video ( int  is_osd_edit)

Definiert in Zeile 680 der Datei gui_osd.c.

681 {
682 #if CAM_EV_IN_VIDEO
683  if (!is_video_recording() && !is_osd_edit) return;
684 
685  int visible = get_ev_video_avail() || is_osd_edit;
686 
687  int x0=conf.ev_video_pos.x, y0=conf.ev_video_pos.y;
688  int i, deltax;
689 
691 
692  draw_rectangle(x0,y0,x0+70,y0+24, visible? MAKE_COLOR(BG_COLOR(col),BG_COLOR(col)): COLOR_TRANSPARENT, RECT_BORDER1|DRAW_FILLED);
693 
694  if (!visible) { return; }
695 
696  for (i=0;i<9;i++) draw_line(x0+2+i*8, y0+12, x0+2+i*8, y0+12-(i&1 ? 5 : 10), col);
697  for (i=0;i<9;i++) draw_line(x0+2+i*8+1, y0+12, x0+2+i*8+1, y0+12-(i&1 ? 5 : 10), col);
698 
699  deltax=8*get_ev_video();
700 
701  x0+=deltax;
702 
703  draw_line(x0+34,y0+16,x0+34,y0+22,col);
704  draw_line(x0+35,y0+16,x0+35,y0+22,col);
705 
706  draw_line(x0+32,y0+19,x0+32,y0+22,col);
707  draw_line(x0+33,y0+18,x0+33,y0+22,col);
708  draw_line(x0+36,y0+18,x0+36,y0+22,col);
709  draw_line(x0+37,y0+19,x0+37,y0+22,col);
710 #endif
711 }
static void gui_osd_draw_movie_time_left ( )
static

Definiert in Zeile 496 der Datei gui_osd.c.

497 {
498  static int card_used, init_space, elapsed, avg_use, time_left;
499  static long init_time;
500  static int record_running = 0;
501  static int init = 0;
502  static unsigned int skipcalls = 1;
503  unsigned int hour=0, min=0, sec=0;
504 
506 
507  if (is_video_recording())
508  record_running = 1;
509  else
510  {
511  record_running = 0;
512  init = 0;
513  }
514 
515  if ((conf.show_movie_time > 0) && (camera_info.state.mode_video || record_running) && !camera_info.state.mode_play)
516  {
517 #if CAM_CHDK_HAS_EXT_VIDEO_MENU
519  {
520  // if manual adjust, show the field item to be adjusted
521  // if any value overriden, show the override value
522 #ifndef CAM_MOVIEREC_NEWSTYLE
523 #if !CAM_VIDEO_QUALITY_ONLY
525  {
526  // gui_print_osd_state_string_chr("Bitrate: ",video_bitrate_strings[conf.video_bitrate]);
527  sprintf(osd_buf, "Bit:%5s",gui_video_bitrate_enum(0,0));
529  }
530 #endif
532  {
533  // gui_print_osd_state_string_int("Quality: ",conf.video_quality);
534  sprintf(osd_buf, "Qual:%2i",conf.video_quality);
536  }
537 #else // CAM_MOVIEREC_NEWSTYLE
539  if (conf.video_mode == 1) // CBR, see gui.c
540  {
541  sprintf(osd_buf, "CBR %5s",gui_video_bitrate_enum(0,0));
543  }
544  else if (conf.video_mode > 1) // VBR, see gui.c
545  {
548  }
549  }
550 #endif // CAM_MOVIEREC_NEWSTYLE
551  // everything else is for when recording
552  if (!record_running)
553  {
554  return;
555  }
556  }
557 #endif
558 
559  if (movie_reset == 1)
560  {
561  init = 0;
562  movie_reset = 0;
563  }
564 
565  if (record_running == 1 && init == 0)
566  {
567  init = 1;
568  init_space = GetFreeCardSpaceKb();
569  init_time = get_tick_count();
570  }
571 
572  if (init == 1)
573  {
574 #ifndef CAM_MOVIEREC_NEWSTYLE
575  card_used = init_space - GetFreeCardSpaceKb();
576  elapsed = (int) ( get_tick_count() - init_time ) / 1000;
577  avg_use = elapsed?(card_used / elapsed):1; // running average Kb/sec (avoids division by zero)
578  time_left = avg_use?(GetFreeCardSpaceKb() / avg_use):1; // (avoids division by zero)
579 #else
580  // D6: filesystem related info is not updated during recording
582  elapsed = (int) ( get_tick_count() - init_time ) / 1000;
583  avg_use = elapsed?(card_used / elapsed):1; // running average Kb/sec (avoids division by zero)
584  time_left = avg_use?((init_space - card_used) / avg_use):1; // (avoids division by zero)
585 #endif
586  hour = time_left / 3600;
587  min = (time_left % 3600) / 60;
588  sec = (time_left % 3600) % 60;
589 
590  if (elapsed < 1)
591  {
592  sprintf(osd_buf, "Calc...");
594  }
595 
596  if (--skipcalls ==0)
597  {
598  if (elapsed > 1)
599  {
600  int time_yofst = 0;
601  if (conf.show_movie_time == 3)
602  {
603  // Both lines displayed so offset time value below bit rate
604  time_yofst = FONT_HEIGHT;
605  }
606  if (conf.show_movie_time & 2)
607  {
608  sprintf(osd_buf, "%04d KB/s", avg_use);
610  }
611  if (conf.show_movie_time & 1)
612  {
613  sprintf(osd_buf, "-%02d:%02d:%02d", hour, min, sec);
615  }
616 #if CAM_CHDK_HAS_EXT_VIDEO_TIME
617  if( (int)conf.ext_video_time == 1 )
618  {
620  }
621 #endif
622  }
623 
624  skipcalls = conf.show_movie_refresh*5;
625  }
626  }
627  }
628 }
void gui_osd_draw_raw_info ( int  is_osd_edit)

Definiert in Zeile 205 der Datei gui_osd.c.

206 {
207  if (is_osd_edit ||
211  )
212  )
213  {
214  static int b;
215  if (is_raw_enabled() || is_osd_edit)
216  {
217  int raw_count = GetRawCount();
218  twoColors col = user_color(((raw_count > conf.remaining_raw_treshold) || (b <= 6)) ? conf.osd_color : conf.osd_color_warn);
219  if (conf.show_remaining_raw || is_osd_edit)
220  {
221  sprintf(osd_buf, "%s:%3d", (conf.dng_raw)?"DNG":"RAW", raw_count);
223  }
224  else
225  draw_osd_string(conf.mode_raw_pos, 0, 0, (conf.dng_raw)?"DNG":"RAW", col, conf.mode_raw_scale);
226  if (++b > 12) b = 0;
227  }
228  else if (conf.raw_exceptions_warn)
229  {
230  gui_print_osd_state_string_chr((conf.dng_raw)?"DNG Disabled":"RAW Disabled","");
231  }
232  }
233 }
void gui_osd_draw_state ( int  is_osd_edit)

Definiert in Zeile 255 der Datei gui_osd.c.

256 {
257  n=0;
258 
259  if ((conf.show_state && camera_info.state.mode_rec_or_review) || is_osd_edit)
260  {
261  long t;
262 
264  //sprintf(osd_buf,"%s",get_debug());
265  //draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+6*FONT_HEIGHT, osd_buf, user_color(conf.osd_color));
267 
268  if (is_tv_override_enabled || is_osd_edit)
269  {
271  {
273  gui_print_osd_state_string_float("TV:%d.%05d", 100000, t);
274  }
275  else
276  {
281  else
283  }
284  }
285  if (is_av_override_enabled || is_osd_edit)
288  if ((conf.nd_filter_state && !(conf.override_disable==1))|| is_osd_edit)
289  gui_print_osd_state_string_chr("NDFILTER:", ((conf.nd_filter_state==1)?"IN":"OUT"));
291  gui_print_osd_state_string_chr("AUTOISO:", ((conf.autoiso_enable==1)?"ON":"OFF"));
293  {
296  {
298  {
300  }
301  else
303  }
304  }
305  if (is_iso_override_enabled || is_osd_edit)
306  gui_print_osd_state_string_int("ISO:", shooting_iso_real_to_market(shooting_get_iso_override_value())); // get_iso_override returns "real" units, clamped within camera limits
307  if (is_osd_edit || (shooting_get_drive_mode() && m!=MODE_STITCH && m!=MODE_BEST_IMAGE))
308  {
313  else if (is_av_bracketing_enabled)
315  else if (is_iso_bracketing_enabled)
317  else if (is_sd_bracketing_enabled)
319  }
320 #ifdef OPT_CURVES
321  if (conf.curve_enable || is_osd_edit) {
322  if (conf.curve_enable==1) gui_print_osd_state_string_chr("CURVES:", "CSTM");
323  else if (conf.curve_enable==4) gui_print_osd_state_string_chr("CURVES:", "AUTO");
324  else if (conf.curve_enable==3) gui_print_osd_state_string_chr("CURVES:", "+2EV");
325  else if (conf.curve_enable==2) gui_print_osd_state_string_chr("CURVES:", "+1EV");
326  }
327 #endif
328  if (conf.override_disable == 1) gui_print_osd_state_string_chr("NO ", "OVERRIDES");
331  // edgeoverlay state
332  if (conf.edge_overlay_enable || is_osd_edit) {
334  else if (camera_info.state.edge_state_draw==1) gui_print_osd_state_string_chr("EDGE:", ((conf.edge_overlay_pano==0)?"FROZEN":"PANO"));
335  }
336 #ifdef CAM_QUALITY_OVERRIDE
337  // displaying the overriding picture quality if active
338  if (!(conf.fast_image_quality==3) || is_osd_edit) {
339  if (conf.fast_image_quality==0) gui_print_osd_state_string_chr("QUALI:", "super");
340  else if (conf.fast_image_quality==1) gui_print_osd_state_string_chr("QUALI:", "fine");
341  else if (conf.fast_image_quality==2) gui_print_osd_state_string_chr("QUALI:", "normal");
342  }
343 #endif
344 
345 /*
346  draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, get_debug(), user_color(conf.osd_color));
347  n+=FONT_HEIGHT;*/
348  }
349 }
void gui_osd_draw_temp ( int  is_osd_edit)

Definiert in Zeile 661 der Datei gui_osd.c.

662 {
663  int yofst = 0;
664 
665  if ((conf.show_temp == 1) || (conf.show_temp == 4) || is_osd_edit)
666  draw_temp("opt", get_optical_temp(), yofst++);
667 
668  if ((conf.show_temp == 2) || (conf.show_temp == 4) || is_osd_edit)
669 #ifdef CAM_HAS_CMOS
670  draw_temp("CMOS", get_ccd_temp(), yofst++);
671 #else
672  draw_temp("CCD", get_ccd_temp(), yofst++);
673 #endif
674 
675  if ((conf.show_temp == 3) || (conf.show_temp == 4) || is_osd_edit)
676  draw_temp("bat", get_battery_temp(), yofst++);
677 }
static void gui_osd_draw_values ( int  is_osd_edit,
int  is_zebra 
)
static

Definiert in Zeile 352 der Datei gui_osd.c.

353 {
354  if (is_osd_edit || (camera_info.state.mode_rec_or_review && conf.show_values))
355  {
356  // showtype
357  // 1 - show all values
358  // 2 - show DOF values only (for zebra & MF)
359  int showtype = 0;
360  if (!is_zebra &&
363  ((camera_info.state.is_shutter_half_press || (recreview_hold==1)) && (conf.show_values==SHOW_MISC_SHOOT))))
364  showtype = 1;
366  showtype = 2;
367 
372 
373  m = 0;
374 
375  short f_ex = (conf.show_dof==DOF_SHOW_IN_MISC_EX);
376 
377  if (((conf.show_dof==DOF_SHOW_IN_MISC) || f_ex) && showtype && !is_osd_edit)
378  {
389  }
390 
391  if ((showtype == 1) || is_osd_edit)
392  {
393  if (conf.values_show_zoom || is_osd_edit)
394  {
395  int fl, zp=shooting_get_zoom(), fl1=get_focal_length(zp);
396  switch (conf.zoom_value)
397  {
398  case ZOOM_SHOW_FL:
399  sprintf(osd_buf, "Z:%d.%dmm%8s", fl1/1000, fl1%1000/100, "");
400  break;
401  case ZOOM_SHOW_EFL:
403  // scale by users adapter lens eg. Canon Wide .42 or Canon Tele 1.75
404  fl = fl * conf.zoom_scale / 100;
405  sprintf(osd_buf, "Z:%3dmm%8s", fl/1000, "");
406  break;
407  case ZOOM_SHOW_X:
408  default:
409  fl=get_zoom_x(zp);
410  sprintf(osd_buf, "Z:%d/%d.%dx%8s", zp, fl/10, fl%10, "");
411  break;
412  }
414  }
415 
416  if (conf.values_show_real_aperture || is_osd_edit)
418 
419  int iso_mode = shooting_get_iso_mode();
420 
421  if ((iso_mode <= 0) || !(conf.values_show_iso_only_in_autoiso_mode))
422  {
425  }
433  }
434  }
435 }
static void gui_print_osd_dof_string_dist ( const char *  title,
int  value,
short  use_good_color 
)
static

Definiert in Zeile 186 der Datei gui_osd.c.

186  {
187  strcpy(osd_buf, title);
188  int i=strlen(osd_buf);
190  twoColors valid_col = MAKE_COLOR(BG_COLOR(col), COLOR_GREEN);
191  if (i<8) {
193  sprintf_dist(osd_buf, value);
194  sprintf(osd_buf+strlen(osd_buf), "%9s", "");
195  osd_buf[9-i]=0;
196  draw_osd_string(conf.values_pos, i*FONT_WIDTH, m, osd_buf, use_good_color?valid_col:col, conf.values_scale);
197  } else {
198  osd_buf[9]=0;
200  }
201  m+=FONT_HEIGHT;
202 }
static void gui_print_osd_misc_string ( )
static

Definiert in Zeile 159 der Datei gui_osd.c.

160 {
161  sprintf(osd_buf+strlen(osd_buf), "%9s", "");
162  osd_buf[9]=0; // limit length to 9 max
164  m+=FONT_HEIGHT;
165 }
static void gui_print_osd_misc_string_canon_values ( const char *  title,
short  value 
)
static

Definiert in Zeile 179 der Datei gui_osd.c.

180 {
181  strcpy(osd_buf, title);
184 }
static void gui_print_osd_misc_string_float ( const char *  fmt,
int  divisor,
int  value 
)
static

Definiert in Zeile 173 der Datei gui_osd.c.

174 {
175  sprintf(osd_buf, fmt, (int)(value/divisor), (int)(value%divisor));
177 }
static void gui_print_osd_misc_string_int ( const char *  title,
int  value 
)
static

Definiert in Zeile 167 der Datei gui_osd.c.

168 {
169  sprintf(osd_buf, "%s%d", title, value);
171 }
static void gui_print_osd_state_string ( )
static

Definiert in Zeile 133 der Datei gui_osd.c.

134 {
135  sprintf(osd_buf+strlen(osd_buf), "%12s", "");
136  osd_buf[12]=0; // limit length to 12 max
138  n+=FONT_HEIGHT;
139 }
static void gui_print_osd_state_string_chr ( const char *  title,
const char *  value 
)
static

Definiert in Zeile 147 der Datei gui_osd.c.

148 {
149  sprintf(osd_buf, "%s%s", title, value);
151 }
static void gui_print_osd_state_string_float ( const char *  fmt,
int  divisor,
int  value 
)
static

Definiert in Zeile 153 der Datei gui_osd.c.

154 {
155  sprintf(osd_buf, fmt, (int)(value/divisor), (int)(value%divisor));
157 }
static void gui_print_osd_state_string_int ( const char *  title,
int  value 
)
static

Definiert in Zeile 141 der Datei gui_osd.c.

142 {
143  sprintf(osd_buf, "%s%d", title, value);
145 }
static int gui_std_kbd_process ( )
static

Definiert in Zeile 917 der Datei gui_osd.c.

918 {
919 #ifdef CAM_USE_ZOOM_FOR_MF
921  return 1;
922 #endif
923 
925  return 1;
926 
927  // Process Shutter Half Press + BUTTON shortcuts
929 
930  // process other keys in not <alt> mode
931 
932 #if CAM_AF_SCAN_DURING_VIDEO_RECORD
933  if (is_video_recording())
935 #endif
936 
937 #if CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
938  // return from digital to optical zoom in video
939 #if CAM_HAS_ZOOM_LEVER
941 #else
943 #endif
944  {
945  short x;
946  // state = 1 => digital zoom standard
948  {
950 #if defined(CAM_USE_OPTICAL_MAX_ZOOM_STATUS)
951  if (x==0) zoom_status=ZOOM_OPTICAL_MAX; //ERR99: No zoom back from digital to optical zoom possible if set to medium
952 #else
954 #endif
955  }
956  }
957 #endif
958 
959 #if CAM_EV_IN_VIDEO
961  {
962 #if CAM_HAS_ERASE_BUTTON
964 #elif CAM_HAS_DISP_BUTTON
966 #else
968 #endif
969  {
971 #ifdef CAM_TOUCHSCREEN_UI
972  redraw_buttons = 1;
973 #endif
974  }
975  if (get_ev_video_avail())
976  {
978  {
980  }
982  {
984  }
985  }
986  }
987 #endif
988 
989  return 0;
990 }
const char* gui_video_bitrate_enum ( int  change,
int  arg 
)

Definiert in Zeile 1165 der Datei gui.c.

1166 {
1167  static const char *modes[]={ "0.25x", "0.5x","0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x", "2.5x", "3x"};
1168  gui_enum_value_change(&conf.video_bitrate,change,sizeof(modes)/sizeof(modes[0]));
1169 
1170  if (change)
1172 
1173  return modes[conf.video_bitrate];
1174 }
const char* gui_video_min_bitrate_enum ( int  change,
int  arg 
)
static void kbd_shortcut ( int  button,
int *  var,
int  max_value 
)
static

Definiert in Zeile 860 der Datei gui_osd.c.

861 {
862  if (kbd_is_key_clicked(button))
863  {
864  (*var)++;
865  if (*var > max_value)
866  {
867  *var = 0;
869  }
870  }
871 }
static int kbd_use_up_down_left_right_as_fast_switch ( )
static

Definiert in Zeile 715 der Datei gui_osd.c.

716 {
717  static long key_pressed = 0;
718  int ev_video = 0;
719 
720 #if CAM_EV_IN_VIDEO
721  ev_video = get_ev_video_avail();
722 #endif
723 
724  // One of the control options must be enabled or don't do anything
726 
727  // Clear state variable is neither UP or DOWN is pressed
728  if (!kbd_is_key_pressed(KEY_UP) && !kbd_is_key_pressed(KEY_DOWN)) key_pressed = 0;
729 
730  // Must be in record mode and not have either Canon menu open
731  if ( (canon_menu_active!=(int)&canon_menu_active-4) || canon_shoot_menu_active!=0 || !camera_info.state.mode_rec) return 0;
732 
733  // Adjust exposure if 'Enable Fast EV switch?' option is set
734  if (conf.fast_ev && (key_pressed == 0) && (camera_info.state.mode_shooting != MODE_M))
735  {
736 #if !CAM_HAS_JOGDIAL
738  {
742  key_pressed = KEY_UP;
743 
744  return 1;
745  }
746 
748  {
752  key_pressed = KEY_DOWN;
753 
754  return 1;
755  }
756 #else
757  int jogdial=get_jogdial_direction();
758 
760  {
764  }
765 
767  {
771  }
772 #endif
773  }
774 
775  // Adjust video quality/bitrate if 'Video Quality Control?' option is set
776 #ifndef CAM_MOVIEREC_NEWSTYLE
777  if (conf.fast_movie_quality_control && key_pressed == 0 && is_video_recording())
778  {
780  {
781  if (conf.video_mode==0)
782  {
783 #if !CAM_VIDEO_QUALITY_ONLY
785  movie_reset = 1;
786 #endif
787  }
788  else if (conf.video_mode==1)
789  {
790  conf.video_quality+=1;
793  movie_reset = 1;
794  }
795  key_pressed = KEY_UP;
796  return 1;
797  }
798 
800  {
801  if (conf.video_mode==0)
802  {
803 #if !CAM_VIDEO_QUALITY_ONLY
804  conf.video_bitrate-=1;
805  if (conf.video_bitrate<0)
807 
809  movie_reset = 1;
810 #endif
811  }
812  else if (conf.video_mode==1)
813  {
814  conf.video_quality-=1;
815  if (conf.video_quality<1)
817  movie_reset = 1;
818  }
819  key_pressed = KEY_DOWN;
820  return 1;
821  }
822  }
823 #endif // !CAM_MOVIEREC_NEWSTYLE
824 
825 #if CAM_VIDEO_CONTROL
826  // Pause / unpause video if 'Fast Movie Control' option is set
827  if (conf.fast_movie_control && key_pressed == 0 && !ev_video
828 #ifndef CAM_HAS_VIDEO_BUTTON
830 #endif
831  )
832  {
834  {
835  set_movie_status(1); // set to stop
836  key_pressed = KEY_LEFT;
837  return 1;
838  }
839 
840  // reyalp - HACK for cams that can do video in any mode
841  // note that this means this will probably run whenever you press right
842  // BUG this doesn't know whether recording was stopped or paused.
844  {
845  set_movie_status(2); // resume
846  movie_reset = 1;
847  key_pressed = KEY_RIGHT;
848  return 1;
849  }
850  }
851 #endif
852 
853  return key_pressed;
854 }
int osd_visible ( )

Definiert in Zeile 996 der Datei gui_osd.c.

997 {
998  if ( conf.show_osd )
999  {
1000  if ( conf.hide_osd == 0 ) return 1;
1001 
1003  {
1005  {
1006  if ( conf.hide_osd < 2 ) return 1;
1007 
1008 #if defined(PARAM_DISPLAY_MODE1) && defined(PARAM_DISPLAY_MODE2)
1009  short disp_key_mode ;
1010  if (recreview_hold == 0)
1011  {
1012  if (shooting_get_display_mode() == 0) return 1;
1013  }
1014  else
1015  {
1017  {
1018  get_parameter_data(PARAM_DISPLAY_MODE2, &disp_key_mode, 2);
1019  if (disp_key_mode == 0) return 1;
1020  }
1021  }
1022  }
1023  else
1024  {
1025  if (conf.hide_osd == 2 )
1026  {
1027  short disp_key_mode ;
1028  get_parameter_data(PARAM_DISPLAY_MODE1, &disp_key_mode, 2);
1029  if (disp_key_mode == 1) return 1;
1030  }
1031  }
1032 #else
1033  if (shooting_get_display_mode() == 0) return 1;
1034  }
1035 #endif
1036  }
1037  }
1038 
1039  return 0;
1040 }
static const char* shooting_get_av_bracket_value ( )
static

Definiert in Zeile 250 der Datei gui_osd.c.

251 {
253 }
static const char* shooting_get_bracket_type ( )
static

Definiert in Zeile 237 der Datei gui_osd.c.

238 {
239  static const char * expo_type[] = { "+/-", "-", "+", "-/+" };
240  return expo_type[conf.bracket_type];
241 }
static const char* shooting_get_tv_bracket_value ( )
static

Definiert in Zeile 245 der Datei gui_osd.c.

246 {
248 }
static void sprintf_canon_values ( char *  buf,
short  dist 
)
static

Definiert in Zeile 65 der Datei gui_osd.c.

66 {
67  short v=((dist<0)?-dist:dist);
68  sprintf(buf, "%s%d.%02d", ((dist<0)?"-":""), v/96, v%96);
69 }
static void sprintf_dist ( char *  buf,
int  dist 
)
static

Definiert in Zeile 47 der Datei gui_osd.c.

47  {
48 // length of printed string is always 4
49  if (dist<=0) {
50  sprintf(buf, " inf");
51  } else {
52  int i = dist / 1000;
53  int f = dist % 1000;
54  if (i == 0)
55  sprintf(buf, ".%03d", f);
56  else if (i < 10)
57  sprintf(buf, "%d.%02d", i, (f+5)/10);
58  else if (i < 100)
59  sprintf(buf, "%02d.%d", i, (f+50)/100);
60  else
61  sprintf(buf, "%4d", i);
62  }
63 }

Variablen-Dokumentation

gui_handler defaultGuiHandler = { GUI_MODE_NONE, gui_default_draw, gui_std_kbd_process, 0, 0, 0 }

Definiert in Zeile 1392 der Datei gui_osd.c.

EXPO_TYPE expo
static

Definiert in Zeile 43 der Datei gui_osd.c.

const char* expo_shift[] = { "Off", "1/3Ev","2/3Ev", "1Ev", "1 1/3Ev", "1 2/3Ev", "2Ev", "2 1/3Ev", "2 2/3Ev", "3Ev", "3 1/3Ev", "3 2/3Ev", "4Ev"}
static

Definiert in Zeile 243 der Datei gui_osd.c.

int half_disp_press = 0
static

Definiert in Zeile 858 der Datei gui_osd.c.

short m
static

Definiert in Zeile 131 der Datei gui_osd.c.

unsigned int movie_reset
static

Definiert in Zeile 494 der Datei gui_osd.c.

short n
static

Definiert in Zeile 131 der Datei gui_osd.c.

char osd_buf[64]
static

Definiert in Zeile 25 der Datei gui_osd.c.