CHDK_DE Vorschauversion  Trunk Rev. 5648
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
gui_space.c-Dateireferenz
#include "camera_info.h"
#include "stdlib.h"
#include "conf.h"
#include "sd_card.h"
#include "gui_draw.h"
#include "gui_space.h"
+ Include-Abhängigkeitsdiagramm für gui_space.c:

gehe zum Quellcode dieser Datei

Funktionen

unsigned long get_space_perc ()
 
static void space_color ()
 
static void spacebar_outer (OSD_pos pos, int w, int h)
 
static void gui_space_draw_spacebar_horizontal ()
 
static void gui_space_draw_spacebar_vertical ()
 
static void gui_space_draw_icon ()
 
static void gui_space_draw_value (int force)
 
void gui_space_draw_osd (int is_osd_edit)
 

Variablen

static char osd_buf [32]
 
static twoColors cl
 
static coord xx
 
static coord yy
 
static int perc
 
static int width
 
static int height
 
static icon_cmd space_icon []
 

Dokumentation der Funktionen

unsigned long get_space_perc ( )

Definiert in Zeile 13 der Datei gui_space.c.

13  {
14  // accuracy reduced to support cards up to 2TB
15  return (GetFreeCardSpaceKb()>>6)*100/(GetTotalCardSpaceKb()>>6);
16 }
static void gui_space_draw_icon ( )
static

Definiert in Zeile 113 der Datei gui_space.c.

114 {
115  space_color();
116 
118  color cl2 = IDX_COLOR_GREEN;
119  if (((conf.space_warn_type == 0) && (perc <= conf.space_perc_warn)) ||
120  ((conf.space_warn_type == 1) && (GetFreeCardSpaceKb() <= conf.space_mb_warn*1024)))
121  {
122  cl1 = IDX_COLOR_RED_DK;
123  cl2 = IDX_COLOR_RED;
124  }
125 
126  // Set dynamic properties for space left
127  space_icon[16].cb = cl1;
128  space_icon[17].x1 = 27 - (17 * perc / 100);
129  space_icon[17].cf = space_icon[17].cb = cl2;
130 
131  // Draw icon
133 }
void gui_space_draw_osd ( int  is_osd_edit)

Definiert in Zeile 171 der Datei gui_space.c.

172 {
173  if (conf.space_icon_show || is_osd_edit)
175 
176  if (conf.space_perc_show || conf.space_mb_show || is_osd_edit)
177  gui_space_draw_value(is_osd_edit);
178 
179  if ((conf.space_bar_show == 1) || is_osd_edit)
181 
182  if (conf.space_bar_show == 2 || is_osd_edit)
184 }
static void gui_space_draw_spacebar_horizontal ( )
static

Definiert in Zeile 61 der Datei gui_space.c.

62 {
63  coord x;
64 
65  // Setup and draw outer shape
67 
68  // space bar fill
69  x = width - ((perc*width)/100);
70  if (x < 1) x = 1;
71  if (x >= width) x = width;
72  else draw_rectangle(xx+x+2, yy+2, xx+width+1, yy+height+1, MAKE_COLOR(FG_COLOR(cl), FG_COLOR(cl)), RECT_BORDER0|DRAW_FILLED); // If not empty fill 'free' space area
73  draw_rectangle(xx+2, yy+2, xx+x+1, yy+height+1, MAKE_COLOR(COLOR_TRANSPARENT, COLOR_BLACK), RECT_BORDER1|DRAW_FILLED); // fill 'used' space area
74 }
static void gui_space_draw_spacebar_vertical ( )
static

Definiert in Zeile 76 der Datei gui_space.c.

76  {
77  coord y;
78 
79  // Setup and draw outer shape
81 
82  // space bar fill
83  y = height - ((perc*height)/100);
84  if (y < 1) y = 1;
85  if (y >= height) y = height;
86  else draw_rectangle(xx+2, yy+y+2, xx+width+1, yy+height+1, MAKE_COLOR(FG_COLOR(cl), FG_COLOR(cl)), RECT_BORDER0|DRAW_FILLED); // If not empty fill 'free' space area
87  draw_rectangle(xx+2, yy+2, xx+width+1, yy+y+1, MAKE_COLOR(COLOR_TRANSPARENT, COLOR_BLACK), RECT_BORDER1|DRAW_FILLED); // fill 'used' space area
88 }
static void gui_space_draw_value ( int  force)
static

Definiert in Zeile 136 der Datei gui_space.c.

137 {
138  int offset = 0;
139 
140  space_color();
141 
142  if ((conf.show_partition_nr) && (get_part_count() > 1))
143  {
144  sprintf(osd_buf, "%1d:\0", get_active_partition());
145  offset = 2;
146  }
147 
148  if (is_partition_changed())
149  {
150  sprintf(osd_buf+offset, "???\0");
151  }
152  else
153  {
154  if (conf.space_perc_show || force)
155  {
156  sprintf(osd_buf+offset, "%3d%%\0", perc);
157  }
158  else if (conf.space_mb_show)
159  {
160  unsigned int freemb = GetFreeCardSpaceKb()/1024;
161  if (freemb < 10000) sprintf(osd_buf+offset, "%4dM\0",freemb);
162  else sprintf(osd_buf+offset, "%4dG\0",freemb/1024); // if 10 GiB or more free, print in GiB instead of MiB
163  }
164  }
165 
167 }
static void space_color ( )
static

Definiert in Zeile 24 der Datei gui_space.c.

25 {
26  perc = get_space_perc();
28  if (((conf.space_warn_type == 0) && (perc <= conf.space_perc_warn)) ||
30  {
32  }
33 }
static void spacebar_outer ( OSD_pos  pos,
int  w,
int  h 
)
static

Definiert in Zeile 36 der Datei gui_space.c.

37 {
38  // Get color and percent free
39  space_color();
40 
41  // space icon / bar position
42  xx = pos.x;
43  yy = pos.y;
44 
45  // space icon / bar size
46  width = w;
47  height = h;
48 
49  // Clamp co-ordinates to keep bar on screen
50  if (xx > (camera_screen.width-width-4)) {
52  }
53  if (yy > (camera_screen.height-height-4)) {
55  }
56 
57  draw_rectangle(xx, yy, xx+width+3, yy+height+3, MAKE_COLOR(COLOR_BLACK,COLOR_BLACK), RECT_BORDER1); // Outer black rectangle
58  draw_rectangle(xx+1, yy+1, xx+width+2, yy+height+2, cl, RECT_BORDER1); // Inner white/red rectangle
59 }

Variablen-Dokumentation

twoColors cl
static

Definiert in Zeile 19 der Datei gui_space.c.

int height
static

Definiert in Zeile 21 der Datei gui_space.c.

char osd_buf[32]
static

Definiert in Zeile 9 der Datei gui_space.c.

int perc
static

Definiert in Zeile 21 der Datei gui_space.c.

icon_cmd space_icon[]
static
Initialisierung:
=
{
{ IA_HLINE, 0, 0, 30, 0, IDX_COLOR_GREY_LT, IDX_COLOR_GREY_LT },
{ IA_VLINE, 0, 0, 0, 13, IDX_COLOR_GREY_LT, IDX_COLOR_GREY_LT },
{ IA_VLINE, 31, 0, 0, 19, IDX_COLOR_GREY, IDX_COLOR_GREY },
{ IA_LINE, 1, 13, 5, 17, IDX_COLOR_GREY, IDX_COLOR_GREY },
{ IA_HLINE, 6, 18, 24, 0, IDX_COLOR_GREY, IDX_COLOR_GREY },
{ IA_FILLED_RECT, 1, 1, 30, 13, IDX_COLOR_GREY_DK, IDX_COLOR_GREY_DK },
{ IA_FILLED_RECT, 5, 14, 30, 17, IDX_COLOR_GREY_DK, IDX_COLOR_GREY_DK },
{ IA_FILLED_RECT, 3, 14, 6, 15, IDX_COLOR_GREY_DK, IDX_COLOR_GREY_DK },
{ IA_FILLED_RECT, 2, 2, 6, 4, IDX_COLOR_YELLOW_DK, IDX_COLOR_YELLOW_DK },
{ IA_FILLED_RECT, 2, 6, 6, 7, IDX_COLOR_YELLOW_DK, IDX_COLOR_YELLOW_DK },
{ IA_FILLED_RECT, 2, 9, 6, 10, IDX_COLOR_YELLOW_DK, IDX_COLOR_YELLOW_DK },
{ IA_FILLED_RECT, 2, 12, 6, 13, IDX_COLOR_YELLOW_DK, IDX_COLOR_YELLOW_DK },
{ IA_FILLED_RECT, 5, 15, 9, 13, IDX_COLOR_YELLOW_DK, IDX_COLOR_YELLOW_DK },
{ IA_HLINE, 8, 0, 2, 0, IDX_COLOR_TRANSPARENT, IDX_COLOR_TRANSPARENT },
{ IA_HLINE, 11, 0, 3, 0, IDX_COLOR_WHITE, IDX_COLOR_WHITE },
{ IA_HLINE, 11, 18, 2, 0, IDX_COLOR_TRANSPARENT, IDX_COLOR_TRANSPARENT },
{ IA_RECT, 9, 5, 28, 13, 0, 0 },
{ IA_FILLED_RECT, 27, 6, 27, 12, 0, 0 },
{ IA_END }
}

Definiert in Zeile 90 der Datei gui_space.c.

int width
static

Definiert in Zeile 21 der Datei gui_space.c.

coord xx
static

Definiert in Zeile 20 der Datei gui_space.c.

coord yy
static

Definiert in Zeile 20 der Datei gui_space.c.