Subversion Repositories tpanel

Rev

Rev 186 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 186 Rev 442
Line 99... Line 99...
99
 
99
 
100
    if (havePalette(palName))
100
    if (havePalette(palName))
101
        return;
101
        return;
102
 
102
 
103
    string name, content;
103
    string name, content;
-
 
104
    PDATA_T pal;
104
 
105
 
105
    while ((index = xml.getNextElementFromIndex(index, &name, &content, &attrs)) != TExpat::npos)
106
    while ((index = xml.getNextElementFromIndex(index, &name, &content, &attrs)) != TExpat::npos)
106
    {
107
    {
107
        PDATA_T pal;
-
 
108
 
-
 
109
        if (name.compare("color") != 0)
108
        if (name.compare("color") != 0)
110
        {
109
        {
111
            pal.clear();
110
            pal.clear();
112
            continue;
111
            continue;
113
        }
112
        }
Line 118... Line 117...
118
 
117
 
119
        if (color.at(0) == '#')     // Do we have a valid color value?
118
        if (color.at(0) == '#')     // Do we have a valid color value?
120
        {
119
        {
121
            string sCol = "0x" + color.substr(1);
120
            string sCol = "0x" + color.substr(1);
122
            pal.color = strtoul(sCol.c_str(), 0, 16);
121
            pal.color = strtoul(sCol.c_str(), 0, 16);
-
 
122
 
-
 
123
            if (color.length() <= 7)
-
 
124
                pal.color = (pal.color << 8) | 0x000000ff;
123
        }
125
        }
124
 
126
 
125
        if (pal.name.length() > 0)
127
        if (pal.name.length() > 0)
126
        {
128
        {
127
            if (mColors.find(pal.name) != mColors.end())    // Don't insert color if it's already in list
129
            if (mColors.find(pal.name) != mColors.end())    // Don't insert color if it's already in list
Line 174... Line 176...
174
{
176
{
175
    DECL_TRACER("TPalette::findColor(int pID)");
177
    DECL_TRACER("TPalette::findColor(int pID)");
176
 
178
 
177
    map<string, PDATA_T>::iterator iter;
179
    map<string, PDATA_T>::iterator iter;
178
 
180
 
179
    for (iter = mColors.begin(); iter != mColors.end(); iter++)
181
    for (iter = mColors.begin(); iter != mColors.end(); ++iter)
180
    {
182
    {
181
        if (iter->second.index == pID)
183
        if (iter->second.index == pID)
182
            return iter->second;
184
            return iter->second;
183
    }
185
    }
184
 
186