Update of /cvsroot/audacity/audacity-src/src/widgets
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv16135
Modified Files:
Grabber.cpp
Log Message:
Frameless toolbars...with many corrections to general handling.
Index: Grabber.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/Grabber.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Grabber.cpp 16 Sep 2006 05:54:38 -0000 1.1
+++ Grabber.cpp 22 Oct 2006 09:54:18 -0000 1.2
@@ -58,7 +58,7 @@
mOver = false;
mPressed = false;
- SetLabel( _("Grabber") );
+ SetLabel(_("Grabber"));
}
//
@@ -73,14 +73,16 @@
//
void Grabber::SendEvent(wxEventType type, const wxPoint & pos)
{
+ wxWindow *parent = GetParent();
+
// Initialize event and convert mouse coordinates to screen space
- GrabberEvent e(type, GetId(), ClientToScreen(pos));
+ GrabberEvent e(type, GetId(), parent->ClientToScreen(pos));
// Set the object of our desire
- e.SetEventObject(GetParent());
+ e.SetEventObject(parent);
// Queue the event
- GetParent()->GetEventHandler()->AddPendingEvent(e);
+ parent->AddPendingEvent(e);
}
//
@@ -108,8 +110,7 @@
// Calculate the bump rectangle
r.Deflate(3, 3);
- if ((r.GetHeight() % 4) < 2)
- {
+ if ((r.GetHeight() % 4) < 2) {
r.Offset(0, 1);
}
@@ -120,24 +121,26 @@
bottom = r.GetBottom();
// Draw the raised bumps
- if( mPressed )
+ if (mPressed) {
AColor::Dark(&dc, false);
- else
+ }
+ else {
AColor::Light(&dc, false);
+ }
- for( y = top; y < bottom; y += 4 )
- {
+ for (y = top; y < bottom; y += 4) {
dc.DrawLine(left, y, right, y);
}
// Draw the pushed bumps
- if (mPressed)
+ if (mPressed) {
AColor::Light(&dc, false);
- else
+ }
+ else {
AColor::Dark(&dc, false);
+ }
- for (y = top + 1; y <= bottom; y += 4)
- {
+ for (y = top + 1; y <= bottom; y += 4) {
dc.DrawLine(left, y, right, y);
}
}
@@ -145,8 +148,11 @@
//
// Change the button state
//
-void Grabber::PushButton(bool state)
+void Grabber::PushButton(bool state )
{
+ wxRect r = GetRect();
+ mOver = r.Inside(ScreenToClient(wxGetMousePosition()));
+
// Redraw button
mPressed = state;
Refresh(false);
@@ -181,9 +187,11 @@
//
void Grabber::OnLeave(wxMouseEvent & event)
{
- // Redraw plain
- mOver = false;
- Refresh(false);
+ if (!GetCapture()) {
+ // Redraw plain
+ mOver = false;
+ Refresh(false);
+ }
}
//
-------------------------------------------------------------------------
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