X-Git-Url: https://git.jsancho.org/?p=guile-irrlicht.git;a=blobdiff_plain;f=src%2Fgui-skin.cpp;h=06242ddebec7fab5f344dd920847cf13eafff45a;hp=6e4f66e8a88a4823316f08bca462ae49a4feed3d;hb=357f279e004c6257a160205835c06c283d317ef7;hpb=384a8fb56d8500dc3551085191a39c9da70e221c diff --git a/src/gui-skin.cpp b/src/gui-skin.cpp index 6e4f66e..06242dd 100644 --- a/src/gui-skin.cpp +++ b/src/gui-skin.cpp @@ -80,141 +80,151 @@ init_gui_skin (void) gui::EGUI_DEFAULT_COLOR scm_to_default_color (SCM default_color) { - char* color = scm_to_utf8_string (scm_symbol_to_string (default_color)); - if (!strcmp (color, "3d-dark-shadow")) + char* color_name = scm_to_utf8_string (scm_symbol_to_string (default_color)); + gui::EGUI_DEFAULT_COLOR color; + + if (!strcmp (color_name, "3d-dark-shadow")) { - return gui::EGDC_3D_DARK_SHADOW; + color = gui::EGDC_3D_DARK_SHADOW; } - else if (!strcmp (color, "3d-shadow")) + else if (!strcmp (color_name, "3d-shadow")) { - return gui::EGDC_3D_SHADOW; + color = gui::EGDC_3D_SHADOW; } - else if (!strcmp (color, "3d-face")) + else if (!strcmp (color_name, "3d-face")) { - return gui::EGDC_3D_FACE; + color = gui::EGDC_3D_FACE; } - else if (!strcmp (color, "3d-high-light")) + else if (!strcmp (color_name, "3d-high-light")) { - return gui::EGDC_3D_HIGH_LIGHT; + color = gui::EGDC_3D_HIGH_LIGHT; } - else if (!strcmp (color, "3d-light")) + else if (!strcmp (color_name, "3d-light")) { - return gui::EGDC_3D_LIGHT; + color = gui::EGDC_3D_LIGHT; } - else if (!strcmp (color, "active-border")) + else if (!strcmp (color_name, "active-border")) { - return gui::EGDC_ACTIVE_BORDER; + color = gui::EGDC_ACTIVE_BORDER; } - else if (!strcmp (color, "active-caption")) + else if (!strcmp (color_name, "active-caption")) { - return gui::EGDC_ACTIVE_CAPTION; + color = gui::EGDC_ACTIVE_CAPTION; } - else if (!strcmp (color, "app-workspace")) + else if (!strcmp (color_name, "app-workspace")) { - return gui::EGDC_APP_WORKSPACE; + color = gui::EGDC_APP_WORKSPACE; } - else if (!strcmp (color, "button-text")) + else if (!strcmp (color_name, "button-text")) { - return gui::EGDC_BUTTON_TEXT; + color = gui::EGDC_BUTTON_TEXT; } - else if (!strcmp (color, "gray-text")) + else if (!strcmp (color_name, "gray-text")) { - return gui::EGDC_GRAY_TEXT; + color = gui::EGDC_GRAY_TEXT; } - else if (!strcmp (color, "high-light")) + else if (!strcmp (color_name, "high-light")) { - return gui::EGDC_HIGH_LIGHT; + color = gui::EGDC_HIGH_LIGHT; } - else if (!strcmp (color, "high-light-text")) + else if (!strcmp (color_name, "high-light-text")) { - return gui::EGDC_HIGH_LIGHT_TEXT; + color = gui::EGDC_HIGH_LIGHT_TEXT; } - else if (!strcmp (color, "inactive-border")) + else if (!strcmp (color_name, "inactive-border")) { - return gui::EGDC_INACTIVE_BORDER; + color = gui::EGDC_INACTIVE_BORDER; } - else if (!strcmp (color, "inactive-caption")) + else if (!strcmp (color_name, "inactive-caption")) { - return gui::EGDC_INACTIVE_CAPTION; + color = gui::EGDC_INACTIVE_CAPTION; } - else if (!strcmp (color, "tooltip")) + else if (!strcmp (color_name, "tooltip")) { - return gui::EGDC_TOOLTIP; + color = gui::EGDC_TOOLTIP; } - else if (!strcmp (color, "tooltip-background")) + else if (!strcmp (color_name, "tooltip-background")) { - return gui::EGDC_TOOLTIP_BACKGROUND; + color = gui::EGDC_TOOLTIP_BACKGROUND; } - else if (!strcmp (color, "scrollbar")) + else if (!strcmp (color_name, "scrollbar")) { - return gui::EGDC_SCROLLBAR; + color = gui::EGDC_SCROLLBAR; } - else if (!strcmp (color, "window")) + else if (!strcmp (color_name, "window")) { - return gui::EGDC_WINDOW; + color = gui::EGDC_WINDOW; } - else if (!strcmp (color, "window-symbol")) + else if (!strcmp (color_name, "window-symbol")) { - return gui::EGDC_WINDOW_SYMBOL; + color = gui::EGDC_WINDOW_SYMBOL; } - else if (!strcmp (color, "icon")) + else if (!strcmp (color_name, "icon")) { - return gui::EGDC_ICON; + color = gui::EGDC_ICON; } - else if (!strcmp (color, "icon-high-light")) + else if (!strcmp (color_name, "icon-high-light")) { - return gui::EGDC_ICON_HIGH_LIGHT; + color = gui::EGDC_ICON_HIGH_LIGHT; } - else if (!strcmp (color, "gray-window-symbol")) + else if (!strcmp (color_name, "gray-window-symbol")) { - return gui::EGDC_GRAY_WINDOW_SYMBOL; + color = gui::EGDC_GRAY_WINDOW_SYMBOL; } - else if (!strcmp (color, "editable")) + else if (!strcmp (color_name, "editable")) { - return gui::EGDC_EDITABLE; + color = gui::EGDC_EDITABLE; } - else if (!strcmp (color, "gray-editable")) + else if (!strcmp (color_name, "gray-editable")) { - return gui::EGDC_GRAY_EDITABLE; + color = gui::EGDC_GRAY_EDITABLE; } - else if (!strcmp (color, "focused-editable")) + else if (!strcmp (color_name, "focused-editable")) { - return gui::EGDC_FOCUSED_EDITABLE; + color = gui::EGDC_FOCUSED_EDITABLE; } else { scm_error (scm_arg_type_key, NULL, "Wrong default color: ~S", scm_list_1 (default_color), scm_list_1 (default_color)); } + + free (color_name); + return color; } gui::EGUI_DEFAULT_FONT scm_to_default_font (SCM default_font) { - char* font = scm_to_utf8_string (scm_symbol_to_string (default_font)); - if (!strcmp (font, "default")) + char* font_name = scm_to_utf8_string (scm_symbol_to_string (default_font)); + gui::EGUI_DEFAULT_FONT font; + + if (!strcmp (font_name, "default")) { - return gui::EGDF_DEFAULT; + font = gui::EGDF_DEFAULT; } - else if (!strcmp (font, "button")) + else if (!strcmp (font_name, "button")) { - return gui::EGDF_BUTTON; + font = gui::EGDF_BUTTON; } - else if (!strcmp (font, "window")) + else if (!strcmp (font_name, "window")) { - return gui::EGDF_WINDOW; + font = gui::EGDF_WINDOW; } - else if (!strcmp (font, "menu")) + else if (!strcmp (font_name, "menu")) { - return gui::EGDF_MENU; + font = gui::EGDF_MENU; } - else if (!strcmp (font, "tooltip")) + else if (!strcmp (font_name, "tooltip")) { - return gui::EGDF_TOOLTIP; + font = gui::EGDF_TOOLTIP; } else { scm_error (scm_arg_type_key, NULL, "Wrong default font: ~S", scm_list_1 (default_font), scm_list_1 (default_font)); } + + free (font_name); + return font; }