Update of /cvsroot/audacity/audacity-src/src/widgets
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv22588/src/widgets
Modified Files:
Meter.cpp Ruler.cpp
Added Files:
Grabber.cpp Grabber.h
Log Message:
Updated toolbars to:
1) Include top and bottom docks
2) Include the SelectionBar as a new toolbar
3) Update the "blue meanie" to be a bit more informatative
4) Include ability to resize the meter bar while docked
5) And probably added a few critters along the way :-)
--- NEW FILE: Grabber.h ---
/**********************************************************************
Audacity: A Digital Audio Editor
Grabber.cpp
Leland Lucius
*******************************************************************//**
\file Grabber.cpp
Implements Grabber
*//*******************************************************************//**
\class Grabber
\brief The widget to the left of a ToolBar that allows it to be dragged
around to new positions.
*//**********************************************************************/
#ifndef __AUDACITY_WIDGETS_GRABBER__
#define __AUDACITY_WIDGETS_GRABBER__
#include "../Audacity.h"
#include "wx/defs.h"
#include "wx/dc.h"
#include "wx/event.h"
#include "wx/gdicmn.h"
#include "wx/window.h"
////////////////////////////////////////////////////////////
/// Grabber Class
////////////////////////////////////////////////////////////
// Custom events
DECLARE_EVENT_TYPE(EVT_GRABBER_CLICKED, -1)
class GrabberEvent:public wxCommandEvent
{
public:
GrabberEvent(wxEventType type = wxEVT_NULL,
wxWindowID winid = 0,
const wxPoint& pt = wxDefaultPosition)
: wxCommandEvent(type, winid)
{
mPos = pt;
}
GrabberEvent(const GrabberEvent & event)
: wxCommandEvent(event)
{
mPos = event.mPos;
}
// Position of event (in screen coordinates)
const wxPoint & GetPosition() const
{
return mPos;
}
void SetPosition(const wxPoint & pos)
{
mPos = pos;
}
virtual wxEvent *Clone() const
{
return new GrabberEvent(*this);
}
protected:
wxPoint mPos;
};
typedef void (wxEvtHandler::*GrabberEventFunction)(GrabberEvent &);
#define EVT_GRABBER(id, fn) \
DECLARE_EVENT_TABLE_ENTRY(EVT_GRABBER_CLICKED, id, wxID_ANY, \
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) \
wxStaticCastEvent(GrabberEventFunction, & fn), (wxObject *) NULL),
// Specifies how wide the grabber will be
#define grabberWidth 10
class Grabber:public wxWindow
{
public:
Grabber(wxWindow *parent, wxWindowID id);
virtual ~Grabber();
// We don't need or want to accept focus since there's really
// not a need to dock/float a toolbar from the keyboard. If this
// changes, remove this and add the necessary keyboard movement
// handling.
bool AcceptsFocus() const {return false;}
void PushButton(bool state);
protected:
void OnLeftDown(wxMouseEvent & event);
void OnEnter(wxMouseEvent & event);
void OnLeave(wxMouseEvent & event);
void OnPaint(wxPaintEvent & event);
private:
void DrawGrabber(wxDC & dc);
void SendEvent(wxEventType type, const wxPoint & pos);
bool mOver;
bool mPressed;
public:
DECLARE_EVENT_TABLE();
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 2f4ec75c-bdb7-4889-96d1-5d00abc41027
--- NEW FILE: Grabber.cpp ---
/**********************************************************************
Audacity: A Digital Audio Editor
Grabber.cpp
Leland Lucius
*******************************************************************//**
\file Grabber.cpp
Implements Grabber
*//*******************************************************************//**
\class Grabber
\brief The widget to the left of a ToolBar that allows it to be dragged
around to new positions.
*//**********************************************************************/
#include "../Audacity.h"
#include <wx/defs.h>
#include <wx/dcclient.h>
#include <wx/event.h>
#include <wx/intl.h>
#include <wx/window.h>
#include "Grabber.h"
#include "../AColor.h"
////////////////////////////////////////////////////////////
/// Methods for Grabber
////////////////////////////////////////////////////////////
DEFINE_EVENT_TYPE(EVT_GRABBER_CLICKED)
BEGIN_EVENT_TABLE(Grabber, wxWindow)
EVT_ENTER_WINDOW(Grabber::OnEnter)
EVT_LEAVE_WINDOW(Grabber::OnLeave)
EVT_LEFT_DOWN(Grabber::OnLeftDown)
EVT_PAINT(Grabber::OnPaint)
END_EVENT_TABLE()
//
// Constructor
//
Grabber::Grabber(wxWindow * parent, wxWindowID id)
: wxWindow(parent,
id,
wxDefaultPosition,
wxSize(grabberWidth, 27),
wxFULL_REPAINT_ON_RESIZE)
{
mOver = false;
mPressed = false;
SetLabel( _("Grabber") );
}
//
// Destructor
//
Grabber::~Grabber()
{
}
//
// Queue a drag event
//
void Grabber::SendEvent(wxEventType type, const wxPoint & pos)
{
// Initialize event and convert mouse coordinates to screen space
GrabberEvent e(type, GetId(), ClientToScreen(pos));
// Set the object of our desire
e.SetEventObject(GetParent());
// Queue the event
GetParent()->GetEventHandler()->AddPendingEvent(e);
}
//
// Draw the grabber
//
void Grabber::DrawGrabber( wxDC & dc )
{
wxRect r = GetRect();
int y, left, right, top, bottom;
// Paint the background
AColor::Medium(&dc, mOver);
dc.DrawRectangle(r);
#ifndef __WXMAC__
// Add a box
r.width -= 1;
r.height -= 1;
AColor::Bevel(dc, !mPressed, r);
r.width += 1;
r.height += 1;
#endif
// Calculate the bump rectangle
r.Deflate(3, 3);
if ((r.GetHeight() % 4) < 2)
{
r.Offset(0, 1);
}
// Cache
left = r.GetLeft();
right = r.GetRight() + 1; //+1 for DrawLine()'s lack of not plotting last
pixel
top = r.GetTop();
bottom = r.GetBottom();
// Draw the raised bumps
if( mPressed )
AColor::Dark(&dc, false);
else
AColor::Light(&dc, false);
for( y = top; y < bottom; y += 4 )
{
dc.DrawLine(left, y, right, y);
}
// Draw the pushed bumps
if (mPressed)
AColor::Light(&dc, false);
else
AColor::Dark(&dc, false);
for (y = top + 1; y <= bottom; y += 4)
{
dc.DrawLine(left, y, right, y);
}
}
//
// Change the button state
//
void Grabber::PushButton(bool state)
{
// Redraw button
mPressed = state;
Refresh(false);
}
//
// Handle left button down events
//
void Grabber::OnLeftDown(wxMouseEvent & event)
{
// Button should be drawn pushed
PushButton(true);
// Notify parent
SendEvent(EVT_GRABBER_CLICKED, event.GetPosition());
event.Skip();
}
//
// Handle mouse enter events
//
void Grabber::OnEnter(wxMouseEvent & event)
{
// Redraw highlighted
mOver = true;
Refresh(false);
}
//
// Handle mouse leave events
//
void Grabber::OnLeave(wxMouseEvent & event)
{
// Redraw plain
mOver = false;
Refresh(false);
}
//
// Handle the paint events
//
void Grabber::OnPaint(wxPaintEvent & event)
{
wxPaintDC dc(this);
// Redraw the grabber
DrawGrabber(dc);
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 2f4ec75c-bdb7-4889-96d1-5d00abc41027
Index: Ruler.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/Ruler.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- Ruler.cpp 19 Aug 2006 18:51:42 -0000 1.39
+++ Ruler.cpp 16 Sep 2006 05:54:38 -0000 1.40
@@ -65,7 +65,7 @@
#include "../Project.h"
#include "Ruler.h"
#include "../TrackPanel.h"
-#include "../ControlToolBar.h"
+#include "../toolbars/ControlToolBar.h"
#include "../Theme.h"
#include "../AllThemeResources.h"
Index: Meter.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/Meter.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- Meter.cpp 11 Jul 2006 08:14:13 -0000 1.23
+++ Meter.cpp 16 Sep 2006 05:54:38 -0000 1.24
@@ -55,7 +55,7 @@
#include "../ImageManipulation.h"
//#include "../../images/MixerImages.h"
#include "../Project.h"
-#include "../MeterToolBar.h"
+#include "../toolbars/MeterToolBar.h"
#include "../Prefs.h"
#include "../Theme.h"
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs