Subversion Repositories tpanel

Rev

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

Rev 137 Rev 146
Line 40... Line 40...
40
    {
40
    {
41
        MSG_WARNING("Empty color name is ignored!");
41
        MSG_WARNING("Empty color name is ignored!");
42
        return TColor::COLOR_T();
42
        return TColor::COLOR_T();
43
    }
43
    }
44
 
44
 
-
 
45
    // Check if we've an index number
-
 
46
    if (color.length() <= 2 && isdigit(color[0]))
-
 
47
    {
-
 
48
        int idx = atoi(color.c_str());
-
 
49
 
-
 
50
        if (idx >= 0 && idx <= 88)
-
 
51
        {
-
 
52
            PDATA_T pd = mPalette->findColor(idx);
-
 
53
 
-
 
54
            if (!pd.name.empty())
-
 
55
                return splitColors(pd);
-
 
56
        }
-
 
57
    }
-
 
58
 
45
    size_t pos = color.find('#');
59
    size_t pos = color.find('#');
46
 
60
 
47
    if (pos == string::npos)
61
    if (pos == string::npos)
48
    {
62
    {
49
        if (!mPalette)
63
        if (!mPalette)
Line 60... Line 74...
60
 
74
 
61
        MSG_DEBUG("Color " << color << " not found in table!");
75
        MSG_DEBUG("Color " << color << " not found in table!");
62
        return TColor::COLOR_T();
76
        return TColor::COLOR_T();
63
    }
77
    }
64
 
78
 
65
    // Check if we've an index number
-
 
66
    if (color.length() <= 2 && isdigit(color[0]))
-
 
67
    {
-
 
68
        int idx = atoi(color.c_str());
-
 
69
 
-
 
70
        if (idx < 0 || idx > 88)
-
 
71
            return TColor::COLOR_T();
-
 
72
 
-
 
73
        PDATA_T pd = mPalette->findColor(idx);
-
 
74
 
-
 
75
        if (!pd.name.empty())
-
 
76
            return splitColors(pd);
-
 
77
 
-
 
78
        return TColor::COLOR_T();
-
 
79
    }
-
 
80
 
-
 
81
    TColor::COLOR_T ct;
79
    TColor::COLOR_T ct;
82
    ct.red = (int)strtol(color.substr(pos+1, 2).c_str(), NULL, 16);
80
    ct.red = (int)strtol(color.substr(pos+1, 2).c_str(), NULL, 16);
83
    ct.green = (int)strtol(color.substr(pos+3, 2).c_str(), NULL, 16);
81
    ct.green = (int)strtol(color.substr(pos+3, 2).c_str(), NULL, 16);
84
    ct.blue = (int)strtol(color.substr(pos+5, 2).c_str(), NULL, 16);
82
    ct.blue = (int)strtol(color.substr(pos+5, 2).c_str(), NULL, 16);
85
 
83