CHDK_DE Vorschauversion  Trunk Rev. 5234
 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 1314 der Datei gui_osd.c.

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

Definiert in Zeile 1108 der Datei gui_osd.c.

1109 {
1110 #ifdef OPT_DEBUGGING
1111 
1112 #if defined(OPT_EXMEM_TESTING)
1113  // Only do memory corruption testing if not recording video
1115  {
1116  extern void exmem_testing();
1117  exmem_testing();
1118  }
1119 #endif
1120 
1121 #if defined(OPT_ARAM_TESTING)
1122  extern void aram_testing();
1123  aram_testing();
1124 #endif
1125 
1127 
1128 #define DBGMISCVALS_X ((CAM_SCREEN_WIDTH/FONT_WIDTH)-17)
1129 #define DBGMISCVALS_Y ((CAM_SCREEN_HEIGHT/FONT_HEIGHT)-6)
1130 
1131  // DEBUG: "Show misc. values"
1132  // change ROW to fit values on screen in draw_txt_string(COLUMN, ROW, ...)
1133  // uncomment call to gui_draw_debug_vals_osd() in gui_redraw() if you want debug values always on top
1134  if (conf.debug_misc_vals_show) {
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  long v=get_file_counter();
1180  sprintf(osd_buf, "1:%03d-%04d", (v>>18)&0x3FF, (v>>4)&0x3FFF);
1181  sprintf(osd_buf, "1:%d, %08X", xxxx, eeee);
1182  */
1183  }
1184  {
1185  int r,i, p, len;
1187 
1188  for (i=0;i<10;i++){
1189  r = 0;
1190  p = conf.debug_propcase_page*10+i;
1191  get_property_case(p, &r, 4);
1192  sprintf(osd_buf, "%3d: %d ", p, r);
1193  osd_buf[20]=0;
1195  }
1196  }
1197 
1199  char s[30];
1200  int count;
1201 
1202  for (i=0;i<10;i++){
1203  r = 0;
1204  p = conf.debug_propcase_page*10+i;
1205  if (p>=get_flash_params_count()) {
1206  sprintf(osd_buf, "%3d: This parameter does not exists", p);
1207  } else {
1208  len = get_parameter_size(p);
1209  if ((len==1)||(len==2)||(len==4)){
1210  get_parameter_data(p, &r, len);
1211  sprintf(osd_buf, "%3d: %30d :%2d ", p, r,len);
1212  }
1213  else {
1214  if (len>=sizeof(s)) count=sizeof(s)-1; else count=len;
1215  get_parameter_data(p, &s, count);
1216  s[count]=0;
1217  sprintf(osd_buf, "%3d: %30s :%2d ", p, s,len);
1218  }
1219  }
1221  }
1222  }
1224 
1225  for (i=0;i<10;i++){
1226  p = conf.debug_propcase_page*10+i;
1227  if (p>=uiprop_count) {
1228  sprintf(osd_buf, "%3d: Does not exist ", p);
1229  } else {
1230  r = get_uiprop_value(p);
1231  sprintf(osd_buf, "%3d: %hi ", p, r);
1232  }
1233  osd_buf[20]=0;
1235  }
1236  }
1237  }
1238 
1239 #ifndef CAM_DRYOS
1241  gui_debug_draw_tasklist();
1242 #endif
1243 #endif
1244 }
void gui_draw_osd ( )

Definiert in Zeile 1300 der Datei gui_osd.c.

1301 {
1302  if (half_disp_press)
1303  return;
1304 
1306  gui_draw_osd_elements(0,0);
1307 
1309 
1311 }
void gui_draw_osd_elements ( int  is_osd_edit,
int  is_zebra 
)

Definiert in Zeile 1273 der Datei gui_osd.c.

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

Definiert in Zeile 889 der Datei gui_osd.c.

890 {
891  static int half_disp_press_old=0;
892 
894  {
895  if (conf.enable_shortcuts == 1)
896  {
901  }
902 #if !CAM_HAS_MANUAL_FOCUS && CAM_HAS_ZOOM_LEVER
903  // Todo, check for AF and if its running, don't override
908  }
909  } else if (kbd_is_key_pressed(SHORTCUT_SD_ADD)) {
913  }
914  }
915 #endif
916  }
917 
919  if (half_disp_press && !half_disp_press_old)
921 #ifdef CAM_DISP_ALT_TEXT
922  if (half_disp_press)
923  {
924  extern void gui_reset_alt_helper();
926  }
927 #endif
928  half_disp_press_old = half_disp_press;
929 }
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 933 der Datei gui_osd.c.

934 {
935 #ifdef CAM_USE_ZOOM_FOR_MF
937  return 1;
938 #endif
939 
941  return 1;
942 
943  // Process Shutter Half Press + BUTTON shortcuts
945 
946  // process other keys in not <alt> mode
947 
948 #if CAM_AF_SCAN_DURING_VIDEO_RECORD
949  if (is_video_recording())
951 #endif
952 
953 #if CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
954  // return from digital to optical zoom in video
955 #if CAM_HAS_ZOOM_LEVER
957 #else
959 #endif
960  {
961  short x;
962  // state = 1 => digital zoom standard
964  {
966 #if defined(CAM_USE_OPTICAL_MAX_ZOOM_STATUS)
967  if (x==0) zoom_status=ZOOM_OPTICAL_MAX; //ERR99: No zoom back from digital to optical zoom possible if set to medium
968 #else
970 #endif
971  }
972  }
973 #endif
974 
975 #if CAM_EV_IN_VIDEO
977  {
978 #if CAM_HAS_ERASE_BUTTON
980 #elif CAM_HAS_DISP_BUTTON
982 #else
984 #endif
985  {
987 #ifdef CAM_TOUCHSCREEN_UI
988  redraw_buttons = 1;
989 #endif
990  }
991  if (get_ev_video_avail())
992  {
994  {
996  }
998  {
1000  }
1001  }
1002  }
1003 #endif
1004 
1005  return 0;
1006 }
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 876 der Datei gui_osd.c.

877 {
878  if (kbd_is_key_clicked(button))
879  {
880  (*var)++;
881  if (*var > max_value)
882  {
883  *var = 0;
885  }
886  }
887 }
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  int jogdial;
735 
736 #if CAM_EV_IN_VIDEO
737  ev_video = get_ev_video_avail();
738 #endif
739 
740  // One of the control options must be enabled or don't do anything
742 
743  // Clear state variable is neither UP or DOWN is pressed
744  if (!kbd_is_key_pressed(KEY_UP) && !kbd_is_key_pressed(KEY_DOWN)) key_pressed = 0;
745 
746  // Must be in record mode and not have either Canon menu open
747  if ( (canon_menu_active!=(int)&canon_menu_active-4) || canon_shoot_menu_active!=0 || !camera_info.state.mode_rec) return 0;
748 
749  // Adjust exposure if 'Enable Fast EV switch?' option is set
750  if (conf.fast_ev && (key_pressed == 0) && (camera_info.state.mode_shooting != MODE_M))
751  {
752 #if !CAM_HAS_JOGDIAL
754  {
758  key_pressed = KEY_UP;
759 
760  return 1;
761  }
762 
764  {
768  key_pressed = KEY_DOWN;
769 
770  return 1;
771  }
772 #else
773  jogdial=get_jogdial_direction();
774 
776  {
780  }
781 
783  {
787  }
788 #endif
789  }
790 
791  // Adjust video quality/bitrate if 'Video Quality Control?' option is set
792 #ifndef CAM_MOVIEREC_NEWSTYLE
793  if (conf.fast_movie_quality_control && key_pressed == 0 && is_video_recording())
794  {
796  {
797  if (conf.video_mode==0)
798  {
799 #if !CAM_VIDEO_QUALITY_ONLY
801  movie_reset = 1;
802 #endif
803  }
804  else if (conf.video_mode==1)
805  {
806  conf.video_quality+=1;
809  movie_reset = 1;
810  }
811  key_pressed = KEY_UP;
812  return 1;
813  }
814 
816  {
817  if (conf.video_mode==0)
818  {
819 #if !CAM_VIDEO_QUALITY_ONLY
820  conf.video_bitrate-=1;
821  if (conf.video_bitrate<0)
823 
825  movie_reset = 1;
826 #endif
827  }
828  else if (conf.video_mode==1)
829  {
830  conf.video_quality-=1;
831  if (conf.video_quality<1)
833  movie_reset = 1;
834  }
835  key_pressed = KEY_DOWN;
836  return 1;
837  }
838  }
839 #endif // !CAM_MOVIEREC_NEWSTYLE
840 
841 #if CAM_VIDEO_CONTROL
842  // Pause / unpause video if 'Fast Movie Control' option is set
843  if (conf.fast_movie_control && key_pressed == 0 && !ev_video
844 #ifndef CAM_HAS_VIDEO_BUTTON
846 #endif
847  )
848  {
850  {
851  set_movie_status(1); // set to stop
852  key_pressed = KEY_LEFT;
853  return 1;
854  }
855 
856  // reyalp - HACK for cams that can do video in any mode
857  // note that this means this will probably run whenever you press right
858  // BUG this doesn't know whether recording was stopped or paused.
860  {
861  set_movie_status(2); // resume
862  movie_reset = 1;
863  key_pressed = KEY_RIGHT;
864  return 1;
865  }
866  }
867 #endif
868 
869  return key_pressed;
870 }
int osd_visible ( )

Definiert in Zeile 1012 der Datei gui_osd.c.

1013 {
1014  if ( conf.show_osd )
1015  {
1016  if ( conf.hide_osd == 0 ) return 1;
1017 
1019  {
1021  {
1022  if ( conf.hide_osd < 2 ) return 1;
1023 
1024 #if defined(PARAM_DISPLAY_MODE1) && defined(PARAM_DISPLAY_MODE2)
1025  short disp_key_mode ;
1026  if (recreview_hold == 0)
1027  {
1028  if (shooting_get_display_mode() == 0) return 1;
1029  }
1030  else
1031  {
1033  {
1034  get_parameter_data(PARAM_DISPLAY_MODE2, &disp_key_mode, 2);
1035  if (disp_key_mode == 0) return 1;
1036  }
1037  }
1038  }
1039  else
1040  {
1041  if (conf.hide_osd == 2 )
1042  {
1043  short disp_key_mode ;
1044  get_parameter_data(PARAM_DISPLAY_MODE1, &disp_key_mode, 2);
1045  if (disp_key_mode == 1) return 1;
1046  }
1047  }
1048 #else
1049  if (shooting_get_display_mode() == 0) return 1;
1050  }
1051 #endif
1052  }
1053  }
1054 
1055  return 0;
1056 }
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 1367 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 874 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.