diff --git a/.gitignore b/.gitignore index 1ea3fff8..b02f4019 100644 --- a/.gitignore +++ b/.gitignore @@ -3,32 +3,37 @@ Output/Songs *.mp4 *.pdb /Output/Benchmark.log - /Output/CoverDB.sqlite - /Output/HighscoreDB.sqlite - /Output/PartyModes/*/Code/* - /Output/Vocaluxe.exe* - /Output/Vocaluxe.vshost.exe* - /Output/VocaluxeLib.dll - *.psess - /*.vsp - /*.ctl - /Output/Registration.xml - /Vocaluxe.suo /Vocaluxe/Vocaluxe.csproj.user - /Output/Config.xml - *.ipch - *.log +/Output/Playlists/*.xml +/Output/x64/gstreamer/GstreamerHelper.dll +*.tlog +*.suo +*.obj +*.lastbuildstate +*.pch +*.idb +*.exp +*.ilk +*.lib +*.opensdf +*.sdf +*.codeanalysis* +*.nativecodeanalysis* +*.lastcodeanalysissucceeded +/PartyModes/*/*/*.dll + +*.Cache diff --git a/CheckingRules.ruleset b/CheckingRules.ruleset new file mode 100644 index 00000000..de4b78c7 --- /dev/null +++ b/CheckingRules.ruleset @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Community.CsharpSqlite/src/parse_c.cs b/Community.CsharpSqlite/src/parse_c.cs index 6875b256..abfea0f1 100644 --- a/Community.CsharpSqlite/src/parse_c.cs +++ b/Community.CsharpSqlite/src/parse_c.cs @@ -1540,8 +1540,6 @@ yyGrowStack(pParser); sqlite3IdListDelete( pParse.db, ref ( yypminor.yy90 ).b ); //#line 1473 "parse.c" } - break; - default: break; /* If no destructor action specified: do nothing */ } } diff --git a/GstreamerHelper/GstreamerAudioStream.cpp b/GstreamerHelper/GstreamerAudioStream.cpp index 776db6b3..1aa4d4c9 100644 --- a/GstreamerHelper/GstreamerAudioStream.cpp +++ b/GstreamerHelper/GstreamerAudioStream.cpp @@ -227,14 +227,14 @@ void GstreamerAudioStream::FadeAndPause(float TargetVolume, float Seconds) { PauseStreamAfterFade = true; - Fade(TargetVolume, FadeTime); + Fade(TargetVolume, Seconds); } void GstreamerAudioStream::FadeAndStop(float TargetVolume, float Seconds) { CloseStreamAfterFade = true; - Fade(TargetVolume, FadeTime); + Fade(TargetVolume, Seconds); } bool GstreamerAudioStream::IsPlaying() diff --git a/GstreamerHelper/GstreamerHelper.vcxproj b/GstreamerHelper/GstreamerHelper.vcxproj index 6ade9eb8..8e692fe5 100644 --- a/GstreamerHelper/GstreamerHelper.vcxproj +++ b/GstreamerHelper/GstreamerHelper.vcxproj @@ -77,6 +77,7 @@ ..\Output\x64\gstreamer\ $(MSBuildProjectDirectory)\x64\lib\glib-2.0\include;$(MSBuildProjectDirectory)\x64\include\gstreamer-1.0;$(MSBuildProjectDirectory)\x64\include\glib-2.0;$(MSBuildProjectDirectory)\x64\include;$(IncludePath) $(MSBuildProjectDirectory)\x64\lib;$(LibraryPath) + ..\CheckingRules.ruleset false diff --git a/GstreamerHelper/GstreamerVideo.cpp b/GstreamerHelper/GstreamerVideo.cpp index 7834eef1..214f0709 100644 --- a/GstreamerHelper/GstreamerVideo.cpp +++ b/GstreamerHelper/GstreamerVideo.cpp @@ -65,7 +65,7 @@ DllExport bool CloseVideo(int Stream) DllExport int GetVideoNumStreams() { - return VideoStreams.size(); + return (int) VideoStreams.size(); } DllExport float GetVideoLength(int Stream) @@ -85,6 +85,13 @@ DllExport struct ApplicationFrame GetFrame(int Stream, float Time) { return it->second->GetFrame(Time); } + struct ApplicationFrame returnFrame; + returnFrame.size=0; + returnFrame.width=0; + returnFrame.height=0; + returnFrame.data=NULL; + returnFrame.videotime=0; + return returnFrame; } DllExport bool Skip(int Stream, float Start, float Gap) diff --git a/GstreamerHelper/GstreamerVideoStream.cpp b/GstreamerHelper/GstreamerVideoStream.cpp index d67f4656..93c98df0 100644 --- a/GstreamerHelper/GstreamerVideoStream.cpp +++ b/GstreamerHelper/GstreamerVideoStream.cpp @@ -180,7 +180,7 @@ struct ApplicationFrame GstreamerVideoStream::GetFrame(float Time) gst_buffer_map(Buffer, &Mapinfo, GST_MAP_READ); - Size = Mapinfo.size; + Size = (int) Mapinfo.size; gst_structure_get_int (BufferStructure, "width", &Width); gst_structure_get_int (BufferStructure, "height", &Height); VideoTime = (float) (Buffer->pts / GST_SECOND); @@ -210,7 +210,7 @@ struct ApplicationFrame GstreamerVideoStream::GetFrame(float Time) bool GstreamerVideoStream::Skip(float Start, float Gap) { - if(!gst_element_seek_simple(Element, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE), (Start + Gap) * GST_SECOND)) + if(!gst_element_seek_simple(Element, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE), (gint64)((Start + Gap) * GST_SECOND))) { LogVideoError("Seek failed"); return true; diff --git a/GstreamerHelper/GstreamerVideoStream.h b/GstreamerHelper/GstreamerVideoStream.h index 29183571..7d69e019 100644 --- a/GstreamerHelper/GstreamerVideoStream.h +++ b/GstreamerHelper/GstreamerVideoStream.h @@ -57,7 +57,7 @@ private: volatile gboolean Copying; gboolean Paused; - gboolean Finished; + bool Finished; gfloat Duration; diff --git a/Output/CreditsRessourcesDB.sqlite b/Output/CreditsRessourcesDB.sqlite index dbfe78bb..3f960232 100644 Binary files a/Output/CreditsRessourcesDB.sqlite and b/Output/CreditsRessourcesDB.sqlite differ diff --git a/Output/Fonts/Fonts.xml b/Output/Fonts/Fonts.xml index 70524adf..2bbf61c3 100644 --- a/Output/Fonts/Fonts.xml +++ b/Output/Fonts/Fonts.xml @@ -1,29 +1,31 @@  - - Normal - 0,00 - 0,00 - 0,00 - 0,00 - 1,00 - FreeSans - FreeSans.ttf - FreeSansBold.ttf - FreeSansOblique.ttf - FreeSansBoldOblique.ttf - - - Outline - 0,10 - 0,00 - 0,00 - 0,00 - 1,00 - FreeSans - FreeSans.ttf - FreeSansBold.ttf - FreeSansOblique.ttf - FreeSansBoldOblique.ttf - + + + Normal + 0,00 + 0,00 + 0,00 + 0,00 + 1,00 + FreeSans + FreeSans.ttf + FreeSansBold.ttf + FreeSansOblique.ttf + FreeSansBoldOblique.ttf + + + Outline + 0,10 + 0,00 + 0,00 + 0,00 + 1,00 + FreeSans + FreeSans.ttf + FreeSansBold.ttf + FreeSansOblique.ttf + FreeSansBoldOblique.ttf + + \ No newline at end of file diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml index e6c32d03..42460ca7 100644 --- a/Output/Languages/English.xml +++ b/Output/Languages/English.xml @@ -112,6 +112,7 @@ Sing all songs Sing all visible songs Open playlist + Select Sing a random medley Sing medley-songs New Playlist diff --git a/Output/Languages/German.xml b/Output/Languages/German.xml index 52cbba63..7fe3cf73 100644 --- a/Output/Languages/German.xml +++ b/Output/Languages/German.xml @@ -112,6 +112,7 @@ Alle Songs singen Alle sichtbaren Songs singen Playlist öffnen + Auswählen Zufälliges Medley singen Medley-Songs singen Neue Playlist diff --git a/Output/PartyModes/Challenge/Fonts/Fonts.xml b/Output/PartyModes/Challenge/Fonts/Fonts.xml deleted file mode 100644 index 70524adf..00000000 --- a/Output/PartyModes/Challenge/Fonts/Fonts.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - Normal - 0,00 - 0,00 - 0,00 - 0,00 - 1,00 - FreeSans - FreeSans.ttf - FreeSansBold.ttf - FreeSansOblique.ttf - FreeSansBoldOblique.ttf - - - Outline - 0,10 - 0,00 - 0,00 - 0,00 - 1,00 - FreeSans - FreeSans.ttf - FreeSansBold.ttf - FreeSansOblique.ttf - FreeSansBoldOblique.ttf - - \ No newline at end of file diff --git a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSans.ttf b/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSans.ttf deleted file mode 100644 index 6de62ebf..00000000 Binary files a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSans.ttf and /dev/null differ diff --git a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBold.ttf b/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBold.ttf deleted file mode 100644 index e75685be..00000000 Binary files a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBold.ttf and /dev/null differ diff --git a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBoldOblique.ttf b/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBoldOblique.ttf deleted file mode 100644 index ec3bc02c..00000000 Binary files a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansBoldOblique.ttf and /dev/null differ diff --git a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansOblique.ttf b/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansOblique.ttf deleted file mode 100644 index 733f8829..00000000 Binary files a/Output/PartyModes/Challenge/Fonts/FreeSans/FreeSansOblique.ttf and /dev/null differ diff --git a/Output/PartyModes/Challenge/Fonts/FreeSans/readme.txt b/Output/PartyModes/Challenge/Fonts/FreeSans/readme.txt deleted file mode 100644 index 33ccd11d..00000000 --- a/Output/PartyModes/Challenge/Fonts/FreeSans/readme.txt +++ /dev/null @@ -1,40 +0,0 @@ -Congratulations, you have successfully downloaded font file! - -This font is provided to you by Fonts2u.com – the largest online -repository of free fonts for Windows and Mac. - - - -How to install this font on your computer? - -For Windows 7 / Vista users: - -- Right-click the font file(s) and choose "Install". - -For users of the previous Windows versions: - -- Copy the included file(s) into a default Windows font folder - (usually C:\WINDOWS\FONTS or C:\WINNT\FONTS) - -For Mac users: - -Mac OS X 10.3 or above (including the FontBook) - -- Double-click the font file and hit "Install font" button at - the bottom of the preview. - -Mac OS X - -- Either copy the font file(s) to /Library/Fonts (for all users), - or to /Users/Your_username/Library/Fonts (for you only). - -Mac OS 9 or earlier - -- You have to convert the font file(s) you have downloaded. - Drag the font suitcases into the System folder. The system - will propose you to add them to the Fonts folder. - -For Linux users: - -- Copy the font file(s) to /USR/SHARE/FONTS - diff --git a/Output/PartyModes/ChallengeMedley.xml b/Output/PartyModes/ChallengeMedley.xml index 618d3000..7e1d6605 100644 --- a/Output/PartyModes/ChallengeMedley.xml +++ b/Output/PartyModes/ChallengeMedley.xml @@ -6,14 +6,14 @@ brunzel TR_PARTYMODE_DESCRIPTION ChallengeMedley - PartyModeChallenge + PartyModeChallengeMedley 0 1 TR_PARTYMODE_AUDIENCE - PartyScreenChallengeMain - PartyScreenChallengeConfig - PartyScreenChallengeNames + PartyScreenChallengeMedleyMain + PartyScreenChallengeMedleyConfig + PartyScreenChallengeMedleyNames \ No newline at end of file diff --git a/Output/PartyModes/ChallengeMedley/Fonts/Fonts.xml b/Output/PartyModes/ChallengeMedley/Fonts/Fonts.xml deleted file mode 100644 index 70524adf..00000000 --- a/Output/PartyModes/ChallengeMedley/Fonts/Fonts.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - Normal - 0,00 - 0,00 - 0,00 - 0,00 - 1,00 - FreeSans - FreeSans.ttf - FreeSansBold.ttf - FreeSansOblique.ttf - FreeSansBoldOblique.ttf - - - Outline - 0,10 - 0,00 - 0,00 - 0,00 - 1,00 - FreeSans - FreeSans.ttf - FreeSansBold.ttf - FreeSansOblique.ttf - FreeSansBoldOblique.ttf - - \ No newline at end of file diff --git a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSans.ttf b/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSans.ttf deleted file mode 100644 index 6de62ebf..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSans.ttf and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBold.ttf b/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBold.ttf deleted file mode 100644 index e75685be..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBold.ttf and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBoldOblique.ttf b/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBoldOblique.ttf deleted file mode 100644 index ec3bc02c..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansBoldOblique.ttf and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansOblique.ttf b/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansOblique.ttf deleted file mode 100644 index 733f8829..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/FreeSansOblique.ttf and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/readme.txt b/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/readme.txt deleted file mode 100644 index 33ccd11d..00000000 --- a/Output/PartyModes/ChallengeMedley/Fonts/FreeSans/readme.txt +++ /dev/null @@ -1,40 +0,0 @@ -Congratulations, you have successfully downloaded font file! - -This font is provided to you by Fonts2u.com – the largest online -repository of free fonts for Windows and Mac. - - - -How to install this font on your computer? - -For Windows 7 / Vista users: - -- Right-click the font file(s) and choose "Install". - -For users of the previous Windows versions: - -- Copy the included file(s) into a default Windows font folder - (usually C:\WINDOWS\FONTS or C:\WINNT\FONTS) - -For Mac users: - -Mac OS X 10.3 or above (including the FontBook) - -- Double-click the font file and hit "Install font" button at - the bottom of the preview. - -Mac OS X - -- Either copy the font file(s) to /Library/Fonts (for all users), - or to /Users/Your_username/Library/Fonts (for you only). - -Mac OS 9 or earlier - -- You have to convert the font file(s) you have downloaded. - Drag the font suitcases into the System folder. The system - will propose you to add them to the Fonts folder. - -For Linux users: - -- Copy the font file(s) to /USR/SHARE/FONTS - diff --git a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeConfig.xml b/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyConfig.xml similarity index 99% rename from Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeConfig.xml rename to Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyConfig.xml index 6581aa77..cda12131 100644 --- a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeConfig.xml +++ b/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyConfig.xml @@ -1,6 +1,6 @@ - + 1 @@ -454,5 +454,5 @@ 10 - + diff --git a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMain.xml b/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyMain.xml similarity index 99% rename from Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMain.xml rename to Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyMain.xml index 34733ff1..c5f7bc22 100644 --- a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMain.xml +++ b/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyMain.xml @@ -1,6 +1,6 @@ - + 1 @@ -981,5 +981,5 @@ - + diff --git a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeNames.xml b/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyNames.xml similarity index 99% rename from Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeNames.xml rename to Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyNames.xml index 9d033c03..284b495e 100644 --- a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeNames.xml +++ b/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyNames.xml @@ -1,6 +1,6 @@ - + 1 @@ -270,5 +270,5 @@ - + diff --git a/Output/PartyModes/TicTacToe/Fonts/Fonts.xml b/Output/PartyModes/TicTacToe/Fonts/Fonts.xml deleted file mode 100644 index 70524adf..00000000 --- a/Output/PartyModes/TicTacToe/Fonts/Fonts.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - Normal - 0,00 - 0,00 - 0,00 - 0,00 - 1,00 - FreeSans - FreeSans.ttf - FreeSansBold.ttf - FreeSansOblique.ttf - FreeSansBoldOblique.ttf - - - Outline - 0,10 - 0,00 - 0,00 - 0,00 - 1,00 - FreeSans - FreeSans.ttf - FreeSansBold.ttf - FreeSansOblique.ttf - FreeSansBoldOblique.ttf - - \ No newline at end of file diff --git a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSans.ttf b/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSans.ttf deleted file mode 100644 index 6de62ebf..00000000 Binary files a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSans.ttf and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBold.ttf b/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBold.ttf deleted file mode 100644 index e75685be..00000000 Binary files a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBold.ttf and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBoldOblique.ttf b/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBoldOblique.ttf deleted file mode 100644 index ec3bc02c..00000000 Binary files a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansBoldOblique.ttf and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansOblique.ttf b/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansOblique.ttf deleted file mode 100644 index 733f8829..00000000 Binary files a/Output/PartyModes/TicTacToe/Fonts/FreeSans/FreeSansOblique.ttf and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Fonts/FreeSans/readme.txt b/Output/PartyModes/TicTacToe/Fonts/FreeSans/readme.txt deleted file mode 100644 index 33ccd11d..00000000 --- a/Output/PartyModes/TicTacToe/Fonts/FreeSans/readme.txt +++ /dev/null @@ -1,40 +0,0 @@ -Congratulations, you have successfully downloaded font file! - -This font is provided to you by Fonts2u.com – the largest online -repository of free fonts for Windows and Mac. - - - -How to install this font on your computer? - -For Windows 7 / Vista users: - -- Right-click the font file(s) and choose "Install". - -For users of the previous Windows versions: - -- Copy the included file(s) into a default Windows font folder - (usually C:\WINDOWS\FONTS or C:\WINNT\FONTS) - -For Mac users: - -Mac OS X 10.3 or above (including the FontBook) - -- Double-click the font file and hit "Install font" button at - the bottom of the preview. - -Mac OS X - -- Either copy the font file(s) to /Library/Fonts (for all users), - or to /Users/Your_username/Library/Fonts (for you only). - -Mac OS 9 or earlier - -- You have to convert the font file(s) you have downloaded. - Drag the font suitcases into the System folder. The system - will propose you to add them to the Fonts folder. - -For Linux users: - -- Copy the font file(s) to /USR/SHARE/FONTS - diff --git a/Output/Readme.txt b/Output/Readme.txt index 4187d5a7..cd0cd6ac 100644 --- a/Output/Readme.txt +++ b/Output/Readme.txt @@ -109,39 +109,41 @@ Vocaluxe.exe -ConfigFile MyConfig.xml -ScoreFile C:\Vocaluxe\Highscores\MyHighsc ================================= = 4. Controls = ================================= -[Mouse] to navigate through the screens: Left button: select/manipulate elements, - Right button: go to previous screen. -[Cursor] to navigate through the screens. -[Enter] to confirm +[Mouse] to navigate through the screens: Left button: select/manipulate elements, + Right button: go to previous screen. +[Cursor] to navigate through the screens. +[Enter] to confirm [Escape] or [Back] to go to the previous screen. -[ALT] + [P] to take a ScreenShot. Screenshots are saved in the directory "Screenshots". +[ALT] + [P] to take a ScreenShot. Screenshots are saved in the directory "Screenshots". [ALT] + [ENTER] to toggle full screen mode. [SHIFT] + [F1] to toggle theme edit mode. The theme edit mode is experimental. It allows you to change the size and position of the element on the screens. You can save your changes with [S] before leaving the theme edit mode. -[TAB] to open the background music controls (not on all screens). +[TAB] to open the background music controls (not on all screens). [SHIFT] + [+] to increase volume [SHIFT] + [-] to decrease volume Song screen +[F3] to open/close the song search menu +[SPACE] to open/close the song menu [CTRL] + [R] to select a random song -[F3] to open/close the song search menu -[A] to sing all songs -[SHIFT] + [A] to sing all songs from a category -[SPACE] to open/close the song menu +[CTRL] + [A] to sing all songs +[CTRL] + [V] to sing all songs from a category +[NUM_1]..[NUM_6] to use a Joker for team 1..6 +[A]..[Z] to jump to category/song title starting with that letter Name selection screen -[1]..[6] to activate player selection. -[Cursor] to select a profile. -[Enter] to confirm a selection. +[1]..[6] to activate player selection. +[Cursor] to select a profile. +[Enter] to confirm a selection. Sing screen -[P] to toggle pause. +[P] to toggle pause. [CTRL] + [S] to skip a song if there is another one in the playlist. -[T] to change the time format of the timer. -[I] to change view of player information. -[W] to activate the configured webcam. +[T] to change the time format of the timer. +[I] to change view of player information. +[W] to activate the configured webcam. ================================= diff --git a/Output/Themes/Ambient/Screens/ScreenSong.xml b/Output/Themes/Ambient/Screens/ScreenSong.xml index 5135f622..e279174b 100644 --- a/Output/Themes/Ambient/Screens/ScreenSong.xml +++ b/Output/Themes/Ambient/Screens/ScreenSong.xml @@ -1,7 +1,7 @@  - 4 + 5 Video @@ -954,7 +954,7 @@ Button 40 - 135 + 225 -2,11 360 40 @@ -1003,7 +1003,7 @@ Button 40 - 180 + 270 -2,11 360 40 @@ -1045,14 +1045,14 @@ - + Button Button 40 - 270 + 135 -2,11 360 40 @@ -1085,7 +1085,7 @@ Outline - TR_SCREENSONG_BUTTON_OPENPLAYLIST + TR_SCREENSONG_BUTTON_OPEN_SELECTED_ITEM @@ -1093,7 +1093,7 @@ - + Invisible @@ -1449,19 +1449,19 @@ SelectSlide 40 - 225 + 180 -2,11 360 40 45 - 235 + 190 -2,12 30 30 365 - 235 + 190 -2,12 30 30 diff --git a/Output/Themes/Changelog/Changelog_ScreenSong.txt b/Output/Themes/Changelog/Changelog_ScreenSong.txt index 35d3c6ba..84b853fb 100644 --- a/Output/Themes/Changelog/Changelog_ScreenSong.txt +++ b/Output/Themes/Changelog/Changelog_ScreenSong.txt @@ -1,5 +1,13 @@ ScreenSong +++++++++++ +Version 5: + +Add: + +Remove: +ButtonOptionsOpenPlaylist + ++++++++++ Version 4: diff --git a/Output/x64/gstreamer/GstreamerHelper.dll b/Output/x64/gstreamer/GstreamerHelper.dll deleted file mode 100644 index c647f7a1..00000000 Binary files a/Output/x64/gstreamer/GstreamerHelper.dll and /dev/null differ diff --git a/PartyModes/Excludes.txt b/PartyModes/Excludes.txt new file mode 100644 index 00000000..794d6f05 --- /dev/null +++ b/PartyModes/Excludes.txt @@ -0,0 +1 @@ +GlobalSuppressions.cs diff --git a/PartyModes/PartyModeChallenge/ChallengeRounds.cs b/PartyModes/PartyModeChallenge/ChallengeRounds.cs index 05670e10..908c1fa8 100644 --- a/PartyModes/PartyModeChallenge/ChallengeRounds.cs +++ b/PartyModes/PartyModeChallenge/ChallengeRounds.cs @@ -1,22 +1,19 @@ using System; using System.Collections.Generic; -using System.Text; -using Vocaluxe.Menu; - -namespace Vocaluxe.PartyModes +namespace VocaluxeLib.PartyModes.Challenge { public class ChallengeRounds { - private Random _Rand; - private int _NumPlayer; + private readonly Random _Rand; + private readonly int _NumPlayer; public List Rounds; public ChallengeRounds(int NumRounds, int NumPlayer, int NumPlayerAtOnce) { Rounds = new List(); - _Rand = new Random(System.DateTime.Now.Millisecond); + _Rand = new Random(DateTime.Now.Millisecond); if (NumPlayerAtOnce < 1 || NumRounds < 1 || NumPlayer == 0) _NumPlayer = 0; @@ -41,26 +38,19 @@ namespace Vocaluxe.PartyModes Rounds.Add(Combinations.GetNextCombination(null)); for (int i = 1; i < NumRounds; i++) - { - Rounds.Add(Combinations.GetNextCombination(GetPlayerDemand(i))); - } } private List GetPlayerDemand(int RoundIndex) { List NumPlayed = new List(_NumPlayer); for (int i = 0; i < _NumPlayer; i++) - { NumPlayed.Add(0); - } for (int i = 0; i < RoundIndex; i++) { foreach (int PlayerIndex in Rounds[i].Player) - { NumPlayed[PlayerIndex]++; - } } int max = 0; @@ -95,7 +85,6 @@ namespace Vocaluxe.PartyModes } else last.Add(i); - } } @@ -129,17 +118,17 @@ namespace Vocaluxe.PartyModes class Combinations { - private List _Combs; - private Random _Rand; - private int _NumPlayer; - private int _NumMics; + private readonly List _Combs; + private readonly Random _Rand; + private readonly int _NumPlayer; + private readonly int _NumMics; public Combinations(int NumPlayer, int NumMics, Random Rand) { _Combs = new List(); _NumMics = NumMics; _NumPlayer = NumPlayer; - _Rand = Rand; + _Rand = Rand; } public Combination GetNextCombination(List PlayerNrDemand) @@ -150,9 +139,7 @@ namespace Vocaluxe.PartyModes Combination combs = new Combination(); if (_NumPlayer == _NumMics) - { return _Combs[0]; - } //filter against PlayerNrDemand List combsFiltered = new List(); @@ -179,18 +166,14 @@ namespace Vocaluxe.PartyModes if (combsFiltered.Count == 0) { for (int i = 0; i < _Combs.Count; i++) - { combsFiltered.Add(_Combs[i]); - } } int num = combsFiltered.Count; int rand = _Rand.Next(num); Combination c = new Combination(); for (int i = 0; i < combsFiltered[rand].Player.Count; i++) - { c.Player.Add(combsFiltered[rand].Player[i]); - } _Combs.Remove(combsFiltered[rand]); return combsFiltered[rand]; @@ -209,9 +192,7 @@ namespace Vocaluxe.PartyModes for (int j = 0; j < _NumPlayer; j++) { if ((i & (1 << j)) > 0) - { c.Player.Add(j); - } } if (c.Player.Count == _NumMics) @@ -243,9 +224,7 @@ namespace Vocaluxe.PartyModes { bool result = true; foreach (int p in PlayerIndices) - { result &= IsAvailable(p); - } return result; } @@ -253,10 +232,8 @@ namespace Vocaluxe.PartyModes { bool result = false; foreach (int p in PlayerIndices) - { result |= IsAvailable(p); - } return result; } } -} +} \ No newline at end of file diff --git a/PartyModes/PartyModeChallenge/GlobalSuppressions.cs b/PartyModes/PartyModeChallenge/GlobalSuppressions.cs new file mode 100644 index 00000000..21fb9bcd Binary files /dev/null and b/PartyModes/PartyModeChallenge/GlobalSuppressions.cs differ diff --git a/PartyModes/PartyModeChallenge/PartyModeChallenge.cs b/PartyModes/PartyModeChallenge/PartyModeChallenge.cs index 600024c2..2b248af1 100644 --- a/PartyModes/PartyModeChallenge/PartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/PartyModeChallenge.cs @@ -1,12 +1,15 @@ using System; using System.Collections.Generic; -using System.Text; +using System.Runtime.InteropServices; +using VocaluxeLib.Menu; -using Vocaluxe.Menu; +[assembly: ComVisible(false)] -namespace Vocaluxe.PartyModes +namespace VocaluxeLib.PartyModes.Challenge { + #region Communication + #region ToScreen public struct DataToScreenConfig { @@ -52,9 +55,7 @@ namespace Vocaluxe.PartyModes { res = row.NumSingPoints.CompareTo(NumSingPoints); if (res == 0) - { res = row.NumWon.CompareTo(NumWon); - } } return res; } @@ -62,7 +63,6 @@ namespace Vocaluxe.PartyModes throw new ArgumentException("object is not a ResultTableRow"); } } - #endregion ToScreen #region FromScreen @@ -93,6 +93,7 @@ namespace Vocaluxe.PartyModes public bool FadeToNameSelection; } #endregion FromScreen + #endregion Communication public sealed class PartyModeChallenge : CPartyMode @@ -103,7 +104,7 @@ namespace Vocaluxe.PartyModes private const int MinTeams = 0; private const int MaxNumRounds = 100; - enum EStage + private enum EStage { NotStarted, Config, @@ -112,7 +113,7 @@ namespace Vocaluxe.PartyModes Singing } - struct Data + private struct Data { public int NumPlayer; public int NumPlayerAtOnce; @@ -128,7 +129,7 @@ namespace Vocaluxe.PartyModes public int[] CatSongIndices; } - struct Stats + private struct Stats { public int ProfileID; public int SingPoints; @@ -148,13 +149,13 @@ namespace Vocaluxe.PartyModes _ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.PartyMode = true; _ScreenSongOptions.Selection.CategoryChangeAllowed = true; - _ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 }; - _ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" }; + _ScreenSongOptions.Selection.NumJokers = new int[] {5, 5}; + _ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"}; _ScreenSongOptions.Sorting.SearchString = String.Empty; _ScreenSongOptions.Sorting.SearchActive = false; - _ScreenSongOptions.Sorting.ShowDuetSongs = false; - + _ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets; + _Stage = EStage.NotStarted; ToScreenConfig = new DataToScreenConfig(); @@ -195,7 +196,7 @@ namespace Vocaluxe.PartyModes switch (ScreenName) { case "PartyScreenChallengeConfig": - + try { data = (DataFromScreen)Data; @@ -327,10 +328,8 @@ namespace Vocaluxe.PartyModes Screen.DataToScreen(ToScreenMain); } break; - default: - break; } - + return Screen; } @@ -441,7 +440,6 @@ namespace Vocaluxe.PartyModes public override void SongSelected(int SongID) { - EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; CBase.Game.Reset(); @@ -503,30 +501,30 @@ namespace Vocaluxe.PartyModes switch (GameData.NumPlayerAtOnce) { case 1: - _ScreenSongOptions.Selection.NumJokers = new int[] { 10 }; + _ScreenSongOptions.Selection.NumJokers = new int[] {10}; break; case 2: - _ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 }; + _ScreenSongOptions.Selection.NumJokers = new int[] {5, 5}; break; case 3: - _ScreenSongOptions.Selection.NumJokers = new int[] { 4, 4, 4 }; + _ScreenSongOptions.Selection.NumJokers = new int[] {4, 4, 4}; break; case 4: - _ScreenSongOptions.Selection.NumJokers = new int[] { 3, 3, 3, 3 }; + _ScreenSongOptions.Selection.NumJokers = new int[] {3, 3, 3, 3}; break; case 5: - _ScreenSongOptions.Selection.NumJokers = new int[] { 2, 2, 2, 2, 2 }; + _ScreenSongOptions.Selection.NumJokers = new int[] {2, 2, 2, 2, 2}; break; case 6: - _ScreenSongOptions.Selection.NumJokers = new int[] { 2, 2, 2, 2, 2, 2 }; + _ScreenSongOptions.Selection.NumJokers = new int[] {2, 2, 2, 2, 2, 2}; break; default: - _ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 }; + _ScreenSongOptions.Selection.NumJokers = new int[] {5, 5}; break; } } @@ -537,16 +535,16 @@ namespace Vocaluxe.PartyModes if (profiles == null) { - _ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" }; + _ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"}; return; } if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce) { - _ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" }; + _ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"}; return; } - + _ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce]; Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); @@ -580,13 +578,11 @@ namespace Vocaluxe.PartyModes GameData.ResultTable.Add(row); } - GameData.Results = new int[GameData.NumRounds, GameData.NumPlayerAtOnce]; + GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce]; for (int i = 0; i < GameData.NumRounds; i++) { for (int j = 0; j < GameData.NumPlayerAtOnce; j++) - { GameData.Results[i, j] = 0; - } } } else @@ -599,9 +595,7 @@ namespace Vocaluxe.PartyModes return; for (int j = 0; j < GameData.NumPlayerAtOnce; j++) - { GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); - } List points = GetPointsForPlayer(results); @@ -609,13 +603,13 @@ namespace Vocaluxe.PartyModes { int index = -1; for (int j = 0; j < GameData.ResultTable.Count; j++) - { + { if (points[i].ProfileID == GameData.ResultTable[j].PlayerID) { index = j; break; } - } + } if (index != -1) { @@ -638,7 +632,7 @@ namespace Vocaluxe.PartyModes int pos = 1; int lastPoints = 0; int lastSingPoints = 0; - for (int i = 0; i < GameData.ResultTable.Count; i++ ) + for (int i = 0; i < GameData.ResultTable.Count; i++) { if (lastPoints > GameData.ResultTable[i].NumGamePoints || lastSingPoints > GameData.ResultTable[i].NumSingPoints) pos++; @@ -651,7 +645,7 @@ namespace Vocaluxe.PartyModes private List GetPointsForPlayer(SPlayer[] Results) { List result = new List(); - for(int i = 0; i < GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { Stats stat = new Stats(); stat.ProfileID = Results[i].ProfileID; @@ -698,7 +692,6 @@ namespace Vocaluxe.PartyModes } - return result; } @@ -708,11 +701,9 @@ namespace Vocaluxe.PartyModes { GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()]; for (int i = 0; i < GameData.CatSongIndices.Length; i++) - { GameData.CatSongIndices[i] = -1; - } } - + if (CBase.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) GameData.CatSongIndices = null; } diff --git a/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj b/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj index 37fb7251..61103a08 100644 --- a/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj +++ b/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj @@ -8,8 +8,8 @@ {5A4053F1-5AD5-441F-B254-D97A088127B6} Library Properties - PartyModeChallenge - PartyModeChallenge + VocaluxeLib.PartyModes.Challenge + Challenge v2.0 @@ -20,7 +20,7 @@ true full false - ..\..\Output\PartyModes\Challenge\Code + bin TRACE;DEBUG;WIN prompt 4 @@ -30,7 +30,7 @@ AnyCPU none true - ..\..\Output\PartyModes\Challenge\Code + bin prompt 4 false @@ -42,17 +42,18 @@ true full false - ..\..\Output\PartyModes\Challenge\Code + bin TRACE;DEBUG;WIN prompt 4 Off + ..\..\CheckingRules.ruleset AnyCPU none true - ..\..\Output\PartyModes\Challenge\Code + bin prompt 4 false @@ -64,7 +65,7 @@ true full false - ..\..\Output\PartyModes\Challenge\Code + bin TRACE;DEBUG;LINUX prompt 4 @@ -74,7 +75,7 @@ AnyCPU none true - ..\..\Output\PartyModes\Challenge\Code + bin prompt 4 false @@ -86,7 +87,7 @@ true full false - ..\..\Output\PartyModes\Challenge\Code + bin TRACE;DEBUG;LINUX prompt 4 @@ -96,7 +97,7 @@ AnyCPU none true - ..\..\Output\PartyModes\Challenge\Code + bin prompt 4 false @@ -107,21 +108,12 @@ - - Always - - - Always - - - Always - - - Always - - - Always - + + + + + + @@ -137,7 +129,14 @@ + + + + + cd $(SolutionDir)Partymodes\ +xcopy "$(ProjectDir)*.cs" "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\" /EXCLUDE:Excludes.txt /I /Y + Use factory method LoadSong - private CSong() - { - } + private CSong() {} public static CSong LoadSong(string FilePath) { @@ -245,81 +237,73 @@ namespace Vocaluxe.Menu.SongMenu public CSong(CSong song) { - this._CoverTextureSmall = song._CoverTextureSmall; - this._CoverTextureBig = song._CoverTextureBig; + _CoverTextureSmall = song._CoverTextureSmall; + _CoverTextureBig = song._CoverTextureBig; - this.Medley = new SMedley(); - this.Medley.Source = song.Medley.Source; - this.Medley.StartBeat = song.Medley.StartBeat; - this.Medley.EndBeat = song.Medley.EndBeat; - this.Medley.FadeInTime = song.Medley.FadeInTime; - this.Medley.FadeOutTime = song.Medley.FadeOutTime; + Medley = new SMedley(); + Medley.Source = song.Medley.Source; + Medley.StartBeat = song.Medley.StartBeat; + Medley.EndBeat = song.Medley.EndBeat; + Medley.FadeInTime = song.Medley.FadeInTime; + Medley.FadeOutTime = song.Medley.FadeOutTime; - this.CalculateMedley = song.CalculateMedley; - this.PreviewStart = song.PreviewStart; + CalculateMedley = song.CalculateMedley; + PreviewStart = song.PreviewStart; - this.ShortEnd = song.ShortEnd; - this.DuetPart1 = song.DuetPart1; - this.DuetPart2 = song.DuetPart2; + ShortEnd = song.ShortEnd; + DuetPart1 = song.DuetPart1; + DuetPart2 = song.DuetPart2; - this.Encoding = song.Encoding; - this.Folder = song.Folder; - this.FolderName = song.FolderName; - this.FileName = song.FileName; - this.Relative = song.Relative; + Encoding = song.Encoding; + Folder = song.Folder; + FolderName = song.FolderName; + FileName = song.FileName; + Relative = song.Relative; - this.MP3FileName = song.MP3FileName; - this.CoverFileName = song.CoverFileName; - this.BackgroundFileName = song.BackgroundFileName; - this.VideoFileName = song.VideoFileName; + MP3FileName = song.MP3FileName; + CoverFileName = song.CoverFileName; + BackgroundFileName = song.BackgroundFileName; + VideoFileName = song.VideoFileName; - this.VideoAspect = song.VideoAspect; - this._CoverSmallLoaded = song._CoverSmallLoaded; - this._CoverBigLoaded = song._CoverBigLoaded; - this._NotesLoaded = song._NotesLoaded; + VideoAspect = song.VideoAspect; + _CoverSmallLoaded = song._CoverSmallLoaded; + _CoverBigLoaded = song._CoverBigLoaded; + _NotesLoaded = song._NotesLoaded; - this.Artist = song.Artist; - this.Title = song.Title; - - this.Start = song.Start; - this.Finish = song.Finish; + Artist = song.Artist; + Title = song.Title; - this.BPM = song.BPM; - this.Gap = song.Gap; - this.VideoGap = song.VideoGap; + Start = song.Start; + Finish = song.Finish; - this.Comment = new List(); + BPM = song.BPM; + Gap = song.Gap; + VideoGap = song.VideoGap; + + Comment = new List(); foreach (string value in song.Comment) - { - this.Comment.Add(value); - } + Comment.Add(value); - this.ID = song.ID; - this.Visible = song.Visible; - this.CatIndex = song.CatIndex; - this.Selected = song.Selected; + ID = song.ID; + Visible = song.Visible; + CatIndex = song.CatIndex; + Selected = song.Selected; - this.Edition = new List(); + Edition = new List(); foreach (string value in song.Edition) - { - this.Edition.Add(value); - } + Edition.Add(value); - this.Genre = new List(); + Genre = new List(); foreach (string value in song.Genre) - { - this.Genre.Add(value); - } + Genre.Add(value); - this.Year = song.Year; + Year = song.Year; - this.Language = new List(); + Language = new List(); foreach (string value in song.Language) - { - this.Language.Add(value); - } + Language.Add(value); - this.Notes = new CNotes(song.Notes); + Notes = new CNotes(song.Notes); } public string GetMP3() @@ -337,33 +321,32 @@ namespace Vocaluxe.Menu.SongMenu if (!File.Exists(FilePath)) return false; - this.Folder = Path.GetDirectoryName(FilePath); + Folder = Path.GetDirectoryName(FilePath); foreach (string folder in CBase.Config.GetSongFolder()) { - if (this.Folder.Contains(folder)) + if (Folder.Contains(folder)) { - if (this.Folder.Length == folder.Length) - this.FolderName = "Songs"; + if (Folder.Length == folder.Length) + FolderName = "Songs"; else { - this.FolderName = this.Folder.Substring(folder.Length + 1, this.Folder.Length - folder.Length - 1); + FolderName = Folder.Substring(folder.Length + 1, Folder.Length - folder.Length - 1); - int pos = this.FolderName.IndexOf("\\"); + int pos = FolderName.IndexOf("\\"); if (pos >= 0) - this.FolderName = this.FolderName.Substring(0, pos); + FolderName = FolderName.Substring(0, pos); } break; } } - this.FileName = Path.GetFileName(FilePath); + FileName = Path.GetFileName(FilePath); EHeaderFlags HeaderFlags = new EHeaderFlags(); - StreamReader sr; + StreamReader sr = null; try { - sr = new StreamReader(FilePath, Encoding.Default, true); string line; @@ -377,7 +360,8 @@ namespace Vocaluxe.Menu.SongMenu line = sr.ReadLine(); if (line.Length == 0) continue; - if (!line[0].ToString().Equals("#")) break; + if (!line[0].ToString().Equals("#")) + break; pos = line.IndexOf(":"); @@ -391,17 +375,20 @@ namespace Vocaluxe.Menu.SongMenu switch (Identifier) { case "ENCODING": - this.Encoding = CEncoding.GetEncoding(Value); - sr = new StreamReader(FilePath, this.Encoding); + Encoding = CEncoding.GetEncoding(Value); + sr.Dispose(); + sr = null; + sr = new StreamReader(FilePath, Encoding); Identifier = String.Empty; //Scip everything till encoding while (!sr.EndOfStream) { line = sr.ReadLine(); - if (line.Length == 0) + if (line.Length == 0) continue; - if(!line[0].ToString().Equals("#")) break; + if (!line[0].ToString().Equals("#")) + break; pos = line.IndexOf(":"); @@ -414,138 +401,130 @@ namespace Vocaluxe.Menu.SongMenu } break; case "TITLE": - if (Value != String.Empty) + if (Value.Length > 0) { - this.Title = Value; + Title = Value; HeaderFlags |= EHeaderFlags.Title; } break; case "ARTIST": - if (Value != String.Empty) + if (Value.Length > 0) { - this.Artist = Value; + Artist = Value; HeaderFlags |= EHeaderFlags.Artist; } break; case "TITLE-ON-SORTING": - if (Value != String.Empty) - { - this.TitleSorting = Value; - } + if (Value.Length > 0) + TitleSorting = Value; break; case "ARTIST-ON-SORTING": - if (Value != String.Empty) - { - this.ArtistSorting = Value; - } + if (Value.Length > 0) + ArtistSorting = Value; break; case "P1": - if (Value != String.Empty) - { - this.DuetPart1 = Value; - } + if (Value.Length > 0) + DuetPart1 = Value; break; case "P2": - if (Value != String.Empty) - { - this.DuetPart2 = Value; - } + if (Value.Length > 0) + DuetPart2 = Value; break; case "MP3": - if (File.Exists(Path.Combine(this.Folder, Value))) + if (File.Exists(Path.Combine(Folder, Value))) { - this.MP3FileName = Value; + MP3FileName = Value; HeaderFlags |= EHeaderFlags.MP3; } else { - CBase.Log.LogError("Can't find audio file: " + Path.Combine(this.Folder, Value)); + CBase.Log.LogError("Can't find audio file: " + Path.Combine(Folder, Value)); return false; } break; case "BPM": - if (CHelper.TryParse(Value, out this.BPM)) + if (CHelper.TryParse(Value, out BPM)) { - this.BPM *= 4; + BPM *= 4; HeaderFlags |= EHeaderFlags.BPM; } break; case "EDITION": if (Value.Length > 1) - this.Edition.Add(Value); + Edition.Add(Value); break; case "GENRE": if (Value.Length > 1) - this.Genre.Add(Value); + Genre.Add(Value); break; case "YEAR": int num = 0; if (Value.Length == 4 && int.TryParse(Value, out num) && num != 0) - { - this.Year = Value; - } + Year = Value; break; case "LANGUAGE": if (Value.Length > 1) - this.Language.Add(Value); + Language.Add(Value); break; case "COMMENT": if (Value.Length > 1) - this.Comment.Add(Value); + Comment.Add(Value); break; case "GAP": - if (CHelper.TryParse(Value, out this.Gap)) - this.Gap /= 1000f; + if (CHelper.TryParse(Value, out Gap)) + Gap /= 1000f; break; case "COVER": - if (File.Exists(Path.Combine(this.Folder, Value))) - this.CoverFileName = Value; + if (File.Exists(Path.Combine(Folder, Value))) + CoverFileName = Value; break; case "BACKGROUND": - if (File.Exists(Path.Combine(this.Folder, Value))) - this.BackgroundFileName = Value; + if (File.Exists(Path.Combine(Folder, Value))) + BackgroundFileName = Value; break; case "VIDEO": - if (File.Exists(Path.Combine(this.Folder, Value))) - this.VideoFileName = Value; + if (File.Exists(Path.Combine(Folder, Value))) + VideoFileName = Value; else - CBase.Log.LogError("Can't find video file: " + Path.Combine(this.Folder, Value)); + CBase.Log.LogError("Can't find video file: " + Path.Combine(Folder, Value)); break; case "VIDEOGAP": - CHelper.TryParse(Value, out this.VideoGap); + CHelper.TryParse(Value, out VideoGap); break; case "VIDEOASPECT": - CHelper.TryParse(Value, out this.VideoAspect, true); + CHelper.TryParse(Value, out VideoAspect, true); break; case "START": - CHelper.TryParse(Value, out this.Start); + CHelper.TryParse(Value, out Start); break; case "END": - if (CHelper.TryParse(Value, out this.Finish)) - this.Finish /= 1000f; + if (CHelper.TryParse(Value, out Finish)) + Finish /= 1000f; break; case "PREVIEWSTART": - if (CHelper.TryParse(Value, out this.PreviewStart)) - if (this.PreviewStart < 0f) - this.PreviewStart = 0f; + if (CHelper.TryParse(Value, out PreviewStart)) + { + if (PreviewStart < 0f) + PreviewStart = 0f; else HeaderFlags |= EHeaderFlags.PreviewStart; + } break; case "MEDLEYSTARTBEAT": - if (int.TryParse(Value, out this.Medley.StartBeat)) + if (int.TryParse(Value, out Medley.StartBeat)) HeaderFlags |= EHeaderFlags.MedleyStartBeat; break; case "MEDLEYENDBEAT": - if (int.TryParse(Value, out this.Medley.EndBeat)) + if (int.TryParse(Value, out Medley.EndBeat)) HeaderFlags |= EHeaderFlags.MedleyEndBeat; break; case "CALCMEDLEY": if (Value.ToUpper() == "OFF") - this.CalculateMedley = false; + CalculateMedley = false; break; case "RELATIVE": if (Value.ToUpper() == "YES" && Value.ToUpper() != "NO") - this.Relative = EOffOn.TR_CONFIG_ON; + Relative = EOffOn.TR_CONFIG_ON; break; } } @@ -586,61 +565,60 @@ namespace Vocaluxe.Menu.SongMenu #region check medley tags if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) { - if (this.Medley.StartBeat > this.Medley.EndBeat) + if (Medley.StartBeat > Medley.EndBeat) { CBase.Log.LogError("MedleyStartBeat is bigger than MedleyEndBeat in file: " + FilePath); HeaderFlags = HeaderFlags - EHeaderFlags.MedleyStartBeat - EHeaderFlags.MedleyEndBeat; } } - if ((HeaderFlags & EHeaderFlags.PreviewStart) == 0 || this.PreviewStart == 0f) + if ((HeaderFlags & EHeaderFlags.PreviewStart) == 0 || PreviewStart == 0f) { //PreviewStart is not set or <=0 if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0) //fallback to MedleyStart - this.PreviewStart = CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM); + PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM); else //else set to 0, it will be set in FindRefrainStart - this.PreviewStart = 0f; + PreviewStart = 0f; } if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) { - this.Medley.Source = EMedleySource.Tag; - this.Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime(); - this.Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime(); + Medley.Source = EMedleySource.Tag; + Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime(); + Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime(); } #endregion check medley tags - this.Encoding = sr.CurrentEncoding; + Encoding = sr.CurrentEncoding; } catch (Exception e) { + if (sr != null) + sr.Dispose(); CBase.Log.LogError("Error reading txt header in file \"" + FilePath + "\": " + e.Message); return false; } - + sr.Dispose(); CheckFiles(); //Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag. - if (this.ArtistSorting == String.Empty) - { - this.ArtistSorting = this.Artist; - } + if (ArtistSorting.Length == 0) + ArtistSorting = Artist; - if (this.TitleSorting == String.Empty) - { - this.TitleSorting = this.Title; - } + if (TitleSorting.Length == 0) + TitleSorting = Title; return true; } public bool ReadNotes() { - return ReadNotes(Path.Combine(this.Folder, this.FileName)); + return ReadNotes(Path.Combine(Folder, FileName)); } - public bool ReadNotes(string FilePath, bool forceReload=false) + + public bool ReadNotes(string FilePath, bool forceReload = false) { //Skip loading if already done and no reload is forced if (_NotesLoaded && !forceReload) @@ -664,22 +642,21 @@ namespace Vocaluxe.Menu.SongMenu int Player = 0; int FileLineNo = 0; - StreamReader sr; + StreamReader sr = null; try { + sr = new StreamReader(FilePath, Encoding, true); - sr = new StreamReader(FilePath, this.Encoding, true); - - this.Notes.Reset(); + Notes.Reset(); //Search for Note Beginning - while(!sr.EndOfStream) + while (!sr.EndOfStream) { line = sr.ReadLine(); FileLineNo++; TempC = (char)sr.Peek(); - if ((TempC == '#') || (TempC == '\r') || (TempC == '\n')) + if ((TempC == '#') || (TempC == '\r') || (TempC == '\n')) continue; if ((TempC == ':') || (TempC == 'F') || (TempC == '*') || (TempC == 'P')) { @@ -696,12 +673,11 @@ namespace Vocaluxe.Menu.SongMenu do { - char chr; switch (TempC) { case 'P': - while ((chr = (char)sr.Read()) == ' ') { } + while ((chr = (char)sr.Read()) == ' ') {} int.TryParse(chr.ToString(), out Param1); if (Param1 == 1) @@ -741,7 +717,7 @@ namespace Vocaluxe.Menu.SongMenu else NoteType = ENoteType.Normal; - if (this.Relative == EOffOn.TR_CONFIG_ON) + if (Relative == EOffOn.TR_CONFIG_ON) Param1 += currentPos; if (Player != 2) @@ -764,7 +740,7 @@ namespace Vocaluxe.Menu.SongMenu sr.Read(); Param1 = CHelper.TryReadInt(sr); - if (this.Relative == EOffOn.TR_CONFIG_ON) + if (Relative == EOffOn.TR_CONFIG_ON) { Param1 += currentPos; sr.Read(); @@ -796,22 +772,23 @@ namespace Vocaluxe.Menu.SongMenu } while (!sr.EndOfStream && (c == 19 || c == 16 || c == 13 || c == 10)); TempC = (char)c; FileLineNo++; - }while(!sr.EndOfStream && (TempC != 'E')); + } while (!sr.EndOfStream && (TempC != 'E')); - foreach(CLines lines in this.Notes.Lines) - { + foreach (CLines lines in Notes.Lines) lines.UpdateTimings(); - } } catch (Exception e) { CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath); + if (sr != null) + sr.Dispose(); return false; } + sr.Dispose(); FindRefrain(); FindShortEnd(); _NotesLoaded = true; - if(IsDuet) + if (IsDuet) CheckDuet(); return true; } @@ -819,7 +796,7 @@ namespace Vocaluxe.Menu.SongMenu private bool ParseNote(int Player, ENoteType NoteType, int Start, int Length, int Tone, string Text) { CNote note = new CNote(Start, Length, Tone, Text, NoteType); - CLines lines = this.Notes.GetLines(Player); + CLines lines = Notes.GetLines(Player); return lines.AddNote(note); } @@ -828,16 +805,16 @@ namespace Vocaluxe.Menu.SongMenu CLines lines = Notes.GetLines(Player); CLine line = new CLine(); line.StartBeat = Start; - lines.AddLine(line); + lines.AddLine(line); } public void LoadSmallCover() { if (_CoverSmallLoaded) return; - if (this.CoverFileName != String.Empty) + if (CoverFileName.Length > 0) { - if (!CBase.DataBase.GetCover(Path.Combine(this.Folder, this.CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize())) + if (!CBase.DataBase.GetCover(Path.Combine(Folder, CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize())) _CoverTextureSmall = CBase.Cover.GetNoCover(); } else @@ -848,44 +825,42 @@ namespace Vocaluxe.Menu.SongMenu private void CheckFiles() { - if(this.CoverFileName == String.Empty){ - List files = CHelper.ListFiles(this.Folder, "*.jpg", false); - files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false)); - foreach(String file in files) + if (CoverFileName.Length == 0) + { + List files = CHelper.ListFiles(Folder, "*.jpg", false); + files.AddRange(CHelper.ListFiles(Folder, "*.png", false)); + foreach (String file in files) { - if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) && (Regex.IsMatch(file, @"" + Regex.Escape(this.Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(this.Artist), RegexOptions.IgnoreCase))) - { - this.CoverFileName = file; - } + if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) && + (Regex.IsMatch(file, @"" + Regex.Escape(Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(Artist), RegexOptions.IgnoreCase))) + CoverFileName = file; } } - if (this.BackgroundFileName == String.Empty) + if (BackgroundFileName.Length == 0) { - List files = CHelper.ListFiles(this.Folder, "*.jpg", false); - files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false)); + List files = CHelper.ListFiles(Folder, "*.jpg", false); + files.AddRange(CHelper.ListFiles(Folder, "*.png", false)); foreach (String file in files) { - - if (Regex.IsMatch(file, @".[BG].", RegexOptions.IgnoreCase) && (Regex.IsMatch(file, @"" + Regex.Escape(this.Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(this.Artist), RegexOptions.IgnoreCase))) - { - this.BackgroundFileName = file; - } + if (Regex.IsMatch(file, @".[BG].", RegexOptions.IgnoreCase) && + (Regex.IsMatch(file, @"" + Regex.Escape(Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(Artist), RegexOptions.IgnoreCase))) + BackgroundFileName = file; } } } private void CheckDuet() { - if (DuetPart1 == String.Empty) + if (DuetPart1.Length == 0) { DuetPart1 = "Part 1"; - CBase.Log.LogError("Warning: Can't find #P1-tag for duets in \"" + this.Artist + " - " + this.Title + "\"."); + CBase.Log.LogError("Warning: Can't find #P1-tag for duets in \"" + Artist + " - " + Title + "\"."); } - if (DuetPart2 == String.Empty) + if (DuetPart2.Length == 0) { DuetPart2 = "Part 2"; - CBase.Log.LogError("Warning: Can't find #P2-tag for duets in \"" + this.Artist + " - " + this.Title + "\"."); + CBase.Log.LogError("Warning: Can't find #P2-tag for duets in \"" + Artist + " - " + Title + "\"."); } } @@ -898,7 +873,7 @@ namespace Vocaluxe.Menu.SongMenu private List GetSeries() { - CLines lines = this.Notes.GetLines(0); + CLines lines = Notes.GetLines(0); if (lines.LineCount == 0) return null; @@ -919,7 +894,7 @@ namespace Vocaluxe.Menu.SongMenu { for (int j = i + 1; j < lines.LineCount; j++) { - if (sentences[i] == sentences[j] && sentences[i] != String.Empty) + if (sentences[i] == sentences[j] && sentences[i].Length > 0) { Series tempSeries = new Series(); tempSeries.start = i; @@ -933,7 +908,7 @@ namespace Vocaluxe.Menu.SongMenu for (int k = 1; k <= max; k++) { - if (sentences[i + k] == sentences[j + k] && sentences[i + k] != String.Empty) + if (sentences[i + k] == sentences[j + k] && sentences[i + k].Length > 0) tempSeries.end = i + k; else break; @@ -949,16 +924,16 @@ namespace Vocaluxe.Menu.SongMenu private void FindRefrain() { - if (this.IsDuet) + if (IsDuet) { - this.Medley.Source = EMedleySource.None; + Medley.Source = EMedleySource.None; return; } - if (this.Medley.Source == EMedleySource.Tag) + if (Medley.Source == EMedleySource.Tag) return; - if (!this.CalculateMedley) + if (!CalculateMedley) return; List series = GetSeries(); @@ -973,55 +948,56 @@ namespace Vocaluxe.Menu.SongMenu longest = i; } - CLines lines = this.Notes.GetLines(0); + CLines lines = Notes.GetLines(0); // set medley vars if (series.Count > 0 && series[longest].length > CBase.Settings.GetMedleyMinSeriesLength()) { - this.Medley.StartBeat = lines.Line[series[longest].start].FirstNoteBeat; - this.Medley.EndBeat = lines.Line[series[longest].end].LastNoteBeat; + Medley.StartBeat = lines.Line[series[longest].start].FirstNoteBeat; + Medley.EndBeat = lines.Line[series[longest].end].LastNoteBeat; bool foundEnd = false; - + // set end if duration > MedleyMinDuration - if (CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CBase.Settings.GetMedleyMinDuration() > - CBase.Game.GetTimeFromBeats(this.Medley.EndBeat, this.BPM)) + if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() > + CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM)) foundEnd = true; if (!foundEnd) { for (int i = series[longest].start + 1; i < lines.LineCount - 1; i++) { - if (CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CBase.Settings.GetMedleyMinDuration() > - CBase.Game.GetTimeFromBeats(lines.Line[i].LastNoteBeat, this.BPM)) + if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() > + CBase.Game.GetTimeFromBeats(lines.Line[i].LastNoteBeat, BPM)) { foundEnd = true; - this.Medley.EndBeat = lines.Line[i].LastNoteBeat; + Medley.EndBeat = lines.Line[i].LastNoteBeat; } } } if (foundEnd) { - this.Medley.Source = EMedleySource.Calculated; - this.Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime(); - this.Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime(); + Medley.Source = EMedleySource.Calculated; + Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime(); + Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime(); } } - - if (this.PreviewStart == 0f) + + if (PreviewStart == 0f) { - if (this.Medley.Source == EMedleySource.Calculated) - this.PreviewStart = CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM); + if (Medley.Source == EMedleySource.Calculated) + PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM); } } - private void FindShortEnd(){ + private void FindShortEnd() + { List series = GetSeries(); if (series == null) return; - CLines lines = this.Notes.GetLines(0); + CLines lines = Notes.GetLines(0); //Calculate length of singing int stop = (lines.Line[lines.Line.Length - 1].LastNoteBeat - lines.Line[0].FirstNoteBeat) / 2 + lines.Line[0].StartBeat; @@ -1033,12 +1009,12 @@ namespace Vocaluxe.Menu.SongMenu { if (stop < (lines.Line[series[i].start].FirstNoteBeat + ((lines.Line[series[i].end].LastNoteBeat - lines.Line[series[i].start].FirstNoteBeat) / 2))) { - this.ShortEnd = lines.Line[series[i].start-1].LastNote.EndBeat; + ShortEnd = lines.Line[series[i].start - 1].LastNote.EndBeat; return; } else { - this.ShortEnd = lines.Line[series[i].end].LastNote.EndBeat; + ShortEnd = lines.Line[series[i].end].LastNote.EndBeat; return; } } @@ -1049,18 +1025,17 @@ namespace Vocaluxe.Menu.SongMenu { if (lines.Line[i].FirstNoteBeat < stop && lines.Line[i].LastNoteBeat > stop) { - this.ShortEnd = lines.Line[i].LastNoteBeat; + ShortEnd = lines.Line[i].LastNoteBeat; return; } } ShortEnd = stop; - } public object Clone() { - return base.MemberwiseClone(); + return MemberwiseClone(); } } -} +} \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs index 32b2d5fa..9742e62f 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs @@ -1,16 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; +using System.Xml; +using VocaluxeLib.PartyModes; -using Vocaluxe.Menu; -using Vocaluxe.PartyModes; - -namespace Vocaluxe.Menu.SongMenu +namespace VocaluxeLib.Menu.SongMenu { public class CSongMenu : ISongMenu { - private int _PartyModeID; + private readonly int _PartyModeID; private ISongMenu _SongMenu; private ESongMenu _Type; @@ -115,6 +110,11 @@ namespace Vocaluxe.Menu.SongMenu _SongMenu.SetSelectedCategory(CategoryNr); } + public bool EnterCurrentCategory() + { + return _SongMenu.EnterCurrentCategory(); + } + public int GetActualSelection() { return _SongMenu.GetActualSelection(); @@ -154,7 +154,6 @@ namespace Vocaluxe.Menu.SongMenu { _SongMenu.SetSmallView(SmallView); } - #endregion ISongMenu #region IMenuElement @@ -202,30 +201,27 @@ namespace Vocaluxe.Menu.SongMenu private void CreateSongMenu() { if (_SongMenu != null) - { _SongMenu.OnHide(); - } switch (CBase.Config.GetSongMenuType()) { - //case ESongMenu.TR_CONFIG_LIST: - // _SongMenu = new CSongMenuList(); - // break; - - //case ESongMenu.TR_CONFIG_DREIDEL: - // _SongMenu = new CSongMenuDreidel(); - // break; + //case ESongMenu.TR_CONFIG_LIST: + // _SongMenu = new CSongMenuList(); + // break; + //case ESongMenu.TR_CONFIG_DREIDEL: + // _SongMenu = new CSongMenuDreidel(); + // break; case ESongMenu.TR_CONFIG_TILE_BOARD: _SongMenu = new CSongMenuTileBoard(_PartyModeID); break; - //case ESongMenu.TR_CONFIG_BOOK: - // _SongMenu = new CSongMenuBook(); - // break; + //case ESongMenu.TR_CONFIG_BOOK: + // _SongMenu = new CSongMenuBook(); + // break; } _Type = CBase.Config.GetSongMenuType(); } } -} +} \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs index ac8d3dbc..abba0394 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs @@ -1,14 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Vocaluxe.Menu.SongMenu +namespace VocaluxeLib.Menu.SongMenu { class CSongMenuBook : CSongMenuFramework { public CSongMenuBook(int PartyModeID) - : base(PartyModeID) - { - } + : base(PartyModeID) {} } -} +} \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs index 5a031652..27898f75 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace Vocaluxe.Menu.SongMenu +namespace VocaluxeLib.Menu.SongMenu { class CSongMenuDreidel : CSongMenuFramework { @@ -27,11 +21,8 @@ namespace Vocaluxe.Menu.SongMenu return _actualSelection; } */ - public CSongMenuDreidel(int PartyModeID) - : base(PartyModeID) - { - } + : base(PartyModeID) {} public override void Init() { @@ -48,4 +39,4 @@ namespace Vocaluxe.Menu.SongMenu **/ } } -} +} \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 3c8290bf..12f0f348 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -1,18 +1,16 @@ using System; -using System.Diagnostics; using System.Collections.Generic; +using System.Diagnostics; using System.IO; -using System.Text; using System.Xml; +using VocaluxeLib.PartyModes; -using Vocaluxe.PartyModes; - -namespace Vocaluxe.Menu.SongMenu +namespace VocaluxeLib.Menu.SongMenu { struct SThemeSongMenu { public string Name; - + public string CoverBackgroundName; public string CoverBigBackgroundName; public string DuetIconName; @@ -29,47 +27,41 @@ namespace Vocaluxe.Menu.SongMenu public SThemeSongMenuTileBoard songMenuTileBoard; } - struct SThemeSongMenuBook - { - } + struct SThemeSongMenuBook {} - struct SThemeSongMenuDreidel - { - } + struct SThemeSongMenuDreidel {} - struct SThemeSongMenuList - { - } + struct SThemeSongMenuList {} struct SThemeSongMenuTileBoard { /// - /// Number of tiles horizontal + /// Number of tiles horizontal /// public int numW; /// - /// Number of tiles vertical + /// Number of tiles vertical /// public int numH; /// - /// Number of tiles horizontal in small-modus + /// Number of tiles horizontal in small-modus /// public int numWsmall; /// - /// Number of tiles vertical in small-modus + /// Number of tiles vertical in small-modus /// public int numHsmall; /// - /// Space between tiles horizontal + /// Space between tiles horizontal /// public float spaceW; /// - /// Space between tiles vertical + /// Space between tiles vertical /// public float spaceH; @@ -94,9 +86,9 @@ namespace Vocaluxe.Menu.SongMenu protected SThemeSongMenu _Theme; private bool _ThemeLoaded; - private Stopwatch _timer = new Stopwatch(); - private Stopwatch _VideoFadeTimer = new Stopwatch(); - private List _streams = new List(); + private readonly Stopwatch _timer = new Stopwatch(); + private readonly Stopwatch _VideoFadeTimer = new Stopwatch(); + private readonly List _streams = new List(); private int _video = -1; private int _actsong = -1; private int _actsongstream = -1; @@ -118,8 +110,9 @@ namespace Vocaluxe.Menu.SongMenu protected float _MaxVolume = 100f; - protected int _PreviewSelected //for preview only + protected int _PreviewSelected { + //for preview only get { if ((_SelectedInternal != _SelectedPending) && (_timer.ElapsedMilliseconds >= _PendingTime)) @@ -157,7 +150,6 @@ namespace Vocaluxe.Menu.SongMenu _SelectedInternal = _SelectedPending; } } - } protected virtual void SetSelectedNow() @@ -167,8 +159,9 @@ namespace Vocaluxe.Menu.SongMenu _SelectedInternal = _SelectedPending; } - protected int _Locked //the real selected song for singing + protected int _Locked { + //the real selected song for singing get { return _LockedInternal; } set { _LockedInternal = value; } } @@ -208,7 +201,7 @@ namespace Vocaluxe.Menu.SongMenu return _actsong; } - private bool _Selected = false; + private bool _Selected; private bool _Visible = true; public bool IsSelected() @@ -269,9 +262,7 @@ namespace Vocaluxe.Menu.SongMenu _ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", ref _Theme.MedleyTagIcon, String.Empty); if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) - { - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, ref _Color); - } + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out _Color); else { _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R); @@ -311,7 +302,6 @@ namespace Vocaluxe.Menu.SongMenu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallZ", ref _Theme.songMenuTileBoard.TileRectSmall.Z); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallW", ref _Theme.songMenuTileBoard.TileRectSmall.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallH", ref _Theme.songMenuTileBoard.TileRectSmall.H); - #endregion SongMenuTileBoard if (_ThemeLoaded) @@ -350,10 +340,8 @@ namespace Vocaluxe.Menu.SongMenu writer.WriteComment(": Tile color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName != String.Empty) - { + if (_Theme.ColorName.Length > 0) writer.WriteElementString("Color", _Theme.ColorName); - } else { writer.WriteElementString("R", _Color.R.ToString("#0.00")); @@ -408,7 +396,7 @@ namespace Vocaluxe.Menu.SongMenu _Theme.songMenuTileBoard.StaticVideoIcon.SaveTheme(writer); _Theme.songMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer); _Theme.songMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer); - + writer.WriteEndElement(); #endregion SongMenuTileBoard @@ -449,13 +437,11 @@ namespace Vocaluxe.Menu.SongMenu } float time = CBase.Sound.GetPosition(_actsongstream); - + float vtime = 0f; CBase.Video.GetFrame(_video, ref _vidtex, time, ref vtime); if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L) - { - _vidtex.color.A = (_VideoFadeTimer.ElapsedMilliseconds / 3000f); - } + _vidtex.color.A = _VideoFadeTimer.ElapsedMilliseconds / 3000f; else { _vidtex.color.A = 1f; @@ -473,15 +459,13 @@ namespace Vocaluxe.Menu.SongMenu public virtual void OnHide() { foreach (int stream in _streams) - { CBase.Sound.FadeAndStop(stream, 0f, 0.75f); - } _streams.Clear(); CBase.Video.Close(_video); _video = -1; - CBase.Drawing.RemoveTexture(ref _vidtex); + CBase.Drawing.RemoveTexture(ref _vidtex); _timer.Stop(); _timer.Reset(); @@ -506,10 +490,7 @@ namespace Vocaluxe.Menu.SongMenu return; if (_video != -1) - { CBase.Drawing.DrawTexture(_vidtex, new SRectF(0, 0, 1280, 720, 0)); - } - } public virtual void ApplyVolume(float VolumeMax) @@ -517,9 +498,7 @@ namespace Vocaluxe.Menu.SongMenu _MaxVolume = VolumeMax; foreach (int stream in _streams) - { CBase.Sound.SetStreamVolumeMax(stream, _MaxVolume); - } } public virtual bool IsActive() @@ -570,15 +549,13 @@ namespace Vocaluxe.Menu.SongMenu return false; } - public virtual void UnloadTextures() - { - } + public virtual void UnloadTextures() {} public virtual void LoadTextures() { Init(); - if (_Theme.ColorName != String.Empty) + if (_Theme.ColorName.Length > 0) _Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); } @@ -588,6 +565,16 @@ namespace Vocaluxe.Menu.SongMenu LoadTextures(); } + public bool EnterCurrentCategory() + { + if (!_Initialized) + return false; + if (CBase.Songs.GetCurrentCategoryIndex() >= 0 || _PreviewSelected < 0 || _PreviewSelected >= CBase.Songs.GetNumCategories()) + return false; + EnterCategory(_PreviewSelected); + return true; + } + protected virtual void EnterCategory(int Category) { if (!_Initialized) @@ -605,8 +592,8 @@ namespace Vocaluxe.Menu.SongMenu if (!_Initialized) return; - if (CBase.Songs.GetCurrentCategoryIndex() != -1) - Reset(); + if (CBase.Songs.GetCurrentCategoryIndex() == -1) + return; Reset(); CBase.Songs.SetCategory(-1); @@ -622,9 +609,7 @@ namespace Vocaluxe.Menu.SongMenu if (CBase.Songs.GetCurrentCategoryIndex() >= 0 && (CBase.Songs.GetNumVisibleSongs() > 0) && (nr >= 0) && ((_actsong != nr) || (_streams.Count == 0))) { foreach (int stream in _streams) - { CBase.Sound.FadeAndStop(stream, 0f, 1f); - } _streams.Clear(); CBase.Video.Close(_video); @@ -651,8 +636,8 @@ namespace Vocaluxe.Menu.SongMenu CBase.Sound.Fade(_stream, 100f, 3f); _streams.Add(_stream); _actsongstream = _stream; - - if (CBase.Songs.GetVisibleSong(_actsong).VideoFileName != String.Empty && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) + + if (CBase.Songs.GetVisibleSong(_actsong).VideoFileName.Length > 0 && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) { _video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_actsong).Folder, CBase.Songs.GetVisibleSong(_actsong).VideoFileName)); if (_video == -1) @@ -668,9 +653,7 @@ namespace Vocaluxe.Menu.SongMenu protected void Reset() { foreach (int stream in _streams) - { CBase.Sound.FadeAndStop(stream, 0f, 0.75f); - } _streams.Clear(); CBase.Video.Close(_video); @@ -708,4 +691,4 @@ namespace Vocaluxe.Menu.SongMenu } #endregion ThemeEdit } -} +} \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs index 71cd11aa..dca53e30 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs @@ -1,14 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Vocaluxe.Menu.SongMenu +namespace VocaluxeLib.Menu.SongMenu { class CSongMenuList : CSongMenuFramework { public CSongMenuList(int PartyModeID) - : base(PartyModeID) - { - } + : base(PartyModeID) {} } -} +} \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 89a26d3c..39fdcd15 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -1,13 +1,10 @@ using System; using System.Collections.Generic; using System.Drawing; -using System.Text; using System.Windows.Forms; +using VocaluxeLib.PartyModes; -using Vocaluxe.Menu.SongMenu; -using Vocaluxe.PartyModes; - -namespace Vocaluxe.Menu.SongMenu +namespace VocaluxeLib.Menu.SongMenu { class CSongMenuTileBoard : CSongMenuFramework { @@ -26,7 +23,7 @@ namespace Vocaluxe.Menu.SongMenu private CText _Artist; private CText _Title; private CText _SongLength; - + private int _NumW; private int _NumH; @@ -36,16 +33,14 @@ namespace Vocaluxe.Menu.SongMenu private int _TileW; private int _TileH; - private int _Offset = 0; + private int _Offset = -1; private int _actualSelection = -1; - private bool _SmallView = false; + private bool _SmallView; public CSongMenuTileBoard(int PartyModeID) - : base(PartyModeID) - { - } - + : base(PartyModeID) {} + public override int GetActualSelection() { return _actualSelection; @@ -56,7 +51,7 @@ namespace Vocaluxe.Menu.SongMenu base.Init(); _Rect = _Theme.songMenuTileBoard.TileRect; - + _NumW = _Theme.songMenuTileBoard.numW; _NumH = _Theme.songMenuTileBoard.numH; _SpaceW = _Theme.songMenuTileBoard.spaceW; @@ -76,7 +71,7 @@ namespace Vocaluxe.Menu.SongMenu for (int j = 0; j < _NumW; j++) { SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW), - _Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); + _Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect); _Tiles.Add(tile); } @@ -108,22 +103,18 @@ namespace Vocaluxe.Menu.SongMenu _Locked = _PreviewSelected; _actualSelection = _PreviewSelected; for (int i = 0; i < _Tiles.Count; i++) - { _Tiles[i].Selected = _Locked == i + _Offset; - } } } - + public override void OnShow() { if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetCurrentCategoryIndex() == -1) - { EnterCategory(0); - } _actualSelection = -1; _Locked = -1; _PreviewSelected = -1; - UpdateList(0); + UpdateList(0, true); //AfterCategoryChange(); SetSelectedSong(_ActSong); AfterCategoryChange(); @@ -144,7 +135,7 @@ namespace Vocaluxe.Menu.SongMenu _MedleyTagIcon.Visible = false; } - if (CBase.Songs.GetNumVisibleSongs() == 0 && CBase.Songs.GetSearchFilter() != String.Empty) + if (CBase.Songs.GetNumVisibleSongs() == 0 && CBase.Songs.GetSearchFilter().Length > 0) { _CoverBig.Texture = _CoverBigTexture; _Artist.Text = String.Empty; @@ -163,15 +154,11 @@ namespace Vocaluxe.Menu.SongMenu { base.HandleInput(ref KeyEvent, SongOptions); - if (KeyEvent.KeyPressed) - { - // - } - else + if (!KeyEvent.KeyPressed) { if (!(KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down || - KeyEvent.Key == Keys.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter || - KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp)) + KeyEvent.Key == Keys.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter || + KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp)) return; bool sel = false; @@ -183,21 +170,19 @@ namespace Vocaluxe.Menu.SongMenu break; } } - + if ((_Locked == -1 || !sel) && (KeyEvent.Key != Keys.Escape && KeyEvent.Key != Keys.Back && KeyEvent.Key != Keys.PageUp && KeyEvent.Key != Keys.PageDown)) { if (_PreviewSelected > -1) - { _Locked = _PreviewSelected; - } else { _Locked = 0; _actualSelection = 0; _PreviewSelected = 0; SetSelectedNow(); - UpdateList(0); + UpdateList(0, true); } } else @@ -211,9 +196,7 @@ namespace Vocaluxe.Menu.SongMenu KeyEvent.Handled = true; } else if (_actualSelection > -1 && _PreviewSelected >= 0) - { _Locked = _actualSelection; - } break; case Keys.Escape: @@ -231,25 +214,19 @@ namespace Vocaluxe.Menu.SongMenu case Keys.PageUp: if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) - { PrevCategory(); - } break; case Keys.PageDown: if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) - { NextCategory(); - } break; case Keys.Left: if (_Locked > 0 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0)) { _Locked--; - if (CBase.Songs.GetCurrentCategoryIndex() < 0 && _Locked < CBase.Songs.GetNumCategories() - _NumW || - CBase.Songs.GetCurrentCategoryIndex() >= 0 && _Locked < CBase.Songs.GetNumVisibleSongs() - _NumW) - UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); + UpdateList(); } break; @@ -259,18 +236,15 @@ namespace Vocaluxe.Menu.SongMenu if (_Locked < CBase.Songs.GetNumCategories() - 1) { _Locked++; - if (_Locked < CBase.Songs.GetNumCategories() - _NumW) - UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); + UpdateList(); } - } else { if (CBase.Songs.GetCurrentCategoryIndex() != -1 && _Locked < CBase.Songs.GetNumVisibleSongs() - 1 && !SongOptions.Selection.RandomOnly) { _Locked++; - if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW) - UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); + UpdateList(); } } break; @@ -282,10 +256,11 @@ namespace Vocaluxe.Menu.SongMenu break; } - if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0)) + if (_Locked > _NumW - 1 && + (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0)) { _Locked -= _NumW; - UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); + UpdateList(); } break; @@ -301,22 +276,15 @@ namespace Vocaluxe.Menu.SongMenu if (_Locked < CBase.Songs.GetNumCategories() - _NumW) { _Locked += _NumW; - if (_Locked < CBase.Songs.GetNumCategories() - _NumW) - UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); + UpdateList(); } - } - else + else if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly) { - if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly) - { - _Locked += _NumW; - if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW) - UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); - } + _Locked += _NumW; + UpdateList(); } break; - } } @@ -326,11 +294,9 @@ namespace Vocaluxe.Menu.SongMenu _actualSelection = _Locked; for (int i = 0; i < _Tiles.Count; i++) - { _Tiles[i].Selected = _Locked == i + _Offset; - } } - } + } } public override void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions) @@ -362,9 +328,7 @@ namespace Vocaluxe.Menu.SongMenu sel = true; } else - { tile.Selected = false; - } i++; } } @@ -377,24 +341,21 @@ namespace Vocaluxe.Menu.SongMenu if (!sel) _actualSelection = -1; - if ((MouseEvent.RB) && (CBase.Songs.GetNumCategories() > 0) && CBase.Songs.GetCurrentCategoryIndex() >= 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) + if (MouseEvent.RB && (CBase.Songs.GetNumCategories() > 0) && CBase.Songs.GetCurrentCategoryIndex() >= 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && + SongOptions.Selection.CategoryChangeAllowed) { ShowCategories(); MouseEvent.Handled = true; return; } else if (MouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !SongOptions.Selection.PartyMode) - { CBase.Graphics.FadeTo(EScreens.ScreenMain); - } else if (_PreviewSelected != -1 && MouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !SongOptions.Selection.PartyMode) { if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent)) - { _Locked = _PreviewSelected; - } } - else if ((MouseEvent.LB) && (CBase.Songs.GetCurrentCategoryIndex() == -1)) + else if (MouseEvent.LB && (CBase.Songs.GetCurrentCategoryIndex() == -1)) { foreach (CStatic tile in _Tiles) { @@ -407,31 +368,9 @@ namespace Vocaluxe.Menu.SongMenu } } - if (MouseEvent.Wheel > 0) - { - if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)) - { - if (CBase.Songs.GetCurrentCategoryIndex() >= 0 && CBase.Songs.GetNumVisibleSongs() > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1) || - CBase.Songs.GetCurrentCategoryIndex() < 0 && CBase.Songs.GetNumCategories() > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1)) - { - _Offset += _NumW * MouseEvent.Wheel; - UpdateList(_Offset); - } - } - } - - if (MouseEvent.Wheel < 0) - { - if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)) - { - _Offset += _NumW * MouseEvent.Wheel; - if (_Offset < 0) - { - _Offset = 0; - } - UpdateList(_Offset); - } - } + if (MouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, MouseEvent) && + (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)) + UpdateList(_Offset + _NumW * MouseEvent.Wheel); } public override void Draw() @@ -511,11 +450,11 @@ namespace Vocaluxe.Menu.SongMenu CBase.Drawing.DrawTexture(_vidtex, vidRect, _vidtex.color, vidRectBounds, false); CBase.Drawing.DrawTextureReflection(_vidtex, vidRect, _vidtex.color, vidRectBounds, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight); - }else + } + else _CoverBig.Draw(1f, EAspect.Crop); - _Artist.Draw(); _Title.Draw(); _SongLength.Draw(); @@ -523,7 +462,6 @@ namespace Vocaluxe.Menu.SongMenu _VideoIcon.Draw(); _MedleyCalcIcon.Draw(); _MedleyTagIcon.Draw(); - } public override int GetSelectedSong() @@ -541,117 +479,62 @@ namespace Vocaluxe.Menu.SongMenu return new CStatic(_PartyModeID); } + protected void SetSelectedTile(int itemNr) + { + bool sel = false; + foreach (CStatic tile in _Tiles) + { + if (tile.Selected) + { + sel = true; + break; + } + } + + if (_Locked == -1 || !sel) + { + if (_PreviewSelected > -1) + _Locked = _PreviewSelected; + else + { + _Locked = 0; + _actualSelection = 0; + _PreviewSelected = 0; + SetSelectedNow(); + UpdateList(0, true); + } + } + + foreach (CStatic tile in _Tiles) + tile.Selected = false; + + _PreviewSelected = itemNr; + SetSelectedNow(); + _Locked = itemNr; + + UpdateList(true); + + _PreviewSelected = _Locked; + _actualSelection = _Locked; + + if (_Locked - _Offset >= 0) + _Tiles[_Locked - _Offset].Selected = true; + } + public override void SetSelectedSong(int VisibleSongNr) { base.SetSelectedSong(VisibleSongNr); - if (VisibleSongNr < 0) - return; - - if (CBase.Songs.GetNumVisibleSongs() > VisibleSongNr) - { - bool sel = false; - foreach (CStatic tile in _Tiles) - { - if (tile.Selected) - { - sel = true; - break; - } - } - - if (_Locked == -1 || !sel) - { - if (_PreviewSelected > -1) - { - _Locked = _PreviewSelected; - } - else - { - _Locked = 0; - _actualSelection = 0; - _PreviewSelected = 0; - SetSelectedNow(); - UpdateList(0); - } - } - - foreach (CStatic tile in _Tiles) - { - tile.Selected = false; - } - - _PreviewSelected = VisibleSongNr; - SetSelectedNow(); - _Locked = VisibleSongNr; - - UpdateList((VisibleSongNr / _NumW) * _NumW - (_NumW * (_NumH - 2))); - - _PreviewSelected = _Locked; - _actualSelection = _Locked; - - for (int i = 0; i < _Tiles.Count; i++) - { - _Tiles[i].Selected = _Locked == i + _Offset; - } - } - + if (VisibleSongNr >= 0 && VisibleSongNr < CBase.Songs.GetNumVisibleSongs()) + SetSelectedTile(VisibleSongNr); } public override void SetSelectedCategory(int CategoryNr) { base.SetSelectedCategory(CategoryNr); - if (CategoryNr < 0) - return; - - if (CBase.Songs.GetNumCategories() > CategoryNr) - { - bool sel = false; - foreach (CStatic tile in _Tiles) - { - if (tile.Selected) - { - sel = true; - break; - } - } - - if (_Locked == -1 || !sel) - { - if (_PreviewSelected > -1) - { - _Locked = _PreviewSelected; - } - else - { - _Locked = 0; - _actualSelection = 0; - _PreviewSelected = 0; - SetSelectedNow(); - UpdateList(0); - } - } - - foreach (CStatic tile in _Tiles) - { - tile.Selected = false; - } - - _PreviewSelected = CategoryNr; - SetSelectedNow(); - _Locked = CategoryNr; - - UpdateList((CategoryNr / _NumW) * _NumW - (_NumW * (_NumH - 2))); - - _PreviewSelected = _Locked; - _actualSelection = _Locked; - - for (int i = 0; i < _Tiles.Count; i++) - { - _Tiles[i].Selected = _Locked == i + _Offset; - } - } + if (CategoryNr >= 0 && CategoryNr < CBase.Songs.GetNumCategories()) + SetSelectedTile(CategoryNr); } protected override void EnterCategory(int cat) @@ -700,66 +583,53 @@ namespace Vocaluxe.Menu.SongMenu SelectSong(_PreviewSelected); foreach (CStatic tile in _Tiles) - { tile.Selected = false; - } if (_actualSelection >= 0 && _actualSelection < _Tiles.Count) _Tiles[_actualSelection].Selected = true; - + if ((_LastKnownNumSongs == CBase.Songs.GetNumVisibleSongs()) && (_LastKnownCategory == CBase.Songs.GetCurrentCategoryIndex())) return; _LastKnownCategory = CBase.Songs.GetCurrentCategoryIndex(); _LastKnownNumSongs = CBase.Songs.GetNumVisibleSongs(); - UpdateList(0); + UpdateList(0, true); CBase.Songs.UpdateRandomSongList(); } - private void UpdateList(int offset) + private void UpdateList(bool force = false) { - if (CBase.Songs.GetCurrentCategoryIndex() > -1) - { - if (offset >= (CBase.Songs.GetNumVisibleSongs() / _NumW) * _NumW - (_NumW * (_NumH - 1))) - offset = (CBase.Songs.GetNumVisibleSongs() / _NumW) * _NumW - (_NumW * (_NumH - 1)); - } - else - { - if (offset >= (CBase.Songs.GetNumCategories() / _NumW) * _NumW - (_NumW * (_NumH - 1))) - offset = (CBase.Songs.GetNumCategories() / _NumW) * _NumW - (_NumW * (_NumH - 1)); - } + UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)), force); + } + + private void UpdateList(int offset, bool force = false) + { + bool isInCategory = CBase.Songs.GetCurrentCategoryIndex() >= 0; + int itemCount = isInCategory ? CBase.Songs.GetNumVisibleSongs() : CBase.Songs.GetNumCategories(); + + if (offset >= (itemCount / _NumW) * _NumW - (_NumW * (_NumH - 1))) + offset = (itemCount / _NumW) * _NumW - (_NumW * (_NumH - 1)); if (offset < 0) offset = 0; + if (offset == _Offset && !force) + return; + for (int i = 0; i < _Tiles.Count; i++) { - if (CBase.Songs.GetCurrentCategoryIndex() >= 0) + if (itemCount > i + offset) { - if (CBase.Songs.GetNumVisibleSongs() > i + offset) - { + if (isInCategory) _Tiles[i].Texture = CBase.Songs.GetVisibleSong(i + offset).CoverTextureSmall; - _Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f); - } else - { - _Tiles[i].Texture = _CoverTexture; - _Tiles[i].Color = _Color; - } - } - - if (CBase.Songs.GetCurrentCategoryIndex() == -1) - { - if (CBase.Songs.GetNumCategories() > i + offset) - { _Tiles[i].Texture = CBase.Songs.GetCategory(i + offset).CoverTextureSmall; - _Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f); - } - else - { - _Tiles[i].Texture = _CoverTexture; - _Tiles[i].Color = _Color; - } + _Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f); + } + else + { + _Tiles[i].Texture = _CoverTexture; + _Tiles[i].Color = _Color; } } _Offset = offset; @@ -775,56 +645,34 @@ namespace Vocaluxe.Menu.SongMenu { _NumH = _Theme.songMenuTileBoard.numHsmall; _NumW = _Theme.songMenuTileBoard.numWsmall; - - _TileW = (int)((_Theme.songMenuTileBoard.TileRectSmall.W - _SpaceW * (_NumW - 1)) / _NumW); - _TileH = (int)((_Theme.songMenuTileBoard.TileRectSmall.H - _SpaceH * (_NumH - 1)) / _NumH); - - _CoverTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBackgroundName, _PartyModeID); - _CoverBigTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName, _PartyModeID); - - _Tiles = new List(); - for (int i = 0; i < _NumH; i++) - { - for (int j = 0; j < _NumW; j++) - { - SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRectSmall.X + j * (_TileW + _SpaceW), - _Theme.songMenuTileBoard.TileRectSmall.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); - CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect); - _Tiles.Add(tile); - } - } - _Rect = _Theme.songMenuTileBoard.TileRectSmall; - _ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRectSmall.Z); } else { _NumH = _Theme.songMenuTileBoard.numH; _NumW = _Theme.songMenuTileBoard.numW; - - _TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW); - _TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH); - - _CoverTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBackgroundName, _PartyModeID); - _CoverBigTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName, _PartyModeID); - - _Tiles = new List(); - for (int i = 0; i < _NumH; i++) - { - for (int j = 0; j < _NumW; j++) - { - SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW), - _Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); - CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect); - _Tiles.Add(tile); - } - } - _Rect = _Theme.songMenuTileBoard.TileRect; - _ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRect.Z); } - UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2))); + _TileW = (int)((_Rect.W - _SpaceW * (_NumW - 1)) / _NumW); + _TileH = (int)((_Rect.H - _SpaceH * (_NumH - 1)) / _NumH); + + _CoverTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBackgroundName, _PartyModeID); + _CoverBigTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName, _PartyModeID); + + _Tiles = new List(); + for (int i = 0; i < _NumH; i++) + { + for (int j = 0; j < _NumW; j++) + { + SRectF rect = new SRectF(_Rect.X + j * (_TileW + _SpaceW), _Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); + CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect); + _Tiles.Add(tile); + } + } + + _ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Rect.Z); + UpdateList(true); } public override bool IsSmallView() @@ -848,4 +696,4 @@ namespace Vocaluxe.Menu.SongMenu _Theme.songMenuTileBoard.TextSongLength.ReloadTextures(); } } -} +} \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/ISongMenu.cs b/VocaluxeLib/Menu/SongMenu/ISongMenu.cs index e5c3d60f..a08a24e0 100644 --- a/VocaluxeLib/Menu/SongMenu/ISongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/ISongMenu.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; +using VocaluxeLib.PartyModes; -using Vocaluxe.PartyModes; - -namespace Vocaluxe.Menu.SongMenu +namespace VocaluxeLib.Menu.SongMenu { interface ISongMenu : IMenuElement { @@ -29,6 +25,8 @@ namespace Vocaluxe.Menu.SongMenu void SetSelectedCategory(int CategoryNr); int GetActualSelection(); + bool EnterCurrentCategory(); + bool IsSelected(); void SetSelected(bool Selected); @@ -40,4 +38,4 @@ namespace Vocaluxe.Menu.SongMenu SRectF GetRect(); } -} +} \ No newline at end of file diff --git a/VocaluxeLib/PartyModes/CPartyMode.cs b/VocaluxeLib/PartyModes/CPartyMode.cs index b145ee64..e8da0e3e 100644 --- a/VocaluxeLib/PartyModes/CPartyMode.cs +++ b/VocaluxeLib/PartyModes/CPartyMode.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; -using System.Text; +using VocaluxeLib.Menu; -using Vocaluxe.Menu; - -namespace Vocaluxe.PartyModes +namespace VocaluxeLib.PartyModes { public abstract class CPartyMode : IPartyMode { @@ -27,22 +25,16 @@ namespace Vocaluxe.PartyModes return false; } - public void Initialize() - { - } + public void Initialize() {} public void AddScreen(CMenuParty Screen, string ScreenName) { _Screens.Add(ScreenName, Screen); } - public virtual void DataFromScreen(string ScreenName, Object Data) - { - } + public virtual void DataFromScreen(string ScreenName, Object Data) {} - public virtual void UpdateGame() - { - } + public virtual void UpdateGame() {} public virtual CMenuParty GetNextPartyScreen(out EScreens AlternativeScreen) { @@ -65,13 +57,9 @@ namespace Vocaluxe.PartyModes return new ScreenSongOptions(); } - public virtual void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions) - { - } + public virtual void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions) {} - public virtual void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions) - { - } + public virtual void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions) {} public virtual int GetMaxPlayer() { @@ -98,9 +86,7 @@ namespace Vocaluxe.PartyModes return 1; } - public virtual void SetSearchString(string SearchString, bool Visible) - { - } + public virtual void SetSearchString(string SearchString, bool Visible) {} public virtual void JokerUsed(int TeamNr) { @@ -114,9 +100,7 @@ namespace Vocaluxe.PartyModes _ScreenSongOptions.Selection.NumJokers[TeamNr]--; } - public virtual void SongSelected(int SongID) - { - } + public virtual void SongSelected(int SongID) {} public virtual void FinishedSinging() { @@ -134,4 +118,4 @@ namespace Vocaluxe.PartyModes } #endregion Implementation } -} +} \ No newline at end of file diff --git a/VocaluxeLib/PartyModes/CPartyModeNone.cs b/VocaluxeLib/PartyModes/CPartyModeNone.cs index 10d33c7c..50f4003d 100644 --- a/VocaluxeLib/PartyModes/CPartyModeNone.cs +++ b/VocaluxeLib/PartyModes/CPartyModeNone.cs @@ -1,10 +1,7 @@ using System; -using System.Collections.Generic; -using System.Text; +using VocaluxeLib.Menu; -using Vocaluxe.Menu; - -namespace Vocaluxe.PartyModes +namespace VocaluxeLib.PartyModes { public class CPartyModeNone : CPartyMode { @@ -20,7 +17,7 @@ namespace Vocaluxe.PartyModes _ScreenSongOptions.Sorting.SearchString = String.Empty; _ScreenSongOptions.Sorting.SearchActive = false; - _ScreenSongOptions.Sorting.ShowDuetSongs = true; + _ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.All; } public override ScreenSongOptions GetScreenSongOptions() @@ -42,4 +39,4 @@ namespace Vocaluxe.PartyModes _ScreenSongOptions.Sorting.SearchActive = Visible; } } -} +} \ No newline at end of file diff --git a/VocaluxeLib/PartyModes/CScreenPartyDummy.cs b/VocaluxeLib/PartyModes/CScreenPartyDummy.cs index 445a4c3a..88b8dbd5 100644 --- a/VocaluxeLib/PartyModes/CScreenPartyDummy.cs +++ b/VocaluxeLib/PartyModes/CScreenPartyDummy.cs @@ -1,37 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; +using System.Windows.Forms; +using VocaluxeLib.Menu; -using Vocaluxe.Menu; - -namespace Vocaluxe.PartyModes +namespace VocaluxeLib.PartyModes { public class CScreenPartyDummy : CMenuParty { // Version number for theme files. Increment it, if you've changed something on the theme files! - const int ScreenVersion = 1; + protected override int _ScreenVersion + { + get { return 1; } + } private CText Warning; - public CScreenPartyDummy() - { - } - - protected override void Init() - { - base.Init(); - - _ThemeName = "ScreenPartyDummy"; - _ScreenVersion = ScreenVersion; - } - public override void LoadTheme(string XmlPath) { Warning = GetNewText(); Warning.Height = 100f; Warning.X = 150; Warning.Y = 300; - Warning.Fon = "Normal"; + Warning.Font = "Normal"; Warning.Style = EStyle.Normal; Warning.Color = new SColorF(1f, 0f, 0f, 1f); Warning.SColor = new SColorF(1f, 0f, 0f, 1f); @@ -39,33 +26,22 @@ namespace Vocaluxe.PartyModes AddText(Warning); } - public override void ReloadTheme(string XmlPath) + public override void ReloadTheme(string XmlPath) {} + + public override void ReloadTextures() {} + + public override void SaveTheme() {} + + public override void UnloadTextures() {} + + public override bool HandleInput(KeyEvent keyEvent) { - } + base.HandleInput(keyEvent); - public override void ReloadTextures() - { - } - - public override void SaveTheme() - { - } - - public override void UnloadTextures() - { - } - - public override bool HandleInput(KeyEvent KeyEvent) - { - base.HandleInput(KeyEvent); - - if (KeyEvent.KeyPressed) - { - - } + if (keyEvent.KeyPressed) {} else { - switch (KeyEvent.Key) + switch (keyEvent.Key) { case Keys.Back: case Keys.Escape: @@ -76,28 +52,18 @@ namespace Vocaluxe.PartyModes return true; } - public override bool HandleMouse(MouseEvent MouseEvent) + public override bool HandleMouse(MouseEvent mouseEvent) { - base.HandleMouse(MouseEvent); + base.HandleMouse(mouseEvent); - if (MouseEvent.LB && IsMouseOver(MouseEvent)) - { + if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} - } - - if (MouseEvent.RB) - { + if (mouseEvent.RB) FadeTo(EScreens.ScreenParty); - } return true; } - public override void OnShow() - { - base.OnShow(); - } - public override bool UpdateGame() { return true; @@ -108,10 +74,5 @@ namespace Vocaluxe.PartyModes base.Draw(); return true; } - - public override void OnClose() - { - base.OnClose(); - } } -} +} \ No newline at end of file diff --git a/VocaluxeLib/PartyModes/IPartyMode.cs b/VocaluxeLib/PartyModes/IPartyMode.cs index 99c3e532..faa03c8b 100644 --- a/VocaluxeLib/PartyModes/IPartyMode.cs +++ b/VocaluxeLib/PartyModes/IPartyMode.cs @@ -1,11 +1,9 @@ using System; -using System.Collections.Generic; -using System.Text; +using VocaluxeLib.Menu; -using Vocaluxe.Menu; - -namespace Vocaluxe.PartyModes +namespace VocaluxeLib.PartyModes { + #region Structs public struct ScreenSongOptions { @@ -20,46 +18,46 @@ namespace Vocaluxe.PartyModes public EOffOn IgnoreArticles; public string SearchString; public bool SearchActive; - public bool ShowDuetSongs; + public EDuetOptions DuetOptions; } /// - /// Configuration of song selection options + /// Configuration of song selection options /// public struct SelectionOptions { /// - /// If != -1, the SongMenu should set the song selection on the provided song index (visible index) if possible + /// If != -1, the SongMenu should set the song selection on the provided song index (visible index) if possible /// public int SongIndex; /// - /// If true, the SongMenu should perform the select random song method + /// If true, the SongMenu should perform the select random song method /// public bool SelectNextRandomSong; /// - /// Choosing song only by random + /// Choosing song only by random /// public bool RandomOnly; /// - /// If true, it is not allowed to go to MainScreen nor open the playlist nor open the song menu + /// If true, it is not allowed to go to MainScreen nor open the playlist nor open the song menu /// public bool PartyMode; /// - /// If true, it is not alled to change or leave the category. It's only valid if Tabs=On. + /// If true, it is not alled to change or leave the category. It's only valid if Tabs=On. /// public bool CategoryChangeAllowed; /// - /// The number of jokers left for each team + /// The number of jokers left for each team /// public int[] NumJokers; /// - /// The Team Name of the teams (:>) + /// The Team Name of the teams (:>) /// public string[] TeamNames; } @@ -96,4 +94,4 @@ namespace Vocaluxe.PartyModes void LeavingScore(); void LeavingHighscore(); } -} +} \ No newline at end of file diff --git a/VocaluxeLib/Properties/AssemblyInfo.cs b/VocaluxeLib/Properties/AssemblyInfo.cs index 8dd7259c..48dc08f0 100644 --- a/VocaluxeLib/Properties/AssemblyInfo.cs +++ b/VocaluxeLib/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden @@ -33,4 +32,4 @@ using System.Runtime.InteropServices; // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/VocaluxeLib/Settings.StyleCop b/VocaluxeLib/Settings.StyleCop new file mode 100644 index 00000000..72ed49f9 --- /dev/null +++ b/VocaluxeLib/Settings.StyleCop @@ -0,0 +1,809 @@ + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + \ No newline at end of file diff --git a/VocaluxeLib/VocaluxeLib.csproj b/VocaluxeLib/VocaluxeLib.csproj index 7a97fb5d..b66a1afd 100644 --- a/VocaluxeLib/VocaluxeLib.csproj +++ b/VocaluxeLib/VocaluxeLib.csproj @@ -46,6 +46,7 @@ prompt 4 Off + ..\CheckingRules.ruleset AnyCPU @@ -110,6 +111,7 @@ + @@ -121,6 +123,7 @@ + diff --git a/gstreamerhelper/VocaluxeClock.cpp b/gstreamerhelper/VocaluxeClock.cpp index cfe7e677..ba84cfd0 100644 --- a/gstreamerhelper/VocaluxeClock.cpp +++ b/gstreamerhelper/VocaluxeClock.cpp @@ -70,7 +70,7 @@ vocaluxe_clock_get_internal_time (GstClock * clock) _vocaluxeclock = GST_VOCALUXE_CLOCK_CAST (clock); - result = _vocaluxeclock->time * GST_SECOND; + result = (GstClockTime) _vocaluxeclock->time * GST_SECOND; return result; }