Update of /cvsroot/audacity/audacity-src/src/widgets
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv8878
Modified Files:
ASlider.cpp
Log Message:
Keep slider tip from "falling behind" other windows, like the ruler while
playing.
Index: ASlider.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/ASlider.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- ASlider.cpp 1 Apr 2007 07:41:06 -0000 1.56
+++ ASlider.cpp 29 May 2007 00:14:42 -0000 1.57
@@ -63,6 +63,10 @@
#include <wx/popupwin.h>
#endif
+#if defined(__WXMAC__)
+#include <wx/sysopt.h>
+#endif
+
#include "ASlider.h"
#include "../AColor.h"
@@ -75,8 +79,6 @@
//#include "../../images/SliderThumb.xpm"
//#include "../../images/SliderThumbAlpha.xpm"
-#include <iostream>
-
#if defined __WXMSW__
const int sliderFontSize = 10;
#else
@@ -89,6 +91,12 @@
#if USE_POPUPWIN
class TipPanel : public wxPopupWindow
+#elif defined(__WXMAC__)
+// On the Mac, we use a wxFrame as a wxPanel will appear to fall behind
+// whatever window it is hovering above if that window is refreshed. A frame
+// does not have this problem. One unfortunate side effect is that a shadow
+// now appears below the tip panel.
+class TipPanel : public wxFrame
#else
class TipPanel : public wxPanel
#endif
@@ -102,6 +110,10 @@
void OnPaint(wxPaintEvent & event);
+#if defined(__WXMAC__)
+ bool Show(bool show);
+#endif
+
wxString label;
wxString origLabel;
@@ -145,6 +157,17 @@
#else
+#if defined(__WXMAC__)
+BEGIN_EVENT_TABLE(TipPanel, wxFrame)
+ EVT_PAINT(TipPanel::OnPaint)
+END_EVENT_TABLE()
+
+TipPanel::TipPanel(wxWindow *parent, wxWindowID id,
+ wxString label,
+ const wxPoint &pos):
+ wxFrame(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize,
+ wxNO_BORDER | wxFRAME_NO_TASKBAR)
+#else
BEGIN_EVENT_TABLE(TipPanel, wxPanel)
EVT_PAINT(TipPanel::OnPaint)
END_EVENT_TABLE()
@@ -153,6 +176,8 @@
wxString label,
const wxPoint &pos):
wxPanel(parent, id)
+#endif
+
{
this->label = label;
this->origLabel = label;
@@ -175,6 +200,25 @@
Raise();
}
+#if defined(__WXMAC__)
+bool TipPanel::Show(bool show)
+{
+ // Save original transition
+ int trans = wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION );
+
+ // Disable window animation
+ wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
+
+ // Show/Hide the window
+ bool shown = wxFrame::Show(show);
+
+ // Disable window animation
+ wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, trans );
+
+ return shown;
+}
+#endif
+
#endif
void TipPanel::OnPaint(wxPaintEvent& event)
@@ -185,7 +229,11 @@
wxFont labelFont(sliderFontSize, wxSWISS, wxNORMAL, wxNORMAL);
dc.SetFont(labelFont);
GetClientSize(&width, &height);
+#if defined(__WXMAC__)
+ dc.SetPen(AColor::tooltipBrush.GetColour());
+#else
dc.SetPen(*wxBLACK_PEN);
+#endif
dc.SetBrush(AColor::tooltipBrush);
dc.DrawRectangle(0, 0, width, height);
dc.GetTextExtent(label, &textWidth, &textHeight);
@@ -436,8 +484,11 @@
{
wxPoint pt(mWidth/2 + mLeft, mHeight + mTop + 1);
pt = mParent->ClientToScreen(pt);
+
+#if !defined(__WXMAC__)
if (GetToolTipParent())
pt = GetToolTipParent()->ScreenToClient(pt);
+#endif
if (mPopWin)
((TipPanel *)mPopWin)->SetPos(pt);
@@ -702,7 +753,8 @@
else if( event.ButtonUp() )
{
mIsDragging = false;
- mParent->ReleaseMouse();
+ if (mParent->HasCapture())
+ mParent->ReleaseMouse();
mPopWin->Hide();
((TipPanel *)mPopWin)->SetPos(wxPoint(-1000, -1000));
}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs