/[paragui]/paragui/src/themes/themeloader.cpp
ViewVC logotype

Diff of /paragui/src/themes/themeloader.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3.6.5.2.1 by braindead, Fri Nov 21 12:27:55 2003 UTC revision 1.3.6.5.2.2 by braindead, Mon Nov 24 09:17:22 2003 UTC
# Line 27  Line 27 
27  */  */
28    
29  #include "paragui.h"  #include "paragui.h"
30    #include "pgcolor.h"
31    
32  #include "theme_priv.h"  #include "theme_priv.h"
33  #include "pglog.h"  #include "pglog.h"
# Line 70  PARSE_INFO; Line 70  PARSE_INFO;
70    
71  char buff[BUFFSIZE];  char buff[BUFFSIZE];
72    
 void splitColor(SDL_Color*c, Uint32 v) {  
         c->r = (v >> 16) & 0xFF;  
         c->g = (v >> 8) & 0xFF;  
         c->b = v & 0xFF;  
 }  
   
73  void parseGlobProps(PARSE_INFO* info, const XML_Char* name, const XML_Char** atts) {  void parseGlobProps(PARSE_INFO* info, const XML_Char* name, const XML_Char** atts) {
74    
75          if(strcmp(name, "theme") == 0) {          if(strcmp(name, "theme") == 0) {
# Line 196  void parseObjectProps(PARSE_INFO* info, Line 190  void parseObjectProps(PARSE_INFO* info,
190    
191                  // set the colorkey (if there is any)                  // set the colorkey (if there is any)
192                  if(filename->hasColorKey && filename->surface) {                  if(filename->hasColorKey && filename->surface) {
193                          SDL_Color c;                          PG_Color c = filename->colorkey;
194                          splitColor(&c, filename->colorkey);                          Uint32 key = c.MapRGB(filename->surface->format);
                         Uint32 key = SDL_MapRGB(filename->surface->format, c.r, c.g, c.b);  
195                          SDL_SetColorKey(filename->surface, SDL_SRCCOLORKEY, key);                          SDL_SetColorKey(filename->surface, SDL_SRCCOLORKEY, key);
196                  }                  }
197                  object->filename[filename->name] = filename;                  object->filename[filename->name] = filename;
# Line 295  void parseObjectProps(PARSE_INFO* info, Line 288  void parseObjectProps(PARSE_INFO* info,
288                          } else if(tcscmp(T(atts[i]), T("color0")) == 0) {                          } else if(tcscmp(T(atts[i]), T("color0")) == 0) {
289                                  val = atts[i+1];                                  val = atts[i+1];
290                                  sscanf(val.c_str(), "0x%08x", &c);                                  sscanf(val.c_str(), "0x%08x", &c);
291                                  gradient->color[0].val = c;                                  gradient->colors[0] = c;
                                 splitColor(&(gradient->color[0].c), c);  
292                          } else if(tcscmp(T(atts[i]), T("color1")) == 0) {                          } else if(tcscmp(T(atts[i]), T("color1")) == 0) {
293                                  val = atts[i+1];                                  val = atts[i+1];
294                                  sscanf(val.c_str(), "0x%08x", &c);                                  sscanf(val.c_str(), "0x%08x", &c);
295                                  gradient->color[1].val = c;                                  gradient->colors[1] = c;
                                 splitColor(&(gradient->color[1].c), c);  
296                          } else if(tcscmp(T(atts[i]), T("color2")) == 0) {                          } else if(tcscmp(T(atts[i]), T("color2")) == 0) {
297                                  val = atts[i+1];                                  val = atts[i+1];
298                                  sscanf(val.c_str(), "0x%08x", &c);                                  sscanf(val.c_str(), "0x%08x", &c);
299                                  gradient->color[2].val = c;                                  gradient->colors[2] = c;
                                 splitColor(&(gradient->color[2].c), c);  
300                          } else if(tcscmp(T(atts[i]), T("color3")) == 0) {                          } else if(tcscmp(T(atts[i]), T("color3")) == 0) {
301                                  val = atts[i+1];                                  val = atts[i+1];
302                                  sscanf(val.c_str(), "0x%08x", &c);                                  sscanf(val.c_str(), "0x%08x", &c);
303                                  gradient->color[3].val = c;                                  gradient->colors[3] = c;
                                 splitColor(&(gradient->color[3].c), c);  
304                          } else {                          } else {
305                                  cerr << "UNKNOWN PROPERTY ATTRIBUTE: " << atts[i] << endl;                                  cerr << "UNKNOWN PROPERTY ATTRIBUTE: " << atts[i] << endl;
306                          }                          }
307                  }                  }
308    
309                  for(i=0; i<4; i++) {                  /*for(i=0; i<4; i++) {
310                          gradient->gradient.colors[i] = gradient->color[i].c;                          gradient->gradient.colors[i] = gradient->color[i];
311                  }                  }*/
312    
313                  object->gradient[gradient->name] = gradient;                  object->gradient[gradient->name] = gradient;
314          }          }

Legend:
Removed from v.1.3.6.5.2.1  
changed lines
  Added in v.1.3.6.5.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26