From: <pst...@us...> - 2008-11-15 19:47:28
|
Revision: 627 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=627&view=rev Author: pstieber Date: 2008-11-15 19:47:25 +0000 (Sat, 15 Nov 2008) Log Message: ----------- Added code to copy the configuration files from the shared location to the uses Jazz++ configuration directory. Modified Paths: -------------- trunk/jazz/src/JazzPlusPlusApplication.cpp trunk/jazz/src/JazzPlusPlusApplication.h Modified: trunk/jazz/src/JazzPlusPlusApplication.cpp =================================================================== --- trunk/jazz/src/JazzPlusPlusApplication.cpp 2008-11-15 15:49:27 UTC (rev 626) +++ trunk/jazz/src/JazzPlusPlusApplication.cpp 2008-11-15 19:47:25 UTC (rev 627) @@ -51,6 +51,7 @@ #endif #include <fstream> +#include <vector> using namespace std; @@ -135,18 +136,7 @@ SetVendorName("Jazz"); SetAppName("Jazz"); - wxString ConfigDir = wxStandardPaths::Get().GetUserDataDir(); - if (!wxDirExists(ConfigDir)) - { - if (!wxMkdir(ConfigDir)) - { - wxString String; - String - << "Unable to create directory \"" - << ConfigDir << '"'; - ::wxMessageBox(String, "Directory Creation Error"); - } - } + InsureConfigurationFileExistence(); // Create the one and only top-level Jazz++ project. mpProject = new JZProject; @@ -237,6 +227,81 @@ //----------------------------------------------------------------------------- // Description: +// This function checks to see if the user's Jazz++ configuration directory +// files exist and creates the directory and copies default versions if they +// do not. +//----------------------------------------------------------------------------- +void JZJazzPlusPlusApplication::InsureConfigurationFileExistence() const +{ + vector<wxString> ConfigurationFileNames; + ConfigurationFileNames.push_back("README"); + ConfigurationFileNames.push_back("jazz.cfg"); + ConfigurationFileNames.push_back("jazz.mid"); + ConfigurationFileNames.push_back("ctrlnam.jzi"); + ConfigurationFileNames.push_back("e26voice.jzi"); + ConfigurationFileNames.push_back("e26.jzi"); + ConfigurationFileNames.push_back("gm.jzi"); + ConfigurationFileNames.push_back("gmdrmnam.jzi"); + ConfigurationFileNames.push_back("gmdrmset.jzi"); + ConfigurationFileNames.push_back("gmvoices.jzi"); + ConfigurationFileNames.push_back("gs.jzi"); + ConfigurationFileNames.push_back("gsdrmset.jzi"); + ConfigurationFileNames.push_back("gsvoices.jzi"); + ConfigurationFileNames.push_back("jv1000.jzi"); + ConfigurationFileNames.push_back("sc88pdrm.jzi"); + ConfigurationFileNames.push_back("sc88pro.jzi"); + ConfigurationFileNames.push_back("sc88pvoi.jzi"); + ConfigurationFileNames.push_back("xg.jzi"); + ConfigurationFileNames.push_back("xgdrmnam.jzi"); + ConfigurationFileNames.push_back("xgdrmset.jzi"); + ConfigurationFileNames.push_back("xgvoices.jzi"); + + wxString UserConfigDir = wxStandardPaths::Get().GetUserDataDir(); + + if (!wxDirExists(UserConfigDir)) + { + if (!wxMkdir(UserConfigDir)) + { + wxString String; + String + << "Unable to create directory \"" + << UserConfigDir << '"'; + ::wxMessageBox(String, "Directory Creation Error"); + } + } + + for ( + vector<wxString>::const_iterator iConfigurationFileName = + ConfigurationFileNames.begin(); + iConfigurationFileName != ConfigurationFileNames.end(); + ++iConfigurationFileName) + { + // Check to see if the user already has a jazz.cfg file in the + // user configuration directory. + wxString JazzCfgFile = + UserConfigDir + + wxFileName::GetPathSeparator() + + *iConfigurationFileName; + + if (!::wxFileExists(JazzCfgFile)) + { + // Attempt to copy the default Jazz++ configuration file to this + // directory. + wxString DefaultJazzCfgFile = + wxStandardPaths::Get().GetDataDir() + + wxFileName::GetPathSeparator() + + *iConfigurationFileName; + + if (::wxFileExists(DefaultJazzCfgFile)) + { + ::wxCopyFile(DefaultJazzCfgFile, JazzCfgFile); + } + } + } +} + +//----------------------------------------------------------------------------- +// Description: // The help file was not found so let the user search for it. If it is // found, create a configuration entry so the code can find the help file path // the next time it starts. Modified: trunk/jazz/src/JazzPlusPlusApplication.h =================================================================== --- trunk/jazz/src/JazzPlusPlusApplication.h 2008-11-15 15:49:27 UTC (rev 626) +++ trunk/jazz/src/JazzPlusPlusApplication.h 2008-11-15 19:47:25 UTC (rev 627) @@ -90,6 +90,8 @@ private: + void InsureConfigurationFileExistence() const; + void FindAndRegisterHelpFilePath(wxString& HelpFilePath); private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-11-15 23:16:30
|
Revision: 628 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=628&view=rev Author: pstieber Date: 2008-11-15 23:16:27 +0000 (Sat, 15 Nov 2008) Log Message: ----------- 1. Changed FindAndRegisterHelpFilePath from void to bool so the code code determine if the user gave up and not prompt a third time for the help file. 2. Forced the wxWidgets configuration file to be of type wxFileConfig because there seems to be a conflict between wxStandardPaths::GetUserDataDir and wxConfig under Linux. The latter creates a normal file as "$HOME/.AppName", while the former expects the ".AppName" portion to be a directory. This change also removes configuration settings from the registry on windows. Modified Paths: -------------- trunk/jazz/src/JazzPlusPlusApplication.cpp trunk/jazz/src/JazzPlusPlusApplication.h Modified: trunk/jazz/src/JazzPlusPlusApplication.cpp =================================================================== --- trunk/jazz/src/JazzPlusPlusApplication.cpp 2008-11-15 19:47:25 UTC (rev 627) +++ trunk/jazz/src/JazzPlusPlusApplication.cpp 2008-11-15 23:16:27 UTC (rev 628) @@ -23,6 +23,7 @@ #include "WxWidgets.h" #include <wx/stdpaths.h> +#include <wx/fileconf.h> #include "JazzPlusPlusApplication.h" #include "TrackFrame.h" @@ -182,26 +183,35 @@ wxString HelpFileNameAndPath = HelpFilePath + mHelpFileName; // Test for the existence of the help file. - bool HelpFileFound = true; + bool HelpFileFound = false; ifstream Is; Is.open(HelpFileNameAndPath.c_str()); if (!Is) { - // Return a valid path to the data. - FindAndRegisterHelpFilePath(HelpFilePath); - HelpFileNameAndPath = HelpFilePath + mHelpFileName; + // Ask the user to find the help file. + if (FindAndRegisterHelpFilePath(HelpFilePath)) + { + HelpFileNameAndPath = HelpFilePath + mHelpFileName; - // Try one more time. - Is.close(); - Is.clear(); - Is.open(HelpFileNameAndPath.c_str()); - if (!Is) - { - wxString Message = "Failed to add the IPVT book " + mHelpFileName; - ::wxMessageBox(Message); - HelpFileFound = false; + // Try one more time. + Is.close(); + Is.clear(); + Is.open(HelpFileNameAndPath.c_str()); + if (!Is) + { + wxString Message = "Failed to add the IPVT book " + mHelpFileName; + ::wxMessageBox(Message); + } + else + { + HelpFileFound = true; + } } } + else + { + HelpFileFound = true; + } if (HelpFileFound) { @@ -233,6 +243,36 @@ //----------------------------------------------------------------------------- void JZJazzPlusPlusApplication::InsureConfigurationFileExistence() const { + // Determine the expected location of the user's data dir for Jazz++. + wxString UserConfigDir = wxStandardPaths::Get().GetUserDataDir(); + + // Determine if the directory exists. + if (!wxDirExists(UserConfigDir)) + { + // Attempt to create the directory. + if (!wxMkdir(UserConfigDir)) + { + wxString String; + String + << "Unable to create directory \"" + << UserConfigDir << '"'; + ::wxMessageBox(String, "Directory Creation Error"); + } + } + + // Setup the wxWidgets configuration file. + wxFileName WxConfigurationFileName(UserConfigDir, ".jazz"); + + wxFileConfig* pFileConfig = new wxFileConfig( + GetAppName(), + wxEmptyString, + WxConfigurationFileName.GetFullPath(), + wxEmptyString, + wxCONFIG_USE_LOCAL_FILE); + + delete wxConfigBase::Set(pFileConfig); + + // Make sure all of the configuration files are setup. vector<wxString> ConfigurationFileNames; ConfigurationFileNames.push_back("README"); ConfigurationFileNames.push_back("jazz.cfg"); @@ -256,20 +296,6 @@ ConfigurationFileNames.push_back("xgdrmset.jzi"); ConfigurationFileNames.push_back("xgvoices.jzi"); - wxString UserConfigDir = wxStandardPaths::Get().GetUserDataDir(); - - if (!wxDirExists(UserConfigDir)) - { - if (!wxMkdir(UserConfigDir)) - { - wxString String; - String - << "Unable to create directory \"" - << UserConfigDir << '"'; - ::wxMessageBox(String, "Directory Creation Error"); - } - } - for ( vector<wxString>::const_iterator iConfigurationFileName = ConfigurationFileNames.begin(); @@ -306,8 +332,8 @@ // found, create a configuration entry so the code can find the help file path // the next time it starts. //----------------------------------------------------------------------------- -void JZJazzPlusPlusApplication::FindAndRegisterHelpFilePath( - wxString& HelpFilePath) +bool JZJazzPlusPlusApplication::FindAndRegisterHelpFilePath( + wxString& HelpFilePath) const { wxString Message; Message = "Unable to find " + mHelpFileName; @@ -317,10 +343,11 @@ wxFileDialog OpenDialog( 0, "Open the Help File", - "", + HelpFilePath, mHelpFileName, "*.hhp", wxFD_OPEN); + if (OpenDialog.ShowModal() == wxID_OK) { // Generate a c-style string that contains a path to the help file. @@ -336,7 +363,11 @@ // Return the user selected help file path. HelpFilePath = TempHelpFilePath; + + return true; } + + return false; } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/JazzPlusPlusApplication.h =================================================================== --- trunk/jazz/src/JazzPlusPlusApplication.h 2008-11-15 19:47:25 UTC (rev 627) +++ trunk/jazz/src/JazzPlusPlusApplication.h 2008-11-15 23:16:27 UTC (rev 628) @@ -92,7 +92,7 @@ void InsureConfigurationFileExistence() const; - void FindAndRegisterHelpFilePath(wxString& HelpFilePath); + bool FindAndRegisterHelpFilePath(wxString& HelpFilePath) const; private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-11-15 23:18:38
|
Revision: 629 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=629&view=rev Author: pstieber Date: 2008-11-15 23:18:35 +0000 (Sat, 15 Nov 2008) Log Message: ----------- Changed JZConfiguration::GetFileName() to look for the Jazz++ configuration file under the user data directory for Jazz++. Modified Paths: -------------- trunk/jazz/src/Configuration.cpp trunk/jazz/src/Configuration.h Modified: trunk/jazz/src/Configuration.cpp =================================================================== --- trunk/jazz/src/Configuration.cpp 2008-11-15 23:16:27 UTC (rev 628) +++ trunk/jazz/src/Configuration.cpp 2008-11-15 23:18:35 UTC (rev 629) @@ -22,6 +22,7 @@ #include "WxWidgets.h" +#include <wx/stdpaths.h> #include <wx/filename.h> #include "Configuration.h" @@ -115,7 +116,6 @@ } } - //***************************************************************************** // Description: // This is the configuration class definition. @@ -440,9 +440,7 @@ //----------------------------------------------------------------------------- // Description: -// Return the Jazz++ configuration file name, normally jazz.cfg. If the -// value has not been set by an earlier call to LoadConfig, attempt to find -// the file using FindFile(). +// Return the Jazz++ configuration file name, normally jazz.cfg. //----------------------------------------------------------------------------- wxString JZConfiguration::GetFileName() { @@ -451,11 +449,16 @@ return mFileName; } - mFileName = FindFile("jazz.cfg"); + wxString ConfigDir = wxStandardPaths::Get().GetUserDataDir(); - if (mFileName.empty()) + wxString JazzCfgFile = + ConfigDir + + wxFileName::GetPathSeparator() + + "jazz.cfg"; + + if (::wxFileExists(JazzCfgFile)) { - mFileName = FindFile(".jazz"); + mFileName = JazzCfgFile; } return mFileName; @@ -607,25 +610,28 @@ } // Create a temporary file name from the current file name. +// wxFileName TempFileName = wxFileName::CreateTempFileName(wxEmptyString); + string TempFileName(FileName); TempFileName.append(".tmp"); ofstream Os(TempFileName.c_str()); +// ofstream Os(TempFileName.GetFullPath()); if (!Os) { return false; } FILE* inp = fopen(FileName.c_str(), "r"); - const string& name = GetName(Index); + const string& ValueName = GetName(Index); - int len = name.length(); + int len = ValueName.length(); char buf[1000]; bool found = false; while (fgets(buf, sizeof(buf), inp) != NULL) { - if (strncmp(buf, name.c_str(), len) == 0) + if (strncmp(buf, ValueName.c_str(), len) == 0) { - Os << name << ' ' << ValueString << endl; + Os << ValueName << ' ' << ValueString << endl; found = true; } else @@ -635,13 +641,14 @@ } if (!found) { - Os << name << ' ' << ValueString << endl; + Os << ValueName << ' ' << ValueString << endl; } fclose(inp); Os.close(); - unlink(FileName.c_str()); - rename(TempFileName.c_str(), FileName.c_str()); + ::wxRemoveFile(FileName.c_str()); + ::wxRenameFile(TempFileName, FileName); + return true; } Modified: trunk/jazz/src/Configuration.h =================================================================== --- trunk/jazz/src/Configuration.h 2008-11-15 23:16:27 UTC (rev 628) +++ trunk/jazz/src/Configuration.h 2008-11-15 23:18:35 UTC (rev 629) @@ -254,9 +254,7 @@ private: // Description: - // Return the Jazz++ configuration file name, normally jazz.cfg. If the - // value has not been set by an earlier call to LoadConfig, attempt to - // find the file using FindFile(). + // Return the Jazz++ configuration file name, normally jazz.cfg. wxString GetFileName(); private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-11-15 23:51:10
|
Revision: 630 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=630&view=rev Author: pstieber Date: 2008-11-15 23:51:07 +0000 (Sat, 15 Nov 2008) Log Message: ----------- Changed the way the Jazz++ configuration file is found. Modified Paths: -------------- trunk/jazz/src/Project.cpp trunk/jazz/src/Project.h Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2008-11-15 23:18:35 UTC (rev 629) +++ trunk/jazz/src/Project.cpp 2008-11-15 23:51:07 UTC (rev 630) @@ -21,6 +21,8 @@ //***************************************************************************** #include "WxWidgets.h" + +#include <wx/stdpaths.h> #include <wx/config.h> #include <wx/filename.h> #include <wx/file.h> @@ -363,63 +365,48 @@ //----------------------------------------------------------------------------- void JZProject::ReadConfiguration() { - wxConfigBase* pConfig = wxConfigBase::Get(); + wxString ConfigDir = wxStandardPaths::Get().GetUserDataDir(); - // Get the current working directory and append a directory separator. - wxString CurrentWorkingDirectory = - ::wxGetCwd() + wxFileName::GetPathSeparator(); + wxString JazzCfgFile = + ConfigDir + + wxFileName::GetPathSeparator() + + mConfFileName; - // Jazz++ should be distributed with a conf subdirectory under the - // executable directory. This will be our initial guess for the location of - // the Jazz++ configuration file. - wxString ConfFileDirectoryGuess = - CurrentWorkingDirectory + "conf" + wxFileName::GetPathSeparator(); - - // Attempt to obtain the path to the Jazz++ configuration file from the - // wxWidgets Jazz++ configuration file. - wxString ConfFilePath; - bool WasConfPathRead = false; - if (pConfig) - { - WasConfPathRead = pConfig->Read( - "/Paths/Conf", - &ConfFilePath, - ConfFileDirectoryGuess); - } - - // Construct a full Jazz++ configuration path and file name. - wxString ConfFileNameAndPath = ConfFilePath + mConfFileName; - // Test for the existence of the Jazz++ configuration file. - if (!::wxFileExists(ConfFileNameAndPath)) + bool ConfigurationFileFound = false; + if (!::wxFileExists(JazzCfgFile)) { // Return a valid path to the data. - FindAndRegisterConfFilePath(ConfFilePath); - ConfFileNameAndPath = ConfFilePath + mConfFileName; - - // Try one more time. - if (!::wxFileExists(ConfFileNameAndPath)) + wxString ConfFilePath; + if (FindAndRegisterConfFilePath(ConfFilePath)) { - ConfFileNameAndPath.clear(); + JazzCfgFile = ConfFilePath + mConfFileName; + + // Try one more time. + if (!::wxFileExists(JazzCfgFile)) + { + JazzCfgFile.clear(); + } + else + { + ConfigurationFileFound = true; + } } } + else + { + ConfigurationFileFound = true; + } - if (!ConfFileNameAndPath.IsEmpty()) + if (ConfigurationFileFound) { cout - << "JZProject::ReadConfiguration() ConfFileNameAndPath:" << '\n' - << " \"" << ConfFileNameAndPath << '"' + << "JZProject::ReadConfiguration() JazzCfgFile:" << '\n' + << " \"" << JazzCfgFile << '"' << endl; - mpConfig->LoadConfig(ConfFileNameAndPath); + mpConfig->LoadConfig(JazzCfgFile); } - else - { - wxMessageBox( - "Could not find configuration file.", - "Warning", - wxOK); - } } //----------------------------------------------------------------------------- @@ -429,25 +416,28 @@ // configuration entry so the code will find the configuration file path the // next time it starts. // -// Returns: +// Outputs: // wxString&: // A user selected path to the Jazz++ configuration file. +// +// Returns: +// bool: +// True if the configuration file path was set; false otherwise. //----------------------------------------------------------------------------- -void JZProject::FindAndRegisterConfFilePath(wxString& ConfFilePath) +bool JZProject::FindAndRegisterConfFilePath(wxString& ConfFilePath) const { wxString DialogTitle; DialogTitle = "Please Indicate the Location of " + mConfFileName; // Use an open dialog to find the Jazz++ configuration file. - // wxFD_CHANGE_DIR - Change the current working directory to the directory - // where the file(s) chosen by the user are. wxFileDialog OpenDialog( 0, DialogTitle, "", mConfFileName, "*.cfg", - wxFD_OPEN | wxFD_CHANGE_DIR); + wxFD_OPEN); + if (OpenDialog.ShowModal() == wxID_OK) { // Generate a c-style string that contains a path to the help file. @@ -463,7 +453,11 @@ // Return the user selected help file path. ConfFilePath = TempConfFilePath; + + return true; } + + return false; } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/Project.h =================================================================== --- trunk/jazz/src/Project.h 2008-11-15 23:18:35 UTC (rev 629) +++ trunk/jazz/src/Project.h 2008-11-15 23:51:07 UTC (rev 630) @@ -165,7 +165,7 @@ void ReadConfiguration(); - void FindAndRegisterConfFilePath(wxString& ConfFilePath); + bool FindAndRegisterConfFilePath(wxString& ConfFilePath) const; private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-11-17 21:55:22
|
Revision: 637 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=637&view=rev Author: pstieber Date: 2008-11-17 21:52:03 +0000 (Mon, 17 Nov 2008) Log Message: ----------- Changed the HelpFile directory installation on Linux to prefix/share/Jazz++/HelpFiles. Modified Paths: -------------- trunk/jazz/src/HelpFiles/Makefile.am trunk/jazz/src/HelpFiles/images/Makefile.am trunk/jazz/src/JazzPlusPlusApplication.cpp Modified: trunk/jazz/src/HelpFiles/Makefile.am =================================================================== --- trunk/jazz/src/HelpFiles/Makefile.am 2008-11-17 19:38:17 UTC (rev 636) +++ trunk/jazz/src/HelpFiles/Makefile.am 2008-11-17 21:52:03 UTC (rev 637) @@ -10,7 +10,7 @@ libphony_a_SOURCES = jazz.tex -helpdir = ${prefix}/bin/HelpFiles +helpdir = ${prefix}/share/Jazz++/HelpFiles make-install-dirs: -if test '!' -d $(helpdir); then mkdir -p $(helpdir); fi Modified: trunk/jazz/src/HelpFiles/images/Makefile.am =================================================================== --- trunk/jazz/src/HelpFiles/images/Makefile.am 2008-11-17 19:38:17 UTC (rev 636) +++ trunk/jazz/src/HelpFiles/images/Makefile.am 2008-11-17 21:52:03 UTC (rev 637) @@ -1,4 +1,4 @@ -helpimagesdir = ${prefix}/bin/HelpFiles/images +helpimagesdir = ${prefix}/share/Jazz++/HelpFiles/images make-install-dirs : -if test '!' -d $(helpimagesdir); then mkdir -p $(helpimagesdir); fi Modified: trunk/jazz/src/JazzPlusPlusApplication.cpp =================================================================== --- trunk/jazz/src/JazzPlusPlusApplication.cpp 2008-11-17 19:38:17 UTC (rev 636) +++ trunk/jazz/src/JazzPlusPlusApplication.cpp 2008-11-17 21:52:03 UTC (rev 637) @@ -159,14 +159,14 @@ // Show it and tell the application that it's our main window SetTopWindow(mpTrackFrame); - // Get the current working directory and append a directory separator. - wxString CurrentWorkingDirectory = - ::wxGetCwd() + wxFileName::GetPathSeparator(); - // This code should be distributed with a HelpFiles subdirectory under - // the directory the executable is stored in. + // the directory the executable is stored in on Windows and under the + // ${prefix}/shared/${appname} on Linux. wxString HelpFileDirectoryGuess = - CurrentWorkingDirectory + "HelpFiles" + wxFileName::GetPathSeparator(); + wxStandardPaths::Get().GetDataDir() + + wxFileName::GetPathSeparator() + + "HelpFiles" + + wxFileName::GetPathSeparator(); // Attempt to obtain the path to the help file from configuration data. wxString HelpFilePath; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-12-26 19:32:37
|
Revision: 649 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=649&view=rev Author: pstieber Date: 2008-12-26 19:32:28 +0000 (Fri, 26 Dec 2008) Log Message: ----------- Added code to trim leading and trailing white space from a string. Modified Paths: -------------- trunk/jazz/src/StringUtilities.cpp trunk/jazz/src/StringUtilities.h Modified: trunk/jazz/src/StringUtilities.cpp =================================================================== --- trunk/jazz/src/StringUtilities.cpp 2008-12-24 01:18:18 UTC (rev 648) +++ trunk/jazz/src/StringUtilities.cpp 2008-12-26 19:32:28 UTC (rev 649) @@ -61,3 +61,20 @@ } return TokenIndex; } + +//----------------------------------------------------------------------------- +// Decsription: +// This function removes leading and trailing white space the input string. +//----------------------------------------------------------------------------- +string TNStringUtilities::TrimLeadingAndTrailingBlanks(const string& String) +{ + const string WhiteSpaceCharacters = " \t\n"; + + string::size_type Start = String.find_first_not_of(WhiteSpaceCharacters); + if (Start == string::npos) + { + return ""; + } + string::size_type Stop = String.find_last_not_of(WhiteSpaceCharacters); + return string(String, Start, Stop - Start + 1); +} Modified: trunk/jazz/src/StringUtilities.h =================================================================== --- trunk/jazz/src/StringUtilities.h 2008-12-24 01:18:18 UTC (rev 648) +++ trunk/jazz/src/StringUtilities.h 2008-12-26 19:32:28 UTC (rev 649) @@ -36,6 +36,12 @@ const std::string& InputString, std::vector<std::string>& Tokens); +//----------------------------------------------------------------------------- +// Decsription: +// This function removes leading and trailing white space the input string. +//----------------------------------------------------------------------------- +std::string TrimLeadingAndTrailingBlanks(const std::string& String); + }; #endif // !defined(TRC_STRINGUTILITIES_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-12-26 19:34:55
|
Revision: 650 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=650&view=rev Author: pstieber Date: 2008-12-26 19:34:52 +0000 (Fri, 26 Dec 2008) Log Message: ----------- 1. Updated an enumeration comment header. 2. Changed JZConfigurationEntry::SetStrValue to JZConfigurationEntry::SetStringValue. 3. Changed JZConfigurationEntry::mStrValue to JZConfigurationEntry::mStringValue. 4. Changed the argument to JZConfiguration::Load from char* to const std::string&. 5. Changed entry to Entry in Configuration.cpp. 6. Changed configuration file reading to use C++ streams and strings instead of C FILE* and char* values. Modified Paths: -------------- trunk/jazz/src/Configuration.cpp trunk/jazz/src/Configuration.h Modified: trunk/jazz/src/Configuration.cpp =================================================================== --- trunk/jazz/src/Configuration.cpp 2008-12-26 19:32:28 UTC (rev 649) +++ trunk/jazz/src/Configuration.cpp 2008-12-26 19:34:52 UTC (rev 650) @@ -26,9 +26,11 @@ #include <wx/filename.h> #include "Configuration.h" + #include "Synth.h" #include "FindFile.h" #include "Globals.h" +#include "StringUtilities.h" #include <stack> #include <iostream> @@ -49,7 +51,7 @@ : mType(eConfigEntryTypeInt), mName(), mValue(IntegerValue), - mStrValue() + mStringValue() { if (pName) { @@ -65,7 +67,7 @@ : mType(eConfigEntryTypeStr), mName(), mValue(0), - mStrValue() + mStringValue() { if (pName) { @@ -74,7 +76,7 @@ if (pStringValue) { - mStrValue = pStringValue; + mStringValue = pStringValue; } } @@ -89,7 +91,7 @@ mName = pName; } - mStrValue = StringValue; + mStringValue = StringValue; } //----------------------------------------------------------------------------- @@ -98,7 +100,7 @@ : mType(eConfigEntryTypeEmpty), mName(), mValue(0), - mStrValue() + mStringValue() { if (pName) { @@ -108,12 +110,9 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZConfigurationEntry::SetStrValue(const char* pStringValue) +void JZConfigurationEntry::SetStringValue(const string& StringValue) { - if (pStringValue) - { - mStrValue = pStringValue; - } + mStringValue = StringValue; } //***************************************************************************** @@ -368,42 +367,42 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const pair<string, int>& JZConfiguration::GetDrumName(unsigned entry) const +const pair<string, int>& JZConfiguration::GetDrumName(unsigned Entry) const { - assert((entry >= 0) && (entry < mDrumNames.size())); - return mDrumNames[entry]; + assert((Entry >= 0) && (Entry < mDrumNames.size())); + return mDrumNames[Entry]; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const pair<string, int>& JZConfiguration::GetDrumSet(unsigned entry) const +const pair<string, int>& JZConfiguration::GetDrumSet(unsigned Entry) const { - assert((entry >= 0) && (entry < mDrumSets.size())); - return mDrumSets[entry]; + assert((Entry >= 0) && (Entry < mDrumSets.size())); + return mDrumSets[Entry]; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const pair<string, int>& JZConfiguration::GetVoiceName(unsigned entry) const +const pair<string, int>& JZConfiguration::GetVoiceName(unsigned Entry) const { - assert((entry >= 0) && (entry < mVoiceNames.size())); - return mVoiceNames[entry]; + assert((Entry >= 0) && (Entry < mVoiceNames.size())); + return mVoiceNames[Entry]; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const pair<string, int>& JZConfiguration::GetCtrlName(unsigned entry) const +const pair<string, int>& JZConfiguration::GetCtrlName(unsigned Entry) const { - assert((entry >= 0) && (entry < mCtrlNames.size())); - return mCtrlNames[entry]; + assert((Entry >= 0) && (Entry < mCtrlNames.size())); + return mCtrlNames[Entry]; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -JZDoubleCommand& JZConfiguration::BankEntry(unsigned entry) +JZDoubleCommand& JZConfiguration::BankEntry(unsigned Entry) { - assert((entry >= 0) && (entry < mBankTable.size())); - return mBankTable[entry]; + assert((Entry >= 0) && (Entry < mBankTable.size())); + return mBankTable[Entry]; } //----------------------------------------------------------------------------- @@ -466,60 +465,62 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZConfiguration::Load(char* buf) +int JZConfiguration::Load(const string& InputLine) { - int entry = Check(buf); + int Entry = Check(InputLine); - if (entry < 0) + if (Entry < 0) { - return entry; + return Entry; } - char format[100]; - int result = 1; - if (mNames[entry]->GetType() == eConfigEntryTypeInt) + int Result = 1; + + switch (mNames[Entry]->GetType()) { - sprintf(format, "%s %%d", mNames[entry]->GetName().c_str()); - int Value; - result = sscanf(buf, format, &Value); - mNames[entry]->SetValue(Value); - } - else if (mNames[entry]->GetType() == eConfigEntryTypeStr) - { - // Allow whitespace inside entries like "C:\Program Files\JazzWare". - int ofs = mNames[entry]->GetName().length(); - while (buf[ofs] == ' ' || buf[ofs] == '\t') // not \n + case eConfigEntryTypeInt: { - ++ofs; + string Name; + int Value; + istringstream Iss(InputLine); + Iss >> Name >> Value; + if (Iss.fail()) + { + Result = -1; + } + mNames[Entry]->SetValue(Value); + break; } - int end = strlen(buf) - 1; - while (end > ofs) + case eConfigEntryTypeStr: { - if (!isspace(buf[end])) + string::size_type FindIndex = InputLine.find(mNames[Entry]->GetName()); + + if (FindIndex == string::npos) { + // Give up if the configuration entry name is not found. + Result = -1; break; } - --end; + + // Construct a string from the rest of the line and trim leading and + // trailing white space. + string StringValue = TNStringUtilities::TrimLeadingAndTrailingBlanks( + string(InputLine, FindIndex + mNames[Entry]->GetName().size())); + + mNames[Entry]->SetStringValue(StringValue); + + break; } - int size = end - ofs + 1; - - char* pStringValue = new char[size + 1]; - memcpy(pStringValue, buf + ofs, size); - pStringValue[size] = 0; - mNames[entry]->SetStrValue(pStringValue); - delete [] pStringValue; + case eConfigEntryTypeEmpty: + break; } - else - { - result = 1; - } - if (result <= 0) + if (Result <= 0) { return -1; } - return entry; + return Entry; } //----------------------------------------------------------------------------- @@ -543,9 +544,9 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool JZConfiguration::Get(int entry, char* value) +bool JZConfiguration::Get(int Entry, char* value) { - assert((entry >= 0) && (entry < NumConfigNames)); + assert((Entry >= 0) && (Entry < NumConfigNames)); wxString FileName = GetFileName(); if (FileName.IsEmpty()) @@ -554,7 +555,7 @@ } FILE *fd = fopen(FileName.c_str(), "r"); - const string& name = GetName(entry); + const string& name = GetName(Entry); int len = name.length(); char buf[1000]; @@ -582,10 +583,10 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool JZConfiguration::Get(int entry, int& value) +bool JZConfiguration::Get(int Entry, int& value) { char buf[512]; - if (Get(entry, buf)) + if (Get(Entry, buf)) { sscanf(buf, " %d ", &value); return true; @@ -695,26 +696,23 @@ wxString Path = FileNameObject.GetPath(); ::wxSetWorkingDirectory(Path); - char buf[1000]; int i, j; unsigned BankIndex = 0, VoiceIndex = 0, DrumsetIndex = 0; vector<pair<string, int> >* pVector = 0; -// stack<ifstream> InputFileStreams; - stack<FILE*> FileDescriptors; + stack<ifstream*> InputFileStreams; + string InputLine; cout << "JZConfiguration::LoadConfig:" << '\n' << " \"" << mFileName << '"' << endl; -// ifstream Is(mFileName.c_str()); -// InputFileStreams.push(Is); - FileDescriptors.push(fopen(mFileName.c_str(), "r")); + ifstream* pIs = new ifstream(mFileName.c_str()); + InputFileStreams.push(pIs); -// if (!InputFileStreams.top()) - if (FileDescriptors.top() == NULL) + if (!*InputFileStreams.top()) { wxString String; String @@ -734,17 +732,17 @@ { // Read a line from the current file. -// if (getline(InputFileStreams.top(), InputLine)) - if (fgets(buf, sizeof(buf), FileDescriptors.top()) == NULL) + getline(*InputFileStreams.top(), InputLine); + + // Check for an end-of-file condition. + if (InputFileStreams.top()->eof()) { -// InputFileStreams.top().close(); - fclose(FileDescriptors.top()); + InputFileStreams.top()->close(); + delete InputFileStreams.top(); + InputFileStreams.pop(); -// InputFileStreams.pop(); - FileDescriptors.pop(); - -// if (InputFileStreams.empty()) - if (FileDescriptors.empty()) + // Are there any open streams? + if (InputFileStreams.empty()) { // The code has reached the last line of the Jazz++ configuration file // (jazz.cfg or .jazz). @@ -757,12 +755,12 @@ } } - int entry; + int Entry; - // Read keyword lines - if ((entry = gpConfig->Load(buf)) >= 0) + // Read keyword lines. + if ((Entry = gpConfig->Load(InputLine)) >= 0) { - switch (entry) + switch (Entry) { case C_BankTable: @@ -806,7 +804,7 @@ case C_SynthConfig: case C_Include: { - if (entry == C_SynthConfig) + if (Entry == C_SynthConfig) { cout << "Include synthesizer configuration file \""; } @@ -814,33 +812,30 @@ { cout << "Include file \""; } - cout << GetStrValue(entry) << '"' << endl; + cout << GetStrValue(Entry) << '"' << endl; // Get the name of the include file. - wxString IncludeFileName = FindFile(GetStrValue(entry)); + wxString IncludeFileName = FindFile(GetStrValue(Entry)); if (IncludeFileName.empty()) { -// InputFileStreams - FileDescriptors.push(NULL); + InputFileStreams.push(0); } else { -// InputFileStreams - FileDescriptors.push(fopen(IncludeFileName, "r")); + pIs = new ifstream(IncludeFileName.c_str()); + InputFileStreams.push(pIs); } -// InputFileStreams - if (FileDescriptors.top() == NULL) + if (!InputFileStreams.top()) { wxString String; String << "Could not open configuration include file:" << '\n' - << '"' << buf << '"'; + << '"' << InputLine << '"'; ::wxMessageBox(String, "Warning", wxOK); -// InputFileStreams.pop(); - FileDescriptors.pop(); + InputFileStreams.pop(); } } break; @@ -849,17 +844,18 @@ break; } } + else if (pVector && isdigit(InputLine[0])) + { + // Read named value entries. - // Read named value entries - else if (pVector && isdigit(buf[0])) - { // Voice names if (pVector == &mVoiceNames) { if (VoiceIndex >= 0 && VoiceIndex < mVoiceNames.size()) { int Value; - sscanf(buf, " %d %n", &Value, &j); + istringstream Iss(InputLine); + Iss >> Value; if (gpConfig->GetValue(C_UseTwoCommandBankSelect)) { @@ -872,10 +868,10 @@ mVoiceNames[VoiceIndex + 1].second = Value + 1; - // Remove the \n. - buf[strlen(buf) - 1] = 0; + string VoiceName = + TNStringUtilities::TrimLeadingAndTrailingBlanks(Iss.str()); - mVoiceNames[VoiceIndex + 1].first = buf + j; + mVoiceNames[VoiceIndex + 1].first = VoiceName; ++VoiceIndex; } @@ -887,13 +883,16 @@ } } - // Drumset names else if (pVector == &mDrumSets) { + // Drumset names. + if (DrumsetIndex >= 0 && DrumsetIndex < 129) { int Value; - sscanf(buf, " %d %n", &Value, &j); + istringstream Iss(InputLine); + Iss >> Value; + if (gpConfig->GetValue(C_UseTwoCommandBankSelect)) { assert(0 <= Value && Value <= 65536); @@ -904,10 +903,10 @@ } mDrumSets[DrumsetIndex + 1].second = Value + 1; - // Remove the \n. - buf[strlen(buf) - 1] = 0; + string DrumSetName = + TNStringUtilities::TrimLeadingAndTrailingBlanks(Iss.str()); - mDrumSets[DrumsetIndex + 1].first = buf + j; + mDrumSets[DrumsetIndex + 1].first = DrumSetName; ++DrumsetIndex; } @@ -918,46 +917,48 @@ << endl; } } - - // Controller names. else if (pVector == &mCtrlNames) { - sscanf(buf, " %d %n", &i, &j); + // Controller names. + + istringstream Iss(InputLine); + Iss >> i; assert(0 <= i && i <= 127); - // Remove the \n. - buf[strlen(buf) - 1] = 0; + string ControllerName = + TNStringUtilities::TrimLeadingAndTrailingBlanks(Iss.str()); - mCtrlNames[i + 1].first = buf + j; + mCtrlNames[i + 1].first = ControllerName; } - - // Drum instrument names. else if (pVector == &mDrumNames) { - sscanf(buf, " %d %n", &i, &j); + // Drum instrument names. + + istringstream Iss(InputLine); + Iss >> i; assert(0 <= i && i <= 127); - // Remove the \n. - buf[strlen(buf) - 1] = 0; + string DrumName = + TNStringUtilities::TrimLeadingAndTrailingBlanks(Iss.str()); - mDrumNames[i + 1].first = buf + j; + mDrumNames[i + 1].first = DrumName; } else { wxString String; String << "LoadConfig: error reading line" << '\n' - << '"' << buf << '"'; + << '"' << InputLine << '"'; ::wxMessageBox(String, "Warning", wxOK); } } - - // Read bank table entries. - else if (pVector == 0 && !mBankTable.empty()&& isdigit(buf[0])) + else if (pVector == 0 && !mBankTable.empty()&& isdigit(InputLine[0])) { + // Read bank table entries. assert(0 <= BankIndex && BankIndex < mBankTable.size()); - sscanf(buf, " %d %d", &i, &j); + istringstream Iss(InputLine); + Iss >> i >> j; assert(0 <= i && i <= 255); assert(0 <= j && j <= 255); Modified: trunk/jazz/src/Configuration.h =================================================================== --- trunk/jazz/src/Configuration.h 2008-12-26 19:32:28 UTC (rev 649) +++ trunk/jazz/src/Configuration.h 2008-12-26 19:34:52 UTC (rev 650) @@ -117,7 +117,8 @@ }; //***************************************************************************** -// values for C_MidiDriver +// Description: +// These are the values associated with the C_MidiDriver entry. //***************************************************************************** enum TEMidiDriver { @@ -152,14 +153,14 @@ const std::string& GetStrValue() const; - void SetStrValue(const char* pStringValue); + void SetStringValue(const std::string& StringValue); private: TEConfigEntryType mType; std::string mName; int mValue; - std::string mStrValue; + std::string mStringValue; }; //***************************************************************************** @@ -203,7 +204,7 @@ inline const std::string& JZConfigurationEntry::GetStrValue() const { - return mStrValue; + return mStringValue; } //***************************************************************************** @@ -220,7 +221,7 @@ int Check(const std::string& Name) const; - int Load(char* buf); + int Load(const std::string& buf); const std::pair<std::string, int>& GetDrumName(unsigned Entry) const; const std::pair<std::string, int>& GetDrumSet(unsigned Entry) const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-12-26 22:22:53
|
Revision: 654 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=654&view=rev Author: pstieber Date: 2008-12-26 21:37:56 +0000 (Fri, 26 Dec 2008) Log Message: ----------- 1. Added a snap select stop function. 2. Started adding record capability. This is a WIP. Modified Paths: -------------- trunk/jazz/src/EventWindow.h trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2008-12-26 21:35:52 UTC (rev 653) +++ trunk/jazz/src/EventWindow.h 2008-12-26 21:37:56 UTC (rev 654) @@ -78,6 +78,10 @@ protected: + virtual void SnapSelStop(wxMouseEvent& Event) + { + } + void DrawVerticalLine(wxDC& Dc, int XPosition) const; void DrawHorizontalLine(wxDC& Dc, int YPosition) const; Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2008-12-26 21:35:52 UTC (rev 653) +++ trunk/jazz/src/TrackFrame.cpp 2008-12-26 21:37:56 UTC (rev 654) @@ -75,6 +75,8 @@ //----------------------------------------------------------------------------- BEGIN_EVENT_TABLE(JZTrackFrame, wxFrame) + EVT_MENU(wxID_NEW, JZTrackFrame::OnFileNew) + EVT_MENU(wxID_OPEN, JZTrackFrame::OnFileOpen) EVT_MENU(wxID_SAVEAS, JZTrackFrame::OnFileSaveAs) @@ -85,6 +87,8 @@ EVT_MENU(ID_PLAY_LOOP, JZTrackFrame::OnPlayLoop) + EVT_MENU(ID_RECORD, JZTrackFrame::OnRecord) + EVT_MENU(ID_PIANOWIN, JZTrackFrame::OnPianoWindow) EVT_MENU(ID_METRONOME_TOGGLE, JZTrackFrame::OnMetroOn) @@ -142,6 +146,16 @@ //----------------------------------------------------------------------------- JZTrackFrame::~JZTrackFrame() { + int XPosition, YPosition, Width, Height; + + GetPosition(&XPosition, &YPosition); + GetSize(&Width, &Height); + + gpConfig->Put(C_TrackWinXpos, XPosition); + gpConfig->Put(C_TrackWinYpos, YPosition); + gpConfig->Put(C_TrackWinWidth, Width); + gpConfig->Put(C_TrackWinHeight, Height); + delete mpToolBar; } @@ -433,6 +447,18 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackFrame::OnFileNew(wxCommandEvent& Event) +{ + if (wxMessageBox("Clear Song?", "Sure?", wxOK | wxCANCEL) == wxOK) + { + gpProject->Clear(); + mpTrackWindow->Refresh(false); +// NextWin->NewPosition(1, 0); + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackFrame::OnFileOpen(wxCommandEvent& Event) { // Use an open dialog to find the Jazz++ configuration file. @@ -509,6 +535,14 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackFrame::OnRecord(wxCommandEvent& Event) +{ + wxMouseEvent MouseEvent; + MousePlay(MouseEvent, eRecordButton); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackFrame::OnPianoWindow(wxCommandEvent& Event) { JZProjectManager::Instance()->CreatePianoView(); @@ -629,169 +663,4 @@ void JZTrackFrame::MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode) { mpTrackWindow->MousePlay(Event, Mode); - -/* - if (Mode == eMouse && !Event.ButtonDown()) - { - return; - } - - // This is a little hack to keep it working for now. - // All this stuff needs to be moved. - JZRecordingInfo* pRecInfo = gpProject->GetRecInfo(); - - if (!gpProject->IsPlaying()) - { - switch (Mode) - { - case eMouse: - int x, y; - Event.GetPosition(&x, &y); - gpProject->SetPlayPosition(x2BarClock((long)x)); - gpProject->Mute((Event.RightDown() != 0)); - if (mpSnapSel->Selected && (Event.ShiftDown() || Event.MiddleDown())) - { - gpProject->SetLoop(true); - } - else - { - gpProject->SetLoop(false); - mPreviouslyRecording = mpSnapSel->Selected; - } - break; - - case eSpaceBar: - break; - - case ePlayButton: - gpProject->SetLoop(false); - gpProject->SetRecord(false); - break; - - case ePlayLoopButton: - if (!EventsSelected("please select loop range first")) - { - return; - } - gpProject->SetLoop(true); - gpProject->SetRecord(false); - break; - - case eRecordButton: - if (!EventsSelected("please select record track/bar first")) - { - return; - } - JZBarInfo bi(gpProject); - - bi.SetClock(mpFilter->FromClock); - - if (bi.BarNr > 0) - { - bi.SetBar(bi.BarNr - 1); - } - gpProject->SetPlayPosition(bi.Clock); - gpProject->SetRecord(true); - gpProject->SetLoop(false); - break; - } - - // todo: Figure out if we should have getters for these instead - // and make them private jppProject members - bool loop = gpProject->mLoop; - bool muted = gpProject->mMuted; - bool record = gpProject->mRecord; - - // Is it possible to record? - if (record && mpSnapSel->Selected) - { - pRecInfo->mTrackIndex = mpFilter->FromTrack; - - pRecInfo->mpTrack = gpProject->GetTrack(pRecInfo->mTrackIndex); - - pRecInfo->mFromClock = mpFilter->FromClock; - pRecInfo->mToClock = mpFilter->ToClock; - - if (muted) - { - pRecInfo->mIsMuted = true; - pRecInfo->mpTrack->SetState(tsMute); -#ifdef OBSOLETE - LineText( - *pDc, - xState, - Line2y(pRecInfo.mTrackIndex), - wState, - pRecInfo.Track->GetStateChar()); -#endif - } - else - { - pRecInfo->mIsMuted = false; - } - } - else - { - pRecInfo->mpTrack = 0; - } - - // Is it possible to loop? - int loop_clock = 0; - if (loop && mpSnapSel->Selected) - { - mPreviousClock = mpFilter->FromClock; - loop_clock = mpFilter->ToClock; - } - - //if (pRecInfo->Track) // recording? - //gpProject->Midi->SetRecordInfo(pRecInfo); - //else - //gpProject->Midi->SetRecordInfo(0); - - gpProject->mStartTime = mPreviousClock; - gpProject->mStopTime = loop_clock; - gpProject->Play(); - - } //if(!Midi->Playing) - else - { - gpProject->Stop(); - if (pRecInfo->mpTrack) - { - if (pRecInfo->mIsMuted) - { -// wxDC* pDc = new wxClientDC(mpTrackWindow); - - pRecInfo->mpTrack->SetState(tsPlay); -// LineText( -// *pDc, -// xState, -// Line2y(pRecInfo->mTrackIndex), -// wState, -// pRecInfo->mpTrack->GetStateChar()); - -// delete pDc; - } - if ( - !pRecInfo->mpTrack->GetAudioMode() && - !gpProject->GetPlayer()->RecdBuffer.IsEmpty()) - { - //int choice = wxMessageBox("Keep recorded events?", "You played", wxOK | wxCANCEL); - //if (choice == wxOK) - { - wxBeginBusyCursor(); - gpProject->NewUndoBuffer(); - pRecInfo->mpTrack->MergeRange( - &gpProject->GetPlayer()->RecdBuffer, - pRecInfo->mFromClock, - pRecInfo->mToClock, - pRecInfo->mIsMuted); - wxEndBusyCursor(); - Refresh(); - NextWin->Refresh(); - } - } - } - } -*/ } Modified: trunk/jazz/src/TrackFrame.h =================================================================== --- trunk/jazz/src/TrackFrame.h 2008-12-26 21:35:52 UTC (rev 653) +++ trunk/jazz/src/TrackFrame.h 2008-12-26 21:37:56 UTC (rev 654) @@ -68,6 +68,8 @@ void CreateMenu(); + void OnFileNew(wxCommandEvent& Event); + void OnFileOpen(wxCommandEvent& Event); void OnFileSaveAs(wxCommandEvent& Event); @@ -82,6 +84,8 @@ void OnPlayLoop(wxCommandEvent& Event); + void OnRecord(wxCommandEvent& Event); + void OnPianoWindow(wxCommandEvent& Event); void OnToolsHarmonyBrowser(wxCommandEvent& Event); Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-12-26 21:35:52 UTC (rev 653) +++ trunk/jazz/src/TrackWindow.cpp 2008-12-26 21:37:56 UTC (rev 654) @@ -266,7 +266,22 @@ { wxPoint Point = Event.GetPosition(); - if ( + if (Point.x < mNumberWidth && Point.y >= mTopInfoHeight) + { + JZRectangle Rectangle( + 0, + y2yLine(Point.y), + Clock2x(mpSong->GetMaxQuarters() * mpSong->GetTicksPerQuarter()), + mTrackHeight); + mpSnapSel->Select( + Rectangle, + mEventsX, + mEventsY, + mEventsWidth, + mEventsHeight); + SnapSelStop(Event); + } + else if ( Point.x >= mEventsX && Point.x < mEventsX + mEventsWidth && Point.y >= mEventsY && Point.y < mEventsY + mEventsHeight) { @@ -1314,10 +1329,10 @@ // and make them private jppProject members bool loop = gpProject->mLoop; bool muted = gpProject->mMuted; - bool record = gpProject->mRecord; + bool Record = gpProject->mRecord; // Is it possible to record? - if (record && mpSnapSel->IsSelected()) + if (Record && mpSnapSel->IsSelected()) { pRecInfo->mTrackIndex = mpFilter->FromTrack; @@ -1359,10 +1374,14 @@ // GO! - //if (pRecInfo->Track) // recording? - //gpProject->Midi->SetRecordInfo(pRecInfo); - //else - //gpProject->Midi->SetRecordInfo(0); + if (pRecInfo->mpTrack) // recording? + { + gpMidiPlayer->SetRecordInfo(pRecInfo); + } + else + { + gpMidiPlayer->SetRecordInfo(0); + } gpProject->mStartTime = mPreviousClock; gpProject->mStopTime = loop_clock; Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2008-12-26 21:35:52 UTC (rev 653) +++ trunk/jazz/src/TrackWindow.h 2008-12-26 21:37:56 UTC (rev 654) @@ -83,6 +83,12 @@ void SetScrollRanges(); + protected: + + virtual void SnapSelStop(wxMouseEvent& Event) + { + } + private: void OnSize(wxSizeEvent& Event); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-12-27 18:49:07
|
Revision: 660 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=660&view=rev Author: pstieber Date: 2008-12-27 18:49:04 +0000 (Sat, 27 Dec 2008) Log Message: ----------- Updated the includes in the ALSA code. Modified Paths: -------------- trunk/jazz/src/AlsaDriver.cpp trunk/jazz/src/AlsaPlayer.cpp Modified: trunk/jazz/src/AlsaDriver.cpp =================================================================== --- trunk/jazz/src/AlsaDriver.cpp 2008-12-27 18:18:38 UTC (rev 659) +++ trunk/jazz/src/AlsaDriver.cpp 2008-12-27 18:49:04 UTC (rev 660) @@ -36,10 +36,11 @@ #include "Configuration.h" #include "Globals.h" +#include <cerrno> +#include <cstdlib> +#include <iostream> +#include <sys/ioctl.h> #include <unistd.h> -#include <stdlib.h> -#include <sys/ioctl.h> -#include <errno.h> using namespace std; Modified: trunk/jazz/src/AlsaPlayer.cpp =================================================================== --- trunk/jazz/src/AlsaPlayer.cpp 2008-12-27 18:18:38 UTC (rev 659) +++ trunk/jazz/src/AlsaPlayer.cpp 2008-12-27 18:49:04 UTC (rev 660) @@ -38,11 +38,12 @@ #include "TrackFrame.h" #include "TrackWindow.h" -#include <stdlib.h> -#include <errno.h> -#include <sys/ioctl.h> +#include <wx/choicdlg.h> +#include <cerrno> +#include <cstdlib> #include <iostream> +#include <sys/ioctl.h> using namespace std; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:17:52
|
Revision: 670 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=670&view=rev Author: pstieber Date: 2009-01-01 03:17:48 +0000 (Thu, 01 Jan 2009) Log Message: ----------- Encapsulated more of the data by using accessors and mutators. Modified Paths: -------------- trunk/jazz/src/Filter.cpp trunk/jazz/src/Filter.h Modified: trunk/jazz/src/Filter.cpp =================================================================== --- trunk/jazz/src/Filter.cpp 2009-01-01 03:14:00 UTC (rev 669) +++ trunk/jazz/src/Filter.cpp 2009-01-01 03:17:48 UTC (rev 670) @@ -22,184 +22,215 @@ #include "Filter.h" -#include "ClockDialog.h" +#include "Dialogs/FilterDialog.h" + #include "Events.h" #include "Help.h" -#include "PropertyListDialog.h" #include "Song.h" #include <cstdlib> +using namespace std; -const JZFilterEvent FltEvents[nFltEvents] = +//***************************************************************************** +//***************************************************************************** +const JZFilterEvent DefaultFilterEvents[eFilterCount] = { { StatKeyOn, "Note", 1, 0, 127}, { StatKeyPressure, "Poly Aftertouch", 1, 0, 127}, { StatControl, "Controller", 1, 0, 127}, { StatProgram, "Patch", 1, 0, 127}, - { StatPitch, "Pitch", 1, -8192, 8192}, - { StatTimeSignat, "Meter", 1, 0, 0}, - { StatChnPressure, "Channel Aftertouch", 1, 0, 0}, - { StatSysEx, "SysEx", 1, 0, 0} + { StatPitch, "Pitch", 1, -8192, 8192} }; - - -JZFilter::JZFilter(JZSong *s) +//***************************************************************************** +// Description: +// This is the filter class definition. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZFilter::JZFilter(JZSong* pSong) + : mFilterEvents(0), + mOtherSelected(true), + mpSong(pSong), + mFromClock(0), + mToClock(120 * 4), + mFromTrack(1), + mToTrack(1) { - mpSong = s; - FltEvents = new JZFilterEvent [nFltEvents]; - memcpy(FltEvents, ::FltEvents, sizeof(::FltEvents)); + mFilterEvents = new JZFilterEvent [eFilterCount]; + memcpy(mFilterEvents, ::DefaultFilterEvents, sizeof(::DefaultFilterEvents)); - FromClock = 0; - ToClock = 120*4; - FromTrack = 1; - ToTrack = 1; - OtherSelected = 1; - - for (int i = 0; i < nFltEvents; i++) + for (int i = 0; i < eFilterCount; ++i) { - FltEvents[i].FromValue = FltEvents[i].MinValue; - FltEvents[i].ToValue = FltEvents[i].MaxValue; + mFilterEvents[i].FromValue = DefaultFilterEvents[i].MinValue; + mFilterEvents[i].ToValue = DefaultFilterEvents[i].MaxValue; } } - -JZFilter::JZFilter(JZFilter *f) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZFilter::JZFilter(JZFilter const& Other) + : mFilterEvents(0), + mOtherSelected(Other.mOtherSelected), + mpSong(Other.mpSong), + mFromClock(Other.mFromClock), + mToClock(Other.mToClock), + mFromTrack(Other.mFromTrack), + mToTrack(Other.mToTrack) { - copy (*f); + mFilterEvents = new JZFilterEvent [eFilterCount]; + memcpy(mFilterEvents, Other.mFilterEvents, sizeof(::DefaultFilterEvents)); } - -JZFilter::JZFilter(JZFilter const &o) { - copy(o); +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZFilter& JZFilter::operator = (JZFilter const& Rhs) +{ + if (this != &Rhs) + { + memcpy(mFilterEvents, Rhs.mFilterEvents, sizeof(::DefaultFilterEvents)); + mOtherSelected = Rhs.mOtherSelected; + mpSong = Rhs.mpSong; + mFromClock = Rhs.mFromClock; + mToClock = Rhs.mToClock; + mFromTrack = Rhs.mFromTrack; + mToTrack = Rhs.mToTrack; + } + return *this; } - -JZFilter& JZFilter::operator=(JZFilter const &o) { - delete FltEvents; - copy(o); - return *this; +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZFilter::~JZFilter() +{ + delete mFilterEvents; } -void JZFilter::copy(JZFilter const &o) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::GetFilterEvent( + TEFilterType FilterType, + bool& Selected, + int& FromValue, + int& ToValue) { - mpSong = o.mpSong; - FromClock = o.FromClock; - ToClock = o.ToClock; - FromTrack = o.FromTrack; - ToTrack = o.ToTrack; - OtherSelected = o.OtherSelected; - - FltEvents = new JZFilterEvent [nFltEvents]; - memcpy(FltEvents, o.FltEvents, sizeof(::FltEvents)); + Selected = mFilterEvents[FilterType].Selected; + FromValue = mFilterEvents[FilterType].FromValue; + ToValue = mFilterEvents[FilterType].ToValue; } - -JZFilter::~JZFilter() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::SetFilterEvent( + TEFilterType FilterType, + bool Selected, + int FromValue, + int ToValue) { - delete FltEvents; + mFilterEvents[FilterType].Selected = Selected; + mFilterEvents[FilterType].FromValue = FromValue; + mFilterEvents[FilterType].ToValue = ToValue; } - -// ************************************************************************* -// Dialog -// ************************************************************************* - - - -class tFilterDlg : public tPropertyListDlg +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::SetOtherSelected(bool OtherSelected) { - JZFilter *Filter; - JZClockDialog FromClockDlg, ToClockDlg; + mOtherSelected = OtherSelected; +} - public: - tFilterDlg(JZFilter *f, JZSong *s, int ShowEventStats); - void AddProperties(); - bool OnClose(); - void OnHelp(); - int ShowEventStats; -}; - - -tFilterDlg::tFilterDlg(JZFilter *f, JZSong *Song, int ShowEventStats) - : tPropertyListDlg("Filter"), - FromClockDlg(Song, "From Time: ", f->FromClock), - ToClockDlg(Song, "To Time: ", f->ToClock) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::GenerateFromTimeString(string& FromTimeString) const { - this->ShowEventStats=ShowEventStats; - Filter = f; + if (mpSong) + { + mpSong->ClockToString(mFromClock, FromTimeString); + } } - -void tFilterDlg::AddProperties() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::SetFromTime(const string& FromTimeString) { -// Add(FromClockDlg.mkFormItem(150)); -// Add(ToClockDlg.mkFormItem(150)); -// Add(wxMakeFormNewLine()); -// #ifdef __WXMSW__ -// Add(wxMakeFormShort("From Track:", &Filter->FromTrack, wxFORM_DEFAULT, 0,0,0,110)); -// Add(wxMakeFormShort("To Track:", &Filter->ToTrack, wxFORM_DEFAULT, 0,0,0,110)); -// Add(wxMakeFormNewLine()); -// #else -// Add(wxMakeFormShort("From Track:", &Filter->FromTrack, wxFORM_DEFAULT)); -// Add(wxMakeFormShort("To Track:", &Filter->ToTrack, wxFORM_DEFAULT)); -// Add(wxMakeFormNewLine()); -// #endif - -// if (ShowEventStats) -// { -// for (int i = 0; i < nFltEvents; i++) -// { -// if (Filter->FltEvents[i].MinValue != Filter->FltEvents[i].MaxValue) -// { -// Add(wxMakeFormShort("Min:", &Filter->FltEvents[i].FromValue, wxFORM_DEFAULT,0,0,0,90)); -// Add(wxMakeFormShort("Max:", &Filter->FltEvents[i].ToValue, wxFORM_DEFAULT,0,0,0,90)); -// Add(wxMakeFormBool(Filter->FltEvents[i].Name, &Filter->FltEvents[i].Selected, wxFORM_DEFAULT)); -// Add(wxMakeFormNewLine()); -// } -// else -// Add(wxMakeFormBool(Filter->FltEvents[i].Name, &Filter->FltEvents[i].Selected, wxFORM_DEFAULT)); -// } - -// Add(wxMakeFormBool("Other", &Filter->OtherSelected)); -// } -// AssociatePanel(panel); + if (mpSong) + { + mFromClock = mpSong->StringToClock(FromTimeString); + } } - -bool tFilterDlg::OnClose() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::GenerateToTimeString(string& ToTimeString) const { - Filter->FromClock = FromClockDlg.GetClock(); - Filter->ToClock = ToClockDlg.GetClock(); - //wxForm::OnOk(); - return FALSE; + if (mpSong) + { + mpSong->ClockToString(mToClock, ToTimeString); + } } -void tFilterDlg::OnHelp() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::SetToTime(const string& ToTimeString) { - gpHelpInstance->ShowTopic("Filter"); + if (mpSong) + { + mToClock = mpSong->StringToClock(ToTimeString); + } } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZFilter::IsSelected(JZEvent* pEvent) +{ + int Value = pEvent->GetValue(); + for (int i = 0; i < eFilterCount; ++i) + { + if (pEvent->GetStat() == mFilterEvents[i].Stat) + { + // Aftertouch belongs to KeyOn events. + if (pEvent->GetStat() == StatKeyPressure) + { + int aval = pEvent->IsKeyPressure()->GetKey(); + return + mFilterEvents[i].Selected && + mFilterEvents[i].FromValue <= aval && + aval <= mFilterEvents[i].ToValue; + } + if (pEvent->GetStat() == StatTimeSignat) + { + return mFilterEvents[i].Selected; + } + if (pEvent->GetStat() == StatChnPressure) + { + return mFilterEvents[i].Selected; + } + if (pEvent->GetStat() == StatSysEx) + { + return mFilterEvents[i].Selected; + } + return + mFilterEvents[i].Selected && + mFilterEvents[i].FromValue <= Value && + Value <= mFilterEvents[i].ToValue; + } + } + return mOtherSelected; +} - - -void JZFilter::Dialog(wxFrame *parent, int ShowEventStats) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::Dialog(wxWindow* pParent) { - tFilterDlg *dlg; - // mpDialogBox = new wxDialogBox(parent, "Event Filter", FALSE ); - dlg = new tFilterDlg(this, mpSong, ShowEventStats); - dlg->Create(); -// dlg->EditForm(mpDialogBox, ShowEventStats); -// mpDialogBox->Fit(); -// mpDialogBox->Show(TRUE); + JZFilterDialog FilterDialog(*this, pParent); + if (FilterDialog.ShowModal() == wxID_OK) + { + } } - - - //***************************************************************************** // Description: // This is the track iterator class definition. @@ -207,7 +238,7 @@ //----------------------------------------------------------------------------- JZTrackIterator::JZTrackIterator(JZFilter* pFilter, bool Reverse) : mpFilter(pFilter), - mpSong(mpFilter->mpSong), + mpSong(mpFilter->GetSong()), mTrackIndex(0), mReverse(Reverse) { @@ -219,11 +250,11 @@ { if (mReverse) { - mTrackIndex = mpFilter->ToTrack; + mTrackIndex = mpFilter->GetToTrack(); } else { - mTrackIndex = mpFilter->FromTrack; + mTrackIndex = mpFilter->GetFromTrack(); } return mpSong->GetTrack(mTrackIndex); } @@ -235,7 +266,7 @@ if (mReverse) { --mTrackIndex; - if (mTrackIndex < mpFilter->FromTrack) + if (mTrackIndex < mpFilter->GetFromTrack()) { return 0; } @@ -243,7 +274,7 @@ else { ++mTrackIndex; - if (mTrackIndex > mpFilter->ToTrack) + if (mTrackIndex > mpFilter->GetToTrack()) { return 0; } @@ -255,5 +286,5 @@ //----------------------------------------------------------------------------- int JZTrackIterator::Count() const { - return mpFilter->ToTrack - mpFilter->FromTrack + 1; + return mpFilter->GetToTrack() - mpFilter->GetFromTrack() + 1; } Modified: trunk/jazz/src/Filter.h =================================================================== --- trunk/jazz/src/Filter.h 2009-01-01 03:14:00 UTC (rev 669) +++ trunk/jazz/src/Filter.h 2009-01-01 03:17:48 UTC (rev 670) @@ -28,26 +28,27 @@ class JZSong; class JZTrack; class wxDialog; -class wxFrame; +class wxWindow; -#define FltKeyOn 0 -#define FltKeyPressure 1 // SN++ PolyAftertouch gehoert to KeyOn Events! -#define FltControl 2 -#define FltProgram 3 -#define FltPitch 4 -#define FltTempo 5 -#define FltChnPressure 6 // SN++ Channel Aftertouch -#define FltSysEx 7 +//***************************************************************************** +//***************************************************************************** +enum TEFilterType +{ + eFilterKeyOn = 0, + eFilterKeyPressure = 1, // PolyAftertouch belongs to KeyOn Events. + eFilterControl = 2, + eFilterProgram = 3, + eFilterPitch = 4, + eFilterCount = 5 +}; -#define nFltEvents 8 - //***************************************************************************** //***************************************************************************** class JZFilterEvent { public: int Stat; - const char* Name; + const char* mName; bool Selected; int MinValue, MaxValue; int FromValue, ToValue; @@ -57,73 +58,87 @@ //***************************************************************************** class JZFilter : public wxObject { - friend class tFilterDlg; - wxDialog* mpDialogBox; - void copy(const JZFilter& Other); - public: - JZFilterEvent* FltEvents; - bool OtherSelected; + JZFilter(JZSong* pSong); + JZFilter(const JZFilter& Other); + + JZFilter& operator = (const JZFilter& Rhs); + + virtual ~JZFilter(); + + void GetFilterEvent( + TEFilterType FilterType, + bool& Selected, + int& FromValue, + int& ToValue); + + void SetFilterEvent( + TEFilterType FilterType, + bool Selected, + int FromValue, + int ToValue); + + void SetOtherSelected(bool OtherSelected); + + JZSong* GetSong() const; + + int GetFromClock() const; + void SetFromClock(int FromClock); + void GenerateFromTimeString(std::string& FromTimeString) const; + void SetFromTime(const std::string& FromTimeString); + + int GetToClock() const; + void SetToClock(int ToClock); + void GenerateToTimeString(std::string& ToTimeString) const; + void SetToTime(const std::string& ToTimeString); + + int GetFromTrack() const; + void SetFromTrack(int FromTrack); + + int GetToTrack() const; + void SetToTrack(int ToTrack); + + bool GetFilterMeter() const; + void SetFilterMeter(bool FilterMeter); + + bool GetFilterChannelAftertouch() const; + void SetFilterChannelAftertouch(bool FilterChannelAftertouch); + + bool GetFilterSysEx() const; + void SetFilterSysEx(bool FilterSysEx); + + bool GetFilterOther() const; + void SetFilterOther(bool FilterOther); + + int IsSelected(JZEvent* pEvent); + + void Dialog(wxWindow* pParent); + + private: + + JZFilterEvent* mFilterEvents; + + bool mOtherSelected; + JZSong* mpSong; - int FromClock, ToClock; // einschl .. ausschl + int mFromClock, mToClock; - int FromTrack, ToTrack; // 1..n einschl .. einschl + int mFromTrack, mToTrack; - void Dialog(wxFrame* parent, int ShowEventStats = 1); + bool mFilterMeter; - JZFilter(JZSong* pSong); - JZFilter(JZFilter* pOtherFilter); - JZFilter(const JZFilter& Other); - JZFilter& operator = (const JZFilter& Rhs); - virtual ~JZFilter(); + bool mFilterChannelAftertouch; - int IsSelected(JZEvent* pEvent) - { - int Value = pEvent->GetValue(); - for (int i = 0; i < nFltEvents; ++i) - { - if (pEvent->GetStat() == FltEvents[i].Stat) - { - // SN++ Aftertouch gehoert eigendlich zu KeyOn Events. - if (pEvent->GetStat() == StatKeyPressure) - { - int aval = pEvent->IsKeyPressure()->GetKey(); - return - FltEvents[i].Selected && - FltEvents[i].FromValue <= aval && - aval <= FltEvents[i].ToValue; - } - if (pEvent->GetStat() == StatTimeSignat) - { - return FltEvents[i].Selected; - } - // SN++ - if (pEvent->GetStat() == StatChnPressure) - { - return FltEvents[i].Selected; - } + bool mFilterSysEx; - if (pEvent->GetStat() == StatSysEx) - { - return FltEvents[i].Selected; - } + bool mFilterOther; - return - FltEvents[i].Selected && - FltEvents[i].FromValue <= Value && - Value <= FltEvents[i].ToValue; - } - } - return OtherSelected; - } + wxDialog* mpDialogBox; }; -// void GlobalFilterDlg(wxButton& but, wxMouseEvent& event); -// void GlobalFilterDlgNoStats(wxButton& but, wxMouseEvent& event); - //***************************************************************************** // Description: // This is the track iterator class declaration. @@ -145,4 +160,144 @@ bool mReverse; }; +//***************************************************************************** +// Description: +// These are the filter class inline member functions. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +JZSong* JZFilter::GetSong() const +{ + return mpSong; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZFilter::GetFromClock() const +{ + return mFromClock; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFromClock(int FromClock) +{ + mFromClock = FromClock; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZFilter::GetToClock() const +{ + return mToClock; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetToClock(int ToClock) +{ + mToClock = ToClock; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZFilter::GetFromTrack() const +{ + return mFromTrack; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFromTrack(int FromTrack) +{ + mFromTrack = FromTrack; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZFilter::GetToTrack() const +{ + return mToTrack; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetToTrack(int ToTrack) +{ + mToTrack = ToTrack; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +bool JZFilter::GetFilterMeter() const +{ + return mFilterMeter; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFilterMeter(bool FilterMeter) +{ + mFilterMeter = FilterMeter; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +bool JZFilter::GetFilterChannelAftertouch() const +{ + return mFilterChannelAftertouch; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFilterChannelAftertouch(bool FilterChannelAftertouch) +{ + mFilterChannelAftertouch = FilterChannelAftertouch; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +bool JZFilter::GetFilterSysEx() const +{ + return mFilterSysEx; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFilterSysEx(bool FilterSysEx) +{ + mFilterSysEx = FilterSysEx; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +bool JZFilter::GetFilterOther() const +{ + return mFilterOther; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFilterOther(bool FilterOther) +{ + mFilterOther = FilterOther; +} + #endif // !defined(JZ_FILTER_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:18:32
|
Revision: 671 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=671&view=rev Author: pstieber Date: 2009-01-01 03:18:28 +0000 (Thu, 01 Jan 2009) Log Message: ----------- Changed to use STL strings instead of char*. Modified Paths: -------------- trunk/jazz/src/StringReadWrite.cpp trunk/jazz/src/StringReadWrite.h Modified: trunk/jazz/src/StringReadWrite.cpp =================================================================== --- trunk/jazz/src/StringReadWrite.cpp 2009-01-01 03:17:48 UTC (rev 670) +++ trunk/jazz/src/StringReadWrite.cpp 2009-01-01 03:18:28 UTC (rev 671) @@ -21,44 +21,39 @@ //***************************************************************************** #include <iostream> +#include <string> using namespace std; //***************************************************************************** //***************************************************************************** -istream& ReadString(istream& Is, char* pString, int MaximumLength) +istream& ReadString(istream& Is, string& String) { - // Save space for the trailing 0. - --MaximumLength; - - int c; + int Character; do { // Ignore through the first ". - c = Is.get(); - } while (c != '"' && c != EOF); + Character = Is.get(); + } while (Character != '"' && Character != EOF); - int i; - for (i = 0; i < MaximumLength; ++i) + // This is an intention infinite for loop. + for (;;) { - c = Is.get(); - if (c == '"' || c == EOF) + Character = Is.get(); + if (Character == '"' || Character != EOF) { break; } - pString[i] = c; + String += Character; } - // Terminate the C-style string. - pString[i] = 0; - return Is; } //***************************************************************************** //***************************************************************************** -ostream& WriteString(ostream& Os, const char* pString) +ostream& WriteString(ostream& Os, const string& String) { - Os << '"' << pString << '"'; + Os << '"' << String << '"'; return Os; } Modified: trunk/jazz/src/StringReadWrite.h =================================================================== --- trunk/jazz/src/StringReadWrite.h 2009-01-01 03:17:48 UTC (rev 670) +++ trunk/jazz/src/StringReadWrite.h 2009-01-01 03:18:28 UTC (rev 671) @@ -23,14 +23,15 @@ #ifndef JZ_STRINGREADWRITE_H #define JZ_STRINGREADWRITE_H -#include <iostream> +#include <iosfwd> +#include <string> //***************************************************************************** //***************************************************************************** -std::istream& ReadString(std::istream& Is, char* pString, int MaximumLength); +std::istream& ReadString(std::istream& Is, std::string& String); //***************************************************************************** //***************************************************************************** -std::ostream& WriteString(std::ostream& Os, const char* pString); +std::ostream& WriteString(std::ostream& Os, const std::string& String); #endif // !defined(JZ_STRINGREADWRITE_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:22:52
|
Revision: 673 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=673&view=rev Author: pstieber Date: 2009-01-01 03:22:49 +0000 (Thu, 01 Jan 2009) Log Message: ----------- Updated to use the new filter accessor and mutator function. Modified Paths: -------------- trunk/jazz/src/Command.cpp trunk/jazz/src/ControlEdit.cpp trunk/jazz/src/Dialogs.cpp trunk/jazz/src/HarmonyBrowserAnalyzer.cpp trunk/jazz/src/PianoWindow.cpp Modified: trunk/jazz/src/Command.cpp =================================================================== --- trunk/jazz/src/Command.cpp 2009-01-01 03:20:32 UTC (rev 672) +++ trunk/jazz/src/Command.cpp 2009-01-01 03:22:49 UTC (rev 673) @@ -40,7 +40,7 @@ //----------------------------------------------------------------------------- tCommand::tCommand(JZFilter* pFilter) : mpFilter(pFilter), - mpSong(pFilter->mpSong), + mpSong(pFilter->GetSong()), mReverse(false) { } @@ -75,7 +75,8 @@ void tCommand::ExecuteTrack(JZTrack* pTrack) { tEventIterator Iterator(pTrack); - JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + JZEvent* pEvent = + Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) { if (mpFilter->IsSelected(pEvent)) @@ -97,8 +98,8 @@ //----------------------------------------------------------------------------- int tCommand::Interpolate(int Clock, int vmin, int vmax) { - int ClockMin = mpFilter->FromClock; - int ClockMax = mpFilter->ToClock; + int ClockMin = mpFilter->GetFromClock(); + int ClockMax = mpFilter->GetToClock(); return (Clock - ClockMin) * (vmax - vmin) / (ClockMax - ClockMin) + vmin; } @@ -319,10 +320,10 @@ tCommand::Execute(NewUndo); if (!LeaveSpace) { - JZFilter Filter(mpFilter); - Filter.FromClock = mpFilter->ToClock; - Filter.ToClock = mpSong->GetLastClock() + 1; - long DeltaClock = mpFilter->FromClock - mpFilter->ToClock; + JZFilter Filter(*mpFilter); + Filter.SetFromClock(mpFilter->GetToClock()); + Filter.SetToClock(mpSong->GetLastClock() + 1); + long DeltaClock = mpFilter->GetFromClock() - mpFilter->GetToClock(); tCmdShift shift(&Filter, DeltaClock); shift.Execute(0); } @@ -584,11 +585,14 @@ void tCmdConvertToModulation::ExecuteTrack(JZTrack* pTrack) { - //JAVE:iterate over all events, make a long event from start until stop of the sequence, - //convert all note-on messages to a pitch bend/volume controller pair, velocity -> volume - //make a volume off controller at the end of the current event + // JAVE: + // Iterate over all events, make a long event from start until stop of the + // sequence, convert all note-on messages to a pitch bend/volume controller + // pair, velocity -> volume make a volume off controller at the end of the + // current event. tEventIterator Iterator(pTrack); - JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + JZEvent* pEvent = + Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); long startclock=-1; long endclock=-1; unsigned char channel=0; @@ -810,10 +814,11 @@ InsertSpace = 0; // no RepeatClock = -1; // -1L - mReverse = DestTrack > mpFilter->FromTrack; + mReverse = DestTrack > mpFilter->GetFromTrack(); if (mReverse) { - DestTrack += mpFilter->ToTrack - mpFilter->FromTrack; // ToTrack inclusive + // ToTrack inclusive. + DestTrack += mpFilter->GetToTrack() - mpFilter->GetFromTrack(); } } @@ -827,7 +832,7 @@ StartClock = DestClock; if (RepeatClock < 0) - StopClock = StartClock + mpFilter->ToClock - mpFilter->FromClock; + StopClock = StartClock + mpFilter->GetToClock() - mpFilter->GetFromClock(); else StopClock = RepeatClock; @@ -852,8 +857,9 @@ tEventArray tmp; { tEventIterator Iterator(s); - long DeltaClock = StartClock - mpFilter->FromClock; - JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + long DeltaClock = StartClock - mpFilter->GetFromClock(); + JZEvent* pEvent = + Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) { long NewClock = pEvent->GetClock() + DeltaClock; @@ -871,7 +877,7 @@ if (!pEvent) { pEvent = Iterator.First(); - DeltaClock += mpFilter->ToClock - mpFilter->FromClock; + DeltaClock += mpFilter->GetToClock() - mpFilter->GetFromClock(); } } } @@ -902,7 +908,7 @@ if (EraseSource) { tEventIterator Iterator(s); - JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + JZEvent* pEvent = Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) { if (mpFilter->IsSelected(pEvent)) @@ -953,7 +959,7 @@ { tKeyOn* pKeyOn = (tKeyOn *)pEvent->Copy(); pKeyOn->SetClock( - mpFilter->FromClock + mpFilter->ToClock - pKeyOn->GetClock()); + mpFilter->GetFromClock() + mpFilter->GetToClock() - pKeyOn->GetClock()); pTrack->Kill(pEvent); pTrack->Put(pKeyOn); } @@ -983,7 +989,8 @@ } tEventIterator Iterator(pTrack); - pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + pEvent = + Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) { if (mpFilter->IsSelected(pEvent) && pEvent->IsKeyOn()) @@ -996,7 +1003,8 @@ // reverse Key's - pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + pEvent = + Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) { if (mpFilter->IsSelected(pEvent) && pEvent->IsKeyOn()) @@ -1047,7 +1055,7 @@ mRandomArray(RandomArray) { mpBarInfo = new JZBarInfo(*mpSong); - mpBarInfo->SetClock(mpFilter->FromClock); + mpBarInfo->SetClock(mpFilter->GetFromClock()); mStartBar = mpBarInfo->GetBarIndex(); } Modified: trunk/jazz/src/ControlEdit.cpp =================================================================== --- trunk/jazz/src/ControlEdit.cpp 2009-01-01 03:20:32 UTC (rev 672) +++ trunk/jazz/src/ControlEdit.cpp 2009-01-01 03:22:49 UTC (rev 673) @@ -523,8 +523,8 @@ { return ( mpPianoWindow->GetFilter()->IsSelected(pEvent) && - (pEvent->GetClock() >= mpPianoWindow->GetFilter()->FromClock && - pEvent->GetClock() <= mpPianoWindow->GetFilter()->ToClock)); + (pEvent->GetClock() >= mpPianoWindow->GetFilter()->GetFromClock() && + pEvent->GetClock() <= mpPianoWindow->GetFilter()->GetToClock())); } } return 0; @@ -546,8 +546,8 @@ if (mpPianoWindow->mpSnapSel->IsSelected()) { - from_clk = mpPianoWindow->GetFilter()->FromClock; - to_clk = mpPianoWindow->GetFilter()->ToClock; + from_clk = mpPianoWindow->GetFilter()->GetFromClock(); + to_clk = mpPianoWindow->GetFilter()->GetToClock(); } else { @@ -624,8 +624,8 @@ { return ( mpPianoWindow->GetFilter()->IsSelected(pEvent) && - (pEvent->GetClock() >= mpPianoWindow->GetFilter()->FromClock && - pEvent->GetClock() <= mpPianoWindow->GetFilter()->ToClock)); + (pEvent->GetClock() >= mpPianoWindow->GetFilter()->GetFromClock() && + pEvent->GetClock() <= mpPianoWindow->GetFilter()->GetToClock())); } } return 0; @@ -661,8 +661,8 @@ if (mpPianoWindow->mpSnapSel->IsSelected()) { - from_clk = mpPianoWindow->GetFilter()->FromClock; - to_clk = mpPianoWindow->GetFilter()->ToClock; + from_clk = mpPianoWindow->GetFilter()->GetFromClock(); + to_clk = mpPianoWindow->GetFilter()->GetToClock(); } else { Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2009-01-01 03:20:32 UTC (rev 672) +++ trunk/jazz/src/Dialogs.cpp 2009-01-01 03:22:49 UTC (rev 673) @@ -58,7 +58,7 @@ mSteps(0), mUnit(unit), mpFilter(pFilter), - mpSong(pFilter->mpSong) + mpSong(pFilter->GetSong()) { } @@ -108,7 +108,7 @@ : tPropertyListDlg( "Clean up events" ) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -188,7 +188,7 @@ : tPropertyListDlg("Search and replace controller types" ) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } bool tSearchReplaceDlg::OnClose() @@ -236,7 +236,7 @@ : tPropertyListDlg("Transpose") { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -285,7 +285,7 @@ : tPropertyListDlg("Set MIDI Channel") { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -336,7 +336,7 @@ : tPropertyListDlg( "Velocity" ) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -387,7 +387,7 @@ : tPropertyListDlg("Length") { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -447,7 +447,7 @@ : tPropertyListDlg("stretch/contract by scale from start of selected sequence" ) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -490,7 +490,7 @@ : tPropertyListDlg("MIDI delay line" ) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -640,7 +640,7 @@ //, Steps("steps", gQntSteps, &gQntStep) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.cpp =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2009-01-01 03:20:32 UTC (rev 672) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2009-01-01 03:22:49 UTC (rev 673) @@ -55,8 +55,8 @@ Exit(); // cleanup from previous run mpFilter = pFilter; - start_clock = pFilter->FromClock; - stop_clock = pFilter->ToClock; + start_clock = pFilter->GetFromClock(); + stop_clock = pFilter->GetToClock(); eighths_per_chord = epc; if (eighths_per_chord == 0) @@ -65,7 +65,7 @@ } else { - JZBarInfo BarInfo(*mpFilter->mpSong); + JZBarInfo BarInfo(*mpFilter->GetSong()); BarInfo.SetClock(start_clock); int start_bar = BarInfo.GetBarIndex(); BarInfo.SetClock(stop_clock); @@ -117,7 +117,7 @@ int HBAnalyzer::Transpose(JZFilter* pFilter, int qbc) { - pFilter->mpSong->NewUndoBuffer(); + pFilter->GetSong()->NewUndoBuffer(); Init(pFilter, qbc); IterateEvents(&HBAnalyzer::CountEvent); GenerateMapping(); @@ -135,15 +135,16 @@ if (!t->IsDrumTrack()) { tEventIterator Events(t); - JZEvent *e = Events.Range(mpFilter->FromClock, mpFilter->ToClock); - while (e) + JZEvent* pEvent = + Events.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); + while (pEvent) { - tKeyOn* pKeyOn = e->IsKeyOn(); + tKeyOn* pKeyOn = pEvent->IsKeyOn(); if (pKeyOn) { (this->*Action)(pKeyOn, t); } - e = Events.Next(); + pEvent = Events.Next(); } t->Cleanup(); } @@ -154,8 +155,8 @@ int HBAnalyzer::Step2Clock(int step) { - int fr = mpFilter->FromClock; - int to = mpFilter->ToClock; + int fr = mpFilter->GetFromClock(); + int to = mpFilter->GetToClock(); return (step * (to - fr)) / mSteps + fr; } Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2009-01-01 03:20:32 UTC (rev 672) +++ trunk/jazz/src/PianoWindow.cpp 2009-01-01 03:22:49 UTC (rev 673) @@ -1658,8 +1658,8 @@ { if (mpSnapSel->IsSelected()) { - Clock = mpFilter->FromClock; - LoopClock = mpFilter->ToClock; + Clock = mpFilter->GetFromClock(); + LoopClock = mpFilter->GetToClock(); } else { @@ -1828,46 +1828,32 @@ mpSnapSel->GetRectangle().y + mpSnapSel->GetRectangle().height - 1); int to = y2Pitch(mpSnapSel->GetRectangle().y + 1); - mpFilter->FltEvents[FltKeyOn].Selected = mVisibleKeyOn; - mpFilter->FltEvents[FltKeyOn].FromValue = fr; - mpFilter->FltEvents[FltKeyOn].ToValue = to; + mpFilter->SetFilterEvent(eFilterKeyOn, mVisibleKeyOn, fr, to); - mpFilter->FltEvents[FltPitch].Selected = mVisiblePitch; - mpFilter->FltEvents[FltPitch].FromValue = (fr << 7) - 8192; - mpFilter->FltEvents[FltPitch].ToValue = ((to + 1) << 7) - 8192; + mpFilter->SetFilterEvent( + eFilterPitch, + mVisiblePitch, + (fr << 7) - 8192, + ((to + 1) << 7) - 8192); - mpFilter->FltEvents[FltControl].Selected = mVisibleController; - mpFilter->FltEvents[FltControl].FromValue = fr; - mpFilter->FltEvents[FltControl].ToValue = to; + mpFilter->SetFilterEvent(eFilterControl, mVisibleController, fr, to); - mpFilter->FltEvents[FltProgram].Selected = mVisibleProgram; - mpFilter->FltEvents[FltProgram].FromValue = fr; - mpFilter->FltEvents[FltProgram].ToValue = to; + mpFilter->SetFilterEvent(eFilterProgram, mVisibleProgram, fr, to); - mpFilter->FltEvents[FltTempo].Selected = mVisibleTempo; - mpFilter->FltEvents[FltTempo].FromValue = fr; - mpFilter->FltEvents[FltTempo].ToValue = to; + mpFilter->SetFilterEvent(eFilterKeyPressure, mVisibleKeyOn, fr, to); - mpFilter->FltEvents[FltSysEx].Selected = mVisibleSysex; - mpFilter->FltEvents[FltSysEx].FromValue = fr; - mpFilter->FltEvents[FltSysEx].ToValue = to; + mpFilter->SetFilterMeter(mVisibleTempo); - // SN++ Aftertouch (gehoeren to KeyOn Events). - mpFilter->FltEvents[FltKeyPressure].Selected = mVisibleKeyOn; - mpFilter->FltEvents[FltKeyPressure].FromValue = fr; - mpFilter->FltEvents[FltKeyPressure].ToValue = to; + mpFilter->SetFilterChannelAftertouch(mVisibleMono); - // SN++ Channel Aftertouch - mpFilter->FltEvents[FltChnPressure].Selected = mVisibleMono; - mpFilter->FltEvents[FltChnPressure].FromValue = fr; - mpFilter->FltEvents[FltChnPressure].ToValue = to; + mpFilter->SetFilterSysEx(mVisibleSysex); - - mpFilter->FromTrack = mTrackIndex; - mpFilter->ToTrack = mTrackIndex; - mpFilter->FromClock = SnapClock(x2Clock(mpSnapSel->GetRectangle().x + 1)); - mpFilter->ToClock = SnapClock(x2Clock( - mpSnapSel->GetRectangle().x + mpSnapSel->GetRectangle().width + 1)); + mpFilter->SetFromTrack(mTrackIndex); + mpFilter->SetToTrack(mTrackIndex); + mpFilter->SetFromClock( + SnapClock(x2Clock(mpSnapSel->GetRectangle().x + 1))); + mpFilter->SetToClock(SnapClock(x2Clock( + mpSnapSel->GetRectangle().x + mpSnapSel->GetRectangle().width + 1))); } // SN++ Veloc- oder Aftertouch-Editor updaten @@ -2836,7 +2822,7 @@ { mPasteBuffer.Clear(); tCmdCopyToBuffer cmd(mpFilter, &mPasteBuffer); - mpFilter->OtherSelected = mVisibleTempo; + mpFilter->SetOtherSelected(mVisibleTempo); cmd.Execute(0); // no UNDO if (Id == wxID_CUT) { @@ -2844,7 +2830,7 @@ cmd.Execute(1); // with UNDO Refresh(); } - mpFilter->OtherSelected = 0; + mpFilter->SetOtherSelected(false); //OLD if (mpGuitarFrame) //OLD { //OLD mpGuitarFrame->Update(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:47:24
|
Revision: 676 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=676&view=rev Author: pstieber Date: 2009-01-01 03:47:21 +0000 (Thu, 01 Jan 2009) Log Message: ----------- 1. Changed the time converter to use an STL string instead of a char *. 2. Changed the tMtcTime class constructor to use an initializer list. 3. Used an output string stream instead of sprintf. Modified Paths: -------------- trunk/jazz/src/Track.cpp trunk/jazz/src/Track.h Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2009-01-01 03:32:09 UTC (rev 675) +++ trunk/jazz/src/Track.cpp 2009-01-01 03:47:21 UTC (rev 676) @@ -33,7 +33,10 @@ #include <cassert> #include <cstdlib> +#include <sstream> +using namespace std; + int tParam::Write(JZWriteBase& Io) { return mMsb.Write(Io) + mLsb.Write(Io) + mDataMsb.Write(Io); @@ -128,7 +131,11 @@ fm = (int) ((double) msec / frametime); } -tMtcTime::tMtcTime(char *str, tMtcType t) +tMtcTime::tMtcTime(char* str, tMtcType t) + : hour(0), + min(0), + sec(0), + fm(0) { type = t; if (type < Mtc24) @@ -139,10 +146,6 @@ { type = Mtc30Ndf; } - hour = 0; - min = 0; - sec = 0; - fm = 0; sscanf(str, "%d:%d:%d.%d", &hour, &min, &sec, &fm); if (fm >= framesPerSecond[type]) { @@ -167,9 +170,11 @@ } } -void tMtcTime::ToString(char *str) +void tMtcTime::ToString(string& String) { - sprintf(str, "%d:%d:%d.%d", hour, min, sec, fm); + ostringstream Oss; + Oss << hour << ':' << min << ':' << sec << '.' << fm; + String = Oss.str(); } tMtcOffset *tMtcTime::ToOffset() Modified: trunk/jazz/src/Track.h =================================================================== --- trunk/jazz/src/Track.h 2009-01-01 03:32:09 UTC (rev 675) +++ trunk/jazz/src/Track.h 2009-01-01 03:47:21 UTC (rev 676) @@ -27,6 +27,8 @@ #include "DynamicArray.h" #include "NamedValue.h" +#include <string> + class JZTrackWindow; class wxDialog; @@ -379,8 +381,8 @@ tMtcTime( int millisek, tMtcType t ); tMtcTime( char *str, tMtcType t ); tMtcTime( unsigned h, unsigned m, unsigned s, unsigned f, unsigned t ); - void ToString( char *str ); - tMtcOffset *ToOffset(); + void ToString(std::string& String); + tMtcOffset* ToOffset(); int ToMillisec(); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 08:46:42
|
Revision: 679 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=679&view=rev Author: pstieber Date: 2009-01-01 08:46:37 +0000 (Thu, 01 Jan 2009) Log Message: ----------- 1. Changed the return type of JZEventWindow::EventsSelected from int to bool. 2. Added ID_SHIFT. 3. Moved ... nect to menu entries. 4. Removed MEN_SHIFT from the piano frame and used ID_SHIFT instead. 5. Changed framesPerSecond to gFramesPerSecond in Track.cpp and made come cosmetic indentation changes. 6. Added an unimplemented shift entry to the Edit menu of the track frame. 7. Added AreEventsSelected to the track window. Happy New Year. Modified Paths: -------------- trunk/jazz/src/ControlEdit.cpp trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h trunk/jazz/src/PianoFrame.cpp trunk/jazz/src/Resources.h trunk/jazz/src/Sample.h trunk/jazz/src/SampleWindow.cpp trunk/jazz/src/Track.cpp trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/ControlEdit.cpp =================================================================== --- trunk/jazz/src/ControlEdit.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/ControlEdit.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -75,7 +75,7 @@ // PORTING: changed the calls a bit so it would compile, need to remake the layout and do the event bindings - ctrlmode = 0; // edit seems stupid to me ... + ctrlmode = 0; // Edit seems stupid to me. wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/EventWindow.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -106,14 +106,14 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZEventWindow::EventsSelected(const wxString& Message) const +bool JZEventWindow::EventsSelected(const wxString& Message) const { if (!mpSnapSel->IsSelected()) { wxMessageBox(Message, "Error", wxOK); - return 0; + return false; } - return 1; + return true; } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/EventWindow.h 2009-01-01 08:46:37 UTC (rev 679) @@ -57,7 +57,7 @@ // WARNING: non-constant access. JZSong* GetSong() const; - int EventsSelected(const wxString& Message) const; + bool EventsSelected(const wxString& Message) const; void LineText( wxDC& Dc, Modified: trunk/jazz/src/PianoFrame.cpp =================================================================== --- trunk/jazz/src/PianoFrame.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/PianoFrame.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -58,7 +58,6 @@ #define MEN_METERCH 8 #define ACT_HELP_MOUSE 9 -#define MEN_SHIFT 11 #define MEN_QUANTIZE 12 #define MEN_SETCHAN 14 #define MEN_TRANSP 15 @@ -174,7 +173,7 @@ EVT_MENU(wxID_DELETE, JZPianoFrame::OnErase) EVT_MENU(wxID_CUT, JZPianoFrame::OnCut) EVT_MENU(wxID_COPY, JZPianoFrame::OnCopy) - EVT_MENU(MEN_SHIFT, JZPianoFrame::OnShift) + EVT_MENU(ID_SHIFT, JZPianoFrame::OnShift) EVT_MENU(MEN_SHIFTL, JZPianoFrame::OnShiftLeft) EVT_MENU(MEN_SHIFTR, JZPianoFrame::OnShiftRight) EVT_MENU(MEN_LERI, JZPianoFrame::OnExchangeLeftRight) @@ -336,28 +335,28 @@ edit_menu->Append(wxID_DELETE, "&Delete"); edit_menu->Append(wxID_COPY, "&Copy"); edit_menu->Append(wxID_CUT, "&Cut"); - edit_menu->Append(MEN_SHIFT, "&Shift ..."); - edit_menu->Append(MEN_QUANTIZE, "&Quantize ..."); - edit_menu->Append(MEN_SETCHAN, "&Set MIDI Channel ..."); - edit_menu->Append(MEN_TRANSP, "&Transpose ..."); - edit_menu->Append(MEN_VELOC, "&Velocity ..."); - edit_menu->Append(MEN_LENGTH, "&Length ..."); + edit_menu->Append(ID_SHIFT, "&Shift..."); + edit_menu->Append(MEN_QUANTIZE, "&Quantize..."); + edit_menu->Append(MEN_SETCHAN, "&Set MIDI Channel..."); + edit_menu->Append(MEN_TRANSP, "&Transpose..."); + edit_menu->Append(MEN_VELOC, "&Velocity..."); + edit_menu->Append(MEN_LENGTH, "&Length..."); - edit_menu->Append(MEN_SEQLENGTH, "&Sequence Length ..."); - edit_menu->Append(MEN_MIDIDELAY, "&Midi Delay ..."); + edit_menu->Append(MEN_SEQLENGTH, "&Sequence Length..."); + edit_menu->Append(MEN_MIDIDELAY, "&Midi Delay..."); edit_menu->Append(MEN_CONVERT_TO_MODULATION, "&Convert to Modulation(experimental)"); edit_menu->Append(MEN_LERI, "&Left <-> Right"); edit_menu->Append(MEN_UPDN, "&Up <-> Down"); - edit_menu->Append(MEN_CLEANUP, "&Cleanup ..."); - edit_menu->Append(MEN_SEARCHREP, "&Search Replace ..."); + edit_menu->Append(MEN_CLEANUP, "&Cleanup..."); + edit_menu->Append(MEN_SEARCHREP, "&Search Replace..."); wxMenu *setting_menu = new wxMenu("",wxMENU_TEAROFF); - setting_menu->Append(MEN_FILTER, "&Filter ..."); - setting_menu->Append(ACT_SETTINGS, "&Window ..."); + setting_menu->Append(MEN_FILTER, "&Filter..."); + setting_menu->Append(ACT_SETTINGS, "&Window..."); setting_menu->Append(MEN_VISIBLE, "&Events..."); - setting_menu->Append(MEN_SNAP, "&Snap ..."); - setting_menu->Append(MEN_METERCH, "&Meterchange ..."); + setting_menu->Append(MEN_SNAP, "&Snap..."); + setting_menu->Append(MEN_METERCH, "&Meterchange..."); wxMenu *misc_menu = new wxMenu("",wxMENU_TEAROFF); misc_menu->Append(wxID_UNDO, "&Undo"); @@ -369,7 +368,7 @@ misc_menu->Append(MEN_CTRL_POLY_AFTER, "Edit &Key Aftertouch"); misc_menu->Append(MEN_CTRL_CHANNEL_AFTER, "Edit &Chn Aftertouch"); - misc_menu->Append(MEN_CTRL_CONTR, "Edit &Controller ..."); + misc_menu->Append(MEN_CTRL_CONTR, "Edit &Controller..."); misc_menu->Append(MEN_CTRL_TEMPO, "Edit &Tempo"); misc_menu->Append(MEN_CTRL_NONE, "Edit &None"); misc_menu->Append(MEN_GUITAR, "&Guitar board"); Modified: trunk/jazz/src/Resources.h =================================================================== --- trunk/jazz/src/Resources.h 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/Resources.h 2009-01-01 08:46:37 UTC (rev 679) @@ -46,15 +46,16 @@ #define ID_TRIM wxID_HIGHEST + 30 #define ID_QUANTIZE wxID_HIGHEST + 31 -#define ID_SHIFT_LEFT wxID_HIGHEST + 32 -#define ID_SHIFT_RIGHT wxID_HIGHEST + 33 -#define ID_SNAP_8 wxID_HIGHEST + 34 -#define ID_SNAP_8D wxID_HIGHEST + 35 -#define ID_SNAP_16 wxID_HIGHEST + 36 -#define ID_SNAP_16D wxID_HIGHEST + 37 -#define ID_MIXER wxID_HIGHEST + 38 -#define ID_PIANOWIN wxID_HIGHEST + 39 -#define ID_METRONOME_TOGGLE wxID_HIGHEST + 40 +#define ID_SHIFT wxID_HIGHEST + 32 +#define ID_SHIFT_LEFT wxID_HIGHEST + 33 +#define ID_SHIFT_RIGHT wxID_HIGHEST + 34 +#define ID_SNAP_8 wxID_HIGHEST + 35 +#define ID_SNAP_8D wxID_HIGHEST + 36 +#define ID_SNAP_16 wxID_HIGHEST + 37 +#define ID_SNAP_16D wxID_HIGHEST + 38 +#define ID_MIXER wxID_HIGHEST + 39 +#define ID_PIANOWIN wxID_HIGHEST + 40 +#define ID_METRONOME_TOGGLE wxID_HIGHEST + 41 #define ID_PLAY wxID_HIGHEST + 50 #define ID_PLAY_LOOP wxID_HIGHEST + 51 Modified: trunk/jazz/src/Sample.h =================================================================== --- trunk/jazz/src/Sample.h 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/Sample.h 2009-01-01 08:46:37 UTC (rev 679) @@ -270,7 +270,7 @@ void Clear(); void GotoRAM() { - // try to swap this sample into memory ... + // Try to swap this sample into memory. volatile short dummy; for (int i = 0; i < length; i++) dummy = data[i]; Modified: trunk/jazz/src/SampleWindow.cpp =================================================================== --- trunk/jazz/src/SampleWindow.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/SampleWindow.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -322,7 +322,7 @@ wxDC* pDc = new wxClientDC(this); - // tSnapSel is strange ... + // tSnapSel is strange. if (e.LeftDown()) { mouse_up_sets_insertion_point = 0; @@ -739,11 +739,11 @@ menu_bar->Append(menu, "&Edit"); menu = new wxMenu; - menu->Append(MEN_VOLUME_PNT, "&Volume ..."); - menu->Append(MEN_PAN_PNT, "&Panpot ..."); - menu->Append(MEN_TRANSP_PNT, "&Pitch ..."); - menu->Append(MEN_WAHWAH, "&Filter ..."); - menu->Append(MEN_CANCEL, "&None ..."); + menu->Append(MEN_VOLUME_PNT, "&Volume..."); + menu->Append(MEN_PAN_PNT, "&Panpot..."); + menu->Append(MEN_TRANSP_PNT, "&Pitch..."); + menu->Append(MEN_WAHWAH, "&Filter..."); + menu->Append(MEN_CANCEL, "&None..."); menu_bar->Append(menu, "&Painters"); menu = new wxMenu; @@ -760,8 +760,8 @@ menu_bar->Append(menu, "&Effects"); menu = new wxMenu; - menu->Append(MEN_TRANSP_SET, "&Pitch Painter ..."); - menu->Append(MEN_WAHSETTINGS, "&Filter Painter ..."); + menu->Append(MEN_TRANSP_SET, "&Pitch Painter..."); + menu->Append(MEN_WAHSETTINGS, "&Filter Painter..."); // menu->Append(wxID_ZOOM_IN, "Zoom &In"); // menu->Append(wxID_ZOOM_OUT, "Zoom &Out"); menu->Append(MEN_SETTINGS, "&View Settings..."); @@ -955,7 +955,7 @@ return; } - // player crashes if data disappear ... + // Player crashes if data disappear. if (id != MEN_PLAY) { cnvs->playpos->StopListen(); Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/Track.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -90,7 +90,13 @@ } */ -static double framesPerSecond[] = { 24.0, 25.0, 30.0, 30.0 }; +static double gFramesPerSecond[] = +{ + 24.0, + 25.0, + 30.0, + 30.0 +}; tMtcTime::tMtcTime(tMtcOffset* pMtcOffset) { @@ -127,7 +133,7 @@ sec = sec % 60; hour = min / 60; min = min % 60; - double frametime = 1000.0 / framesPerSecond[type]; + double frametime = 1000.0 / gFramesPerSecond[type]; fm = (int) ((double) msec / frametime); } @@ -147,9 +153,9 @@ type = Mtc30Ndf; } sscanf(str, "%d:%d:%d.%d", &hour, &min, &sec, &fm); - if (fm >= framesPerSecond[type]) + if (fm >= gFramesPerSecond[type]) { - fm = (int) framesPerSecond[type] - 1; + fm = (int) gFramesPerSecond[type] - 1; } } @@ -193,7 +199,7 @@ int tMtcTime::ToMillisec() { int msec = (((((hour * 60L) + min) * 60L) + sec) * 1000L) + - ((fm * 1000L) / (int) framesPerSecond[type]); + ((fm * 1000L) / (int) gFramesPerSecond[type]); return msec; } Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/TrackFrame.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -85,6 +85,9 @@ EVT_MENU(wxID_EXIT, JZTrackFrame::OnFileExit) + EVT_UPDATE_UI(ID_SHIFT, JZTrackFrame::OnUpdateEditShift) + EVT_MENU(ID_SHIFT, JZTrackFrame::OnEditShift) + EVT_MENU(ID_PLAY, JZTrackFrame::OnPlay) EVT_MENU(ID_PLAY_LOOP, JZTrackFrame::OnPlayLoop) @@ -236,6 +239,17 @@ mpEditMenu->AppendSeparator(); +// mpEditMenu->Append(MEN_QUANTIZE, "&Quantize..."); +// mpEditMenu->Append(MEN_SETCHAN, "&Set MIDI Channel..."); +// mpEditMenu->Append(MEN_TRANSP, "&Transpose..."); +// mpEditMenu->Append(MEN_VELOC, "&Velocity..."); +// mpEditMenu->Append(MEN_LENGTH, "&Length..."); + mpEditMenu->Append(ID_SHIFT, "Shi&ft..."); +// mpEditMenu->Append(MEN_CLEANUP, "C&leanup..."); +// mpEditMenu->Append(MEN_SEARCHREP, "Search Re&place..."); + + mpEditMenu->AppendSeparator(); + mpEditMenu->Append(wxID_DELETE, "&Delete"); mpEditMenu->Append(wxID_DELETE, "&Silence"); @@ -251,16 +265,6 @@ mpEditMenu->AppendSeparator(); - /* Move Elsewhere - mpEditMenu->Append(MEN_QUANTIZE, "&Quantize..."); - mpEditMenu->Append(MEN_SETCHAN, "&Set MIDI Channel..."); - mpEditMenu->Append(MEN_TRANSP, "&Transpose..."); - mpEditMenu->Append(MEN_VELOC, "&Velocity..."); - mpEditMenu->Append(MEN_LENGTH, "&Length..."); - mpEditMenu->Append(MEN_SHIFT, "Shi&ft..."); - mpEditMenu->Append(MEN_CLEANUP, "C&leanup..."); - mpEditMenu->Append(MEN_SEARCHREP, "Search Re&place..."); - */ // Miscellaneous Menu is Stupid. // Now it's a View Menu @@ -521,6 +525,19 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackFrame::OnUpdateEditShift(wxUpdateUIEvent& Event) +{ + Event.Enable(mpTrackWindow->AreEventsSelected()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZTrackFrame::OnEditShift(wxCommandEvent& Event) +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackFrame::OnPlay(wxCommandEvent& Event) { wxMouseEvent MouseEvent; Modified: trunk/jazz/src/TrackFrame.h =================================================================== --- trunk/jazz/src/TrackFrame.h 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/TrackFrame.h 2009-01-01 08:46:37 UTC (rev 679) @@ -82,6 +82,9 @@ void OnZoomOut(wxCommandEvent& Event); + void OnUpdateEditShift(wxUpdateUIEvent& Event); + void OnEditShift(wxCommandEvent& Event); + void OnPlay(wxCommandEvent& Event); void OnPlayLoop(wxCommandEvent& Event); Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/TrackWindow.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -1229,6 +1229,13 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +bool JZTrackWindow::AreEventsSelected() +{ + return mpSnapSel->IsSelected(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int JZTrackWindow::EventsSelected(const wxString& Message) { if (!mpSnapSel->IsSelected()) Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/TrackWindow.h 2009-01-01 08:46:37 UTC (rev 679) @@ -75,6 +75,8 @@ void MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode); + bool AreEventsSelected(); + int EventsSelected(const wxString& Message); void ZoomIn(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-19 17:45:26
|
Revision: 682 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=682&view=rev Author: pstieber Date: 2009-01-19 17:45:14 +0000 (Mon, 19 Jan 2009) Log Message: ----------- Added a function to determine if events are selected. Modified Paths: -------------- trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2009-01-02 19:13:35 UTC (rev 681) +++ trunk/jazz/src/TrackWindow.cpp 2009-01-19 17:45:14 UTC (rev 682) @@ -1229,13 +1229,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool JZTrackWindow::AreEventsSelected() -{ - return mpSnapSel->IsSelected(); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- int JZTrackWindow::EventsSelected(const wxString& Message) { if (!mpSnapSel->IsSelected()) Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2009-01-02 19:13:35 UTC (rev 681) +++ trunk/jazz/src/TrackWindow.h 2009-01-19 17:45:14 UTC (rev 682) @@ -75,8 +75,6 @@ void MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode); - bool AreEventsSelected(); - int EventsSelected(const wxString& Message); void ZoomIn(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-19 17:53:41
|
Revision: 684 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=684&view=rev Author: pstieber Date: 2009-01-19 17:53:36 +0000 (Mon, 19 Jan 2009) Log Message: ----------- 1. Moved the declaration of the snap selection and filter data members. 2. Added code for determining if events are selected and shifting events. This is a WIP. Modified Paths: -------------- trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-01-19 17:47:16 UTC (rev 683) +++ trunk/jazz/src/EventWindow.cpp 2009-01-19 17:53:36 UTC (rev 684) @@ -22,6 +22,7 @@ #include "EventWindow.h" +#include "Dialogs/ShiftDialog.h" #include "EventFrame.h" #include "Filter.h" #include "MouseAction.h" @@ -104,6 +105,13 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +bool JZEventWindow::AreEventsSelected() +{ + return mpSnapSel->IsSelected(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- bool JZEventWindow::EventsSelected(const wxString& Message) const { if (!mpSnapSel->IsSelected()) @@ -116,6 +124,22 @@ //----------------------------------------------------------------------------- // Description: +// Display the "shift events" dialog. +//----------------------------------------------------------------------------- +void JZEventWindow::Shift(int Units) +{ + if (AreEventsSelected()) + { + JZShiftDialog ShiftDialog(*this, *mpFilter, this); + + if (ShiftDialog.ShowModal() == wxID_OK) + { + } + } +} + +//----------------------------------------------------------------------------- +// Description: // Only consider the event portion of the window when computing the virtual // size. Do not consider the static information of the left or top portion of // the screen. Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2009-01-19 17:47:16 UTC (rev 683) +++ trunk/jazz/src/EventWindow.h 2009-01-19 17:53:36 UTC (rev 684) @@ -38,10 +38,6 @@ { public: - JZSnapSelection* mpSnapSel; - - JZFilter* mpFilter; - JZEventWindow( wxFrame* pParent, JZSong* pSong, @@ -53,8 +49,12 @@ // WARNING: non-constant access. JZSong* GetSong() const; + bool AreEventsSelected(); + bool EventsSelected(const wxString& Message) const; + void Shift(int Units); + void LineText( wxDC& Dc, int x, @@ -92,6 +92,12 @@ int y2yLine(int y, int Up = 0); + public: + + JZSnapSelection* mpSnapSel; + + JZFilter* mpFilter; + protected: JZSong* mpSong; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-19 17:56:33
|
Revision: 685 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=685&view=rev Author: pstieber Date: 2009-01-19 17:56:29 +0000 (Mon, 19 Jan 2009) Log Message: ----------- 1. Added a pointer to the associated event window as a data member. 2. Added event handlers for shifting events. This is a WIP. Modified Paths: -------------- trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventFrame.h Modified: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp 2009-01-19 17:53:36 UTC (rev 684) +++ trunk/jazz/src/EventFrame.cpp 2009-01-19 17:56:29 UTC (rev 685) @@ -1,10 +1,11 @@ #include "EventFrame.h" #include "Command.h" -#include "Dialogs/ShiftDialog.h" #include "Dialogs.h" +#include "EventWindow.h" #include "Filter.h" #include "MouseAction.h" +#include "Resources.h" #include "ToolBar.h" #include <wx/dc.h> @@ -21,18 +22,23 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- BEGIN_EVENT_TABLE(JZEventFrame, wxFrame) + + EVT_UPDATE_UI(ID_SHIFT, JZEventFrame::OnUpdateEditShift) + EVT_MENU(ID_SHIFT, JZEventFrame::OnEditShift) + EVT_SIZE(JZEventFrame::OnSize) + END_EVENT_TABLE() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZEventFrame::JZEventFrame( - wxWindow* pParent, + JZEventWindow* pEventWindow, const wxString& Title, JZSong* pSong, const wxPoint& Position, const wxSize& Size) - : wxFrame(pParent, wxID_ANY, Title, Position, Size), + : wxFrame(pEventWindow, wxID_ANY, Title, Position, Size), Song(pSong), mpFilter(0), mpFixedFont(0), @@ -60,7 +66,8 @@ MixerForm(0), mpToolBar(0), mpGreyColor(0), - mpGreyBrush(0) + mpGreyBrush(0), + mpEventWindow(pEventWindow) { #ifdef __WXMSW__ mpGreyColor = new wxColor(192, 192, 192); @@ -149,6 +156,20 @@ } //----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::OnUpdateEditShift(wxUpdateUIEvent& Event) +{ + Event.Enable(mpEventWindow->AreEventsSelected()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::OnEditShift(wxCommandEvent& Event) +{ +// mpEventWindow->Shift(); +} + +//----------------------------------------------------------------------------- // this onsize handler is supposed to take care of handling of the resizing // the two subwindows sizes to they dont overlap //----------------------------------------------------------------------------- @@ -455,22 +476,7 @@ } //----------------------------------------------------------------------------- -// show the "shift events" dialog //----------------------------------------------------------------------------- -void JZEventFrame::MenShift(int Unit) -{ - if (EventsSelected()) - { - JZShiftDialog ShiftDialog(*this, *mpFilter, this); - - if (ShiftDialog.ShowModal() == wxID_OK) - { - } - } -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- void JZEventFrame::MenDelete() { if (!EventsSelected()) Modified: trunk/jazz/src/EventFrame.h =================================================================== --- trunk/jazz/src/EventFrame.h 2009-01-19 17:53:36 UTC (rev 684) +++ trunk/jazz/src/EventFrame.h 2009-01-19 17:56:29 UTC (rev 685) @@ -25,6 +25,7 @@ #include <wx/frame.h> +class JZEventWindow; class JZFilter; class JZSnapSelection; class JZSong; @@ -34,10 +35,9 @@ //***************************************************************************** // Description: -// A frame window that containes a scrolled event window. Acts as the -// common base class for JZTrackFrame and JSPianoFrame. -// -// The panel and menu are administered by derived classes. +// A frame window that containes a scrolled event window. This class acts +// as the common base class for the JZTrackFrame class and the JZPianoFrame +// class. // Functionality: // - Settings dialog // - Selection via Snapsel @@ -46,12 +46,9 @@ { public: - bool OnCharHook(wxKeyEvent& event); - void OnChar(wxKeyEvent& event); - // 2-step initialization: 1) constructor JZEventFrame( - wxWindow* pParent, + JZEventWindow* pEventWindow, const wxString& Title, JZSong* pSong, const wxPoint& Position = wxDefaultPosition, @@ -104,7 +101,6 @@ // Events virtual int OnMouseEvent(wxMouseEvent& Event); virtual bool OnKeyEvent(wxKeyEvent& Event); // true = processed by eventwin - virtual void OnSize(wxSizeEvent& Event); virtual void OnMenuCommand(int id); virtual bool OnClose(); @@ -123,10 +119,20 @@ // if selection active: TRUE, else: Errormessage + FALSE int EventsSelected(const char* msg = 0); + private: + + void OnUpdateEditShift(wxUpdateUIEvent& Event); + void OnEditShift(wxCommandEvent& Event); + + void OnSize(wxSizeEvent& Event); + + bool OnCharHook(wxKeyEvent& Event); + + void OnChar(wxKeyEvent& Event); + void MenQuantize(); void MenSetChannel(); void MenTranspose(); - void MenShift(int Unit); void MenDelete(); void MenVelocity(); void MenLength(); @@ -143,6 +149,8 @@ wxColor* mpGreyColor; wxBrush* mpGreyBrush; + JZEventWindow* mpEventWindow; + DECLARE_EVENT_TABLE() }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-20 03:39:57
|
Revision: 690 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=690&view=rev Author: pstieber Date: 2009-01-20 03:39:55 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Commented out tShiftDlg. Modified Paths: -------------- trunk/jazz/src/Dialogs.cpp trunk/jazz/src/Dialogs.h Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2009-01-20 03:37:24 UTC (rev 689) +++ trunk/jazz/src/Dialogs.cpp 2009-01-20 03:39:55 UTC (rev 690) @@ -53,56 +53,54 @@ // ************************************************************************* //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -tShiftDlg::tShiftDlg(JZEventFrame* pEventWindow, JZFilter* pFilter, long unit) - : tPropertyListDlg("Shift events left/right"), - mSteps(0), - mUnit(unit), - mpFilter(pFilter), - mpSong(pFilter->GetSong()) -{ -} +//tShiftDlg::tShiftDlg(JZEventFrame* pEventWindow, JZFilter* pFilter, long unit) +// : tPropertyListDlg("Shift events left/right"), +// mSteps(0), +// mUnit(unit), +// mpFilter(pFilter), +// mpSong(pFilter->GetSong()) +//{ +//} //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool tShiftDlg::OnClose() -{ - cout << "tShiftDlg::OnClose " << mSteps << endl; - tCmdShift cmd(mpFilter, mSteps * mUnit); - cmd.Execute(); +//bool tShiftDlg::OnClose() +//{ +// cout << "tShiftDlg::OnClose " << mSteps << endl; +// tCmdShift cmd(mpFilter, mSteps * mUnit); +// cmd.Execute(); +// +// JZProjectManager::Instance()->UpdateAllViews(); +// +// // wxForm::OnOk(); +// return false; +//} - JZProjectManager::Instance()->UpdateAllViews(); - - // wxForm::OnOk(); - return false; -} - //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void tShiftDlg::OnHelp() -{ - gpHelpInstance->ShowTopic("Shift"); -} +//void tShiftDlg::OnHelp() +//{ +// gpHelpInstance->ShowTopic("Shift"); +//} //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void tShiftDlg::AddProperties() -{ -//send wxPropertyValue REFERENCE not POINTER - sheet->AddProperty(new wxProperty( - "Snaps", - wxPropertyValue(&mSteps), - "integer", - new wxIntegerListValidator(-16, 16))); +//void tShiftDlg::AddProperties() +//{ +////send wxPropertyValue REFERENCE not POINTER +// sheet->AddProperty(new wxProperty( +// "Snaps", +// wxPropertyValue(&mSteps), +// "integer", +// new wxIntegerListValidator(-16, 16))); +// +// sheet->AddProperty(new wxProperty( +// "clocks per snap", +// (long)mUnit, +// "integer")); // informational only +//} - sheet->AddProperty(new wxProperty( - "clocks per snap", - (long)mUnit, - "integer")); // informational only -} - - - // ************************************************************************** // Cleanup // ************************************************************************* Modified: trunk/jazz/src/Dialogs.h =================================================================== --- trunk/jazz/src/Dialogs.h 2009-01-20 03:37:24 UTC (rev 689) +++ trunk/jazz/src/Dialogs.h 2009-01-20 03:39:55 UTC (rev 690) @@ -33,22 +33,22 @@ class JZTrack; class JZEvent; -class tShiftDlg : public tPropertyListDlg -{ - public: +//class tShiftDlg : public tPropertyListDlg +//{ +// public: +// +// long mSteps; // 0 was static +// long mUnit; +// +// JZFilter* mpFilter; +// JZSong* mpSong; +// +// tShiftDlg(JZEventFrame* pEventWindow, JZFilter* pFilter, long Unit); +// void AddProperties(); +// bool OnClose(); +// void OnHelp(); +//}; - long mSteps; // 0 was static - long mUnit; - - JZFilter* mpFilter; - JZSong* mpSong; - - tShiftDlg(JZEventFrame* pEventWindow, JZFilter* pFilter, long Unit); - void AddProperties(); - bool OnClose(); - void OnHelp(); -}; - class tCleanupDlg : public tPropertyListDlg { public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-20 03:46:34
|
Revision: 691 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=691&view=rev Author: pstieber Date: 2009-01-20 03:46:28 +0000 (Tue, 20 Jan 2009) Log Message: ----------- 1. Added class and function comment headers. 2. Used pre increment instead of post increment for loop variables. 3. Made some style changes (e -> pEvent...). 4. Translated some German. Modified Paths: -------------- trunk/jazz/src/Command.cpp trunk/jazz/src/Command.h Modified: trunk/jazz/src/Command.cpp =================================================================== --- trunk/jazz/src/Command.cpp 2009-01-20 03:39:55 UTC (rev 690) +++ trunk/jazz/src/Command.cpp 2009-01-20 03:46:28 UTC (rev 691) @@ -75,8 +75,9 @@ void tCommand::ExecuteTrack(JZTrack* pTrack) { tEventIterator Iterator(pTrack); - JZEvent* pEvent = - Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); + JZEvent* pEvent = Iterator.Range( + mpFilter->GetFromClock(), + mpFilter->GetToClock()); while (pEvent) { if (mpFilter->IsSelected(pEvent)) @@ -147,64 +148,71 @@ //***************************************************************************** // tScale //***************************************************************************** - // c d e f g a b +//----------------------------------------------------------------------------- +// Description: +// This is a C-major scale. +// c d e f g a b +//----------------------------------------------------------------------------- static const int CMajor[12] = { 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 }; +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tScale::Init(int ScaleNr, JZFilter* pFilter) { - int i; - - for (i = 0; i < 12; i++) + for (int i = 0; i < 12; ++i) { ScaleKeys[i] = 0; } if (ScaleNr == gScaleChromatic) { - for (i = 0; i < 12; i++) + for (int i = 0; i < 12; ++i) + { ScaleKeys[i] = 1; + } } - else if (ScaleNr == gScaleSelected) { - int found = 0; + bool Found = false; tSelectedKeys cmd(pFilter); cmd.Execute(0); - for (i = 0; i < 128; i++) + for (int i = 0; i < 128; ++i) { if (cmd.Keys[i]) { ScaleKeys[ i % 12 ] = 1; - found = 1; + Found = true; } } - if (!found) + if (!Found) { ScaleKeys[0] = 1; // avoid loop in Member() } } - else { - for (i = 0; i < 12; i++) + for (int i = 0; i < 12; ++i) + { ScaleKeys[ (i + ScaleNr) % 12 ] = CMajor[i]; + } } } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tScale::Analyze(JZFilter* pFilter) { - long keys[12]; - for (int i = 0; i < 12; i++) + long Keys[12]; + for (int i = 0; i < 12; ++i) { - keys[i] = 0; + Keys[i] = 0; } tSelectedKeys cmd(pFilter); cmd.Execute(0); - for (int i = 0; i < 128; i++) + for (int i = 0; i < 128; ++i) { - keys[i % 12] += cmd.Keys[i]; + Keys[i % 12] += cmd.Keys[i]; } long Min = std::numeric_limits<long>::max(); @@ -218,7 +226,7 @@ { if (Scale.ScaleKeys[i] == 0) { - Error += keys[i]; + Error += Keys[i]; } } if (Error < Min) @@ -231,78 +239,91 @@ return ScaleIndex; } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tScale::Next(int Key) { do - ++ Key; - while (!Member(Key)); + { + ++Key; + } while (!Member(Key)); return Key; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tScale::Prev(int Key) { do - -- Key; - while (!Member(Key)); + { + --Key; + } while (!Member(Key)); return Key; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tScale::Transpose(int Key, int Steps) { int Offset = 0; while (!Member(Key)) { - ++ Key; - ++ Offset; + ++Key; + ++Offset; } while (Steps > 0) { Key = Next(Key); - -- Steps; + --Steps; } while (Steps < 0) { Key = Prev(Key); - ++ Steps; + ++Steps; } return Key - Offset; } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tScale::FitInto(int Key) { int Offset = 0; while (!Member(Key)) { - ++ Offset; + ++Offset; if (Offset & 1) + { Key += Offset; + } else + { Key -= Offset; + } } return Key; } -// *********************************************************************** +//***************************************************************************** // tCmdShift -// *********************************************************************** - -tCmdShift::tCmdShift(JZFilter* pFilter, long dclk) - : tCommand(pFilter) +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +tCmdShift::tCmdShift(JZFilter* pFilter, long DeltaClock) + : tCommand(pFilter), + mDeltaClock(DeltaClock) { - DeltaClock = dclk; } void tCmdShift::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent) { - JZEvent* c = pEvent->Copy(); + JZEvent* pEventCopy = pEvent->Copy(); pTrack->Kill(pEvent); - c->SetClock(c->GetClock() + DeltaClock); - pTrack->Put(c); + pEventCopy->SetClock(pEventCopy->GetClock() + mDeltaClock); + pTrack->Put(pEventCopy); } // ************************************************************************ @@ -694,7 +715,7 @@ { if (pEvent->IsKeyOn()) { - // only echo note events + // Only echo note events. pKeyOn = (tKeyOn *)pEvent->Copy(); pKeyOn->SetClock(pKeyOn->GetClock()+ clockDelay * i); pKeyOn->SetVelocity( @@ -853,9 +874,9 @@ if (s && d) { - // Events nach tmp kopieren tEventArray tmp; { + // Events after temporary copy. tEventIterator Iterator(s); long DeltaClock = StartClock - mpFilter->GetFromClock(); JZEvent* pEvent = @@ -882,8 +903,6 @@ } } - // ggf Freien Platz einfuegen - if (InsertSpace && d->GetLastClock() > StartClock) { tEventIterator Iterator(d); @@ -903,10 +922,9 @@ d->Cleanup(); } - // ggf Quelle loeschen - if (EraseSource) { + // Delete source. tEventIterator Iterator(s); JZEvent* pEvent = Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) @@ -920,10 +938,9 @@ s->Cleanup(); } - // ggf Ziel loeschen - if (EraseDestin) { + // Delete destination. tEventIterator Iterator(d); JZEvent* pEvent = Iterator.Range(StartClock, StopClock); while (pEvent) @@ -937,7 +954,7 @@ d->Cleanup(); } - // tmp und Zieltrack zusammenmischen, aufraeumen + // tmp track and target mix, aufraeumen d->Merge(&tmp); d->Cleanup(); Modified: trunk/jazz/src/Command.h =================================================================== --- trunk/jazz/src/Command.h 2009-01-20 03:39:55 UTC (rev 690) +++ trunk/jazz/src/Command.h 2009-01-20 03:46:28 UTC (rev 691) @@ -32,6 +32,8 @@ class JZBarInfo; class tKeyOn; +//***************************************************************************** +//***************************************************************************** class tScale { public: @@ -50,7 +52,8 @@ static int Analyze(JZFilter* pFilter); // returns ScaleNr }; - +//***************************************************************************** +//***************************************************************************** class tCommand { public: @@ -74,16 +77,22 @@ bool mReverse; }; - +//***************************************************************************** +//***************************************************************************** class tCmdShift : public tCommand { - long DeltaClock; public: + tCmdShift(JZFilter* pFilter, long DeltaClock); virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); + + private: + + long mDeltaClock; }; - +//***************************************************************************** +//***************************************************************************** class tCmdErase : public tCommand { public: @@ -93,6 +102,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; +//***************************************************************************** +//***************************************************************************** class tCmdVelocity : public tCommand { public: @@ -101,7 +112,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdLength : public tCommand { public: @@ -110,7 +122,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdSeqLength : public tCommand { public: @@ -120,8 +133,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - - +//***************************************************************************** +//***************************************************************************** class tCmdMidiDelay : public tCommand { public: @@ -137,6 +150,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; +//***************************************************************************** +//***************************************************************************** class tCmdConvertToModulation : public tCommand { public: @@ -145,10 +160,8 @@ virtual void ExecuteTrack(JZTrack* pTrack); }; - - - - +//***************************************************************************** +//***************************************************************************** class tCmdCleanup : public tCommand { long lengthLimit; @@ -160,7 +173,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdSearchReplace : public tCommand { short fr, to; @@ -169,7 +183,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdQuantize : public tCommand { long Quantize(long Clock, int islen); @@ -183,7 +198,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdTranspose : public tCommand { public: @@ -198,7 +214,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdSetChannel : public tCommand { public: @@ -207,7 +224,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdCopyToBuffer : public tCommand { public: @@ -221,8 +239,8 @@ tEventArray* mpBuffer; }; - - +//***************************************************************************** +//***************************************************************************** class tCmdCopy : public tCommand { public: @@ -238,8 +256,8 @@ virtual void ExecuteTrack(JZTrack* pTrack); }; - - +//***************************************************************************** +//***************************************************************************** class tCmdExchLeftRight : public tCommand { public: @@ -247,6 +265,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; +//***************************************************************************** +//***************************************************************************** class tCmdExchUpDown : public tCommand { public: @@ -254,6 +274,8 @@ virtual void ExecuteTrack(JZTrack* pTrack); }; +//***************************************************************************** +//***************************************************************************** class tCmdMapper : public tCommand { public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-20 04:14:10
|
Revision: 692 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=692&view=rev Author: pstieber Date: 2009-01-20 04:14:04 +0000 (Tue, 20 Jan 2009) Log Message: ----------- 1. Put the proper controls in the new shift dialog. 2. Made the event frame usable by derived classes and started leaning up this class. Most of the stuff that is in it should be in the event window class, but the old dialogs still rely on the code being there. 3. Added event shift handling to the event window. 4. Changed or removed comments in the piano window header. 5. Changed tSynthSysex::Reset() to tSynthSysex::CreateResetEvent(). 6. Attempted to prevent leaks in the player code when reset is sent. 7. Cleared all of the tracks in JZSong::Clear. 8. Changed e to pEvent in the track code and changed Reset to mpReset. 9. Deleted mpReset in JZTrack::Clear. 10. Fixed a leak in the track code by using a local instance of tJazzMeta. 11. Derived JZTrackFrame form JZEventFrame and let the base class deal with shift event handling. Modified Paths: -------------- trunk/jazz/src/Dialogs/ShiftDialog.cpp trunk/jazz/src/Dialogs/ShiftDialog.h trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventFrame.h trunk/jazz/src/EventWindow.cpp trunk/jazz/src/PianoWindow.h trunk/jazz/src/Player.cpp trunk/jazz/src/Song.cpp trunk/jazz/src/Synth.h trunk/jazz/src/Track.cpp trunk/jazz/src/Track.h trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h Modified: trunk/jazz/src/Dialogs/ShiftDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/ShiftDialog.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Dialogs/ShiftDialog.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -23,16 +23,13 @@ #include "../Command.h" #include "../Filter.h" #include "../ProjectManager.h" -#include "IntegerEdit.h" #include <wx/button.h> -#include <wx/checkbox.h> -#include <wx/msgdlg.h> #include <wx/sizer.h> +#include <wx/slider.h> #include <wx/stattext.h> -#include <wx/textctrl.h> -#include <string> +#include <sstream> using namespace std; @@ -51,92 +48,25 @@ JZShiftDialog::JZShiftDialog( JZEventWindow& EventWindow, JZFilter& Filter, + int Unit, + int& Shift, wxWindow* pParent) : wxDialog(pParent, wxID_ANY, wxString("Shift")), mFilter(Filter), - mpFromTimeEdit(0), - mpToTimeEdit(0), - mpFromTrackEdit(0), - mpToTrackEdit(0), - mpNoteCheckBox(0), - mpNoteMinEdit(0), - mpNoteMaxEdit(0), - mpPolyAftertouchCheckBox(0), - mpPolyAftertouchMinEdit(0), - mpPolyAftertouchMaxEdit(0), - mpControllerCheckBox(0), - mpControllerMinEdit(0), - mpControllerMaxEdit(0), - mpPatchCheckBox(0), - mpPatchMinEdit(0), - mpPatchMaxEdit(0), - mpPitchCheckBox(0), - mpPitchMinEdit(0), - mpPitchMaxEdit(0), - mpMeterCheckBox(0), - mpChannelAftertouchCheckBox(0), - mpSysExCheckBox(0), - mpOtherBox(0) + mUnit(Unit), + mShift(Shift), + mpStepsSlider(0) { - mpFromTimeEdit = new wxTextCtrl(this, wxID_ANY); - mpToTimeEdit = new wxTextCtrl(this, wxID_ANY); + mpStepsSlider = new wxSlider( + this, + wxID_ANY, + mShift, + -16, + 16, + wxDefaultPosition, + wxDefaultSize, + wxSL_LABELS | wxSL_BOTTOM); - mpFromTrackEdit = new JZIntegerEdit(this, wxID_ANY); - mpFromTrackEdit->SetValueName("FromTrack"); - mpFromTrackEdit->SetMinAndMax(1, 127); - mpToTrackEdit = new JZIntegerEdit(this, wxID_ANY); - mpToTrackEdit->SetValueName("To Track"); - mpToTrackEdit->SetMinAndMax(1, 127); - - mpNoteCheckBox = new wxCheckBox(this, wxID_ANY, "Note"); - mpNoteMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpNoteMinEdit->SetValueName("Note Minimum"); - mpNoteMinEdit->SetMinAndMax(0, 127); - mpNoteMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpNoteMaxEdit->SetValueName("Note Maximum"); - mpNoteMaxEdit->SetMinAndMax(0, 127); - - mpPolyAftertouchCheckBox = new wxCheckBox(this, wxID_ANY, "Poly Aftertouch"); - mpPolyAftertouchMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpPolyAftertouchMinEdit->SetValueName("Poly Aftertouch Minimum"); - mpPolyAftertouchMinEdit->SetMinAndMax(0, 127); - mpPolyAftertouchMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpPolyAftertouchMaxEdit->SetValueName("Poly Aftertouch Maximum"); - mpPolyAftertouchMaxEdit->SetMinAndMax(0, 127); - - mpControllerCheckBox = new wxCheckBox(this, wxID_ANY, "Controller"); - mpControllerMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpControllerMinEdit->SetValueName("Controller Minimum"); - mpControllerMinEdit->SetMinAndMax(0, 127); - mpControllerMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpControllerMaxEdit->SetValueName("Controller Maximum"); - mpControllerMaxEdit->SetMinAndMax(0, 127); - - mpPatchCheckBox = new wxCheckBox(this, wxID_ANY, "Patch"); - mpPatchMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpPatchMinEdit->SetValueName("Patch Minimum"); - mpPatchMinEdit->SetMinAndMax(0, 127); - mpPatchMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpPatchMaxEdit->SetValueName("Patch Maximum"); - mpPatchMaxEdit->SetMinAndMax(0, 127); - - mpPitchCheckBox = new wxCheckBox(this, wxID_ANY, "Pitch"); - mpPitchMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpPitchMinEdit->SetValueName("Pitch Minimum"); - mpPitchMinEdit->SetMinAndMax(-8192, 8192); - mpPitchMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpPitchMaxEdit->SetValueName("Pitch Maximum"); - mpPitchMaxEdit->SetMinAndMax(-8192, 8192); - - mpMeterCheckBox = new wxCheckBox(this, wxID_ANY, "Meter"); - - mpChannelAftertouchCheckBox = - new wxCheckBox(this, wxID_ANY, "Channel Aftertouch"); - - mpSysExCheckBox = new wxCheckBox(this, wxID_ANY, "SysEx"); - - mpOtherBox = new wxCheckBox(this, wxID_ANY, "Other"); - wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK"); wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel"); wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help"); @@ -144,167 +74,23 @@ wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL); - wxFlexGridSizer* pFlexGridSizer; - - pFlexGridSizer = new wxFlexGridSizer(2, 4, 4, 2); - - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "From Time:"), + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, "Shift events left or right"), 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpFromTimeEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "To Time:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpToTimeEdit, - 0, - wxALIGN_CENTER_VERTICAL); + wxCENTER | wxALL, + 5); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "From Track:"), + ostringstream Oss; + Oss << "Snap is currently " << mUnit << " clocks"; + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, Oss.str().c_str()), 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpFromTrackEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "To Track:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpToTrackEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 10); - - pFlexGridSizer = new wxFlexGridSizer(5, 5, 4, 2); - - pFlexGridSizer->Add( - mpNoteCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpNoteMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpNoteMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpPolyAftertouchCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPolyAftertouchMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPolyAftertouchMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpControllerCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpControllerMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpControllerMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpPatchCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPatchMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPatchMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpPitchCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPitchMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPitchMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 10); - + wxCENTER | wxALL, + 5); wxBoxSizer* pCheckBoxSizer = new wxBoxSizer(wxHORIZONTAL); - pCheckBoxSizer->Add(mpMeterCheckBox, 0, wxALL, 5); + pTopSizer->Add(mpStepsSlider, 0, wxCENTER | wxALL, 5); - pCheckBoxSizer->Add(mpChannelAftertouchCheckBox, 0, wxALL, 5); - - pCheckBoxSizer->Add(mpSysExCheckBox, 0, wxALL, 5); - - pCheckBoxSizer->Add(mpOtherBox, 0, wxALL, 5); - - pTopSizer->Add(pCheckBoxSizer, 0, wxCENTER | wxALL, 5); - wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL); pButtonSizer->Add(pOkButton, 0, wxALL, 5); pButtonSizer->Add(pCancelButton, 0, wxALL, 5); @@ -323,53 +109,6 @@ //----------------------------------------------------------------------------- bool JZShiftDialog::TransferDataToWindow() { - string TimeString; - - mFilter.GenerateFromTimeString(TimeString); - mpFromTimeEdit->ChangeValue(TimeString); - - mFilter.GenerateToTimeString(TimeString); - mpToTimeEdit->ChangeValue(TimeString); - - mpFromTrackEdit->SetNumber(mFilter.GetFromTrack()); - mpToTrackEdit->SetNumber(mFilter.GetToTrack()); - - bool Selected; - int FromValue, ToValue; - - mFilter.GetFilterEvent(eFilterKeyOn, Selected, FromValue, ToValue); - mpNoteCheckBox->SetValue(Selected); - mpNoteMinEdit->SetNumber(FromValue); - mpNoteMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterKeyPressure, Selected, FromValue, ToValue); - mpPolyAftertouchCheckBox->SetValue(Selected); - mpPolyAftertouchMinEdit->SetNumber(FromValue); - mpPolyAftertouchMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterControl, Selected, FromValue, ToValue); - mpControllerCheckBox->SetValue(Selected); - mpControllerMinEdit->SetNumber(FromValue); - mpControllerMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterProgram, Selected, FromValue, ToValue); - mpPatchCheckBox->SetValue(Selected); - mpPatchMinEdit->SetNumber(FromValue); - mpPatchMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterPitch, Selected, FromValue, ToValue); - mpPitchCheckBox->SetValue(Selected); - mpPitchMinEdit->SetNumber(FromValue); - mpPitchMaxEdit->SetNumber(ToValue); - - mpMeterCheckBox->SetValue(mFilter.GetFilterMeter()); - - mpChannelAftertouchCheckBox->SetValue(mFilter.GetFilterChannelAftertouch()); - - mpSysExCheckBox->SetValue(mFilter.GetFilterSysEx()); - - mpOtherBox->SetValue(mFilter.GetFilterOther()); - return true; } @@ -377,171 +116,14 @@ //----------------------------------------------------------------------------- bool JZShiftDialog::TransferDataFromWindow() { - int FromTrack, ToTrack; - int NoteMin, NoteMax; - int PolyAftertouchMin, PolyAftertouchMax; - int ControllerMin, ControllerMax; - int PatchMin, PatchMax; - int PitchMin, PitchMax; + mShift = mpStepsSlider->GetValue(); - if ( - mpFromTrackEdit->GetNumber(FromTrack) && - mpToTrackEdit->GetNumber(ToTrack) && - mpNoteMinEdit->GetNumber(NoteMin) && - mpNoteMaxEdit->GetNumber(NoteMax) && - mpPolyAftertouchMinEdit->GetNumber(PolyAftertouchMin) && - mpPolyAftertouchMaxEdit->GetNumber(PolyAftertouchMax) && - mpControllerMinEdit->GetNumber(ControllerMin) && - mpControllerMaxEdit->GetNumber(ControllerMax) && - mpPatchMinEdit->GetNumber(PatchMin) && - mpPatchMaxEdit->GetNumber(PatchMax) && - mpPitchMinEdit->GetNumber(PitchMin) && - mpPitchMaxEdit->GetNumber(PitchMax)) - { - if (FromTrack > ToTrack) - { - ::wxMessageBox( - "The From Track must be less than or equal to the To Track", - "Invalid Track Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpFromTrackEdit->SetFocus(); - - return false; - } - - if (NoteMin > NoteMax) - { - ::wxMessageBox( - "The Minimum Note must be less than or equal to the Maximum Note", - "Invalid Note Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpNoteMinEdit->SetFocus(); - - return false; - } - - if (PolyAftertouchMin > PolyAftertouchMax) - { - ::wxMessageBox( - "The Minimum Poly Aftertouch must be less than or equal to the Maximum" - " Poly Aftertouch", - "Invalid Poly Aftertouch Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpPolyAftertouchMinEdit->SetFocus(); - - return false; - } - - if (ControllerMin > ControllerMax) - { - ::wxMessageBox( - "The Minimum Controller must be less than or equal to the Maximum" - " Controller", - "Invalid Controller Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpControllerMinEdit->SetFocus(); - - return false; - } - - if (PatchMin > PatchMax) - { - ::wxMessageBox( - "The Minimum Patch must be less than or equal to the Maximum Patch", - "Invalid Patch Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpPatchMinEdit->SetFocus(); - - return false; - } - - if (PitchMin > PitchMax) - { - ::wxMessageBox( - "The Minimum Pitch must be less than or equal to the Maximum Pitch", - "Invalid Pitch Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpPitchMinEdit->SetFocus(); - - return false; - } - - string TimeString; - - TimeString = mpFromTimeEdit->GetValue(); - mFilter.SetFromTime(TimeString); - - TimeString = mpToTimeEdit->GetValue(); - mFilter.SetToTime(TimeString); - - mFilter.SetFromTrack(FromTrack); - mFilter.SetToTrack(ToTrack); - - mFilter.SetFilterEvent( - eFilterKeyOn, - mpNoteCheckBox->GetValue(), - NoteMin, - NoteMax); - - mFilter.SetFilterEvent( - eFilterKeyPressure, - mpPolyAftertouchCheckBox->GetValue(), - PolyAftertouchMin, - PolyAftertouchMax); - - mFilter.SetFilterEvent( - eFilterControl, - mpControllerCheckBox->GetValue(), - ControllerMin, - ControllerMax); - - mFilter.SetFilterEvent( - eFilterProgram, - mpPatchCheckBox->GetValue(), - PatchMin, - PatchMax); - - mFilter.SetFilterEvent( - eFilterPitch, - mpPitchCheckBox->GetValue(), - PitchMin, - PitchMax); - - mFilter.SetFilterMeter(mpMeterCheckBox->GetValue()); - - mFilter.SetFilterChannelAftertouch( - mpChannelAftertouchCheckBox->GetValue()); - - mFilter.SetFilterSysEx(mpSysExCheckBox->GetValue()); - - mFilter.SetFilterOther(mpOtherBox->GetValue()); - -// tCmdShift ShiftCommand(&mFilter, mSteps * mUnit); -// ShiftCommand.Execute(); - - JZProjectManager::Instance()->UpdateAllViews(); - - return true; - } - - return false; + return true; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void JZShiftDialog::OnHelp(wxCommandEvent& Event) { -// gpHelpInstance->ShowTopic("Filter Dialog"); +// gpHelpInstance->ShowTopic("Shift Dialog"); } Modified: trunk/jazz/src/Dialogs/ShiftDialog.h =================================================================== --- trunk/jazz/src/Dialogs/ShiftDialog.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Dialogs/ShiftDialog.h 2009-01-20 04:14:04 UTC (rev 692) @@ -28,6 +28,7 @@ class JZIntegerEdit; class wxCheckBox; class wxTextCtrl; +class wxSlider; //***************************************************************************** //***************************************************************************** @@ -38,6 +39,8 @@ JZShiftDialog( JZEventWindow& EventWindow, JZFilter& Filter, + int Unit, + int& Shift, wxWindow* pParent); private: @@ -51,41 +54,11 @@ private: JZFilter& mFilter; + int mUnit; + int& mShift; - wxTextCtrl* mpFromTimeEdit; - wxTextCtrl* mpToTimeEdit; + wxSlider* mpStepsSlider; - JZIntegerEdit* mpFromTrackEdit; - JZIntegerEdit* mpToTrackEdit; - - wxCheckBox* mpNoteCheckBox; - JZIntegerEdit* mpNoteMinEdit; - JZIntegerEdit* mpNoteMaxEdit; - - wxCheckBox* mpPolyAftertouchCheckBox; - JZIntegerEdit* mpPolyAftertouchMinEdit; - JZIntegerEdit* mpPolyAftertouchMaxEdit; - - wxCheckBox* mpControllerCheckBox; - JZIntegerEdit* mpControllerMinEdit; - JZIntegerEdit* mpControllerMaxEdit; - - wxCheckBox* mpPatchCheckBox; - JZIntegerEdit* mpPatchMinEdit; - JZIntegerEdit* mpPatchMaxEdit; - - wxCheckBox* mpPitchCheckBox; - JZIntegerEdit* mpPitchMinEdit; - JZIntegerEdit* mpPitchMaxEdit; - - wxCheckBox* mpMeterCheckBox; - - wxCheckBox* mpChannelAftertouchCheckBox; - - wxCheckBox* mpSysExCheckBox; - - wxCheckBox* mpOtherBox; - DECLARE_EVENT_TABLE(); }; Modified: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/EventFrame.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -26,23 +26,20 @@ EVT_UPDATE_UI(ID_SHIFT, JZEventFrame::OnUpdateEditShift) EVT_MENU(ID_SHIFT, JZEventFrame::OnEditShift) - EVT_SIZE(JZEventFrame::OnSize) - END_EVENT_TABLE() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZEventFrame::JZEventFrame( - JZEventWindow* pEventWindow, + wxWindow* pParent, const wxString& Title, JZSong* pSong, const wxPoint& Position, - const wxSize& Size) - : wxFrame(pEventWindow, wxID_ANY, Title, Position, Size), + const wxSize& Size, + long WindowStyle) + : wxFrame(pParent, wxID_ANY, Title, Position, Size, WindowStyle), Song(pSong), mpFilter(0), - mpFixedFont(0), - hFixedFont(0), mTrackHeight(0), mTopInfoHeight(40), FontSize(12), @@ -67,7 +64,7 @@ mpToolBar(0), mpGreyColor(0), mpGreyBrush(0), - mpEventWindow(pEventWindow) + mpEventWindow(0) { #ifdef __WXMSW__ mpGreyColor = new wxColor(192, 192, 192); @@ -88,8 +85,6 @@ delete mpFilter; - delete mpFixedFont; - delete mpToolBar; if (MixerForm) @@ -99,127 +94,40 @@ } //----------------------------------------------------------------------------- +// Description: +// Register the event window with the frame. //----------------------------------------------------------------------------- -void JZEventFrame::CreateMenu() +void JZEventFrame::SetEventWindow(JZEventWindow* pEventWindow) { + mpEventWindow = pEventWindow; } - //----------------------------------------------------------------------------- -// create the canvas component(used for differently dependingon the subclass) -// size it to the client area of the frame(frame size minus toolbar and menus ) //----------------------------------------------------------------------------- -//void JZEventFrame::CreateCanvas() -//{ -// cout << "CreateCanvas" << endl; -// int Width, Height; -// GetClientSize(&Width, &Height); -// mpEventWindow = new JZEventWindow(this, 0, 0, Width, Height); -//} - -/** -second phase of creation. make menus, the canvas, and so on -*/ -void JZEventFrame::Create() -{ - CreateMenu(); - - Setup(); -} - -//----------------------------------------------------------------------------- -// Initialize the constants used in drawing. -//----------------------------------------------------------------------------- -void JZEventFrame::Setup() -{ -/* - int x, y; - - wxClientDC Dc(mpEventWindow); - Dc.SetFont(wxNullFont); - delete mpFixedFont; - mpFixedFont = new wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); - Dc.SetFont(*mpFixedFont); - Dc.GetTextExtent("M", &x, &y); - hFixedFont = (int)y; - - delete mpFont; - mpFont = new wxFont(FontSize, wxSWISS, wxNORMAL, wxNORMAL); - Dc.SetFont(*mpFont); - - Dc.GetTextExtent("M", &x, &y); - mLittleBit = (int)(x/2); - - Dc.GetTextExtent("HXWjgi", &x, &y); - mTrackHeight = (int)y + mLittleBit; -*/ -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- void JZEventFrame::OnUpdateEditShift(wxUpdateUIEvent& Event) { - Event.Enable(mpEventWindow->AreEventsSelected()); + if (mpEventWindow) + { + Event.Enable(mpEventWindow->AreEventsSelected()); + } + else + { + Event.Enable(false); + } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void JZEventFrame::OnEditShift(wxCommandEvent& Event) { -// mpEventWindow->Shift(); + if (mpEventWindow) + { + mpEventWindow->Shift(16); + } } //----------------------------------------------------------------------------- -// this onsize handler is supposed to take care of handling of the resizing -// the two subwindows sizes to they dont overlap //----------------------------------------------------------------------------- -void JZEventFrame::OnSize(wxSizeEvent& Event) -{ -// wxFrame::OnSize(Event); - - // The code below is from the toolbar sample, the layoutchidlren function - wxSize size = GetClientSize(); - - int offset; -// if (mpToolBar) -// { -// mpToolBar->SetSize(-1, size.y); -// mpToolBar->Move(0, 0); -// -// offset = mpToolBar->GetSize().x; -// } -// else -// { -// offset = 0; -// } - - // The step below should set the offset of the mpEventWindow - // m_textWindow->SetSize(offset, 0, size.x - offset, size.y); - -// float maxToolBarWidth = 0.0; -// float maxToolBarHeight = 0.0; -// if (mpToolBar) -// { -// mpToolBar->GetMaxSize(&maxToolBarWidth, &maxToolBarHeight); -// } - - offset = mpToolBar->GetSize().y; //get the height of the toolbar - - int frameWidth, frameHeight; - GetClientSize(&frameWidth, &frameHeight); - -// if (mpEventWindow) -// // mpEventWindow->SetSize(0, (int)offset, (int)frameWidth, (int)(frameHeight - offset)); -// mpEventWindow->SetSize(0, (int)0, (int)frameWidth, (int)(frameHeight)); -// // if (mpToolBar) -// // mpToolBar->SetSize(0, 0, (int)frameWidth, (int)maxToolBarHeight); - - cout - << "JZEventFrame::OnSize " << frameWidth<< 'x' << frameHeight << endl; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- bool JZEventFrame::OnCharHook(wxKeyEvent& e) { return OnKeyEvent(e); @@ -227,20 +135,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZEventFrame::y2yLine(int y, int up) -{ - if (up) - { - y += mTrackHeight; - } - y -= mTopInfoHeight; - y -= y % mTrackHeight; - y += mTopInfoHeight; - return y; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- int JZEventFrame::y2Line(int y, int up) { if (up) @@ -318,10 +212,14 @@ // wxPaintEvent e; // cout<<"FIXME JZEventFrame::Redraw"<<endl; // mpEventWindow->OnDraw(*dc); //this will in turn call the eventwin onpaintsub -// //the problem is that onpaint no longer tkes no argument, and is supposed to be called from the framework only, so it should be split +// // the problem is that onpaint no longer takes arguments, and is supposed +// // to be called from the framework only, so it should be split. // delete dc; -// mpEventWindow->Refresh(); +// if (mpEventWindow) +// { +// mpEventWindow->Refresh(); +// } } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/EventFrame.h =================================================================== --- trunk/jazz/src/EventFrame.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/EventFrame.h 2009-01-20 04:14:04 UTC (rev 692) @@ -48,11 +48,12 @@ // 2-step initialization: 1) constructor JZEventFrame( - JZEventWindow* pEventWindow, + wxWindow* pParent, const wxString& Title, JZSong* pSong, const wxPoint& Position = wxDefaultPosition, - const wxSize& Size = wxDefaultSize); + const wxSize& Size = wxDefaultSize, + long WindowStyle = wxDEFAULT_FRAME_STYLE); virtual ~JZEventFrame(); @@ -60,25 +61,14 @@ JZFilter* mpFilter; - // 2) Create(): - virtual void Create(); - virtual void CreateMenu(); - void CreateCanvas(); -// JZEventWindow* mpEventWindow; + virtual void SetEventWindow(JZEventWindow* pEventWindow); - // Setup() - wxFont* mpFixedFont; // remains with 12pt - int hFixedFont; // Height of letters - int mTrackHeight; int mTopInfoHeight; int FontSize; int ClocksPerPixel; - // Parameters changed, e.g. Song loaded - virtual void Setup(); - int mEventsX, mEventsY, mEventsWidth, mEventsHeight; int CanvasX, CanvasY, CanvasW, CanvasH; // canvas coords int FromClock, ToClock; @@ -92,9 +82,7 @@ // methods int y2Line(int y, int up = 0); - int y2yLine(int y, int up = 0); int Line2y(int line); -// void LineText(wxDC *dc, int x, int y, int w, const char *str, int h = -1, bool down = false); int PlayClock; @@ -124,8 +112,6 @@ void OnUpdateEditShift(wxUpdateUIEvent& Event); void OnEditShift(wxCommandEvent& Event); - void OnSize(wxSizeEvent& Event); - bool OnCharHook(wxKeyEvent& Event); void OnChar(wxKeyEvent& Event); Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/EventWindow.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -22,12 +22,14 @@ #include "EventWindow.h" +#include "Command.h" #include "Dialogs/ShiftDialog.h" #include "EventFrame.h" #include "Filter.h" #include "MouseAction.h" #include "Song.h" #include "Help.h" +#include "ProjectManager.h" #include "PropertyListDialog.h" #include <wx/dc.h> @@ -130,10 +132,16 @@ { if (AreEventsSelected()) { - JZShiftDialog ShiftDialog(*this, *mpFilter, this); + int Unit = 30; + int Shift = 0; + JZShiftDialog ShiftDialog(*this, *mpFilter, Units, Shift, this); - if (ShiftDialog.ShowModal() == wxID_OK) + if (ShiftDialog.ShowModal() == wxID_OK && Shift != 0) { + tCmdShift ShiftCommand(mpFilter, Shift * Unit); + ShiftCommand.Execute(); + + JZProjectManager::Instance()->UpdateAllViews(); } } } Modified: trunk/jazz/src/PianoWindow.h =================================================================== --- trunk/jazz/src/PianoWindow.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/PianoWindow.h 2009-01-20 04:14:04 UTC (rev 692) @@ -294,7 +294,7 @@ void Draw(wxDC& Dc); - // Overridden tButtonLabelInterface finction. + // Overridden tButtonLabelInterface function. void ButtonLabelDisplay(const wxString& Text, bool IsButtonDown); private: @@ -326,9 +326,8 @@ int mFontSize; wxFont* mpFont; - // remains with 12pt/ bleibt bei 12pt wxFont* mpFixedFont; - int mFixedFontHeight; //Height letters/ Hoehe eines Buchstaben + int mFixedFontHeight; wxFont* mpDrumFont; Modified: trunk/jazz/src/Player.cpp =================================================================== --- trunk/jazz/src/Player.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Player.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -245,7 +245,9 @@ { // fixme: we should have different synths for each device t = Song->GetTrack(0); - OutNow(t, gpSynth->Reset()); + JZEvent* mpResetEvent = gpSynth->CreateResetEvent(); + OutNow(t, mpResetEvent); + delete mpResetEvent; } // Send Volume, Pan, Chorus, etc @@ -640,7 +642,9 @@ if (Reset) { - OutNow(gpSynth->Reset()); + JZEvent* mpResetEvent = gpSynth->CreateResetEvent(); + OutNow(mpResetEvent); + delete mpResetEvent; } } Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Song.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -154,7 +154,7 @@ //----------------------------------------------------------------------------- void JZSong::Clear() { - for (int i = 0; i < mTrackCount; i++) + for (int i = 0; i < eMaxTrackCount; ++i) { mTracks[i].Clear(); } @@ -210,9 +210,10 @@ void JZSong::Write(JZWriteBase& Io, const char* pFileName) { // Make sure track 0 has a synth reset - if (!mTracks[0].Reset) + if (!mTracks[0].mpReset) { - mTracks[0].Reset = gpSynth->Reset()->IsSysEx(); + JZEvent* pEvent = gpSynth->CreateResetEvent(); + mTracks[0].mpReset = dynamic_cast<tSysEx*>(pEvent); } int n = NumUsedTracks(); Modified: trunk/jazz/src/Synth.h =================================================================== --- trunk/jazz/src/Synth.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Synth.h 2009-01-20 04:14:04 UTC (rev 692) @@ -325,7 +325,7 @@ Sysex.FixCheckSum( s ); } - virtual JZEvent* Reset() = 0; + virtual JZEvent* CreateResetEvent() = 0; virtual JZEvent* MasterVolSX( long clk, unsigned char vol ) { @@ -375,7 +375,7 @@ return this; } - virtual JZEvent* Reset() + virtual JZEvent* CreateResetEvent() { return Sysex(0, SX_GM_ON); } @@ -389,7 +389,7 @@ return this; } - JZEvent* Reset() + virtual JZEvent* CreateResetEvent() { return Sysex(0, SX_GS_ON); } @@ -420,7 +420,7 @@ return this; } - JZEvent* Reset() + virtual JZEvent* CreateResetEvent() { return Sysex(0, SX_XG_ON); } Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Track.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -523,9 +523,9 @@ nEvents = newnEvents; } -void tSimpleEventArray::Put(JZEvent* e) +void tSimpleEventArray::Put(JZEvent* pEvent) { - if (e->IsEndOfTrack()) + if (pEvent->IsEndOfTrack()) { // Remove the old EOT if we are adding a new one. RemoveEOT(); @@ -534,7 +534,7 @@ { Resize(); } - Events[nEvents++] = e; + Events[nEvents++] = pEvent; #ifdef E_DBUG { @@ -567,11 +567,11 @@ void tSimpleEventArray::Copy(tSimpleEventArray& src, int frclk, int toclk) { tEventIterator iter(&src); - JZEvent* e = iter.Range(frclk, toclk); - while (e) + JZEvent* pEvent = iter.Range(frclk, toclk); + while (pEvent) { - Put(e->Copy()); - e = iter.Next(); + Put(pEvent->Copy()); + pEvent = iter.Next(); } } @@ -588,7 +588,7 @@ Chorus(0), mpBank(0), mpBank2(0), - Reset(0) + mpReset(0) { nEvents = 0; @@ -632,7 +632,9 @@ delete mpBank2; mpBank2 = 0; - Reset = 0; + delete mpReset; + mpReset = 0; + Speed = 0; Channel = 1; Device = 0; @@ -741,7 +743,7 @@ void tEventArray::Cleanup(bool dont_delete_killed_events) { - JZEvent *e; + JZEvent* pEvent; tControl* pControl; tSysEx *s; int i; @@ -820,7 +822,7 @@ for (i = 0; i < nEvents; i++) { - if ((e = Events[i])->IsKilled()) + if ((pEvent = Events[i])->IsKilled()) { if (!dont_delete_killed_events) { @@ -834,29 +836,29 @@ } // accept only events having clock == 0 as track defaults - if (e->GetClock() != 0) + if (pEvent->GetClock() != 0) { continue; } if (!mpName) { - mpName = e->IsTrackName(); + mpName = pEvent->IsTrackName(); } if (!Copyright) { - Copyright = e->IsCopyright(); + Copyright = pEvent->IsCopyright(); } if (!Speed) { - Speed = e->IsSetTempo(); + Speed = pEvent->IsSetTempo(); } if (!MtcOffset) { - MtcOffset = e->IsMtcOffset(); + MtcOffset = pEvent->IsMtcOffset(); } - if ((pControl = e->IsControl()) != 0) + if ((pControl = pEvent->IsControl()) != 0) { switch (pControl->GetControl()) { @@ -886,13 +888,13 @@ break; } } - if ((s = e->IsSysEx()) != 0) + if ((s = pEvent->IsSysEx()) != 0) { - int sxid = gpSynth->GetSysexId(s); + int SysExId = gpSynth->GetSysexId(s); if (!gpSynth->IsGS()) { - switch (sxid) + switch (SysExId) { case SX_GM_MasterVol: // GS has its own; SC-55 doesn't recognize GM Mastervol @@ -905,7 +907,7 @@ if (gpSynth->IsGS()) { - switch (sxid) + switch (SysExId) { case SX_GS_MasterVol: MasterVol = s; @@ -924,7 +926,7 @@ case SX_GS_BendLfo2Pitch: case SX_GS_BendLfo2Tvf: case SX_GS_BendLfo2Tva: - BenderSettings[sxid - SX_GS_BendPitch] = s; + BenderSettings[SysExId - SX_GS_BendPitch] = s; break; case SX_GS_ModPitch: @@ -938,7 +940,7 @@ case SX_GS_ModLfo2Pitch: case SX_GS_ModLfo2Tvf: case SX_GS_ModLfo2Tva: - ModulationSettings[sxid - SX_GS_ModPitch] = s; + ModulationSettings[SysExId - SX_GS_ModPitch] = s; break; case SX_GS_CafPitch: @@ -952,7 +954,7 @@ case SX_GS_CafLfo2Pitch: case SX_GS_CafLfo2Tvf: case SX_GS_CafLfo2Tva: - CAfSettings[sxid - SX_GS_CafPitch] = s; + CAfSettings[SysExId - SX_GS_CafPitch] = s; break; case SX_GS_PafPitch: @@ -966,7 +968,7 @@ case SX_GS_PafLfo2Pitch: case SX_GS_PafLfo2Tvf: case SX_GS_PafLfo2Tva: - PAfSettings[sxid - SX_GS_PafPitch] = s; + PAfSettings[SysExId - SX_GS_PafPitch] = s; break; case SX_GS_CC1Pitch: @@ -980,7 +982,7 @@ case SX_GS_CC1Lfo2Pitch: case SX_GS_CC1Lfo2Tvf: case SX_GS_CC1Lfo2Tva: - CC1Settings[sxid - SX_GS_CC1Pitch] = s; + CC1Settings[SysExId - SX_GS_CC1Pitch] = s; break; case SX_GS_CC2Pitch: @@ -994,7 +996,7 @@ case SX_GS_CC2Lfo2Pitch: case SX_GS_CC2Lfo2Tvf: case SX_GS_CC2Lfo2Tva: - CC2Settings[sxid - SX_GS_CC2Pitch] = s; + CC2Settings[SysExId - SX_GS_CC2Pitch] = s; break; case SX_GS_ReverbMacro: @@ -1007,7 +1009,7 @@ case SX_GS_RevTime: case SX_GS_RevDelayFeedback: case SX_GS_RevSendChorus: - ReverbSettings[sxid - SX_GS_RevCharacter] = s; + ReverbSettings[SysExId - SX_GS_RevCharacter] = s; break; case SX_GS_ChorusMacro: @@ -1021,7 +1023,7 @@ case SX_GS_ChoRate: case SX_GS_ChoDepth: case SX_GS_ChoSendReverb: - ChorusSettings[sxid - SX_GS_ChoPreLpf] = s; + ChorusSettings[SysExId - SX_GS_ChoPreLpf] = s; break; case SX_GS_CC1CtrlNo: @@ -1050,78 +1052,78 @@ } else if (gpSynth->IsXG()) { - switch (sxid) + switch (SysExId) { case SX_XG_BendPitch: case SX_XG_BendTvf: case SX_XG_BendAmpl: - BenderSettings[sxid - SX_XG_BendPitch] = s; + BenderSettings[SysExId - SX_XG_BendPitch] = s; break; case SX_XG_BendLfoPitch: case SX_XG_BendLfoTvf: case SX_XG_BendLfoTva: - BenderSettings[sxid + 1 - SX_XG_BendPitch] = s; + BenderSettings[SysExId + 1 - SX_XG_BendPitch] = s; break; case SX_XG_ModPitch: case SX_XG_ModTvf: case SX_XG_ModAmpl: - ModulationSettings[sxid - SX_XG_ModPitch] = s; + ModulationSettings[SysExId - SX_XG_ModPitch] = s; break; case SX_XG_ModLfoPitch: case SX_XG_ModLfoTvf: case SX_XG_ModLfoTva: - ModulationSettings[sxid + 1 - SX_XG_ModPitch] = s; + ModulationSettings[SysExId + 1 - SX_XG_ModPitch] = s; break; case SX_XG_CafPitch: case SX_XG_CafTvf: case SX_XG_CafAmpl: - CAfSettings[sxid - SX_XG_CafPitch] = s; + CAfSettings[SysExId - SX_XG_CafPitch] = s; break; case SX_XG_CafLfoPitch: case SX_XG_CafLfoTvf: case SX_XG_CafLfoTva: - CAfSettings[sxid + 1 - SX_XG_CafPitch] = s; + CAfSettings[SysExId + 1 - SX_XG_CafPitch] = s; break; case SX_XG_PafPitch: case SX_XG_PafTvf: case SX_XG_PafAmpl: - PAfSettings[sxid - SX_XG_PafPitch] = s; + PAfSettings[SysExId - SX_XG_PafPitch] = s; break; case SX_XG_PafLfoPitch: case SX_XG_PafLfoTvf: case SX_XG_PafLfoTva: - PAfSettings[sxid + 1 - SX_XG_PafPitch] = s; + PAfSettings[SysExId + 1 - SX_XG_PafPitch] = s; break; case SX_XG_CC1Pitch: case SX_XG_CC1Tvf: case SX_XG_CC1Ampl: - CC1Settings[sxid - SX_XG_CC1Pitch] = s; + CC1Settings[SysExId - SX_XG_CC1Pitch] = s; break; case SX_XG_CC1LfoPitch: case SX_XG_CC1LfoTvf: case SX_XG_CC1LfoTva: - CC1Settings[sxid + 1 - SX_XG_CC1Pitch] = s; + CC1Settings[SysExId + 1 - SX_XG_CC1Pitch] = s; break; case SX_XG_CC2Pitch: case SX_XG_CC2Tvf: case SX_XG_CC2Ampl: - CC2Settings[sxid - SX_XG_CC2Pitch] = s; + CC2Settings[SysExId - SX_XG_CC2Pitch] = s; break; case SX_XG_CC2LfoPitch: case SX_XG_CC2LfoTvf: case SX_XG_CC2LfoTva: - CC2Settings[sxid + 1 - SX_XG_CC2Pitch] = s; + CC2Settings[SysExId + 1 - SX_XG_CC2Pitch] = s; break; case SX_XG_ReverbMacro: @@ -1200,10 +1202,10 @@ tKeyOff* pKeyOff; if ((pKeyOff = Events[i]->IsKeyOff()) != 0) { - JZEvent **e = &Events[i - 1]; - while (e >= Events) + JZEvent** ppEvent = &Events[i - 1]; + while (ppEvent >= Events) { - tKeyOn* pKeyOn = (*e)->IsKeyOn(); + tKeyOn* pKeyOn = (*ppEvent)->IsKeyOn(); if ( pKeyOn && pKeyOn->Key == pKeyOff->Key && @@ -1218,7 +1220,7 @@ pKeyOff->Kill(); break; } - --e; + --ppEvent; } } } @@ -1292,7 +1294,7 @@ void tEventArray::Write(JZWriteBase& Io) { - JZEvent *e; + JZEvent* pEvent; int WrittenBefore; Length2Keyoff(); @@ -1311,9 +1313,9 @@ } // Synth reset - if (Reset) + if (mpReset) { - Reset->Write(Io); + mpReset->Write(Io); } // Rpn / Nrpn: @@ -1385,21 +1387,20 @@ mPatch->Write(Io); } - // write jazz track info - tJazzMeta *jazz = new tJazzMeta; - jazz->SetAudioMode(audio_mode); - jazz->SetTrackState(State); - jazz->SetTrackDevice(Device); - jazz->SetIntroLength(gpSong->GetIntroLength()); - jazz->Write(Io); + tJazzMeta JazzMeta; + JazzMeta.SetAudioMode(audio_mode); + JazzMeta.SetTrackState(State); + JazzMeta.SetTrackDevice(Device); + JazzMeta.SetIntroLength(gpSong->GetIntroLength()); + JazzMeta.Write(Io); for (int i = 0; i < nEvents; i++) { - e = Events[i]; + pEvent = Events[i]; WrittenBefore = 0; - if (e->IsControl()) + if (pEvent->IsControl()) { - switch (e->IsControl()->GetControl()) + switch (pEvent->IsControl()->GetControl()) { // Don't write these again if present as events // and clock == 0 (should not happen) @@ -1410,7 +1411,7 @@ case 0x06: // Rpn/Nrpn Data case 0x00: // mpBank case 0x20: // Bank2 - if (e->GetClock() == 0) + if (pEvent->GetClock() == 0) { WrittenBefore = 1; } @@ -1419,23 +1420,23 @@ WrittenBefore = 0; } } - else if (e->IsProgram()) + else if (pEvent->IsProgram()) { // Don't write these again if present as events // and clock == 0 (should not happen) - if (e->GetClock() == 0) + if (pEvent->GetClock() == 0) { WrittenBefore = 1; } } - else if (e->IsCopyright() || e->IsMtcOffset()) + else if (pEvent->IsCopyright() || pEvent->IsMtcOffset()) { // Will probably happen WrittenBefore = 1; } if (!WrittenBefore) { - e->Write(Io); + pEvent->Write(Io); } } Keyoff2Length(); @@ -1443,10 +1444,10 @@ void tEventArray::Read(JZReadBase& Io) { - JZEvent *e; + JZEvent* pEvent; Channel = 0; unsigned char Msb, Lsb, Data; - int SpecialEvent; + bool SpecialEvent; Msb = Lsb = Data = 0xff; int cha; @@ -1454,13 +1455,13 @@ bool NeedToDelete; Io.NextTrack(); - while ((e = Io.Read()) != 0) + while ((pEvent = Io.Read()) != 0) { NeedToDelete = false; - SpecialEvent = 0; - if (e->IsJazzMeta()) + SpecialEvent = false; + if (pEvent->IsJazzMeta()) { - tJazzMeta *j = e->IsJazzMeta(); + tJazzMeta *j = pEvent->IsJazzMeta(); audio_mode = (int)j->GetAudioMode(); State = (int)j->GetTrackState(); Device = (int)j->GetTrackDevice(); @@ -1468,26 +1469,26 @@ delete j; continue; } - if (e->IsControl()) + if (pEvent->IsControl()) { - switch (e->IsControl()->GetControl()) + switch (pEvent->IsControl()->GetControl()) { // Grab Rpn/Nrpn/Bank from file and save them, don't put // them into event-array case 0x63: case 0x65: - Msb = e->IsControl()->GetControlValue(); // Rpn/Nrpn Msb - SpecialEvent = 1; + Msb = pEvent->IsControl()->GetControlValue(); // Rpn/Nrpn Msb + SpecialEvent = true; break; case 0x62: case 0x64: - Lsb = e->IsControl()->GetControlValue(); // Rpn/Nrpn Lsb - SpecialEvent = 1; + Lsb = pEvent->IsControl()->GetControlValue(); // Rpn/Nrpn Lsb + SpecialEvent = true; break; case 0x06: - Data = e->IsControl()->GetControlValue(); // Rpn/Nrpn Data - SpecialEvent = 1; - cha = e->IsControl()->GetChannel(); + Data = pEvent->IsControl()->GetControlValue(); // Rpn/Nrpn Data + SpecialEvent = true; + cha = pEvent->IsControl()->GetChannel(); switch (Msb) { case 0x01: // Nrpn @@ -1570,65 +1571,65 @@ case 0x00: if (!mpBank) { - SpecialEvent = 1; - mpBank = e->IsControl(); + SpecialEvent = true; + mpBank = pEvent->IsControl(); mpBank->SetClock(0); } break; case 0x20: if (!mpBank2) { - SpecialEvent = 1; - mpBank2 = e->IsControl(); + SpecialEvent = true; + mpBank2 = pEvent->IsControl(); mpBank2->SetClock(0); } break; default: - SpecialEvent = 0; // Other control + SpecialEvent = false; // Other control break; } } - else if (e->IsProgram()) + else if (pEvent->IsProgram()) { if (!mPatch) { - mPatch = e->IsProgram(); + mPatch = pEvent->IsProgram(); mPatch->SetClock(0); - SpecialEvent = 1; + SpecialEvent = true; } } - else if (e->IsCopyright()) + else if (pEvent->IsCopyright()) { if (!Copyright) { - Copyright = e->IsCopyright(); + Copyright = pEvent->IsCopyright(); // Just make sure clock is zero, then put into event array Copyright->SetClock(0); } } - else if (e->IsSysEx()) + else if (pEvent->IsSysEx()) { NeedToDelete = true; // Get hold of the Reset sysex... - int sxid = gpSynth->GetSysexId(e->IsSysEx()); + int SysExId = gpSynth->GetSysexId(pEvent->IsSysEx()); - if ((sxid == SX_GM_ON) || (sxid == SX_GS_ON) || (sxid == SX_XG_ON)) + if (SysExId == SX_GM_ON || SysExId == SX_GS_ON || SysExId == SX_XG_ON) { // Take them all away - SpecialEvent = 1; + SpecialEvent = true; // Save it in the track defaults if it fits with synth // type settings if ( - (gpSynth->IsGM() && (sxid == SX_GM_ON)) || - (gpSynth->IsGS() && (sxid == SX_GS_ON)) || - (gpSynth->IsXG() && (sxid == SX_XG_ON))) + (gpSynth->IsGM() && (SysExId == SX_GM_ON)) || + (gpSynth->IsGS() && (SysExId == SX_GS_ON)) || + (gpSynth->IsXG() && (SysExId == SX_XG_ON))) { - if (!Reset) + if (!mpReset) { - Reset = e->IsSysEx(); + mpReset = pEvent->IsSysEx(); NeedToDelete = false; } } @@ -1637,14 +1638,14 @@ if (!SpecialEvent) { - Put(e); + Put(pEvent); NeedToDelete = false; - if (!Channel && e->IsChannelEvent()) + if (!Channel && pEvent->IsChannelEvent()) { - Channel = e->IsChannelEvent()->GetChannel() + 1; + Channel = pEvent->IsChannelEvent()->GetChannel() + 1; } } - if (e->IsEndOfTrack()) + if (pEvent->IsEndOfTrack()) { // JAVE I want explicit end of track events // Break out of loop here because endoftrack is end, and we want it read @@ -1655,7 +1656,7 @@ if (NeedToDelete) { - delete e; + delete pEvent; } } // while read @@ -1772,17 +1773,17 @@ tSysEx *s; tEventIterator Iterator(trk); trk->Sort(); - JZEvent *e = Iterator.Range(0, (unsigned) trk->GetLastClock() + 1); - while (e) + JZEvent* pEvent = Iterator.Range(0, (unsigned) trk->GetLastClock() + 1); + while (pEvent) { - if ((c = e->IsChannelEvent()) != 0) + if ((c = pEvent->IsChannelEvent()) != 0) { - c = (tChannelEvent *)e->Copy(); + c = (tChannelEvent *)pEvent->Copy(); c->SetChannel(trk->Channel - 1); - trk->Kill(e); + trk->Kill(pEvent); trk->Put(c); } - else if ((s = e->IsSysEx()) != 0) + else if ((s = pEvent->IsSysEx()) != 0) { // Check for sysex that contains channel number const unsigned char* pChannel = gpSynth->GetSysexChaPtr(s); @@ -1798,13 +1799,13 @@ *pChannel |= sysex_channel(trk->Channel); } - s = (tSysEx *) e->Copy(); - trk->Kill(e); + s = (tSysEx *) pEvent->Copy(); + trk->Kill(pEvent); trk->Put(s); } } - e = Iterator.Next(); - } // while e + pEvent = Iterator.Next(); + } // while pEvent if (trk->VibRate) { @@ -1997,20 +1998,20 @@ if (Replace) { tEventIterator Erase(this); - JZEvent *e = Erase.Range(FromClock, ToClock); - while (e) + JZEvent* pEvent = Erase.Range(FromClock, ToClock); + while (pEvent) { - Kill(e); - e = Erase.Next(); + Kill(pEvent); + pEvent = Erase.Next(); } } // Merge Recorded Events tEventIterator Copy(other); - JZEvent *e = Copy.Range(FromClock, ToClock); - while (e) + JZEvent* pEvent = Copy.Range(FromClock, ToClock); + while (pEvent) { - JZEvent *c = e->Copy(); + JZEvent* c = pEvent->Copy(); if (ForceChannel) { tChannelEvent* pChannelEvent = c->IsChannelEvent(); @@ -2020,7 +2021,7 @@ } } Put(c); - e = Copy.Next(); + pEvent = Copy.Next(); } Cleanup(); } @@ -2044,17 +2045,17 @@ tUndoBuffer *undo = &mUndoBuffers[mUndoIndex]; for (int i = undo->nEvents - 1; i >= 0; i--) { - JZEvent *e = undo->Events[i]; + JZEvent* pEvent = undo->Events[i]; if (undo->bits(i)) { undo->bits.set(i, 0); - e->UnKill(); - tEventArray::Put(e); + pEvent->UnKill(); + tEventArray::Put(pEvent); } else { undo->bits.set(i, 1); - e->Kill(); + pEvent->Kill(); } } tEventArray::Cleanup(TRUE); @@ -2074,17 +2075,17 @@ tUndoBuffer *undo = &mUndoBuffers[mUndoIndex]; for (int i = 0; i < undo->nEvents; i++) { - JZEvent *e = undo->Events[i]; + JZEvent* pEvent = undo->Events[i]; if (undo->bits(i)) { undo->bits.set(i, 0); - e->UnKill(); - tEventArray::Put(e); + pEvent->UnKill(); + tEventArray::Put(pEvent); } else { undo->bits.set(i, 1); - e->Kill(); + pEvent->Kill(); } } tEventArray::Cleanup(TRUE); @@ -2268,9 +2269,9 @@ } if (Value > 0) { - JZEvent *e = new tControl(0, Channel - 1, 0x0a, Value - 1); - Put(e); - gpMidiPlayer->OutNow(this, e); + JZEvent* pEvent = new tControl(0, Channel - 1, 0x0a, Value - 1); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } Cleanup(); } @@ -2294,9 +2295,9 @@ } if (Value > 0) { - JZEvent *e = new tControl(0, Channel - 1, 0x5B, Value - 1); - Put(e); - gpMidiPlayer->OutNow(this, e); + JZEvent* pEvent = new tControl(0, Channel - 1, 0x5B, Value - 1); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } Cleanup(); } @@ -2320,9 +2321,9 @@ } if (Value > 0) { - JZEvent *e = new tControl(0, Channel - 1, 0x5D, Value - 1); - Put(e); - gpMidiPlayer->OutNow(this, e); + JZEvent* pEvent = new tControl(0, Channel - 1, 0x5D, Value - 1); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } Cleanup(); } @@ -2743,11 +2744,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->ModSX(msp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ModSX(msp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2775,11 +2776,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->BendSX(bsp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->BendSX(bsp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2807,11 +2808,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->CafSX(csp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->CafSX(csp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2839,11 +2840,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->PafSX(psp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->PafSX(psp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2871,11 +2872,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->CC1SX(csp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->CC1SX(csp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2901,11 +2902,11 @@ Kill(CC2Settings[csp]); if (Value > 0) { - JZEvent *e = gpSynth->CC2SX(csp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->CC2SX(csp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2933,11 +2934,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->ControllerNumberSX(1, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ControllerNumberSX(1, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2965,11 +2966,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->ControllerNumberSX(2, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ControllerNumberSX(2, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3002,13 +3003,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ReverbMacroSX(0, Value - 1, lsb - 1); - if (e) + JZEvent* pEvent = gpSynth->ReverbMacroSX(0, Value - 1, lsb - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (gpConfig->GetValue(C_UseReverbMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3043,13 +3044,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ChorusMacroSX(0, Value - 1, lsb - 1); - if (e) + JZEvent* pEvent = gpSynth->ChorusMacroSX(0, Value - 1, lsb - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (gpConfig->GetValue(C_UseChorusMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3079,11 +3080,11 @@ if (Value > 0) { - JZEvent *e = gpSynth->EqualizerMacroSX(0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->EqualizerMacroSX(0, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3112,13 +3113,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ReverbParamSX(rsp, 0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ReverbParamSX(rsp, 0, Value - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (!gpConfig->GetValue(C_UseReverbMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3148,13 +3149,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ChorusParamSX(csp, 0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ChorusParamSX(csp, 0, Value - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (!gpConfig->GetValue(C_UseChorusMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3185,11 +3186,11 @@ if (rsrv) { - JZEvent *e = gpSynth->PartialReserveSX(0, Channel, rsrv); - if (e) + JZEvent* pEvent = gpSynth->PartialReserveSX(0, Channel, rsrv); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3223,11 +3224,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->MasterVolSX(0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->MasterVolSX(0, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3256,11 +3257,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->MasterPanSX(0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->MasterPanSX(0, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3310,24 +3311,24 @@ break; } - JZEvent *e = 0; + JZEvent* pEvent = 0; if (Value > 0) { switch (param) { case mspRxChannel: - e = gpSynth->RxChannelSX(0, Channel, Value - 1); + pEvent = gpSynth->RxChannelSX(0, Channel, Value - 1); break; case mspUseForRhythm: - e = gpSynth->UseForRhythmSX(0, Channel, Value - 1); + pEvent = gpSynth->UseForRhythmSX(0, Channel, Value - 1); break; } - if (e) + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3352,8 +3353,8 @@ } if (mtc) { - JZEvent *e = mtc->ToOffset(); - Put(e); + JZEvent* pEvent = mtc->ToOffset(); + Put(pEvent); } Cleanup(); } @@ -3372,13 +3373,13 @@ void JZTrack::SetDefaultSpeed(int bpm) { - JZEvent *e = new tSetTempo(0, bpm); + JZEvent* pEvent = new tSetTempo(0, bpm); if (Speed) { Kill(Speed); } - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); Cleanup(); } @@ -3386,16 +3387,16 @@ { tEventIterator Iterator(this); Sort(); - JZEvent *e = Iterator.Range(0, clk + 1); + JZEvent* pEvent = Iterator.Range(0, clk + 1); tSetTempo *t = Speed; - while (e) + while (pEvent) { - if (e->IsSetTempo()) + if (pEvent->IsSetTempo()) { - t = e->IsSetTempo(); + t = pEvent->IsSetTempo(); } - e = Iterator.Next(); - } // while e + pEvent = Iterator.Next(); + } // while pEvent return t; } Modified: trunk/jazz/src/Track.h =================================================================== --- trunk/jazz/src/Track.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Track.h 2009-01-20 04:14:04 UTC (rev 692) @@ -467,7 +467,7 @@ public: - tSysEx* Reset; + tSysEx* mpReset; tSysEx* ModulationSettings[mspModulationSysexParameters]; tSysEx* BenderSettings[bspBenderSysexParameters]; Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/TrackFrame.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -75,7 +75,7 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(JZTrackFrame, wxFrame) +BEGIN_EVENT_TABLE(JZTrackFrame, JZEventFrame) EVT_MENU(wxID_NEW, JZTrackFrame::OnFileNew) @@ -85,9 +85,6 @@ EVT_MENU(wxID_EXIT, JZTrackFrame::OnFileExit) - EVT_UPDATE_UI(ID_SHIFT, JZTrackFrame::OnUpdateEditShift) - EVT_MENU(ID_SHIFT, JZTrackFrame::OnEditShift) - EVT_MENU... [truncated message content] |
From: <pst...@us...> - 2009-01-20 05:51:24
|
Revision: 694 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=694&view=rev Author: pstieber Date: 2009-01-20 05:51:17 +0000 (Tue, 20 Jan 2009) Log Message: ----------- 1. Changed Destin to pDestin in JZSong. 2. Changed buf to pEventArray in JZPlayer. 3. Added mPlayBuffer.Clear() and mRecdBuffer.Clear() calls to ~JZPlayer. 4. Prefixed several JZTrack data members with mp. 5. Fixed a leak of end-of-track events in tSimpleEventArray::RemoveEOT. Modified Paths: -------------- trunk/jazz/src/Player.cpp trunk/jazz/src/Player.h trunk/jazz/src/Song.cpp trunk/jazz/src/Track.cpp trunk/jazz/src/Track.h trunk/jazz/src/TrackWindow.cpp Modified: trunk/jazz/src/Player.cpp =================================================================== --- trunk/jazz/src/Player.cpp 2009-01-20 05:45:55 UTC (rev 693) +++ trunk/jazz/src/Player.cpp 2009-01-20 05:51:17 UTC (rev 694) @@ -136,13 +136,13 @@ // Copy events from the passed song to output buffer. //----------------------------------------------------------------------------- void tPlayLoop::PrepareOutput( - tEventArray* buf, + tEventArray* pEventArray, JZSong* pSong, long ExtFr, long ExtTo, int Mode) { - if (buf == 0) + if (pEventArray == 0) { return; } @@ -155,7 +155,7 @@ pSong->MergeTracks( From, mStopClock, - buf, + pEventArray, gpProject->GetMetronomeInfo(), Delta, Mode); @@ -170,7 +170,7 @@ pSong->MergeTracks( From, From + Size, - buf, + pEventArray, gpProject->GetMetronomeInfo(), Delta, Mode); @@ -199,6 +199,8 @@ JZPlayer::~JZPlayer() { delete PlayLoop; + mPlayBuffer.Clear(); + mRecdBuffer.Clear(); } //----------------------------------------------------------------------------- @@ -229,7 +231,7 @@ Clock = PlayLoop->Int2ExtClock(Clock); mPlayBuffer.Clear(); - RecdBuffer.Clear(); + mRecdBuffer.Clear(); if (AudioBuffer) { AudioBuffer->Clear(); @@ -262,25 +264,25 @@ { OutNow(t, t->mpBank2); } - if (t->mPatch) + if (t->mpPatch) { - OutNow(t, t->mPatch); + OutNow(t, t->mpPatch); } - if (t->Volume) + if (t->mpVolume) { - OutNow(t, t->Volume); + OutNow(t, t->mpVolume); } - if (t->Pan) + if (t->mpPan) { - OutNow(t, t->Pan); + OutNow(t, t->mpPan); } - if (t->Reverb) + if (t->mpReverb) { - OutNow(t, t->Reverb); + OutNow(t, t->mpReverb); } - if (t->Chorus) + if (t->mpChorus) { - OutNow(t, t->Chorus); + OutNow(t, t->mpChorus); } if (t->VibRate) { @@ -700,7 +702,7 @@ #if DB_WRITE //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int dwrite(int dev, const char *buf, int size) +int dwrite(int dev, const char* buf, int size) { int i, written; //dev = 2; // stderr @@ -864,7 +866,7 @@ // Get record buffer GetRecordedData(); - RecdBuffer.Keyoff2Length(); + mRecdBuffer.Keyoff2Length(); } //----------------------------------------------------------------------------- @@ -1046,7 +1048,7 @@ tGetMidiBytes midi; if (pEvent->Write(midi) == 0) { - char *buf = new char[midi.nBytes + 3]; + char* buf = new char[midi.nBytes + 3]; buf[n++] = CMD+1; buf[n++] = 0xd7; buf[n++] = DAT+midi.nBytes; @@ -1329,7 +1331,7 @@ if (pEvent) { pEvent->Clock = PlayLoop->Ext2IntClock(pEvent->Clock); - RecdBuffer.Put(pEvent); + mRecdBuffer.Put(pEvent); } } else if (c == 0xfc) @@ -1923,7 +1925,7 @@ through = new tOSSThru(); } JZProjectManager::Instance()->NewPlayPosition(-1); - RecdBuffer.Keyoff2Length(); + mRecdBuffer.Keyoff2Length(); } //----------------------------------------------------------------------------- @@ -2053,7 +2055,7 @@ if (pEvent) { pEvent->SetClock(PlayLoop->Ext2IntClock(recd_clock)); - RecdBuffer.Put(pEvent); + mRecdBuffer.Put(pEvent); pEvent = 0; } Modified: trunk/jazz/src/Player.h =================================================================== --- trunk/jazz/src/Player.h 2009-01-20 05:45:55 UTC (rev 693) +++ trunk/jazz/src/Player.h 2009-01-20 05:51:17 UTC (rev 694) @@ -59,7 +59,7 @@ long Int2ExtClock(long Clock); void PrepareOutput( - tEventArray* buf, + tEventArray* pEventArray, JZSong* pSong, long ExtFr, long ExtTo, @@ -154,7 +154,7 @@ JZSong *Song; tEventArray mPlayBuffer; - tEventArray RecdBuffer; + tEventArray mRecdBuffer; void SetRecordInfo(JZRecordingInfo* inf) { rec_info = inf; Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2009-01-20 05:45:55 UTC (rev 693) +++ trunk/jazz/src/Song.cpp 2009-01-20 05:51:17 UTC (rev 694) @@ -341,7 +341,7 @@ void JZSong::MergeTracks( int FrClock, int ToClock, - tEventArray* Destin, + tEventArray* pDestin, const JZMetronomeInfo& MetronomeInfo, int delta, int mode) @@ -349,7 +349,7 @@ // Make metronome if (MetronomeInfo.IsOn()) { - MakeMetronome(FrClock, ToClock, Destin, MetronomeInfo, delta); + MakeMetronome(FrClock, ToClock, pDestin, MetronomeInfo, delta); } // Find solo-tracks. @@ -383,11 +383,11 @@ JZEvent* pEventCopy = pEvent->Copy(); pEventCopy->SetClock(pEventCopy->GetClock() + delta); pEventCopy->SetDevice(pTrack->GetDevice()); - Destin->Put(pEventCopy); + pDestin->Put(pEventCopy); if (pEventCopy->IsPlayTrack()) { - MergePlayTrackEvent(pEventCopy->IsPlayTrack(), Destin, 0); + MergePlayTrackEvent(pEventCopy->IsPlayTrack(), pDestin, 0); } pEvent = Iterator.Next(); @@ -401,7 +401,7 @@ //----------------------------------------------------------------------------- void JZSong::MergePlayTrackEvent( tPlayTrack* c, //the playtrack event - tEventArray* Destin, + tEventArray* pDestin, int recursionDepth) { // Recursion might be simple, but we have the infinite loop problem, if a @@ -470,10 +470,10 @@ } if (d->IsPlayTrack()) { - MergePlayTrackEvent(d->IsPlayTrack(), Destin, recursionDepth); + MergePlayTrackEvent(d->IsPlayTrack(), pDestin, recursionDepth); } d->SetDevice(pTrack->GetDevice()); - Destin->Put(d); + pDestin->Put(d); f = IteratorPL.Next(); } loopOffset+=loopLength; @@ -485,7 +485,7 @@ void JZSong::MakeMetronome( int FrClock, int ToClock, - tEventArray* Destin, + tEventArray* pDestin, const JZMetronomeInfo& MetronomeInfo, int delta) { @@ -510,13 +510,13 @@ } // Insert normal click always - Destin->Put(MetronomeInfo.CreateNormalEvent(clk + delta)); + pDestin->Put(MetronomeInfo.CreateNormalEvent(clk + delta)); // On a bar? if (count == 1 && MetronomeInfo.IsAccented()) { // Insert accented click also - Destin->Put(MetronomeInfo.CreateAccentedEvent(clk + delta)); + pDestin->Put(MetronomeInfo.CreateAccentedEvent(clk + delta)); } clk += BarInfo.GetTicksPerBar() / BarInfo.GetCountsPerBar(); Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2009-01-20 05:45:55 UTC (rev 693) +++ trunk/jazz/src/Track.cpp 2009-01-20 05:51:17 UTC (rev 694) @@ -505,6 +505,7 @@ { if (Events[i] != 0 && Events[i]->IsEndOfTrack()) { + delete Events[i]; ++j; --newnEvents; } @@ -579,13 +580,13 @@ tEventArray::tEventArray() : tSimpleEventArray(), mpName(0), - Copyright(0), - mPatch(0), - Speed(0), - Volume(0), - Pan(0), - Reverb(0), - Chorus(0), + mpCopyright(0), + mpPatch(0), + mpSpeed(0), + mpVolume(0), + mpPan(0), + mpReverb(0), + mpChorus(0), mpBank(0), mpBank2(0), mpReset(0) @@ -613,18 +614,23 @@ // delete mpName; mpName = 0; - Copyright = 0; +// delete mpCopyright; + mpCopyright = 0; - delete mPatch; - mPatch = 0; + delete mpPatch; + mpPatch = 0; - Volume = 0; +// delete mpVolume; + mpVolume = 0; - Pan = 0; +// delete mpPan; + mpPan = 0; - Reverb = 0; +// delete mpReverb; + mpReverb = 0; - Chorus = 0; +// delete mpChorus; + mpChorus = 0; delete mpBank; mpBank = 0; @@ -635,7 +641,9 @@ delete mpReset; mpReset = 0; - Speed = 0; +// delete mpSpeed; + mpSpeed = 0; + Channel = 1; Device = 0; @@ -754,17 +762,17 @@ // delete mpName; mpName = 0; - Copyright = 0; + mpCopyright = 0; - Speed = 0; + mpSpeed = 0; - Volume = 0; + mpVolume = 0; - Pan = 0; + mpPan = 0; - Reverb = 0; + mpReverb = 0; - Chorus = 0; + mpChorus = 0; for (i = 0; i < mspModulationSysexParameters; i++) { @@ -846,13 +854,13 @@ mpName = pEvent->IsTrackName(); } - if (!Copyright) + if (!mpCopyright) { - Copyright = pEvent->IsCopyright(); + mpCopyright = pEvent->IsCopyright(); } - if (!Speed) + if (!mpSpeed) { - Speed = pEvent->IsSetTempo(); + mpSpeed = pEvent->IsSetTempo(); } if (!MtcOffset) { @@ -863,27 +871,27 @@ switch (pControl->GetControl()) { case 0x07: - if (!Volume) + if (!mpVolume) { - Volume = pControl; + mpVolume = pControl; } break; case 0x0a: - if (!Pan) + if (!mpPan) { - Pan = pControl; + mpPan = pControl; } break; case 0x5b: - if (!Reverb) + if (!mpReverb) { - Reverb = pControl; + mpReverb = pControl; } break; case 0x5d: - if (!Chorus) + if (!mpChorus) { - Chorus = pControl; + mpChorus = pControl; } break; } @@ -1301,9 +1309,9 @@ Io.NextTrack(); // Write copyright notice first (according to spec): - if (Copyright) + if (mpCopyright) { - Copyright->Write(Io); + mpCopyright->Write(Io); } // Write MTC offset before any transmittable events (spec) @@ -1382,9 +1390,9 @@ mpBank2->Write(Io); } - if (mPatch) + if (mpPatch) { - mPatch->Write(Io); + mpPatch->Write(Io); } tJazzMeta JazzMeta; @@ -1591,21 +1599,21 @@ } else if (pEvent->IsProgram()) { - if (!mPatch) + if (!mpPatch) { - mPatch = pEvent->IsProgram(); - mPatch->SetClock(0); + mpPatch = pEvent->IsProgram(); + mpPatch->SetClock(0); SpecialEvent = true; } } else if (pEvent->IsCopyright()) { - if (!Copyright) + if (!mpCopyright) { - Copyright = pEvent->IsCopyright(); + mpCopyright = pEvent->IsCopyright(); // Just make sure clock is zero, then put into event array - Copyright->SetClock(0); + mpCopyright->SetClock(0); } } else if (pEvent->IsSysEx()) @@ -1847,9 +1855,9 @@ { trk->mpBank->Channel = trk->Channel - 1; } - if (trk->mPatch) + if (trk->mpPatch) { - trk->mPatch->Channel = trk->Channel - 1; + trk->mpPatch->Channel = trk->Channel - 1; } if (!trk->DrumParams.IsEmpty()) { @@ -2124,9 +2132,9 @@ const char* JZTrack::GetCopyright() { - if (Copyright) + if (mpCopyright) { - return (const char *)Copyright->GetData(); + return (const char *)mpCopyright->GetData(); } return ""; } @@ -2135,9 +2143,9 @@ void JZTrack::SetCopyright(char *str) { - if (Copyright) + if (mpCopyright) { - Kill(Copyright); + Kill(mpCopyright); } if (str && strlen(str)) { @@ -2177,22 +2185,22 @@ Cleanup(); } -// ------------------------ Volume ------------------------------ +// ------------------------ Volume ------------------------------ int JZTrack::GetVolume() { - if (Volume) + if (mpVolume) { - return Volume->GetControlValue() + 1; + return mpVolume->GetControlValue() + 1; } return 0; } void JZTrack::SetVolume(int Value) { - if (Volume) + if (mpVolume) { - Kill(Volume); + Kill(mpVolume); } if (Value > 0) { @@ -2205,17 +2213,17 @@ bool JZTrack::DecreaseVolume() { - if (Volume && Volume->GetControlValue() > 0) + if (mpVolume && mpVolume->GetControlValue() > 0) { - Kill(Volume); + Kill(mpVolume); - Volume->SetControlValue(Volume->GetControlValue() - 1); + mpVolume->SetControlValue(mpVolume->GetControlValue() - 1); JZEvent* pEvent = new tControl( 0, Channel - 1, 0x07, - Volume->GetControlValue()); + mpVolume->GetControlValue()); Put(pEvent); gpMidiPlayer->OutNow(this, pEvent); @@ -2228,17 +2236,17 @@ bool JZTrack::IncreaseVolume() { - if (Volume && Volume->GetControlValue() < 127) + if (mpVolume && mpVolume->GetControlValue() < 127) { - Kill(Volume); + Kill(mpVolume); - Volume->SetControlValue(Volume->GetControlValue() + 1); + mpVolume->SetControlValue(mpVolume->GetControlValue() + 1); JZEvent* pEvent = new tControl( 0, Channel - 1, 0x07, - Volume->GetControlValue()); + mpVolume->GetControlValue()); Put(pEvent); gpMidiPlayer->OutNow(this, pEvent); @@ -2250,22 +2258,22 @@ return false; } -// ------------------------ Pan ------------------------------ +// ------------------------ Pan ------------------------------ int JZTrack::GetPan() { - if (Pan) + if (mpPan) { - return Pan->GetControlValue() + 1; + return mpPan->GetControlValue() + 1; } return 0; } void JZTrack::SetPan(int Value) { - if (Pan) + if (mpPan) { - Kill(Pan); + Kill(mpPan); } if (Value > 0) { @@ -2276,22 +2284,22 @@ Cleanup(); } -// ------------------------ Reverb ------------------------------ +// ------------------------ Reverb ------------------------------ int JZTrack::GetReverb() { - if (Reverb) + if (mpReverb) { - return Reverb->GetControlValue() + 1; + return mpReverb->GetControlValue() + 1; } return 0; } void JZTrack::SetReverb(int Value) { - if (Reverb) + if (mpReverb) { - Kill(Reverb); + Kill(mpReverb); } if (Value > 0) { @@ -2302,22 +2310,22 @@ Cleanup(); } -// ------------------------ Chorus ------------------------------ +// ------------------------ Chorus ------------------------------ int JZTrack::GetChorus() { - if (Chorus) + if (mpChorus) { - return Chorus->GetControlValue() + 1; + return mpChorus->GetControlValue() + 1; } return 0; } void JZTrack::SetChorus(int Value) { - if (Chorus) + if (mpChorus) { - Kill(Chorus); + Kill(mpChorus); } if (Value > 0) { @@ -2430,24 +2438,24 @@ int JZTrack::GetPatch() { - if (mPatch) + if (mpPatch) { - return mPatch->GetProgram() + 1; + return mpPatch->GetProgram() + 1; } return 0; } void JZTrack::SetPatch(int PatchNr) { - if (mPatch) + if (mpPatch) { - delete mPatch; - mPatch = 0; + delete mpPatch; + mpPatch = 0; } if (PatchNr > 0) { - mPatch = new tProgram(0, Channel - 1, PatchNr - 1); - gpMidiPlayer->OutNow(this, mPatch); + mpPatch = new tProgram(0, Channel - 1, PatchNr - 1); + gpMidiPlayer->OutNow(this, mpPatch); mChanged = true; } } @@ -3359,13 +3367,13 @@ Cleanup(); } -// ------------------------ Speed ------------------------------ +// ------------------------ Speed ------------------------------ int JZTrack::GetDefaultSpeed() { - if (Speed) + if (mpSpeed) { - return Speed->GetBPM(); + return mpSpeed->GetBPM(); } return 120; } @@ -3374,9 +3382,9 @@ void JZTrack::SetDefaultSpeed(int bpm) { JZEvent* pEvent = new tSetTempo(0, bpm); - if (Speed) + if (mpSpeed) { - Kill(Speed); + Kill(mpSpeed); } Put(pEvent); gpMidiPlayer->OutNow(this, pEvent); @@ -3388,7 +3396,7 @@ tEventIterator Iterator(this); Sort(); JZEvent* pEvent = Iterator.Range(0, clk + 1); - tSetTempo *t = Speed; + tSetTempo* t = mpSpeed; while (pEvent) { if (pEvent->IsSetTempo()) Modified: trunk/jazz/src/Track.h =================================================================== --- trunk/jazz/src/Track.h 2009-01-20 05:45:55 UTC (rev 693) +++ trunk/jazz/src/Track.h 2009-01-20 05:51:17 UTC (rev 694) @@ -455,13 +455,13 @@ public: tTrackName* mpName; - tCopyright* Copyright; - tProgram* mPatch; - tSetTempo* Speed; - tControl* Volume; - tControl* Pan; - tControl* Reverb; - tControl* Chorus; + tCopyright* mpCopyright; + tProgram* mpPatch; + tSetTempo* mpSpeed; + tControl* mpVolume; + tControl* mpPan; + tControl* mpReverb; + tControl* mpChorus; tControl* mpBank; tControl* mpBank2; Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2009-01-20 05:45:55 UTC (rev 693) +++ trunk/jazz/src/TrackWindow.cpp 2009-01-20 05:51:17 UTC (rev 694) @@ -1412,7 +1412,7 @@ } if ( !pRecInfo->mpTrack->GetAudioMode() && - !gpProject->GetPlayer()->RecdBuffer.IsEmpty()) + !gpProject->GetPlayer()->mRecdBuffer.IsEmpty()) { //int choice = wxMessageBox("Keep recorded events?", "You played", wxOK | wxCANCEL); //if (choice == wxOK) @@ -1420,7 +1420,7 @@ wxBeginBusyCursor(); gpProject->NewUndoBuffer(); pRecInfo->mpTrack->MergeRange( - &gpProject->GetPlayer()->RecdBuffer, + &gpProject->GetPlayer()->mRecdBuffer, pRecInfo->mFromClock, pRecInfo->mToClock, pRecInfo->mIsMuted); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-20 15:03:38
|
Revision: 695 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=695&view=rev Author: pstieber Date: 2009-01-20 15:03:32 +0000 (Tue, 20 Jan 2009) Log Message: ----------- 1. Removed more code from the event frame that now is in the event Window and started using the event window version of AreEventsSelected. 2. Changed up -> Up and made it a Boolean in JZPianoWindow::SnapClock. Modified Paths: -------------- trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventFrame.h trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/PianoWindow.h Modified: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp 2009-01-20 05:51:17 UTC (rev 694) +++ trunk/jazz/src/EventFrame.cpp 2009-01-20 15:03:32 UTC (rev 695) @@ -40,39 +40,19 @@ : wxFrame(pParent, wxID_ANY, Title, Position, Size, WindowStyle), Song(pSong), mpFilter(0), - mTrackHeight(0), mTopInfoHeight(40), - FontSize(12), - ClocksPerPixel(36), mEventsX(), mEventsY(mTopInfoHeight), mEventsWidth(0), mEventsHeight(0), - CanvasX(0), - CanvasY(0), - CanvasW(0), - CanvasH(0), - FromClock(0), - ToClock(0), - FromLine(0), - ToLine(0), SnapSel(0), MouseAction(0), PlayClock(-1), mpSettingsDialog(0), MixerForm(0), mpToolBar(0), - mpGreyColor(0), - mpGreyBrush(0), mpEventWindow(0) { -#ifdef __WXMSW__ - mpGreyColor = new wxColor(192, 192, 192); -#else - mpGreyColor = new wxColor(220, 220, 220); -#endif - mpGreyBrush = new wxBrush(*mpGreyColor, wxSOLID); - mpFilter = new JZFilter(Song); } @@ -80,9 +60,6 @@ { delete SnapSel; - delete mpGreyColor; - delete mpGreyBrush; - delete mpFilter; delete mpToolBar; @@ -135,77 +112,25 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZEventFrame::y2Line(int y, int up) -{ - if (up) - { - y += mTrackHeight; - } - y -= mTopInfoHeight; - return y / mTrackHeight; -} +//int JZEventFrame::y2Line(int y, bool Up) +//{ +// if (Up) +// { +// y += mTrackHeight; +// } +// y -= mTopInfoHeight; +// return y / mTrackHeight; +//} //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZEventFrame::Line2y(int Line) -{ - return Line * mTrackHeight + mTopInfoHeight; -} +//int JZEventFrame::Line2y(int Line) +//{ +// return Line * mTrackHeight + mTopInfoHeight; +//} -/* //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZEventFrame::LineText(wxDC *dc, int x, int y, int w, const char *str, int h, bool down) -{ - if (h <= 0) - { - h = mTrackHeight; - y = y2yLine(y); - } - if (w && h) - { - //dc->SetBrush(wxGREY_BRUSH); - dc->SetBrush(*mpGreyBrush); - dc->SetPen(*wxGREY_PEN); - #ifdef __WXMSW__ - dc->DrawRectangle(x, y, w+1, h+1); - #else - dc->DrawRectangle(x, y, w, h); - #endif - x += 1; - y += 1; - w -= 2; - h -= 2; - if (down) - { - dc->SetPen(*wxBLACK_PEN); - dc->DrawLine(x, y, x+w, y); - dc->DrawLine(x, y, x, y+h); - dc->SetPen(*wxWHITE_PEN); - dc->DrawLine(x+w, y, x+w, y+h); - dc->DrawLine(x, y+h, x+w, y+h); - } - else - { - dc->SetPen(*wxWHITE_PEN); - dc->DrawLine(x, y, x+w, y); - dc->DrawLine(x, y, x, y+h); - dc->SetPen(*wxBLACK_PEN); - dc->DrawLine(x+w, y, x+w, y+h); - dc->DrawLine(x, y+h, x+w, y+h); - } - dc->SetPen(*wxBLACK_PEN); - x -= 2; - y -= 2; - } - dc->SetTextBackground(*mpGreyColor); - dc->DrawText((char *)str, x + mLittleBit, y + mLittleBit); - dc->SetTextBackground(*wxWHITE); -} -*/ - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- void JZEventFrame::Redraw() { // wxDC* dc=new wxClientDC(this); @@ -308,26 +233,13 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZEventFrame::EventsSelected(const char* msg) +void JZEventFrame::MenQuantize() { - if (!SnapSel->IsSelected()) + if (!mpEventWindow || !mpEventWindow->AreEventsSelected()) { - if (msg == 0) - { - msg = "please select some events first"; - } - wxMessageBox((char *)msg, "Error", wxOK); - return 0; + return; } - return 1; -} -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::MenQuantize() -{ - if (!EventsSelected()) - return; // wxDialogBox *panel = new wxDialogBox(this, "Quantize", FALSE ); tQuantizeDlg * dlg = new tQuantizeDlg(this, mpFilter); dlg->Create(); @@ -337,8 +249,11 @@ //----------------------------------------------------------------------------- void JZEventFrame::MenCleanup() { - if (!EventsSelected()) - return; + if (!mpEventWindow || !mpEventWindow->AreEventsSelected()) + { + return; + } + tCleanupDlg * dlg = new tCleanupDlg(this, mpFilter); dlg->Create(); } @@ -347,8 +262,11 @@ //----------------------------------------------------------------------------- void JZEventFrame::MenSearchReplace() { - if (!EventsSelected()) - return; + if (!mpEventWindow || !mpEventWindow->AreEventsSelected()) + { + return; + } + tSearchReplaceDlg * dlg = new tSearchReplaceDlg(this, mpFilter); dlg->Create(); } @@ -357,8 +275,11 @@ //----------------------------------------------------------------------------- void JZEventFrame::MenSetChannel() { - if (!EventsSelected()) - return; + if (!mpEventWindow || !mpEventWindow->AreEventsSelected()) + { + return; + } + tSetChannelDlg * dlg = new tSetChannelDlg(mpFilter); dlg->Create(); } @@ -367,8 +288,11 @@ //----------------------------------------------------------------------------- void JZEventFrame::MenTranspose() { - if (!EventsSelected()) - return; + if (!mpEventWindow || !mpEventWindow->AreEventsSelected()) + { + return; + } + tTransposeDlg * dlg = new tTransposeDlg(this, mpFilter); dlg->Create(); } @@ -377,8 +301,11 @@ //----------------------------------------------------------------------------- void JZEventFrame::MenDelete() { - if (!EventsSelected()) - return; + if (!mpEventWindow || !mpEventWindow->AreEventsSelected()) + { + return; + } + tDeleteDlg * dlg = new tDeleteDlg(this, mpFilter); dlg->Create(); } @@ -387,8 +314,11 @@ //----------------------------------------------------------------------------- void JZEventFrame::MenVelocity() { - if (!EventsSelected()) - return; + if (!mpEventWindow || !mpEventWindow->AreEventsSelected()) + { + return; + } + tVelocityDlg * dlg = new tVelocityDlg(mpFilter); dlg->Create(); } @@ -397,8 +327,11 @@ //----------------------------------------------------------------------------- void JZEventFrame::MenLength() { - if (!EventsSelected()) - return; + if (!mpEventWindow || !mpEventWindow->AreEventsSelected()) + { + return; + } + tLengthDlg * dlg = new tLengthDlg(this, mpFilter); dlg->Create(); } @@ -408,8 +341,11 @@ //----------------------------------------------------------------------------- void JZEventFrame::MenConvertToModulation() { - if (!EventsSelected()) - return; + if (!mpEventWindow || !mpEventWindow->AreEventsSelected()) + { + return; + } + tCmdConvertToModulation cmd(mpFilter); cmd.Execute(); Redraw(); Modified: trunk/jazz/src/EventFrame.h =================================================================== --- trunk/jazz/src/EventFrame.h 2009-01-20 05:51:17 UTC (rev 694) +++ trunk/jazz/src/EventFrame.h 2009-01-20 15:03:32 UTC (rev 695) @@ -63,27 +63,16 @@ virtual void SetEventWindow(JZEventWindow* pEventWindow); - int mTrackHeight; - int mTopInfoHeight; - int FontSize; - int ClocksPerPixel; int mEventsX, mEventsY, mEventsWidth, mEventsHeight; - int CanvasX, CanvasY, CanvasW, CanvasH; // canvas coords - int FromClock, ToClock; - int FromLine, ToLine; - // Mousehandling + // Mouse handling JZSnapSelection* SnapSel; tMouseAction* MouseAction; virtual void SnapSelStart(wxMouseEvent &e); virtual void SnapSelStop(wxMouseEvent &e); - // methods - int y2Line(int y, int up = 0); - int Line2y(int line); - int PlayClock; // Events @@ -102,11 +91,6 @@ // Mixer-Dialog wxDialog* MixerForm; - // Edit-Menu - - // if selection active: TRUE, else: Errormessage + FALSE - int EventsSelected(const char* msg = 0); - private: void OnUpdateEditShift(wxUpdateUIEvent& Event); @@ -132,8 +116,6 @@ protected: JZToolBar* mpToolBar; - wxColor* mpGreyColor; - wxBrush* mpGreyBrush; JZEventWindow* mpEventWindow; Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2009-01-20 05:51:17 UTC (rev 694) +++ trunk/jazz/src/PianoWindow.cpp 2009-01-20 15:03:32 UTC (rev 695) @@ -1868,7 +1868,7 @@ void JZPianoWindow::SnapSelStart(wxMouseEvent &) { mSnapCount = 0; - int clk = SnapClock(mFromClock, 0); + int clk = SnapClock(mFromClock, false); int qnt = SnapClocks(); while (clk <= mToClock && mSnapCount < eMaxSnaps) { @@ -1891,11 +1891,11 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZPianoWindow::SnapClock(int Clock, int up) +int JZPianoWindow::SnapClock(int Clock, bool Up) { int qnt = SnapClocks(); Clock -= (Clock % qnt); - if (up) + if (Up) { Clock += qnt; } Modified: trunk/jazz/src/PianoWindow.h =================================================================== --- trunk/jazz/src/PianoWindow.h 2009-01-20 05:51:17 UTC (rev 694) +++ trunk/jazz/src/PianoWindow.h 2009-01-20 15:03:32 UTC (rev 695) @@ -113,7 +113,7 @@ void SnapSelStart(wxMouseEvent& Event); - int SnapClock(int Clock, int up = 0); + int SnapClock(int Clock, bool Up = false); void SnapSelStop(wxMouseEvent& Event); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-21 06:04:41
|
Revision: 696 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=696&view=rev Author: pstieber Date: 2009-01-21 06:04:36 +0000 (Wed, 21 Jan 2009) Log Message: ----------- 1. Updated some resource IDs. 2. Continued with the event frame cleanup. Modified Paths: -------------- trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventFrame.h trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h trunk/jazz/src/PianoFrame.cpp trunk/jazz/src/Resources.h trunk/jazz/src/TrackFrame.cpp Modified: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp 2009-01-20 15:03:32 UTC (rev 695) +++ trunk/jazz/src/EventFrame.cpp 2009-01-21 06:04:36 UTC (rev 696) @@ -47,7 +47,6 @@ mEventsHeight(0), SnapSel(0), MouseAction(0), - PlayClock(-1), mpSettingsDialog(0), MixerForm(0), mpToolBar(0), @@ -56,6 +55,8 @@ mpFilter = new JZFilter(Song); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- JZEventFrame::~JZEventFrame() { delete SnapSel; @@ -81,104 +82,45 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZEventFrame::OnUpdateEditShift(wxUpdateUIEvent& Event) +void JZEventFrame::SnapSelStart(wxMouseEvent& MouseEvent) { - if (mpEventWindow) - { - Event.Enable(mpEventWindow->AreEventsSelected()); - } - else - { - Event.Enable(false); - } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZEventFrame::OnEditShift(wxCommandEvent& Event) +void JZEventFrame::SnapSelStop(wxMouseEvent& MouseEvent) { - if (mpEventWindow) - { - mpEventWindow->Shift(16); - } } //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -bool JZEventFrame::OnCharHook(wxKeyEvent& e) -{ - return OnKeyEvent(e); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -//int JZEventFrame::y2Line(int y, bool Up) -//{ -// if (Up) -// { -// y += mTrackHeight; -// } -// y -= mTopInfoHeight; -// return y / mTrackHeight; -//} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -//int JZEventFrame::Line2y(int Line) -//{ -// return Line * mTrackHeight + mTopInfoHeight; -//} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::Redraw() -{ -// wxDC* dc=new wxClientDC(this); -// wxPaintEvent e; -// cout<<"FIXME JZEventFrame::Redraw"<<endl; -// mpEventWindow->OnDraw(*dc); //this will in turn call the eventwin onpaintsub -// // the problem is that onpaint no longer takes arguments, and is supposed -// // to be called from the framework only, so it should be split. -// delete dc; - -// if (mpEventWindow) -// { -// mpEventWindow->Refresh(); -// } -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -bool JZEventFrame::OnKeyEvent(wxKeyEvent &e) -{ - return false; -} - -//----------------------------------------------------------------------------- // seems to handle the "selection" rectangle. normally called from the base // class onmouseevent handler //----------------------------------------------------------------------------- -int JZEventFrame::OnMouseEvent(wxMouseEvent &e) +int JZEventFrame::OnMouseEvent(wxMouseEvent& MouseEvent) { - // cout <<"JZEventFrame::OnMouseEvent"<<endl; +// cout << "JZEventFrame::OnMouseEvent" << endl; if (!MouseAction) { // create SnapSel? int x; int y; - e.GetPosition(&x, &y); - if (mEventsX < x && x < mEventsX + mEventsWidth && mEventsY < y && y < mEventsY + mEventsHeight) + MouseEvent.GetPosition(&x, &y); + if ( + mEventsX < x && + x < mEventsX + mEventsWidth && + mEventsY < y && + y < mEventsY + mEventsHeight) { - if (e.LeftDown()) + if (MouseEvent.LeftDown()) { { - SnapSelStart(e); + SnapSelStart(MouseEvent); if (SnapSel->IsSelected()) { Refresh(); //redraw the whole window instead(inefficient, we should rather invalidate a rect) } - SnapSel->Event(e); + SnapSel->Event(MouseEvent); MouseAction = SnapSel; } } @@ -188,13 +130,13 @@ { // MouseAction active - if (MouseAction->Event(e)) + if (MouseAction->Event(MouseEvent)) { // MouseAction finished if (MouseAction == SnapSel) { - SnapSelStop(e); + SnapSelStop(MouseEvent); Redraw(); //ineficcient, invalidate rect first instead MouseAction = 0; return 1; @@ -208,36 +150,74 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +bool JZEventFrame::OnKeyEvent(wxKeyEvent& KeyEvent) +{ + return false; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- bool JZEventFrame::OnClose() { - return FALSE; + return false; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZEventFrame::OnMenuCommand(int) +void JZEventFrame::Redraw() { +// wxDC* dc=new wxClientDC(this); +// wxPaintEvent PaintEvent; +// cout<<"FIXME JZEventFrame::Redraw"<<endl; +// mpEventWindow->OnDraw(*dc); //this will in turn call the eventwin onpaintsub +// // the problem is that onpaint no longer takes arguments, and is supposed +// // to be called from the framework only, so it should be split. +// delete dc; + +// if (mpEventWindow) +// { +// mpEventWindow->Refresh(); +// } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZEventFrame::SnapSelStart(wxMouseEvent& MouseEvent) +bool JZEventFrame::OnCharHook(wxKeyEvent& KeyEvent) { + return OnKeyEvent(KeyEvent); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZEventFrame::SnapSelStop(wxMouseEvent& MouseEvent) +void JZEventFrame::OnUpdateEditShift(wxUpdateUIEvent& Event) { + if (mpEventWindow) + { + Event.Enable(mpEventWindow->AreEventsSelected()); + } + else + { + Event.Enable(false); + } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZEventFrame::MenQuantize() +void JZEventFrame::OnEditShift(wxCommandEvent& Event) { + if (mpEventWindow) + { + mpEventWindow->Shift(16); + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::OnQuantize(wxCommandEvent& Event) +{ if (!mpEventWindow || !mpEventWindow->AreEventsSelected()) { - return; + return; } // wxDialogBox *panel = new wxDialogBox(this, "Quantize", FALSE ); Modified: trunk/jazz/src/EventFrame.h =================================================================== --- trunk/jazz/src/EventFrame.h 2009-01-20 15:03:32 UTC (rev 695) +++ trunk/jazz/src/EventFrame.h 2009-01-21 06:04:36 UTC (rev 696) @@ -57,50 +57,49 @@ virtual ~JZEventFrame(); - JZSong* Song; - - JZFilter* mpFilter; - virtual void SetEventWindow(JZEventWindow* pEventWindow); - int mTopInfoHeight; - - int mEventsX, mEventsY, mEventsWidth, mEventsHeight; - - // Mouse handling - JZSnapSelection* SnapSel; - tMouseAction* MouseAction; virtual void SnapSelStart(wxMouseEvent &e); virtual void SnapSelStop(wxMouseEvent &e); - int PlayClock; - // Events virtual int OnMouseEvent(wxMouseEvent& Event); virtual bool OnKeyEvent(wxKeyEvent& Event); // true = processed by eventwin - virtual void OnMenuCommand(int id); virtual bool OnClose(); // Redraw - nach Aenderungen von Parametern, kein GUI-Event virtual void Redraw(); + + + + JZSong* Song; + + JZFilter* mpFilter; + + int mTopInfoHeight; + + int mEventsX, mEventsY, mEventsWidth, mEventsHeight; + + // Mouse handling + JZSnapSelection* SnapSel; + tMouseAction* MouseAction; + // Settings-Dialog wxDialog* mpSettingsDialog; - void SettingsDialog(int piano); // Mixer-Dialog wxDialog* MixerForm; private: + bool OnCharHook(wxKeyEvent& Event); + void OnUpdateEditShift(wxUpdateUIEvent& Event); void OnEditShift(wxCommandEvent& Event); - bool OnCharHook(wxKeyEvent& Event); + void OnQuantize(wxCommandEvent& Event); - void OnChar(wxKeyEvent& Event); - - void MenQuantize(); void MenSetChannel(); void MenTranspose(); void MenDelete(); Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-01-20 15:03:32 UTC (rev 695) +++ trunk/jazz/src/EventWindow.cpp 2009-01-21 06:04:36 UTC (rev 696) @@ -147,6 +147,19 @@ } //----------------------------------------------------------------------------- +// Quantize selected events. +//----------------------------------------------------------------------------- +//void JZEventWindow::Quantize() +//{ +// if (AreEventsSelected()) +// { +// tCmdQuantize QuantizeCommand(mpFilter, SnapClocks(), 0, 0); +// QuantizeCommand.Execute(1); +// JZProjectManager::Instance()->UpdateAllViews(); +// } +//} + +//----------------------------------------------------------------------------- // Description: // Only consider the event portion of the window when computing the virtual // size. Do not consider the static information of the left or top portion of Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2009-01-20 15:03:32 UTC (rev 695) +++ trunk/jazz/src/EventWindow.h 2009-01-21 06:04:36 UTC (rev 696) @@ -55,6 +55,8 @@ void Shift(int Units); +// void Quantize(); + void LineText( wxDC& Dc, int x, Modified: trunk/jazz/src/PianoFrame.cpp =================================================================== --- trunk/jazz/src/PianoFrame.cpp 2009-01-20 15:03:32 UTC (rev 695) +++ trunk/jazz/src/PianoFrame.cpp 2009-01-21 06:04:36 UTC (rev 696) @@ -54,14 +54,11 @@ #define ACT_SETTINGS 5 #define MEN_FILTER 6 -#define MEN_SNAP 7 #define MEN_METERCH 8 #define ACT_HELP_MOUSE 9 -#define MEN_QUANTIZE 12 #define MEN_SETCHAN 14 #define MEN_TRANSP 15 -#define MEN_VELOC 16 #define MEN_LERI 18 #define MEN_UPDN 19 #define MEN_LENGTH 20 @@ -81,8 +78,6 @@ #define MEN_RESET 36 #define MEN_VIS_ALL_TRK 37 #define MEN_SEARCHREP 38 -#define MEN_SHIFTL 39 -#define MEN_SHIFTR 40 #define ACT_CLOSE 41 #define MEN_CTRL_TEMPO 42 @@ -110,10 +105,10 @@ { ID_SNAP_16D, TRUE, note163_xpm, "snap 1/24"}, { JZToolBar::eToolBarSeparator }, { wxID_CUT, FALSE, cut_xpm, "cut selection"}, - { wxID_DELETE, FALSE, delete_xpm, "delete selection"}, - { MEN_QUANTIZE, FALSE, quantize_xpm, "quantize selection"}, - { MEN_SHIFTL, FALSE, shiftl_xpm, "shift selection left"}, - { MEN_SHIFTR, FALSE, shiftr_xpm, "shift selection right"}, + { wxID_DELETE, FALSE, delete_xpm, "delete selection"}, + { ID_QUANTIZE, FALSE, quantize_xpm, "quantize selection"}, + { ID_SHIFT_LEFT, FALSE, shiftl_xpm, "shift selection left"}, + { ID_SHIFT_RIGHT, FALSE, shiftr_xpm, "shift selection right"}, { MEN_VIS_ALL_TRK, TRUE, evnts_xpm, "show events from all tracks"}, { JZToolBar::eToolBarSeparator }, { wxID_ZOOM_IN, FALSE, zoomin_xpm, "zoom in"}, @@ -174,11 +169,11 @@ EVT_MENU(wxID_CUT, JZPianoFrame::OnCut) EVT_MENU(wxID_COPY, JZPianoFrame::OnCopy) EVT_MENU(ID_SHIFT, JZPianoFrame::OnShift) - EVT_MENU(MEN_SHIFTL, JZPianoFrame::OnShiftLeft) - EVT_MENU(MEN_SHIFTR, JZPianoFrame::OnShiftRight) + EVT_MENU(ID_SHIFT_LEFT, JZPianoFrame::OnShiftLeft) + EVT_MENU(ID_SHIFT_RIGHT, JZPianoFrame::OnShiftRight) EVT_MENU(MEN_LERI, JZPianoFrame::OnExchangeLeftRight) EVT_MENU(MEN_UPDN, JZPianoFrame::OnExchangeUpDown) - EVT_MENU(MEN_QUANTIZE, JZPianoFrame::OnQuantize) + EVT_MENU(ID_QUANTIZE, JZPianoFrame::OnQuantize) EVT_MENU(wxID_UNDO, JZPianoFrame::OnUndo) EVT_MENU(wxID_REDO, JZPianoFrame::OnRedo) EVT_MENU(MEN_CTRL_PITCH, JZPianoFrame::OnCtrlPitch) @@ -195,7 +190,7 @@ // EVT_MENU(MEN_SEARCHREP, JZPianoFrame::MenSearchReplace) // EVT_MENU(MEN_TRANSP, JZPianoFrame::MenTranspose) // EVT_MENU(MEN_SETCHAN, JZPianoFrame::MenSetChannel) - EVT_MENU(MEN_VELOC, JZPianoFrame::OnActivateVelocityDialog) + EVT_MENU(ID_VELOCITY, JZPianoFrame::OnActivateVelocityDialog) // EVT_MENU(MEN_LENGTH, JZPianoFrame::MenLength) EVT_MENU(MEN_MIDIDELAY, JZPianoFrame::OnActivateMidiDelayDialog) EVT_MENU(MEN_SEQLENGTH, JZPianoFrame::OnActivateSequenceLengthDialog) @@ -203,7 +198,7 @@ // EVT_MENU(MEN_CONVERT_TO_MODULATION, JZPianoFrame::MenConvertToModulation) EVT_MENU(ACT_SETTINGS, JZPianoFrame::OnActivateSettingsDialog) EVT_MENU(MEN_FILTER, JZPianoFrame::OnFilter) - EVT_MENU(MEN_SNAP, JZPianoFrame::OnSnapDlg) + EVT_MENU(ID_SNAP, JZPianoFrame::OnSnapDlg) // These are all "Patrick Approved" EVT_CLOSE(JZPianoFrame::ActCloseEvent) @@ -336,10 +331,10 @@ edit_menu->Append(wxID_COPY, "&Copy"); edit_menu->Append(wxID_CUT, "&Cut"); edit_menu->Append(ID_SHIFT, "&Shift..."); - edit_menu->Append(MEN_QUANTIZE, "&Quantize..."); + edit_menu->Append(ID_QUANTIZE, "&Quantize..."); edit_menu->Append(MEN_SETCHAN, "&Set MIDI Channel..."); edit_menu->Append(MEN_TRANSP, "&Transpose..."); - edit_menu->Append(MEN_VELOC, "&Velocity..."); + edit_menu->Append(ID_VELOCITY, "&Velocity..."); edit_menu->Append(MEN_LENGTH, "&Length..."); edit_menu->Append(MEN_SEQLENGTH, "&Sequence Length..."); @@ -355,7 +350,7 @@ setting_menu->Append(MEN_FILTER, "&Filter..."); setting_menu->Append(ACT_SETTINGS, "&Window..."); setting_menu->Append(MEN_VISIBLE, "&Events..."); - setting_menu->Append(MEN_SNAP, "&Snap..."); + setting_menu->Append(ID_SNAP, "&Snap..."); setting_menu->Append(MEN_METERCH, "&Meterchange..."); wxMenu *misc_menu = new wxMenu("",wxMENU_TEAROFF); Modified: trunk/jazz/src/Resources.h =================================================================== --- trunk/jazz/src/Resources.h 2009-01-20 15:03:32 UTC (rev 695) +++ trunk/jazz/src/Resources.h 2009-01-21 06:04:36 UTC (rev 696) @@ -49,13 +49,15 @@ #define ID_SHIFT wxID_HIGHEST + 32 #define ID_SHIFT_LEFT wxID_HIGHEST + 33 #define ID_SHIFT_RIGHT wxID_HIGHEST + 34 -#define ID_SNAP_8 wxID_HIGHEST + 35 -#define ID_SNAP_8D wxID_HIGHEST + 36 -#define ID_SNAP_16 wxID_HIGHEST + 37 -#define ID_SNAP_16D wxID_HIGHEST + 38 -#define ID_MIXER wxID_HIGHEST + 39 -#define ID_PIANOWIN wxID_HIGHEST + 40 -#define ID_METRONOME_TOGGLE wxID_HIGHEST + 41 +#define ID_SNAP wxID_HIGHEST + 35 +#define ID_SNAP_8 wxID_HIGHEST + 36 +#define ID_SNAP_8D wxID_HIGHEST + 37 +#define ID_SNAP_16 wxID_HIGHEST + 38 +#define ID_SNAP_16D wxID_HIGHEST + 39 +#define ID_MIXER wxID_HIGHEST + 40 +#define ID_PIANOWIN wxID_HIGHEST + 41 +#define ID_METRONOME_TOGGLE wxID_HIGHEST + 42 +#define ID_VELOCITY wxID_HIGHEST + 43 #define ID_PLAY wxID_HIGHEST + 50 #define ID_PLAY_LOOP wxID_HIGHEST + 51 Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2009-01-20 15:03:32 UTC (rev 695) +++ trunk/jazz/src/TrackFrame.cpp 2009-01-21 06:04:36 UTC (rev 696) @@ -238,10 +238,10 @@ mpEditMenu->AppendSeparator(); -// mpEditMenu->Append(MEN_QUANTIZE, "&Quantize..."); +// mpEditMenu->Append(ID_QUANTIZE, "&Quantize..."); // mpEditMenu->Append(MEN_SETCHAN, "&Set MIDI Channel..."); // mpEditMenu->Append(MEN_TRANSP, "&Transpose..."); -// mpEditMenu->Append(MEN_VELOC, "&Velocity..."); +// mpEditMenu->Append(ID_VELOCITY, "&Velocity..."); // mpEditMenu->Append(MEN_LENGTH, "&Length..."); mpEditMenu->Append(ID_SHIFT, "Shi&ft..."); // mpEditMenu->Append(MEN_CLEANUP, "C&leanup..."); @@ -293,7 +293,7 @@ mpFileMenu->AppendSeparator(); parts_menu = new wxMenu; - parts_menu->Append(MEN_MIXER, "&Mixer..."); + parts_menu->Append(ID_MIXER, "&Mixer..."); parts_menu->Append(MEN_MASTER, "Mas&ter..."); parts_menu->Append(MEN_SOUND, "&Sound..."); parts_menu->Append(MEN_VIBRATO, "&Vibrato..."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-02-16 20:00:10
|
Revision: 699 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=699&view=rev Author: pstieber Date: 2009-02-16 19:59:58 +0000 (Mon, 16 Feb 2009) Log Message: ----------- 1. Fixed piano key mouse handling. The main problem was an improperly named virtual function in tMousePlay. I changed the the virtual function name to ProcessMouseEvent, and changed wxMouseEvent object instance names to MouseEvent. 2. Changed tMousePlay -> JZMousePlay and changed the way the class destroys itself. This is causing a leak, but it is better than the crash that was caused by clicking the mouse below the bass piano keys. 3. Moved the mpMouseAction data member from the piano window to the event window base class. Gave the event window base class a mouse handler. I'm still not confident about this design. 4. Created a virtual SnalSelStart in the event window. Modified Paths: -------------- trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventFrame.h trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h trunk/jazz/src/GuitarWindow.cpp trunk/jazz/src/GuitarWindow.h trunk/jazz/src/Harmony.cpp trunk/jazz/src/Knob.cpp trunk/jazz/src/Knob.h trunk/jazz/src/MouseAction.cpp trunk/jazz/src/MouseAction.h trunk/jazz/src/PianoFrame.h trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/PianoWindow.h trunk/jazz/src/Random.cpp trunk/jazz/src/Random.h trunk/jazz/src/SampleWindow.cpp trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/EventFrame.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -81,20 +81,21 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZEventFrame::SnapSelStart(wxMouseEvent& MouseEvent) -{ -} +//void JZEventFrame::SnapSelStart(wxMouseEvent& MouseEvent) +//{ +//} //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZEventFrame::SnapSelStop(wxMouseEvent& MouseEvent) -{ -} +//void JZEventFrame::SnapSelStop(wxMouseEvent& MouseEvent) +//{ +//} //----------------------------------------------------------------------------- // seems to handle the "selection" rectangle. normally called from the base // class onmouseevent handler //----------------------------------------------------------------------------- +/* int JZEventFrame::OnMouseEvent(wxMouseEvent& MouseEvent) { // cout << "JZEventFrame::OnMouseEvent" << endl; @@ -119,7 +120,7 @@ { Refresh(); //redraw the whole window instead(inefficient, we should rather invalidate a rect) } - SnapSel->Event(MouseEvent); + SnapSel->ProcessMouseEvent(MouseEvent); MouseAction = SnapSel; } } @@ -129,7 +130,7 @@ { // MouseAction active - if (MouseAction->Event(MouseEvent)) + if (MouseAction->ProcessMouseEvent(MouseEvent)) { // MouseAction finished @@ -146,6 +147,7 @@ } return 0; } +*/ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- Modified: trunk/jazz/src/EventFrame.h =================================================================== --- trunk/jazz/src/EventFrame.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/EventFrame.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -59,11 +59,11 @@ virtual void SetEventWindow(JZEventWindow* pEventWindow); - virtual void SnapSelStart(wxMouseEvent &e); - virtual void SnapSelStop(wxMouseEvent &e); +// virtual void SnapSelStart(wxMouseEvent &e); +// virtual void SnapSelStop(wxMouseEvent &e); // Events - virtual int OnMouseEvent(wxMouseEvent& Event); +// virtual int OnMouseEvent(wxMouseEvent& Event); virtual bool OnKeyEvent(wxKeyEvent& Event); // true = processed by eventwin virtual bool OnClose(); Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/EventWindow.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -44,8 +44,9 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//BEGIN_EVENT_TABLE(JZEventWindow, wxScrolledWindow) -//END_EVENT_TABLE() +BEGIN_EVENT_TABLE(JZEventWindow, wxWindow) + EVT_MOUSE_EVENTS(JZEventWindow::OnMouseEvent) +END_EVENT_TABLE() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -62,6 +63,7 @@ wxHSCROLL | wxVSCROLL | wxNO_FULL_REPAINT_ON_RESIZE), mpSnapSel(0), mpFilter(0), + mpMouseAction(0), mpSong(pSong), mpGreyColor(0), mpGreyBrush(0), @@ -401,13 +403,72 @@ } //----------------------------------------------------------------------------- -// This mouse handler delegates to the subclased event window. //----------------------------------------------------------------------------- -//void JZEventWindow::OnMouseEvent(wxMouseEvent& MouseEvent) -//{ -// EventWin->OnMouseEvent(MouseEvent); -//} +void JZEventWindow::SnapSelStart(wxMouseEvent& MouseEvent) +{ +} +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventWindow::SnapSelStop(wxMouseEvent& MouseEvent) +{ +} + +//----------------------------------------------------------------------------- +// Descriptions: +// This mouse handler delegates to the subclassed event window. +//----------------------------------------------------------------------------- +void JZEventWindow::OnMouseEvent(wxMouseEvent& MouseEvent) +{ + if (!mpMouseAction) + { + // create mpSnapSel? + + int x, y; + MouseEvent.GetPosition(&x, &y); + if ( + mEventsX < x && x < mEventsX + mEventsWidth && + mEventsY < y && y < mEventsY + mEventsHeight) + { + if (MouseEvent.LeftDown()) + { + { + SnapSelStart(MouseEvent); + +// if (mpSnapSel->IsSelected()) +// { + // Redraw the whole window instead (inefficient, we should rather + // invalidate a rect). + Refresh(); +// } + mpSnapSel->ProcessMouseEvent(MouseEvent); + mpMouseAction = mpSnapSel; + } + } + } + } + else + { + // mpMouseAction active + + if (mpMouseAction->ProcessMouseEvent(MouseEvent)) + { + // mpMouseAction finished + + if (mpMouseAction == mpSnapSel) + { + SnapSelStop(MouseEvent); + + // inefficient, invalidate rect first instead. + Refresh(); + } + + mpMouseAction = 0; + } + } +} + + // JAVE the OnChar method seems to be gone in wxwin232, but its documented, so // I don't know what happened. The OnCharHook should do the same thing // basically. It was there from the start. OnChar seemd redundant. Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/EventWindow.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ #include <wx/window.h> class JZFilter; +class tMouseAction; class JZSnapSelection; class JZSong; class wxDialog; @@ -83,10 +84,12 @@ protected: - virtual void SnapSelStop(wxMouseEvent& Event) - { - } + int SnapClock(int Clock, bool Up); + virtual void SnapSelStart(wxMouseEvent& MouseEvent); + + virtual void SnapSelStop(wxMouseEvent& MouseEvent); + void DrawVerticalLine(wxDC& Dc, int XPosition) const; void DrawHorizontalLine(wxDC& Dc, int YPosition) const; @@ -99,12 +102,16 @@ int y2yLine(int y, int Up = 0); + void OnMouseEvent(wxMouseEvent& MouseEvent); + public: JZSnapSelection* mpSnapSel; JZFilter* mpFilter; + tMouseAction* mpMouseAction; + protected: JZSong* mpSong; @@ -128,7 +135,7 @@ // Settings-Dialog wxDialog* mpSettingsDialog; -// DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; //***************************************************************************** Modified: trunk/jazz/src/GuitarWindow.cpp =================================================================== --- trunk/jazz/src/GuitarWindow.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/GuitarWindow.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -341,12 +341,12 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZGuitarWindow::OnMouseMove(wxMouseEvent& Event) +void JZGuitarWindow::OnMouseMove(wxMouseEvent& MouseEvent) { wxClientDC Dc(this); PrepareDC(Dc); - wxPoint Position = Event.GetPosition(); + wxPoint Position = MouseEvent.GetPosition(); int x = Dc.DeviceToLogicalX(Position.x); int y = Dc.DeviceToLogicalY(Position.y); Modified: trunk/jazz/src/GuitarWindow.h =================================================================== --- trunk/jazz/src/GuitarWindow.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/GuitarWindow.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ void OnPaint(wxPaintEvent& Event); - void OnMouseMove(wxMouseEvent& Event); + void OnMouseMove(wxMouseEvent& MouseEvent); private: Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/Harmony.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by Modified: trunk/jazz/src/Knob.cpp =================================================================== --- trunk/jazz/src/Knob.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/Knob.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -1,7 +1,7 @@ //***************************************************************************** // The JAZZ++ Midi Sequencer // -// Copyright (C) 2008 Peter J. Stieber +// Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -317,11 +317,11 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnLeftButtonDown(wxMouseEvent& Event) +void JZKnob::OnLeftButtonDown(wxMouseEvent& MouseEvent) { SetFocus(); - mLastPoint = Event.GetPosition(); + mLastPoint = MouseEvent.GetPosition(); SetCursor(wxCursor(wxCURSOR_SIZENS)); @@ -332,18 +332,18 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnRightButtonDown(wxMouseEvent& Event) +void JZKnob::OnRightButtonDown(wxMouseEvent& MouseEvent) { SetFocus(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnMouseMove(wxMouseEvent& Event) +void JZKnob::OnMouseMove(wxMouseEvent& MouseEvent) { if (mDragging) { - wxPoint Point = Event.GetPosition(); + wxPoint Point = MouseEvent.GetPosition(); int Delta = (mLastPoint.y - Point.y) / mSensitivity; @@ -361,7 +361,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnLeftButtonUp(wxMouseEvent& Event) +void JZKnob::OnLeftButtonUp(wxMouseEvent& MouseEvent) { if (HasCapture()) { @@ -372,7 +372,7 @@ mDragging = false; - wxPoint Point = Event.GetPosition(); + wxPoint Point = MouseEvent.GetPosition(); int Delta = (mLastPoint.y - Point.y) / mSensitivity; if (Delta) @@ -383,23 +383,23 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnLeftButtonDoubleClick(wxMouseEvent& Event) +void JZKnob::OnLeftButtonDoubleClick(wxMouseEvent& MouseEvent) { SetValueWithEvent(GetValue() + 1); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnRightButtonDoubleClick(wxMouseEvent& Event) +void JZKnob::OnRightButtonDoubleClick(wxMouseEvent& MouseEvent) { SetValueWithEvent(GetValue() - 1); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnMouseWheel(wxMouseEvent& Event) +void JZKnob::OnMouseWheel(wxMouseEvent& MouseEvent) { - int WheelRotation = Event.GetWheelRotation(); + int WheelRotation = MouseEvent.GetWheelRotation(); if (WheelRotation < 0) { Modified: trunk/jazz/src/Knob.h =================================================================== --- trunk/jazz/src/Knob.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/Knob.h 2009-02-16 19:59:58 UTC (rev 699) @@ -1,7 +1,7 @@ //***************************************************************************** // The JAZZ++ Midi Sequencer // -// Copyright (C) 2008 Peter J. Stieber +// Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -148,19 +148,19 @@ void OnPaint(wxPaintEvent& Event); - void OnLeftButtonDown(wxMouseEvent& Event); + void OnLeftButtonDown(wxMouseEvent& MouseEvent); - void OnRightButtonDown(wxMouseEvent& Event); + void OnRightButtonDown(wxMouseEvent& MouseEvent); - void OnMouseMove(wxMouseEvent& Event); + void OnMouseMove(wxMouseEvent& MouseEvent); - void OnLeftButtonUp(wxMouseEvent& Event); + void OnLeftButtonUp(wxMouseEvent& MouseEvent); - void OnLeftButtonDoubleClick(wxMouseEvent& Event); + void OnLeftButtonDoubleClick(wxMouseEvent& MouseEvent); - void OnRightButtonDoubleClick(wxMouseEvent& Event); + void OnRightButtonDoubleClick(wxMouseEvent& MouseEvent); - void OnMouseWheel(wxMouseEvent& Event); + void OnMouseWheel(wxMouseEvent& MouseEvent); private: Modified: trunk/jazz/src/MouseAction.cpp =================================================================== --- trunk/jazz/src/MouseAction.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/MouseAction.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -69,37 +69,37 @@ actions[i] = code; } -int tMouseMapper::Action(wxMouseEvent& Event) +int tMouseMapper::Action(wxMouseEvent& MouseEvent) { - if (!Event.ButtonDown()) + if (!MouseEvent.ButtonDown()) { return 0; } if ( left_action > 0 && - Event.LeftDown() && - !Event.ShiftDown() && - !Event.ControlDown()) + MouseEvent.LeftDown() && + !MouseEvent.ShiftDown() && + !MouseEvent.ControlDown()) { return left_action; } int i = 0; // left down - if (Event.MiddleDown()) + if (MouseEvent.MiddleDown()) { i = 1; } - else if (Event.RightDown()) + else if (MouseEvent.RightDown()) { i = 2; } - if (Event.ShiftDown()) + if (MouseEvent.ShiftDown()) { i += 3; } - if (Event.ControlDown()) + if (MouseEvent.ControlDown()) { i += 6; } @@ -132,42 +132,42 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZSelection::Event(wxMouseEvent& Event) +int JZSelection::ProcessMouseEvent(wxMouseEvent& MouseEvent) { - if (Event.ButtonDown()) + if (MouseEvent.ButtonDown()) { - return ButtonDown(Event); + return ButtonDown(MouseEvent); } - else if (Event.ButtonUp()) + else if (MouseEvent.ButtonUp()) { - return ButtonUp(Event); + return ButtonUp(MouseEvent); } - else if (Event.Dragging()) + else if (MouseEvent.Dragging()) { - return Dragging(Event); + return Dragging(MouseEvent); } return 0; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZSelection::ButtonDown(wxMouseEvent& Event) +int JZSelection::ButtonDown(wxMouseEvent& MouseEvent) { if (!mActive) { mActive = true; - if (mSelected && Event.ShiftDown()) + if (mSelected && MouseEvent.ShiftDown()) { // Continue selection JZRectangle Rectangle = mRectangle; Rectangle.SetNormal(); - Dragging(Event); + Dragging(MouseEvent); } else { mSelected = false; - int x = Event.GetX(); - int y = Event.GetY(); + int x = MouseEvent.GetX(); + int y = MouseEvent.GetY(); Snap(x, y, 0); mRectangle.x = x; mRectangle.y = y; @@ -180,17 +180,17 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZSelection::Dragging(wxMouseEvent& Event) +int JZSelection::Dragging(wxMouseEvent& MouseEvent) { if (!mActive) { - ButtonDown(Event); + ButtonDown(MouseEvent); } if (mActive) { - int x = Event.GetX(); - int y = Event.GetY(); + int x = MouseEvent.GetX(); + int y = MouseEvent.GetY(); if (x < 0) { x = 0; @@ -210,7 +210,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZSelection::ButtonUp(wxMouseEvent& Event) +int JZSelection::ButtonUp(wxMouseEvent& MouseEvent) { if (mActive) { @@ -461,9 +461,9 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tMouseCounter::LeftDown(wxMouseEvent& Event) +int tMouseCounter::LeftDown(wxMouseEvent& MouseEvent) { - Delta = Event.ShiftDown() ? 10 : 1; + Delta = MouseEvent.ShiftDown() ? 10 : 1; Start(Timeout); if (Wait) { @@ -476,7 +476,9 @@ return 0; } -int tMouseCounter::LeftUp(wxMouseEvent& Event) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int tMouseCounter::LeftUp(wxMouseEvent& MouseEvent) { Stop(); ShowValue(FALSE); @@ -485,9 +487,9 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tMouseCounter::RightDown(wxMouseEvent& Event) +int tMouseCounter::RightDown(wxMouseEvent& MouseEvent) { - Delta = Event.ShiftDown() ? -10 : -1; + Delta = MouseEvent.ShiftDown() ? -10 : -1; Start(Timeout); if (Wait) { @@ -503,7 +505,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tMouseCounter::RightUp(wxMouseEvent& Event) +int tMouseCounter::RightUp(wxMouseEvent& MouseEvent) { Stop(); ShowValue(FALSE); @@ -556,7 +558,7 @@ //Frame->SetStatusText("Click Destination point"); } -int tMarkDestin::ButtonDown(wxMouseEvent& Event) +int tMarkDestin::ButtonDown(wxMouseEvent& MouseEvent) { wxCursor c = wxCursor(wxCURSOR_ARROW); Canvas->SetCursor(c); @@ -564,7 +566,7 @@ //converts physical coords to logical(scrolled) coords wxClientDC* scrolledDC=new wxClientDC(Canvas); Canvas->PrepareDC(*scrolledDC); - wxPoint point = Event.GetLogicalPosition(*scrolledDC); + wxPoint point = MouseEvent.GetLogicalPosition(*scrolledDC); delete scrolledDC; x=point.x; @@ -573,17 +575,17 @@ return 1; } -int tMarkDestin::RightDown(wxMouseEvent& Event) +int tMarkDestin::RightDown(wxMouseEvent& MouseEvent) { - ButtonDown(Event); + ButtonDown(MouseEvent); Aborted = 1; //Frame->SetStatusText("Operation aborted"); return 1; } -int tMarkDestin::LeftDown(wxMouseEvent& Event) +int tMarkDestin::LeftDown(wxMouseEvent& MouseEvent) { - ButtonDown(Event); + ButtonDown(MouseEvent); Aborted = 0; //Frame->SetStatusText(""); return 1; @@ -638,7 +640,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tMouseButton::Event(wxMouseEvent& MouseEvent) +int tMouseButton::ProcessMouseEvent(wxMouseEvent& MouseEvent) { if (MouseEvent.ButtonUp()) { Modified: trunk/jazz/src/MouseAction.h =================================================================== --- trunk/jazz/src/MouseAction.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/MouseAction.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -55,6 +55,7 @@ // 9..11 = left/middle/right down + ctrl + shift tMouseMapper(const int actions[12]); + tMouseMapper(); enum Button @@ -70,7 +71,7 @@ bool shift = false, bool ctrl = false); - int Action(wxMouseEvent&); + int Action(wxMouseEvent& MouseEvent); void SetLeftAction(int id = 0) { @@ -89,23 +90,23 @@ // This is a base class for mouse actions. The classes are instantiated in // the mouse handler of the event window, for example, to keep state during // mouse operations, like drag and drop and so on. -// The Event() function is used to determine what to do with an incoming -// event. Normally, if the event is a drag event, call the drag function of -// the class, and so on. +// The ProcessMouseEvent() function is used to determine what to do with an +// incoming event. Normally, if the event is a drag event, call the drag +// function of the class, and so on. //***************************************************************************** class tMouseAction { public: - virtual ~tMouseAction() {} - virtual int Dragging(wxMouseEvent &) { return 0; } - virtual int LeftDown(wxMouseEvent &) { return 0; } - virtual int LeftUp(wxMouseEvent &) { return 0; } - virtual int RightDown(wxMouseEvent &) { return 0; } - virtual int RightUp(wxMouseEvent &) { return 0; } - virtual int MiddleDown(wxMouseEvent &) { return 0; } - virtual int MiddleUp(wxMouseEvent &) { return 0; } - virtual int Event(wxMouseEvent& MouseEvent) + virtual ~tMouseAction() {} + virtual int Dragging(wxMouseEvent& MouseEvent) { return 0; } + virtual int LeftDown(wxMouseEvent& MouseEvent) { return 0; } + virtual int LeftUp(wxMouseEvent& MouseEvent) { return 0; } + virtual int RightDown(wxMouseEvent& MouseEvent) { return 0; } + virtual int RightUp(wxMouseEvent& MouseEvent) { return 0; } + virtual int MiddleDown(wxMouseEvent& MouseEvent) { return 0; } + virtual int MiddleUp(wxMouseEvent& MouseEvent) { return 0; } + virtual int ProcessMouseEvent(wxMouseEvent& MouseEvent) { if (MouseEvent.Dragging()) { @@ -182,13 +183,13 @@ { } - virtual int Dragging(wxMouseEvent& Event); + virtual int Dragging(wxMouseEvent& MouseEvent); - virtual int Event(wxMouseEvent& Event); + virtual int ProcessMouseEvent(wxMouseEvent& MouseEvent); - virtual int ButtonDown(wxMouseEvent& Event); + virtual int ButtonDown(wxMouseEvent& MouseEvent); - virtual int ButtonUp(wxMouseEvent& Event); + virtual int ButtonUp(wxMouseEvent& MouseEvent); virtual void Draw(wxDC& Dc, int ScrolledX, int ScrolledY); @@ -313,10 +314,10 @@ int Wait; // don't inc/dec at Init tButtonLabelInterface *win; - virtual int LeftDown(wxMouseEvent &); - virtual int LeftUp(wxMouseEvent &); - virtual int RightDown(wxMouseEvent &); - virtual int RightUp(wxMouseEvent &); + virtual int LeftDown(wxMouseEvent& MouseEvent); + virtual int LeftUp(wxMouseEvent& MouseEvent); + virtual int RightDown(wxMouseEvent& MouseEvent); + virtual int RightUp(wxMouseEvent& MouseEvent); virtual void Notify(); virtual void ShowValue(bool down); }; @@ -327,17 +328,18 @@ //***************************************************************************** class tMarkDestin : public tMouseAction { - wxWindow *Canvas; - wxFrame *Frame; - int ButtonDown(wxMouseEvent &); + public: + int Aborted; + float x, y; -public: - int Aborted; - float x, y; + virtual int LeftDown(wxMouseEvent& MouseEvent); + virtual int RightDown(wxMouseEvent& MouseEvent); + tMarkDestin(wxWindow* canvas, wxFrame* frame, int left); - virtual int LeftDown(wxMouseEvent &); - virtual int RightDown(wxMouseEvent &); - tMarkDestin(wxWindow *canvas, wxFrame *frame, int left); + private: + wxWindow *Canvas; + wxFrame *Frame; + int ButtonDown(wxMouseEvent& MouseEvent); }; //***************************************************************************** @@ -355,7 +357,7 @@ virtual ~tMouseButton(); - virtual int Event(wxMouseEvent& MouseEvent); + virtual int ProcessMouseEvent(wxMouseEvent& MouseEvent); protected: Modified: trunk/jazz/src/PianoFrame.h =================================================================== --- trunk/jazz/src/PianoFrame.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/PianoFrame.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ int mTrackIndex; JZTrack* Track; - void MouseCutPaste(wxMouseEvent &e, bool cut); + void MouseCutPaste(wxMouseEvent& MouseEvent, bool cut); bool OnClose(); Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/PianoWindow.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -93,15 +93,16 @@ //***************************************************************************** // Description: -// tMousePlay - Click in pianoroll +// JZMousePlay - Click in pianoroll //***************************************************************************** -class tMousePlay : public tMouseAction +class JZMousePlay : public tMouseAction { public: - tMousePlay(JZPianoWindow* pPianoWindow, wxMouseEvent& Event); - int ProcessEvent(wxMouseEvent& Event); + JZMousePlay(JZPianoWindow* pPianoWindow); + virtual int ProcessMouseEvent(wxMouseEvent& MouseEvent); + private: int mPitch, mVeloc, mChannel; @@ -110,7 +111,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -tMousePlay::tMousePlay(JZPianoWindow* pPianoWindow, wxMouseEvent& Event) +JZMousePlay::JZMousePlay(JZPianoWindow* pPianoWindow) : mPitch(0), mVeloc(-1), mChannel(-1), @@ -118,39 +119,37 @@ { mChannel = mpPianoWindow->GetTrack()->Channel ? mpPianoWindow->GetTrack()->Channel - 1 : 0; - - ProcessEvent(Event); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tMousePlay::ProcessEvent(wxMouseEvent& Event) +int JZMousePlay::ProcessMouseEvent(wxMouseEvent& MouseEvent) { int x, y; - Event.GetPosition(&x, &y); + MouseEvent.GetPosition(&x, &y); int OldPitch = mPitch; - if (Event.LeftDown()) + if (MouseEvent.LeftDown()) { mPitch = mpPianoWindow->y2Pitch(y); mVeloc = 64; } - else if (Event.MiddleDown()) + else if (MouseEvent.MiddleDown()) { mPitch = mpPianoWindow->y2Pitch(y); mVeloc = 80; } - else if (Event.RightDown()) + else if (MouseEvent.RightDown()) { mPitch = mpPianoWindow->y2Pitch(y); mVeloc = 110; } - else if (Event.ButtonUp()) + else if (MouseEvent.ButtonUp()) { mPitch = 0; } - else if (Event.Dragging()) + else if (MouseEvent.Dragging()) { mPitch = mpPianoWindow->y2Pitch(y); } @@ -170,23 +169,21 @@ { if (OldPitch && OldPitch != mPitch) { - tKeyOff of(0, mChannel, OldPitch); - gpMidiPlayer->OutNow(mpPianoWindow->GetTrack(), &of); + tKeyOff KeyOff(0, mChannel, OldPitch); + gpMidiPlayer->OutNow(mpPianoWindow->GetTrack(), &KeyOff); OldPitch = 0; } if (mPitch && mPitch != OldPitch) { - tKeyOn on(0, mChannel, mPitch, mVeloc); - gpMidiPlayer->OutNow(mpPianoWindow->GetTrack(), &on); + tKeyOn KeyOn(0, mChannel, mPitch, mVeloc); + gpMidiPlayer->OutNow(mpPianoWindow->GetTrack(), &KeyOn); OldPitch = 0; } } if (!mPitch) { - mpPianoWindow->mpMouseAction = 0; - delete this; return 1; // done } return 0; @@ -202,11 +199,11 @@ tKeyLengthDragger(tKeyOn* pKeyOn, JZPianoWindow* pPianoWindow); - int Dragging(wxMouseEvent& Event); + int Dragging(wxMouseEvent& MouseEvent); - int ButtonUp(wxMouseEvent& Event); + int ButtonUp(wxMouseEvent& MouseEvent); - int Event(wxMouseEvent& Event); + int ProcessMouseEvent(wxMouseEvent& MouseEvent); private: @@ -240,28 +237,28 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tKeyLengthDragger::Event(wxMouseEvent& Event) +int tKeyLengthDragger::ProcessMouseEvent(wxMouseEvent& MouseEvent) { - if (Event.Dragging()) + if (MouseEvent.Dragging()) { - return Dragging(Event); + return Dragging(MouseEvent); } - else if (Event.ButtonUp()) + else if (MouseEvent.ButtonUp()) { - return ButtonUp(Event); + return ButtonUp(MouseEvent); } return 0; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tKeyLengthDragger::Dragging(wxMouseEvent& Event) +int tKeyLengthDragger::Dragging(wxMouseEvent& MouseEvent) { wxClientDC Dc(Win); Win->PrepareDC(Dc); //to translate scrolled coordinates Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1); int fx, fy; - Event.GetPosition(&fx, &fy); + MouseEvent.GetPosition(&fx, &fy); int Clock = Win->x2Clock(fx); int Length = Clock - Copy->GetClock(); if (Length <= 0) @@ -276,7 +273,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tKeyLengthDragger::ButtonUp(wxMouseEvent& Event) +int tKeyLengthDragger::ButtonUp(wxMouseEvent& MouseEvent) { // SN++ Key_Aftertouch if (Copy->GetEventLength() < mpKeyOn->GetEventLength()) @@ -330,16 +327,21 @@ //***************************************************************************** class tPlayTrackLengthDragger : public tMouseAction { + public: + + tPlayTrackLengthDragger(tPlayTrack* k, JZPianoWindow* pPianoWindow); + + int Dragging(wxMouseEvent& MouseEvent); + + int ButtonUp(wxMouseEvent& MouseEvent); + + int ProcessMouseEvent(wxMouseEvent& MouseEvent); + + private: tPlayTrack* mpKeyOn; tPlayTrack* Copy; JZPianoWindow* Win; JZTrack* mpTrack; - - public: - tPlayTrackLengthDragger(tPlayTrack* k, JZPianoWindow* pPianoWindow); - int Dragging(wxMouseEvent& Event); - int ButtonUp(wxMouseEvent& Event); - int Event(wxMouseEvent& Event); }; //----------------------------------------------------------------------------- @@ -363,28 +365,28 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tPlayTrackLengthDragger::Event(wxMouseEvent& Event) +int tPlayTrackLengthDragger::ProcessMouseEvent(wxMouseEvent& MouseEvent) { - if (Event.Dragging()) + if (MouseEvent.Dragging()) { - return Dragging(Event); + return Dragging(MouseEvent); } - else if (Event.ButtonUp()) + else if (MouseEvent.ButtonUp()) { - return ButtonUp(Event); + return ButtonUp(MouseEvent); } return 0; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tPlayTrackLengthDragger::Dragging(wxMouseEvent& Event) +int tPlayTrackLengthDragger::Dragging(wxMouseEvent& MouseEvent) { wxClientDC Dc(Win); Win->PrepareDC(Dc); Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1); int fx, fy; - Event.GetPosition(&fx, &fy); + MouseEvent.GetPosition(&fx, &fy); int Clock = Win->x2Clock(fx); int Length = Clock - Copy->GetClock(); if (Length <= 0) @@ -397,7 +399,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tPlayTrackLengthDragger::ButtonUp(wxMouseEvent& Event) +int tPlayTrackLengthDragger::ButtonUp(wxMouseEvent& MouseEvent) { wxClientDC Dc(Win); Win->PrepareDC(Dc); @@ -423,7 +425,6 @@ class tVelocCounter : public tMouseCounter { public: - int Event(wxMouseEvent& Event); tVelocCounter( JZPianoWindow* pPianoWindow, JZRectangle* pRectangle, @@ -440,6 +441,8 @@ Dc.SetFont(*(Win->GetFixedFont())); } + virtual int ProcessMouseEvent(wxMouseEvent& MouseEvent); + private: JZPianoWindow* Win; @@ -449,9 +452,9 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tVelocCounter::Event(wxMouseEvent& Event) +int tVelocCounter::ProcessMouseEvent(wxMouseEvent& MouseEvent) { - if (tMouseCounter::Event(Event)) + if (tMouseCounter::ProcessMouseEvent(MouseEvent)) { tKeyOn* pKeyOnCopy = (tKeyOn *)mpKeyOn->Copy(); pKeyOnCopy->SetVelocity(Value); @@ -591,7 +594,7 @@ mpPianoFrame(pPianoFrame), mPlayClock(-1), mSnapCount(0), - mpMouseAction(0), + mPasteBuffer(), mpTrack(0), mTrackIndex(0), mpCtrlEdit(0), @@ -1612,12 +1615,12 @@ // Descriptions: // This mouse handler delegates to the subclassed event window. //----------------------------------------------------------------------------- -void JZPianoWindow::OnMouseEvent(wxMouseEvent& Event) +void JZPianoWindow::OnMouseEvent(wxMouseEvent& MouseEvent) { - if (Event.Moving() && !Event.Dragging() && !mpMouseAction) + if (MouseEvent.Moving() && !MouseEvent.Dragging() && !mpMouseAction) { int fx, fy; - Event.GetPosition(&fx, &fy); + MouseEvent.GetPosition(&fx, &fy); int Pitch = y2Pitch(fy); JZProjectManager::Instance()->ShowPitch(Pitch); } @@ -1627,27 +1630,30 @@ if (!mpMouseAction) { int x, y; - Event.GetPosition(&x, &y); + MouseEvent.GetPosition(&x, &y); - if (y > mEventsY) // click in event area? + // Was the mouse event below the top line that indicates the measure? + if (y > mEventsY) { if (mPianoX < x && x < mPianoX + mPianoWidth) { - MousePiano(Event); + // The mouse event was in the piano keys area. + MousePiano(MouseEvent); } else if (mEventsX < x && x < mEventsX + mEventsWidth) { - MouseEvents(Event); + // The mouse event was in the MIDI event area. + MouseEvents(MouseEvent); } else { - OnEventWinMouseEvent(Event); + OnEventWinMouseEvent(MouseEvent); } } else if (x > mEventsX) { // click in top line - int action = mMousePlay.Action(Event); + int action = mMousePlay.Action(MouseEvent); if (action) { @@ -1685,7 +1691,8 @@ } else { - OnEventWinMouseEvent(Event); + MouseEvent.Skip(); +//NEW OnEventWinMouseEvent(MouseEvent); } } @@ -1820,7 +1827,7 @@ //----------------------------------------------------------------------------- // Snapper //----------------------------------------------------------------------------- -void JZPianoWindow::SnapSelStop(wxMouseEvent& Event) +void JZPianoWindow::SnapSelStop(wxMouseEvent& MouseEvent) { if (mpSnapSel->IsSelected()) { @@ -1865,8 +1872,21 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZPianoWindow::SnapSelStart(wxMouseEvent &) +int JZPianoWindow::SnapClock(int Clock, bool Up) { + int qnt = SnapClocks(); + Clock -= (Clock % qnt); + if (Up) + { + Clock += qnt; + } + return Clock; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZPianoWindow::SnapSelStart(wxMouseEvent& MouseEvent) +{ mSnapCount = 0; int clk = SnapClock(mFromClock, false); int qnt = SnapClocks(); @@ -1890,19 +1910,6 @@ } //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -int JZPianoWindow::SnapClock(int Clock, bool Up) -{ - int qnt = SnapClocks(); - Clock -= (Clock % qnt); - if (Up) - { - Clock += qnt; - } - return Clock; -} - -//----------------------------------------------------------------------------- // Description: // Update the play position to the clock argument, and trigger a redraw so // the play bar will be drawn. @@ -2000,22 +2007,22 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZPianoWindow::OnEventWinMouseEvent(wxMouseEvent& Event) +int JZPianoWindow::OnEventWinMouseEvent(wxMouseEvent& MouseEvent) { if (!mpMouseAction) { // create mpSnapSel? int x, y; - Event.GetPosition(&x, &y); + MouseEvent.GetPosition(&x, &y); if ( mEventsX < x && x < mEventsX + mEventsWidth && mEventsY < y && y < mEventsY + mEventsHeight) { - if (Event.LeftDown()) + if (MouseEvent.LeftDown()) { { - SnapSelStart(Event); + SnapSelStart(MouseEvent); // if (mpSnapSel->IsSelected()) // { @@ -2023,7 +2030,7 @@ // invalidate a rect). Refresh(); // } - mpSnapSel->Event(Event); + mpSnapSel->ProcessMouseEvent(MouseEvent); mpMouseAction = mpSnapSel; } } @@ -2033,13 +2040,13 @@ { // mpMouseAction active - if (mpMouseAction->Event(Event)) + if (mpMouseAction->ProcessMouseEvent(MouseEvent)) { // mpMouseAction finished if (mpMouseAction == mpSnapSel) { - SnapSelStop(Event); + SnapSelStop(MouseEvent); // inefficient, invalidate rect first instead. Refresh(); @@ -2100,14 +2107,14 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZPianoWindow::MouseCutPaste(wxMouseEvent& Event, bool Cut) +void JZPianoWindow::MouseCutPaste(wxMouseEvent& MouseEvent, bool Cut) { wxClientDC Dc(this); PrepareDC(Dc); // Convert physical coordinates to logical (scrolled) coordinates. - wxPoint Point = Event.GetLogicalPosition(Dc); + wxPoint Point = MouseEvent.GetLogicalPosition(Dc); int x = Point.x; int y = Point.y; @@ -2130,14 +2137,14 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZPianoWindow::MouseEvents(wxMouseEvent& Event) +void JZPianoWindow::MouseEvents(wxMouseEvent& MouseEvent) { - int action = mMouseEvent.Action(Event); + int action = mMouseEvent.Action(MouseEvent); if (action) { int x, y; - Event.GetPosition(&x, &y); + MouseEvent.GetPosition(&x, &y); int Clock = x2Clock(x); int Pitch = y2Pitch(y); @@ -2153,11 +2160,11 @@ switch (action) { case MA_CUTPASTE: - MouseCutPaste(Event, 1); + MouseCutPaste(MouseEvent, 1); break; case MA_COPY: - MouseCutPaste(Event, 0); + MouseCutPaste(MouseEvent, 0); break; case MA_LENGTH: @@ -2198,12 +2205,12 @@ case MA_LISTEN: - MousePiano(Event); + MousePiano(MouseEvent); break; case MA_SELECT: case MA_CONTSEL: - OnEventWinMouseEvent(Event); + OnEventWinMouseEvent(MouseEvent); break; case MA_VELOCITY: @@ -2216,7 +2223,7 @@ r.SetHeight(mTopInfoHeight); tVelocCounter *VelocCounter = new tVelocCounter(this, &r, pKeyOn); - VelocCounter->Event(Event); + VelocCounter->ProcessMouseEvent(MouseEvent); mpMouseAction = VelocCounter; } break; @@ -2227,11 +2234,17 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZPianoWindow::MousePiano(wxMouseEvent& Event) +void JZPianoWindow::MousePiano(wxMouseEvent& MouseEvent) { - if (Event.ButtonDown()) + if (MouseEvent.ButtonDown()) { - mpMouseAction = new tMousePlay(this, Event); + mpMouseAction = new JZMousePlay(this); + int Status = mpMouseAction->ProcessMouseEvent(MouseEvent); + if (Status == 1) + { + delete mpMouseAction; + mpMouseAction = 0; + } } } Modified: trunk/jazz/src/PianoWindow.h =================================================================== --- trunk/jazz/src/PianoWindow.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/PianoWindow.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -111,12 +111,12 @@ int IsVisible(JZTrack* pTrack); - void SnapSelStart(wxMouseEvent& Event); - int SnapClock(int Clock, bool Up = false); - void SnapSelStop(wxMouseEvent& Event); + virtual void SnapSelStart(wxMouseEvent& MouseEvent); + virtual void SnapSelStop(wxMouseEvent& MouseEvent); + int SnapClocks(); void SetSnapDenom(int Value); @@ -208,8 +208,6 @@ int mSnapsX[eMaxSnaps]; - tMouseAction* mpMouseAction; - tEventArray mPasteBuffer; public: @@ -240,7 +238,7 @@ int y2TrackIndex(int y); int EventsSelected(const char *msg = 0); - int OnEventWinMouseEvent(wxMouseEvent &e); + int OnEventWinMouseEvent(wxMouseEvent& MouseEvent); void DrawEvents( wxDC& Dc, @@ -268,7 +266,7 @@ void OnPaint(wxPaintEvent& Event); - void OnMouseEvent(wxMouseEvent& Event); + void OnMouseEvent(wxMouseEvent& MouseEvent); void OnScroll(wxScrollWinEvent& Event); @@ -276,11 +274,11 @@ void VerticalScroll(wxScrollWinEvent& Event); - void MouseCutPaste(wxMouseEvent& Event, bool Cut); + void MouseCutPaste(wxMouseEvent& MouseEvent, bool Cut); - void MouseEvents(wxMouseEvent& Event); + void MouseEvents(wxMouseEvent& MouseEvent); - void MousePiano(wxMouseEvent& Event); + void MousePiano(wxMouseEvent& MouseEvent); bool OnCharHook(wxKeyEvent& Event); Modified: trunk/jazz/src/Random.cpp =================================================================== --- trunk/jazz/src/Random.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/Random.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -597,29 +597,33 @@ xmax = xma; } -int tArrayEdit::Index(wxMouseEvent &e) +int tArrayEdit::Index(wxMouseEvent& MouseEvent) { int ex, ey; - e.GetPosition(&ex, &ey); + MouseEvent.GetPosition(&ex, &ey); int i = (int)( ((short)ex - x) * n / w); i = i < 0 ? 0 : i; i = i >= n ? n-1 : i; return i; } -int tArrayEdit::Dragging(wxMouseEvent &e) +int tArrayEdit::Dragging(wxMouseEvent& MouseEvent) { if (!dragging) + { return 0; + } if (index < 0) - index = Index(e); + { + index = Index(MouseEvent); + } int val = nul; - if (e.LeftIsDown()) + if (MouseEvent.LeftIsDown()) { int ex, ey; - e.GetPosition(&ex, &ey); + MouseEvent.GetPosition(&ex, &ey); // $blk$ val = (int)( (y + h - (short)ey) * (max - min) / h + min); val = (int)( (double)(y + h - ey) * (max - min) / h + min + 0.5); val = val > max ? max : val; @@ -631,12 +635,12 @@ // in msw ex,ey are 65536 for negative values! wxDC *dc = new wxClientDC(this);//GetDC(); char buf[500]; - sprintf(buf, "x %4.0f, y %4.0f, sh %d", ex, ey, e.ShiftDown()); + sprintf(buf, "x %4.0f, y %4.0f, sh %d", ex, ey, MouseEvent.ShiftDown()); dc->DrawText(buf, 50, 50); } #endif wxDC *dc = new wxClientDC(this); // PORTING this is evil and shoud go - if (e.ShiftDown()) + if (MouseEvent.ShiftDown()) { int k; for (k = 0; k < n; k++) @@ -648,7 +652,7 @@ } } - else if (e.ControlDown()) + else if (MouseEvent.ControlDown()) { DrawBar(dc, index, 0); mArray[index] = val; @@ -656,7 +660,7 @@ } else { - int i = Index(e); + int i = Index(MouseEvent); int k = i; if (i < index) for (; i <= index; i++) @@ -678,18 +682,18 @@ return 0; } -int tArrayEdit::ButtonDown(wxMouseEvent &e) +int tArrayEdit::ButtonDown(wxMouseEvent& MouseEvent) { #ifdef __WXMSW__ CaptureMouse(); #endif dragging = 1; - index = Index(e); - Dragging(e); + index = Index(MouseEvent); + Dragging(MouseEvent); return 0; } -int tArrayEdit::ButtonUp(wxMouseEvent &e) +int tArrayEdit::ButtonUp(wxMouseEvent& MouseEvent) { #ifdef __WXMSW__ ReleaseMouse(); @@ -705,16 +709,24 @@ } -void tArrayEdit::OnMouseEvent(wxMouseEvent &e) +void tArrayEdit::OnMouseEvent(wxMouseEvent& MouseEvent) { if (!enabled) + { return; - if (e.ButtonDown()) - ButtonDown(e); - else if (e.Dragging()) - Dragging(e); - else if (e.ButtonUp()) - ButtonUp(e); + } + if (MouseEvent.ButtonDown()) + { + ButtonDown(MouseEvent); + } + else if (MouseEvent.Dragging()) + { + Dragging(MouseEvent); + } + else if (MouseEvent.ButtonUp()) + { + ButtonUp(MouseEvent); + } } void tArrayEdit::Enable(int e) Modified: trunk/jazz/src/Random.h =================================================================== --- trunk/jazz/src/Random.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/Random.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -145,7 +145,7 @@ virtual void DrawYTicks(wxDC* dc); virtual void DrawLabel(wxDC* dc); virtual void DrawNull(wxDC* dc); - int Index(wxMouseEvent &e); + int Index(wxMouseEvent& MouseEvent); int enabled; int style_bits; @@ -168,10 +168,10 @@ virtual void OnDraw(wxDC& indc); virtual void OnSize(wxSizeEvent& event); - virtual void OnMouseEvent(wxMouseEvent &e); - virtual int Dragging(wxMouseEvent &); - virtual int ButtonDown(wxMouseEvent &); - virtual int ButtonUp(wxMouseEvent &); + virtual void OnMouseEvent(wxMouseEvent& MouseEvent); + virtual int Dragging(wxMouseEvent& MouseEvent); + virtual int ButtonDown(wxMouseEvent& MouseEvent); + virtual int ButtonUp(wxMouseEvent& MouseEvent); virtual void SetLabel(char const *llabel); void Enable(int enable = 1); Modified: trunk/jazz/src/SampleWindow.cpp =================================================================== --- trunk/jazz/src/SampleWindow.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/SampleWindow.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -138,7 +138,7 @@ } virtual void OnPaint(); virtual void OnSize(int w, int h); - virtual void OnEvent(wxMouseEvent &evt); + virtual void OnEvent(wxMouseEvent& MouseEvent); void ClearSelection(); void SetInsertionPoint(int offs); void SetSelection(int fr, int to); @@ -311,7 +311,7 @@ -void tSampleCnvs::OnEvent(wxMouseEvent &e) +void tSampleCnvs::OnEvent(wxMouseEvent& MouseEvent) { // dont accept mouse events as long as the // array edit is up @@ -323,7 +323,7 @@ wxDC* pDc = new wxClientDC(this); // tSnapSel is strange. - if (e.LeftDown()) + if (MouseEvent.LeftDown()) { mouse_up_sets_insertion_point = 0; mouse_down = TRUE; @@ -340,12 +340,12 @@ { mouse_up_sets_insertion_point = 1; } - snapsel.Event(e); + snapsel.ProcessMouseEvent(MouseEvent); } - else if (e.LeftUp()) + else if (MouseEvent.LeftUp()) { mouse_down = FALSE; - snapsel.Event(e); + snapsel.ProcessMouseEvent(MouseEvent); if (snapsel.IsSelected()) { snapsel.Draw(*pDc, 0, 0); @@ -357,7 +357,7 @@ else if (mouse_up_sets_insertion_point) { int x, y; - e.GetPosition(&x, &y); + MouseEvent.GetPosition(&x, &y); sel_fr = sel_to = Pixel2Sample(x); inspt.Draw(x); } @@ -366,9 +366,9 @@ sel_fr = sel_to = -1; } } - else if (e.Dragging() && mouse_down) + else if (MouseEvent.Dragging() && mouse_down) { - snapsel.Event(e); + snapsel.ProcessMouseEvent(MouseEvent); } } Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/TrackFrame.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -665,7 +665,7 @@ // playing: // left+right: stop //----------------------------------------------------------------------------- -void JZTrackFrame::MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode) +void JZTrackFrame::MousePlay(wxMouseEvent& MouseEvent, TEMousePlayMode Mode) { - mpTrackWindow->MousePlay(Event, Mode); + mpTrackWindow->MousePlay(MouseEvent, Mode); } Modified: trunk/jazz/src/TrackFrame.h =================================================================== --- trunk/jazz/src/TrackFrame.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/TrackFrame.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -102,7 +102,7 @@ void OnHelpAbout(wxCommandEvent& Event); - void MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode); + void MousePlay(wxMouseEvent& MouseEvent, TEMousePlayMode Mode); private: Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/TrackWindow.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 Peter J. Stieber // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -265,9 +265,9 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZTrackWindow::OnLeftButtonDown(wxMouseEvent& Event) +void JZTrackWindow::OnLeftButtonDown(wxMouseEvent& MouseEvent) { - wxPoint Point = Event.GetPosition(); + wxPoint Point = MouseEvent.GetPosition(); if (Point.x < mNumberWidth && Point.y >= mTopInfoHeight) { @@ -282,34 +282,34 @@ mEventsY, mEventsWidth, mEventsHeight); - SnapSelStop(Event); + SnapSelStop(MouseEvent); } else if ( Point.x >= mEventsX && Point.x < mEventsX + mEventsWidth && Point.y >= mEventsY && Point.y < mEventsY + mEventsHeight) { - SnapSelectionStart(Event); - mpSnapSel->ButtonDown(Event); + SnapSelectionStart(MouseEvent); + mpSnapSel->ButtonDown(MouseEvent); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZTrackWindow::OnMouseMove(wxMouseEvent& Event) +void JZTrackWindow::OnMouseMove(wxMouseEvent& MouseEvent) { - if (Event.LeftIsDown()) + if (MouseEvent.LeftIsDown()) { - mpSnapSel->Dragging(Event); -// SnapSelectionStop(Event); + mpSnapSel->Dragging(MouseEvent); +// SnapSelectionStop(MouseEvent); Refresh(false); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZTrackWindow::OnLeftButtonUp(wxMouseEvent& Event) +void JZTrackWindow::OnLeftButtonUp(wxMouseEvent& MouseEvent) { - wxPoint Point = Event.GetPosition(); + wxPoint Point = MouseEvent.GetPosition(); // Check to see if the mouse was clicked in the top header. if (Point.y < mTopInfoHeight) @@ -410,10 +410,10 @@ Point.x >= mEventsX && Point.x < mEventsX + mEventsWidth && Point.y >= mEventsY && Point.y < mEventsY + mEventsHeight) { - mpSnapSel->ButtonUp(Event); + mpSnapSel->ButtonUp(MouseEvent); // The point is in event area. - SnapSelectionStop(Event); + SnapSelectionStop(MouseEvent); } } } @@ -421,9 +421,9 @@ //----------------------------------------------------------------------------- //------------------------------------------------------------------------... [truncated message content] |
From: <pst...@us...> - 2009-02-16 21:03:14
|
Revision: 701 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=701&view=rev Author: pstieber Date: 2009-02-16 21:03:09 +0000 (Mon, 16 Feb 2009) Log Message: ----------- Removed unused data from the event frame base class. Modified Paths: -------------- trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventFrame.h Modified: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp 2009-02-16 20:49:52 UTC (rev 700) +++ trunk/jazz/src/EventFrame.cpp 2009-02-16 21:03:09 UTC (rev 701) @@ -4,7 +4,6 @@ #include "Dialogs.h" #include "EventWindow.h" #include "Filter.h" -#include "MouseAction.h" #include "Resources.h" #include "ToolBar.h" @@ -38,28 +37,18 @@ const wxSize& Size, long WindowStyle) : wxFrame(pParent, wxID_ANY, Title, Position, Size, WindowStyle), - Song(pSong), mpFilter(0), - mTopInfoHeight(40), - mEventsX(), - mEventsY(mTopInfoHeight), - mEventsWidth(0), - mEventsHeight(0), - SnapSel(0), - MouseAction(0), MixerForm(0), mpToolBar(0), mpEventWindow(0) { - mpFilter = new JZFilter(Song); + mpFilter = new JZFilter(pSong); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZEventFrame::~JZEventFrame() { - delete SnapSel; - delete mpFilter; delete mpToolBar; @@ -81,76 +70,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//void JZEventFrame::SnapSelStart(wxMouseEvent& MouseEvent) -//{ -//} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -//void JZEventFrame::SnapSelStop(wxMouseEvent& MouseEvent) -//{ -//} - -//----------------------------------------------------------------------------- -// seems to handle the "selection" rectangle. normally called from the base -// class onmouseevent handler -//----------------------------------------------------------------------------- -/* -int JZEventFrame::OnMouseEvent(wxMouseEvent& MouseEvent) -{ -// cout << "JZEventFrame::OnMouseEvent" << endl; - if (!MouseAction) - { - // create SnapSel? - int x; - int y; - MouseEvent.GetPosition(&x, &y); - if ( - mEventsX < x && - x < mEventsX + mEventsWidth && - mEventsY < y && - y < mEventsY + mEventsHeight) - { - if (MouseEvent.LeftDown()) - { - { - SnapSelStart(MouseEvent); - - if (SnapSel->IsSelected()) - { - Refresh(); //redraw the whole window instead(inefficient, we should rather invalidate a rect) - } - SnapSel->ProcessMouseEvent(MouseEvent); - MouseAction = SnapSel; - } - } - } - } - else - { - // MouseAction active - - if (MouseAction->ProcessMouseEvent(MouseEvent)) - { - // MouseAction finished - - if (MouseAction == SnapSel) - { - SnapSelStop(MouseEvent); - Redraw(); //ineficcient, invalidate rect first instead - MouseAction = 0; - return 1; - } - - MouseAction = 0; - } - } - return 0; -} -*/ - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- bool JZEventFrame::OnKeyEvent(wxKeyEvent& KeyEvent) { return false; Modified: trunk/jazz/src/EventFrame.h =================================================================== --- trunk/jazz/src/EventFrame.h 2009-02-16 20:49:52 UTC (rev 700) +++ trunk/jazz/src/EventFrame.h 2009-02-16 21:03:09 UTC (rev 701) @@ -27,10 +27,8 @@ class JZEventWindow; class JZFilter; -class JZSnapSelection; class JZSong; class JZToolBar; -class tMouseAction; class wxDialog; //***************************************************************************** @@ -40,7 +38,6 @@ // class. // Functionality: // - Settings dialog -// - Selection via Snapsel //***************************************************************************** class JZEventFrame : public wxFrame { @@ -59,11 +56,7 @@ virtual void SetEventWindow(JZEventWindow* pEventWindow); -// virtual void SnapSelStart(wxMouseEvent &e); -// virtual void SnapSelStop(wxMouseEvent &e); - // Events -// virtual int OnMouseEvent(wxMouseEvent& Event); virtual bool OnKeyEvent(wxKeyEvent& Event); // true = processed by eventwin virtual bool OnClose(); @@ -71,20 +64,8 @@ virtual void Redraw(); - - - JZSong* Song; - JZFilter* mpFilter; - int mTopInfoHeight; - - int mEventsX, mEventsY, mEventsWidth, mEventsHeight; - - // Mouse handling - JZSnapSelection* SnapSel; - tMouseAction* MouseAction; - // Mixer-Dialog wxDialog* MixerForm; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |