CHDK_DE Vorschauversion  Trunk Rev. 5833
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
gui_osd.c-Dateireferenz
#include "platform.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)
 
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 438 der Datei gui_osd.c.

#define CLOCK_FORMAT_24   0

Definiert in Zeile 437 der Datei gui_osd.c.

#define CLOCK_WITH_SEC   2

Definiert in Zeile 440 der Datei gui_osd.c.

#define CLOCK_WITHOUT_SEC   1

Definiert in Zeile 439 der Datei gui_osd.c.

Dokumentation der Funktionen

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

Definiert in Zeile 652 der Datei gui_osd.c.

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

Definiert in Zeile 1342 der Datei gui_osd.c.

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

Definiert in Zeile 1093 der Datei gui_osd.c.

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

Definiert in Zeile 1328 der Datei gui_osd.c.

1329 {
1330  if (half_disp_press)
1331  return;
1332 
1334  gui_draw_osd_elements(0,0);
1335 
1337 
1339 }
void gui_draw_osd_elements ( int  is_osd_edit,
int  is_zebra 
)

Definiert in Zeile 1299 der Datei gui_osd.c.

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

Definiert in Zeile 874 der Datei gui_osd.c.

875 {
876  static int half_disp_press_old=0;
877 
879  {
880  if (conf.enable_shortcuts == 1)
881  {
886  }
887 #if !CAM_HAS_MANUAL_FOCUS && CAM_HAS_ZOOM_LEVER
888  // Todo, check for AF and if its running, don't override
893  }
894  } else if (kbd_is_key_pressed(SHORTCUT_SD_ADD)) {
898  }
899  }
900 #endif
901  }
902 
904  if (half_disp_press && !half_disp_press_old)
906 #ifdef CAM_DISP_ALT_TEXT
907  if (half_disp_press)
908  {
909  extern void gui_reset_alt_helper();
911  }
912 #endif
913  half_disp_press_old = half_disp_press;
914 }
static void gui_osd_calc_expo_param ( )
static

Definiert in Zeile 72 der Datei gui_osd.c.

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

Definiert in Zeile 442 der Datei gui_osd.c.

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

Definiert in Zeile 89 der Datei gui_osd.c.

90 {
93 
94  if (is_osd_edit ||
99  {
101  twoColors valid_col = MAKE_COLOR(BG_COLOR(col), COLOR_GREEN);
102  int i = 8, j;
103  short f_ex = (conf.show_dof==DOF_SHOW_IN_DOF_EX);
104  draw_osd_string(conf.dof_pos, 0, 0, "S/NL/FL:", col, conf.dof_scale);
106  j = strlen(osd_buf);
108  i = i+j;
109  draw_osd_string(conf.dof_pos, i*FONT_WIDTH, 0, "/", col, conf.dof_scale);
111  j = strlen(osd_buf);
112  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);
113  i = i+j;
114  draw_osd_string(conf.dof_pos, i*FONT_WIDTH, 0, "/", col, conf.dof_scale);
116  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);
117  i = 8;
118  draw_osd_string(conf.dof_pos, 0, FONT_HEIGHT, "DOF/HYP:", col, conf.dof_scale);
120  j = strlen(osd_buf);
122  i = i+j;
123  draw_osd_string(conf.dof_pos, i*FONT_WIDTH, FONT_HEIGHT, "/", col, conf.dof_scale);
125  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);
126  }
127 }
void gui_osd_draw_ev ( int  is_osd_edit)

Definiert in Zeile 629 der Datei gui_osd.c.

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

Definiert in Zeile 495 der Datei gui_osd.c.

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

Definiert in Zeile 204 der Datei gui_osd.c.

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

Definiert in Zeile 254 der Datei gui_osd.c.

255 {
256  n=0;
257 
258  if ((conf.show_state && camera_info.state.mode_rec_or_review) || is_osd_edit)
259  {
260  long t;
261 
263  //sprintf(osd_buf,"%s",get_debug());
264  //draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+6*FONT_HEIGHT, osd_buf, user_color(conf.osd_color));
266 
267  if (is_tv_override_enabled || is_osd_edit)
268  {
270  {
272  gui_print_osd_state_string_float("TV:%d.%05d", 100000, t);
273  }
274  else
275  {
280  else
282  }
283  }
284  if (is_av_override_enabled || is_osd_edit)
287  if ((conf.nd_filter_state && !(conf.override_disable==1))|| is_osd_edit)
288  gui_print_osd_state_string_chr("NDFILTER:", ((conf.nd_filter_state==1)?"IN":"OUT"));
290  gui_print_osd_state_string_chr("AUTOISO:", ((conf.autoiso_enable==1)?"ON":"OFF"));
292  {
295  {
297  {
299  }
300  else
302  }
303  }
304  if (is_iso_override_enabled || is_osd_edit)
305  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
306  if (is_osd_edit || (shooting_get_drive_mode() && m!=MODE_STITCH && m!=MODE_BEST_IMAGE))
307  {
312  else if (is_av_bracketing_enabled)
314  else if (is_iso_bracketing_enabled)
316  else if (is_sd_bracketing_enabled)
318  }
319 #ifdef OPT_CURVES
320  if (conf.curve_enable || is_osd_edit) {
321  if (conf.curve_enable==1) gui_print_osd_state_string_chr("CURVES:", "CSTM");
322  else if (conf.curve_enable==4) gui_print_osd_state_string_chr("CURVES:", "AUTO");
323  else if (conf.curve_enable==3) gui_print_osd_state_string_chr("CURVES:", "+2EV");
324  else if (conf.curve_enable==2) gui_print_osd_state_string_chr("CURVES:", "+1EV");
325  }
326 #endif
327  if (conf.override_disable == 1) gui_print_osd_state_string_chr("NO ", "OVERRIDES");
330  // edgeoverlay state
331  if (conf.edge_overlay_enable || is_osd_edit) {
333  else if (camera_info.state.edge_state_draw==1) gui_print_osd_state_string_chr("EDGE:", ((conf.edge_overlay_pano==0)?"FROZEN":"PANO"));
334  }
335 #ifdef CAM_QUALITY_OVERRIDE
336  // displaying the overriding picture quality if active
337  if (!(conf.fast_image_quality==3) || is_osd_edit) {
338  if (conf.fast_image_quality==0) gui_print_osd_state_string_chr("QUALI:", "super");
339  else if (conf.fast_image_quality==1) gui_print_osd_state_string_chr("QUALI:", "fine");
340  else if (conf.fast_image_quality==2) gui_print_osd_state_string_chr("QUALI:", "normal");
341  }
342 #endif
343 
344 /*
345  draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, get_debug(), user_color(conf.osd_color));
346  n+=FONT_HEIGHT;*/
347  }
348 }
void gui_osd_draw_temp ( int  is_osd_edit)

Definiert in Zeile 660 der Datei gui_osd.c.

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

Definiert in Zeile 351 der Datei gui_osd.c.

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

Definiert in Zeile 185 der Datei gui_osd.c.

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

Definiert in Zeile 158 der Datei gui_osd.c.

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

Definiert in Zeile 178 der Datei gui_osd.c.

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

Definiert in Zeile 172 der Datei gui_osd.c.

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

Definiert in Zeile 166 der Datei gui_osd.c.

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

Definiert in Zeile 132 der Datei gui_osd.c.

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

Definiert in Zeile 146 der Datei gui_osd.c.

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

Definiert in Zeile 152 der Datei gui_osd.c.

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

Definiert in Zeile 140 der Datei gui_osd.c.

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

Definiert in Zeile 918 der Datei gui_osd.c.

919 {
920 #ifdef CAM_USE_ZOOM_FOR_MF
922  return 1;
923 #endif
924 
926  return 1;
927 
928  // Process Shutter Half Press + BUTTON shortcuts
930 
931  // process other keys in not <alt> mode
932 
933 #if CAM_AF_SCAN_DURING_VIDEO_RECORD
934  if (is_video_recording())
936 #endif
937 
938 #if CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
939  // return from digital to optical zoom in video
940 #if CAM_HAS_ZOOM_LEVER
942 #else
944 #endif
945  {
946  short x;
947  // state = 1 => digital zoom standard
949  {
951 #if defined(CAM_USE_OPTICAL_MAX_ZOOM_STATUS)
952  if (x==0) zoom_status=ZOOM_OPTICAL_MAX; //ERR99: No zoom back from digital to optical zoom possible if set to medium
953 #else
955 #endif
956  }
957  }
958 #endif
959 
960 #if CAM_EV_IN_VIDEO
962  {
963 #if CAM_HAS_ERASE_BUTTON
965 #elif CAM_HAS_DISP_BUTTON
967 #else
969 #endif
970  {
972 #ifdef CAM_TOUCHSCREEN_UI
973  redraw_buttons = 1;
974 #endif
975  }
976  if (get_ev_video_avail())
977  {
979  {
981  }
983  {
985  }
986  }
987  }
988 #endif
989 
990  return 0;
991 }
const char* gui_video_bitrate_enum ( int  change,
int  arg 
)
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 861 der Datei gui_osd.c.

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

Definiert in Zeile 714 der Datei gui_osd.c.

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

Definiert in Zeile 997 der Datei gui_osd.c.

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

Definiert in Zeile 249 der Datei gui_osd.c.

250 {
252 }
static const char* shooting_get_bracket_type ( )
static

Definiert in Zeile 236 der Datei gui_osd.c.

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

Definiert in Zeile 244 der Datei gui_osd.c.

245 {
247 }
static void sprintf_canon_values ( char *  buf,
short  dist 
)
static

Definiert in Zeile 64 der Datei gui_osd.c.

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

Definiert in Zeile 46 der Datei gui_osd.c.

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

Variablen-Dokumentation

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

Definiert in Zeile 1395 der Datei gui_osd.c.

EXPO_TYPE expo
static

Definiert in Zeile 42 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 242 der Datei gui_osd.c.

int half_disp_press = 0
static

Definiert in Zeile 859 der Datei gui_osd.c.

short m
static

Definiert in Zeile 130 der Datei gui_osd.c.

unsigned int movie_reset
static

Definiert in Zeile 493 der Datei gui_osd.c.

short n
static

Definiert in Zeile 130 der Datei gui_osd.c.

char osd_buf[64]
static

Definiert in Zeile 24 der Datei gui_osd.c.