home *** CD-ROM | disk | FTP | other *** search
- //--------------------------------------------------------------------------
- // Object Scripting
- // Copyright (c) 1996, 1997 by Borland International, All Rights Reserved
- //
- // SOUND.SPP: Sound Enabler. Plays WAV files on specified IDE events, such
- // as Build Failure.
- //
- // USE: Set values in sound.cfg. Run script.
- //
- // FILES: SOUND.CFG, FILE.SPP, MISC.SPP
- //
- // NOTES: All sound.* files must reside in the same directory.
- //--------------------------------------------------------------------------
- print typeid(module());
-
- //
- // IDE imports.
- //
- import IDE;
- import editor;
- import scriptEngine;
- import debugger;
-
- //
- // Load support module(s).
- //
- if (!scriptEngine.IsLoaded("file")) scriptEngine.Load("file");
- if (!scriptEngine.IsLoaded("misc")) scriptEngine.Load("misc");
-
- //
- // Configuration values.
- //
- BuildCompleteSuccessWAV;
- BuildCompleteFailureWAV;
- MakeCompleteSuccessWAV;
- MakeCompleteFailureWAV;
- DebugeeStoppedWAV;
- ExitingWAV;
- StartedWAV;
-
- CFGFile = GetModuleDir(typeid(module())) + "\\sound.cfg"; // The config file.
-
- sound()
- {
- //
- // Load configuration values.
- //
- declare File = new TConfigFile(CFGFile);
-
- BuildCompleteSuccessWAV = File.GetValue("BuildCompleteSuccess", "None");
- BuildCompleteFailureWAV = File.GetValue("BuildCompleteFailure", "None");
- MakeCompleteSuccessWAV = File.GetValue("MakeCompleteSuccess", "None");
- MakeCompleteFailureWAV = File.GetValue("MakeCompleteFailure", "None");
- DebugeeStoppedWAV = File.GetValue("DebugeeStopped", "None");
- ExitingWAV = File.GetValue("Exiting", "None");
- StartedWAV = File.GetValue("Started", "None");
-
- File.Close();
- }
-
- //
- // Handlers to tie sounds to IDE events.
- //
- on debugger:>DebugeeStopped()
- {
- if (DebugeeStoppedWAV != "None") {
- declare wav = new TWAVFile(DebugeeStoppedWAV);
- wav.Play();
- }
- pass();
- }
-
- on IDE:>BuildComplete(status, inputPath, outputPath)
- {
- if (BuildCompleteSuccessWAV != "None" &&
- BuildCompleteFailureWAV != "None") {
- declare file = status ? BuildCompleteSuccessWAV : BuildCompleteFailureWAV;
- declare wav = new TWAVFile(file);
- wav.Play();
- }
- pass(status, inputPath, outputPath);
- }
-
- on IDE:>MakeComplete(status, inputPath, outputPath)
- {
- if (MakeCompleteSuccessWAV != "None" && MakeCompleteFailureWAV != "None") {
- declare file = status ? MakeCompleteSuccessWAV : MakeCompleteFailureWAV;
- declare wav = new TWAVFile(file);
- wav.Play();
- }
- pass(status, inputPath, outputPath);
- }
-
- on IDE:>Exiting()
- {
- if (ExitingWAV != "None") {
- declare wav = new TWAVFile(ExitingWAV);
- wav.Play();
- }
- pass();
- }
-
- on IDE:>Started(firstTime)
- {
- if (StartedWAV != "None") {
- declare wav = new TWAVFile(StartedWAV);
- wav.Play();
- }
- pass(firstTime);
- }
-