#include "bcsignals.h"
#include "bcsynchronous.h"
#include "bcwindowbase.h"
-#include "colors.h"
+#include "bccolors.h"
#include "bccmodels.h"
#include "cstrdup.h"
#include "fonts.h"
char BC_Resources::encoding[LEN_ENCOD] = {0};
const char *BC_Resources::wide_encoding = 0;
ArrayList<BC_FontEntry*> *BC_Resources::fontlist = 0;
+int BC_Resources::font_debug = 0;
const char *BC_Resources::fc_properties[] = { FC_SLANT, FC_WEIGHT, FC_WIDTH };
#define LEN_FCPROP (sizeof(BC_Resources::fc_properties) / sizeof(const char*))
"-*-bitstream charter-bold-r-normal-*-*-0-%d-%d-p-0-iso8859-1"; // 160
static const char *def_big_font2 =
"-*-nimbus sans l-bold-r-normal-*-*-0-%d-%d-p-0-iso8859-1"; // 160
+static const char *def_clock_font = "-*-helvetica-bold-r-normal-*-%d-*"; // 16
+static const char *def_clock_font2 = "-*-helvetica-bold-r-normal-*-%d-*"; // 18
static const char *def_small_fontset = "-*-helvetica-medium-r-normal-*-%d-*";// 10
static const char *def_medium_fontset = "-*-helvetica-bold-r-normal-*-%d-*"; // 14
static const char *def_large_fontset = "-*-helvetica-bold-r-normal-*-%d-*"; // 18
static const char *def_big_fontset = "-*-helvetica-bold-r-normal-*-%d-*"; // 24
+static const char *def_clock_fontset = "-*-helvetica-bold-r-normal-*-%d-*"; // 16
+
static const char *def_small_font_xft = "Sans:pixelsize=%.4f"; // 10.6667
static const char *def_small_b_font_xft = "Sans:bold:pixelsize=%.4f"; // 10.6667
static const char *def_medium_font_xft = "Sans:pixelsize=%.4f"; // 13.3333
static const char *def_large_b_font_xft = "Sans:bold:pixelsize=%.4f"; // 21.3333
static const char *def_big_font_xft = "Sans:pixelsize=37.3333"; // 37.3333
static const char *def_big_b_font_xft = "Sans:bold:pixelsize=37.33333"; // 37.3333
+static const char *def_clock_font_xft = "Sans:pixelsize=%.4f"; // 16
#define default_font_xft2 "-microsoft-verdana-*-*-*-*-*-*-*-*-*-*-*-*"
const char* BC_Resources::large_font2 = 0;
const char* BC_Resources::big_font = 0;
const char* BC_Resources::big_font2 = 0;
+const char* BC_Resources::clock_font = 0;
+const char* BC_Resources::clock_font2 = 0;
const char* BC_Resources::small_fontset = 0;
const char* BC_Resources::medium_fontset = 0;
const char* BC_Resources::large_fontset = 0;
const char* BC_Resources::big_fontset = 0;
+const char* BC_Resources::clock_fontset = 0;
const char* BC_Resources::small_font_xft = 0;
const char* BC_Resources::small_font_xft2 = 0;
const char* BC_Resources::small_b_font_xft = 0;
const char* BC_Resources::big_font_xft = 0;
const char* BC_Resources::big_font_xft2 = 0;
const char* BC_Resources::big_b_font_xft = 0;
+const char* BC_Resources::clock_font_xft = 0;
+const char* BC_Resources::clock_font_xft2 = 0;
#define def_font(v, s...) do { sprintf(string,def_##v,s); v = cstrdup(string); } while(0)
#define set_font(v, s) do { sprintf(string, "%s", s); v = cstrdup(string); } while(0)
def_font(large_font, iround(scale*18));
def_font(large_font2, iround(scale*20));
def_font(big_font, iround(scale*160), iround(scale*160));
- def_font(big_font2, iround(scale*160), iround(scale*160));
+ def_font(big_font2, iround(scale*16), iround(scale*16));
+ def_font(clock_font, iround(scale*16));
+ def_font(clock_font2, iround(scale*18));
def_font(small_fontset, iround(scale*10));
def_font(medium_fontset, iround(scale*14));
def_font(large_fontset, iround(scale*18));
def_font(big_fontset, iround(scale*24));
+ def_font(clock_fontset, iround(scale*16));
def_font(small_font_xft, (scale*10.6667));
def_font(small_b_font_xft, (scale*10.6667));
def_font(medium_font_xft, (scale*13.3333));
def_font(large_b_font_xft, (scale*21.3333));
def_font(big_font_xft, (scale*37.3333));
def_font(big_b_font_xft, (scale*37.3333));
+ def_font(clock_font_xft, (scale*16.));
set_font(small_font_xft2, default_font_xft2);
set_font(medium_font_xft2, default_font_xft2);
set_font(large_font_xft2, default_font_xft2);
set_font(big_font_xft2, default_font_xft2);
+ set_font(clock_font_xft2, default_font_xft2);
+}
+void BC_Resources::finit_font_defs()
+{
+ delete [] small_font;
+ delete [] small_font2;
+ delete [] medium_font;
+ delete [] medium_font2;
+ delete [] large_font;
+ delete [] large_font2;
+ delete [] big_font;
+ delete [] big_font2;
+ delete [] clock_font;
+ delete [] clock_font2;
+ delete [] small_fontset;
+ delete [] medium_fontset;
+ delete [] large_fontset;
+ delete [] big_fontset;
+ delete [] clock_fontset;
+ delete [] small_font_xft;
+ delete [] small_b_font_xft;
+ delete [] medium_font_xft;
+ delete [] medium_b_font_xft;
+ delete [] large_font_xft;
+ delete [] large_b_font_xft;
+ delete [] big_font_xft;
+ delete [] big_b_font_xft;
+ delete [] clock_font_xft;
+
+ delete [] small_font_xft2;
+ delete [] medium_font_xft2;
+ delete [] large_font_xft2;
+ delete [] big_font_xft2;
+ delete [] clock_font_xft2;
}
+
suffix_to_type_t BC_Resources::suffix_to_type[] =
{
- { "m2v", ICON_FILM },
- { "mov", ICON_FILM },
- { "mp2", ICON_SOUND },
- { "mp3", ICON_SOUND },
- { "ac3", ICON_SOUND },
- { "mpg", ICON_FILM },
- { "vob", ICON_FILM },
- { "ifo", ICON_FILM },
- { "ts", ICON_FILM },
- { "vts", ICON_FILM },
- { "wav", ICON_SOUND }
+ { "aac", ICON_SOUND },
+ { "ac3", ICON_SOUND },
+ { "dts", ICON_SOUND },
+ { "f4a", ICON_SOUND },
+ { "flac", ICON_SOUND },
+ { "m4a", ICON_SOUND },
+ { "mp2", ICON_SOUND },
+ { "mp3", ICON_SOUND },
+ { "mpc", ICON_SOUND },
+ { "oga", ICON_SOUND },
+ { "ogg", ICON_SOUND },
+ { "opus", ICON_SOUND },
+ { "ra", ICON_SOUND },
+ { "tta", ICON_SOUND },
+ { "vox", ICON_SOUND },
+ { "wav", ICON_SOUND },
+ { "wma", ICON_SOUND },
+ { "3gp", ICON_FILM },
+ { "avi", ICON_FILM },
+ { "bmp", ICON_FILM },
+ { "cr2", ICON_FILM },
+ { "dnxhd", ICON_FILM },
+ { "drc", ICON_FILM },
+ { "dv", ICON_FILM },
+ { "dvd", ICON_FILM },
+ { "exr", ICON_FILM },
+ { "f4v", ICON_FILM },
+ { "flv", ICON_FILM },
+ { "gif", ICON_FILM },
+ { "gxf", ICON_FILM },
+ { "h263", ICON_FILM },
+ { "h264", ICON_FILM },
+ { "h265", ICON_FILM },
+ { "hevc", ICON_FILM },
+ { "ifo", ICON_FILM },
+ { "jpeg", ICON_FILM },
+ { "jpg", ICON_FILM },
+ { "m2t", ICON_FILM },
+ { "m2ts", ICON_FILM },
+ { "m2v", ICON_FILM },
+ { "m4p", ICON_FILM },
+ { "m4v", ICON_FILM },
+ { "mkv", ICON_FILM },
+ { "mov", ICON_FILM },
+ { "mp4", ICON_FILM },
+ { "mpe", ICON_FILM },
+ { "mpeg", ICON_FILM },
+ { "mpg", ICON_FILM },
+ { "mpv", ICON_FILM },
+ { "mts", ICON_FILM },
+ { "mxf", ICON_FILM },
+ { "ogv", ICON_FILM },
+ { "pcm", ICON_FILM },
+ { "pgm", ICON_FILM },
+ { "png", ICON_FILM },
+ { "ppm", ICON_FILM },
+ { "qt", ICON_FILM },
+ { "rm", ICON_FILM },
+ { "rmvb", ICON_FILM },
+ { "rv", ICON_FILM },
+ { "swf", ICON_FILM },
+ { "tif", ICON_FILM },
+ { "tiff", ICON_FILM },
+ { "ts", ICON_FILM },
+ { "vob", ICON_FILM },
+ { "vts", ICON_FILM },
+ { "webm", ICON_FILM },
+ { "webp", ICON_FILM },
+ { "wmv", ICON_FILM },
+ { "xml", ICON_FILM },
+ { "y4m", ICON_FILM },
+ { 0, 0 },
};
BC_Signals* BC_Resources::signal_handler = 0;
return cpus;
}
+void BC_Resources::new_vframes(int n, VFrame *vframes[], ...)
+{
+ va_list ap;
+ va_start(ap, vframes);
+ for( int i=0; i<n; ++i )
+ vframes[i] = va_arg(ap, VFrame *);
+ va_end(ap);
+}
+
+VFrame *BC_Resources::default_type_to_icon[6] = { 0, };
+VFrame *BC_Resources::default_bar = 0;
+VFrame *BC_Resources::default_cancel_images[3] = { 0, };
+VFrame *BC_Resources::default_ok_images[3] = { 0, };
+VFrame *BC_Resources::default_usethis_images[3] = { 0, };
+#if 0
+VFrame *BC_Resources::default_checkbox_images[5] = { 0, };
+VFrame *BC_Resources::default_radial_images[5] = { 0, };
+VFrame *BC_Resources::default_label_images[5] = { 0, };
+#endif
+VFrame *BC_Resources::default_menuitem_data[3] = { 0, };
+VFrame *BC_Resources::default_menubar_data[3] = { 0, };
+VFrame *BC_Resources::default_menu_popup_bg = 0;
+VFrame *BC_Resources::default_menu_bar_bg = 0;
+VFrame *BC_Resources::default_check_image = 0;
+VFrame *BC_Resources::default_filebox_text_images[3] = { 0, };
+VFrame *BC_Resources::default_filebox_icons_images[3] = { 0, };
+VFrame *BC_Resources::default_filebox_updir_images[3] = { 0, };
+VFrame *BC_Resources::default_filebox_newfolder_images[3] = { 0, };
+VFrame *BC_Resources::default_filebox_rename_images[3] = { 0, };
+VFrame *BC_Resources::default_filebox_delete_images[3] = { 0, };
+VFrame *BC_Resources::default_filebox_reload_images[3] = { 0, };
+VFrame *BC_Resources::default_listbox_button[4] = { 0, };
+VFrame *BC_Resources::default_listbox_bg = 0;
+VFrame *BC_Resources::default_listbox_expand[5] = { 0, };
+VFrame *BC_Resources::default_listbox_column[3] = { 0, };
+VFrame *BC_Resources::default_listbox_up = 0;
+VFrame *BC_Resources::default_listbox_dn = 0;
+VFrame *BC_Resources::default_pot_images[3] = { 0, };
+VFrame *BC_Resources::default_progress_images[2] = { 0, };
+VFrame *BC_Resources::default_medium_7segment[20] = { 0, };
+
BC_Resources::BC_Resources()
{
synchronous = 0;
vframe_shm = 0;
double default_scale = 1.0; // display_size/1000.;
- char *env = getenv("BC_FONT_SCALE");
+ char *env = getenv("BC_FONT_DEBUG");
+ font_debug = env ? atoi(env) : 0;
+ env = getenv("BC_FONT_SCALE");
font_scale = env ? atof(env) : default_scale;
if( font_scale <= 0 ) font_scale = 1;
init_font_defs(font_scale);
wide_encoding = little_endian ? "UTF32LE" : "UTF32BE";
use_xvideo = 1;
-#include "images/file_film_png.h"
#include "images/file_folder_png.h"
-#include "images/file_sound_png.h"
#include "images/file_unknown_png.h"
+#include "images/file_film_png.h"
+#include "images/file_sound_png.h"
+#include "images/file_label_png.h"
#include "images/file_column_png.h"
- static VFrame* default_type_to_icon[] =
- {
- new VFramePng(file_folder_png),
- new VFramePng(file_unknown_png),
- new VFramePng(file_film_png),
- new VFramePng(file_sound_png),
- new VFramePng(file_column_png)
- };
- type_to_icon = default_type_to_icon;
-
+new_vframes(6,default_type_to_icon,
+ new VFramePng(file_folder_png),
+ new VFramePng(file_unknown_png),
+ new VFramePng(file_film_png),
+ new VFramePng(file_sound_png),
+ new VFramePng(file_label_png),
+ new VFramePng(file_column_png));
#include "images/bar_png.h"
- static VFrame* default_bar = new VFramePng(bar_png);
- bar_data = default_bar;
-
+ default_bar = new VFramePng(bar_png);
#include "images/cancel_up_png.h"
#include "images/cancel_hi_png.h"
#include "images/cancel_dn_png.h"
- static VFrame* default_cancel_images[] =
- {
- new VFramePng(cancel_up_png),
- new VFramePng(cancel_hi_png),
- new VFramePng(cancel_dn_png)
- };
+new_vframes(3,default_cancel_images,
+ new VFramePng(cancel_up_png),
+ new VFramePng(cancel_hi_png),
+ new VFramePng(cancel_dn_png));
#include "images/ok_up_png.h"
#include "images/ok_hi_png.h"
#include "images/ok_dn_png.h"
- static VFrame* default_ok_images[] =
- {
- new VFramePng(ok_up_png),
- new VFramePng(ok_hi_png),
- new VFramePng(ok_dn_png)
- };
+new_vframes(3,default_ok_images,
+ new VFramePng(ok_up_png),
+ new VFramePng(ok_hi_png),
+ new VFramePng(ok_dn_png));
#include "images/usethis_up_png.h"
#include "images/usethis_uphi_png.h"
#include "images/usethis_dn_png.h"
- static VFrame* default_usethis_images[] =
- {
- new VFramePng(usethis_up_png),
- new VFramePng(usethis_uphi_png),
- new VFramePng(usethis_dn_png)
- };
+new_vframes(3,default_usethis_images,
+ new VFramePng(usethis_up_png),
+ new VFramePng(usethis_uphi_png),
+ new VFramePng(usethis_dn_png));
#if 0
#include "images/checkbox_checked_png.h"
#include "images/checkbox_checkedhi_png.h"
#include "images/checkbox_up_png.h"
#include "images/checkbox_hi_png.h"
- static VFrame* default_checkbox_images[] =
- {
- new VFramePng(checkbox_up_png),
- new VFramePng(checkbox_hi_png),
- new VFramePng(checkbox_checked_png),
- new VFramePng(checkbox_dn_png),
- new VFramePng(checkbox_checkedhi_png)
- };
+new_vframes(5,default_checkbox_images,
+ new VFramePng(checkbox_up_png),
+ new VFramePng(checkbox_hi_png),
+ new VFramePng(checkbox_checked_png),
+ new VFramePng(checkbox_dn_png),
+ new VFramePng(checkbox_checkedhi_png));
#include "images/radial_checked_png.h"
#include "images/radial_dn_png.h"
#include "images/radial_checkedhi_png.h"
#include "images/radial_up_png.h"
#include "images/radial_hi_png.h"
- static VFrame* default_radial_images[] =
- {
- new VFramePng(radial_up_png),
- new VFramePng(radial_hi_png),
- new VFramePng(radial_checked_png),
- new VFramePng(radial_dn_png),
- new VFramePng(radial_checkedhi_png)
- };
-
- static VFrame* default_label_images[] =
- {
- new VFramePng(radial_up_png),
- new VFramePng(radial_hi_png),
- new VFramePng(radial_checked_png),
- new VFramePng(radial_dn_png),
- new VFramePng(radial_checkedhi_png)
- };
+new_vframes(5,default_radial_images,
+ new VFramePng(radial_up_png),
+ new VFramePng(radial_hi_png),
+ new VFramePng(radial_checked_png),
+ new VFramePng(radial_dn_png),
+ new VFramePng(radial_checkedhi_png));
+
+new_vframes(5,default_label_images,
+ new VFramePng(radial_up_png),
+ new VFramePng(radial_hi_png),
+ new VFramePng(radial_checked_png),
+ new VFramePng(radial_dn_png),
+ new VFramePng(radial_checkedhi_png));
#endif
+#include "images/menuitem_up_png.h"
+#include "images/menuitem_hi_png.h"
+#include "images/menuitem_dn_png.h"
+new_vframes(3,default_menuitem_data,
+ new VFramePng(menuitem_up_png),
+ new VFramePng(menuitem_hi_png),
+ new VFramePng(menuitem_dn_png));
+
+#include "images/menubar_up_png.h"
+#include "images/menubar_hi_png.h"
+#include "images/menubar_dn_png.h"
+new_vframes(3,default_menubar_data,
+ new VFramePng(menubar_up_png),
+ new VFramePng(menubar_hi_png),
+ new VFramePng(menubar_dn_png));
+
+#include "images/menu_popup_bg_png.h"
+ default_menu_popup_bg = new VFramePng(menu_popup_bg_png);
+
+#include "images/menubar_bg_png.h"
+ default_menu_bar_bg = new VFramePng(menubar_bg_png);
+
#include "images/check_png.h"
- static VFrame* default_check_image = new VFramePng(check_png);
- check = default_check_image;
+ default_check_image = new VFramePng(check_png);
#include "images/file_text_up_png.h"
#include "images/file_text_hi_png.h"
#include "images/file_reload_up_png.h"
#include "images/file_reload_hi_png.h"
#include "images/file_reload_dn_png.h"
- static VFrame* default_filebox_text_images[] =
- {
- new VFramePng(file_text_up_png),
- new VFramePng(file_text_hi_png),
- new VFramePng(file_text_dn_png)
- };
-
- static VFrame* default_filebox_icons_images[] =
- {
- new VFramePng(file_icons_up_png),
- new VFramePng(file_icons_hi_png),
- new VFramePng(file_icons_dn_png)
- };
-
- static VFrame* default_filebox_updir_images[] =
- {
- new VFramePng(file_updir_up_png),
- new VFramePng(file_updir_hi_png),
- new VFramePng(file_updir_dn_png)
- };
-
- static VFrame* default_filebox_newfolder_images[] =
- {
- new VFramePng(file_newfolder_up_png),
- new VFramePng(file_newfolder_hi_png),
- new VFramePng(file_newfolder_dn_png)
- };
-
-
- static VFrame* default_filebox_rename_images[] =
- {
- new VFramePng(file_rename_up_png),
- new VFramePng(file_rename_hi_png),
- new VFramePng(file_rename_dn_png)
- };
-
- static VFrame* default_filebox_delete_images[] =
- {
- new VFramePng(file_delete_up_png),
- new VFramePng(file_delete_hi_png),
- new VFramePng(file_delete_dn_png)
- };
-
- static VFrame* default_filebox_reload_images[] =
- {
- new VFramePng(file_reload_up_png),
- new VFramePng(file_reload_hi_png),
- new VFramePng(file_reload_dn_png)
- };
+new_vframes(3,default_filebox_text_images,
+ new VFramePng(file_text_up_png),
+ new VFramePng(file_text_hi_png),
+ new VFramePng(file_text_dn_png));
+
+new_vframes(3,default_filebox_icons_images,
+ new VFramePng(file_icons_up_png),
+ new VFramePng(file_icons_hi_png),
+ new VFramePng(file_icons_dn_png));
+
+new_vframes(3,default_filebox_updir_images,
+ new VFramePng(file_updir_up_png),
+ new VFramePng(file_updir_hi_png),
+ new VFramePng(file_updir_dn_png));
+
+new_vframes(3,default_filebox_newfolder_images,
+ new VFramePng(file_newfolder_up_png),
+ new VFramePng(file_newfolder_hi_png),
+ new VFramePng(file_newfolder_dn_png));
+
+new_vframes(3,default_filebox_rename_images,
+ new VFramePng(file_rename_up_png),
+ new VFramePng(file_rename_hi_png),
+ new VFramePng(file_rename_dn_png));
+
+new_vframes(3,default_filebox_delete_images,
+ new VFramePng(file_delete_up_png),
+ new VFramePng(file_delete_hi_png),
+ new VFramePng(file_delete_dn_png));
+
+new_vframes(3,default_filebox_reload_images,
+ new VFramePng(file_reload_up_png),
+ new VFramePng(file_reload_hi_png),
+ new VFramePng(file_reload_dn_png));
#include "images/listbox_button_dn_png.h"
#include "images/listbox_button_hi_png.h"
#include "images/listbox_button_up_png.h"
#include "images/listbox_button_disabled_png.h"
- static VFrame* default_listbox_button[] =
- {
- new VFramePng(listbox_button_up_png),
- new VFramePng(listbox_button_hi_png),
- new VFramePng(listbox_button_dn_png),
- new VFramePng(listbox_button_disabled_png)
- };
- listbox_button = default_listbox_button;
+new_vframes(4,default_listbox_button,
+ new VFramePng(listbox_button_up_png),
+ new VFramePng(listbox_button_hi_png),
+ new VFramePng(listbox_button_dn_png),
+ new VFramePng(listbox_button_disabled_png));
-#include "images/menu_popup_bg_png.h"
- static VFrame* default_listbox_bg = 0;
- listbox_bg = default_listbox_bg;
+default_listbox_bg = 0;
#include "images/listbox_expandchecked_png.h"
#include "images/listbox_expandcheckedhi_png.h"
#include "images/listbox_expanddn_png.h"
#include "images/listbox_expandup_png.h"
#include "images/listbox_expanduphi_png.h"
- static VFrame* default_listbox_expand[] =
- {
- new VFramePng(listbox_expandup_png),
- new VFramePng(listbox_expanduphi_png),
- new VFramePng(listbox_expandchecked_png),
- new VFramePng(listbox_expanddn_png),
- new VFramePng(listbox_expandcheckedhi_png),
- };
- listbox_expand = default_listbox_expand;
+new_vframes(5,default_listbox_expand,
+ new VFramePng(listbox_expandup_png),
+ new VFramePng(listbox_expanduphi_png),
+ new VFramePng(listbox_expandchecked_png),
+ new VFramePng(listbox_expanddn_png),
+ new VFramePng(listbox_expandcheckedhi_png));
#include "images/listbox_columnup_png.h"
#include "images/listbox_columnhi_png.h"
#include "images/listbox_columndn_png.h"
- static VFrame* default_listbox_column[] =
- {
- new VFramePng(listbox_columnup_png),
- new VFramePng(listbox_columnhi_png),
- new VFramePng(listbox_columndn_png)
- };
- listbox_column = default_listbox_column;
-
+new_vframes(3,default_listbox_column,
+ new VFramePng(listbox_columnup_png),
+ new VFramePng(listbox_columnhi_png),
+ new VFramePng(listbox_columndn_png));
#include "images/listbox_up_png.h"
-#include "images/listbox_dn_png.h"
- listbox_up = new VFramePng(listbox_up_png);
- listbox_dn = new VFramePng(listbox_dn_png);
- listbox_title_overlap = 0;
- listbox_title_margin = 0;
- listbox_title_color = BLACK;
- listbox_title_hotspot = 5;
+ default_listbox_up = new VFramePng(listbox_up_png);
- listbox_border1 = DKGREY;
- listbox_border2_hi = RED;
- listbox_border2 = BLACK;
- listbox_border3_hi = RED;
- listbox_border3 = MEGREY;
- listbox_border4 = WHITE;
- listbox_selected = BLUE;
- listbox_highlighted = LTGREY;
- listbox_inactive = WHITE;
- listbox_text = BLACK;
+#include "images/listbox_dn_png.h"
+ default_listbox_dn = new VFramePng(listbox_dn_png);
#include "images/pot_hi_png.h"
#include "images/pot_up_png.h"
#include "images/pot_dn_png.h"
- static VFrame *default_pot_images[] =
- {
- new VFramePng(pot_up_png),
- new VFramePng(pot_hi_png),
- new VFramePng(pot_dn_png)
- };
+new_vframes(3,default_pot_images,
+ new VFramePng(pot_up_png),
+ new VFramePng(pot_hi_png),
+ new VFramePng(pot_dn_png));
#include "images/progress_up_png.h"
#include "images/progress_hi_png.h"
- static VFrame* default_progress_images[] =
- {
- new VFramePng(progress_up_png),
- new VFramePng(progress_hi_png)
- };
-
- pan_data = 0;
- pan_text_color = YELLOW;
+new_vframes(2,default_progress_images,
+ new VFramePng(progress_up_png),
+ new VFramePng(progress_hi_png));
#include "images/7seg_small/0_png.h"
#include "images/7seg_small/1_png.h"
#include "images/7seg_small/f_png.h"
#include "images/7seg_small/space_png.h"
#include "images/7seg_small/dash_png.h"
- static VFrame* default_medium_7segment[] =
- {
- new VFramePng(_0_png),
- new VFramePng(_1_png),
- new VFramePng(_2_png),
- new VFramePng(_3_png),
- new VFramePng(_4_png),
- new VFramePng(_5_png),
- new VFramePng(_6_png),
- new VFramePng(_7_png),
- new VFramePng(_8_png),
- new VFramePng(_9_png),
- new VFramePng(colon_png),
- new VFramePng(period_png),
- new VFramePng(a_png),
- new VFramePng(b_png),
- new VFramePng(c_png),
- new VFramePng(d_png),
- new VFramePng(e_png),
- new VFramePng(f_png),
- new VFramePng(space_png),
- new VFramePng(dash_png)
- };
+new_vframes(20,default_medium_7segment,
+ new VFramePng(_0_png),
+ new VFramePng(_1_png),
+ new VFramePng(_2_png),
+ new VFramePng(_3_png),
+ new VFramePng(_4_png),
+ new VFramePng(_5_png),
+ new VFramePng(_6_png),
+ new VFramePng(_7_png),
+ new VFramePng(_8_png),
+ new VFramePng(_9_png),
+ new VFramePng(colon_png),
+ new VFramePng(period_png),
+ new VFramePng(a_png),
+ new VFramePng(b_png),
+ new VFramePng(c_png),
+ new VFramePng(d_png),
+ new VFramePng(e_png),
+ new VFramePng(f_png),
+ new VFramePng(space_png),
+ new VFramePng(dash_png));
+
+ type_to_icon = default_type_to_icon;
+ bar_data = default_bar;
+ check = default_check_image;
+ listbox_button = default_listbox_button;
+ listbox_bg = default_listbox_bg;
+ listbox_expand = default_listbox_expand;
+ listbox_column = default_listbox_column;
+ listbox_up = default_listbox_up;
+ listbox_dn = default_listbox_dn;
+ listbox_title_overlap = 0;
+ listbox_title_margin = 0;
+ listbox_title_color = BLACK;
+ listbox_title_hotspot = 5;
+
+ listbox_border1 = DKGREY;
+ listbox_border2_hi = RED;
+ listbox_border2 = BLACK;
+ listbox_border3_hi = RED;
+ listbox_border3 = MEGREY;
+ listbox_border4 = WHITE;
+ listbox_selected = BLUE;
+ listbox_highlighted = LTGREY;
+ listbox_inactive = WHITE;
+ listbox_text = BLACK;
+
+ pan_data = 0;
+ pan_text_color = YELLOW;
generic_button_margin = 15;
draw_clock_background=1;
menu_up = MECYAN;
menu_shadow = DKCYAN;
-
-#include "images/menuitem_up_png.h"
-#include "images/menuitem_hi_png.h"
-#include "images/menuitem_dn_png.h"
-#include "images/menubar_up_png.h"
-#include "images/menubar_hi_png.h"
-#include "images/menubar_dn_png.h"
-#include "images/menubar_bg_png.h"
-
- static VFrame *default_menuitem_data[] =
- {
- new VFramePng(menuitem_up_png),
- new VFramePng(menuitem_hi_png),
- new VFramePng(menuitem_dn_png),
- };
- menu_item_bg = default_menuitem_data;
-
-
- static VFrame *default_menubar_data[] =
- {
- new VFramePng(menubar_up_png),
- new VFramePng(menubar_hi_png),
- new VFramePng(menubar_dn_png),
- };
menu_title_bg = default_menubar_data;
-
- menu_popup_bg = new VFramePng(menu_popup_bg_png);
-
- menu_bar_bg = new VFramePng(menubar_bg_png);
+ menu_popup_bg = default_menu_popup_bg;
+ menu_bar_bg = default_menu_bar_bg;
popupmenu_images = 0;
menu_item_text = BLACK;
menu_highlighted_fontcolor = BLACK;
progress_text = BLACK;
-
-
+ grab_input_focus = 1;
text_default = BLACK;
highlight_inverse = WHITE ^ BLUE;
text_border3_hi = LTPINK;
text_border4 = WHITE;
text_highlight = BLUE;
+ text_selected_highlight = SLBLUE;
text_inactive_highlight = MEGREY;
toggle_highlight_bg = 0;
}
+void BC_Resources::del_vframes(VFrame *vframes[], int n)
+{
+ while( --n >= 0 ) delete vframes[n];
+}
+
BC_Resources::~BC_Resources()
{
+ delete id_lock;
+ delete create_window_lock;
+ del_vframes(default_type_to_icon, 6);
+ delete default_bar;
+ del_vframes(default_cancel_images, 3);
+ del_vframes(default_ok_images, 3);
+ del_vframes(default_usethis_images, 3);
+#if 0
+ del_vframes(default_checkbox_images, 5);
+ del_vframes(default_radial_images, 5);
+ del_vframes(default_label_images, 5);
+#endif
+ del_vframes(default_menuitem_data, 3);
+ del_vframes(default_menubar_data, 3);
+ delete default_menu_popup_bg;
+ delete default_menu_bar_bg;
+ delete default_check_image;
+ del_vframes(default_filebox_text_images, 3);
+ del_vframes(default_filebox_icons_images, 3);
+ del_vframes(default_filebox_updir_images, 3);
+ del_vframes(default_filebox_newfolder_images, 3);
+ del_vframes(default_filebox_rename_images, 3);
+ del_vframes(default_filebox_delete_images, 3);
+ del_vframes(default_filebox_reload_images, 3);
+ del_vframes(default_listbox_button, 4);
+ delete default_listbox_bg;
+ del_vframes(default_listbox_expand, 5);
+ del_vframes(default_listbox_column, 3);
+ delete default_listbox_up;
+ delete default_listbox_dn;
+ del_vframes(default_pot_images, 3);
+ del_vframes(default_progress_images, 2);
+ del_vframes(default_medium_7segment, 20);
+ if( fontlist ) {
+ fontlist->remove_all_objects();
+ delete fontlist;
+ }
+ finit_font_defs();
}
int BC_Resources::initialize_display(BC_WindowBase *window)
} while(0)
char find_command[BCTEXTLEN];
- sprintf(find_command,
- "find %s -name 'fonts.dir' -print -exec cat {} \\;",
- search_path);
+ char *fp = find_command, *ep = fp+sizeof(find_command)-1;
+ fp += snprintf(fp, ep-fp, "%s", "find");
+ const char *bc_font_path = getenv("BC_FONT_PATH");
+// if BC_FONT_PATH starts with ':', omit default path
+ if( !(bc_font_path && bc_font_path[0] == ':') )
+ fp += snprintf(fp, ep-fp, " '%s'", search_path);
+ if( bc_font_path ) {
+ const char *path = bc_font_path;
+ while( *path ) {
+ char font_path[BCTEXTLEN];
+ const char *cp = strchr(path,':');
+ int len = !cp ? strlen(path) : cp-path;
+ if( len > 0 ) {
+ memcpy(font_path, path, len);
+ font_path[len] = 0; path += len;
+ fp += snprintf(fp, ep-fp, " '%s'", font_path);
+ }
+ if( cp ) ++path;
+ }
+ }
+ fp += snprintf(fp, ep-fp, " -name 'fonts.scale' -print -exec cat {} \\;");
FILE *in = popen(find_command, "r");
FT_Library freetype_library = 0;
entry->path = cstrcat(2, current_dir, string);
// Foundary
skip_str(" -", in_ptr);
- get_str(string, " -\n", in_ptr, 1);
+ get_str(string, "-\n", in_ptr, 1);
if( !string[0] ) { delete entry; continue; }
entry->foundry = cstrdup(string);
if(*in_ptr == '-') in_ptr++;
}
if(!strcasecmp(entry->swidth, "normal"))
- entry->style = FL_WIDTH_NORMAL;
+ entry->style |= FL_WIDTH_NORMAL;
else if(!strcasecmp(entry->swidth, "ultracondensed"))
- entry->style = FL_WIDTH_ULTRACONDENSED;
+ entry->style |= FL_WIDTH_ULTRACONDENSED;
else if(!strcasecmp(entry->swidth, "extracondensed"))
- entry->style = FL_WIDTH_EXTRACONDENSED;
+ entry->style |= FL_WIDTH_EXTRACONDENSED;
else if(!strcasecmp(entry->swidth, "condensed"))
- entry->style = FL_WIDTH_CONDENSED;
+ entry->style |= FL_WIDTH_CONDENSED;
else if(!strcasecmp(entry->swidth, "semicondensed"))
- entry->style = FL_WIDTH_SEMICONDENSED;
+ entry->style |= FL_WIDTH_SEMICONDENSED;
else if(!strcasecmp(entry->swidth, "semiexpanded"))
- entry->style = FL_WIDTH_SEMIEXPANDED;
+ entry->style |= FL_WIDTH_SEMIEXPANDED;
else if(!strcasecmp(entry->swidth, "expanded"))
- entry->style = FL_WIDTH_EXPANDED;
+ entry->style |= FL_WIDTH_EXPANDED;
else if(!strcasecmp(entry->swidth, "extraexpanded"))
- entry->style = FL_WIDTH_EXTRAEXPANDED;
+ entry->style |= FL_WIDTH_EXTRAEXPANDED;
else if(!strcasecmp(entry->swidth, "ultraexpanded"))
- entry->style = FL_WIDTH_ULTRAEXPANDED;
+ entry->style |= FL_WIDTH_ULTRAEXPANDED;
else
- entry->style = FL_WIDTH_NORMAL;
+ entry->style |= FL_WIDTH_NORMAL;
fontlist->append(entry);
+ if( font_debug )
+ dump_font_entry(stdout, "font 0: ", entry);
+
// printf("TitleMain::build_fonts %s: success\n", entry->path);
//printf("TitleMain::build_fonts 2\n");
}
pclose(in);
+ if( bc_font_path && bc_font_path[0] == ':' )
+ return 0;
// Load all the fonts from fontconfig
FcPattern *pat;
}
fontlist->append(entry);
+ if( font_debug )
+ dump_font_entry(stdout, "font 1: ", entry);
}
FcFontSetDestroy(fs);
strcpy(entry->displayname, entry->family);
}
fontlist->append(entry);
+ if( font_debug )
+ dump_font_entry(stdout, "font 2: ", entry);
}
FcFontSetDestroy(fs);
return 0;
{
if(!style_match)
style_match = entry;
- if(!preferred_match && (entry->style & preferred))
+ if(!preferred_match && entry->fixed_style == preferred)
preferred_match = entry;
}
}
void BC_Resources::dump_fonts(FILE *fp)
{
- for( int i=0; i<fontlist->total; ++i ) {
- BC_FontEntry *ep = fontlist->values[i];
- fprintf(fp,"%s = %s\n",ep->displayname,ep->path);
- fprintf(fp," %s:%s:%s:%s:%s:%s:%d:%d:%d:%d:%d:%s:%d:%s:%s:%d\n",
- ep->foundry, ep->family, ep->weight, ep->slant, ep->swidth, ep->adstyle,
- ep->pixelsize, ep->pointsize, ep->xres, ep->yres, ep->style, ep->spacing,
- ep->avg_width, ep->registry, ep->encoding, ep->fixed_style);
- }
+ for( int i=0; i<fontlist->total; ++i )
+ dump_font_entry(fp, "", fontlist->values[i]);
+}
+
+void BC_Resources::dump_font_entry(FILE *fp, const char *cp, BC_FontEntry *ep)
+{
+ fprintf(fp,"%s%s = %s\n",cp,ep->displayname,ep->path);
+ fprintf(fp," %s:%s:%s:%s:%s:%s:%d:%d:%d:%d:%d:%s:%d:%s:%s:%d\n",
+ ep->foundry, ep->family, ep->weight, ep->slant, ep->swidth, ep->adstyle,
+ ep->pixelsize, ep->pointsize, ep->xres, ep->yres, ep->style, ep->spacing,
+ ep->avg_width, ep->registry, ep->encoding, ep->fixed_style);
}