CHDK_DE Vorschauversion  Trunk Rev. 5298
 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 print_dist (char *buf, int dist, short is_hyp)
 
static void sprintf_dist (char *buf, int dist)
 
static void sprintf_dist_hyp (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, short is_hyp)
 
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 454 der Datei gui_osd.c.

#define CLOCK_FORMAT_24   0

Definiert in Zeile 453 der Datei gui_osd.c.

#define CLOCK_WITH_SEC   2

Definiert in Zeile 456 der Datei gui_osd.c.

#define CLOCK_WITHOUT_SEC   1

Definiert in Zeile 455 der Datei gui_osd.c.

Dokumentation der Funktionen

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

Definiert in Zeile 668 der Datei gui_osd.c.

669 {
670  if (conf.temperature_unit != 0)
671  val = (val*18+320)/10;
672  sprintf(osd_buf,"%s: %i\xb0",lbl, val);
674 }
static void gui_default_draw ( int  force_redraw)
static

Definiert in Zeile 1313 der Datei gui_osd.c.

1314 {
1315 #if CAM_SWIVEL_SCREEN
1316  static int flashlight = 0;
1317 
1319  {
1320  flashlight = 1;
1322  return;
1323  }
1324  else if (flashlight)
1325  {
1326  flashlight = 0;
1328  return;
1329  }
1330 #endif
1331 
1332  if (half_disp_press)
1333  return;
1334 
1335  if (conf.zebra_draw)
1337  return; // if zebra drawn, we're done
1338 
1339 #if !CAM_SHOW_OSD_IN_SHOOT_MENU
1340  if (!(conf.show_osd && (canon_menu_active==(int)&canon_menu_active-4) && (canon_shoot_menu_active==0))) return;
1341 #else
1342  if (!(conf.show_osd && (canon_menu_active==(int)&canon_menu_active-4) /*&& (canon_shoot_menu_active==0)*/ )) return;
1343 #endif
1344 
1345  gui_draw_osd();
1346 
1347 #if CAM_DRAW_EXPOSITION
1349  {
1350  extern char* shooting_get_tv_str();
1351  extern char* shooting_get_av_str();
1352 
1354  strcat(osd_buf,"\" F");
1357  }
1358 #endif
1359 
1360  if (conf.console_show)
1361  console_draw(force_redraw);
1362 }
void gui_draw_debug_vals_osd ( )

Definiert in Zeile 1107 der Datei gui_osd.c.

1108 {
1109 #ifdef OPT_DEBUGGING
1110 
1111 #if defined(OPT_EXMEM_TESTING)
1112  // Only do memory corruption testing if not recording video
1114  {
1115  extern void exmem_testing();
1116  exmem_testing();
1117  }
1118 #endif
1119 
1120 #if defined(OPT_ARAM_TESTING)
1121  extern void aram_testing();
1122  aram_testing();
1123 #endif
1124 
1126 
1127  int DBGMISCVALS_X = ((camera_screen.width/FONT_WIDTH)-17);
1128  int DBGMISCVALS_Y = ((camera_screen.height/FONT_HEIGHT)-6);
1129 
1130  // DEBUG: "Show misc. values"
1131  // change ROW to fit values on screen in draw_txt_string(COLUMN, ROW, ...)
1132  // uncomment call to gui_draw_debug_vals_osd() in gui_redraw() if you want debug values always on top
1133  if (conf.debug_misc_vals_show) {
1134  // show value of Memory Address selected with Memory Browser
1135  sprintf(osd_buf, "MEM: %#8x", (void*) (*(int*)conf.mem_view_addr_init)); // show value in Hexadecimal integer
1136  //sprintf(osd_buf, "MEM: %8u", (void*) (*(int*)conf.mem_view_addr_init)); // show value in Decimal integer
1137  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y, osd_buf, col);
1138 
1139  // show Autofocus status (if AF is working)
1140  extern volatile long focus_busy;
1141  sprintf(osd_buf, "FB: %8u", focus_busy);
1142  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+1, osd_buf, col);
1143 
1144  // show Zoom status (if Lens is moving)
1145  extern volatile long zoom_busy;
1146  sprintf(osd_buf, "ZB: %8u", zoom_busy);
1147  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+2, osd_buf, col);
1148 
1149  // show USB-Power status to debug remote / sync
1150  sprintf(osd_buf, "USB: %8u", get_usb_power(1));
1151  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+3, osd_buf, col);
1152 
1153  /*
1154  // some cameras missing zoom_status
1155  sprintf(osd_buf, "ZS: %#8x", zoom_status);
1156  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+4, osd_buf, col);
1157  */
1158 
1159  /*
1160  sprintf(osd_buf, "VP: %#8x", vid_get_viewport_active_buffer());
1161  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+5, osd_buf, col);
1162  */
1163 
1164  /*
1165  // debug keymap, KEYS_MASKx, SD_READONLY_FLAG, USB_MASK
1166  extern long physw_status[3];
1167  sprintf(osd_buf, "PS1: %#8x", physw_status[0]);
1168  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+1, osd_buf, col);
1169 
1170  sprintf(osd_buf, "PS2: %#8x", physw_status[1]);
1171  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+2, osd_buf, col);
1172 
1173  sprintf(osd_buf, "PS3: %#8x", physw_status[2]);
1174  draw_txt_string(DBGMISCVALS_X, DBGMISCVALS_Y+3, osd_buf, col);
1175  */
1176 
1177  /*
1178  long v=get_file_counter();
1179  sprintf(osd_buf, "1:%03d-%04d", (v>>18)&0x3FF, (v>>4)&0x3FFF);
1180  sprintf(osd_buf, "1:%d, %08X", xxxx, eeee);
1181  */
1182  }
1183  {
1184  int r,i, p, len;
1186 
1187  for (i=0;i<10;i++){
1188  r = 0;
1189  p = conf.debug_propcase_page*10+i;
1190  get_property_case(p, &r, 4);
1191  sprintf(osd_buf, "%3d: %d ", p, r);
1192  osd_buf[20]=0;
1194  }
1195  }
1196 
1198  char s[30];
1199  int count;
1200 
1201  for (i=0;i<10;i++){
1202  r = 0;
1203  p = conf.debug_propcase_page*10+i;
1204  if (p>=get_flash_params_count()) {
1205  sprintf(osd_buf, "%3d: This parameter does not exists", p);
1206  } else {
1207  len = get_parameter_size(p);
1208  if ((len==1)||(len==2)||(len==4)){
1209  get_parameter_data(p, &r, len);
1210  sprintf(osd_buf, "%3d: %30d :%2d ", p, r,len);
1211  }
1212  else {
1213  if (len>=sizeof(s)) count=sizeof(s)-1; else count=len;
1214  get_parameter_data(p, &s, count);
1215  s[count]=0;
1216  sprintf(osd_buf, "%3d: %30s :%2d ", p, s,len);
1217  }
1218  }
1220  }
1221  }
1223 
1224  for (i=0;i<10;i++){
1225  p = conf.debug_propcase_page*10+i;
1226  if (p>=uiprop_count) {
1227  sprintf(osd_buf, "%3d: Does not exist ", p);
1228  } else {
1229  r = get_uiprop_value(p);
1230  sprintf(osd_buf, "%3d: %hi ", p, r);
1231  }
1232  osd_buf[20]=0;
1234  }
1235  }
1236  }
1237 
1238 #ifndef CAM_DRYOS
1240  gui_debug_draw_tasklist();
1241 #endif
1242 #endif
1243 }
void gui_draw_osd ( )

Definiert in Zeile 1299 der Datei gui_osd.c.

1300 {
1301  if (half_disp_press)
1302  return;
1303 
1305  gui_draw_osd_elements(0,0);
1306 
1308 
1310 }
void gui_draw_osd_elements ( int  is_osd_edit,
int  is_zebra 
)

Definiert in Zeile 1272 der Datei gui_osd.c.

1273 {
1274  if (!is_osd_edit)
1275  libgrids->gui_grid_draw_osd(is_zebra);
1276 
1277  gui_osd_draw_dof(is_osd_edit);
1278  gui_osd_draw_values(is_osd_edit,is_zebra);
1279 
1280  if (is_osd_edit || is_zebra || osd_visible())
1281  {
1282  gui_osd_draw_state(is_osd_edit);
1283  gui_osd_draw_raw_info(is_osd_edit);
1284  gui_batt_draw_osd(is_osd_edit);
1285  gui_space_draw_osd(is_osd_edit);
1286  gui_osd_draw_temp(is_osd_edit);
1287  gui_osd_draw_clock(0,0,MAKE_COLOR(0,0),is_osd_edit);
1288  if (!is_zebra)
1289  {
1290  gui_usb_draw_osd(is_osd_edit);
1291  gui_osd_draw_ev(is_osd_edit);
1292  }
1293  }
1294 
1295  if (!is_zebra)
1296  gui_osd_draw_ev_video(is_osd_edit);
1297 }
void gui_kbd_shortcuts ( )

Definiert in Zeile 888 der Datei gui_osd.c.

889 {
890  static int half_disp_press_old=0;
891 
893  {
894  if (conf.enable_shortcuts == 1)
895  {
900  }
901 #if !CAM_HAS_MANUAL_FOCUS && CAM_HAS_ZOOM_LEVER
902  // Todo, check for AF and if its running, don't override
907  }
908  } else if (kbd_is_key_pressed(SHORTCUT_SD_ADD)) {
912  }
913  }
914 #endif
915  }
916 
918  if (half_disp_press && !half_disp_press_old)
920 #ifdef CAM_DISP_ALT_TEXT
921  if (half_disp_press)
922  {
923  extern void gui_reset_alt_helper();
925  }
926 #endif
927  half_disp_press_old = half_disp_press;
928 }
static void gui_osd_calc_expo_param ( )
static

Definiert in Zeile 84 der Datei gui_osd.c.

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

Definiert in Zeile 458 der Datei gui_osd.c.

459 {
460  if (conf.show_clock || is_osd_edit)
461  {
462  static char *ampm[2][3] = { { " AM", "A", " "}, { " PM", "P", "." } };
463 
464  struct tm *ttm = get_localtime();
465 
466  int w = 0; // Extra width from AM/PM indicator and seconds (if displayed)
467 
468  if ((FG_COLOR(cl) == 0) && (BG_COLOR(cl) == 0)) cl = user_color(conf.osd_color);
469 
470  if ((camera_info.state.is_shutter_half_press == 0) || (conf.clock_halfpress == 0) || is_osd_edit)
471  {
472  unsigned int hour = (ttm->tm_hour);
473  char *ampm_ind = ""; // AM / PM indicator
474 
476  {
477  ampm_ind = ampm[hour/12][conf.clock_indicator]; //(hour >= 12) ? pm : am;
478  w = strlen(ampm_ind);
479  if (hour == 0)
480  hour = 12;
481  else if (hour > 12)
482  hour = hour - 12;
483  }
484 
485  if ((conf.show_clock != CLOCK_WITHOUT_SEC) || is_osd_edit)
486  {
487  sprintf(osd_buf, "%2u:%02u:%02u%s", hour, ttm->tm_min, ttm->tm_sec, ampm_ind);
488  w += 3;
489  }
490  else
491  {
492  sprintf(osd_buf, "%2u:%02u%s", hour, ttm->tm_min, ampm_ind);
493  }
494 
495  if (x) // for gui_4wins.c
496  draw_string(x, y, osd_buf, cl);
497  else
499  }
501  {
502  sprintf(osd_buf, "%02u", ttm->tm_sec);
503  if (conf.clock_pos.x >= 4*FONT_WIDTH) w = 3;
505  }
506  }
507 }
void gui_osd_draw_dof ( int  is_osd_edit)

Definiert in Zeile 101 der Datei gui_osd.c.

102 {
103  if (conf.show_dof != DOF_DONT_SHOW)
105 
106  if (is_osd_edit ||
111  {
113  twoColors valid_col = MAKE_COLOR(BG_COLOR(col), COLOR_GREEN);
114  int i = 8, j;
115  short f_ex = (conf.show_dof==DOF_SHOW_IN_DOF_EX);
116  draw_osd_string(conf.dof_pos, 0, 0, "S/NL/FL:", col, conf.dof_scale);
118  j = strlen(osd_buf);
120  i = i+j;
121  draw_osd_string(conf.dof_pos, i*FONT_WIDTH, 0, "/", col, conf.dof_scale);
123  j = strlen(osd_buf);
124  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);
125  i = i+j;
126  draw_osd_string(conf.dof_pos, i*FONT_WIDTH, 0, "/", col, conf.dof_scale);
128  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);
129  i = 8;
130  draw_osd_string(conf.dof_pos, 0, FONT_HEIGHT, "DOF/HYP:", col, conf.dof_scale);
132  j = strlen(osd_buf);
134  i = i+j;
135  draw_osd_string(conf.dof_pos, i*FONT_WIDTH, FONT_HEIGHT, "/", col, conf.dof_scale);
137  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);
138  }
139 }
void gui_osd_draw_ev ( int  is_osd_edit)

Definiert in Zeile 645 der Datei gui_osd.c.

646 {
647  static char *s[6] = {" ", "1/6", "1/3", "1/2", "2/3", "5/6"};
648 
649  if ((!camera_info.state.mode_video && camera_info.state.mode_rec && conf.fast_ev) || is_osd_edit)
650  {
651  short ev = shooting_get_ev_correction1();
652 
653  if (ev/96 || (ev==0))
654  sprintf(osd_buf, "EV: %d %s", abs(ev/96), s[abs(ev/16%6)]);
655  else
656  sprintf(osd_buf, "EV: %s ", s[abs(ev/16%6)]);
657 
658  if (ev>0)
659  osd_buf[4]='+';
660  else if (ev<0)
661  osd_buf[4]='-';
662 
664  }
665 }
void gui_osd_draw_ev_video ( int  is_osd_edit)

Definiert in Zeile 695 der Datei gui_osd.c.

696 {
697 #if CAM_EV_IN_VIDEO
698  if (!is_video_recording() && !is_osd_edit) return;
699 
700  int visible = get_ev_video_avail() || is_osd_edit;
701 
702  int x0=conf.ev_video_pos.x, y0=conf.ev_video_pos.y;
703  int i, deltax;
704 
706 
707  draw_rectangle(x0,y0,x0+70,y0+24, visible? MAKE_COLOR(BG_COLOR(col),BG_COLOR(col)): COLOR_TRANSPARENT, RECT_BORDER1|DRAW_FILLED);
708 
709  if (!visible) { return; }
710 
711  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);
712  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);
713 
714  deltax=8*get_ev_video();
715 
716  x0+=deltax;
717 
718  draw_line(x0+34,y0+16,x0+34,y0+22,col);
719  draw_line(x0+35,y0+16,x0+35,y0+22,col);
720 
721  draw_line(x0+32,y0+19,x0+32,y0+22,col);
722  draw_line(x0+33,y0+18,x0+33,y0+22,col);
723  draw_line(x0+36,y0+18,x0+36,y0+22,col);
724  draw_line(x0+37,y0+19,x0+37,y0+22,col);
725 #endif
726 }
static void gui_osd_draw_movie_time_left ( )
static

Definiert in Zeile 511 der Datei gui_osd.c.

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

Definiert in Zeile 220 der Datei gui_osd.c.

221 {
222  if (is_osd_edit ||
226  )
227  )
228  {
229  static int b;
230  if (is_raw_enabled() || is_osd_edit)
231  {
232  int raw_count = GetRawCount();
233  twoColors col = user_color(((raw_count > conf.remaining_raw_treshold) || (b <= 6)) ? conf.osd_color : conf.osd_color_warn);
234  if (conf.show_remaining_raw || is_osd_edit)
235  {
236  sprintf(osd_buf, "%s:%3d", (conf.dng_raw)?"DNG":"RAW", raw_count);
238  }
239  else
240  draw_osd_string(conf.mode_raw_pos, 0, 0, (conf.dng_raw)?"DNG":"RAW", col, conf.mode_raw_scale);
241  if (++b > 12) b = 0;
242  }
243  else if (conf.raw_exceptions_warn)
244  {
245  gui_print_osd_state_string_chr((conf.dng_raw)?"DNG Disabled":"RAW Disabled","");
246  }
247  }
248 }
void gui_osd_draw_state ( int  is_osd_edit)

Definiert in Zeile 270 der Datei gui_osd.c.

271 {
272  n=0;
273 
274  if ((conf.show_state && camera_info.state.mode_rec_or_review) || is_osd_edit)
275  {
276  long t;
277 
279  //sprintf(osd_buf,"%s",get_debug());
280  //draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+6*FONT_HEIGHT, osd_buf, user_color(conf.osd_color));
282 
283  if (is_tv_override_enabled || is_osd_edit)
284  {
286  {
288  gui_print_osd_state_string_float("TV:%d.%05d", 100000, t);
289  }
290  else
291  {
296  else
298  }
299  }
300  if (is_av_override_enabled || is_osd_edit)
303  if ((conf.nd_filter_state && !(conf.override_disable==1))|| is_osd_edit)
304  gui_print_osd_state_string_chr("NDFILTER:", ((conf.nd_filter_state==1)?"IN":"OUT"));
306  gui_print_osd_state_string_chr("AUTOISO:", ((conf.autoiso_enable==1)?"ON":"OFF"));
308  {
311  {
313  {
315  }
316  else
318  }
319  }
320  if (is_iso_override_enabled || is_osd_edit)
321  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
322  if (is_osd_edit || (shooting_get_drive_mode() && m!=MODE_STITCH && m!=MODE_BEST_IMAGE))
323  {
328  else if (is_av_bracketing_enabled)
330  else if (is_iso_bracketing_enabled)
332  else if (is_sd_bracketing_enabled)
334  }
335 #ifdef OPT_CURVES
336  if (conf.curve_enable || is_osd_edit) {
337  if (conf.curve_enable==1) gui_print_osd_state_string_chr("CURVES:", "CSTM");
338  else if (conf.curve_enable==4) gui_print_osd_state_string_chr("CURVES:", "AUTO");
339  else if (conf.curve_enable==3) gui_print_osd_state_string_chr("CURVES:", "+2EV");
340  else if (conf.curve_enable==2) gui_print_osd_state_string_chr("CURVES:", "+1EV");
341  }
342 #endif
343  if (conf.override_disable == 1) gui_print_osd_state_string_chr("NO ", "OVERRIDES");
346  // edgeoverlay state
347  if (conf.edge_overlay_enable || is_osd_edit) {
349  else if (camera_info.state.edge_state_draw==1) gui_print_osd_state_string_chr("EDGE:", ((conf.edge_overlay_pano==0)?"FROZEN":"PANO"));
350  }
351 #ifdef CAM_QUALITY_OVERRIDE
352  // displaying the overriding picture quality if active
353  if (!(conf.fast_image_quality==3) || is_osd_edit) {
354  if (conf.fast_image_quality==0) gui_print_osd_state_string_chr("QUALI:", "super");
355  else if (conf.fast_image_quality==1) gui_print_osd_state_string_chr("QUALI:", "fine");
356  else if (conf.fast_image_quality==2) gui_print_osd_state_string_chr("QUALI:", "normal");
357  }
358 #endif
359 
360 /*
361  draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, get_debug(), user_color(conf.osd_color));
362  n+=FONT_HEIGHT;*/
363  }
364 }
void gui_osd_draw_temp ( int  is_osd_edit)

Definiert in Zeile 676 der Datei gui_osd.c.

677 {
678  int yofst = 0;
679 
680  if ((conf.show_temp == 1) || (conf.show_temp == 4) || is_osd_edit)
681  draw_temp("opt", get_optical_temp(), yofst++);
682 
683  if ((conf.show_temp == 2) || (conf.show_temp == 4) || is_osd_edit)
684 #ifdef CAM_HAS_CMOS
685  draw_temp("CMOS", get_ccd_temp(), yofst++);
686 #else
687  draw_temp("CCD", get_ccd_temp(), yofst++);
688 #endif
689 
690  if ((conf.show_temp == 3) || (conf.show_temp == 4) || is_osd_edit)
691  draw_temp("bat", get_battery_temp(), yofst++);
692 }
static void gui_osd_draw_values ( int  is_osd_edit,
int  is_zebra 
)
static

Definiert in Zeile 367 der Datei gui_osd.c.

368 {
369  if (is_osd_edit || (camera_info.state.mode_rec_or_review && conf.show_values))
370  {
371  // showtype
372  // 1 - show all values
373  // 2 - show DOF values only (for zebra & MF)
374  int showtype = 0;
375  if (!is_zebra &&
378  ((camera_info.state.is_shutter_half_press || (recreview_hold==1)) && (conf.show_values==SHOW_MISC_SHOOT))))
379  showtype = 1;
381  showtype = 2;
382 
387 
388  m = 0;
389 
390  short f_ex = (conf.show_dof==DOF_SHOW_IN_MISC_EX);
391 
392  if (((conf.show_dof==DOF_SHOW_IN_MISC) || f_ex) && showtype && !is_osd_edit)
393  {
404  }
405 
406  if ((showtype == 1) || is_osd_edit)
407  {
408  if (conf.values_show_zoom || is_osd_edit)
409  {
410  int fl, zp=shooting_get_zoom(), fl1=get_focal_length(zp);
411  switch (conf.zoom_value)
412  {
413  case ZOOM_SHOW_FL:
414  sprintf(osd_buf, "Z:%d.%dmm%8s", fl1/1000, fl1%1000/100, "");
415  break;
416  case ZOOM_SHOW_EFL:
418  // scale by users adapter lens eg. Canon Wide .42 or Canon Tele 1.75
419  fl = fl * conf.zoom_scale / 100;
420  sprintf(osd_buf, "Z:%3dmm%8s", fl/1000, "");
421  break;
422  case ZOOM_SHOW_X:
423  default:
424  fl=get_zoom_x(zp);
425  sprintf(osd_buf, "Z:%d/%d.%dx%8s", zp, fl/10, fl%10, "");
426  break;
427  }
429  }
430 
431  if (conf.values_show_real_aperture || is_osd_edit)
433 
434  int iso_mode = shooting_get_iso_mode();
435 
436  if ((iso_mode <= 0) || !(conf.values_show_iso_only_in_autoiso_mode))
437  {
440  }
448  }
449  }
450 }
static void gui_print_osd_dof_string_dist ( const char *  title,
int  value,
short  use_good_color,
short  is_hyp 
)
static

Definiert in Zeile 197 der Datei gui_osd.c.

197  {
198  strcpy(osd_buf, title);
199  int i=strlen(osd_buf);
201  twoColors valid_col = MAKE_COLOR(BG_COLOR(col), COLOR_GREEN);
202  if (i<8) {
204  if (is_hyp) {
205  sprintf_dist_hyp(osd_buf, value);
206  } else {
207  sprintf_dist(osd_buf, value);
208  }
209  sprintf(osd_buf+strlen(osd_buf), "%9s", "");
210  osd_buf[9-i]=0;
211  draw_osd_string(conf.values_pos, i*FONT_WIDTH, m, osd_buf, use_good_color?valid_col:col, conf.values_scale);
212  } else {
213  osd_buf[9]=0;
215  }
216  m+=FONT_HEIGHT;
217 }
static void gui_print_osd_misc_string ( )
static

Definiert in Zeile 170 der Datei gui_osd.c.

171 {
172  sprintf(osd_buf+strlen(osd_buf), "%9s", "");
173  osd_buf[9]=0; // limit length to 9 max
175  m+=FONT_HEIGHT;
176 }
static void gui_print_osd_misc_string_canon_values ( const char *  title,
short  value 
)
static

Definiert in Zeile 190 der Datei gui_osd.c.

191 {
192  strcpy(osd_buf, title);
195 }
static void gui_print_osd_misc_string_float ( const char *  fmt,
int  divisor,
int  value 
)
static

Definiert in Zeile 184 der Datei gui_osd.c.

185 {
186  sprintf(osd_buf, fmt, (int)(value/divisor), (int)(value%divisor));
188 }
static void gui_print_osd_misc_string_int ( const char *  title,
int  value 
)
static

Definiert in Zeile 178 der Datei gui_osd.c.

179 {
180  sprintf(osd_buf, "%s%d", title, value);
182 }
static void gui_print_osd_state_string ( )
static

Definiert in Zeile 144 der Datei gui_osd.c.

145 {
146  sprintf(osd_buf+strlen(osd_buf), "%12s", "");
147  osd_buf[12]=0; // limit length to 12 max
149  n+=FONT_HEIGHT;
150 }
static void gui_print_osd_state_string_chr ( const char *  title,
const char *  value 
)
static

Definiert in Zeile 158 der Datei gui_osd.c.

159 {
160  sprintf(osd_buf, "%s%s", title, value);
162 }
static void gui_print_osd_state_string_float ( const char *  fmt,
int  divisor,
int  value 
)
static

Definiert in Zeile 164 der Datei gui_osd.c.

165 {
166  sprintf(osd_buf, fmt, (int)(value/divisor), (int)(value%divisor));
168 }
static void gui_print_osd_state_string_int ( const char *  title,
int  value 
)
static

Definiert in Zeile 152 der Datei gui_osd.c.

153 {
154  sprintf(osd_buf, "%s%d", title, value);
156 }
static int gui_std_kbd_process ( )
static

Definiert in Zeile 932 der Datei gui_osd.c.

933 {
934 #ifdef CAM_USE_ZOOM_FOR_MF
936  return 1;
937 #endif
938 
940  return 1;
941 
942  // Process Shutter Half Press + BUTTON shortcuts
944 
945  // process other keys in not <alt> mode
946 
947 #if CAM_AF_SCAN_DURING_VIDEO_RECORD
948  if (is_video_recording())
950 #endif
951 
952 #if CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
953  // return from digital to optical zoom in video
954 #if CAM_HAS_ZOOM_LEVER
956 #else
958 #endif
959  {
960  short x;
961  // state = 1 => digital zoom standard
963  {
965 #if defined(CAM_USE_OPTICAL_MAX_ZOOM_STATUS)
966  if (x==0) zoom_status=ZOOM_OPTICAL_MAX; //ERR99: No zoom back from digital to optical zoom possible if set to medium
967 #else
969 #endif
970  }
971  }
972 #endif
973 
974 #if CAM_EV_IN_VIDEO
976  {
977 #if CAM_HAS_ERASE_BUTTON
979 #elif CAM_HAS_DISP_BUTTON
981 #else
983 #endif
984  {
986 #ifdef CAM_TOUCHSCREEN_UI
987  redraw_buttons = 1;
988 #endif
989  }
990  if (get_ev_video_avail())
991  {
993  {
995  }
997  {
999  }
1000  }
1001  }
1002 #endif
1003 
1004  return 0;
1005 }
const char* gui_video_bitrate_enum ( int  change,
int  arg 
)

Definiert in Zeile 1161 der Datei gui.c.

1162 {
1163  static const char *modes[]={ "0.25x", "0.5x","0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x", "2.5x", "3x"};
1164  gui_enum_value_change(&conf.video_bitrate,change,sizeof(modes)/sizeof(modes[0]));
1165 
1166  if (change)
1168 
1169  return modes[conf.video_bitrate];
1170 }
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 875 der Datei gui_osd.c.

876 {
877  if (kbd_is_key_clicked(button))
878  {
879  (*var)++;
880  if (*var > max_value)
881  {
882  *var = 0;
884  }
885  }
886 }
static int kbd_use_up_down_left_right_as_fast_switch ( )
static

Definiert in Zeile 730 der Datei gui_osd.c.

731 {
732  static long key_pressed = 0;
733  int ev_video = 0;
734 
735 #if CAM_EV_IN_VIDEO
736  ev_video = get_ev_video_avail();
737 #endif
738 
739  // One of the control options must be enabled or don't do anything
741 
742  // Clear state variable is neither UP or DOWN is pressed
743  if (!kbd_is_key_pressed(KEY_UP) && !kbd_is_key_pressed(KEY_DOWN)) key_pressed = 0;
744 
745  // Must be in record mode and not have either Canon menu open
746  if ( (canon_menu_active!=(int)&canon_menu_active-4) || canon_shoot_menu_active!=0 || !camera_info.state.mode_rec) return 0;
747 
748  // Adjust exposure if 'Enable Fast EV switch?' option is set
749  if (conf.fast_ev && (key_pressed == 0) && (camera_info.state.mode_shooting != MODE_M))
750  {
751 #if !CAM_HAS_JOGDIAL
753  {
757  key_pressed = KEY_UP;
758 
759  return 1;
760  }
761 
763  {
767  key_pressed = KEY_DOWN;
768 
769  return 1;
770  }
771 #else
772  int jogdial=get_jogdial_direction();
773 
775  {
779  }
780 
782  {
786  }
787 #endif
788  }
789 
790  // Adjust video quality/bitrate if 'Video Quality Control?' option is set
791 #ifndef CAM_MOVIEREC_NEWSTYLE
792  if (conf.fast_movie_quality_control && key_pressed == 0 && is_video_recording())
793  {
795  {
796  if (conf.video_mode==0)
797  {
798 #if !CAM_VIDEO_QUALITY_ONLY
800  movie_reset = 1;
801 #endif
802  }
803  else if (conf.video_mode==1)
804  {
805  conf.video_quality+=1;
808  movie_reset = 1;
809  }
810  key_pressed = KEY_UP;
811  return 1;
812  }
813 
815  {
816  if (conf.video_mode==0)
817  {
818 #if !CAM_VIDEO_QUALITY_ONLY
819  conf.video_bitrate-=1;
820  if (conf.video_bitrate<0)
822 
824  movie_reset = 1;
825 #endif
826  }
827  else if (conf.video_mode==1)
828  {
829  conf.video_quality-=1;
830  if (conf.video_quality<1)
832  movie_reset = 1;
833  }
834  key_pressed = KEY_DOWN;
835  return 1;
836  }
837  }
838 #endif // !CAM_MOVIEREC_NEWSTYLE
839 
840 #if CAM_VIDEO_CONTROL
841  // Pause / unpause video if 'Fast Movie Control' option is set
842  if (conf.fast_movie_control && key_pressed == 0 && !ev_video
843 #ifndef CAM_HAS_VIDEO_BUTTON
845 #endif
846  )
847  {
849  {
850  set_movie_status(1); // set to stop
851  key_pressed = KEY_LEFT;
852  return 1;
853  }
854 
855  // reyalp - HACK for cams that can do video in any mode
856  // note that this means this will probably run whenever you press right
857  // BUG this doesn't know whether recording was stopped or paused.
859  {
860  set_movie_status(2); // resume
861  movie_reset = 1;
862  key_pressed = KEY_RIGHT;
863  return 1;
864  }
865  }
866 #endif
867 
868  return key_pressed;
869 }
int osd_visible ( )

Definiert in Zeile 1011 der Datei gui_osd.c.

1012 {
1013  if ( conf.show_osd )
1014  {
1015  if ( conf.hide_osd == 0 ) return 1;
1016 
1018  {
1020  {
1021  if ( conf.hide_osd < 2 ) return 1;
1022 
1023 #if defined(PARAM_DISPLAY_MODE1) && defined(PARAM_DISPLAY_MODE2)
1024  short disp_key_mode ;
1025  if (recreview_hold == 0)
1026  {
1027  if (shooting_get_display_mode() == 0) return 1;
1028  }
1029  else
1030  {
1032  {
1033  get_parameter_data(PARAM_DISPLAY_MODE2, &disp_key_mode, 2);
1034  if (disp_key_mode == 0) return 1;
1035  }
1036  }
1037  }
1038  else
1039  {
1040  if (conf.hide_osd == 2 )
1041  {
1042  short disp_key_mode ;
1043  get_parameter_data(PARAM_DISPLAY_MODE1, &disp_key_mode, 2);
1044  if (disp_key_mode == 1) return 1;
1045  }
1046  }
1047 #else
1048  if (shooting_get_display_mode() == 0) return 1;
1049  }
1050 #endif
1051  }
1052  }
1053 
1054  return 0;
1055 }
static void print_dist ( char *  buf,
int  dist,
short  is_hyp 
)
static

Definiert in Zeile 46 der Datei gui_osd.c.

46  {
47 // length of printed string is always 4
48  if (dist<=0 || (!(is_hyp) && shooting_is_infinity_distance())) {
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 }
static const char* shooting_get_av_bracket_value ( )
static

Definiert in Zeile 265 der Datei gui_osd.c.

266 {
268 }
static const char* shooting_get_bracket_type ( )
static

Definiert in Zeile 252 der Datei gui_osd.c.

253 {
254  static const char * expo_type[] = { "+/-", "-", "+", "-/+" };
255  return expo_type[conf.bracket_type];
256 }
static const char* shooting_get_tv_bracket_value ( )
static

Definiert in Zeile 260 der Datei gui_osd.c.

261 {
263 }
static void sprintf_canon_values ( char *  buf,
short  dist 
)
static

Definiert in Zeile 76 der Datei gui_osd.c.

77 {
78  short v=((dist<0)?-dist:dist);
79  sprintf(buf, "%s%d.%02d", ((dist<0)?"-":""), v/96, v%96);
80 }
static void sprintf_dist ( char *  buf,
int  dist 
)
static

Definiert in Zeile 65 der Datei gui_osd.c.

66 {
67  print_dist(buf, dist, 0);
68 }
static void sprintf_dist_hyp ( char *  buf,
int  dist 
)
static

Definiert in Zeile 71 der Datei gui_osd.c.

72 {
73  print_dist(buf, dist, 1);
74 }

Variablen-Dokumentation

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

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

int half_disp_press = 0
static

Definiert in Zeile 873 der Datei gui_osd.c.

short m
static

Definiert in Zeile 142 der Datei gui_osd.c.

unsigned int movie_reset
static

Definiert in Zeile 509 der Datei gui_osd.c.

short n
static

Definiert in Zeile 142 der Datei gui_osd.c.

char osd_buf[64]
static

Definiert in Zeile 25 der Datei gui_osd.c.