// Use DrawUpTrackerWindow instead. void UpdateTrackerWindow(struct Tracker_Windows *window){ UpdateTrackerWindowCoordinates(window); UpdateWBlockCoordinates(window,window->wblock); PixMap_reset(window); DrawWBlock(window,window->wblock); DrawLeftSlider(window); window->wblock->isgfxdatahere=true; }
void TLevelsSlider::TrackLeftSlider() { BPoint newPt, oldPt; // Check to see if button is down uint32 buttons = 0; GetMouse(&newPt, &buttons, true); while(buttons) { // Idle if in same mouse location if (newPt.y != oldPt.y) { // Get old positions BRect oldRect = m_LeftSliderRect; // Move both left and right slider under mouse const uint32 leftHeight = m_LeftSlider->Bounds().IntegerHeight(); m_LeftSliderRect.top = newPt.y - leftHeight/2; m_LeftSliderRect.bottom = m_LeftSliderRect.top + leftHeight; // Now clip the location of the slider if out of bounds ClipLeftSlider(); // Clean up old position Draw(oldRect); // Draw new location DrawLeftSlider(); // Set new volume level UpdateLeftVolume(newPt); // Save mouse location oldPt = newPt; } // Let other events through snooze(20 * 1000); // Get new mouse location and button state GetMouse(&newPt, &buttons, true); // Clip location const BRect bounds = Bounds(); if ( newPt.y < bounds.top+kTopOffset) newPt.y = bounds.top+kTopOffset; if ( newPt.y > bounds.bottom-kBottomOffset) newPt.y = bounds.bottom-kBottomOffset; } }
/************************************************************************** FUNCTION Redraw without flickering. ***************************************************************************/ void DrawUpTrackerWindow(struct Tracker_Windows *window){ //printf("Draw up tracker. width: %d, height: %d\n",window->width,window->height); if(window->must_redraw==true) return; #if UPDATECOORDINATES_WHEN_DRAWING struct WBlocks *wblock = window->wblock; #endif #if 0 while(GetXSubTrack_B2(wblock,window->curr_track,window->curr_track_sub) >= wblock->a.x2){ if(window->curr_track<wblock->left_track) break; // should not be possible if(window->curr_track==wblock->left_track && window->curr_track_sub==wblock->left_subtrack) break; CursorLeft_CurrPos(window); } #endif #if !USE_OPENGL GFX_BouncePoints(window); // To clear point buffer. (TODO: Implement a clear point buffer function.) #endif #if UPDATECOORDINATES_WHEN_DRAWING UpdateTrackerWindowCoordinates(window); UpdateWBlockCoordinates(window,wblock); #endif #if !USE_OPENGL PixMap_reset(window); #endif #if !USE_OPENGL struct WTracks *wtrack=ListLast1(&wblock->wtracks->l); int x2=wtrack->fxarea.x2; EraseAllLines(window, window->wblock, 0, x2); GFX_FilledBox(window,0, x2,0, window->width-1,window->height-1, PAINT_BUFFER); DrawLeftSlider(window); #endif DrawWBlock(window,window->wblock); window->wblock->isgfxdatahere=true; #if !USE_OPENGL ClearUnusedWindowsAreas(window); Blt_unMarkVisible(window); // Need a better name for this function. #endif }
void TLevelsSlider::MouseDown(BPoint where) { // Check for which button is pressed uint32 buttons = 0; Window()->CurrentMessage()->FindInt32("buttons", (long *)&buttons); // Determine which button has been clicked switch(buttons) { case B_PRIMARY_MOUSE_BUTTON: { const BRect bounds = Bounds(); // Get old positions BRect oldLeftRect = m_LeftSliderRect; BRect oldRightRect = m_RightSliderRect; // Move both left and right slider under mouse const uint32 leftHeight = m_LeftSlider->Bounds().IntegerHeight(); const uint32 rightHeight = m_RightSlider->Bounds().IntegerHeight(); m_LeftSliderRect.top = where.y - leftHeight/2; m_LeftSliderRect.bottom = m_LeftSliderRect.top + leftHeight; m_RightSliderRect.top = where.y - rightHeight/2; m_RightSliderRect.bottom = m_RightSliderRect.top + rightHeight; // Now clip the location of the slider if out of bounds ClipSliders(); // Clean up old position BRect updateRect = oldLeftRect; updateRect.right = oldRightRect.right; Draw(Bounds()); // Draw updated position DrawLeftSlider(); DrawRightSlider(); // Update the volumes UpdateVolumes(where); // Wait a while for the mouse button to be realeased snooze(100 * 1000); // Is button down? They are dragging or resizing the cue... // Check to see if button is down Window()->CurrentMessage()->FindInt32("buttons", (long *)&buttons); if (buttons) { //StartMouseWatcher(this); TrackSliders(); } } break; // User is dragging one half of the slider case B_SECONDARY_MOUSE_BUTTON: { const BRect bounds = Bounds(); // Determine area mouse is in for slider drag // // Left Side if (where.x <= bounds.Width()/2) { // Get old positions BRect oldRect = m_LeftSliderRect; // Move both left slider under mouse const uint32 leftHeight = m_LeftSlider->Bounds().IntegerHeight(); m_LeftSliderRect.top = where.y - leftHeight/2; m_LeftSliderRect.bottom = m_LeftSliderRect.top + leftHeight; // Now clip the location of the slider if out of bounds ClipLeftSlider(); // Clean up old position Draw(oldRect); // Draw updated position DrawLeftSlider(); // Update the volume UpdateLeftVolume(where); // Wait a while for the mouse button to be realeased snooze(100 * 1000); // Is button down? They are dragging or resizing the cue... // Check to see if button is down Window()->CurrentMessage()->FindInt32("buttons", (long *)&buttons); if (buttons) { TrackLeftSlider(); } } // Right Side else { const BRect bounds = Bounds(); // Get old positions BRect oldRect = m_RightSliderRect; // Move both left and right slider under mouse const uint32 rightHeight = m_RightSlider->Bounds().IntegerHeight(); m_RightSliderRect.top = where.y - rightHeight/2; m_RightSliderRect.bottom = m_RightSliderRect.top + rightHeight; // Now clip the location of the slider if out of bounds ClipRightSlider(); // Clean up old position Draw(oldRect); // Draw updated position DrawRightSlider(); // Update the volume UpdateRightVolume(where); // Wait a while for the mouse button to be realeased snooze(100 * 1000); // Is button down? They are dragging or resizing the cue... // Check to see if button is down Window()->CurrentMessage()->FindInt32("buttons", (long *)&buttons); if (buttons) { TrackRightSlider(); } } } break; } }
void TLevelsSlider::DrawSliders() { DrawLeftSlider(); DrawRightSlider(); }