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

Modified Files:
        ToolBar.cpp ToolManager.cpp ToolManager.h 
Log Message:
Reverse change checked in by mistake

Index: ToolManager.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolManager.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ToolManager.h       17 Oct 2006 12:28:53 -0000      1.3
+++ ToolManager.h       17 Oct 2006 12:36:29 -0000      1.4
@@ -67,26 +67,22 @@
    void OnTimer( wxTimerEvent & event );
    void OnMouse( wxMouseEvent & event );
    void OnGrabber( GrabberEvent & event );
-   void OnPaintIndicator( wxPaintEvent & event );
-   void OnPaintFloat( wxPaintEvent & event );
+   void OnPaint( wxPaintEvent & event );
    void OnCreate( wxWindowCreateEvent & event );
   
    void ReadConfig();
    void WriteConfig();
-   void StartDrag( wxPoint & pos );
+   void StartDrag( const 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;
@@ -104,6 +100,8 @@
 
    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.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ToolManager.cpp     17 Oct 2006 12:28:53 -0000      1.5
+++ ToolManager.cpp     17 Oct 2006 12:36:29 -0000      1.6
@@ -134,7 +134,7 @@
 
    // Hook the paint event...needed for all
    mIndicator->Connect( wxEVT_PAINT,
-                        wxPaintEventHandler( ToolManager::OnPaintIndicator ),
+                        wxPaintEventHandler( ToolManager::OnPaint ),
                         NULL,
                         this );
 
@@ -173,7 +173,7 @@
                            NULL,
                            this );
    mIndicator->Disconnect( wxEVT_PAINT,
-                           wxPaintEventHandler( ToolManager::OnPaintIndicator 
),
+                           wxPaintEventHandler( ToolManager::OnPaint ),
                            NULL,
                            this );
 
@@ -418,7 +418,7 @@
 //
 wxWindow *ToolManager::Float( ToolBar *t, wxPoint & pos )
 {
-   wxFrame *parent;
+   wxWindow *parent;
 
 #if defined(__WXMAC__)
    // Disable window animation
@@ -426,31 +426,27 @@
 #endif
 
    // Create the floater window
-//   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() );
+   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() );
+   }
 
    // Intercept the grabber events
    parent->Connect( EVT_GRABBER_CLICKED,
@@ -458,28 +454,16 @@
                     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() )
    {
@@ -495,7 +479,7 @@
 
 #if defined(__WXMAC__)
    // Reinstate original transition
-//   wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition );
+   wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition );
 #endif
 
    return parent;
@@ -572,24 +556,17 @@
    // Inform toolbar of change
    mDragBar->SetDocked( false );
 
-   wxPoint mp = wxGetMousePosition();
-   mDragOffset = mp - 
-                 mDragBar->GetParent()->ClientToScreen( 
mDragBar->GetPosition() );
-
    // Continue the drag 
-   StartDrag( mp );
+   StartDrag( wxGetMousePosition() );
 }
 
 //
 // Common handler for transitioning a bar to dragging
 //
-void ToolManager::StartDrag( wxPoint & pos )
+void ToolManager::StartDrag( const 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;
@@ -623,7 +600,7 @@
                               wxID_ANY,
                               wxEmptyString,
                               pos,
-                              sz + wxSize( 2, 2 ),
+                              wxSize( sz.GetWidth() + 2, sz.GetHeight() + 2 ),
                               wxNO_BORDER |
                               wxFRAME_NO_TASKBAR |
                               wxFRAME_FLOAT_ON_PARENT );
@@ -735,13 +712,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 - mDragOffset );
+      mDragWindow->Move( pos );
 
       // Remember to prevent excessive movement
       mLastPos = pos;
@@ -852,29 +829,13 @@
 // Really only needed for the Mac since SetBackgroundColour()
 // doesn't seem to work with shaped frames.
 //
-void ToolManager::OnPaintIndicator( wxPaintEvent & event )
-{
-   wxWindow *w = (wxWindow *)event.GetEventObject();
-   wxPaintDC dc( w );
-   dc.BeginDrawing();
-   dc.SetBackground( *wxBLUE_BRUSH );
-   dc.Clear();
-   dc.EndDrawing();
-}
-
-//
-// Handle floaterpaint events
-//
-void ToolManager::OnPaintFloat( wxPaintEvent & event )
+void ToolManager::OnPaint( wxPaintEvent & event )
 {
-   wxWindow *w = (wxWindow *)event.GetEventObject();
-   wxPaintDC dc( w );
-   wxSize sz = w->GetSize();
+   wxPaintDC dc( mIndicator );
 
    dc.BeginDrawing();
+   dc.SetBackground( *wxBLUE_BRUSH );
    dc.Clear();
-   dc.SetPen( *wxBLACK_PEN );
-   dc.DrawRectangle( 0, 0, sz.GetWidth(), sz.GetHeight() );
    dc.EndDrawing();
 }
 
@@ -916,12 +877,8 @@
    // And make it disappear
    parent->Hide();
 
-   wxPoint mp = wxGetMousePosition();
-   mDragOffset = mp - 
-                 mDragBar->GetParent()->ClientToScreen( 
mDragBar->GetPosition() );
-
    // Start the dragging
-   StartDrag( mp );
+   StartDrag( wxGetMousePosition() );
 
    // Kill the parent
    parent->Destroy();

Index: ToolBar.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolBar.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ToolBar.cpp 17 Oct 2006 12:28:53 -0000      1.3
+++ ToolBar.cpp 17 Oct 2006 12:36:29 -0000      1.4
@@ -206,7 +206,6 @@
    // Set the true AND minimum sizes and do final layout
    SetBestFittingSize(sz);
    Layout();
-   SetAutoLayout(false);
 }
 
 ToolDock *ToolBar::GetDock()
@@ -444,9 +443,6 @@
 //
 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