1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-24 16:20:05 +02:00

Merge branch 'master' into scrubbing2

This commit is contained in:
Paul Licameli 2016-06-01 13:02:51 -04:00
commit f3dd448aa3
11 changed files with 4273 additions and 4233 deletions

View File

@ -65,6 +65,7 @@ and use it for toolbar and window layouts too.
#include "Project.h" #include "Project.h"
#include "toolbars/ToolBar.h" #include "toolbars/ToolBar.h"
#include "toolbars/ToolManager.h" #include "toolbars/ToolManager.h"
#include "widgets/Ruler.h"
#include "ImageManipulation.h" #include "ImageManipulation.h"
#include "Theme.h" #include "Theme.h"
#include "Experimental.h" #include "Experimental.h"
@ -230,6 +231,7 @@ void Theme::ApplyUpdatedImages()
if( pToolBar ) if( pToolBar )
pToolBar->ReCreateButtons(); pToolBar->ReCreateButtons();
} }
p->GetRulerPanel()->ReCreateButtons();
} }
void Theme::RegisterImages() void Theme::RegisterImages()
@ -958,27 +960,41 @@ void ThemeBase::SaveComponents()
if( (mBitmapFlags[i] & resFlagInternal)==0) if( (mBitmapFlags[i] & resFlagInternal)==0)
{ {
FileName = FileNames::ThemeComponent( mBitmapNames[i] ); FileName = FileNames::ThemeComponent( mBitmapNames[i] );
if( !wxFileExists( FileName )) if( wxFileExists( FileName ))
{ {
if( !mImages[i].SaveFile( FileName, wxBITMAP_TYPE_PNG )) ++n;
{ break;
wxMessageBox(
wxString::Format(
_("Audacity could not save file:\n %s"),
FileName.c_str() ));
return;
}
n++;
} }
} }
} }
if( n==0 )
if (n > 0)
{ {
wxMessageBox( auto result =
wxString::Format( wxMessageBox(
_("All required files in:\n %s\nwere already present."), wxString::Format(
FileNames::ThemeComponentsDir().c_str() )); _("Some required files in:\n %s\nwere already present. Overwrite?"),
return; FileNames::ThemeComponentsDir().c_str()),
wxMessageBoxCaptionStr,
wxYES_NO | wxNO_DEFAULT);
if(result == wxNO)
return;
}
for(i=0;i<(int)mImages.GetCount();i++)
{
if( (mBitmapFlags[i] & resFlagInternal)==0)
{
FileName = FileNames::ThemeComponent( mBitmapNames[i] );
if( !mImages[i].SaveFile( FileName, wxBITMAP_TYPE_PNG ))
{
wxMessageBox(
wxString::Format(
_("Audacity could not save file:\n %s"),
FileName.c_str() ));
return;
}
}
} }
wxMessageBox( wxMessageBox(
wxString::Format( wxString::Format(

File diff suppressed because it is too large Load Diff

View File

@ -129,7 +129,7 @@ AButton *ControlToolBar::MakeButton(teBmps eEnabledUp, teBmps eEnabledDown, teBm
bool processdownevents, bool processdownevents,
const wxChar *label) const wxChar *label)
{ {
AButton *r = ToolBar::MakeButton( AButton *r = ToolBar::MakeButton(this,
bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredHiliteLarge, bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredHiliteLarge,
eEnabledUp, eEnabledDown, eDisabled, eEnabledUp, eEnabledDown, eDisabled,
wxWindowID(id), wxWindowID(id),

View File

@ -105,7 +105,7 @@ AButton *EditToolBar::AddButton(
{ {
AButton *&r = mButtons[id]; AButton *&r = mButtons[id];
r = ToolBar::MakeButton( r = ToolBar::MakeButton(this,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall, bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
eEnabledUp, eEnabledDown, eDisabled, eEnabledUp, eEnabledDown, eDisabled,
wxWindowID(id), wxWindowID(id),

View File

@ -700,6 +700,7 @@ void ToolBar::MakeButtonBackgroundsSmall()
} }
/// Makes a button and its four different state bitmaps /// Makes a button and its four different state bitmaps
/// @param parent Parent window for the button.
/// @param eUp Background for when button is Up. /// @param eUp Background for when button is Up.
/// @param eDown Background for when button is Down. /// @param eDown Background for when button is Down.
/// @param eHilite Background for when button is Hilit. /// @param eHilite Background for when button is Hilit.
@ -710,7 +711,8 @@ void ToolBar::MakeButtonBackgroundsSmall()
/// @param placement Placement position /// @param placement Placement position
/// @param processdownevents true iff button handles down events. /// @param processdownevents true iff button handles down events.
/// @param size Size of the background. /// @param size Size of the background.
AButton * ToolBar::MakeButton(teBmps eUp, AButton * ToolBar::MakeButton(wxWindow *parent,
teBmps eUp,
teBmps eDown, teBmps eDown,
teBmps eHilite, teBmps eHilite,
teBmps eStandardUp, teBmps eStandardUp,
@ -731,7 +733,7 @@ AButton * ToolBar::MakeButton(teBmps eUp,
wxImagePtr disable2 (OverlayImage(eUp, eDisabled, xoff, yoff)); wxImagePtr disable2 (OverlayImage(eUp, eDisabled, xoff, yoff));
AButton * button = AButton * button =
new AButton(this, id, placement, size, *up2, *hilite2, *down2, new AButton(parent, id, placement, size, *up2, *hilite2, *down2,
*disable2, processdownevents); *disable2, processdownevents);
return button; return button;

View File

@ -121,9 +121,11 @@ class ToolBar /* not final */ : public wxPanel
virtual int GetInitialWidth() { return -1; } virtual int GetInitialWidth() { return -1; }
virtual int GetMinToolbarWidth() { return GetInitialWidth(); } virtual int GetMinToolbarWidth() { return GetInitialWidth(); }
virtual wxSize GetDockedSize() { return GetMinSize(); } virtual wxSize GetDockedSize() { return GetMinSize(); }
protected:
AButton *MakeButton(teBmps eUp, public:
static
AButton *MakeButton(wxWindow *parent,
teBmps eUp,
teBmps eDown, teBmps eDown,
teBmps eHilite, teBmps eHilite,
teBmps eStandardUp, teBmps eStandardUp,
@ -144,6 +146,7 @@ class ToolBar /* not final */ : public wxPanel
teBmps eDisabled, teBmps eDisabled,
wxSize size); wxSize size);
protected:
void SetButton(bool down, AButton *button); void SetButton(bool down, AButton *button);
void MakeMacRecoloredImage(teBmps eBmpOut, teBmps eBmpIn); void MakeMacRecoloredImage(teBmps eBmpOut, teBmps eBmpIn);

View File

@ -156,7 +156,7 @@ void ToolsToolBar::UpdatePrefs()
AButton * ToolsToolBar::MakeTool( teBmps eTool, AButton * ToolsToolBar::MakeTool( teBmps eTool,
int id, const wxChar *label) int id, const wxChar *label)
{ {
AButton *button = ToolBar::MakeButton( AButton *button = ToolBar::MakeButton(this,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall, bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
eTool, eTool, eTool, eTool, eTool, eTool,
wxWindowID(id), wxWindowID(id),

View File

@ -147,7 +147,7 @@ AButton *TranscriptionToolBar::AddButton(
{ {
AButton *&r = mButtons[id]; AButton *&r = mButtons[id];
r = ToolBar::MakeButton( r = ToolBar::MakeButton(this,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall, bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
eFore, eFore, eDisabled, eFore, eFore, eDisabled,
wxWindowID(id), wxWindowID(id),

View File

@ -392,18 +392,6 @@ void AButton::OnMouseEvent(wxMouseEvent & event)
(event.m_x >= 0 && event.m_y >= 0 && (event.m_x >= 0 && event.m_y >= 0 &&
event.m_x < clientSize.x && event.m_y < clientSize.y); event.m_x < clientSize.x && event.m_y < clientSize.y);
if (!mButtonIsDown)
{
// Note that CMD (or CTRL) takes precedence over Shift if both are down
// see also AButton::Listener::OnKeyUp()
if (event.CmdDown() && HasAlternateImages(2))
mAlternateIdx = 2;
else if (event.ShiftDown() && HasAlternateImages(1))
mAlternateIdx = 1;
else
mAlternateIdx = 0;
}
if (mEnabled && event.IsButton()) { if (mEnabled && event.IsButton()) {
if (event.ButtonIsDown(wxMOUSE_BTN_ANY)) { if (event.ButtonIsDown(wxMOUSE_BTN_ANY)) {
mIsClicking = true; mIsClicking = true;

View File

@ -1957,6 +1957,8 @@ AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent,
, mProject(parent) , mProject(parent)
, mViewInfo(viewinfo) , mViewInfo(viewinfo)
{ {
ReCreateButtons();
SetLabel( _("Timeline") ); SetLabel( _("Timeline") );
SetName(GetLabel()); SetName(GetLabel());
SetBackgroundStyle(wxBG_STYLE_PAINT); SetBackgroundStyle(wxBG_STYLE_PAINT);
@ -2062,6 +2064,10 @@ void AdornedRulerPanel::UpdatePrefs()
mButtonFontSize = -1; mButtonFontSize = -1;
} }
void AdornedRulerPanel::ReCreateButtons()
{
}
namespace { namespace {
enum { ArrowWidth = 8, ArrowSpacing = 1, ArrowHeight = ArrowWidth / 2 }; enum { ArrowWidth = 8, ArrowSpacing = 1, ArrowHeight = ArrowWidth / 2 };

View File

@ -315,6 +315,7 @@ public:
void InvalidateRuler(); void InvalidateRuler();
void UpdatePrefs(); void UpdatePrefs();
void ReCreateButtons();
enum class StatusChoice { enum class StatusChoice {
FirstButton = 0, FirstButton = 0,