Esempio n. 1
0
int32
BMenuField::_MenuTask()
{
	if (!LockLooper())
		return 0;

	fSelected = true;
	fTransition = true;
	Invalidate();
	UnlockLooper();

	bool tracking;
	do {
		snooze(20000);
		if (!LockLooper())
			return 0;

		tracking = fMenuBar->fTracking;

		UnlockLooper();
	} while (tracking);

	if (LockLooper()) {
		fSelected = false;
		fTransition = true;
		Invalidate();
		UnlockLooper();
	}

	return 0;
}
Esempio n. 2
0
int32 TextScrollerView::updater_function()
{
	float height;
	if (LockLooper()) {
		height = Bounds().Height();
		text_view->ScrollTo(0,-height);
		text_view->Sync();
		UnlockLooper();
	}
	else {
		height = Bounds().Height();
	}
	float total_height = text_view->TextHeight(0,text_view->CountLines());

	while (continue_updating) {
		if (LockLooper()) {
			if ((text_view->Bounds().top <= total_height) && (text_view->Bounds().top >= -height)) {
				text_view->ScrollBy(0,1);
			}
			else {
				text_view->ScrollTo(0,-height);
			}
			text_view->Sync();
			UnlockLooper();
		}
		snooze(60 * 1000);
		while ((tracking_mouse) && (continue_updating)) {
			snooze(250 * 1000);	// sleep 1/4 seconds
		}
	}

	return B_OK;
}
Esempio n. 3
0
//*****************************************************
void IndexView::Draw(BRect rect)
{
	LockLooper();

	BRect r = Bounds();
	if (Pool.update_index && !m_resized)
		CalculateCache(Bounds());

	if (m_resized)
	{
		acquire_sem(indexSem);
		// allocate offscreen bitmap here
		if (OffScreen)	{ delete OffScreen; OffScreen = NULL; }
		OffScreen = new BBitmap(r, B_RGB32);
		release_sem(indexSem);

		// recalculate caches for resized screen
		if (CalculateCache(r))
			m_resized = false;
	}

	DrawBitmapAsync( OffScreen, rect, rect);

	if (Pool.sample_type != NONE)
	{
		float x = Pool.last_pointer * Bounds().Width() / Pool.size;
		SetDrawingMode(B_OP_INVERT);
		StrokeLine( BPoint( x, 0), BPoint( x, r.bottom-1));//, B_MIXED_COLORS);
		SetDrawingMode(B_OP_COPY);
	}
	UnlockLooper();
}
Esempio n. 4
0
void
TTracker::Pulse()
{
	if (!TrackerSettings().ShowVolumeSpaceBar())
		return;

	// update the volume icon's free space bars
	BVolumeRoster roster;

 	BVolume volume;
	while (roster.GetNextVolume(&volume) == B_NO_ERROR)
	{
		BDirectory dir;
		volume.GetRootDirectory(&dir);
		node_ref nodeRef;
		dir.GetNodeRef(&nodeRef);

		BMessage notificationMessage;
		notificationMessage.AddInt32("device", *(int32 *)&nodeRef.device);

		LockLooper();
		SendNotices(kUpdateVolumeSpaceBar, &notificationMessage);
		UnlockLooper();
	}
}
Esempio n. 5
0
void BrowseView::Clear()
{
	tasks->GiveUp();
	
	LockLooper();
	if (mainList != NULL)
	{
		RemoveChild(mainScroll);

		eraser->KillList(mainList,mainScroll);
		mainList = NULL;
	}
	
	if (linksList != NULL)
	{
		RemoveChild(linksScroll);

		eraser->KillList(linksList,linksScroll);
		linksList = NULL;
	}

	
	DESTROYVIEW(horizontalMover)
	DESTROYVIEW(nextButton)
	DESTROYVIEW(searchTextView)
	DESTROYVIEW(containsView)
	DESTROYVIEW(infoText)
		
	UnlockLooper();
}
Esempio n. 6
0
void
TransportControlGroup::SetEnabled(uint32 buttons)
{
	if (!LockLooper())
		return;

	if (fSeekSlider != NULL)
		fSeekSlider->SetEnabled(buttons & SEEK_ENABLED);

	if (fVolumeSlider != NULL)
		fVolumeSlider->SetEnabled(buttons & VOLUME_ENABLED);
	if (fMute != NULL)
		fMute->SetEnabled(buttons & VOLUME_ENABLED);

	if (fSkipBack)
		fSkipBack->SetEnabled(buttons & SKIP_BACK_ENABLED);
	if (fSkipForward)
		fSkipForward->SetEnabled(buttons & SKIP_FORWARD_ENABLED);
	if (fRewind)
		fRewind->SetEnabled(buttons & SEEK_BACK_ENABLED);
	if (fForward)
		fForward->SetEnabled(buttons & SEEK_FORWARD_ENABLED);

	if (fPlayPause != NULL)
		fPlayPause->SetEnabled(buttons & PLAYBACK_ENABLED);
	if (fStop != NULL)
		fStop->SetEnabled(buttons & PLAYBACK_ENABLED);

	UnlockLooper();
}
Esempio n. 7
0
// _DrawBorder
void
ColorField::_DrawBorder()
{
	bool looperLocked = LockLooper();
		
	fBgBitmap[1]->Lock();

	rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR);
	rgb_color shadow = tint_color(background, B_DARKEN_1_TINT);
	rgb_color darkShadow = tint_color(background, B_DARKEN_3_TINT);
	rgb_color light = tint_color(background, B_LIGHTEN_MAX_TINT);

	BRect r(fBgView[1]->Bounds());
	r.OffsetBy(-2.0, -2.0);
	BRegion region(r);
	fBgView[1]->ConstrainClippingRegion(&region);

	r = Bounds();
	r.OffsetBy(-2.0, -2.0);

	stroke_frame(fBgView[1], r, shadow, shadow, light, light);
	r.InsetBy(1.0, 1.0);
	stroke_frame(fBgView[1], r, darkShadow, darkShadow, background, background);
	r.InsetBy(1.0, 1.0);

	region.Set(r);
	fBgView[1]->ConstrainClippingRegion(&region);

	fBgBitmap[1]->Unlock();

	if (looperLocked)
		UnlockLooper();
}
Esempio n. 8
0
void
BSlider::DrawSlider()
{
	if (LockLooper()) {
#if USE_OFF_SCREEN_VIEW
		if (!fOffScreenBits)
			return;
		if (fOffScreenBits->Lock()) {
#endif
			DrawBar();
			DrawHashMarks();
			DrawThumb();
			DrawFocusMark();
			DrawText();

#if USE_OFF_SCREEN_VIEW
			fOffScreenView->Sync();
			fOffScreenBits->Unlock();

			DrawBitmap(fOffScreenBits, B_ORIGIN);
		}
#endif
		UnlockLooper();
	}
}
//void TTextControlComponent::MessageReceived(BMessage *message)
bool TTextControlComponent::ChangeProperty(string APropertyName, string APropertyValue)
{
	ShowDebug(string("ChangeProperty Name=") + APropertyName + string(" Value=") + APropertyValue);
	if (LockLooper())
	{
		SetDivider(0);
		FPropertyList->SetPropertyValue(APropertyName,APropertyValue);												
		SetStandardProperties(APropertyName.c_str(),APropertyValue.c_str());
		SetFrameProperties(APropertyName.c_str(),APropertyValue.c_str(),this);																			
		SetSizingProperties(APropertyName.c_str(),APropertyValue.c_str(),this);
		SetFlagsProperties(APropertyName.c_str(),APropertyValue.c_str(),this);	
		if (FindPropertyName(APropertyName,PROP_LABEL))
		{
			SetLabel(APropertyValue.c_str());
			BRect ANewFrame = Frame();							
			SetDivider((ANewFrame.right-ANewFrame.left)/2);
		}
		if (FindPropertyName(APropertyName,PROP_MESSAGE)) ((TTextControlCodeGenerator *)FCodeGenerator)->CreateMessageReceived(!FLoaded);
		
		if (FindPropertyName(APropertyName,PROP_TEXT))
		{
			SetText(APropertyValue.c_str());
			BRect ANewFrame = Frame();							
			SetDivider((ANewFrame.right-ANewFrame.left)/2);
		}
		UnlockLooper();
		return TComponent::ChangeProperty(APropertyName,APropertyValue);		
	}
	return false;
}
Esempio n. 10
0
/*****************************************************************************
 * VideoWindow::drawBuffer
 *****************************************************************************/
void
VideoWindow::drawBuffer(int bufferIndex)
{
    i_buffer = bufferIndex;

    // sync to the screen if required
    if (IsSyncedToRetrace())
    {
        BScreen screen(this);
        screen.WaitForRetrace(22000);
    }
    if (fInitStatus >= B_OK && LockLooper())
    {
       // switch the overlay bitmap
       if (mode == OVERLAY)
       {
          rgb_color key;
          view->SetViewOverlay(bitmap[i_buffer],
                            bitmap[i_buffer]->Bounds() ,
                            view->Bounds(),
                            &key, B_FOLLOW_ALL,
                            B_OVERLAY_FILTER_HORIZONTAL|B_OVERLAY_FILTER_VERTICAL|
                            B_OVERLAY_TRANSFER_CHANNEL);
           view->SetViewColor(key);
       }
       else
       {
         // switch the bitmap
         view->DrawBitmap(bitmap[i_buffer], view->Bounds() );
       }
       UnlockLooper();
    }
}
void
BlogPositiveMainView::ReloadBlogs() {
	if (LockLooper()) {
		Reload(gBlogList);
		UnlockLooper();
	}
}
Esempio n. 12
0
	void Update(bigtime_t position, bigtime_t duration)
	{
		if (!LockLooper())
			return;

		if (position != -1) {
			position /= 1000000L;
			duration /= 1000000L;
			if (position == fPosition && duration == fDuration) {
				UnlockLooper();
				return;
			}

			fPosition = position;
			fDuration = duration;
		}

		char positionText[32];
		duration_to_string(fPosition, positionText, sizeof(positionText));

		char durationText[32];
		duration_to_string(fDuration, durationText, sizeof(durationText));

		char text[64];
		snprintf(text, sizeof(text), "%s / %s", positionText, durationText);
		SetText(text);

		UnlockLooper();
	}
Esempio n. 13
0
//-----------------------------------------------------------------
void mApp::RefsReceived(BMessage *message)
{
cout << "REFS RECIEVED!! " << endl;
//Get Filepanelpath
int32	count = 0;
uint32	type = 0;
message->GetInfo("refs", &type, &count);
cout << "type is " << type << "count is " << count << endl;
	for (int32 i = 0; i < count; i++) 
	{
	entry_ref	ref;
	cout << " asd its " << i << endl;
		if (message->FindRef("refs", i, &ref) == B_NO_ERROR) 
		{
		BEntry entry(&ref);
			if (entry.InitCheck() == B_NO_ERROR) 
			{
			BPath Path;
			entry.GetPath(&Path);
			LockLooper();
			_ExportWindow->fSaveTo.SetTo(Path.Path());
			UnlockLooper();
			}
			else
			{
			cout << "2_" << endl;
			}
		}
		else
		{
		cout << "1_" << endl;
		}
	}
}
void NavigatorEditor::SetShortCutFilter(ShortCutFilter *_shortCutFilter)
{
	if (LockLooper())
	{
		AddFilter(_shortCutFilter);
		UnlockLooper();
	}
}
Esempio n. 15
0
void
BIconButton::_Update()
{
	if (LockLooper()) {
		Invalidate();
		UnlockLooper();
	}
}
Esempio n. 16
0
void
TransportControlGroup::SetMuted(bool mute)
{
	if (!LockLooper())
		return;

	fVolumeSlider->SetMuted(mute);

	UnlockLooper();
}
Esempio n. 17
0
void FontDrawView::Draw(BRect r)
{
	if (LockLooper() )
  	{
		FillRect(Bounds(),B_SOLID_LOW);
  		CheckStringPlacement();
		DrawString(text,fontlocation);
		UnlockLooper();
 	}
}
Esempio n. 18
0
void TextScrollerView::AddEmptyLine()
{
	if (LockLooper()) {
		text_view->Insert("\n");
		UnlockLooper();
	}
	else {
		text_view->Insert("\n");
	}
}
Esempio n. 19
0
void BBackView::flush()
{
	BBitmap * bmp = Bitmap();
	if(LockLooper())
	{	
		backView->Flush();
		SetViewBitmap(bmp, B_FOLLOW_NONE, 0);
		Invalidate();
		UnlockLooper();
	}
}
Esempio n. 20
0
// SetEnabled
void
PopupSlider::SetEnabled(bool enable)
{
	if (enable != fEnabled) {
		fEnabled = enable;
		if (LockLooper()) {
			Invalidate();
			UnlockLooper();
		}
	}
}
Esempio n. 21
0
 void SetBuffer(void *buf, int32 width, int32 height)
 {
     _buf = buf;
     _width = width;
     _height = height;
     LockLooper();
     ResizeTo(width-1,height-1);
     UnlockLooper();
     delete _bitmap; _bitmap = NULL;
     _bitmap = new BBitmap(BRect(0,0,_width-1, _height-1), B_RGBA32);
 }
Esempio n. 22
0
void RDDBIcon::Draw(BRect update_rect)
{
	if (Window())
	{
		LockLooper();
		DrawString("R*\0",BPoint(0,8));
		DrawString("d\0", BPoint(8,15));
		UnlockLooper();
	}
	BView::Draw(update_rect);
}
Esempio n. 23
0
void 
FBView::Paint()
{
  if(LockLooper())	{
 	 bufferView->LockLooper();
 	 SetDrawingMode(B_OP_COPY);
	 DrawBitmap(bufferBitmap,bufferView->Bounds(),Bounds());
	 bufferView->UnlockLooper();
	 UnlockLooper();
	}
}
Esempio n. 24
0
void
DeskbarControlView::DetachedFromWindow()
{
	if (LockLooper()) {
		StopWatching(fControllerMessenger, kMsgControllerCaptureStarted);
		StopWatching(fControllerMessenger, kMsgControllerCaptureStopped);	
		StopWatching(fControllerMessenger, kMsgControllerCapturePaused);	
		StopWatching(fControllerMessenger, kMsgControllerCaptureResumed);	
		UnlockLooper();
	}
}
Esempio n. 25
0
void
TransportControlGroup::SetAudioEnabled(bool enabled)
{
	if (!LockLooper())
		return;

	fMute->SetEnabled(enabled);
	fVolumeSlider->SetEnabled(enabled);

	UnlockLooper();
}
Esempio n. 26
0
void
DesktopPoseView::ShowVolumes(bool visible, bool showShared)
{
	if (LockLooper()) {
		SavePoseLocations();
		if (!visible)
			RemoveRootPoses();
		else
			AddRootPoses(true, showShared);
		UnlockLooper();
	}
}
Esempio n. 27
0
void
ColorField::_DrawBorder()
{
	bool looperLocked = LockLooper();

	fBgBitmap[1]->Lock();

	rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR);
	rgb_color shadow = tint_color(background, B_DARKEN_1_TINT);
	rgb_color darkShadow = tint_color(background, B_DARKEN_3_TINT);
	rgb_color light = tint_color(background, B_LIGHTEN_MAX_TINT);

	BRect bounds(fBgView[1]->Bounds());
	bounds.OffsetBy(-2.0, -2.0);
	BRegion region(bounds);
	fBgView[1]->ConstrainClippingRegion(&region);

	bounds = COLOR_FIELD_RECT;
	bounds.OffsetBy(-2.0, -2.0);

	fBgView[1]->BeginLineArray(4);
	fBgView[1]->AddLine(BPoint(bounds.left, bounds.bottom),
		BPoint(bounds.left, bounds.top), shadow);
	fBgView[1]->AddLine(BPoint(bounds.left + 1.0, bounds.top),
		BPoint(bounds.right, bounds.top), shadow);
	fBgView[1]->AddLine(BPoint(bounds.right, bounds.top + 1.0),
		BPoint(bounds.right, bounds.bottom), light);
	fBgView[1]->AddLine(BPoint(bounds.right - 1.0, bounds.bottom),
		BPoint(bounds.left + 1.0, bounds.bottom), light);
	fBgView[1]->EndLineArray();
	bounds.InsetBy(1.0, 1.0);

	fBgView[1]->BeginLineArray(4);
	fBgView[1]->AddLine(BPoint(bounds.left, bounds.bottom),
		BPoint(bounds.left, bounds.top), darkShadow);
	fBgView[1]->AddLine(BPoint(bounds.left + 1.0, bounds.top),
		BPoint(bounds.right, bounds.top), darkShadow);
	fBgView[1]->AddLine(BPoint(bounds.right, bounds.top + 1.0),
		BPoint(bounds.right, bounds.bottom), background);
	fBgView[1]->AddLine(BPoint(bounds.right - 1.0, bounds.bottom),
		BPoint(bounds.left + 1.0, bounds.bottom), background);
	fBgView[1]->EndLineArray();
	bounds.InsetBy(1.0, 1.0);

	region.Set(bounds);
	fBgView[1]->ConstrainClippingRegion(&region);

	fBgBitmap[1]->Unlock();

	if (looperLocked)
		UnlockLooper();
}
Esempio n. 28
0
void
TransportControlGroup::SetSkippable(bool backward, bool forward)
{
	if (!LockLooper())
		return;

	if (fSkipBack)
		fSkipBack->SetEnabled(backward);
	if (fSkipForward)
		fSkipForward->SetEnabled(forward);

	UnlockLooper();
}
Esempio n. 29
0
void
DeskbarControlView::AttachedToWindow()
{
	SetViewColor(Parent()->ViewColor());
		
	if (LockLooper()) {
		StartWatching(fControllerMessenger, kMsgControllerCaptureStarted);
		StartWatching(fControllerMessenger, kMsgControllerCaptureStopped);
		StartWatching(fControllerMessenger, kMsgControllerCapturePaused);	
		StartWatching(fControllerMessenger, kMsgControllerCaptureResumed);
		UnlockLooper();
	}
}
Esempio n. 30
0
void
BBox::SetBorder(border_style border)
{
	if (border == fStyle)
		return;

	fStyle = border;

	InvalidateLayout();

	if (Window() != NULL && LockLooper()) {
		Invalidate();
		UnlockLooper();
	}
}