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:
@@ -2774,8 +2774,8 @@ public:
|
|||||||
//
|
//
|
||||||
// bold turns on bold
|
// bold turns on bold
|
||||||
// italic turns on italics
|
// italic turns on italics
|
||||||
// fore:#RRGGBB sets the foreground colour
|
// fore:[name or #RRGGBB] sets the foreground colour
|
||||||
// back:#RRGGBB sets the background colour
|
// back:[name or #RRGGBB] sets the background colour
|
||||||
// face:[facename] sets the font face name to use
|
// face:[facename] sets the font face name to use
|
||||||
// size:[num] sets the font size in points
|
// size:[num] sets the font size in points
|
||||||
// eol turns on eol filling
|
// eol turns on eol filling
|
||||||
|
@@ -52,13 +52,18 @@ static wxColour wxColourFromLong(long c) {
|
|||||||
|
|
||||||
|
|
||||||
static wxColour wxColourFromSpec(const wxString& spec) {
|
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;
|
long red, green, blue;
|
||||||
red = green = blue = 0;
|
red = green = blue = 0;
|
||||||
spec.Mid(1,2).ToLong(&red, 16);
|
spec.Mid(1,2).ToLong(&red, 16);
|
||||||
spec.Mid(3,2).ToLong(&green, 16);
|
spec.Mid(3,2).ToLong(&green, 16);
|
||||||
spec.Mid(5,2).ToLong(&blue, 16);
|
spec.Mid(5,2).ToLong(&blue, 16);
|
||||||
return wxColour(red, green, blue);
|
return wxColour(red, green, blue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return wxColour(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -2436,8 +2441,8 @@ int wxStyledTextCtrl::GetCurrentLine() {
|
|||||||
//
|
//
|
||||||
// bold turns on bold
|
// bold turns on bold
|
||||||
// italic turns on italics
|
// italic turns on italics
|
||||||
// fore:#RRGGBB sets the foreground colour
|
// fore:[name or #RRGGBB] sets the foreground colour
|
||||||
// back:#RRGGBB sets the background colour
|
// back:[name or #RRGGBB] sets the background colour
|
||||||
// face:[facename] sets the font face name to use
|
// face:[facename] sets the font face name to use
|
||||||
// size:[num] sets the font size in points
|
// size:[num] sets the font size in points
|
||||||
// eol turns on eol filling
|
// eol turns on eol filling
|
||||||
|
@@ -52,13 +52,18 @@ static wxColour wxColourFromLong(long c) {
|
|||||||
|
|
||||||
|
|
||||||
static wxColour wxColourFromSpec(const wxString& spec) {
|
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;
|
long red, green, blue;
|
||||||
red = green = blue = 0;
|
red = green = blue = 0;
|
||||||
spec.Mid(1,2).ToLong(&red, 16);
|
spec.Mid(1,2).ToLong(&red, 16);
|
||||||
spec.Mid(3,2).ToLong(&green, 16);
|
spec.Mid(3,2).ToLong(&green, 16);
|
||||||
spec.Mid(5,2).ToLong(&blue, 16);
|
spec.Mid(5,2).ToLong(&blue, 16);
|
||||||
return wxColour(red, green, blue);
|
return wxColour(red, green, blue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return wxColour(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -210,8 +215,8 @@ int wxStyledTextCtrl::GetCurrentLine() {
|
|||||||
//
|
//
|
||||||
// bold turns on bold
|
// bold turns on bold
|
||||||
// italic turns on italics
|
// italic turns on italics
|
||||||
// fore:#RRGGBB sets the foreground colour
|
// fore:[name or #RRGGBB] sets the foreground colour
|
||||||
// back:#RRGGBB sets the background colour
|
// back:[name or #RRGGBB] sets the background colour
|
||||||
// face:[facename] sets the font face name to use
|
// face:[facename] sets the font face name to use
|
||||||
// size:[num] sets the font size in points
|
// size:[num] sets the font size in points
|
||||||
// eol turns on eol filling
|
// eol turns on eol filling
|
||||||
|
@@ -128,8 +128,8 @@ public:
|
|||||||
//
|
//
|
||||||
// bold turns on bold
|
// bold turns on bold
|
||||||
// italic turns on italics
|
// italic turns on italics
|
||||||
// fore:#RRGGBB sets the foreground colour
|
// fore:[name or #RRGGBB] sets the foreground colour
|
||||||
// back:#RRGGBB sets the background colour
|
// back:[name or #RRGGBB] sets the background colour
|
||||||
// face:[facename] sets the font face name to use
|
// face:[facename] sets the font face name to use
|
||||||
// size:[num] sets the font size in points
|
// size:[num] sets the font size in points
|
||||||
// eol turns on eol filling
|
// eol turns on eol filling
|
||||||
|
@@ -2774,8 +2774,8 @@ public:
|
|||||||
//
|
//
|
||||||
// bold turns on bold
|
// bold turns on bold
|
||||||
// italic turns on italics
|
// italic turns on italics
|
||||||
// fore:#RRGGBB sets the foreground colour
|
// fore:[name or #RRGGBB] sets the foreground colour
|
||||||
// back:#RRGGBB sets the background colour
|
// back:[name or #RRGGBB] sets the background colour
|
||||||
// face:[facename] sets the font face name to use
|
// face:[facename] sets the font face name to use
|
||||||
// size:[num] sets the font size in points
|
// size:[num] sets the font size in points
|
||||||
// eol turns on eol filling
|
// eol turns on eol filling
|
||||||
|
@@ -52,13 +52,18 @@ static wxColour wxColourFromLong(long c) {
|
|||||||
|
|
||||||
|
|
||||||
static wxColour wxColourFromSpec(const wxString& spec) {
|
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;
|
long red, green, blue;
|
||||||
red = green = blue = 0;
|
red = green = blue = 0;
|
||||||
spec.Mid(1,2).ToLong(&red, 16);
|
spec.Mid(1,2).ToLong(&red, 16);
|
||||||
spec.Mid(3,2).ToLong(&green, 16);
|
spec.Mid(3,2).ToLong(&green, 16);
|
||||||
spec.Mid(5,2).ToLong(&blue, 16);
|
spec.Mid(5,2).ToLong(&blue, 16);
|
||||||
return wxColour(red, green, blue);
|
return wxColour(red, green, blue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return wxColour(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -2436,8 +2441,8 @@ int wxStyledTextCtrl::GetCurrentLine() {
|
|||||||
//
|
//
|
||||||
// bold turns on bold
|
// bold turns on bold
|
||||||
// italic turns on italics
|
// italic turns on italics
|
||||||
// fore:#RRGGBB sets the foreground colour
|
// fore:[name or #RRGGBB] sets the foreground colour
|
||||||
// back:#RRGGBB sets the background colour
|
// back:[name or #RRGGBB] sets the background colour
|
||||||
// face:[facename] sets the font face name to use
|
// face:[facename] sets the font face name to use
|
||||||
// size:[num] sets the font size in points
|
// size:[num] sets the font size in points
|
||||||
// eol turns on eol filling
|
// eol turns on eol filling
|
||||||
|
@@ -52,13 +52,18 @@ static wxColour wxColourFromLong(long c) {
|
|||||||
|
|
||||||
|
|
||||||
static wxColour wxColourFromSpec(const wxString& spec) {
|
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;
|
long red, green, blue;
|
||||||
red = green = blue = 0;
|
red = green = blue = 0;
|
||||||
spec.Mid(1,2).ToLong(&red, 16);
|
spec.Mid(1,2).ToLong(&red, 16);
|
||||||
spec.Mid(3,2).ToLong(&green, 16);
|
spec.Mid(3,2).ToLong(&green, 16);
|
||||||
spec.Mid(5,2).ToLong(&blue, 16);
|
spec.Mid(5,2).ToLong(&blue, 16);
|
||||||
return wxColour(red, green, blue);
|
return wxColour(red, green, blue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return wxColour(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -210,8 +215,8 @@ int wxStyledTextCtrl::GetCurrentLine() {
|
|||||||
//
|
//
|
||||||
// bold turns on bold
|
// bold turns on bold
|
||||||
// italic turns on italics
|
// italic turns on italics
|
||||||
// fore:#RRGGBB sets the foreground colour
|
// fore:[name or #RRGGBB] sets the foreground colour
|
||||||
// back:#RRGGBB sets the background colour
|
// back:[name or #RRGGBB] sets the background colour
|
||||||
// face:[facename] sets the font face name to use
|
// face:[facename] sets the font face name to use
|
||||||
// size:[num] sets the font size in points
|
// size:[num] sets the font size in points
|
||||||
// eol turns on eol filling
|
// eol turns on eol filling
|
||||||
|
@@ -128,8 +128,8 @@ public:
|
|||||||
//
|
//
|
||||||
// bold turns on bold
|
// bold turns on bold
|
||||||
// italic turns on italics
|
// italic turns on italics
|
||||||
// fore:#RRGGBB sets the foreground colour
|
// fore:[name or #RRGGBB] sets the foreground colour
|
||||||
// back:#RRGGBB sets the background colour
|
// back:[name or #RRGGBB] sets the background colour
|
||||||
// face:[facename] sets the font face name to use
|
// face:[facename] sets the font face name to use
|
||||||
// size:[num] sets the font size in points
|
// size:[num] sets the font size in points
|
||||||
// eol turns on eol filling
|
// eol turns on eol filling
|
||||||
|
Reference in New Issue
Block a user