1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-15 08:07:41 +02:00

Merge pull request #69 from lllucius/master

Accept rather than close this request.
This commit is contained in:
James Crook 2015-09-16 19:41:35 +01:00
commit 17e2761330
12 changed files with 126 additions and 52 deletions

View File

@ -1175,7 +1175,7 @@ void FileDialog::Disabler::Exit(wxDialog *dialog)
if (mModalCount == 0)
{
::EnableWindow(mHwnd, TRUE);
::SetWindowPos(mHwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
::SetWindowPos(mHwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
}
}

View File

@ -555,21 +555,32 @@ void GetDefaultWindowRect(wxRect *defRect)
{
*defRect = wxGetClientDisplayRect();
defRect->width = 940;
defRect->height = 674;
int width = 940;
int height = 674;
//These conditional values assist in improving placement and size
//of new windows on different platforms.
#ifdef __WXGTK__
defRect->height += 20;
height += 20;
#endif
#ifdef __WXMSW__
defRect->height += 40;
height += 40;
#endif
#ifdef __WXMAC__
defRect->height += 55;
height += 55;
#endif
if (width < defRect->width)
{
defRect->width = width;
}
if (height < defRect->height)
{
defRect->height = height;
}
}
bool IsWindowAccessible(wxRect *requestedRect)
@ -639,6 +650,20 @@ void GetNextWindowPlacement(wxRect *nextRect, bool *pMaximized, bool *pIconized)
}
#endif
// Make sure initial sizes fit within the display bounds
if (normalRect.GetRight() > defaultRect.GetRight()) {
normalRect.SetRight(defaultRect.GetRight());
}
if (normalRect.GetBottom() > defaultRect.GetBottom()) {
normalRect.SetBottom(defaultRect.GetBottom());
}
if (windowRect.GetRight() > defaultRect.GetRight()) {
windowRect.SetRight(defaultRect.GetRight());
}
if (windowRect.GetBottom() > defaultRect.GetBottom()) {
windowRect.SetBottom(defaultRect.GetBottom());
}
if (gAudacityProjects.IsEmpty()) {
if (*pMaximized || *pIconized) {
*nextRect = normalRect;

View File

@ -5300,9 +5300,9 @@ void TrackPanel::HandleSliders(wxMouseEvent &event, bool pan)
WaveTrack *capturedTrack = (WaveTrack *) mCapturedTrack;
if (pan)
slider = mTrackInfo.PanSlider(capturedTrack);
slider = mTrackInfo.PanSlider(capturedTrack, true);
else
slider = mTrackInfo.GainSlider(capturedTrack);
slider = mTrackInfo.GainSlider(capturedTrack, true);
slider->OnMouseEvent(event);
@ -7718,7 +7718,7 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect & rec,
mTrackInfo.DrawMuteSolo(dc, rect, t, (captured && mMouseCapture == IsMuting), false, HasSoloButton());
mTrackInfo.DrawMuteSolo(dc, rect, t, (captured && mMouseCapture == IsSoloing), true, HasSoloButton());
mTrackInfo.DrawSliders(dc, (WaveTrack *)t, rect);
mTrackInfo.DrawSliders(dc, (WaveTrack *)t, rect, captured);
if (!t->GetMinimized()) {
int offset = 8;
@ -9648,6 +9648,11 @@ TrackInfo::TrackInfo(TrackPanel * pParentIn)
wxSize(sliderRect.width, sliderRect.height),
DB_SLIDER);
mGain->SetDefaultValue(1.0);
mGainCaptured = new LWSlider(pParent, _("Gain"),
wxPoint(sliderRect.x, sliderRect.y),
wxSize(sliderRect.width, sliderRect.height),
DB_SLIDER);
mGainCaptured->SetDefaultValue(1.0);
GetPanRect(rect, sliderRect);
@ -9657,6 +9662,11 @@ TrackInfo::TrackInfo(TrackPanel * pParentIn)
wxSize(sliderRect.width, sliderRect.height),
PAN_SLIDER);
mPan->SetDefaultValue(0.0);
mPanCaptured = new LWSlider(pParent, _("Pan"),
wxPoint(sliderRect.x, sliderRect.y),
wxSize(sliderRect.width, sliderRect.height),
PAN_SLIDER);
mPanCaptured->SetDefaultValue(0.0);
int fontSize = 10;
mFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
@ -9677,7 +9687,9 @@ TrackInfo::TrackInfo(TrackPanel * pParentIn)
TrackInfo::~TrackInfo()
{
delete mGainCaptured;
delete mGain;
delete mPanCaptured;
delete mPan;
}
@ -10000,43 +10012,53 @@ void TrackInfo::DrawVelocitySlider(wxDC *dc, NoteTrack *t, wxRect rect) const
}
#endif
void TrackInfo::DrawSliders(wxDC *dc, WaveTrack *t, wxRect rect) const
void TrackInfo::DrawSliders(wxDC *dc, WaveTrack *t, wxRect rect, bool captured) const
{
wxRect sliderRect;
GetGainRect(rect, sliderRect);
if (sliderRect.y + sliderRect.height < rect.y + rect.height - 19) {
GainSlider(t)->OnPaint(*dc);
GainSlider(t, captured)->OnPaint(*dc);
}
GetPanRect(rect, sliderRect);
if (sliderRect.y + sliderRect.height < rect.y + rect.height - 19) {
PanSlider(t)->OnPaint(*dc);
PanSlider(t, captured)->OnPaint(*dc);
}
}
LWSlider * TrackInfo::GainSlider(WaveTrack *t) const
LWSlider * TrackInfo::GainSlider(WaveTrack *t, bool captured) const
{
wxRect rect(kLeftInset, t->GetY() - pParent->GetViewInfo()->vpos + kTopInset, 1, t->GetHeight());
wxRect sliderRect;
GetGainRect(rect, sliderRect);
mGain->Move(wxPoint(sliderRect.x, sliderRect.y));
mGain->Set(t->GetGain());
wxPoint pos = sliderRect.GetPosition();
float gain = t->GetGain();
return mGain;
mGain->Move(pos);
mGain->Set(gain);
mGainCaptured->Move(pos);
mGainCaptured->Set(gain);
return captured ? mGainCaptured : mGain;
}
LWSlider * TrackInfo::PanSlider(WaveTrack *t) const
LWSlider * TrackInfo::PanSlider(WaveTrack *t, bool captured) const
{
wxRect rect(kLeftInset, t->GetY() - pParent->GetViewInfo()->vpos + kTopInset, 1, t->GetHeight());
wxRect sliderRect;
GetPanRect(rect, sliderRect);
mPan->Move(wxPoint(sliderRect.x, sliderRect.y));
mPan->Set(t->GetPan());
wxPoint pos = sliderRect.GetPosition();
float pan = t->GetPan();
return mPan;
mPan->Move(pos);
mPan->Set(pan);
mPanCaptured->Move(pos);
mPanCaptured->Set(pan);
return captured ? mPanCaptured : mPan;
}
static TrackPanel * TrackPanelFactory(wxWindow * parent,

View File

@ -90,7 +90,7 @@ private:
#ifdef EXPERIMENTAL_MIDI_OUT
void DrawVelocitySlider(wxDC * dc, NoteTrack *t, wxRect rect) const ;
#endif
void DrawSliders(wxDC * dc, WaveTrack *t, wxRect rect) const;
void DrawSliders(wxDC * dc, WaveTrack *t, wxRect rect, bool captured) const;
// Draw the minimize button *and* the sync-lock track icon, if necessary.
void DrawMinimize(wxDC * dc, const wxRect & rect, Track * t, bool down) const;
@ -105,12 +105,14 @@ private:
void GetSyncLockIconRect(const wxRect & rect, wxRect &dest) const;
public:
LWSlider * GainSlider(WaveTrack *t) const;
LWSlider * PanSlider(WaveTrack *t) const;
LWSlider * GainSlider(WaveTrack *t, bool captured = false) const;
LWSlider * PanSlider(WaveTrack *t, bool captured = false) const;
private:
TrackPanel * pParent;
wxFont mFont;
LWSlider *mGainCaptured;
LWSlider *mPanCaptured;
LWSlider *mGain;
LWSlider *mPan;

View File

@ -87,6 +87,8 @@ class ToolBar:public wxPanel
ToolBar(int type, const wxString & label, const wxString & section, bool resizable = false);
virtual ~ToolBar();
virtual bool AcceptsFocus() const { return false; };
virtual void Create(wxWindow *parent);
virtual void EnableDisableButtons() = 0;
virtual void ReCreateButtons();

View File

@ -53,6 +53,8 @@ class ToolDock:public wxPanel
ToolDock( ToolManager *manager, wxWindow *parent, int dockid );
~ToolDock();
virtual bool AcceptsFocus() const { return false; };
void LayoutToolBars();
void Expose( int type, bool show );
int GetOrder( ToolBar *bar );

View File

@ -56,6 +56,9 @@ class AButton: public wxWindow {
virtual ~ AButton();
virtual bool AcceptsFocus() const { return false; };
virtual bool AcceptsFocusFromKeyboard() const { return true; };
// Associate a set of four images (button up, highlight, button down,
// disabled) with one nondefault state of the button
virtual void SetAlternateImages(unsigned idx,

View File

@ -493,8 +493,6 @@ void LWSlider::Init(wxWindow * parent,
mStyle = style;
mOrientation = orientation;
mIsDragging = false;
mWidth = size.x;
mHeight = size.y;
mParent = parent;
mHW = heavyweight;
mPopup = popup;
@ -513,6 +511,8 @@ void LWSlider::Init(wxWindow * parent,
mScrollPage = 5.0f;
mTipPanel = NULL;
AdjustSize(size);
mpRuler = NULL; // Do this and Move() before Draw().
Move(pos);
}
@ -577,6 +577,39 @@ void LWSlider::Move(const wxPoint &newpos)
mTop = newpos.y;
}
void LWSlider::AdjustSize(const wxSize & sz)
{
mWidth = sz.GetWidth();
mHeight = sz.GetHeight();
mThumbWidth = 14;
mThumbHeight = 14;
if (mOrientation == wxHORIZONTAL)
{
mCenterY = mHeight - 9;
}
else
{
mCenterX = mWidth - 9;
}
if (mOrientation == wxHORIZONTAL)
{
mLeftX = mThumbWidth/2;
mRightX = mWidth - mThumbWidth/2 - 1;
mWidthX = mRightX - mLeftX;
}
else
{
mTopY = mThumbWidth/2;
mBottomY = mHeight - mThumbWidth/2 - 1;
mHeightY = mBottomY - mTopY;
}
Refresh();
}
void LWSlider::OnPaint(wxDC &dc)
{
if (!mBitmap || !mThumbBitmap)
@ -617,8 +650,7 @@ void LWSlider::OnPaint(wxDC &dc)
void LWSlider::OnSize( wxSizeEvent & event )
{
mWidth = event.GetSize().GetX();
mHeight = event.GetSize().GetY();
AdjustSize(event.GetSize());
Refresh();
}
@ -644,8 +676,6 @@ void LWSlider::Draw(wxDC & paintDC)
wxMemoryDC dc;
// Create the bitmap
mThumbWidth = 14;
mThumbHeight = 14;
mThumbBitmap = new wxBitmap();
mThumbBitmap->Create(mThumbWidth, mThumbHeight, paintDC);
dc.SelectObject(*mThumbBitmap);
@ -711,28 +741,6 @@ void LWSlider::Draw(wxDC & paintDC)
// Now the background bitmap
//
if (mOrientation == wxHORIZONTAL)
{
mCenterY = mHeight - 9;
}
else
{
mCenterX = mWidth - 9;
}
if (mOrientation == wxHORIZONTAL)
{
mLeftX = mThumbWidth/2;
mRightX = mWidth - mThumbWidth/2 - 1;
mWidthX = mRightX - mLeftX;
}
else
{
mTopY = mThumbWidth/2;
mBottomY = mHeight - mThumbWidth/2 - 1;
mHeightY = mBottomY - mTopY;
}
mBitmap = new wxBitmap();
mBitmap->Create(mWidth, mHeight, paintDC);
dc.SelectObject(*mBitmap);

View File

@ -142,6 +142,8 @@ class LWSlider
void Move(const wxPoint &newpos);
void AdjustSize(const wxSize & sz);
void OnPaint(wxDC &dc);
void OnSize(wxSizeEvent & event);
void OnMouseEvent(wxMouseEvent & event);

View File

@ -414,8 +414,11 @@ void Meter::OnErase(wxEraseEvent & WXUNUSED(event))
void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
{
// wxDC *paintDC = wxAutoBufferedPaintDCFactory(this);
#if defined(__WXMAC__)
wxPaintDC *paintDC = new wxPaintDC(this);
#else
wxDC *paintDC = wxAutoBufferedPaintDCFactory(this);
#endif
wxDC & destDC = *paintDC;
if (mLayoutValid == false)

View File

@ -113,6 +113,9 @@ class Meter : public wxPanel
~Meter();
virtual bool AcceptsFocus() const { return false; };
virtual bool AcceptsFocusFromKeyboard() const { return true; };
void UpdatePrefs();
void Clear();

View File

@ -282,6 +282,8 @@ public:
~AdornedRulerPanel();
virtual bool AcceptsFocus() const { return false; };
public:
static int GetRulerHeight() { return 28; }
void SetLeftOffset(int offset);