void SetASMountLook(){ int i ; char *default_style = safemalloc( 1+strlen(MyName)+1); char buf[4096]; default_style[0] = '*' ; strcpy (&(default_style[1]), MyName ); mystyle_get_property (Scr.wmprops); for( i = 0 ; i < BACK_STYLES ; ++i ) Scr.Look.MSWindow[i] = NULL ; Scr.Look.MSWindow[BACK_UNFOCUSED] = mystyle_find( Config->UnmountedStyle ); LOCAL_DEBUG_OUT( "Configured MyStyle %d \"%s\" is %p", BACK_UNFOCUSED, Config->UnmountedStyle?Config->UnmountedStyle:"(null)", Scr.Look.MSWindow[BACK_UNFOCUSED] ); Scr.Look.MSWindow[BACK_FOCUSED] = mystyle_find( Config->MountedStyle ); LOCAL_DEBUG_OUT( "Configured MyStyle %d \"%s\" is %p", BACK_FOCUSED, Config->MountedStyle?Config->MountedStyle:"(null)", Scr.Look.MSWindow[BACK_FOCUSED] ); for( i = 0 ; i < 2 ; ++i ) { static char *default_window_style_name[BACK_STYLES] ={"unfocused_window_style", "sticky_window_style", NULL}; static char *default_style_names[DESK_STYLES] ={"*%sUnmounted", "*%sMounted" }; sprintf( buf, default_style_names[i], MyName ); if( Scr.Look.MSWindow[i] == NULL ) Scr.Look.MSWindow[i] = mystyle_find (buf); if( Scr.Look.MSWindow[i] == NULL ) Scr.Look.MSWindow[i] = mystyle_find (default_window_style_name[i]); if( Scr.Look.MSWindow[i] == NULL && i != BACK_URGENT ) Scr.Look.MSWindow[i] = mystyle_find_or_default( default_style ); show_activity( "MyStyle %d is \"%s\"", i, Scr.Look.MSWindow[i]?Scr.Look.MSWindow[i]->name:"none" ); } free( default_style ); #if defined(LOCAL_DEBUG) && !defined(NO_DEBUG_OUTPUT) PrintASMountConfig (Config); Print_balloonConfig ( Config->asmodule_config.balloon_configs[0]); #endif balloon_config2look( &(Scr.Look), NULL, Config->asmodule_config.balloon_configs[0], "*ASMountBalloon" ); set_balloon_look( Scr.Look.balloon_look ); }
MyStyle * mystyle_create_from_definition (struct ASHashTable *list, MyStyleDefinition * def) { int i; MyStyle *style; if (def == NULL || def->Name == NULL) return NULL; if ((style = mystyle_find (def->Name)) == NULL) style = mystyle_new_with_name (def->Name); if (def->inherit) { for (i = 0; i < def->inherit_num; ++i) { MyStyle *parent; if (def->inherit[i]) { if ((parent = mystyle_find_or_get_from_file (list, def->inherit[i])) != NULL) mystyle_merge_styles (parent, style, True, False); else show_error ("unknown style to inherit: %s\n", def->inherit[i]); } } } if( def->Font ) { if (get_flags(style->user_flags, F_FONT)) { unload_font (&style->font); clear_flags(style->user_flags, F_FONT); } set_string(&(style->font.name), mystrdup(def->Font)); set_flags(style->user_flags, F_FONT); } if( get_flags(def->set_flags, MYSTYLE_TextStyle ) ) { set_flags( style->user_flags, F_TEXTSTYLE ); style->text_style = def->TextStyle; } if( get_flags(def->set_flags, MYSTYLE_SLICE_SET ) ) { set_flags( style->user_flags, F_SLICE ); style->slice_x_start = def->SliceXStart; style->slice_x_end = def->SliceXEnd; style->slice_y_start = def->SliceYStart; style->slice_y_end = def->SliceYEnd; } if( get_flags(def->set_flags, MYSTYLE_BlurSize ) ) { set_flags( style->user_flags, F_BLUR ); style->blur_x = def->BlurSize.width; style->blur_y = def->BlurSize.height; } if( def->ForeColor ) { if (parse_argb_color (def->ForeColor, &(style->colors.fore)) != def->ForeColor) set_flags(style->user_flags, F_FORECOLOR); else show_error("unable to parse Forecolor \"%s\"", def->ForeColor); } if( def->BackColor ) { if (parse_argb_color (def->BackColor, &(style->colors.back)) != def->BackColor) { style->relief.fore = GetHilite (style->colors.back); style->relief.back = GetShadow (style->colors.back); set_flags(style->user_flags, F_BACKCOLOR); }else show_error("unable to parse BackColor \"%s\"", def->BackColor); } if( def->overlay != NULL ) { MyStyle *o = mystyle_find_or_get_from_file (list, def->overlay ); if ( o != NULL) { style->overlay = o; style->overlay_type = def->overlay_type ; }else show_error ("unknown style to be overlayed with: %s\n", def->overlay ); set_flags(style->user_flags, F_OVERLAY); } if( def->texture_type > 0 && def->texture_type <= TEXTURE_GRADIENT_END ) { int type = def->back_grad_type; ASGradient gradient = {0}; Bool success = False; if( type <= TEXTURE_OLD_GRADIENT_END ) { ARGB32 color1 = ARGB32_White, color2 = ARGB32_Black; parse_argb_color( def->back_grad_colors[0], &color1 ); parse_argb_color( def->back_grad_colors[1], &color2 ); if ((type = mystyle_parse_old_gradient (type, color1, color2, &gradient)) >= 0) { if (style->user_flags & F_BACKGRADIENT) { free (style->gradient.color); free (style->gradient.offset); } style->gradient = gradient; style->gradient.type = mystyle_translate_grad_type (type); LOCAL_DEBUG_OUT( "style %p type = %d", style, style->gradient.type ); success = True ; } else show_error("Error in MyStyle \"%s\": invalid gradient type %d", style->name, type); }else { int i ; gradient.npoints = def->back_grad_npoints; gradient.color = safecalloc(gradient.npoints, sizeof(ARGB32)); gradient.offset = safecalloc(gradient.npoints, sizeof(double)); for( i = 0 ; i < gradient.npoints ; ++i ) { ARGB32 color = ARGB32_White; parse_argb_color (def->back_grad_colors[i], &color ); gradient.color[i] = color ; gradient.offset[i] = def->back_grad_offsets[i] ; } gradient.offset[0] = 0.0; gradient.offset[gradient.npoints - 1] = 1.0; if (style->user_flags & F_BACKGRADIENT) { free (style->gradient.color); free (style->gradient.offset); } style->gradient = gradient; style->gradient.type = mystyle_translate_grad_type (type); success = True ; } if( success ) { style->texture_type = def->texture_type; set_flags( style->user_flags, F_BACKGRADIENT ); }else { if (gradient.color != NULL) free (gradient.color); if (gradient.offset != NULL) free (gradient.offset); show_error("Error in MyStyle \"%s\": bad gradient", style->name); } }else if( def->texture_type > TEXTURE_GRADIENT_END && def->texture_type <= TEXTURE_TEXTURED_END ) { int type = def->texture_type; if ( get_flags(style->user_flags, F_BACKPIXMAP) ) { mystyle_free_back_icon(style); clear_flags (style->user_flags, F_BACKTRANSPIXMAP | F_BACKPIXMAP); } clear_flags (style->inherit_flags, F_BACKTRANSPIXMAP | F_BACKPIXMAP); LOCAL_DEBUG_OUT( "calling mystyle_free_back_icon for style %p", style ); if (type == TEXTURE_TRANSPARENT || type == TEXTURE_TRANSPARENT_TWOWAY) { /* treat second parameter as ARGB tint value : */ if (parse_argb_color (def->back_pixmap, &(style->tint)) == def->back_pixmap) style->tint = TINT_LEAVE_SAME; /* use no tinting by default */ else if (type == TEXTURE_TRANSPARENT) style->tint = (style->tint >> 1) & 0x7F7F7F7F; /* converting old style tint */ /*LOCAL_DEBUG_OUT( "tint is 0x%X (from %s)", style->tint, tmp);*/ set_flags (style->user_flags, F_BACKPIXMAP); style->texture_type = type; } else { /* treat second parameter as an image filename : */ if ( load_icon(&(style->back_icon), def->back_pixmap, get_screen_image_manager(NULL) ))