Update of /cvsroot/audacity/audacity-src/src/toolbars
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv27426/toolbars

Modified Files:
        ToolBar.cpp ToolManager.cpp ToolManager.h 
Log Message:
Add filter for MP2/MPEG files

Index: ToolManager.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolManager.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ToolManager.h       15 Oct 2006 03:47:23 -0000      1.2
+++ ToolManager.h       17 Oct 2006 12:28:53 -0000      1.3
@@ -67,22 +67,26 @@
    void OnTimer( wxTimerEvent & event );
    void OnMouse( wxMouseEvent & event );
    void OnGrabber( GrabberEvent & event );
-   void OnPaint( wxPaintEvent & event );
+   void OnPaintIndicator( wxPaintEvent & event );
+   void OnPaintFloat( wxPaintEvent & event );
    void OnCreate( wxWindowCreateEvent & event );
   
    void ReadConfig();
    void WriteConfig();
-   void StartDrag( const wxPoint & pos );
+   void StartDrag( wxPoint & pos );
    void Updated();
 
    wxWindow *mParent;
 
+   wxWindow *mDragWindow;
    ToolDock *mDragDock;
    ToolBar *mDragBar;
+   wxPoint mDragOffset;
    int mDragBefore;
 
    wxPoint mLastPos;
    wxRect mBarPos;
+
    wxFrame *mIndicator;
    wxRegion *mLeft;
    wxRegion *mDown;
@@ -100,8 +104,6 @@
 
    ToolBar *mBars[ ToolBarCount ];
 
-   wxWindow *mDragWindow;
-
  public:
 
    DECLARE_CLASS( ToolManager );

Index: ToolManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolManager.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ToolManager.cpp     15 Oct 2006 03:47:23 -0000      1.4
+++ ToolManager.cpp     17 Oct 2006 12:28:53 -0000      1.5
@@ -134,7 +134,7 @@
 
    // Hook the paint event...needed for all
    mIndicator->Connect( wxEVT_PAINT,
-                        wxPaintEventHandler( ToolManager::OnPaint ),
+                        wxPaintEventHandler( ToolManager::OnPaintIndicator ),
                         NULL,
                         this );
 
@@ -173,7 +173,7 @@
                            NULL,
                            this );
    mIndicator->Disconnect( wxEVT_PAINT,
-                           wxPaintEventHandler( ToolManager::OnPaint ),
+                           wxPaintEventHandler( ToolManager::OnPaintIndicator 
),
                            NULL,
                            this );
 
@@ -418,7 +418,7 @@
 //
 wxWindow *ToolManager::Float( ToolBar *t, wxPoint & pos )
 {
-   wxWindow *parent;
+   wxFrame *parent;
 
 #if defined(__WXMAC__)
    // Disable window animation
@@ -426,27 +426,31 @@
 #endif
 
    // Create the floater window
-   int flags = wxCAPTION | wxFRAME_TOOL_WINDOW | wxFRAME_FLOAT_ON_PARENT;
-   if( t->IsResizeable() )
-   {
-      parent = new wxFrame( mParent,
-                            wxID_ANY,
-                            t->GetTitle(),
-                            pos,
-                            wxDefaultSize,
-                            flags | wxRESIZE_BORDER,
-                            t->GetLabel() );
-   }
-   else
-   {
-      parent = new wxMiniFrame( mParent,
-                                wxID_ANY,
-                                t->GetTitle(),
-                                pos,
-                                wxDefaultSize,
-                                flags,
-                                t->GetLabel() );
-   }
+//   int flags = wxCAPTION | wxFRAME_TOOL_WINDOW | wxFRAME_FLOAT_ON_PARENT;
+   int flags = wxFRAME_TOOL_WINDOW |
+               wxFRAME_FLOAT_ON_PARENT | 
+               wxNO_BORDER |
+               wxFRAME_SHAPED |
+               wxFRAME_NO_TASKBAR;
+
+#if defined(__WXMAC__)
+   // Mac needs the caption flag to ensure it stays on top of the parent.  
Otherwise,
+   // it can fall behind the parent window.  The caption isn't used, but this 
flag
+   // give us what we need.
+   flags |= wxCAPTION;
+#endif
+
+   // Get the size of the toolbar
+   wxSize sz = t->GetSize();
+
+   // Create the floater
+   parent = new wxFrame( mParent,
+                         wxID_ANY,
+                         wxEmptyString,
+                         pos - mDragOffset,
+                         sz + wxSize( 2 , 2 ),
+                         flags,
+                         t->GetLabel() );
 
    // Intercept the grabber events
    parent->Connect( EVT_GRABBER_CLICKED,
@@ -454,16 +458,28 @@
                     NULL,
                     this );
 
+   // Hook the paint event...needed for all
+   parent->Connect( wxEVT_PAINT,
+                    wxPaintEventHandler( ToolManager::OnPaintFloat ),
+                    NULL,
+                    this );
+
    // Move the toolbar from the toolbar dock to the floater window
    t->Reparent( parent );
+   t->Move( 1, 1 );
+
+//   wxBoxSizer *szr = new wxBoxSizer( wxHORIZONTAL );
+//   szr->Add(t);
+//   parent->SetSizer(szr);
+
+#if defined(__WXGTK__)
+   parent->SetBackgroundColour( *wxBLACK );
+   parent->ClearBackground();
+#endif
 
    // Tell the toolbar about the change
    t->SetDocked( false );
 
-   // Resize the floater client size to the toolbars minimum size
-   wxSize sz = t->GetSize();
-   parent->SetClientSize( sz.x + 1, sz.y + 1 );
-
    // Make sure resizable floaters don't get any smaller than initial size
    if( t->IsResizeable() )
    {
@@ -479,7 +495,7 @@
 
 #if defined(__WXMAC__)
    // Reinstate original transition
-   wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition );
+//   wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition );
 #endif
 
    return parent;
@@ -556,17 +572,24 @@
    // Inform toolbar of change
    mDragBar->SetDocked( false );
 
+   wxPoint mp = wxGetMousePosition();
+   mDragOffset = mp - 
+                 mDragBar->GetParent()->ClientToScreen( 
mDragBar->GetPosition() );
+
    // Continue the drag 
-   StartDrag( wxGetMousePosition() );
+   StartDrag( mp );
 }
 
 //
 // Common handler for transitioning a bar to dragging
 //
-void ToolManager::StartDrag( const wxPoint & pos )
+void ToolManager::StartDrag( wxPoint & pos )
 {
    wxSize sz;
 
+   // Calc the real position of the window
+   pos -= mDragOffset;
+
    // Get the current size and force the height to the minimum
    sz = mDragBar->GetSize();
    sz.y = mDragBar->GetMinSize().y;
@@ -600,7 +623,7 @@
                               wxID_ANY,
                               wxEmptyString,
                               pos,
-                              wxSize( sz.GetWidth() + 2, sz.GetHeight() + 2 ),
+                              sz + wxSize( 2, 2 ),
                               wxNO_BORDER |
                               wxFRAME_NO_TASKBAR |
                               wxFRAME_FLOAT_ON_PARENT );
@@ -712,13 +735,13 @@
 
 #if defined(__WXMAC__)
       // Reinstate original transition
-      wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition );
+//      wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition 
);
 #endif
    }
    else if( event.Dragging() && pos != mLastPos )
    {
       // Make toolbar follow the mouse
-      mDragWindow->Move( pos );
+      mDragWindow->Move( pos - mDragOffset );
 
       // Remember to prevent excessive movement
       mLastPos = pos;
@@ -829,10 +852,10 @@
 // Really only needed for the Mac since SetBackgroundColour()
 // doesn't seem to work with shaped frames.
 //
-void ToolManager::OnPaint( wxPaintEvent & event )
+void ToolManager::OnPaintIndicator( wxPaintEvent & event )
 {
-   wxPaintDC dc( mIndicator );
-
+   wxWindow *w = (wxWindow *)event.GetEventObject();
+   wxPaintDC dc( w );
    dc.BeginDrawing();
    dc.SetBackground( *wxBLUE_BRUSH );
    dc.Clear();
@@ -840,6 +863,22 @@
 }
 
 //
+// Handle floaterpaint events
+//
+void ToolManager::OnPaintFloat( wxPaintEvent & event )
+{
+   wxWindow *w = (wxWindow *)event.GetEventObject();
+   wxPaintDC dc( w );
+   wxSize sz = w->GetSize();
+
+   dc.BeginDrawing();
+   dc.Clear();
+   dc.SetPen( *wxBLACK_PEN );
+   dc.DrawRectangle( 0, 0, sz.GetWidth(), sz.GetHeight() );
+   dc.EndDrawing();
+}
+
+//
 // Handle Indicator creation event
 //
 // Without this, the initial Indicator window will be a solid blue square
@@ -877,8 +916,12 @@
    // And make it disappear
    parent->Hide();
 
+   wxPoint mp = wxGetMousePosition();
+   mDragOffset = mp - 
+                 mDragBar->GetParent()->ClientToScreen( 
mDragBar->GetPosition() );
+
    // Start the dragging
-   StartDrag( wxGetMousePosition() );
+   StartDrag( mp );
 
    // Kill the parent
    parent->Destroy();

Index: ToolBar.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolBar.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ToolBar.cpp 15 Oct 2006 03:47:23 -0000      1.2
+++ ToolBar.cpp 17 Oct 2006 12:28:53 -0000      1.3
@@ -206,6 +206,7 @@
    // Set the true AND minimum sizes and do final layout
    SetBestFittingSize(sz);
    Layout();
+   SetAutoLayout(false);
 }
 
 ToolDock *ToolBar::GetDock()
@@ -443,6 +444,9 @@
 //
 void ToolBar::OnSize( wxSizeEvent & event )
 {
+   wxSize sz = GetSize();
+   Layout();
+   Move( 1, 1 );
    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

Reply via email to