コード例 #1
0
ファイル: Effect.cpp プロジェクト: Kirushanr/audacity
bool Effect::DoEffect(wxWindow *parent, int flags,
                      double projectRate,
                      TrackList *list,
                      TrackFactory *factory,
                      double *t0, double *t1)
{
   wxASSERT(*t0 <= *t1);

   if (mWaveTracks) {
      delete mWaveTracks;
      mWaveTracks = NULL;
   }

   mFactory = factory;
   mProjectRate = projectRate;
   mParent = parent;
   mTracks = list;
   mT0 = *t0;
   mT1 = *t1;
   CountWaveTracks();

   if (!Init())
      return false;

   // Don't prompt user if we are dealing with a 
   // effect that is already configured, e.g. repeating
   // the last effect on a different selection.
   if( (flags & CONFIGURED_EFFECT) == 0)
   {
      if (!PromptUser())
         return false;
   }
   wxBusyCursor busy;
   wxYield();
   wxStartTimer();

   bool returnVal = true;
   bool skipFlag = CheckWhetherSkipEffect();
   if (skipFlag == false) {
      returnVal = Process();
   }
   End();
   
   if (mProgress) {
      delete mProgress;
      mProgress = NULL;
   }
   
   delete mWaveTracks;
   mWaveTracks = NULL;

   if (returnVal) {
      *t0 = mT0;
      *t1 = mT1;
   }
   
   return returnVal;
}
コード例 #2
0
ファイル: svctlcui.cpp プロジェクト: zukisoft/external
const INT_PTR ConsoleUI::Message(UINT uType, LPCTSTR pszText)
{
	INT_PTR			nResult;				// Result from function call

	// Attempt to lock the console, and default the response code if we cannot

	if(!LockConsole()) return DefaultUserResponse(uType, false);

	// Display the icon header and the message text in the console window
	
	if(InsertHeader(uType)) BlankLines();
	if(WriteText(pszText)) BlankLines();	

	nResult = PromptUser(uType);			// Prompt the user for their response
	BlankLines();							// Skip a line for neatness

	UnlockConsole();						// Release the console handle lock
	return nResult;							// Return the user's response
}
コード例 #3
0
ファイル: svctlcui.cpp プロジェクト: zukisoft/external
const INT_PTR ConsoleUI::List(UINT uType, LPCTSTR pszHeader, LPCTSTR *rgszItems,
							  DWORD cItems, LPCTSTR pszFooter)
{
	String			strItem;				// Item text string object
	DWORD			dwIndex;				// Loop index variable
	INT_PTR			nResult;				// Result from function call

	// Attempt to lock the console, and default the response code if we cannot

	if(!LockConsole()) return DefaultUserResponse(uType, false);

	// Display the optional faux icon header string, and the list box header text
	
	if(InsertHeader(uType)) BlankLines();
	if(pszHeader) { if(WriteText(pszHeader)) BlankLines(); }

	// Loop through the array of list items to display them in the console
	
	if(rgszItems) {
		
		for(dwIndex = 0; dwIndex < cItems; dwIndex++) {

			strItem = CONSOLE_BULLET;		// Start with the bullet
			strItem += CONSOLE_SPACE;		// Add in a space
			strItem += rgszItems[dwIndex];	// Finish with the text itself

			WriteText(strItem, CONSOLE_LIST_LMARGIN);
		}

		BlankLines();						// Finish up with a blank line
	}

	// Display the optional list box footer text before prompting the user
	
	if(pszFooter) { if(WriteText(pszFooter)) BlankLines(); }
		
	nResult = PromptUser(uType);			// Prompt the user for their response
	BlankLines();							// Skip a line for neatness

	UnlockConsole();						// Release the console handle lock
	return nResult;							// Return the user's response
}
コード例 #4
0
ファイル: Effect.cpp プロジェクト: andreipaga/audacity
bool Effect::DoEffect(wxWindow *parent, TrackList *list, double t0, double t1)
{
   wxASSERT(t0 <= t1);

   if (mWaveTracks) {
      delete mWaveTracks;
      mWaveTracks = NULL;
   }

   mParent = parent;
   mTracks = list;
   mT0 = t0;
   mT1 = t1;
   CountWaveTracks();

   if (!Init())
      return false;
   
   if (!PromptUser())
      return false;
      
   wxBusyCursor busy;
   wxYield();
   wxStartTimer();

   bool returnVal = Process();

   End();
   
   if (mProgress) {
      delete mProgress;
      mProgress = NULL;
   }
   
   delete mWaveTracks;
   mWaveTracks = NULL;
   
   return returnVal;
}
コード例 #5
0
bool AudacityCommand::DoAudacityCommand(wxWindow *parent,
                      const CommandContext & context,
                      bool shouldPrompt /* = true */)
{
   // Note: Init may read parameters from preferences
   if (!Init())
   {
      return false;
   }

   // Prompting will be bypassed when applying a command that has already 
   // been configured, e.g. repeating the last effect on a different selection.
   // Prompting may call AudacityCommand::Preview
   if (shouldPrompt && /*IsInteractive() && */!PromptUser(parent))
   {
      return false;
   }

   auto cleanup = finally( [&] {
      End();
   } );

   bool returnVal = true;
   bool skipFlag = CheckWhetherSkipAudacityCommand();
   if (skipFlag == false)
   {
      auto name = GetTranslatedName();
      ProgressDialog progress{
         name,
         wxString::Format(_("Applying %s..."), name),
         pdlgHideStopButton
      };
      auto vr = valueRestorer( mProgress, &progress );

      returnVal = Apply(context);
   }
   return returnVal;
}
コード例 #6
0
ファイル: Effect.cpp プロジェクト: tuanmasterit/audacity
bool Effect::DoEffect(wxWindow *parent, int flags,
                      double projectRate,
                      TrackList *list,
                      TrackFactory *factory,
                      double *t0, double *t1, wxString params)
{
   wxASSERT(*t0 <= *t1);

   if (mOutputTracks) {
      delete mOutputTracks;
      mOutputTracks = NULL;
   }

   mFactory = factory;
   mProjectRate = projectRate;
   mParent = parent;
   mTracks = list;
   mT0 = *t0;
   mT1 = *t1;
   CountWaveTracks();

   // Note: Init may read parameters from preferences
   if (!Init())
      return false;

   // If a parameter string was provided, it overrides any remembered settings
   // (but if the user is to be prompted, that takes priority)
   if (!params.IsEmpty())
   {
      ShuttleCli shuttle;
      shuttle.mParams = params;
      shuttle.mbStoreInClient=true;
      if( !TransferParameters( shuttle ))
      {
         wxMessageBox(
            wxString::Format(
               _("Could not set parameters of effect %s\n to %s."),
               GetEffectName().c_str(),
               params.c_str()
            )
         );
         return false;
      }
   }

   // Don't prompt user if we are dealing with a 
   // effect that is already configured, e.g. repeating
   // the last effect on a different selection.
   if( (flags & CONFIGURED_EFFECT) == 0)
   {
      if (!PromptUser())
         return false;
   }

   bool returnVal = true;
   bool skipFlag = CheckWhetherSkipEffect();
   if (skipFlag == false) {
      mProgress = new ProgressDialog(StripAmpersand(GetEffectName()),
                                     GetEffectAction(), 
                                     pdlgHideStopButton);
      returnVal = Process();
      delete mProgress;
   }

   End();

   if (mOutputTracks) {
      delete mOutputTracks;
      mOutputTracks = NULL;
   }

   if (returnVal) {
      *t0 = mT0;
      *t1 = mT1;
   }
   
   return returnVal;
}