-void BScreen::rereadMenu(void) {
- InitMenu();
- raiseWindows(0, 0);
-
- rootmenu->reconfigure();
-}
-
-
-void BScreen::LoadStyle(void) {
- Configuration style(False);
-
- const char *sfile = blackbox->getStyleFilename();
- if (sfile != NULL) {
- style.setFile(sfile);
- if (! style.load()) {
- style.setFile(DEFAULTSTYLE);
- if (! style.load())
- style.create(); // hardcoded default values will be used.
- }
- }
-
- // merge in the rc file
- style.merge(config->file(), True);
-
- string s;
-
- // load fonts/fontsets
- if (resource.wstyle.font)
- delete resource.wstyle.font;
- if (resource.tstyle.font)
- delete resource.tstyle.font;
- if (resource.mstyle.f_font)
- delete resource.mstyle.f_font;
- if (resource.mstyle.t_font)
- delete resource.mstyle.t_font;
- resource.wstyle.font = resource.tstyle.font = resource.mstyle.f_font =
- resource.mstyle.t_font = (BFont *) 0;
-
- resource.wstyle.font = readDatabaseFont("window.", style);
- resource.tstyle.font = readDatabaseFont("toolbar.", style);
- resource.mstyle.t_font = readDatabaseFont("menu.title.", style);
- resource.mstyle.f_font = readDatabaseFont("menu.frame.", style);
-
- // load window config
- resource.wstyle.t_focus =
- readDatabaseTexture("window.title.focus", "white", style);
- resource.wstyle.t_unfocus =
- readDatabaseTexture("window.title.unfocus", "black", style);
- resource.wstyle.l_focus =
- readDatabaseTexture("window.label.focus", "white", style);
- resource.wstyle.l_unfocus =
- readDatabaseTexture("window.label.unfocus", "black", style);
- resource.wstyle.h_focus =
- readDatabaseTexture("window.handle.focus", "white", style);
- resource.wstyle.h_unfocus =
- readDatabaseTexture("window.handle.unfocus", "black", style);
- resource.wstyle.g_focus =
- readDatabaseTexture("window.grip.focus", "white", style);
- resource.wstyle.g_unfocus =
- readDatabaseTexture("window.grip.unfocus", "black", style);
- resource.wstyle.b_focus =
- readDatabaseTexture("window.button.focus", "white", style);
- resource.wstyle.b_unfocus =
- readDatabaseTexture("window.button.unfocus", "black", style);
- resource.wstyle.b_pressed =
- readDatabaseTexture("window.button.pressed", "black", style);
-
- //if neither of these can be found, we will use the previous resource
- resource.wstyle.b_pressed_focus =
- readDatabaseTexture("window.button.pressed.focus", "black", style, true);
- resource.wstyle.b_pressed_unfocus =
- readDatabaseTexture("window.button.pressed.unfocus", "black", style, true);
-
-#ifdef BITMAPBUTTONS
- if (resource.wstyle.close_button.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.wstyle.close_button.mask);
- if (resource.wstyle.max_button.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.wstyle.max_button.mask);
- if (resource.wstyle.icon_button.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.wstyle.icon_button.mask);
- if (resource.wstyle.stick_button.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.wstyle.stick_button.mask);
-
- resource.wstyle.close_button.mask = resource.wstyle.max_button.mask =
- resource.wstyle.icon_button.mask =
- resource.wstyle.icon_button.mask = None;
-
- readDatabaseMask("window.button.close.mask", resource.wstyle.close_button,
- style);
- readDatabaseMask("window.button.max.mask", resource.wstyle.max_button,
- style);
- readDatabaseMask("window.button.icon.mask", resource.wstyle.icon_button,
- style);
- readDatabaseMask("window.button.stick.mask", resource.wstyle.stick_button,
- style);
-#endif // BITMAPBUTTONS
-
- // we create the window.frame texture by hand because it exists only to
- // make the code cleaner and is not actually used for display
- BColor color = readDatabaseColor("window.frame.focusColor", "white", style);
- resource.wstyle.f_focus = BTexture("solid flat", getBaseDisplay(),
- getScreenNumber(), image_control);
- resource.wstyle.f_focus.setColor(color);
-
- color = readDatabaseColor("window.frame.unfocusColor", "white", style);
- resource.wstyle.f_unfocus = BTexture("solid flat", getBaseDisplay(),
- getScreenNumber(), image_control);
- resource.wstyle.f_unfocus.setColor(color);
-
- resource.wstyle.l_text_focus =
- readDatabaseColor("window.label.focus.textColor", "black", style);
- resource.wstyle.l_text_unfocus =
- readDatabaseColor("window.label.unfocus.textColor", "white", style);
- resource.wstyle.b_pic_focus =
- readDatabaseColor("window.button.focus.picColor", "black", style);
- resource.wstyle.b_pic_unfocus =
- readDatabaseColor("window.button.unfocus.picColor", "white", style);
-
- resource.wstyle.justify = LeftJustify;
- if (style.getValue("window.justify", s)) {
- if (s == "right" || s == "Right")
- resource.wstyle.justify = RightJustify;
- else if (s == "center" || s == "Center")
- resource.wstyle.justify = CenterJustify;
- }
-
- // sanity checks
- if (resource.wstyle.t_focus.texture() == BTexture::Parent_Relative)
- resource.wstyle.t_focus = resource.wstyle.f_focus;
- if (resource.wstyle.t_unfocus.texture() == BTexture::Parent_Relative)
- resource.wstyle.t_unfocus = resource.wstyle.f_unfocus;
- if (resource.wstyle.h_focus.texture() == BTexture::Parent_Relative)
- resource.wstyle.h_focus = resource.wstyle.f_focus;
- if (resource.wstyle.h_unfocus.texture() == BTexture::Parent_Relative)
- resource.wstyle.h_unfocus = resource.wstyle.f_unfocus;
-
- // load toolbar config
-#ifdef BITMAPBUTTONS
- if (resource.tstyle.left_button.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.tstyle.left_button.mask);
- if (resource.tstyle.right_button.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.tstyle.right_button.mask);
-#endif // BITMAPBUTTONS
-
- resource.tstyle.toolbar =
- readDatabaseTexture("toolbar", "black", style);
- resource.tstyle.label =
- readDatabaseTexture("toolbar.label", "black", style);
- resource.tstyle.window =
- readDatabaseTexture("toolbar.windowLabel", "black", style);
- resource.tstyle.button =
- readDatabaseTexture("toolbar.button", "white", style);
- resource.tstyle.pressed =
- readDatabaseTexture("toolbar.button.pressed", "black", style);
- resource.tstyle.clock =
- readDatabaseTexture("toolbar.clock", "black", style);
- resource.tstyle.l_text =
- readDatabaseColor("toolbar.label.textColor", "white", style);
- resource.tstyle.w_text =
- readDatabaseColor("toolbar.windowLabel.textColor", "white", style);
- resource.tstyle.c_text =
- readDatabaseColor("toolbar.clock.textColor", "white", style);
- resource.tstyle.b_pic =
- readDatabaseColor("toolbar.button.picColor", "black", style);
-
-#ifdef BITMAPBUTTONS
- readDatabaseMask("toolbar.button.left.mask", resource.tstyle.left_button,
- style);
- readDatabaseMask("toolbar.button.right.mask", resource.tstyle.right_button,
- style);
-#endif // BITMAPBUTTONS
-
- resource.tstyle.justify = LeftJustify;
- if (style.getValue("toolbar.justify", s)) {
- if (s == "right" || s == "Right")
- resource.tstyle.justify = RightJustify;
- else if (s == "center" || s == "Center")
- resource.tstyle.justify = CenterJustify;
- }
-
- // sanity checks
- if (resource.tstyle.toolbar.texture() == BTexture::Parent_Relative) {
- resource.tstyle.toolbar = BTexture("solid flat", getBaseDisplay(),
- getScreenNumber(), image_control);
- resource.tstyle.toolbar.setColor(BColor("black", getBaseDisplay(),
- getScreenNumber()));
- }
-
- // load menu config
-#ifdef BITMAPBUTTONS
- if (resource.mstyle.bullet_image.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.mstyle.bullet_image.mask);
- if (resource.mstyle.tick_image.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.mstyle.tick_image.mask);
-#endif // BITMAPBUTTONS
-
- resource.mstyle.title =
- readDatabaseTexture("menu.title", "white", style);
- resource.mstyle.frame =
- readDatabaseTexture("menu.frame", "black", style);
- resource.mstyle.hilite =
- readDatabaseTexture("menu.hilite", "white", style);
- resource.mstyle.t_text =
- readDatabaseColor("menu.title.textColor", "black", style);
- resource.mstyle.f_text =
- readDatabaseColor("menu.frame.textColor", "white", style);
- resource.mstyle.d_text =
- readDatabaseColor("menu.frame.disableColor", "black", style);
- resource.mstyle.h_text =
- readDatabaseColor("menu.hilite.textColor", "black", style);
-
-#ifdef BITMAPBUTTONS
- readDatabaseMask("menu.arrow.mask", resource.mstyle.bullet_image, style);
- readDatabaseMask("menu.selected.mask", resource.mstyle.tick_image, style);
-#endif // BITMAPBUTTONS
-
- resource.mstyle.t_justify = LeftJustify;
- if (style.getValue("menu.title.justify", s)) {
- if (s == "right" || s == "Right")
- resource.mstyle.t_justify = RightJustify;
- else if (s == "center" || s == "Center")
- resource.mstyle.t_justify = CenterJustify;
- }
-
- resource.mstyle.f_justify = LeftJustify;
- if (style.getValue("menu.frame.justify", s)) {
- if (s == "right" || s == "Right")
- resource.mstyle.f_justify = RightJustify;
- else if (s == "center" || s == "Center")
- resource.mstyle.f_justify = CenterJustify;
- }
-
- resource.mstyle.bullet = Basemenu::Triangle;
- if (style.getValue("menu.bullet", s)) {
- if (s == "empty" || s == "Empty")
- resource.mstyle.bullet = Basemenu::Empty;
- else if (s == "square" || s == "Square")
- resource.mstyle.bullet = Basemenu::Square;
- else if (s == "diamond" || s == "Diamond")
- resource.mstyle.bullet = Basemenu::Diamond;
- }
-
- resource.mstyle.bullet_pos = Basemenu::Left;
- if (style.getValue("menu.bullet.position", s)) {
- if (s == "right" || s == "Right")
- resource.mstyle.bullet_pos = Basemenu::Right;
- }
-
- // sanity checks
- if (resource.mstyle.frame.texture() == BTexture::Parent_Relative) {
- resource.mstyle.frame = BTexture("solid flat", getBaseDisplay(),
- getScreenNumber(), image_control);
- resource.mstyle.frame.setColor(BColor("black", getBaseDisplay(),
- getScreenNumber()));
- }
-
- resource.border_color =
- readDatabaseColor("borderColor", "black", style);
-
- // load bevel, border and handle widths
- if (! style.getValue("handleWidth", resource.handle_width) ||
- resource.handle_width > (getWidth() / 2) || resource.handle_width == 0)
- resource.handle_width = 6;
-
- if (! style.getValue("borderWidth", resource.border_width))
- resource.border_width = 1;
-
- if (! style.getValue("bevelWidth", resource.bevel_width) ||
- resource.bevel_width > (getWidth() / 2) || resource.bevel_width == 0)
- resource.bevel_width = 3;
-
- if (! style.getValue("frameWidth", resource.frame_width) ||
- resource.frame_width > (getWidth() / 2))
- resource.frame_width = resource.bevel_width;
-
- if (style.getValue("rootCommand", s))
- bexec(s, displayString());
-}
-