From b82aa528112c89a02c9961381216393b0215e2e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Mon, 22 May 2006 16:12:50 +0000 Subject: [PATCH] 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 --- src/preferences/time/AnalogClock.cpp | 12 ++---------- src/preferences/time/AnalogClock.h | 1 - src/preferences/time/SettingsView.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/preferences/time/AnalogClock.cpp b/src/preferences/time/AnalogClock.cpp index b9a62e5e42..14d67f50a9 100644 --- a/src/preferences/time/AnalogClock.cpp +++ b/src/preferences/time/AnalogClock.cpp @@ -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(); } } diff --git a/src/preferences/time/AnalogClock.h b/src/preferences/time/AnalogClock.h index c2c3fdb0f9..84027b5e41 100644 --- a/src/preferences/time/AnalogClock.h +++ b/src/preferences/time/AnalogClock.h @@ -27,7 +27,6 @@ class TAnalogClock: public BView { private: void _InitView(BRect frame); - BPoint fClockLeftTop; BBitmap *fBitmap; OffscreenClock *fClock; }; diff --git a/src/preferences/time/SettingsView.cpp b/src/preferences/time/SettingsView.cpp index 3fcd1720c3..509c3fcf25 100644 --- a/src/preferences/time/SettingsView.cpp +++ b/src/preferences/time/SettingsView.cpp @@ -9,6 +9,7 @@ #include #include +#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