Audacity  2.2.2
Classes | Enumerations | Functions | Variables
Project.cpp File Reference

Implements AudacityProject, DropTarget, and FileObject.F Includes Menus.cpp. More...

#include "Audacity.h"
#include "Project.h"
#include <stdio.h>
#include <iostream>
#include <wx/wxprec.h>
#include <wx/apptrait.h>
#include <wx/defs.h>
#include <wx/app.h>
#include <wx/dc.h>
#include <wx/dcmemory.h>
#include <wx/dnd.h>
#include <wx/docview.h>
#include <wx/event.h>
#include <wx/ffile.h>
#include <wx/filedlg.h>
#include <wx/filefn.h>
#include <wx/filename.h>
#include <wx/intl.h>
#include <wx/log.h>
#include <wx/menu.h>
#include <wx/notebook.h>
#include <wx/progdlg.h>
#include <wx/scrolbar.h>
#include <wx/sizer.h>
#include <wx/statusbr.h>
#include <wx/string.h>
#include <wx/textfile.h>
#include <wx/timer.h>
#include <wx/display.h>
#include "AudacityException.h"
#include "FreqWindow.h"
#include "effects/Contrast.h"
#include "AutoRecovery.h"
#include "AudacityApp.h"
#include "AColor.h"
#include "AudioIO.h"
#include "Dependencies.h"
#include "Diags.h"
#include "HistoryWindow.h"
#include "Lyrics.h"
#include "LyricsWindow.h"
#include "MixerBoard.h"
#include "Internat.h"
#include "import/Import.h"
#include "LabelTrack.h"
#include "Legacy.h"
#include "Mix.h"
#include "NoteTrack.h"
#include "Prefs.h"
#include "Sequence.h"
#include "Snap.h"
#include "Tags.h"
#include "TimeTrack.h"
#include "TrackPanel.h"
#include "WaveTrack.h"
#include "DirManager.h"
#include "effects/Effect.h"
#include "prefs/PrefsDialog.h"
#include "widgets/LinkingHtmlWindow.h"
#include "widgets/ASlider.h"
#include "widgets/ErrorDialog.h"
#include "widgets/Ruler.h"
#include "widgets/Warning.h"
#include "xml/XMLFileReader.h"
#include "PlatformCompatibility.h"
#include "Experimental.h"
#include "export/Export.h"
#include "FileNames.h"
#include "BlockFile.h"
#include "ondemand/ODManager.h"
#include "ondemand/ODTask.h"
#include "ondemand/ODComputeSummaryTask.h"
#include "ModuleManager.h"
#include "Theme.h"
#include "AllThemeResources.h"
#include "FileDialog.h"
#include "UndoManager.h"
#include "toolbars/ToolManager.h"
#include "toolbars/ControlToolBar.h"
#include "toolbars/DeviceToolBar.h"
#include "toolbars/EditToolBar.h"
#include "toolbars/MeterToolBar.h"
#include "toolbars/MixerToolBar.h"
#include "toolbars/ScrubbingToolBar.h"
#include "toolbars/SelectionBar.h"
#include "toolbars/SpectralSelectionBar.h"
#include "toolbars/ToolsToolBar.h"
#include "toolbars/TranscriptionToolBar.h"
#include "tracks/ui/BackgroundCell.h"
#include "tracks/ui/EditCursorOverlay.h"
#include "tracks/ui/PlayIndicatorOverlay.h"
#include "tracks/ui/Scrubbing.h"
#include "commands/ScriptCommandRelay.h"
#include "commands/CommandTargets.h"
#include "commands/Command.h"
#include "commands/CommandType.h"
#include "commands/CommandContext.h"
#include "prefs/QualityPrefs.h"
#include "../images/AudacityLogoAlpha.xpm"

Go to the source code of this file.

Classes

class  VarSetter< T >
 
class  ScrollBar
 
class  TitleRestorer
 

Enumerations

enum  { FirstID = 1000, HSBarID, VSBarID, TrackPanelID }
 

Functions

 DEFINE_EVENT_TYPE (EVT_CAPTURE_KEY)
 Custom events. More...
 
static void SetActiveProject (AudacityProject *project)
 
AUDACITY_DLL_API AudacityProjectGetActiveProject ()
 
AudacityProjectCreateNewAudacityProject ()
 
void RedrawAllProjects ()
 
void RefreshCursorForAllProjects ()
 
AUDACITY_DLL_API void CloseAllProjects ()
 
void GetDefaultWindowRect (wxRect *defRect)
 
bool IsWindowAccessible (wxRect *requestedRect)
 
int ScreenContaining (wxRect &r)
 
bool CornersOnScreen (wxRect &r)
 
void GetNextWindowPlacement (wxRect *nextRect, bool *pMaximized, bool *pIconized)
 
static wxString CreateUniqueName ()
 
static wxString gsLegacyFileWarning ()
 

Variables

const int sbarSpaceWidth = 15
 
const int sbarControlWidth = 15
 
const int sbarExtraLen = 0
 
const int sbarHjump = 30
 
static int gAudacityOffsetInc = 0
 
static int gAudacityPosInc = 0
 
static AudacityProjectgActiveProject
 
AProjectArray gAudacityProjects
 

Detailed Description

Implements AudacityProject, DropTarget, and FileObject.F Includes Menus.cpp.

Definition in file Project.cpp.

Enumeration Type Documentation

anonymous enum
Enumerator
FirstID 
HSBarID 
VSBarID 
TrackPanelID 

Definition at line 887 of file Project.cpp.

887  {
888  FirstID = 1000,
889 
890  // Window controls
891 
892  HSBarID,
893  VSBarID,
895 };

Function Documentation

AUDACITY_DLL_API void CloseAllProjects ( )

Definition at line 611 of file Project.cpp.

References gAudacityOffsetInc, gAudacityPosInc, and gAudacityProjects.

612 {
613  size_t len = gAudacityProjects.size();
614  for (size_t i = 0; i < len; i++)
615  gAudacityProjects[i]->Close();
616 
617  //Set the Offset and Position increments to 0
618  gAudacityOffsetInc = 0;
619  gAudacityPosInc = 0;
620 }
static int gAudacityOffsetInc
Definition: Project.cpp:298
AProjectArray gAudacityProjects
Definition: Project.cpp:303
static int gAudacityPosInc
Definition: Project.cpp:299
bool CornersOnScreen ( wxRect &  r)

Definition at line 708 of file Project.cpp.

Referenced by GetNextWindowPlacement().

708  {
709  if( wxDisplay::GetFromPoint( r.GetTopLeft() ) == wxNOT_FOUND) return false;
710  if( wxDisplay::GetFromPoint( r.GetBottomRight() ) == wxNOT_FOUND) return false;
711  return true;
712 }
AudacityProject* CreateNewAudacityProject ( )

Definition at line 549 of file Project.cpp.

References ModuleManager::Dispatch(), gAudacityProjects, gAudioIO, ModuleManager::Get(), GetNextWindowPlacement(), ProjectInitialized, safenew, SetActiveProject(), and AudioIO::SetListener().

Referenced by AudacityProject::OnCloseWindow(), AudacityApp::OnInit(), AudacityApp::OnMenuNew(), AudacityProject::OnNew(), and AudacityProject::OpenProject().

550 {
551  wxRect wndRect;
552  bool bMaximized = false;
553  bool bIconized = false;
554  GetNextWindowPlacement(&wndRect, &bMaximized, &bIconized);
555 
556  // Create and show a NEW project
557  // Use a non-default deleter in the smart pointer!
558  gAudacityProjects.push_back( AProjectHolder {
560  nullptr, -1,
561  wxDefaultPosition,
562  wxSize(wndRect.width, wndRect.height)
563  ),
565  } );
566  const auto p = gAudacityProjects.back().get();
567 
568  // wxGTK3 seems to need to require creating the window using default position
569  // and then manually positioning it.
570  p->SetPosition(wndRect.GetPosition());
571 
572  if(bMaximized) {
573  p->Maximize(true);
574  }
575  else if (bIconized) {
576  // if the user close down and iconized state we could start back up and iconized state
577  // p->Iconize(TRUE);
578  }
579 
580  //Initialise the Listener
581  gAudioIO->SetListener(p);
582 
583  //Set the NEW project as active:
584  SetActiveProject(p);
585 
586  // Okay, GetActiveProject() is ready. Now we can get its CommandManager,
587  // and add the shortcut keys to the tooltips.
588  p->GetToolManager()->RegenerateTooltips();
589 
591 
592  p->Show(true);
593 
594  return p;
595 }
void GetNextWindowPlacement(wxRect *nextRect, bool *pMaximized, bool *pIconized)
Definition: Project.cpp:718
static ModuleManager & Get()
AProjectArray gAudacityProjects
Definition: Project.cpp:303
std::shared_ptr< AudacityProject > AProjectHolder
Definition: Project.h:119
#define safenew
Definition: Audacity.h:230
int Dispatch(ModuleDispatchTypes type)
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
AudioIO * gAudioIO
Definition: AudioIO.cpp:482
void SetListener(AudioIOListener *listener)
Definition: AudioIO.cpp:4167
static void SetActiveProject(AudacityProject *project)
Definition: Project.cpp:313
static wxString CreateUniqueName ( )
static

Definition at line 880 of file Project.cpp.

Referenced by AudacityProject::AutoSave().

881 {
882  static int count = 0;
883  return wxDateTime::Now().Format(wxT("%Y-%m-%d %H-%M-%S")) +
884  wxString::Format(wxT(" N-%i"), ++count);
885 }
DEFINE_EVENT_TYPE ( EVT_CAPTURE_KEY  )

Custom events.

AUDACITY_DLL_API AudacityProject* GetActiveProject ( )

Definition at line 308 of file Project.cpp.

References gActiveProject.

Referenced by LongMessageDialog::AcceptText(), AudacityCommand::Apply(), Effect::Apply(), MacroCommands::ApplyCommand(), MacroCommands::ApplyCommandInBatchMode(), MacroCommands::ApplyEffectCommand(), MacroCommands::ApplyMacro(), MacroCommands::ApplySpecialCommand(), audacityAudioCallback(), TrackSelectHandle::CalculateRearrangingThresholds(), ControlToolBar::CancelRecording(), ControlToolBar::CanStopAudioStream(), AudacityProject::CaptureKeyboard(), LabelTrack::Char(), TimeTrack::Clear(), WaveformPrefs::Commit(), KeyConfigPrefs::Commit(), ControlToolBar::CommitRecording(), ContrastDialog::ContrastDialog(), LabelTrack::DoCaptureKey(), ControlToolBar::DoRecord(), Effect::Effect(), EffectUIHost::EffectUIHost(), DeviceToolBar::EnableDisableButtons(), ScrubbingToolBar::EnableDisableButtons(), TranscriptionToolBar::EnableDisableButtons(), ControlToolBar::EnableDisableButtons(), ExecCommand(), TimerRecordDialog::ExecutePostRecordActions(), CommandManagerEventMonitor::FilterEvent(), CommandManager::FilterKeyEvent(), EditToolBar::ForAllButtons(), FreqWindow::FreqWindow(), TrackInfo::GainSlider(), CommandManager::GetCategories(), ContrastDialog::GetDB(), MacroCommands::GetEndTime(), AudacityProject::GetKeyboardCaptureHandler(), CommandContext::GetProject(), TranscriptionToolBar::GetSamples(), Effect::GetSelectionFormat(), CommandManager::HandleCommandEntry(), CommandManager::HandleMenuID(), AudacityProject::HandlePasteNothingSelected(), CommandManager::HandleTextualCommand(), IdleHandler(), Importer::Import(), EffectScienFilter::Init(), NyquistEffect::Init(), EffectEqualization::Init(), TrackMenuTable::InitMenu(), WaveColorMenuTable::InitMenu(), FormatMenuTable::InitMenu(), RateMenuTable::InitMenu(), WaveTrackMenuTable::InitMenu(), MacroCommands::IsMono(), Track::IsSyncLockSelected(), LabelTrack::KeyDown(), AudacityApp::MRUOpen(), ApplyMacroDialog::OnApplyToFiles(), TimerRecordDialog::OnAutoExportPathButton_Click(), TimerRecordDialog::OnAutoSavePathButton_Click(), ScrubbingToolBar::OnButton(), EditToolBar::OnButton(), WaveTrackMenuTable::OnChannelChange(), LabelTrack::OnChar(), LabelTrack::OnContextMenu(), AudacityApp::OnExceptionInMainLoop(), ContrastDialog::OnExport(), ControlToolBar::OnFF(), FormatMenuTable::OnFormatChange(), ContrastDialog::OnGetBackground(), ContrastDialog::OnGetForeground(), AudacityApp::OnKeyDown(), LabelTrack::OnKeyDown(), ControlToolBar::OnKeyEvent(), LyricsPanel::OnKeyEvent(), MixerBoardFrame::OnKeyEvent(), WaveTrackMenuTable::OnMergeStereo(), MeterPanel::OnMouse(), HighlightTextCtrl::OnMouseEvent(), AButton::OnMouseEvent(), LWSlider::OnMouseEvent(), TrackMenuTable::OnMoveTrack(), TimerRecordDialog::OnOK(), ControlToolBar::OnPause(), ControlToolBar::OnPlay(), MeterPanel::OnPreferences(), CommandHandler::OnReceiveCommand(), ControlToolBar::OnRecord(), ControlToolBar::OnRewind(), LabelDialog::OnSelectCell(), WaveTrackMenuTable::OnSetDisplay(), TrackMenuTable::OnSetName(), TimeTrackMenuTable::OnSetTimeTrackRange(), MultiDialog::OnShowLog(), WaveTrackMenuTable::OnSpectrogramSettings(), SpectrumVRulerMenuTable::OnSpectrumScaleType(), WaveTrackMenuTable::OnSplitStereo(), WaveTrackMenuTable::OnSplitStereoMono(), ControlToolBar::OnStop(), WaveTrackMenuTable::OnSwapChannels(), AudacityApp::OnTimer(), TimeTrackMenuTable::OnTimeTrackLin(), TimeTrackMenuTable::OnTimeTrackLog(), TimeTrackMenuTable::OnTimeTrackLogInt(), AudacityProject::OnTogglePinnedHead(), ScreenFrame::OnUIUpdate(), WaveColorMenuTable::OnWaveColorChange(), WaveformVRulerMenuTable::OnWaveformScaleType(), WaveTrackVRulerMenuTable::OnZoom(), TrackInfo::PanSlider(), TimeTrack::Paste(), TranscriptionToolBar::PlayAtSpeed(), ControlToolBar::PlayCurrentRegion(), ControlToolBar::PlayPlayRegion(), KeyConfigPrefs::Populate(), EffectToneGen::PopulateOrExchange(), TimerRecordDialog::PopulateOrExchange(), EffectEqualization::PopulateOrExchange(), TrackSelectHandle::Preview(), SpectrumPrefs::Preview(), EffectStereoToMono::Process(), Generator::Process(), NyquistEffect::Process(), EffectTruncSilence::ProcessIndependently(), EffectEqualization::ProcessOne(), Effect::ProcessTrack(), ScrubbingToolBar::RegenerateTooltips(), TrackSelectHandle::Release(), AudacityProject::ReleaseKeyboard(), SpectrumPrefs::Rollback(), TimerRecordDialog::RunWaitDialog(), EffectToneGen::SetAutomationParameters(), ToolBar::SetButtonToolTip(), AudioIO::SetMeters(), CommandImplementation::SetParameter(), ControlToolBar::SetPlay(), RateMenuTable::SetRate(), ContrastDialog::SetStartAndEndTime(), ControlToolBar::SetupCutPreviewTracks(), SelectHandle::SetUseSnap(), ZoomInfo::SetZoom(), HelpSystem::ShowHelp(), SnapManager::Snap(), SnapManager::SnapManager(), ODManager::Start(), MeterPanel::StartMonitoring(), AudioIO::StartPortAudioStream(), ControlToolBar::StartScrolling(), ControlToolBar::StartScrollingIfPreferred(), ControlToolBar::StateForStatusBar(), ControlToolBar::StopPlaying(), ControlToolBar::StopScrolling(), AudioIO::StopStream(), WaveTrack::SyncLockAdjust(), Scrubber::Thunk(), MuteButtonHandle::Tip(), CloseButtonHandle::Tip(), SoloButtonHandle::Tip(), MenuButtonHandle::Tip(), LyricsPanel::Update(), MacrosWindow::UpdateMenus(), AudacityProject::UpdateMenus(), AButton::UpdateStatus(), WaveTrack::WaveTrack(), and MacroCommands::WriteMp3File().

309 {
310  return gActiveProject;
311 }
static AudacityProject * gActiveProject
Definition: Project.cpp:301
void GetDefaultWindowRect ( wxRect *  defRect)

Definition at line 623 of file Project.cpp.

Referenced by GetNextWindowPlacement(), and SaveWindowSize().

624 {
625  *defRect = wxGetClientDisplayRect();
626 
627  int width = 940;
628  int height = 674;
629 
630  //These conditional values assist in improving placement and size
631  //of NEW windows on different platforms.
632 #ifdef __WXGTK__
633  height += 20;
634 #endif
635 
636 #ifdef __WXMSW__
637  height += 40;
638 #endif
639 
640 #ifdef __WXMAC__
641  height += 55;
642 #endif
643 
644  // Use screen size where it is smaller than the values we would like.
645  // Otherwise use the values we would like, and centred.
646  if (width < defRect->width)
647  {
648  defRect->x = (defRect->width - width)/2;
649  defRect->width = width;
650  }
651 
652  if (height < defRect->height)
653  {
654  defRect->y = (defRect->height - height)/2;
655  // Bug 1119 workaround
656  // Small adjustment for very small Mac screens.
657  // If there is only a tiny space at the top
658  // then instead of vertical centre, align to bottom.
659  const int pixelsFormenu = 60;
660  if( defRect->y < pixelsFormenu )
661  defRect->y *=2;
662  defRect->height = height;
663  }
664 }
void GetNextWindowPlacement ( wxRect *  nextRect,
bool *  pMaximized,
bool *  pIconized 
)

Definition at line 718 of file Project.cpp.

References CornersOnScreen(), gAudacityProjects, GetDefaultWindowRect(), gPrefs, IsWindowAccessible(), and ScreenContaining().

Referenced by CreateNewAudacityProject(), and AudacityApp::OnInit().

719 {
720  int inc = 25;
721 
722  wxRect defaultRect;
723  GetDefaultWindowRect(&defaultRect);
724 
725  gPrefs->Read(wxT("/Window/Maximized"), pMaximized, false);
726  gPrefs->Read(wxT("/Window/Iconized"), pIconized, false);
727 
728  wxRect windowRect;
729  gPrefs->Read(wxT("/Window/X"), &windowRect.x, defaultRect.x);
730  gPrefs->Read(wxT("/Window/Y"), &windowRect.y, defaultRect.y);
731  gPrefs->Read(wxT("/Window/Width"), &windowRect.width, defaultRect.width);
732  gPrefs->Read(wxT("/Window/Height"), &windowRect.height, defaultRect.height);
733 
734  wxRect normalRect;
735  gPrefs->Read(wxT("/Window/Normal_X"), &normalRect.x, defaultRect.x);
736  gPrefs->Read(wxT("/Window/Normal_Y"), &normalRect.y, defaultRect.y);
737  gPrefs->Read(wxT("/Window/Normal_Width"), &normalRect.width, defaultRect.width);
738  gPrefs->Read(wxT("/Window/Normal_Height"), &normalRect.height, defaultRect.height);
739 
740  // Workaround 2.1.1 and earlier bug on OSX...affects only normalRect, but let's just
741  // validate for all rects and plats
742  if (normalRect.width == 0 || normalRect.height == 0) {
743  normalRect = defaultRect;
744  }
745  if (windowRect.width == 0 || windowRect.height == 0) {
746  windowRect = defaultRect;
747  }
748 
749 
750  wxRect screenRect( wxGetClientDisplayRect());
751 #if defined(__WXMAC__)
752 
753  // On OSX, the top of the window should never be less than the menu height,
754  // so something is amiss if it is
755  if (normalRect.y < screenRect.y) {
756  normalRect = defaultRect;
757  }
758  if (windowRect.y < screenRect.y) {
759  windowRect = defaultRect;
760  }
761 #endif
762 
763  // IF projects empty, THEN it's the first window.
764  // It lands where the config says it should, and can straddle screen.
765  if (gAudacityProjects.empty()) {
766  if (*pMaximized || *pIconized) {
767  *nextRect = normalRect;
768  }
769  else {
770  *nextRect = windowRect;
771  }
772  // Resize, for example if one monitor that was on is now off.
773  if (!CornersOnScreen( wxRect(*nextRect).Deflate( 32, 32 ))) {
774  *nextRect = defaultRect;
775  }
776  if (!IsWindowAccessible(nextRect)) {
777  *nextRect = defaultRect;
778  }
779  // Do not trim the first project window down.
780  // All corners are on screen (or almost so), and
781  // the rect may straddle screens.
782  return;
783  }
784 
785 
786  // ELSE a subsequent NEW window. It will NOT straddle screens.
787 
788  // We don't mind being 32 pixels off the screen in any direction.
789  // Make sure initial sizes (pretty much) fit within the display bounds
790  // We used to trim the sizes which could result in ridiculously small windows.
791  // contributing to bug 1243.
792  // Now instead if the window significantly doesn't fit the screen, we use the default
793  // window instead, which we know does.
794  if (ScreenContaining( wxRect(normalRect).Deflate( 32, 32 ))<0) {
795  normalRect = defaultRect;
796  }
797  if (ScreenContaining( wxRect(windowRect).Deflate( 32, 32 ) )<0) {
798  windowRect = defaultRect;
799  }
800 
801  bool validWindowSize = false;
802  AudacityProject * validProject = NULL;
803  size_t numProjects = gAudacityProjects.size();
804  for (int i = numProjects; i > 0 ; i--) {
805  if (!gAudacityProjects[i-1]->IsIconized()) {
806  validWindowSize = true;
807  validProject = gAudacityProjects[i-1].get();
808  break;
809  }
810  }
811  if (validWindowSize) {
812  *nextRect = validProject->GetRect();
813  *pMaximized = validProject->IsMaximized();
814  *pIconized = validProject->IsIconized();
815  // Do not straddle screens.
816  if (ScreenContaining( wxRect(*nextRect).Deflate( 32, 32 ) )<0) {
817  *nextRect = defaultRect;
818  }
819  }
820  else {
821  *nextRect = normalRect;
822  }
823 
824  //Placement depends on the increments
825  nextRect->x += inc;
826  nextRect->y += inc;
827 
828  // defaultrect is a rectangle on the first screen. It's the right fallback to
829  // use most of the time if things are not working out right with sizing.
830  // windowRect is a saved rectangle size.
831  // normalRect seems to be a substitute for windowRect when iconized or maximised.
832 
833  // Windows can say that we are off screen when actually we are not.
834  // On Windows 10 I am seeing miscalculation by about 6 pixels.
835  // To fix this we allow some sloppiness on the edge being counted as off screen.
836  // This matters most when restoring very carefully sized windows that are maximised
837  // in one dimension (height or width) but not both.
838  const int edgeSlop = 10;
839 
840  // Next four lines are getting the rectangle for the screen that contains the
841  // top left corner of nextRect (and defaulting to rect of screen 0 otherwise).
842  wxPoint p = nextRect->GetLeftTop();
843  int scr = std::max( 0, wxDisplay::GetFromPoint( p ));
844  wxDisplay d( scr );
845  screenRect = d.GetClientArea();
846 
847  // Now we (possibly) start trimming our rectangle down.
848  // Have we hit the right side of the screen?
849  wxPoint bottomRight = nextRect->GetBottomRight();
850  if (bottomRight.x > (screenRect.GetRight()+edgeSlop)) {
851  int newWidth = screenRect.GetWidth() - nextRect->GetLeft();
852  if (newWidth < defaultRect.GetWidth()) {
853  nextRect->x = windowRect.x;
854  nextRect->y = windowRect.y;
855  nextRect->width = windowRect.width;
856  }
857  else {
858  nextRect->width = newWidth;
859  }
860  }
861 
862  // Have we hit the bottom of the screen?
863  bottomRight = nextRect->GetBottomRight();
864  if (bottomRight.y > (screenRect.GetBottom()+edgeSlop)) {
865  nextRect->y -= inc;
866  bottomRight = nextRect->GetBottomRight();
867  if (bottomRight.y > (screenRect.GetBottom()+edgeSlop)) {
868  nextRect->SetBottom(screenRect.GetBottom());
869  }
870  }
871 
872  // After all that we could have a window that does not have a visible
873  // top bar. [It is unlikely, but something might have gone wrong]
874  // If so, use the safe fallback size.
875  if (!IsWindowAccessible(nextRect)) {
876  *nextRect = defaultRect;
877  }
878 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
AProjectArray gAudacityProjects
Definition: Project.cpp:303
int ScreenContaining(wxRect &r)
Definition: Project.cpp:693
bool IsWindowAccessible(wxRect *requestedRect)
Definition: Project.cpp:667
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
bool CornersOnScreen(wxRect &r)
Definition: Project.cpp:708
void GetDefaultWindowRect(wxRect *defRect)
Definition: Project.cpp:623
static wxString gsLegacyFileWarning ( )
static

Definition at line 2943 of file Project.cpp.

References _().

Referenced by AudacityProject::HandleXMLTag(), and AudacityProject::WarnOfLegacyFile().

2943  { return
2944 _("This file was saved by Audacity version %s. The format has changed. \
2945 \n\nAudacity can try to open and save this file, but saving it in this \
2946 \nversion will then prevent any 1.2 or earlier version opening it. \
2947 \n\nAudacity might corrupt the file in opening it, so you should \
2948 back it up first. \
2949 \n\nOpen this file now?");
2950 }
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
bool IsWindowAccessible ( wxRect *  requestedRect)

Definition at line 667 of file Project.cpp.

References monitor.

Referenced by GetNextWindowPlacement().

668 {
669  wxDisplay display;
670  wxRect targetTitleRect(requestedRect->GetLeftTop(), requestedRect->GetBottomRight());
671  // Hackery to approximate a window top bar size from a window size.
672  // and exclude the open/close and borders.
673  targetTitleRect.x += 15;
674  targetTitleRect.width -= 100;
675  if (targetTitleRect.width < 165) targetTitleRect.width = 165;
676  targetTitleRect.height = 15;
677  int targetBottom = targetTitleRect.GetBottom();
678  int targetRight = targetTitleRect.GetRight();
679  // This looks like overkill to check each and every pixel in the ranges.
680  // and decide that if any is visible on screen we are OK.
681  for (int i = targetTitleRect.GetLeft(); i < targetRight; i++) {
682  for (int j = targetTitleRect.GetTop(); j < targetBottom; j++) {
683  int monitor = display.GetFromPoint(wxPoint(i, j));
684  if (monitor != wxNOT_FOUND) {
685  return TRUE;
686  }
687  }
688  }
689  return FALSE;
690 }
CommandManagerEventMonitor monitor
void RedrawAllProjects ( )

Definition at line 597 of file Project.cpp.

References gAudacityProjects.

Referenced by ToolsToolBar::OnTool().

598 {
599  size_t len = gAudacityProjects.size();
600  for (size_t i = 0; i < len; i++)
601  gAudacityProjects[i]->RedrawProject();
602 }
AProjectArray gAudacityProjects
Definition: Project.cpp:303
void RefreshCursorForAllProjects ( )

Definition at line 604 of file Project.cpp.

References gAudacityProjects.

Referenced by ToolsToolBar::SetCurrentTool().

605 {
606  size_t len = gAudacityProjects.size();
607  for (size_t i = 0; i < len; i++)
608  gAudacityProjects[i]->RefreshCursor();
609 }
AProjectArray gAudacityProjects
Definition: Project.cpp:303
int ScreenContaining ( wxRect &  r)

Definition at line 693 of file Project.cpp.

Referenced by GetNextWindowPlacement().

693  {
694  unsigned int n = wxDisplay::GetCount();
695  for(unsigned int i = 0;i<n;i++){
696  wxDisplay d(i);
697  wxRect scr = d.GetClientArea();
698  if( scr.Contains( r ) )
699  return (int)i;
700  }
701  return -1;
702 }
void SetActiveProject ( AudacityProject project)
static

Definition at line 313 of file Project.cpp.

References gActiveProject.

Referenced by CreateNewAudacityProject(), AudacityProject::OnActivate(), AudacityProject::OnCloseWindow(), and AudacityProject::OnMouseEvent().

314 {
315  gActiveProject = project;
316  wxTheApp->SetTopWindow(project);
317 }
static AudacityProject * gActiveProject
Definition: Project.cpp:301

Variable Documentation

AudacityProject* gActiveProject
static

Definition at line 301 of file Project.cpp.

Referenced by GetActiveProject(), AudacityProject::OnCloseWindow(), and SetActiveProject().

int gAudacityOffsetInc = 0
static

Definition at line 298 of file Project.cpp.

Referenced by CloseAllProjects().

int gAudacityPosInc = 0
static

Definition at line 299 of file Project.cpp.

Referenced by CloseAllProjects().

AProjectArray gAudacityProjects
const int sbarControlWidth = 15

Definition at line 201 of file Project.cpp.

const int sbarExtraLen = 0

Definition at line 202 of file Project.cpp.

const int sbarHjump = 30
const int sbarSpaceWidth = 15

Definition at line 200 of file Project.cpp.