1 #include "bcdisplayinfo.h"
3 #include "bclistbox.inc"
4 #include "bcresources.h"
7 #include "bcwindowbase.h"
9 #include "colormodels.h"
17 #include <X11/extensions/XShm.h>
24 int BC_Resources::error = 0;
26 VFrame* BC_Resources::bg_image = 0;
27 VFrame* BC_Resources::menu_bg = 0;
29 char* BC_Resources::small_font = N_("-*-helvetica-medium-r-normal-*-10-*");
30 char* BC_Resources::small_font2 = N_("-*-helvetica-medium-r-normal-*-11-*");
31 char* BC_Resources::medium_font = N_("-*-helvetica-bold-r-normal-*-14-*");
32 char* BC_Resources::medium_font2 = N_("-*-helvetica-bold-r-normal-*-14-*");
33 char* BC_Resources::large_font = N_("-*-helvetica-bold-r-normal-*-18-*");
34 char* BC_Resources::large_font2 = N_("-*-helvetica-bold-r-normal-*-20-*");
36 char* BC_Resources::small_fontset = "6x12,*";
37 char* BC_Resources::medium_fontset = "7x14,*";
38 char* BC_Resources::large_fontset = "8x16,*";
40 char* BC_Resources::small_font_xft = N_("-microsoft-verdana-*-*-*-*-*-*-*-*-*-*-*-*");
41 char* BC_Resources::medium_font_xft = N_("-microsoft-verdana-*-*-*-*-*-*-*-*-*-*-*-*");
42 char* BC_Resources::large_font_xft = N_("-microsoft-verdana-*-*-*-*-*-*-*-*-*-*-*-*");
44 suffix_to_type_t BC_Resources::suffix_to_type[] =
48 { "mp2", ICON_SOUND },
49 { "mp3", ICON_SOUND },
55 BC_Signals* BC_Resources::signal_handler = 0;
57 int BC_Resources::x_error_handler(Display *display, XErrorEvent *event)
60 XGetErrorText(event->display, event->error_code, string, 1024);
61 // printf("BC_Resources::x_error_handler: %s\n", string);
62 BC_Resources::error = 1;
68 BC_Resources::BC_Resources()
70 display_info = new BC_DisplayInfo("", 0);
78 static VFrame* type_to_icon = 0;
80 #include "images/cancel_up_png.h"
81 #include "images/cancel_hi_png.h"
82 #include "images/cancel_dn_png.h"
83 static VFrame* default_cancel_images[] =
85 new VFrame(cancel_up_png),
86 new VFrame(cancel_hi_png),
87 new VFrame(cancel_dn_png)
90 #include "images/ok_up_png.h"
91 #include "images/ok_hi_png.h"
92 #include "images/ok_dn_png.h"
93 static VFrame* default_ok_images[] =
95 new VFrame(ok_up_png),
96 new VFrame(ok_hi_png),
100 #include "images/usethis_up_png.h"
101 #include "images/usethis_uphi_png.h"
102 #include "images/usethis_dn_png.h"
103 static VFrame* default_usethis_images[] =
105 new VFrame(usethis_up_png),
106 new VFrame(usethis_uphi_png),
107 new VFrame(usethis_dn_png)
110 static VFrame* default_checkbox_images = 0;
111 static VFrame* default_radial_images = 0;
112 static VFrame* default_label_images = 0;
117 static VFrame* default_filebox_text_images = 0;
118 static VFrame* default_filebox_icons_images = 0;
119 static VFrame* default_filebox_updir_images = 0;
120 static VFrame* default_filebox_newfolder_images = 0;
127 horizontal_slider_data = 0;
128 vertical_slider_data = 0;
131 #include "images/pot_hi_png.h"
132 #include "images/pot_up_png.h"
133 #include "images/pot_dn_png.h"
134 static VFrame *default_pot_images[] =
136 new VFrame(pot_up_png),
137 new VFrame(pot_hi_png),
138 new VFrame(pot_dn_png)
141 #include "images/progress_up_png.h"
142 #include "images/progress_hi_png.h"
143 static VFrame* default_progress_images[] =
145 new VFrame(progress_up_png),
146 new VFrame(progress_hi_png)
150 pan_text_color = YELLOW;
152 #include "images/7seg_small/0_png.h"
153 #include "images/7seg_small/1_png.h"
154 #include "images/7seg_small/2_png.h"
155 #include "images/7seg_small/3_png.h"
156 #include "images/7seg_small/4_png.h"
157 #include "images/7seg_small/5_png.h"
158 #include "images/7seg_small/6_png.h"
159 #include "images/7seg_small/7_png.h"
160 #include "images/7seg_small/8_png.h"
161 #include "images/7seg_small/9_png.h"
162 #include "images/7seg_small/colon_png.h"
163 #include "images/7seg_small/period_png.h"
164 #include "images/7seg_small/a_png.h"
165 #include "images/7seg_small/b_png.h"
166 #include "images/7seg_small/c_png.h"
167 #include "images/7seg_small/d_png.h"
168 #include "images/7seg_small/e_png.h"
169 #include "images/7seg_small/f_png.h"
170 #include "images/7seg_small/space_png.h"
171 #include "images/7seg_small/dash_png.h"
172 static VFrame* default_medium_7segment[] =
184 new VFrame(colon_png),
185 new VFrame(period_png),
192 new VFrame(space_png),
196 draw_clock_background=1;
205 bg_light2 = bg_color;
207 default_text_color = BLACK;
208 disabled_text_color = MEGREY;
210 button_light = WHITE; // bright corner
211 button_highlighted = 0xffe000; // face when highlighted
212 button_down = MDGREY; // face when down
213 button_up = 0xffc000; // face when up
214 button_shadow = DKGREY; // dark corner
215 button_uphighlighted = RED; // upper side when highlighted
218 tumble_duration = 150;
220 ok_images = default_ok_images;
221 cancel_images = default_cancel_images;
222 usethis_button_images = default_usethis_images;
225 menu_highlighted = LTBLUE;
228 menu_shadow = DKCYAN;
230 popup_title_text = BLACK;
231 menu_item_text = BLACK;
232 menu_highlighted_fontcolor = BLACK;
233 progress_text = BLACK;
235 text_default = BLACK;
236 text_background = WHITE;
237 highlight_inverse = WHITE ^ BLUE;
238 text_highlight = BLUE;
240 // Delays must all be different for repeaters
244 tooltip_delay = 1000;
245 tooltip_bg_color = YELLOW;
246 tooltips_enabled = 1;
248 filebox_mode = LISTBOX_TEXT;
249 sprintf(filebox_filter, "*");
252 filebox_columntype[0] = FILEBOX_NAME;
253 filebox_columntype[1] = FILEBOX_SIZE;
254 filebox_columntype[2] = FILEBOX_DATE;
255 filebox_columnwidth[0] = 200;
256 filebox_columnwidth[1] = 100;
257 filebox_columnwidth[2] = 100;
259 filebox_text_images = 0;
260 filebox_icons_images = 0;
261 filebox_updir_images = 0;
262 filebox_newfolder_images = 0;
264 filebox_sortcolumn = 0;
265 filebox_sortorder = BC_ListBox::SORT_ASCENDING;
267 pot_images = default_pot_images;
268 pot_x1 = pot_images[0]->get_w() / 2 - 2;
269 pot_y1 = pot_images[0]->get_h() / 2 - 2;;
271 pot_needle_color = BLACK;
273 progress_images = default_progress_images;
277 meter_font = SMALLFONT_3D;
278 meter_font_color = RED;
281 medium_7segment = default_medium_7segment;
283 listboxitemselected_color = BLUE;
285 audiovideo_color = RED;
289 // Xft has priority over font set
298 recursive_resizing = 1;
303 BC_Resources::~BC_Resources()
307 int BC_Resources::initialize_display(BC_WindowBase *window)
309 // Set up IPC cleanup handlers
312 // Test for shm. Must come before yuv test
318 int BC_Resources::init_shm(BC_WindowBase *window)
321 XSetErrorHandler(BC_Resources::x_error_handler);
323 if(!XShmQueryExtension(window->display)) use_shm = 0;
326 XShmSegmentInfo test_shm;
329 test_image = XShmCreateImage(window->display, window->vis, window->default_depth,
330 ZPixmap, (char*)NULL, &test_shm, 5, 5);
332 test_shm.shmid = shmget(IPC_PRIVATE, 5 * test_image->bytes_per_line, (IPC_CREAT | 0777 ));
333 data = (unsigned char *)shmat(test_shm.shmid, NULL, 0);
334 shmctl(test_shm.shmid, IPC_RMID, 0);
335 BC_Resources::error = 0;
336 XShmAttach(window->display, &test_shm);
337 XSync(window->display, False);
338 if(BC_Resources::error) use_shm = 0;
339 XDestroyImage(test_image);
340 shmdt(test_shm.shmaddr);
342 // XSetErrorHandler(0);
346 int BC_Resources::get_top_border()
348 return display_info->get_top_border();
351 int BC_Resources::get_left_border()
353 return display_info->get_left_border();
356 int BC_Resources::get_right_border()
358 return display_info->get_right_border();
361 int BC_Resources::get_bottom_border()
363 return display_info->get_bottom_border();
367 int BC_Resources::get_bg_color() { return bg_color; }
369 int BC_Resources::get_bg_shadow1() { return bg_shadow1; }
371 int BC_Resources::get_bg_shadow2() { return bg_shadow2; }
373 int BC_Resources::get_bg_light1() { return bg_light1; }
375 int BC_Resources::get_bg_light2() { return bg_light2; }