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:
@@ -186,21 +186,13 @@ TAnalogClock::_InitView(BRect rect)
|
|||||||
fBitmap->Lock();
|
fBitmap->Lock();
|
||||||
fBitmap->AddChild(fClock);
|
fBitmap->AddChild(fClock);
|
||||||
fBitmap->Unlock();
|
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
|
void
|
||||||
TAnalogClock::AttachedToWindow()
|
TAnalogClock::AttachedToWindow()
|
||||||
{
|
{
|
||||||
if (Parent())
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
SetViewColor(Parent()->ViewColor());
|
|
||||||
else
|
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -242,7 +234,7 @@ TAnalogClock::Draw(BRect /*updateRect*/)
|
|||||||
|
|
||||||
if (fBitmap->Lock()) {
|
if (fBitmap->Lock()) {
|
||||||
fClock->DrawClock();
|
fClock->DrawClock();
|
||||||
DrawBitmap(fBitmap, fClockLeftTop);
|
DrawBitmap(fBitmap, BPoint(0, 0));
|
||||||
fBitmap->Unlock();
|
fBitmap->Unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ class TAnalogClock: public BView {
|
|||||||
private:
|
private:
|
||||||
void _InitView(BRect frame);
|
void _InitView(BRect frame);
|
||||||
|
|
||||||
BPoint fClockLeftTop;
|
|
||||||
BBitmap *fBitmap;
|
BBitmap *fBitmap;
|
||||||
OffscreenClock *fClock;
|
OffscreenClock *fClock;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
|
||||||
|
#include "Bitmaps.h"
|
||||||
#include "SettingsView.h"
|
#include "SettingsView.h"
|
||||||
#include "TimeMessages.h"
|
#include "TimeMessages.h"
|
||||||
|
|
||||||
@@ -98,13 +99,14 @@ TSettingsView::InitView()
|
|||||||
frame.bottom = frame.top +text_height +6;
|
frame.bottom = frame.top +text_height +6;
|
||||||
frame.right += 4;
|
frame.right += 4;
|
||||||
f_timeedit = new TTimeEdit(frame, "time_edit", 4);
|
f_timeedit = new TTimeEdit(frame, "time_edit", 4);
|
||||||
|
AddChild(f_timeedit);
|
||||||
|
|
||||||
frame.top = f_timeedit->Frame().bottom;
|
frame.top = f_timeedit->Frame().bottom;
|
||||||
frame.bottom = bounds.bottom -(text_height *3);
|
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",
|
f_clock = new TAnalogClock(frame, "analog clock",
|
||||||
B_FOLLOW_NONE, B_WILL_DRAW);
|
B_FOLLOW_NONE, B_WILL_DRAW);
|
||||||
AddChild(f_timeedit);
|
AddChild(f_clock);
|
||||||
|
|
||||||
// clock radio buttons
|
// clock radio buttons
|
||||||
frame = bounds.InsetByCopy(6, 10);
|
frame = bounds.InsetByCopy(6, 10);
|
||||||
@@ -114,6 +116,7 @@ TSettingsView::InitView()
|
|||||||
float width = be_plain_font->StringWidth(label.String());
|
float width = be_plain_font->StringWidth(label.String());
|
||||||
frame.right = frame.left +width;
|
frame.right = frame.left +width;
|
||||||
BStringView *text = new BStringView(frame, "clockis", "Clock set to:");
|
BStringView *text = new BStringView(frame, "clockis", "Clock set to:");
|
||||||
|
AddChild(text);
|
||||||
|
|
||||||
frame.OffsetBy(frame.Width() +9, -1);
|
frame.OffsetBy(frame.Width() +9, -1);
|
||||||
frame.right = bounds.right-2;
|
frame.right = bounds.right-2;
|
||||||
@@ -125,9 +128,6 @@ TSettingsView::InitView()
|
|||||||
f_gmt = new BRadioButton(frame, "gmt", "GMT", new BMessage(H_RTC_CHANGE));
|
f_gmt = new BRadioButton(frame, "gmt", "GMT", new BMessage(H_RTC_CHANGE));
|
||||||
AddChild(f_gmt);
|
AddChild(f_gmt);
|
||||||
|
|
||||||
AddChild(text);
|
|
||||||
AddChild(f_clock);
|
|
||||||
|
|
||||||
if (f_islocal)
|
if (f_islocal)
|
||||||
f_local->SetValue(1);
|
f_local->SetValue(1);
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user