avoids analog clock flickering (ie on VPC): AnalogClock view is now of the bitmap size
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17534 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
453f642e2e
commit
b82aa52811
@ -186,21 +186,13 @@ TAnalogClock::_InitView(BRect rect)
|
||||
fBitmap->Lock();
|
||||
fBitmap->AddChild(fClock);
|
||||
fBitmap->Unlock();
|
||||
|
||||
// offscreen clock is kClockFaceWidth by kClockFaceHeight
|
||||
// which might be smaller then TAnalogClock frame so "center" it.
|
||||
fClockLeftTop = BPoint((rect.Width() - kClockFaceWidth) / 2.0,
|
||||
(rect.Height() - kClockFaceHeight) / 2.0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TAnalogClock::AttachedToWindow()
|
||||
{
|
||||
if (Parent())
|
||||
SetViewColor(Parent()->ViewColor());
|
||||
else
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetViewColor(B_TRANSPARENT_COLOR);
|
||||
}
|
||||
|
||||
|
||||
@ -242,7 +234,7 @@ TAnalogClock::Draw(BRect /*updateRect*/)
|
||||
|
||||
if (fBitmap->Lock()) {
|
||||
fClock->DrawClock();
|
||||
DrawBitmap(fBitmap, fClockLeftTop);
|
||||
DrawBitmap(fBitmap, BPoint(0, 0));
|
||||
fBitmap->Unlock();
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ class TAnalogClock: public BView {
|
||||
private:
|
||||
void _InitView(BRect frame);
|
||||
|
||||
BPoint fClockLeftTop;
|
||||
BBitmap *fBitmap;
|
||||
OffscreenClock *fClock;
|
||||
};
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <String.h>
|
||||
#include <StringView.h>
|
||||
|
||||
#include "Bitmaps.h"
|
||||
#include "SettingsView.h"
|
||||
#include "TimeMessages.h"
|
||||
|
||||
@ -98,13 +99,14 @@ TSettingsView::InitView()
|
||||
frame.bottom = frame.top +text_height +6;
|
||||
frame.right += 4;
|
||||
f_timeedit = new TTimeEdit(frame, "time_edit", 4);
|
||||
AddChild(f_timeedit);
|
||||
|
||||
frame.top = f_timeedit->Frame().bottom;
|
||||
frame.bottom = bounds.bottom -(text_height *3);
|
||||
frame.InsetBy(10, 10);
|
||||
frame.InsetBy((frame.Width() - kClockFaceWidth + 1)/2.0, (frame.Height() - kClockFaceHeight + 1)/2.0);
|
||||
f_clock = new TAnalogClock(frame, "analog clock",
|
||||
B_FOLLOW_NONE, B_WILL_DRAW);
|
||||
AddChild(f_timeedit);
|
||||
AddChild(f_clock);
|
||||
|
||||
// clock radio buttons
|
||||
frame = bounds.InsetByCopy(6, 10);
|
||||
@ -114,6 +116,7 @@ TSettingsView::InitView()
|
||||
float width = be_plain_font->StringWidth(label.String());
|
||||
frame.right = frame.left +width;
|
||||
BStringView *text = new BStringView(frame, "clockis", "Clock set to:");
|
||||
AddChild(text);
|
||||
|
||||
frame.OffsetBy(frame.Width() +9, -1);
|
||||
frame.right = bounds.right-2;
|
||||
@ -125,9 +128,6 @@ TSettingsView::InitView()
|
||||
f_gmt = new BRadioButton(frame, "gmt", "GMT", new BMessage(H_RTC_CHANGE));
|
||||
AddChild(f_gmt);
|
||||
|
||||
AddChild(text);
|
||||
AddChild(f_clock);
|
||||
|
||||
if (f_islocal)
|
||||
f_local->SetValue(1);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user