aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Color.cc
diff options
context:
space:
mode:
authormathias <mathias>2006-10-27 06:57:43 (GMT)
committermathias <mathias>2006-10-27 06:57:43 (GMT)
commit10082d821d6691f42a8d8ad6fa2e42e5b3f44edd (patch)
tree99c94a6105cf35612307e307be343eda2aea8baf /src/FbTk/Color.cc
parent34b7f7ddfc3e914238fd0d30ff50c4f37c2a6dd8 (diff)
downloadfluxbox-10082d821d6691f42a8d8ad6fa2e42e5b3f44edd.zip
fluxbox-10082d821d6691f42a8d8ad6fa2e42e5b3f44edd.tar.bz2
cosmetic patch from slava semushin, removes whitespaces and
uses only those things from "namespace std" what we really need.
Diffstat (limited to 'src/FbTk/Color.cc')
-rw-r--r--src/FbTk/Color.cc31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/FbTk/Color.cc b/src/FbTk/Color.cc
index 5c4f1b8..8e5c8ef 100644
--- a/src/FbTk/Color.cc
+++ b/src/FbTk/Color.cc
@@ -28,7 +28,10 @@
28#include "I18n.hh" 28#include "I18n.hh"
29 29
30#include <iostream> 30#include <iostream>
31using namespace std; 31
32using std::cerr;
33using std::endl;
34using std::string;
32 35
33namespace { 36namespace {
34 37
@@ -56,9 +59,9 @@ Color::Color(const Color &col_copy):
56} 59}
57 60
58Color::Color(unsigned short red, unsigned short green, unsigned short blue, int screen): 61Color::Color(unsigned short red, unsigned short green, unsigned short blue, int screen):
59 m_red(red), m_green(green), m_blue(blue), 62 m_red(red), m_green(green), m_blue(blue),
60 m_pixel(0), m_allocated(false), 63 m_pixel(0), m_allocated(false),
61 m_screen(screen) { 64 m_screen(screen) {
62 allocate(red, green, blue, screen); 65 allocate(red, green, blue, screen);
63} 66}
64 67
@@ -95,7 +98,7 @@ bool Color::setFromString(const char *color_string, int screen) {
95 return false; 98 return false;
96 99
97 setPixel(color.pixel); 100 setPixel(color.pixel);
98 setRGB(maxValue(color.red), 101 setRGB(maxValue(color.red),
99 maxValue(color.green), 102 maxValue(color.green),
100 maxValue(color.blue)); 103 maxValue(color.blue));
101 setAllocated(true); 104 setAllocated(true);
@@ -107,7 +110,7 @@ bool Color::setFromString(const char *color_string, int screen) {
107bool Color::validColorString(const char *color_string, int screen) { 110bool Color::validColorString(const char *color_string, int screen) {
108 XColor color; 111 XColor color;
109 Display *disp = App::instance()->display(); 112 Display *disp = App::instance()->display();
110 Colormap colm = DefaultColormap(disp, screen); 113 Colormap colm = DefaultColormap(disp, screen);
111 // trim white space 114 // trim white space
112 string color_string_tmp = color_string; 115 string color_string_tmp = color_string;
113 StringUtil::removeFirstWhitespace(color_string_tmp); 116 StringUtil::removeFirstWhitespace(color_string_tmp);
@@ -120,7 +123,7 @@ Color &Color::operator = (const Color &col_copy) {
120 // check for aliasing 123 // check for aliasing
121 if (this == &col_copy) 124 if (this == &col_copy)
122 return *this; 125 return *this;
123 126
124 copy(col_copy); 127 copy(col_copy);
125 return *this; 128 return *this;
126} 129}
@@ -134,7 +137,7 @@ void Color::free() {
134 setPixel(0); 137 setPixel(0);
135 setRGB(0, 0, 0); 138 setRGB(0, 0, 0);
136 setAllocated(false); 139 setAllocated(false);
137 } 140 }
138} 141}
139 142
140void Color::copy(const Color &col_copy) { 143void Color::copy(const Color &col_copy) {
@@ -144,12 +147,12 @@ void Color::copy(const Color &col_copy) {
144 setPixel(col_copy.pixel()); 147 setPixel(col_copy.pixel());
145 return; 148 return;
146 } 149 }
147 150
148 allocate(col_copy.red()*0xFF, 151 allocate(col_copy.red()*0xFF,
149 col_copy.green()*0xFF, 152 col_copy.green()*0xFF,
150 col_copy.blue()*0xFF, 153 col_copy.blue()*0xFF,
151 col_copy.m_screen); 154 col_copy.m_screen);
152 155
153} 156}
154 157
155void Color::allocate(unsigned short red, unsigned short green, unsigned short blue, int screen) { 158void Color::allocate(unsigned short red, unsigned short green, unsigned short blue, int screen) {
@@ -158,10 +161,10 @@ void Color::allocate(unsigned short red, unsigned short green, unsigned short bl
158 XColor color; 161 XColor color;
159 // fill xcolor structure 162 // fill xcolor structure
160 color.red = red; 163 color.red = red;
161 color.green = green; 164 color.green = green;
162 color.blue = blue; 165 color.blue = blue;
163 166
164 167
165 if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) { 168 if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) {
166 _FB_USES_NLS; 169 _FB_USES_NLS;
167 cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl; 170 cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl;
@@ -173,7 +176,7 @@ void Color::allocate(unsigned short red, unsigned short green, unsigned short bl
173 setPixel(color.pixel); 176 setPixel(color.pixel);
174 setAllocated(true); 177 setAllocated(true);
175 } 178 }
176 179
177 m_screen = screen; 180 m_screen = screen;
178} 181}
179 182