Changeset 25013
- Timestamp:
- 04/17/08 17:57:04 (1 month ago)
- Files:
-
- haiku/trunk/src/kits/interface/ColorControl.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
haiku/trunk/src/kits/interface/ColorControl.cpp
r23680 r25013 237 237 BColorControl::SetValue(int32 value) 238 238 { 239 if (Value() == value)240 return;241 242 239 rgb_color c1 = ValueAsColor(); 243 240 rgb_color c2; … … 256 253 fSelectedPaletteColorIndex = BScreen(Window()).IndexForColor(c2); 257 254 } 258 255 259 256 c2 = BScreen(Window()).ColorForIndex(fSelectedPaletteColorIndex); 260 261 sprintf(string, "%d", c2.red);262 fRedText->SetText(string);263 sprintf(string, "%d", c2.green);264 fGreenText->SetText(string);265 sprintf(string, "%d", c2.blue);266 fBlueText->SetText(string);267 257 268 258 Invalidate(_PaletteSelectorFrame(fPreviousSelectedPaletteColorIndex)); … … 275 265 276 266 if (c1.red != c2.red) { 277 sprintf(string, "%d", c2.red);278 fRedText->SetText(string);279 280 267 p = _SelectorPosition(_RampFrame(1), c1.red); 281 268 Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius, … … 286 273 p.x + invalidateRadius, p.y + invalidateRadius)); 287 274 } 288 289 275 if (c1.green != c2.green) { 290 sprintf(string, "%d", c2.green);291 fGreenText->SetText(string);292 293 276 p = _SelectorPosition(_RampFrame(2), c1.green); 294 277 Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius, … … 300 283 } 301 284 if (c1.blue != c2.blue) { 302 sprintf(string, "%d", c2.blue);303 fBlueText->SetText(string);304 305 285 p = _SelectorPosition(_RampFrame(3), c1.blue); 306 286 Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius, … … 312 292 } 313 293 } 294 295 // the textcontrols have to be updated even when the color 296 // hasn't changed since the value is clamped upstream 297 // and the textcontrols would still show the unclamped value 298 sprintf(string, "%d", c2.red); 299 fRedText->SetText(string); 300 sprintf(string, "%d", c2.green); 301 fGreenText->SetText(string); 302 sprintf(string, "%d", c2.blue); 303 fBlueText->SetText(string); 304 305 if (Value() == value) 306 return; 314 307 315 308 BControl::SetValueNoUpdate(value); … … 374 367 { 375 368 rgb_color color; 376 color.red = /*min_c(*/strtol(fRedText->Text(), NULL, 10), 255/*)*/; 377 color.green = /*min_c(*/strtol(fGreenText->Text(), NULL, 10), 255/*)*/; 378 color.blue = /*min_c(*/strtol(fBlueText->Text(), NULL, 10), 255/*)*/; 379 color.alpha = 255; 380 381 //TODO: text is not updated if the clamping 382 // gives the same value next time 369 color.red = min_c(strtol(fRedText->Text(), NULL, 10), 255); 370 color.green = min_c(strtol(fGreenText->Text(), NULL, 10), 255); 371 color.blue = min_c(strtol(fBlueText->Text(), NULL, 10), 255); 372 color.alpha = 255; 383 373 384 374 SetValue(color);
