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

Implements AudacityProject, DropTarget, and FileObject.F. 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 "BatchProcessDialog.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 "Menus.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 "commands/CommandManager.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 "prefs/TracksPrefs.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.

Definition in file Project.cpp.

Enumeration Type Documentation

anonymous enum
Enumerator
FirstID 
HSBarID 
VSBarID 
TrackPanelID 

Definition at line 891 of file Project.cpp.

891  {
892  FirstID = 1000,
893 
894  // Window controls
895 
896  HSBarID,
897  VSBarID,
899 };

Function Documentation

AUDACITY_DLL_API void CloseAllProjects ( )

Definition at line 615 of file Project.cpp.

References gAudacityOffsetInc, gAudacityPosInc, and gAudacityProjects.

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

Definition at line 712 of file Project.cpp.

Referenced by GetNextWindowPlacement().

712  {
713  if( wxDisplay::GetFromPoint( r.GetTopLeft() ) == wxNOT_FOUND) return false;
714  if( wxDisplay::GetFromPoint( r.GetBottomRight() ) == wxNOT_FOUND) return false;
715  return true;
716 }
AudacityProject* CreateNewAudacityProject ( )

Definition at line 553 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(), MenuCommandHandler::OnNew(), and AudacityProject::OpenProject().

554 {
555  wxRect wndRect;
556  bool bMaximized = false;
557  bool bIconized = false;
558  GetNextWindowPlacement(&wndRect, &bMaximized, &bIconized);
559 
560  // Create and show a NEW project
561  // Use a non-default deleter in the smart pointer!
562  gAudacityProjects.push_back( AProjectHolder {
564  nullptr, -1,
565  wxDefaultPosition,
566  wxSize(wndRect.width, wndRect.height)
567  ),
569  } );
570  const auto p = gAudacityProjects.back().get();
571 
572  // wxGTK3 seems to need to require creating the window using default position
573  // and then manually positioning it.
574  p->SetPosition(wndRect.GetPosition());
575 
576  if(bMaximized) {
577  p->Maximize(true);
578  }
579  else if (bIconized) {
580  // if the user close down and iconized state we could start back up and iconized state
581  // p->Iconize(TRUE);
582  }
583 
584  //Initialise the Listener
585  gAudioIO->SetListener(p);
586 
587  //Set the NEW project as active:
588  SetActiveProject(p);
589 
590  // Okay, GetActiveProject() is ready. Now we can get its CommandManager,
591  // and add the shortcut keys to the tooltips.
592  p->GetToolManager()->RegenerateTooltips();
593 
595 
596  p->Show(true);
597 
598  return p;
599 }
void GetNextWindowPlacement(wxRect *nextRect, bool *pMaximized, bool *pIconized)
Definition: Project.cpp:722
static ModuleManager & Get()
AProjectArray gAudacityProjects
Definition: Project.cpp:307
std::shared_ptr< AudacityProject > AProjectHolder
Definition: Project.h:118
#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:175
AudioIO * gAudioIO
Definition: AudioIO.cpp:492
void SetListener(AudioIOListener *listener)
Definition: AudioIO.cpp:4139
static void SetActiveProject(AudacityProject *project)
Definition: Project.cpp:317
static wxString CreateUniqueName ( )
static

Definition at line 884 of file Project.cpp.

Referenced by AudacityProject::AutoSave().

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

Custom events.

AUDACITY_DLL_API AudacityProject* GetActiveProject ( )

Definition at line 312 of file Project.cpp.

References gActiveProject.

Referenced by LongMessageDialog::AcceptText(), AudacityCommand::Apply(), Effect::Apply(), MacroCommands::ApplyCommand(), MacroCommands::ApplyCommandInBatchMode(), MacroCommands::ApplyEffectCommand(), MacroCommands::ApplyMacro(), MacroCommands::ApplySpecialCommand(), 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(), MenuCommandHandler::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(), ControlToolBar::IsTransportingPinned(), LabelTrack::KeyDown(), AudacityApp::MRUOpen(), ApplyMacroDialog::OnApplyToFiles(), TimerRecordDialog::OnAutoExportPathButton_Click(), TimerRecordDialog::OnAutoSavePathButton_Click(), ScrubbingToolBar::OnButton(), EditToolBar::OnButton(), LabelTrack::OnChar(), LabelTrack::OnContextMenu(), AudacityApp::OnExceptionInMainLoop(), ContrastDialog::OnExport(), ControlToolBar::OnFF(), FormatMenuTable::OnFormatChange(), ContrastDialog::OnGetBackground(), ContrastDialog::OnGetForeground(), Exporter::OnHelp(), 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(), MenuCommandHandler::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(), Generator::Process(), NyquistEffect::Process(), EffectTruncSilence::ProcessIndependently(), EffectStereoToMono::ProcessOne(), EffectEqualization::ProcessOne(), Effect::ProcessTrack(), ScrubbingToolBar::RegenerateTooltips(), TrackSelectHandle::Release(), AudacityProject::ReleaseKeyboard(), SpectrumPrefs::Rollback(), TimerRecordDialog::RunWaitDialog(), EffectToneGen::SetAutomationParameters(), ToolBar::SetButtonToolTip(), CommandImplementation::SetParameter(), ControlToolBar::SetPlay(), RateMenuTable::SetRate(), ContrastDialog::SetStartAndEndTime(), ControlToolBar::SetupCutPreviewTracks(), SelectHandle::SetUseSnap(), ZoomInfo::SetZoom(), HelpSystem::ShowHelp(), SnapManager::Snap(), SnapManager::SnapManager(), WaveTrackMenuTable::SplitStereo(), ODManager::Start(), MeterPanel::StartMonitoring(), AudioIO::StartPortAudioStream(), ControlToolBar::StartScrolling(), ControlToolBar::StartScrollingIfPreferred(), ControlToolBar::StateForStatusBar(), ControlToolBar::StopPlaying(), ControlToolBar::StopScrolling(), WaveTrack::SyncLockAdjust(), Scrubber::Thunk(), MuteButtonHandle::Tip(), CloseButtonHandle::Tip(), SoloButtonHandle::Tip(), MenuButtonHandle::Tip(), LyricsPanel::Update(), MacrosWindow::UpdateMenus(), MenuManager::UpdateMenus(), AButton::UpdateStatus(), WaveTrack::WaveTrack(), and MacroCommands::WriteMp3File().

313 {
314  return gActiveProject;
315 }
static AudacityProject * gActiveProject
Definition: Project.cpp:305
void GetDefaultWindowRect ( wxRect *  defRect)

Definition at line 627 of file Project.cpp.

Referenced by GetNextWindowPlacement(), and SaveWindowSize().

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

Definition at line 722 of file Project.cpp.

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

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

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

Definition at line 2922 of file Project.cpp.

References _().

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

2922  { return
2923 _("This file was saved by Audacity version %s. The format has changed. \
2924 \n\nAudacity can try to open and save this file, but saving it in this \
2925 \nversion will then prevent any 1.2 or earlier version opening it. \
2926 \n\nAudacity might corrupt the file in opening it, so you should \
2927 back it up first. \
2928 \n\nOpen this file now?");
2929 }
_("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 671 of file Project.cpp.

References monitor.

Referenced by GetNextWindowPlacement().

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

Definition at line 601 of file Project.cpp.

References gAudacityProjects.

Referenced by ToolsToolBar::OnTool().

602 {
603  size_t len = gAudacityProjects.size();
604  for (size_t i = 0; i < len; i++)
605  gAudacityProjects[i]->RedrawProject();
606 }
AProjectArray gAudacityProjects
Definition: Project.cpp:307
void RefreshCursorForAllProjects ( )

Definition at line 608 of file Project.cpp.

References gAudacityProjects.

Referenced by ToolsToolBar::SetCurrentTool().

609 {
610  size_t len = gAudacityProjects.size();
611  for (size_t i = 0; i < len; i++)
612  gAudacityProjects[i]->RefreshCursor();
613 }
AProjectArray gAudacityProjects
Definition: Project.cpp:307
int ScreenContaining ( wxRect &  r)

Definition at line 697 of file Project.cpp.

Referenced by GetNextWindowPlacement().

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

Definition at line 317 of file Project.cpp.

References gActiveProject.

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

318 {
319  gActiveProject = project;
320  wxTheApp->SetTopWindow(project);
321 }
static AudacityProject * gActiveProject
Definition: Project.cpp:305

Variable Documentation

AudacityProject* gActiveProject
static

Definition at line 305 of file Project.cpp.

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

int gAudacityOffsetInc = 0
static

Definition at line 302 of file Project.cpp.

Referenced by CloseAllProjects().

int gAudacityPosInc = 0
static

Definition at line 303 of file Project.cpp.

Referenced by CloseAllProjects().

AProjectArray gAudacityProjects
const int sbarControlWidth = 15

Definition at line 205 of file Project.cpp.

const int sbarExtraLen = 0

Definition at line 206 of file Project.cpp.

const int sbarHjump = 30
const int sbarSpaceWidth = 15

Definition at line 204 of file Project.cpp.