CHDK_DE Vorschauversion  Trunk Rev. 6014
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
gui_space.c-Dateireferenz
#include "camera_info.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 12 der Datei gui_space.c.

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

Definiert in Zeile 112 der Datei gui_space.c.

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

Definiert in Zeile 170 der Datei gui_space.c.

171 {
172  if (conf.space_icon_show || is_osd_edit)
174 
175  if (conf.space_perc_show || conf.space_mb_show || is_osd_edit)
176  gui_space_draw_value(is_osd_edit);
177 
178  if ((conf.space_bar_show == 1) || is_osd_edit)
180 
181  if (conf.space_bar_show == 2 || is_osd_edit)
183 }
static void gui_space_draw_spacebar_horizontal ( )
static

Definiert in Zeile 60 der Datei gui_space.c.

61 {
62  coord x;
63 
64  // Setup and draw outer shape
66 
67  // space bar fill
68  x = width - ((perc*width)/100);
69  if (x < 1) x = 1;
70  if (x >= width) x = width;
71  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
72  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
73 }
static void gui_space_draw_spacebar_vertical ( )
static

Definiert in Zeile 75 der Datei gui_space.c.

75  {
76  coord y;
77 
78  // Setup and draw outer shape
80 
81  // space bar fill
82  y = height - ((perc*height)/100);
83  if (y < 1) y = 1;
84  if (y >= height) y = height;
85  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
86  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
87 }
static void gui_space_draw_value ( int  force)
static

Definiert in Zeile 135 der Datei gui_space.c.

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

Definiert in Zeile 23 der Datei gui_space.c.

24 {
25  perc = get_space_perc();
27  if (((conf.space_warn_type == 0) && (perc <= conf.space_perc_warn)) ||
28  ((conf.space_warn_type == 1) && (GetFreeCardSpaceKb() <= (unsigned)conf.space_mb_warn*1024)))
29  {
31  }
32 }
static void spacebar_outer ( OSD_pos  pos,
int  w,
int  h 
)
static

Definiert in Zeile 35 der Datei gui_space.c.

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

Variablen-Dokumentation

twoColors cl
static

Definiert in Zeile 18 der Datei gui_space.c.

int height
static

Definiert in Zeile 20 der Datei gui_space.c.

char osd_buf[32]
static

Definiert in Zeile 8 der Datei gui_space.c.

int perc
static

Definiert in Zeile 20 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 89 der Datei gui_space.c.

int width
static

Definiert in Zeile 20 der Datei gui_space.c.

coord xx
static

Definiert in Zeile 19 der Datei gui_space.c.

coord yy
static

Definiert in Zeile 19 der Datei gui_space.c.