Allow style spec strings to contain colour names as well as hex values

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29478 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2004-09-27 21:17:01 +00:00
parent 65df77ec74
commit 5ee1d7604b
8 changed files with 64 additions and 44 deletions

View File

@ -2774,8 +2774,8 @@ public:
//
// bold turns on bold
// italic turns on italics
// fore:#RRGGBB sets the foreground colour
// back:#RRGGBB sets the background colour
// fore:[name or #RRGGBB] sets the foreground colour
// back:[name or #RRGGBB] sets the background colour
// face:[facename] sets the font face name to use
// size:[num] sets the font size in points
// eol turns on eol filling

View File

@ -52,13 +52,18 @@ static wxColour wxColourFromLong(long c) {
static wxColour wxColourFromSpec(const wxString& spec) {
// spec should be "#RRGGBB"
// spec should be a colour name or "#RRGGBB"
if (spec.GetChar(0) == wxT('#')) {
long red, green, blue;
red = green = blue = 0;
spec.Mid(1,2).ToLong(&red, 16);
spec.Mid(3,2).ToLong(&green, 16);
spec.Mid(5,2).ToLong(&blue, 16);
return wxColour(red, green, blue);
}
else
return wxColour(spec);
}
//----------------------------------------------------------------------
@ -2436,8 +2441,8 @@ int wxStyledTextCtrl::GetCurrentLine() {
//
// bold turns on bold
// italic turns on italics
// fore:#RRGGBB sets the foreground colour
// back:#RRGGBB sets the background colour
// fore:[name or #RRGGBB] sets the foreground colour
// back:[name or #RRGGBB] sets the background colour
// face:[facename] sets the font face name to use
// size:[num] sets the font size in points
// eol turns on eol filling

View File

@ -52,13 +52,18 @@ static wxColour wxColourFromLong(long c) {
static wxColour wxColourFromSpec(const wxString& spec) {
// spec should be "#RRGGBB"
// spec should be a colour name or "#RRGGBB"
if (spec.GetChar(0) == wxT('#')) {
long red, green, blue;
red = green = blue = 0;
spec.Mid(1,2).ToLong(&red, 16);
spec.Mid(3,2).ToLong(&green, 16);
spec.Mid(5,2).ToLong(&blue, 16);
return wxColour(red, green, blue);
}
else
return wxColour(spec);
}
//----------------------------------------------------------------------
@ -210,8 +215,8 @@ int wxStyledTextCtrl::GetCurrentLine() {
//
// bold turns on bold
// italic turns on italics
// fore:#RRGGBB sets the foreground colour
// back:#RRGGBB sets the background colour
// fore:[name or #RRGGBB] sets the foreground colour
// back:[name or #RRGGBB] sets the background colour
// face:[facename] sets the font face name to use
// size:[num] sets the font size in points
// eol turns on eol filling

View File

@ -128,8 +128,8 @@ public:
//
// bold turns on bold
// italic turns on italics
// fore:#RRGGBB sets the foreground colour
// back:#RRGGBB sets the background colour
// fore:[name or #RRGGBB] sets the foreground colour
// back:[name or #RRGGBB] sets the background colour
// face:[facename] sets the font face name to use
// size:[num] sets the font size in points
// eol turns on eol filling

View File

@ -2774,8 +2774,8 @@ public:
//
// bold turns on bold
// italic turns on italics
// fore:#RRGGBB sets the foreground colour
// back:#RRGGBB sets the background colour
// fore:[name or #RRGGBB] sets the foreground colour
// back:[name or #RRGGBB] sets the background colour
// face:[facename] sets the font face name to use
// size:[num] sets the font size in points
// eol turns on eol filling

View File

@ -52,13 +52,18 @@ static wxColour wxColourFromLong(long c) {
static wxColour wxColourFromSpec(const wxString& spec) {
// spec should be "#RRGGBB"
// spec should be a colour name or "#RRGGBB"
if (spec.GetChar(0) == wxT('#')) {
long red, green, blue;
red = green = blue = 0;
spec.Mid(1,2).ToLong(&red, 16);
spec.Mid(3,2).ToLong(&green, 16);
spec.Mid(5,2).ToLong(&blue, 16);
return wxColour(red, green, blue);
}
else
return wxColour(spec);
}
//----------------------------------------------------------------------
@ -2436,8 +2441,8 @@ int wxStyledTextCtrl::GetCurrentLine() {
//
// bold turns on bold
// italic turns on italics
// fore:#RRGGBB sets the foreground colour
// back:#RRGGBB sets the background colour
// fore:[name or #RRGGBB] sets the foreground colour
// back:[name or #RRGGBB] sets the background colour
// face:[facename] sets the font face name to use
// size:[num] sets the font size in points
// eol turns on eol filling

View File

@ -52,13 +52,18 @@ static wxColour wxColourFromLong(long c) {
static wxColour wxColourFromSpec(const wxString& spec) {
// spec should be "#RRGGBB"
// spec should be a colour name or "#RRGGBB"
if (spec.GetChar(0) == wxT('#')) {
long red, green, blue;
red = green = blue = 0;
spec.Mid(1,2).ToLong(&red, 16);
spec.Mid(3,2).ToLong(&green, 16);
spec.Mid(5,2).ToLong(&blue, 16);
return wxColour(red, green, blue);
}
else
return wxColour(spec);
}
//----------------------------------------------------------------------
@ -210,8 +215,8 @@ int wxStyledTextCtrl::GetCurrentLine() {
//
// bold turns on bold
// italic turns on italics
// fore:#RRGGBB sets the foreground colour
// back:#RRGGBB sets the background colour
// fore:[name or #RRGGBB] sets the foreground colour
// back:[name or #RRGGBB] sets the background colour
// face:[facename] sets the font face name to use
// size:[num] sets the font size in points
// eol turns on eol filling

View File

@ -128,8 +128,8 @@ public:
//
// bold turns on bold
// italic turns on italics
// fore:#RRGGBB sets the foreground colour
// back:#RRGGBB sets the background colour
// fore:[name or #RRGGBB] sets the foreground colour
// back:[name or #RRGGBB] sets the background colour
// face:[facename] sets the font face name to use
// size:[num] sets the font size in points
// eol turns on eol filling