Ticket #7937: time_clock_21082011.patch
File time_clock_21082011.patch, 2.6 KB (added by , 13 years ago) |
---|
-
src/preferences/time/AnalogClock.h
27 27 virtual void MouseUp(BPoint point); 28 28 virtual void MouseMoved(BPoint point, uint32 transit, 29 29 const BMessage* message); 30 virtual void FrameResized(float, float);31 30 virtual void DoLayout(); 31 32 32 virtual BSize MaxSize(); 33 33 virtual BSize MinSize(); 34 34 virtual BSize PreferredSize(); … … 60 60 int32 fMinutes; 61 61 int32 fSeconds; 62 62 bool fDirty; 63 63 64 64 float fCenterX; 65 65 float fCenterY; 66 66 float fRadius; … … 70 70 bool fDrawSecondHand; 71 71 bool fInteractive; 72 72 73 bool fTimeChangeIsOngoing; 73 bool fTimeChangeIsOngoing; 74 74 }; 75 75 76 76 -
src/preferences/time/AnalogClock.cpp
98 98 BView::MouseDown(point); 99 99 return; 100 100 } 101 101 102 102 if (InMinuteHand(point)) { 103 103 fMinuteDragging = true; 104 104 fDirty = true; … … 124 124 BView::MouseUp(point); 125 125 return; 126 126 } 127 127 128 128 if (fHourDragging || fMinuteDragging) { 129 129 int32 hour, minute, second; 130 130 GetTime(&hour, &minute, &second); … … 160 160 161 161 162 162 void 163 TAnalogClock:: FrameResized(float, float)163 TAnalogClock::DoLayout() 164 164 { 165 165 BRect bounds = Bounds(); 166 166 … … 168 168 // (important when drawing with B_SUBPIXEL_PRECISE) 169 169 fCenterX = floorf((bounds.left + bounds.right) / 2 + 0.5) + 0.5; 170 170 fCenterY = floorf((bounds.top + bounds.bottom) / 2 + 0.5) + 0.5; 171 fRadius = floorf((MIN(bounds.Width(), bounds.Height()) / 2.0)) - 2.5; 172 fRadius -= 3; 171 fRadius = floorf((MIN(bounds.Width(), bounds.Height()) / 2.0)) - 5.5; 173 172 } 174 173 175 174 … … 202 201 // don't set the time if the hands are in a drag action 203 202 if (fHourDragging || fMinuteDragging || fTimeChangeIsOngoing) 204 203 return; 205 204 206 205 if (fHours == hour && fMinutes == minute && fSeconds == second) 207 206 return; 208 207 … … 254 253 rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR); 255 254 SetHighColor(background); 256 255 FillRect(bounds); 257 256 258 257 bounds.Set(fCenterX - fRadius, fCenterY - fRadius, 259 258 fCenterX + fRadius, fCenterY + fRadius); 260 259 … … 459 458 offsetY = (radius * 0.95) * cosf((fSeconds * M_PI) / 30.0); 460 459 StrokeLine(BPoint(x, y), BPoint(x + offsetX, y - offsetY)); 461 460 } 462 461 463 462 // draw the center knob 464 463 SetHighColor(knobColor); 465 464 FillEllipse(BPoint(x, y), radius * 0.06, radius * 0.06);