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 "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 Includes Menus.cpp.

Definition in file Project.cpp.

Enumeration Type Documentation

anonymous enum
Enumerator
FirstID 
HSBarID 
VSBarID 
TrackPanelID 

Definition at line 888 of file Project.cpp.

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

Function Documentation

AUDACITY_DLL_API void CloseAllProjects ( )

Definition at line 612 of file Project.cpp.

References gAudacityOffsetInc, gAudacityPosInc, and gAudacityProjects.

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

Definition at line 709 of file Project.cpp.

Referenced by GetNextWindowPlacement().

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

Definition at line 550 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().

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

Definition at line 881 of file Project.cpp.

Referenced by AudacityProject::AutoSave().

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

Custom events.

AUDACITY_DLL_API AudacityProject* GetActiveProject ( )

Definition at line 309 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(), ExecCommand2(), 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(), 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(), 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(), 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(), 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().

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

Definition at line 624 of file Project.cpp.

Referenced by GetNextWindowPlacement(), and SaveWindowSize().

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

Definition at line 719 of file Project.cpp.

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

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

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

Definition at line 2946 of file Project.cpp.

References _().

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

2946  { return
2947 _("This file was saved by Audacity version %s. The format has changed. \
2948 \n\nAudacity can try to open and save this file, but saving it in this \
2949 \nversion will then prevent any 1.2 or earlier version opening it. \
2950 \n\nAudacity might corrupt the file in opening it, so you should \
2951 back it up first. \
2952 \n\nOpen this file now?");
2953 }
_("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 668 of file Project.cpp.

References monitor.

Referenced by GetNextWindowPlacement().

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

Definition at line 598 of file Project.cpp.

References gAudacityProjects.

Referenced by ToolsToolBar::OnTool().

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

Definition at line 605 of file Project.cpp.

References gAudacityProjects.

Referenced by ToolsToolBar::SetCurrentTool().

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

Definition at line 694 of file Project.cpp.

Referenced by GetNextWindowPlacement().

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

Definition at line 314 of file Project.cpp.

References gActiveProject.

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

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

Variable Documentation

AudacityProject* gActiveProject
static

Definition at line 302 of file Project.cpp.

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

int gAudacityOffsetInc = 0
static

Definition at line 299 of file Project.cpp.

Referenced by CloseAllProjects().

int gAudacityPosInc = 0
static

Definition at line 300 of file Project.cpp.

Referenced by CloseAllProjects().

AProjectArray gAudacityProjects
const int sbarControlWidth = 15

Definition at line 202 of file Project.cpp.

const int sbarExtraLen = 0

Definition at line 203 of file Project.cpp.

const int sbarHjump = 30
const int sbarSpaceWidth = 15

Definition at line 201 of file Project.cpp.