Beispiel #1
0
void ControlToolBar::Populate()
{
   MakeButtonBackgroundsLarge();

   mPause = MakeButton(bmpPause, bmpPause, bmpPauseDisabled,
      ID_PAUSE_BUTTON,  true,  _("Pause"));

   mPlay = MakeButton( bmpPlay, bmpPlay, bmpPlayDisabled,
      ID_PLAY_BUTTON, true, _("Play"));

   MakeLoopImage();

   mStop = MakeButton( bmpStop, bmpStop, bmpStopDisabled ,
      ID_STOP_BUTTON, false, _("Stop"));

   mRewind = MakeButton(bmpRewind, bmpRewind, bmpRewindDisabled,
      ID_REW_BUTTON, false, _("Skip to Start"));

   mFF = MakeButton(bmpFFwd, bmpFFwd, bmpFFwdDisabled,
      ID_FF_BUTTON, false, _("Skip to End"));

   mRecord = MakeButton(bmpRecord, bmpRecord, bmpRecordDisabled,
      ID_RECORD_BUTTON, true, _("Record"));

#if wxUSE_TOOLTIPS
   RegenerateToolsTooltips();
   wxToolTip::Enable(true);
   wxToolTip::SetDelay(1000);
#endif

   // Set default order and mode
   ArrangeButtons();
}
Beispiel #2
0
void ControlToolBar::ReCreateButtons()
{
   bool playDown = false;
   bool playShift = false;
   bool pauseDown = false;
   bool recordDown = false;
   bool recordShift = false;

   // ToolBar::ReCreateButtons() will get rid of its sizer and
   // since we've attached our sizer to it, ours will get deleted too
   // so clean ours up first.
   if( mSizer )
   {
      playDown = mPlay->IsDown();
      playShift = mPlay->WasShiftDown();
      pauseDown = mPause->IsDown();
      recordDown = mRecord->IsDown();
      recordShift = mRecord->WasShiftDown();
      Detach( mSizer );

      delete mSizer;
      mSizer = NULL;
   }

   ToolBar::ReCreateButtons();

   if (playDown)
   {
      ControlToolBar::PlayAppearance appearance =
         playShift ? ControlToolBar::PlayAppearance::Looped
         : ControlToolBar::PlayAppearance::Straight;
      SetPlay(playDown, appearance);
   }

   if (pauseDown)
   {
      mPause->PushDown();
   }

   if (recordDown)
   {
      SetRecord(recordDown, recordShift);
   }

   EnableDisableButtons();

   RegenerateToolsTooltips();
}
Beispiel #3
0
void ControlToolBar::ReCreateButtons()
{
   // ToolBar::ReCreateButtons() will get rid of its sizer and
   // since we've attached our sizer to it, ours will get deleted too
   // so clean ours up first.
   if( mSizer )
   {
      Detach( mSizer );
      delete mSizer;
      mSizer = NULL;
   }

   ToolBar::ReCreateButtons();

   RegenerateToolsTooltips();
}
Beispiel #4
0
void ToolsToolBar::Populate()
{
   MakeButtonBackgroundsSmall();
   Add(mToolSizer = safenew wxGridSizer(2, 3, 1, 1));

   /* Tools */
   mTool[ selectTool   ] = MakeTool( bmpIBeam, selectTool, _("Selection Tool") );
   mTool[ envelopeTool ] = MakeTool( bmpEnvelope, envelopeTool, _("Envelope Tool") );
   mTool[ drawTool     ] = MakeTool( bmpDraw, drawTool, _("Draw Tool") );
   mTool[ zoomTool     ] = MakeTool( bmpZoom, zoomTool, _("Zoom Tool") );
   mTool[ slideTool    ] = MakeTool( bmpTimeShift, slideTool, _("Slide Tool") );
   mTool[ multiTool    ] = MakeTool( bmpMulti, multiTool, _("Multi Tool") );

   mTool[mCurrentTool]->PushDown();

   RegenerateToolsTooltips();
}
void ControlToolBar::Populate()
{
   MakeButtonBackgroundsLarge();

   mPause = MakeButton(bmpPause, bmpPause, bmpPauseDisabled,
      ID_PAUSE_BUTTON,  true,  _("Pause"));

   mPlay = MakeButton( bmpPlay, bmpPlay, bmpPlayDisabled,
      ID_PLAY_BUTTON, true, _("Play"));
   MakeAlternateImages(*mPlay, 1, bmpLoop, bmpLoop, bmpLoopDisabled);
   MakeAlternateImages(*mPlay, 2,
      bmpCutPreview, bmpCutPreview, bmpCutPreviewDisabled);
   MakeAlternateImages(*mPlay, 3,
                       bmpScrub, bmpScrub, bmpScrubDisabled);
   MakeAlternateImages(*mPlay, 4,
                       bmpSeek, bmpSeek, bmpSeekDisabled);
   mPlay->FollowModifierKeys();

   mStop = MakeButton( bmpStop, bmpStop, bmpStopDisabled ,
      ID_STOP_BUTTON, false, _("Stop"));

   mRewind = MakeButton(bmpRewind, bmpRewind, bmpRewindDisabled,
      ID_REW_BUTTON, false, _("Skip to Start"));

   mFF = MakeButton(bmpFFwd, bmpFFwd, bmpFFwdDisabled,
      ID_FF_BUTTON, false, _("Skip to End"));

   mRecord = MakeButton(bmpRecord, bmpRecord, bmpRecordDisabled,
      ID_RECORD_BUTTON, true, _("Record"));
   MakeAlternateImages(*mRecord, 1, bmpAppendRecord, bmpAppendRecord,
      bmpAppendRecordDisabled);
   mRecord->FollowModifierKeys();

#if wxUSE_TOOLTIPS
   RegenerateToolsTooltips();
   wxToolTip::Enable(true);
   wxToolTip::SetDelay(1000);
#endif

   // Set default order and mode
   ArrangeButtons();
}
Beispiel #6
0
void ControlToolBar::UpdatePrefs()
{
   bool updated = false;
   bool active;

   gPrefs->Read( wxT("/GUI/ErgonomicTransportButtons"), &active, true );
   if( mErgonomicTransportButtons != active )
   {
      mErgonomicTransportButtons = active;
      updated = true;
   }
   wxString strLocale = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
   if (mStrLocale != strLocale)
   {
      mStrLocale = strLocale;
      updated = true;
   }

   if( updated )
   {
      ReCreateButtons(); // side effect: calls RegenerateToolsTooltips()
      Updated();
   }
   else
      // The other reason to regenerate tooltips is if keyboard shortcuts for
      // transport buttons changed, but that's too much work to check for, so just
      // always do it. (Much cheaper than calling ReCreateButtons() in all cases.
      RegenerateToolsTooltips();


   // Set label to pull in language change
   SetLabel(_("Transport"));

   // Give base class a chance
   ToolBar::UpdatePrefs();
}
void ToolsToolBar::UpdatePrefs()
{
   RegenerateToolsTooltips();
}
Beispiel #8
0
void ControlToolBar::MakeButtons()
{
   wxImage *upOriginal = new wxImage(wxBitmap(UpButton).ConvertToImage());
   wxImage *downOriginal = new wxImage(wxBitmap(DownButton).ConvertToImage());
   wxImage *hiliteOriginal = new wxImage(wxBitmap(HiliteButton).ConvertToImage());

   wxColour newColour =
       wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);

#ifdef __WXMAC__
   upPattern = upOriginal;
   downPattern = downOriginal;
   hilitePattern = hiliteOriginal;
#else
   upPattern = ChangeImageColour(upOriginal, newColour);
   downPattern = ChangeImageColour(downOriginal, newColour);
   hilitePattern = ChangeImageColour(hiliteOriginal, newColour);
#endif

   /* Buttons */
   #if (AUDACITY_BRANDING == BRAND_THINKLABS) // || (AUDACITY_BRANDING == BRAND_AUDIOTOUCH)
      #define kNumButtons 7
   #else
      #define kNumButtons 6
   #endif
   int buttonOrder[kNumButtons];
   mButtonPos = kButtonsXOffset;
   #if (AUDACITY_BRANDING != BRAND_THINKLABS)
      // no tools for Thinklabs
      if (mShowTools)
         mButtonPos += kToolsClusterWidth;
   #endif
   
   gPrefs->Read("/GUI/ErgonomicTransportButtons", &mErgonomicTransportButtons, false);

   if (mErgonomicTransportButtons)
   {
      #if (AUDACITY_BRANDING == BRAND_THINKLABS)
         buttonOrder[0] = ID_PAUSE_BUTTON;
         buttonOrder[1] = ID_PLAY_BUTTON;
         buttonOrder[2] = ID_LOOP_PLAY_BUTTON;
         buttonOrder[3] = ID_STOP_BUTTON;
         buttonOrder[4] = ID_REW_BUTTON;
         buttonOrder[5] = ID_FF_BUTTON;
         buttonOrder[6] = ID_RECORD_BUTTON;
      #elif (AUDACITY_BRANDING == BRAND_AUDIOTOUCH)
         //buttonOrder[0] = ID_LOCK_BUTTON;
         //buttonOrder[1] = ID_RECORD_BUTTON;
         //buttonOrder[2] = ID_REW_BUTTON;
         //buttonOrder[3] = ID_PLAY_BUTTON;
         //buttonOrder[4] = ID_PAUSE_BUTTON; // actually, on top of Play btn, and alternately hidden
         //buttonOrder[5] = ID_STOP_BUTTON;
         //buttonOrder[6] = ID_FF_BUTTON;

         buttonOrder[0] = ID_RECORD_BUTTON;
         buttonOrder[1] = ID_REW_BUTTON;
         buttonOrder[2] = ID_PLAY_BUTTON;
         buttonOrder[3] = ID_PAUSE_BUTTON; // actually, on top of Play btn, and alternately hidden
         buttonOrder[4] = ID_STOP_BUTTON;
         buttonOrder[5] = ID_FF_BUTTON;
      #else
         buttonOrder[0] = ID_PAUSE_BUTTON;
         buttonOrder[1] = ID_PLAY_BUTTON;
         buttonOrder[2] = ID_STOP_BUTTON;
         buttonOrder[3] = ID_REW_BUTTON;
         buttonOrder[4] = ID_FF_BUTTON;
         buttonOrder[5] = ID_RECORD_BUTTON;
      #endif
   } else
   {
      #if (AUDACITY_BRANDING == BRAND_THINKLABS)
         buttonOrder[0] = ID_REW_BUTTON;
         buttonOrder[1] = ID_PLAY_BUTTON;
         buttonOrder[2] = ID_LOOP_PLAY_BUTTON;
         buttonOrder[3] = ID_RECORD_BUTTON;
         buttonOrder[4] = ID_PAUSE_BUTTON;
         buttonOrder[5] = ID_STOP_BUTTON;
         buttonOrder[6] = ID_FF_BUTTON;
      #elif (AUDACITY_BRANDING == BRAND_AUDIOTOUCH) // ignores mErgonomicTransportButtons
         //buttonOrder[0] = ID_LOCK_BUTTON;
         //buttonOrder[1] = ID_RECORD_BUTTON;
         //buttonOrder[2] = ID_REW_BUTTON;
         //buttonOrder[3] = ID_PLAY_BUTTON;
         //buttonOrder[4] = ID_PAUSE_BUTTON; // actually, on top of Play btn, and alternately hidden
         //buttonOrder[5] = ID_STOP_BUTTON;
         //buttonOrder[6] = ID_FF_BUTTON;

         buttonOrder[0] = ID_RECORD_BUTTON;
         buttonOrder[1] = ID_REW_BUTTON;
         buttonOrder[2] = ID_PLAY_BUTTON;
         buttonOrder[3] = ID_PAUSE_BUTTON; // actually, on top of Play btn, and alternately hidden
         buttonOrder[4] = ID_STOP_BUTTON;
         buttonOrder[5] = ID_FF_BUTTON;
      #else
         buttonOrder[0] = ID_REW_BUTTON;
         buttonOrder[1] = ID_PLAY_BUTTON;
         buttonOrder[2] = ID_RECORD_BUTTON;
         buttonOrder[3] = ID_PAUSE_BUTTON;
         buttonOrder[4] = ID_STOP_BUTTON;
         buttonOrder[5] = ID_FF_BUTTON;
      #endif
   }
   
   for (int iButton = 0; iButton < kNumButtons; iButton++)
   {
      switch (buttonOrder[iButton])
      {
      case ID_REW_BUTTON:
         mRewind = MakeButton((char const **) Rewind,
                              (char const **) RewindDisabled,
                              (char const **) RewindAlpha, ID_REW_BUTTON,
                              false);
         break;
      
      case ID_PLAY_BUTTON:
         mPlay = MakeButton((char const **) Play,
                            (char const **) PlayDisabled,
                            (char const **) PlayAlpha, ID_PLAY_BUTTON,
                            false);
         MakeLoopImage();
         break;
      
      #if (AUDACITY_BRANDING == BRAND_THINKLABS)
         case ID_LOOP_PLAY_BUTTON:
            mLoopPlay = MakeButton((char const **) Loop,
                                    (char const **) LoopDisabled,
                                    (char const **) LoopAlpha, ID_LOOP_PLAY_BUTTON,
                                    false);
            break;
      //#elif (AUDACITY_BRANDING == BRAND_AUDIOTOUCH) 
      //   case ID_LOCK_BUTTON:
      //      mLock = MakeButton((char const **) Lock, 
      //                           (char const **) LockDisabled, 
      //                           (char const **) LockAlpha, ID_LOCK_BUTTON, 
      //                           true); // processDownEvents
      //      //v alt images for unlocked? Currently just making it toggle up/down with processDownEvents.
      //      break;
      #endif

      case ID_RECORD_BUTTON:
         if (mErgonomicTransportButtons)
            mButtonPos += 10; // space before record button
         
         mRecord = MakeButton((char const **) Record,
                              (char const **) RecordDisabled,
                              (char const **) RecordAlpha, ID_RECORD_BUTTON,
                              false);
         break;
      
      #if (AUDACITY_BRANDING == BRAND_AUDIOTOUCH) 
         // Audacity_Audiotouch swaps colors for Pause and Stop. 
         case ID_PAUSE_BUTTON:
            mPause = MakeButton((char const **)Pause_yellow,
                              (char const **) PauseDisabled_yellow,
                              (char const **) PauseAlpha, ID_PAUSE_BUTTON,
                              true);
            break;
         
         case ID_STOP_BUTTON:
            mStop = MakeButton((char const **) Stop_blue,
                              (char const **) StopDisabled_blue,
                              (char const **) StopAlpha, ID_STOP_BUTTON,
                              false);
            break;
      #else
         case ID_PAUSE_BUTTON:
            mPause = MakeButton((char const **)Pause,
                              (char const **) PauseDisabled,
                              (char const **) PauseAlpha, ID_PAUSE_BUTTON,
                              true);
            break;
         
         case ID_STOP_BUTTON:
            mStop = MakeButton((char const **) Stop,
                              (char const **) StopDisabled,
                              (char const **) StopAlpha, ID_STOP_BUTTON,
                              false);
            break;
      #endif
      
      case ID_FF_BUTTON:
         mFF = MakeButton((char const **) FFwd,
                          (char const **) FFwdDisabled,
                          (char const **) FFwdAlpha, ID_FF_BUTTON,
                          false);
         break;
      
      default:
         wxASSERT(false); // unknown button id
      }
   }

   #if wxUSE_TOOLTIPS
         mRewind->SetToolTip(_("Skip to Start"));
         mPlay->SetToolTip(_("Play (Shift for loop-play)"));
         #if (AUDACITY_BRANDING == BRAND_THINKLABS)
            mLoopPlay->SetToolTip(_("Loop Play"));
         //#elif (AUDACITY_BRANDING == BRAND_AUDIOTOUCH) 
         //   mLock->SetToolTip(_("Lock/Unlock Recording"));
         #endif
         mRecord->SetToolTip(_("Record"));
         mPause->SetToolTip(_("Pause"));
         mStop->SetToolTip(_("Stop"));
         mFF->SetToolTip(_("Skip to End"));
   #endif

#ifndef __WXMAC__
   delete upPattern;
   delete downPattern;
   delete hilitePattern;
#endif

   delete upOriginal;
   delete downOriginal;
   delete hiliteOriginal;

   /* Tools */

   #if (AUDACITY_BRANDING == BRAND_THINKLABS)
      // no tools for Thinklabs
      for (unsigned int i = 0; i < numTools; i++)
         mTool[i] = NULL;
   #else
      #ifdef __WXMAC__ // different positioning
         mTool[selectTool] = MakeTool(IBeam, IBeamAlpha, ID_SELECT, 0, 0);
         mTool[zoomTool] = MakeTool(Zoom, ZoomAlpha, ID_ZOOM, 0, 26);
         mTool[envelopeTool] = MakeTool(Envelope, EnvelopeAlpha, ID_ENVELOPE, 26, 0);
         mTool[slideTool] = MakeTool(TimeShift, TimeShiftAlpha, ID_SLIDE, 26, 26);
         mTool[drawTool]  = MakeTool(Draw, DrawAlpha, ID_DRAW, 52, 0);
         mTool[multiTool] = MakeTool(Multi, MultiAlpha, ID_MULTI, 52, 26); 
      #else
         mTool[selectTool] = MakeTool(IBeam, IBeamAlpha, ID_SELECT, 0, 0);
         mTool[zoomTool] = MakeTool(Zoom, ZoomAlpha, ID_ZOOM, 0, 28);
         mTool[envelopeTool] = MakeTool(Envelope, EnvelopeAlpha, ID_ENVELOPE, 27, 0);
         mTool[slideTool] = MakeTool(TimeShift, TimeShiftAlpha, ID_SLIDE, 27, 28);
         mTool[drawTool]  = MakeTool(Draw, DrawAlpha, ID_DRAW, 54, 0);
         mTool[multiTool] = MakeTool(Multi, MultiAlpha, ID_MULTI, 54, 28); 
      #endif
   #endif

#if wxUSE_TOOLTIPS
#ifdef __WXMAC__
   wxToolTip::Enable(false);    // DM: tooltips are broken in wxMac
#else
// MB: Should make this a pref
   wxToolTip::Enable(true);     
   wxToolTip::SetDelay(1000);
#endif
#endif

   RegenerateToolsTooltips();
}