Barberpole drawing glitches fixed. Disabled mode now too shows a barberpole - a gray one. Stop button disabled when done zipping.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31894 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -4,10 +4,12 @@
|
||||
#include "ZipOMaticActivity.h"
|
||||
|
||||
Activity::Activity (BRect a_rect, const char * a_name, uint32 a_resizing_mode, uint32 a_flags)
|
||||
: BBox (a_rect, a_name, a_resizing_mode, a_flags),
|
||||
: BView (a_rect, a_name, a_resizing_mode, a_flags),
|
||||
m_is_running (false),
|
||||
m_barberpole_bitmap (NULL)
|
||||
{
|
||||
SetViewColor(B_TRANSPARENT_COLOR);
|
||||
|
||||
m_pattern.data[0] = 0x0f;
|
||||
m_pattern.data[1] = 0x1e;
|
||||
m_pattern.data[2] = 0x3c;
|
||||
@@ -33,7 +35,6 @@ Activity::Start()
|
||||
m_is_running = true;
|
||||
Window()->SetPulseRate(100000);
|
||||
SetFlags(Flags() | B_PULSE_NEEDED);
|
||||
SetViewColor(B_TRANSPARENT_COLOR);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
@@ -51,7 +52,6 @@ Activity::Stop()
|
||||
m_is_running = false;
|
||||
Window()->SetPulseRate(500000);
|
||||
SetFlags(Flags() & (~ B_PULSE_NEEDED));
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
@@ -73,34 +73,18 @@ Activity::Pulse()
|
||||
|
||||
m_pattern.data[0] = tmp;
|
||||
|
||||
DrawIntoBitmap();
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void
|
||||
Activity::Draw(BRect a_rect)
|
||||
{
|
||||
if (IsRunning())
|
||||
{
|
||||
// draw BBox outline
|
||||
BBox::Draw(a_rect);
|
||||
SetDrawingMode(B_OP_COPY);
|
||||
DrawBitmap(m_barberpole_bitmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
BBox::Draw(a_rect);
|
||||
|
||||
float string_width = StringWidth("Drop files to zip.");
|
||||
float view_width = Bounds().Width();
|
||||
|
||||
MovePenTo ((view_width/2)-(string_width/2),12);
|
||||
DrawString("Drop files to zip.");
|
||||
}
|
||||
DrawIntoBitmap(IsRunning());
|
||||
SetDrawingMode(B_OP_COPY);
|
||||
DrawBitmap(m_barberpole_bitmap);
|
||||
}
|
||||
|
||||
void Activity::DrawIntoBitmap (void)
|
||||
void Activity::DrawIntoBitmap (bool running)
|
||||
{
|
||||
if (m_barberpole_bitmap->Lock())
|
||||
{
|
||||
@@ -111,8 +95,12 @@ void Activity::DrawIntoBitmap (void)
|
||||
rgb_color color;
|
||||
color.red = 0;
|
||||
color.green = 0;
|
||||
color.blue = 200;
|
||||
color.blue = 0;
|
||||
color.alpha = 255;
|
||||
|
||||
if (running)
|
||||
color.blue = 200;
|
||||
|
||||
m_barberpole_bitmap_view->SetHighColor(color);
|
||||
|
||||
// draw the pole
|
||||
@@ -126,6 +114,7 @@ void Activity::DrawIntoBitmap (void)
|
||||
color.green = 150;
|
||||
color.blue = 150;
|
||||
m_barberpole_bitmap_view->SetHighColor(color);
|
||||
m_barberpole_bitmap_view->SetDrawingMode(B_OP_OVER);
|
||||
BPoint point_a = m_barberpole_bitmap->Bounds().LeftTop();
|
||||
BPoint point_b = m_barberpole_bitmap->Bounds().LeftBottom();
|
||||
point_b.y -= 1;
|
||||
@@ -136,8 +125,6 @@ void Activity::DrawIntoBitmap (void)
|
||||
m_barberpole_bitmap_view->StrokeLine(point_a, point_b);
|
||||
|
||||
// top
|
||||
m_barberpole_bitmap_view->SetDrawingMode(B_OP_OVER);
|
||||
m_barberpole_bitmap_view->SetHighColor(color);
|
||||
point_a = m_barberpole_bitmap->Bounds().LeftTop();
|
||||
point_b = m_barberpole_bitmap->Bounds().RightTop();
|
||||
point_b.x -= 1;
|
||||
@@ -161,7 +148,6 @@ void Activity::DrawIntoBitmap (void)
|
||||
m_barberpole_bitmap_view->StrokeLine(point_a, point_b);
|
||||
|
||||
// bottom
|
||||
m_barberpole_bitmap_view->SetHighColor(color);
|
||||
point_a = m_barberpole_bitmap->Bounds().LeftBottom();
|
||||
point_b = m_barberpole_bitmap->Bounds().RightBottom();
|
||||
m_barberpole_bitmap_view->StrokeLine(point_a, point_b);
|
||||
@@ -194,10 +180,9 @@ void Activity::DrawIntoBitmap (void)
|
||||
LightenBitmapHighColor(& color);
|
||||
m_barberpole_bitmap_view->StrokeRect(a_rect);
|
||||
|
||||
m_barberpole_bitmap_view->Flush();
|
||||
m_barberpole_bitmap_view->Sync();
|
||||
m_barberpole_bitmap->Unlock();
|
||||
}
|
||||
|
||||
m_barberpole_bitmap->Unlock();
|
||||
}
|
||||
|
||||
void Activity::LightenBitmapHighColor (rgb_color * a_color)
|
||||
@@ -217,13 +202,6 @@ void Activity::CreateBitmap (void)
|
||||
m_barberpole_bitmap->AddChild(m_barberpole_bitmap_view);
|
||||
}
|
||||
|
||||
void Activity::FrameMoved (BPoint a_point)
|
||||
{
|
||||
delete m_barberpole_bitmap;
|
||||
CreateBitmap();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void Activity::FrameResized (float a_width, float a_height)
|
||||
{
|
||||
delete m_barberpole_bitmap;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <Box.h>
|
||||
#include <Bitmap.h>
|
||||
|
||||
class Activity : public BBox
|
||||
class Activity : public BView
|
||||
{
|
||||
public:
|
||||
Activity (BRect a_rect, const char * a_name, uint32 a_resizing_mode,
|
||||
@@ -21,13 +21,12 @@ class Activity : public BBox
|
||||
bool IsRunning ();
|
||||
virtual void Pulse ();
|
||||
virtual void Draw (BRect a_draw);
|
||||
virtual void FrameMoved (BPoint a_point);
|
||||
virtual void FrameResized (float a_width, float a_height);
|
||||
|
||||
protected:
|
||||
void CreateBitmap (void);
|
||||
void LightenBitmapHighColor (rgb_color * a_color);
|
||||
void DrawIntoBitmap (void);
|
||||
void DrawIntoBitmap (bool running);
|
||||
|
||||
bool m_is_running;
|
||||
pattern m_pattern;
|
||||
|
||||
@@ -29,7 +29,7 @@ ZippoView::ZippoView (BRect a_rect)
|
||||
AddChild (m_archive_name_view);
|
||||
|
||||
BRect ouput_rect (a_rect.left+14, a_rect.top+47, a_rect.right-15, a_rect.top+66);
|
||||
m_zip_output_view = new BStringView (ouput_rect, "output_text", " ", B_FOLLOW_LEFT_RIGHT);
|
||||
m_zip_output_view = new BStringView (ouput_rect, "output_text", "Drop files to zip.", B_FOLLOW_LEFT_RIGHT);
|
||||
AddChild (m_zip_output_view);
|
||||
|
||||
}
|
||||
|
||||
@@ -104,6 +104,7 @@ ZippoWindow::MessageReceived (BMessage * a_message)
|
||||
{
|
||||
m_zipper_thread = NULL;
|
||||
zippoview->m_activity_view->Stop();
|
||||
zippoview->m_stop_button->SetEnabled(false);
|
||||
zippoview->m_archive_name_view->SetText(" ");
|
||||
if (m_zipping_was_stopped)
|
||||
zippoview->m_zip_output_view->SetText("Stopped");
|
||||
@@ -119,6 +120,7 @@ ZippoWindow::MessageReceived (BMessage * a_message)
|
||||
|
||||
m_zipper_thread = NULL;
|
||||
zippoview->m_activity_view->Stop();
|
||||
zippoview->m_stop_button->SetEnabled(false);
|
||||
zippoview->m_archive_name_view->SetText("");
|
||||
zippoview->m_zip_output_view->SetText("Error creating archive");
|
||||
//CloseWindowOrKeepOpen();
|
||||
|
||||
Reference in New Issue
Block a user