From 8c3a50c18f8cd16b380b0ba5cd393f9414e0da78 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Wed, 22 Oct 2014 12:54:33 +0200 Subject: [PATCH] More improvements for objectinteractions Also removes highlight textures and colors --- .../Challenge/Themes/Default/Blue.xml | 6 - .../Screens/PartyScreenChallengeConfig.xml | 6 - .../Screens/PartyScreenChallengeNames.xml | 4 - .../ChallengeMedley/Themes/Default/Blue.xml | 6 - .../PartyScreenChallengeMedleyConfig.xml | 6 - .../PartyScreenChallengeMedleyNames.xml | 4 - .../TicTacToe/Themes/Default/Blue.xml | 6 - .../Screens/PartyScreenTicTacToeConfig.xml | 10 - .../Screens/PartyScreenTicTacToeNames.xml | 4 - Output/RequiredSkinElements.xml | 1 - .../Screens/PopupScreenVolumeControl.xml | 2 - Output/Themes/Ambient/Screens/ScreenNames.xml | 14 - .../Ambient/Screens/ScreenOptionsGame.xml | 12 - .../Ambient/Screens/ScreenOptionsLyrics.xml | 4 - .../Ambient/Screens/ScreenOptionsRecord.xml | 8 - .../Ambient/Screens/ScreenOptionsSound.xml | 10 - .../Ambient/Screens/ScreenOptionsTheme.xml | 16 - .../Ambient/Screens/ScreenOptionsVideo.xml | 12 - Output/Themes/Ambient/Screens/ScreenParty.xml | 2 - .../Themes/Ambient/Screens/ScreenProfiles.xml | 10 - Output/Themes/Ambient/Screens/ScreenSing.xml | 12 +- Output/Themes/Ambient/Screens/ScreenSong.xml | 12 +- Output/Themes/Ambient/Skin Blue.xml | 10 +- Output/Themes/Ambient/Skin Green.xml | 10 +- Output/Themes/Ambient/Skin Red.xml | 10 +- Output/Themes/Ambient/Skin Yellow.xml | 10 +- .../CPartyScreenChallengeMain.cs | 6 +- .../CPartyScreenChallengeMedleyMain.cs | 6 +- .../CPartyScreenTicTacToeMain.cs | 12 +- Vocaluxe/Base/CGraphics.cs | 2 +- Vocaluxe/Screens/CScreenNames.cs | 6 +- Vocaluxe/Screens/CScreenParty.cs | 2 +- Vocaluxe/Screens/CScreenProfiles.cs | 2 +- Vocaluxe/Screens/CScreenSong.cs | 8 +- VocaluxeLib/Enums.cs | 9 + VocaluxeLib/Menu/CMenu.cs | 2 +- VocaluxeLib/Menu/CObjectInteractions.cs | 764 +++++++----------- VocaluxeLib/Menu/CPlaylist.cs | 17 +- VocaluxeLib/Menu/CSelectSlide.cs | 241 +++--- VocaluxeLib/Menu/IMenu.cs | 8 +- 40 files changed, 450 insertions(+), 842 deletions(-) diff --git a/Output/PartyModes/Challenge/Themes/Default/Blue.xml b/Output/PartyModes/Challenge/Themes/Default/Blue.xml index 3ad2ea1b..d4c468d1 100644 --- a/Output/PartyModes/Challenge/Themes/Default/Blue.xml +++ b/Output/PartyModes/Challenge/Themes/Default/Blue.xml @@ -68,12 +68,6 @@ 0,969 0,500 - - 0,675 - 0,890 - 0,969 - 1,000 - 0,675 0,890 diff --git a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml index 15368e88..7fdcd72c 100644 --- a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml +++ b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml @@ -175,7 +175,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 100 @@ -199,7 +198,6 @@ - @@ -219,7 +217,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 160 @@ -243,7 +240,6 @@ - @@ -263,7 +259,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 220 @@ -287,7 +282,6 @@ - diff --git a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeNames.xml b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeNames.xml index 66840942..af1ac70a 100644 --- a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeNames.xml +++ b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeNames.xml @@ -291,7 +291,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 40 100 @@ -315,7 +314,6 @@ - @@ -335,7 +333,6 @@ SelectSlidePlayer SelectSlideArrowLeft SelectSlideArrowRight - SelectSlidePlayer 40 160 @@ -359,7 +356,6 @@ - diff --git a/Output/PartyModes/ChallengeMedley/Themes/Default/Blue.xml b/Output/PartyModes/ChallengeMedley/Themes/Default/Blue.xml index 3ad2ea1b..d4c468d1 100644 --- a/Output/PartyModes/ChallengeMedley/Themes/Default/Blue.xml +++ b/Output/PartyModes/ChallengeMedley/Themes/Default/Blue.xml @@ -68,12 +68,6 @@ 0,969 0,500 - - 0,675 - 0,890 - 0,969 - 1,000 - 0,675 0,890 diff --git a/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyConfig.xml b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyConfig.xml index 773473b7..93fd13f8 100644 --- a/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyConfig.xml +++ b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyConfig.xml @@ -175,7 +175,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 100 @@ -199,7 +198,6 @@ - @@ -219,7 +217,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 160 @@ -243,7 +240,6 @@ - @@ -263,7 +259,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 220 @@ -287,7 +282,6 @@ - diff --git a/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyNames.xml b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyNames.xml index 5c2613d2..bf2e1edc 100644 --- a/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyNames.xml +++ b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyNames.xml @@ -291,7 +291,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 40 100 @@ -315,7 +314,6 @@ - @@ -335,7 +333,6 @@ SelectSlidePlayer SelectSlideArrowLeft SelectSlideArrowRight - SelectSlidePlayer 40 160 @@ -359,7 +356,6 @@ - diff --git a/Output/PartyModes/TicTacToe/Themes/Default/Blue.xml b/Output/PartyModes/TicTacToe/Themes/Default/Blue.xml index 3ad2ea1b..d4c468d1 100644 --- a/Output/PartyModes/TicTacToe/Themes/Default/Blue.xml +++ b/Output/PartyModes/TicTacToe/Themes/Default/Blue.xml @@ -68,12 +68,6 @@ 0,969 0,500 - - 0,675 - 0,890 - 0,969 - 1,000 - 0,675 0,890 diff --git a/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeConfig.xml b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeConfig.xml index 0fb3bf27..57fd1627 100644 --- a/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeConfig.xml +++ b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeConfig.xml @@ -175,7 +175,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 100 @@ -199,7 +198,6 @@ - @@ -219,7 +217,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 160 @@ -243,7 +240,6 @@ - @@ -263,7 +259,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 220 @@ -287,7 +282,6 @@ - @@ -307,7 +301,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 220 @@ -331,7 +324,6 @@ - @@ -351,7 +343,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 280 @@ -375,7 +366,6 @@ - diff --git a/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeNames.xml b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeNames.xml index 9f85db0f..438f1cc9 100644 --- a/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeNames.xml +++ b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeNames.xml @@ -291,7 +291,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 40 100 @@ -315,7 +314,6 @@ - @@ -335,7 +333,6 @@ SelectSlidePlayer SelectSlideArrowLeft SelectSlideArrowRight - SelectSlidePlayer 40 160 @@ -359,7 +356,6 @@ - diff --git a/Output/RequiredSkinElements.xml b/Output/RequiredSkinElements.xml index a13ab56e..bea2e0ac 100644 --- a/Output/RequiredSkinElements.xml +++ b/Output/RequiredSkinElements.xml @@ -35,7 +35,6 @@ ButtonTextColor ButtonTextSColor SelectSlideColor - SelectSlideHColor SelectSlideSColor ArrowColor ArrowSColor diff --git a/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml b/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml index b976ecd5..91768d22 100644 --- a/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml +++ b/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml @@ -47,7 +47,6 @@ Minus Plus - 1090 680 @@ -71,7 +70,6 @@ - diff --git a/Output/Themes/Ambient/Screens/ScreenNames.xml b/Output/Themes/Ambient/Screens/ScreenNames.xml index ec806280..d287a8e8 100644 --- a/Output/Themes/Ambient/Screens/ScreenNames.xml +++ b/Output/Themes/Ambient/Screens/ScreenNames.xml @@ -418,7 +418,6 @@ SelectSlidePlayer SelectSlideArrowLeft SelectSlideArrowRight - SelectSlidePlayer 70 548 @@ -442,7 +441,6 @@ - @@ -462,7 +460,6 @@ Button SelectSlideArrowLeft SelectSlideArrowRight - Button 41 105 @@ -486,7 +483,6 @@ - @@ -506,7 +502,6 @@ Button SelectSlideArrowLeft SelectSlideArrowRight - Button 41 260 @@ -530,7 +525,6 @@ - @@ -550,7 +544,6 @@ Button SelectSlideArrowLeft SelectSlideArrowRight - Button 41 415 @@ -574,7 +567,6 @@ - @@ -594,7 +586,6 @@ Button SelectSlideArrowLeft SelectSlideArrowRight - Button 1152 105 @@ -618,7 +609,6 @@ - @@ -638,7 +628,6 @@ Button SelectSlideArrowLeft SelectSlideArrowRight - Button 1152 260 @@ -662,7 +651,6 @@ - @@ -682,7 +670,6 @@ Button SelectSlideArrowLeft SelectSlideArrowRight - Button 1152 415 @@ -706,7 +693,6 @@ - diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml b/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml index f85bc49b..f86fc47f 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml @@ -292,7 +292,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 100 @@ -316,7 +315,6 @@ - @@ -336,7 +334,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 160 @@ -360,7 +357,6 @@ - @@ -380,7 +376,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 220 @@ -404,7 +399,6 @@ - @@ -424,7 +418,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 280 @@ -448,7 +441,6 @@ - @@ -468,7 +460,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 340 @@ -492,7 +483,6 @@ - @@ -512,7 +502,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 400 @@ -536,7 +525,6 @@ - diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml b/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml index 95568c9c..46d80615 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml @@ -123,7 +123,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 100 @@ -147,7 +146,6 @@ - @@ -167,7 +165,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 160 @@ -191,7 +188,6 @@ - diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml index 16db3e04..1606a069 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml @@ -331,7 +331,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 100 @@ -355,7 +354,6 @@ - @@ -375,7 +373,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 220 @@ -399,7 +396,6 @@ - @@ -419,7 +415,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 280 @@ -443,7 +438,6 @@ - @@ -463,7 +457,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 340 @@ -487,7 +480,6 @@ - diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml index 385ab7d3..4c373577 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml @@ -168,7 +168,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 100 @@ -192,7 +191,6 @@ - @@ -212,7 +210,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 160 @@ -236,7 +233,6 @@ - @@ -256,7 +252,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 220 @@ -280,7 +275,6 @@ - @@ -300,7 +294,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 280 @@ -324,7 +317,6 @@ - @@ -344,7 +336,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 340 @@ -368,7 +359,6 @@ - diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml b/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml index 9f9c586a..f35cea42 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml @@ -309,7 +309,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 100 @@ -333,7 +332,6 @@ - @@ -353,7 +351,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 160 @@ -377,7 +374,6 @@ - @@ -397,7 +393,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 220 @@ -421,7 +416,6 @@ - @@ -441,7 +435,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 280 @@ -465,7 +458,6 @@ - @@ -485,7 +477,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 340 @@ -509,7 +500,6 @@ - @@ -529,7 +519,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 400 @@ -553,7 +542,6 @@ - @@ -573,7 +561,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 460 @@ -597,7 +584,6 @@ - @@ -617,7 +603,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 520 @@ -641,7 +626,6 @@ - diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml index ea795dc0..bc356434 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml @@ -268,7 +268,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 100 @@ -292,7 +291,6 @@ - @@ -312,7 +310,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 160 @@ -336,7 +333,6 @@ - @@ -356,7 +352,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 220 @@ -380,7 +375,6 @@ - @@ -400,7 +394,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 280 @@ -424,7 +417,6 @@ - @@ -444,7 +436,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 340 @@ -468,7 +459,6 @@ - @@ -488,7 +478,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 400 @@ -512,7 +501,6 @@ - diff --git a/Output/Themes/Ambient/Screens/ScreenParty.xml b/Output/Themes/Ambient/Screens/ScreenParty.xml index 427cb65e..183417f6 100644 --- a/Output/Themes/Ambient/Screens/ScreenParty.xml +++ b/Output/Themes/Ambient/Screens/ScreenParty.xml @@ -340,7 +340,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 100 @@ -364,7 +363,6 @@ - diff --git a/Output/Themes/Ambient/Screens/ScreenProfiles.xml b/Output/Themes/Ambient/Screens/ScreenProfiles.xml index 394ba2b9..ee4fcfba 100644 --- a/Output/Themes/Ambient/Screens/ScreenProfiles.xml +++ b/Output/Themes/Ambient/Screens/ScreenProfiles.xml @@ -518,7 +518,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 160 @@ -542,7 +541,6 @@ - @@ -562,7 +560,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 340 @@ -586,7 +583,6 @@ - @@ -606,7 +602,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 400 @@ -630,7 +625,6 @@ - @@ -650,7 +644,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 460 @@ -674,7 +667,6 @@ - @@ -694,7 +686,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 500 520 @@ -718,7 +709,6 @@ - diff --git a/Output/Themes/Ambient/Screens/ScreenSing.xml b/Output/Themes/Ambient/Screens/ScreenSing.xml index 9652b95b..074b2fe2 100644 --- a/Output/Themes/Ambient/Screens/ScreenSing.xml +++ b/Output/Themes/Ambient/Screens/ScreenSing.xml @@ -1741,7 +1741,7 @@ -1 - + @@ -1752,7 +1752,7 @@ -1 - + @@ -1763,7 +1763,7 @@ -1 - + @@ -1774,7 +1774,7 @@ -1 - + @@ -1785,7 +1785,7 @@ -1 - + @@ -1796,7 +1796,7 @@ -1 - + diff --git a/Output/Themes/Ambient/Screens/ScreenSong.xml b/Output/Themes/Ambient/Screens/ScreenSong.xml index 7da931cb..5910114d 100644 --- a/Output/Themes/Ambient/Screens/ScreenSong.xml +++ b/Output/Themes/Ambient/Screens/ScreenSong.xml @@ -960,7 +960,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 40 135 @@ -984,7 +983,6 @@ - @@ -1004,7 +1002,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 40 190 @@ -1028,7 +1025,6 @@ - @@ -1048,7 +1044,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 40 180 @@ -1072,7 +1067,6 @@ - @@ -1092,7 +1086,6 @@ SelectSlide SelectSlideArrowLeft SelectSlideArrowRight - SelectSlide 40 90 @@ -1116,7 +1109,6 @@ - @@ -1360,7 +1352,6 @@ SelectSlideArrowLeft SelectSlideArrowRight - 0 28 @@ -1384,8 +1375,7 @@ - - + diff --git a/Output/Themes/Ambient/Skin Blue.xml b/Output/Themes/Ambient/Skin Blue.xml index acc97dd5..9b8eb95a 100644 --- a/Output/Themes/Ambient/Skin Blue.xml +++ b/Output/Themes/Ambient/Skin Blue.xml @@ -104,12 +104,6 @@ 0,969 0,500 - - 0,675 - 0,890 - 0,969 - 1,000 - 0,675 0,890 @@ -170,12 +164,12 @@ 1,000 0,000 - + 0,000 0,000 1,000 1,000 - + 0,000 0,000 diff --git a/Output/Themes/Ambient/Skin Green.xml b/Output/Themes/Ambient/Skin Green.xml index 746bac00..8f5ec34d 100644 --- a/Output/Themes/Ambient/Skin Green.xml +++ b/Output/Themes/Ambient/Skin Green.xml @@ -98,12 +98,6 @@ 0,674 1,000 - - 0,709 - 0,968 - 0,674 - 1,000 - 0,709 0,968 @@ -164,12 +158,12 @@ 1,000 0,000 - + 0,000 1,000 0,000 1,000 - + 0,000 0,000 diff --git a/Output/Themes/Ambient/Skin Red.xml b/Output/Themes/Ambient/Skin Red.xml index cffb1667..33399368 100644 --- a/Output/Themes/Ambient/Skin Red.xml +++ b/Output/Themes/Ambient/Skin Red.xml @@ -98,12 +98,6 @@ 0,674 1,000 - - 0,968 - 0,674 - 0,674 - 1,000 - 0,968 0,674 @@ -164,12 +158,12 @@ 1,000 0,000 - + 1,000 0,000 0,000 1,000 - + 0,000 0,000 diff --git a/Output/Themes/Ambient/Skin Yellow.xml b/Output/Themes/Ambient/Skin Yellow.xml index 67b8c641..91b0d7b5 100644 --- a/Output/Themes/Ambient/Skin Yellow.xml +++ b/Output/Themes/Ambient/Skin Yellow.xml @@ -98,12 +98,6 @@ 0,674 1,000 - - 0,968 - 0,956 - 0,674 - 1,000 - 0,968 0,956 @@ -164,12 +158,12 @@ 1,000 0,000 - + 1,000 1,000 0,000 1,000 - + 0,000 0,000 diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index 5996fb29..840baaf7 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -291,7 +291,7 @@ namespace VocaluxeLib.PartyModes.Challenge _Buttons[_ButtonNextRound].Visible = true; _Texts[_TextFinishMessage].Visible = false; _Texts[_TextFinishPlayerWin].Visible = false; - _SetInteractionToButton(_Buttons[_ButtonNextRound]); + _SelectElement(_Buttons[_ButtonNextRound]); } else { @@ -299,7 +299,7 @@ namespace VocaluxeLib.PartyModes.Challenge _Texts[_TextFinishMessage].Visible = true; _Texts[_TextFinishPlayerWin].Visible = true; _Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); - _SetInteractionToButton(_Buttons[_ButtonExit]); + _SelectElement(_Buttons[_ButtonExit]); } _ShowPopup(false); @@ -332,7 +332,7 @@ namespace VocaluxeLib.PartyModes.Challenge _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; if (_ExitPopupVisible) - _SetInteractionToButton(_Buttons[_ButtonPopupNo]); + _SelectElement(_Buttons[_ButtonPopupNo]); } private void _Back() diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs index 5ec546d9..1f4e6e22 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs @@ -291,7 +291,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _Buttons[_ButtonNextRound].Visible = true; _Texts[_TextFinishMessage].Visible = false; _Texts[_TextFinishPlayerWin].Visible = false; - _SetInteractionToButton(_Buttons[_ButtonNextRound]); + _SelectElement(_Buttons[_ButtonNextRound]); } else { @@ -299,7 +299,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _Texts[_TextFinishMessage].Visible = true; _Texts[_TextFinishPlayerWin].Visible = true; _Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); - _SetInteractionToButton(_Buttons[_ButtonExit]); + _SelectElement(_Buttons[_ButtonExit]); } _ShowPopup(false); @@ -332,7 +332,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; if (_ExitPopupVisible) - _SetInteractionToButton(_Buttons[_ButtonPopupNo]); + _SelectElement(_Buttons[_ButtonPopupNo]); } private void _Back() diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index caa0e6b9..619e4bab 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -310,13 +310,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe _SelectedField = -1; _Buttons[_ButtonBack].Visible = true; _Buttons[_ButtonExit].Visible = false; - _SetInteractionToButton(_Buttons[_ButtonBack]); + _SelectElement(_Buttons[_ButtonBack]); } else { _Buttons[_ButtonBack].Visible = false; _Buttons[_ButtonExit].Visible = true; - _SetInteractionToButton(_Buttons[_ButtonExit]); + _SelectElement(_Buttons[_ButtonExit]); } _Status = EStatus.FieldChoosing; @@ -358,7 +358,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Texts[_TextFinishMessage].Color = new SColorF(1, 1, 1, 1); _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", PartyModeID); } - _SetInteractionToButton(_Buttons[_ButtonExit]); + _SelectElement(_Buttons[_ButtonExit]); } _ShowPopup(false); @@ -512,7 +512,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Buttons[_ButtonExit].Visible = true; _Buttons[_ButtonBack].Visible = false; - _SetInteractionToButton(_Buttons[_ButtonNextRound]); + _SelectElement(_Buttons[_ButtonNextRound]); } private void _FieldSelectedAgain() @@ -541,7 +541,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Buttons[_ButtonExit].Visible = true; _Buttons[_ButtonBack].Visible = false; - _SetInteractionToButton(_Buttons[_ButtonNextRound]); + _SelectElement(_Buttons[_ButtonNextRound]); } private void _UpdatePlayerInformation() @@ -648,7 +648,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; if (_ExitPopupVisible) - _SetInteractionToButton(_Buttons[_ButtonPopupNo]); + _SelectElement(_Buttons[_ButtonPopupNo]); } private void _Back() diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 6f8b05f5..d35fe9ff 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -585,7 +585,7 @@ namespace Vocaluxe.Base if (keyEvent.ModShift && (keyEvent.Key == Keys.F1)) { CSettings.ProgramState = EProgramState.Normal; - _Screens[(int)_CurrentScreen].NextInteraction(); + _Screens[(int)_CurrentScreen].NextElement(); } else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter)) CConfig.FullScreen = (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) ? EOffOn.TR_CONFIG_OFF : EOffOn.TR_CONFIG_ON; diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index ccd1ce77..06505a17 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -181,7 +181,7 @@ namespace Vocaluxe.Screens _UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID); - _SetInteractionToButton(_Buttons[_ButtonStart]); + _SelectElement(_Buttons[_ButtonStart]); } //Started selecting with 'P' if (_SelectingFast) @@ -248,7 +248,7 @@ namespace Vocaluxe.Screens _SelectingKeyboardActive = false; _SelectingFast = false; _NameSelections[_NameSelection].FastSelection(false, -1); - _SetInteractionToButton(_Buttons[_ButtonStart]); + _SelectElement(_Buttons[_ButtonStart]); } break; } @@ -557,7 +557,7 @@ namespace Vocaluxe.Screens _NameSelections[_NameSelection].Init(); _LoadProfiles(); - _SetInteractionToButton(_Buttons[_ButtonStart]); + _SelectElement(_Buttons[_ButtonStart]); } public override void OnClose() diff --git a/Vocaluxe/Screens/CScreenParty.cs b/Vocaluxe/Screens/CScreenParty.cs index 2d0e7540..5542b3fe 100644 --- a/Vocaluxe/Screens/CScreenParty.cs +++ b/Vocaluxe/Screens/CScreenParty.cs @@ -119,7 +119,7 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideModes].Selection = 0; _UpdateSelection(); - _SetInteractionToSelectSlide(_SelectSlides[_SelectSlideModes]); + _SelectElement(_SelectSlides[_SelectSlideModes]); } public override bool UpdateGame() diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index b77d19bf..de24e17e 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -386,7 +386,7 @@ namespace Vocaluxe.Screens CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, _SelectSlides[_SelectSlideAvatars].ValueIndex); - _SetInteractionToButton(_Buttons[_ButtonPlayerName]); + _SelectElement(_Buttons[_ButtonPlayerName]); _EditMode = EEditMode.PlayerName; } diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 2b11c721..2adf26e8 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -1209,7 +1209,7 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true; _Buttons[_ButtonOptionsSing].Visible = true; _Buttons[_ButtonOptionsPlaylist].Visible = true; - _SetInteractionToButton(_Buttons[_ButtonOptionsSing]); + _SelectElement(_Buttons[_ButtonOptionsSing]); _SetSelectSlidePlaylistToCurrentPlaylist(); } @@ -1232,9 +1232,9 @@ namespace Vocaluxe.Screens // ReSharper disable ConvertIfStatementToConditionalTernaryExpression if (_Buttons[_ButtonOptionsRandom].Visible) // ReSharper restore ConvertIfStatementToConditionalTernaryExpression - _SetInteractionToButton(_Buttons[_ButtonOptionsRandom]); + _SelectElement(_Buttons[_ButtonOptionsRandom]); else - _SetInteractionToButton(_Buttons[_ButtonOptionsRandomCategory]); + _SelectElement(_Buttons[_ButtonOptionsRandomCategory]); } private void _ShowSongOptionsMedley() @@ -1256,7 +1256,7 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(4); else _SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues - 1); - _SetInteractionToButton(_Buttons[_ButtonOptionsStartMedley]); + _SelectElement(_Buttons[_ButtonOptionsStartMedley]); } #region Playlist Actions diff --git a/VocaluxeLib/Enums.cs b/VocaluxeLib/Enums.cs index 5a7b4005..f517245d 100644 --- a/VocaluxeLib/Enums.cs +++ b/VocaluxeLib/Enums.cs @@ -19,6 +19,13 @@ using System; namespace VocaluxeLib { + public enum EDirection + { + Up = 0, + Right = 1, + Down = 2, + Left = 3 + } #region Inputs [Flags] @@ -259,9 +266,11 @@ namespace VocaluxeLib public enum EBackgroundMusicOffOn { + // ReSharper disable InconsistentNaming TR_CONFIG_OFF, TR_CONFIG_ONLY_SONG, TR_CONFIG_ON + // ReSharper restore InconsistentNaming } public enum EPlayerInfo diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index 09988e96..93899630 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -550,12 +550,12 @@ namespace VocaluxeLib.Menu public virtual void OnShow() { _ResumeBG(); + _Active = true; } public virtual void OnShowFinish() { _ResumeBG(); - _Active = true; } public virtual void OnClose() diff --git a/VocaluxeLib/Menu/CObjectInteractions.cs b/VocaluxeLib/Menu/CObjectInteractions.cs index a09e4482..4e9cd3d1 100644 --- a/VocaluxeLib/Menu/CObjectInteractions.cs +++ b/VocaluxeLib/Menu/CObjectInteractions.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; using System.Windows.Forms; using VocaluxeLib.Menu.SingNotes; @@ -26,11 +27,10 @@ namespace VocaluxeLib.Menu { public abstract class CObjectInteractions { - private readonly List _Interactions = new List(); + private readonly List _Elements = new List(); private int _Selection; - private int _PrevMouseX; - private int _PrevMouseY; + private Point _PrevMouse; protected bool _Active; @@ -66,17 +66,13 @@ namespace VocaluxeLib.Menu public virtual void Init() { _Selection = 0; - - _PrevMouseX = 0; - _PrevMouseY = 0; - - + _PrevMouse = new Point(0, 0); _Active = false; } protected virtual void _ClearElements() { - _Interactions.Clear(); + _Elements.Clear(); _Backgrounds.Clear(); _Buttons.Clear(); _Texts.Clear(); @@ -91,6 +87,17 @@ namespace VocaluxeLib.Menu _ParticleEffects.Clear(); } + private void _SetSelected(int newSelection) + { + IMenuElement el = _GetElement(_Selection); + if (el != null) + el.Selected = false; + _Selection = newSelection; + el = _GetElement(_Selection); + if (el != null) + el.Selected = true; + } + #region MenuHandler public virtual bool HandleInput(SKeyEvent keyEvent) { @@ -98,38 +105,38 @@ namespace VocaluxeLib.Menu { if (keyEvent.Key == Keys.Left) { - if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.SelectSlide && keyEvent.Mod != EModifier.Shift) - keyEvent.Handled = _PrevElement(); + if (_IsSelectionValid() && _Elements[_Selection].Type == EType.SelectSlide && keyEvent.Mod != EModifier.Shift) + keyEvent.Handled = PrevValue(); else - keyEvent.Handled = _NextInteraction(keyEvent); + keyEvent.Handled = _NextElement(keyEvent); } if (keyEvent.Key == Keys.Right) { - if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.SelectSlide && keyEvent.Mod != EModifier.Shift) - keyEvent.Handled = _NextElement(); + if (_IsSelectionValid() && _Elements[_Selection].Type == EType.SelectSlide && keyEvent.Mod != EModifier.Shift) + keyEvent.Handled = NextValue(); else - keyEvent.Handled = _NextInteraction(keyEvent); + keyEvent.Handled = _NextElement(keyEvent); } if (keyEvent.Key == Keys.Up || keyEvent.Key == Keys.Down) - keyEvent.Handled = _NextInteraction(keyEvent); + keyEvent.Handled = _NextElement(keyEvent); } else { if (keyEvent.Key == Keys.Tab) { if (keyEvent.Mod == EModifier.Shift) - PrevInteraction(); + PrevElement(); else - NextInteraction(); + NextElement(); } if (keyEvent.Key == Keys.Left) - _PrevElement(); + PrevValue(); if (keyEvent.Key == Keys.Right) - _NextElement(); + NextValue(); } return true; @@ -137,127 +144,93 @@ namespace VocaluxeLib.Menu public virtual bool HandleMouse(SMouseEvent mouseEvent) { - int selection = _Selection; ProcessMouseMove(mouseEvent.X, mouseEvent.Y); - if (selection != _Selection) - { - _GetElement(selection).Highlighted = false; - _GetElement(_Selection).Highlighted = true; - } if (mouseEvent.LB) ProcessMouseClick(mouseEvent.X, mouseEvent.Y); - _PrevMouseX = mouseEvent.X; - _PrevMouseY = mouseEvent.Y; + _PrevMouse.X = mouseEvent.X; + _PrevMouse.Y = mouseEvent.Y; return true; } public virtual bool HandleInputThemeEditor(SKeyEvent keyEvent) { - _GetElement(_Selection).Highlighted = false; + int dx = 0; + int dy = 0; if (!keyEvent.KeyPressed) { switch (keyEvent.Key) { case Keys.Up: - if (keyEvent.Mod == EModifier.Ctrl) - _MoveElement(0, -1); - - if (keyEvent.Mod == EModifier.Shift) - _ResizeElement(0, 1); - + dy = -1; break; case Keys.Down: - if (keyEvent.Mod == EModifier.Ctrl) - _MoveElement(0, 1); - - if (keyEvent.Mod == EModifier.Shift) - _ResizeElement(0, -1); - + dy = 1; break; - case Keys.Right: - if (keyEvent.Mod == EModifier.Ctrl) - _MoveElement(1, 0); - - if (keyEvent.Mod == EModifier.Shift) - _ResizeElement(1, 0); - - if (keyEvent.Mod == EModifier.None) - NextInteraction(); + dx = 1; break; case Keys.Left: - if (keyEvent.Mod == EModifier.Ctrl) - _MoveElement(-1, 0); - - if (keyEvent.Mod == EModifier.Shift) - _ResizeElement(-1, 0); - - if (keyEvent.Mod == EModifier.None) - PrevInteraction(); + dx = -1; break; + case Keys.Tab: + _NextElement(keyEvent); + return true; + default: + return false; } } + else + return false; + + if ((keyEvent.Mod & EModifier.Ctrl) != EModifier.Ctrl) + { + dx *= 5; + dy *= 5; + } + + if ((keyEvent.Mod & EModifier.Alt) == EModifier.Alt) + _MoveElement(dx, dy); + else if ((keyEvent.Mod & EModifier.Shift) == EModifier.Shift) + _ResizeElement(dx, dy); + else + { + if (_IsSelectionValid()) + _GetElement(_Selection).Highlighted = false; + if (_NextElement(keyEvent)) + _GetElement(_Selection).Highlighted = true; + } + return true; } public virtual bool HandleMouseThemeEditor(SMouseEvent mouseEvent) { - _GetElement(_Selection).Highlighted = false; - int mouseDX = mouseEvent.X - _PrevMouseX; - int mouseDY = mouseEvent.Y - _PrevMouseY; + if (_IsSelectionValid()) + _GetElement(_Selection).Highlighted = false; - int stepX = 0; - int stepY = 0; - - if ((mouseEvent.Mod & EModifier.Ctrl) == EModifier.Ctrl) + Point mouse = new Point(mouseEvent.X, mouseEvent.Y); + if ((mouseEvent.Mod & EModifier.Ctrl) != EModifier.Ctrl) { - _PrevMouseX = mouseEvent.X; - _PrevMouseY = mouseEvent.Y; + // Clip to raster + mouse.X = (int)(Math.Round((double)mouse.X / 5) * 5); + mouse.Y = (int)(Math.Round((double)mouse.Y / 5) * 5); } - else - { - while (Math.Abs(mouseEvent.X - _PrevMouseX) >= 5) - { - if (mouseEvent.X - _PrevMouseX >= 5) - stepX += 5; - if (mouseEvent.X - _PrevMouseX <= -5) - stepX -= 5; + int mouseDX = mouse.X - _PrevMouse.X; + int mouseDY = mouse.Y - _PrevMouse.Y; - _PrevMouseX = mouseEvent.X - (mouseDX - stepX); - } - - while (Math.Abs(mouseEvent.Y - _PrevMouseY) >= 5) - { - if (mouseEvent.Y - _PrevMouseY >= 5) - stepY += 5; - - if (mouseEvent.Y - _PrevMouseY <= -5) - stepY -= 5; - - _PrevMouseY = mouseEvent.Y - (mouseDY - stepY); - } - } + _PrevMouse.X = mouseEvent.X; + _PrevMouse.Y = mouseEvent.Y; if (mouseEvent.LBH) { - //if (IsMouseOver(MouseEvent.X, _PrevMouseY)) - //{ - if (mouseEvent.Mod == EModifier.None) - _MoveElement(stepX, stepY); - - if (mouseEvent.Mod == EModifier.Ctrl) - _MoveElement(mouseDX, mouseDY); - if (mouseEvent.Mod == EModifier.Shift) - _ResizeElement(stepX, stepY); - - if (mouseEvent.Mod == (EModifier.Shift | EModifier.Ctrl)) - _ResizeElement(mouseDX, mouseDY); - //} + _ResizeElement(mouseDX, mouseDX); + else + _MoveElement(mouseDX, mouseDY); } else ProcessMouseMove(mouseEvent.X, mouseEvent.Y); @@ -266,41 +239,46 @@ namespace VocaluxeLib.Menu } #endregion MenuHandler - private IMenuElement _GetElement(CInteraction interaction) + private bool _IsSelectionValid() { - switch (interaction.Type) - { - case EType.Background: - return _Backgrounds[interaction.Num]; - case EType.Button: - return _Buttons[interaction.Num]; - case EType.SelectSlide: - return _SelectSlides[interaction.Num]; - case EType.Text: - return _Texts[interaction.Num]; - case EType.Static: - return _Statics[interaction.Num]; - case EType.SongMenu: - return _SongMenus[interaction.Num]; - case EType.Lyric: - return _Lyrics[interaction.Num]; - case EType.SingNote: - return _SingNotes[interaction.Num]; - case EType.NameSelection: - return _NameSelections[interaction.Num]; - case EType.Equalizer: - return _Equalizers[interaction.Num]; - case EType.Playlist: - return _Playlists[interaction.Num]; - case EType.ParticleEffect: - return _ParticleEffects[interaction.Num]; - } - throw new ArgumentException("Invalid interaction type: " + interaction.Type); + return _Selection >= 0 && _Selection < _Elements.Count; } - private IMenuElement _GetElement(int interaction) + private IMenuElement _GetElement(CInteraction element) { - return (interaction >= 0 && interaction < _Interactions.Count) ? _GetElement(_Interactions[interaction]) : null; + switch (element.Type) + { + case EType.Background: + return _Backgrounds[element.Num]; + case EType.Button: + return _Buttons[element.Num]; + case EType.SelectSlide: + return _SelectSlides[element.Num]; + case EType.Text: + return _Texts[element.Num]; + case EType.Static: + return _Statics[element.Num]; + case EType.SongMenu: + return _SongMenus[element.Num]; + case EType.Lyric: + return _Lyrics[element.Num]; + case EType.SingNote: + return _SingNotes[element.Num]; + case EType.NameSelection: + return _NameSelections[element.Num]; + case EType.Equalizer: + return _Equalizers[element.Num]; + case EType.Playlist: + return _Playlists[element.Num]; + case EType.ParticleEffect: + return _ParticleEffects[element.Num]; + } + throw new ArgumentException("Invalid element type: " + element.Type); + } + + private IMenuElement _GetElement(int element) + { + return (element >= 0 && element < _Elements.Count) ? _GetElement(_Elements[element]) : null; } #region Drawing @@ -308,26 +286,14 @@ namespace VocaluxeLib.Menu { if (!_Active) return; - _DrawBG(); - _DrawFG(); - } - - private void _DrawBG() - { - foreach (CBackground bg in _Backgrounds) - bg.Draw(); - } - - private void _DrawFG() - { - if (_Interactions.Count <= 0) + if (_Elements.Count <= 0) return; var items = new List(); - for (int i = 0; i < _Interactions.Count; i++) + for (int i = 0; i < _Elements.Count; i++) { - if (_IsVisible(i) && _Interactions[i].DrawAsForeground) + if (_IsVisible(i) && _Elements[i].Type != EType.SingNote) { var zs = new SZSort {ID = i, Z = _GetZValue(i)}; items.Add(zs); @@ -341,142 +307,82 @@ namespace VocaluxeLib.Menu items.Sort((s1, s2) => s2.Z.CompareTo(s1.Z)); for (int i = 0; i < items.Count; i++) - _DrawInteraction(items[i].ID); + _GetElement(items[i].ID).Draw(); } #endregion Drawing #region Element-Adding protected void _AddBackground(CBackground bg, String key = null) { - _AddInteraction(_Backgrounds.Add(bg, key), EType.Background); + _AddElement(_Backgrounds.Add(bg, key), EType.Background); } protected void _AddButton(CButton button, String key = null) { - _AddInteraction(_Buttons.Add(button, key), EType.Button); + _AddElement(_Buttons.Add(button, key), EType.Button); } protected void _AddSelectSlide(CSelectSlide slide, String key = null) { - _AddInteraction(_SelectSlides.Add(slide, key), EType.SelectSlide); + _AddElement(_SelectSlides.Add(slide, key), EType.SelectSlide); } protected void _AddStatic(CStatic stat, String key = null) { - _AddInteraction(_Statics.Add(stat, key), EType.Static); + _AddElement(_Statics.Add(stat, key), EType.Static); } protected void _AddText(CText text, String key = null) { - _AddInteraction(_Texts.Add(text, key), EType.Text); + _AddElement(_Texts.Add(text, key), EType.Text); } protected void _AddSongMenu(ISongMenu songmenu, String key = null) { - _AddInteraction(_SongMenus.Add(songmenu, key), EType.SongMenu); + _AddElement(_SongMenus.Add(songmenu, key), EType.SongMenu); } protected void _AddLyric(CLyric lyric, String key = null) { - _AddInteraction(_Lyrics.Add(lyric, key), EType.Lyric); + _AddElement(_Lyrics.Add(lyric, key), EType.Lyric); } protected void _AddSingNote(CSingNotes sn, String key = null) { - _AddInteraction(_SingNotes.Add(sn, key), EType.SingNote); + _AddElement(_SingNotes.Add(sn, key), EType.SingNote); } protected void _AddNameSelection(CNameSelection ns, String key = null) { - _AddInteraction(_NameSelections.Add(ns, key), EType.NameSelection); + _AddElement(_NameSelections.Add(ns, key), EType.NameSelection); } protected void _AddEqualizer(CEqualizer eq, String key = null) { - _AddInteraction(_Equalizers.Add(eq, key), EType.Equalizer); + _AddElement(_Equalizers.Add(eq, key), EType.Equalizer); } protected void _AddPlaylist(CPlaylist pls, String key = null) { - _AddInteraction(_Playlists.Add(pls, key), EType.Playlist); + _AddElement(_Playlists.Add(pls, key), EType.Playlist); } protected void _AddParticleEffect(CParticleEffect pe, String key = null) { - _AddInteraction(_ParticleEffects.Add(pe, key), EType.ParticleEffect); + _AddElement(_ParticleEffects.Add(pe, key), EType.ParticleEffect); } #endregion Element-Adding #region InteractionHandling - public void NextInteraction() + protected void _SelectElement(IMenuElement element) { - if (_Interactions.Count > 0) - _NextInteraction(); - } - - public void PrevInteraction() - { - if (_Interactions.Count > 0) - _PrevInteraction(); - } - - /// - /// Selects the next element in a menu Interaction. - /// - /// True if the next element is selected. False if either there is no next element or the Interaction does not provide such a method. - public bool NextElement() - { - if (_Interactions.Count > 0) - return _NextElement(); - - return false; - } - - /// - /// Selects the previous element in a menu Interaction. - /// - /// True if the previous element is selected. False if either there is no next element or the Interaction does not provide such a method. - public bool PrevElement() - { - if (_Interactions.Count > 0) - return _PrevElement(); - - return false; - } - - protected void _SetInteractionToButton(CButton button) - { - if (!button.Visible) + if (!element.Visible) return; - for (int i = 0; i < _Interactions.Count; i++) + for (int i = 0; i < _Elements.Count; i++) { - if (_Interactions[i].Type != EType.Button) - continue; - if (_Buttons[_Interactions[i].Num] == button) + if (_GetElement(i) == element) { - _GetElement(_Selection).Selected = false; - _GetElement(_Selection).Highlighted = false; - _Selection = i; - _GetElement(_Selection).Selected = true; - return; - } - } - } - - protected void _SetInteractionToSelectSlide(CSelectSlide slide) - { - if (!slide.Visible) - return; - for (int i = 0; i < _Interactions.Count; i++) - { - if (_Interactions[i].Type != EType.SelectSlide) - continue; - if (_SelectSlides[_Interactions[i].Num] == slide) - { - _GetElement(_Selection).Selected = false; - _GetElement(_Selection).Highlighted = false; - _Selection = i; - _GetElement(_Selection).Selected = true; + _SetSelected(i); return; } } @@ -484,13 +390,13 @@ namespace VocaluxeLib.Menu public void ProcessMouseClick(int x, int y) { - if (_Selection >= _Interactions.Count || _Selection < 0) + if (!_IsSelectionValid()) return; - if (_Interactions[_Selection].Type == EType.SelectSlide) + if (_Elements[_Selection].Type == EType.SelectSlide) { - if (_SelectSlides[_Interactions[_Selection].Num].Visible) - _SelectSlides[_Interactions[_Selection].Num].ProcessMouseLBClick(x, y); + if (_SelectSlides[_Elements[_Selection].Num].Visible) + _SelectSlides[_Elements[_Selection].Num].ProcessMouseLBClick(x, y); } } @@ -498,46 +404,40 @@ namespace VocaluxeLib.Menu { _SelectByMouse(x, y); - if (_Selection >= _Interactions.Count || _Selection < 0) + if (!_IsSelectionValid()) return; - if (_Interactions[_Selection].Type == EType.SelectSlide) + if (_Elements[_Selection].Type == EType.SelectSlide) { - if (_SelectSlides[_Interactions[_Selection].Num].Visible) - _SelectSlides[_Interactions[_Selection].Num].ProcessMouseMove(x, y); + if (_SelectSlides[_Elements[_Selection].Num].Visible) + _SelectSlides[_Elements[_Selection].Num].ProcessMouseMove(x, y); } } private void _SelectByMouse(int x, int y) { float z = CBase.Settings.GetZFar(); - for (int i = 0; i < _Interactions.Count; i++) + int element = -1; + for (int i = 0; i < _Elements.Count; i++) { - if ((CBase.Settings.GetProgramState() != EProgramState.EditTheme) && (_Interactions[i].ThemeEditorOnly || !_IsVisible(i) || !_IsSelectable(i))) + if (!_IsSelectable(i)) continue; - if (!_IsMouseOverElement(x, y, _Interactions[i])) + if (!_IsMouseOverElement(x, y, _Elements[i])) continue; - if (_GetZValue(_Interactions[i]) > z) + if (_GetZValue(i) > z) continue; - z = _GetZValue(_Interactions[i]); - _GetElement(_Selection).Selected = false; - _Selection = i; - _GetElement(_Selection).Selected = true; - _Selection = i; + z = _GetZValue(i); + element = i; } + _SetSelected(element); } protected bool _IsMouseOverCurSelection(SMouseEvent mouseEvent) { - return _IsMouseOverCurSelection(mouseEvent.X, mouseEvent.Y); - } - - private bool _IsMouseOverCurSelection(int x, int y) - { - if (_Selection >= _Interactions.Count || _Selection < 0) + if (!_IsSelectionValid()) return false; - return _Interactions.Count > 0 && _IsMouseOverElement(x, y, _Interactions[_Selection]); + return _IsMouseOverElement(mouseEvent.X, mouseEvent.Y, _Elements[_Selection]); } private bool _IsMouseOverElement(int x, int y, CInteraction interact) @@ -553,348 +453,256 @@ namespace VocaluxeLib.Menu return false; } - private float _GetZValue(CInteraction interact) + public void NextElement() { - IMenuElement el = _GetElement(interact); - return el != null ? el.Rect.Z : CBase.Settings.GetZFar(); + int element = _Selection; + for (int i = 0; i < _Elements.Count; i++) + { + element++; + if (element >= _Elements.Count) + element = 0; + if (_IsSelectable(element)) + break; + } + _SetSelected(element); } - private float _GetZValue(int interaction) + public void PrevElement() { - return _GetZValue(_Interactions[interaction]); - } - - private void _NextInteraction() - { - _GetElement(_Selection).Selected = false; - if (CBase.Settings.GetProgramState() != EProgramState.EditTheme) + Debug.Assert(_Selection == 0 || _Selection < _Elements.Count); + int element = _Selection; + for (int i = 0; i < _Elements.Count; i++) { - bool found = false; - int start = _Selection; - do - { - start++; - if (start > _Interactions.Count - 1) - start = 0; - - if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsSelectable(start))) - found = true; - } while (!found); - _Selection = start; + element--; + if (element < 0) + element = _Elements.Count - 1; + if (_IsSelectable(element)) + break; } - else - { - _Selection++; - if (_Selection > _Interactions.Count - 1) - _Selection = 0; - } - _GetElement(_Selection).Selected = true; - } - - private void _PrevInteraction() - { - _GetElement(_Selection).Selected = false; - if (CBase.Settings.GetProgramState() != EProgramState.EditTheme) - { - bool found = false; - int start = _Selection; - do - { - start--; - if (start < 0) - start = _Interactions.Count - 1; - - if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start) && _IsSelectable(start))) - found = true; - } while (!found); - _Selection = start; - } - else - { - _Selection--; - if (_Selection < 0) - _Selection = _Interactions.Count - 1; - } - _GetElement(_Selection).Selected = true; + _SetSelected(element); } /// - /// Selects the next best interaction in a menu. + /// Selects the next best element in a menu. /// /// /// - private bool _NextInteraction(SKeyEvent key) + private bool _NextElement(SKeyEvent key) { - var directions = new SKeyEvent[4]; - var distances = new float[4]; - var stages = new int[4]; - var elements = new int[4]; - - for (int i = 0; i < 4; i++) - directions[i] = new SKeyEvent(); - - directions[0].Key = Keys.Up; - directions[1].Key = Keys.Right; - directions[2].Key = Keys.Down; - directions[3].Key = Keys.Left; - - for (int i = 0; i < 4; i++) - elements[i] = _GetNextElement(directions[i], out distances[i], out stages[i]); - - int element = _Selection; - int stage = int.MaxValue; - int direction = -1; - - int mute = -1; + int element; switch (key.Key) { case Keys.Up: - mute = 2; + element = _GetNextElement(EDirection.Up); break; case Keys.Right: - mute = 3; + element = _GetNextElement(EDirection.Right); break; case Keys.Down: - mute = 0; + element = _GetNextElement(EDirection.Down); break; case Keys.Left: - mute = 1; + element = _GetNextElement(EDirection.Left); break; - } - - for (int i = 0; i < 4; i++) - { - if (i != mute && elements[i] != _Selection && (stages[i] <= stage && directions[i].Key == key.Key)) - { - stage = stages[i]; - element = elements[i]; - direction = i; - } - } - - if (direction != -1) - { - // select the new element - if (directions[direction].Key == key.Key) - { - _GetElement(_Selection).Selected = false; - _GetElement(_Selection).Highlighted = false; - _Selection = element; - _GetElement(_Selection).Selected = true; - _GetElement(_Selection).Highlighted = true; - + case Keys.Tab: + if (key.Mod == EModifier.Shift) + PrevElement(); + else + NextElement(); return true; - } + default: + return false; } - return false; + if (element < 0) + return false; + + // select the new element + _SetSelected(element); + return true; } - private int _GetNextElement(SKeyEvent key, out float distance, out int stage) + private int _GetNextElement(EDirection direction) { - distance = float.MaxValue; - int min = _Selection; - SRectF actualRect = _GetRect(_Selection); - stage = int.MaxValue; + float distance = float.MaxValue; + int min = -1; + SRectF currentRect = _IsSelectionValid() ? _GetRect(_Selection) : new SRectF(_PrevMouse.X, _PrevMouse.Y, 1, 1, 1); - for (int i = 0; i < _Interactions.Count; i++) + for (int i = 0; i < _Elements.Count; i++) { - if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsSelectable(i)) + if (i != _Selection && _IsSelectable(i)) { - SRectF targetRect = _GetRect(i); - float dist = _GetDistanceDirect(key, actualRect, targetRect); + float dist = _GetDistanceDirect(direction, currentRect, _GetRect(i)); if (dist >= 0f && dist < distance) { distance = dist; min = i; - stage = 10; } } } + if (min >= 0) + return min; - if (min == _Selection) + for (int i = 0; i < _Elements.Count; i++) { - for (int i = 0; i < _Interactions.Count; i++) + if (i != _Selection && _IsSelectable(i)) { - if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsSelectable(i)) + float dist = _GetDistance180(direction, currentRect, _GetRect(i)); + if (dist >= 0f && dist < distance) { - SRectF targetRect = _GetRect(i); - float dist = _GetDistance180(key, actualRect, targetRect); - if (dist >= 0f && dist < distance) - { - distance = dist; - min = i; - stage = 20; - } + distance = dist; + min = i; } } } + if (min >= 0) + return min; - if (min == _Selection) + switch (direction) { - switch (key.Key) - { - case Keys.Up: - actualRect = new SRectF(actualRect.X, CBase.Settings.GetRenderH(), 1, 1, actualRect.Z); - break; - case Keys.Down: - actualRect = new SRectF(actualRect.X, 0, 1, 1, actualRect.Z); - break; - case Keys.Left: - actualRect = new SRectF(CBase.Settings.GetRenderW(), actualRect.Y, 1, 1, actualRect.Z); - break; - case Keys.Right: - actualRect = new SRectF(0, actualRect.Y, 1, 1, actualRect.Z); - break; - } + case EDirection.Up: + currentRect = new SRectF(currentRect.X, CBase.Settings.GetRenderH(), 1, 1, currentRect.Z); + break; + case EDirection.Down: + currentRect = new SRectF(currentRect.X, 0, 1, 1, currentRect.Z); + break; + case EDirection.Left: + currentRect = new SRectF(CBase.Settings.GetRenderW(), currentRect.Y, 1, 1, currentRect.Z); + break; + case EDirection.Right: + currentRect = new SRectF(0, currentRect.Y, 1, 1, currentRect.Z); + break; + } - for (int i = 0; i < _Interactions.Count; i++) + for (int i = 0; i < _Elements.Count; i++) + { + if (i != _Selection && _IsSelectable(i)) { - if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsSelectable(i)) + float dist = _GetDistance180(direction, currentRect, _GetRect(i)); + if (dist >= 0f && dist < distance) { - SRectF targetRect = _GetRect(i); - float dist = _GetDistance180(key, actualRect, targetRect); - if (dist >= 0f && dist < distance) - { - distance = dist; - min = i; - stage = 30; - } + distance = dist; + min = i; } } } return min; } - private static float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect) + private static float _GetDistanceDirect(EDirection direction, SRectF current, SRectF other) { - var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); - var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); - - var vector = new PointF(dest.X - source.X, dest.Y - source.Y); - var distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); - bool inDirection = false; - switch (key.Key) + switch (direction) { - case Keys.Up: - if (vector.Y < 0f && (targetRect.X + targetRect.W > actualRect.X && actualRect.X + actualRect.W > targetRect.X)) - inDirection = true; + case EDirection.Up: + case EDirection.Down: + if (!other.X.IsInRange(current.X, current.Right) && !other.Right.IsInRange(current.X, current.Right)) + return float.MaxValue; break; - case Keys.Down: - if (vector.Y > 0f && (targetRect.X + targetRect.W > actualRect.X && actualRect.X + actualRect.W > targetRect.X)) - inDirection = true; - break; - - case Keys.Left: - if (vector.X < 0f && (targetRect.Y + targetRect.H > actualRect.Y && actualRect.Y + actualRect.H > targetRect.Y)) - inDirection = true; - break; - - case Keys.Right: - if (vector.X > 0f && (targetRect.Y + targetRect.H > actualRect.Y && actualRect.Y + actualRect.H > targetRect.Y)) - inDirection = true; + case EDirection.Left: + case EDirection.Right: + if (!other.Y.IsInRange(current.Y, current.Bottom) && !other.Bottom.IsInRange(current.Y, current.Bottom)) + return float.MaxValue; break; } - return !inDirection ? float.MaxValue : distance; + return _GetDistance180(direction, current, other); } - private static float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect) + private static float _GetDistance180(EDirection direction, SRectF current, SRectF other) { - var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); - var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); + var source = new PointF(current.X + current.W / 2f, current.Y + current.H / 2f); + var dest = new PointF(other.X + other.W / 2f, other.Y + other.H / 2f); var vector = new PointF(dest.X - source.X, dest.Y - source.Y); var distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); - bool inDirection = false; - switch (key.Key) + switch (direction) { - case Keys.Up: + case EDirection.Up: if (vector.Y < 0f) - inDirection = true; + return distance; break; - case Keys.Down: + case EDirection.Down: if (vector.Y > 0f) - inDirection = true; + return distance; break; - case Keys.Left: + case EDirection.Left: if (vector.X < 0f) - inDirection = true; + return distance; break; - case Keys.Right: + case EDirection.Right: if (vector.X > 0f) - inDirection = true; + return distance; break; } - return !inDirection ? float.MaxValue : distance; + return float.MaxValue; } /// - /// Selects the next element in a menu interaction. + /// Selects the next value in a menu element. /// - /// True if the next element is selected. False if either there is no next element or the interaction does not provide such a method. - private bool _NextElement() + /// True if the next value is selected. False if either there is no next value or the element does not provide such a method. + public bool NextValue() { - if (_Interactions[_Selection].Type == EType.SelectSlide) - return _SelectSlides[_Interactions[_Selection].Num].NextValue(); + if (_IsSelectionValid() && _Elements[_Selection].Type == EType.SelectSlide) + return _SelectSlides[_Elements[_Selection].Num].SelectNextValue(); return false; } /// - /// Selects the previous element in a menu interaction. + /// Selects the previous value in a menu element. /// /// - /// True if the previous element is selected. False if either there is no previous element or the interaction does not provide such a method. + /// True if the previous value is selected. False if either there is no previous value or the element does not provide such a method. /// - private bool _PrevElement() + public bool PrevValue() { - if (_Interactions[_Selection].Type == EType.SelectSlide) - return _SelectSlides[_Interactions[_Selection].Num].PrevValue(); + if (_IsSelectionValid() && _Elements[_Selection].Type == EType.SelectSlide) + return _SelectSlides[_Elements[_Selection].Num].SelectPrevValue(); return false; } - private bool _IsVisible(int interaction) + private void _AddElement(int num, EType type) { - IMenuElement el = _GetElement(interaction); + _Elements.Add(new CInteraction(num, type)); + if (_IsSelectable(_Selection)) + _SetSelected(_Selection); + else + NextElement(); + } + #endregion InteractionHandling + + #region Element-property getters + private bool _IsVisible(int element) + { + IMenuElement el = _GetElement(element); return el != null && el.Visible; } - private bool _IsSelectable(int interaction) + private bool _IsSelectable(int element) { - IMenuElement el = _GetElement(interaction); - return el != null && el.Selectable; + IMenuElement el = _GetElement(element); + return el != null && (el.Selectable || CBase.Settings.GetProgramState() == EProgramState.EditTheme); } - private SRectF _GetRect(CInteraction interaction) + private SRectF _GetRect(CInteraction element) { - IMenuElement el = _GetElement(interaction); - return el.Rect; + return _GetElement(element).Rect; } - private SRectF _GetRect(int interaction) + private SRectF _GetRect(int element) { - return _GetRect(_Interactions[interaction]); + return _GetRect(_Elements[element]); } - private void _AddInteraction(int num, EType type) + private float _GetZValue(int element) { - _Interactions.Add(new CInteraction(num, type)); - if (!_Interactions[_Selection].ThemeEditorOnly) - _GetElement(_Selection).Selected = true; - else - _NextInteraction(); + return _GetElement(_Elements[element]).Rect.Z; } - - private void _DrawInteraction(int interaction) - { - IMenuElement el = _GetElement(interaction); - el.Draw(); - } - #endregion InteractionHandling + #endregion #region Theme Handling private void _MoveElement(int stepX, int stepY) diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index a6df6bd8..f12a7a63 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -175,7 +175,11 @@ namespace VocaluxeLib.Menu { get { return Visible; } } - public bool Visible { get; set; } + public bool Visible + { + get { return _Active; } + set { _Active = value; } + } public bool Highlighted { get; set; } public bool Selected { @@ -183,7 +187,6 @@ namespace VocaluxeLib.Menu set { _Selected = value; - _Active = value; _CurrentPlaylistElement = _GetSelectedElementNr(); if (!value) @@ -462,7 +465,7 @@ namespace VocaluxeLib.Menu case Keys.Up: if (keyEvent.ModShift) { - _SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide); + _SelectElement(_PlaylistElements[0].SelectSlide); base.HandleInput(keyEvent); _CurrentPlaylistElement = _GetSelectedElementNr(); } @@ -493,7 +496,7 @@ namespace VocaluxeLib.Menu { if (_PlaylistElements[i].SelectSlide.Visible) { - _SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide); + _SelectElement(_PlaylistElements[0].SelectSlide); base.HandleInput(keyEvent); _CurrentPlaylistElement = _GetSelectedElementNr(); } @@ -532,7 +535,7 @@ namespace VocaluxeLib.Menu _CurrentPlaylistElement = _PlaylistElementContents.Count - 1; if (_CurrentPlaylistElement != -1) - _SetInteractionToSelectSlide(_PlaylistElements[_CurrentPlaylistElement].SelectSlide); + _SelectElement(_PlaylistElements[_CurrentPlaylistElement].SelectSlide); break; case Keys.Back: @@ -802,7 +805,7 @@ namespace VocaluxeLib.Menu { hoverSet = true; _CurrentPlaylistElement = i; - _SetInteractionToSelectSlide(_PlaylistElements[_CurrentPlaylistElement].SelectSlide); + _SelectElement(_PlaylistElements[_CurrentPlaylistElement].SelectSlide); ProcessMouseMove(mouseEvent.X, mouseEvent.Y); } @@ -941,7 +944,7 @@ namespace VocaluxeLib.Menu break; case EEditMode.PlaylistName: - _SetInteractionToButton(_ButtonPlaylistName); + _SelectElement(_ButtonPlaylistName); _CurrentPlaylistElement = -1; if (mouseEvent.LB) { diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index cabec751..ecd7ff6b 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -37,15 +37,12 @@ namespace VocaluxeLib.Menu public string SkinArrowLeftSelected; public string SkinArrowRightSelected; - public string SkinHighlighted; - public SRectF Rect; public SRectF RectArrowLeft; public SRectF RectArrowRight; public SThemeColor Color; public SThemeColor SColor; - public SThemeColor HColor; public SThemeColor ArrowColor; public SThemeColor ArrowSColor; @@ -83,20 +80,19 @@ namespace VocaluxeLib.Menu public SRectF RectArrowLeft; public SRectF RectArrowRight; - public SColorF Color; - public SColorF SelColor; - public SColorF HighlightColor; + private SColorF _Color; + private SColorF _SelColor; - public SColorF ColorArrow; - public SColorF SelColorArrow; + private SColorF _ColorArrow; + private SColorF _SelColorArrow; - public SColorF TextColor; - public SColorF SelTextColor; + private SColorF _TextColor; + private SColorF _SelTextColor; - public float TextRelativeX; - public float TextRelativeY; - public float TextH; - public float MaxW; + private float _TextRelativeX; + private float _TextRelativeY; + private float _TextH; + private float _MaxW; public bool Selectable { @@ -193,6 +189,13 @@ namespace VocaluxeLib.Menu } private int _NumVisible = -1; + private CTextureRef _Texture; + private CTextureRef _TextureArrowLeft; + private CTextureRef _TextureArrowRight; + private CTextureRef _SelTexture; + private CTextureRef _SelTextureArrowLeft; + private CTextureRef _SelTextureArrowRight; + public int NumVisible { get { return _NumVisible; } @@ -209,8 +212,8 @@ namespace VocaluxeLib.Menu { _PartyModeID = partyModeID; _ThemeLoaded = false; - TextH = 1f; - MaxW = 0f; + _TextH = 1f; + _MaxW = 0f; _Textures = new List(); _ValueIndexes = new List(); @@ -221,24 +224,7 @@ namespace VocaluxeLib.Menu public CSelectSlide(CSelectSlide slide) { _PartyModeID = slide._PartyModeID; - _Theme = new SThemeSelectSlide - { - SkinArrowLeft = slide._Theme.SkinArrowLeft, - SkinArrowRight = slide._Theme.SkinArrowRight, - Color = slide._Theme.Color, - SColor = slide._Theme.SColor, - HColor = slide._Theme.HColor, - ArrowColor = slide._Theme.ArrowColor, - ArrowSColor = slide._Theme.ArrowSColor, - TextColor = slide._Theme.TextColor, - TextSColor = slide._Theme.TextSColor, - SkinSelected = slide._Theme.SkinSelected, - SkinArrowLeftSelected = slide._Theme.SkinArrowLeftSelected, - SkinArrowRightSelected = slide._Theme.SkinArrowRightSelected, - SkinHighlighted = slide._Theme.SkinHighlighted, - TextFont = slide._Theme.TextFont, - TextStyle = slide._Theme.TextStyle - }; + _Theme = slide._Theme; _ThemeLoaded = false; @@ -246,18 +232,18 @@ namespace VocaluxeLib.Menu RectArrowLeft = slide.RectArrowLeft; RectArrowRight = slide.RectArrowRight; - Color = slide.Color; - SelColor = slide.SelColor; + _Color = slide._Color; + _SelColor = slide._SelColor; - ColorArrow = slide.ColorArrow; - SelColorArrow = slide.SelColorArrow; + _ColorArrow = slide._ColorArrow; + _SelColorArrow = slide._SelColorArrow; - TextColor = slide.TextColor; - SelTextColor = slide.SelTextColor; - TextH = slide.TextH; - TextRelativeX = slide.TextRelativeX; - TextRelativeY = slide.TextRelativeY; - MaxW = slide.MaxW; + _TextColor = slide._TextColor; + _SelTextColor = slide._SelTextColor; + _TextH = slide._TextH; + _TextRelativeX = slide._TextRelativeX; + _TextRelativeY = slide._TextRelativeY; + _MaxW = slide._MaxW; _Textures = new List(slide._Textures); _ValueIndexes = new List(slide._ValueIndexes); @@ -297,8 +283,6 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeftSelected", out _Theme.SkinArrowLeftSelected, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRightSelected", out _Theme.SkinArrowRightSelected, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinHighlighted", out _Theme.SkinHighlighted, String.Empty); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z); @@ -306,33 +290,23 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H); if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty)) - _ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color); + _ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out _Color); else { - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref _Color.G); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref _Color.B); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref _Color.A); } if (xmlReader.GetValue(item + "/SColor", out _Theme.SColor.Name, String.Empty)) - _ThemeLoaded &= _Theme.SColor.Get(_PartyModeID, out SelColor); + _ThemeLoaded &= _Theme.SColor.Get(_PartyModeID, out _SelColor); else { - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref SelColor.G); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref SelColor.B); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref SelColor.A); - } - - if (xmlReader.GetValue(item + "/HColor", out _Theme.HColor.Name, String.Empty)) - _ThemeLoaded &= _Theme.HColor.Get(_PartyModeID, out HighlightColor); - else - { - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/HR", ref HighlightColor.R); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/HG", ref HighlightColor.G); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/HB", ref HighlightColor.B); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/HA", ref HighlightColor.A); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref _SelColor.R); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref _SelColor.G); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref _SelColor.B); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref _SelColor.A); } _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowLeftX", ref RectArrowLeft.X); @@ -348,43 +322,43 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H); if (xmlReader.GetValue(item + "/ArrowColor", out _Theme.ArrowColor.Name, String.Empty)) - _ThemeLoaded &= _Theme.ArrowColor.Get(_PartyModeID, out ColorArrow); + _ThemeLoaded &= _Theme.ArrowColor.Get(_PartyModeID, out _ColorArrow); else { - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowR", ref ColorArrow.R); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowG", ref ColorArrow.G); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowB", ref ColorArrow.B); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowA", ref ColorArrow.A); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowR", ref _ColorArrow.R); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowG", ref _ColorArrow.G); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowB", ref _ColorArrow.B); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowA", ref _ColorArrow.A); } if (xmlReader.GetValue(item + "/ArrowSColor", out _Theme.ArrowSColor.Name, String.Empty)) - _ThemeLoaded &= _Theme.ArrowSColor.Get(_PartyModeID, out SelColorArrow); + _ThemeLoaded &= _Theme.ArrowSColor.Get(_PartyModeID, out _SelColorArrow); else { - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSR", ref SelColorArrow.R); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSG", ref SelColorArrow.G); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSB", ref SelColorArrow.B); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSA", ref SelColorArrow.A); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSR", ref _SelColorArrow.R); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSG", ref _SelColorArrow.G); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSB", ref _SelColorArrow.B); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSA", ref _SelColorArrow.A); } if (xmlReader.GetValue(item + "/TextColor", out _Theme.TextColor.Name, String.Empty)) - _ThemeLoaded &= _Theme.TextColor.Get(_PartyModeID, out TextColor); + _ThemeLoaded &= _Theme.TextColor.Get(_PartyModeID, out _TextColor); else { - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextR", ref TextColor.R); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextG", ref TextColor.G); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextB", ref TextColor.B); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextA", ref TextColor.A); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextR", ref _TextColor.R); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextG", ref _TextColor.G); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextB", ref _TextColor.B); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextA", ref _TextColor.A); } if (xmlReader.GetValue(item + "/TextSColor", out _Theme.TextSColor.Name, String.Empty)) - _ThemeLoaded &= _Theme.TextSColor.Get(_PartyModeID, out SelTextColor); + _ThemeLoaded &= _Theme.TextSColor.Get(_PartyModeID, out _SelTextColor); else { - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSR", ref SelTextColor.R); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSG", ref SelTextColor.G); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSB", ref SelTextColor.B); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSA", ref SelTextColor.A); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSR", ref _SelTextColor.R); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSG", ref _SelTextColor.G); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSB", ref _SelTextColor.B); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSA", ref _SelTextColor.A); } _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextH", ref _Theme.TextH); xmlReader.TryGetFloatValue(item + "/TextRelativeX", ref _Theme.TextRelativeX); @@ -399,15 +373,14 @@ namespace VocaluxeLib.Menu if (_ThemeLoaded) { _Theme.Name = elementName; - _Theme.ArrowColor.Color = ColorArrow; - _Theme.ArrowSColor.Color = SelColorArrow; - _Theme.Color.Color = Color; - _Theme.HColor.Color = HighlightColor; + _Theme.ArrowColor.Color = _ColorArrow; + _Theme.ArrowSColor.Color = _SelColorArrow; + _Theme.Color.Color = _Color; _Theme.RectArrowLeft = RectArrowLeft; _Theme.RectArrowRight = RectArrowRight; - _Theme.SColor.Color = SelColor; - _Theme.TextColor.Color = TextColor; - _Theme.TextSColor.Color = SelTextColor; + _Theme.SColor.Color = _SelColor; + _Theme.TextColor.Color = _TextColor; + _Theme.TextSColor.Color = _SelTextColor; LoadSkin(); } return _ThemeLoaded; @@ -500,7 +473,7 @@ namespace VocaluxeLib.Menu return false; } - public bool NextValue() + public bool SelectNextValue() { if (Selection < _ValueNames.Count - 1) { @@ -510,7 +483,7 @@ namespace VocaluxeLib.Menu return false; } - public bool PrevValue() + public bool SelectPrevValue() { if (Selection > 0) { @@ -520,13 +493,13 @@ namespace VocaluxeLib.Menu return false; } - public void FirstValue() + public void SelectFirstValue() { if (_ValueNames.Count > 0) Selection = 0; } - public void LastValue() + public void SelectLastValue() { if (_ValueNames.Count > 0) Selection = _ValueNames.Count - 1; @@ -573,10 +546,10 @@ namespace VocaluxeLib.Menu ProcessMouseMove(x, y); if (_ArrowLeftSelected) - PrevValue(); + SelectPrevValue(); if (_ArrowRightSelected) - NextValue(); + SelectNextValue(); for (int i = 0; i < _ValueBounds.Count; i++) { @@ -602,47 +575,32 @@ namespace VocaluxeLib.Menu if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme) return; - CTextureRef texture = CBase.Themes.GetSkinTexture(_Theme.Skin, _PartyModeID); - CTextureRef textureArrowLeft = CBase.Themes.GetSkinTexture(_Theme.SkinArrowLeft, _PartyModeID); - CTextureRef textureArrowRight = CBase.Themes.GetSkinTexture(_Theme.SkinArrowRight, _PartyModeID); - - CTextureRef selTexture = CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeID); - CTextureRef selTextureArrowLeft = CBase.Themes.GetSkinTexture(_Theme.SkinArrowLeftSelected, _PartyModeID); - CTextureRef selTextureArrowRight = CBase.Themes.GetSkinTexture(_Theme.SkinArrowRightSelected, _PartyModeID); - - CTextureRef highlightTexture = CBase.Themes.GetSkinTexture(_Theme.SkinHighlighted, _PartyModeID); - if (Selected) - { - if (Highlighted) - CBase.Drawing.DrawTexture(highlightTexture, Rect, HighlightColor); - else - CBase.Drawing.DrawTexture(selTexture, Rect, SelColor); - } + CBase.Drawing.DrawTexture(_SelTexture, Rect, _SelColor); else - CBase.Drawing.DrawTexture(texture, Rect, Color); + CBase.Drawing.DrawTexture(_Texture, Rect, _Color); if (_Selection > 0 || CBase.Settings.GetProgramState() == EProgramState.EditTheme) { if (_ArrowLeftSelected) - CBase.Drawing.DrawTexture(selTextureArrowLeft, RectArrowLeft, SelColorArrow); + CBase.Drawing.DrawTexture(_SelTextureArrowLeft, RectArrowLeft, _SelColorArrow); else - CBase.Drawing.DrawTexture(textureArrowLeft, RectArrowLeft, ColorArrow); + CBase.Drawing.DrawTexture(_TextureArrowLeft, RectArrowLeft, _ColorArrow); } if (_Selection < _ValueNames.Count - 1 || CBase.Settings.GetProgramState() == EProgramState.EditTheme) { if (_ArrowRightSelected) - CBase.Drawing.DrawTexture(selTextureArrowRight, RectArrowRight, SelColorArrow); + CBase.Drawing.DrawTexture(_SelTextureArrowRight, RectArrowRight, _SelColorArrow); else - CBase.Drawing.DrawTexture(textureArrowRight, RectArrowRight, ColorArrow); + CBase.Drawing.DrawTexture(_TextureArrowRight, RectArrowRight, _ColorArrow); } if (_NumVisible < 1 || _ValueNames.Count == 0) return; - float x = Rect.X + (Rect.W - TextRelativeX) * 0.1f; - float dx = (Rect.W - TextRelativeX) * 0.8f / _NumVisible; + float x = Rect.X + (Rect.W - _TextRelativeX) * 0.1f; + float dx = (Rect.W - _TextRelativeX) * 0.8f / _NumVisible; //float y = Rect.Y + (Rect.H - TextH); int offset = _Selection - _NumVisible / 2; @@ -660,7 +618,7 @@ namespace VocaluxeLib.Menu _ValueBounds.Clear(); for (int i = 0; i < numvis; i++) { - var text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, "T", + var text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", _ValuePartyModeIDs[i + offset]); if (_ValueNames[i + offset] != "") @@ -671,17 +629,17 @@ namespace VocaluxeLib.Menu var alpha = new SColorF(1f, 1f, 1f, 0.35f); if (i + offset == _Selection) { - text.Color = SelTextColor; + text.Color = _SelTextColor; alpha = new SColorF(1f, 1f, 1f, 1f); } RectangleF bounds = CBase.Fonts.GetTextBounds(text); - text.X = (x + dx / 2f + dx * i) + TextRelativeX; + text.X = (x + dx / 2f + dx * i) + _TextRelativeX; if (!WithTextures) - text.Y = (int)((Rect.Y + (Rect.H - bounds.Height) / 2) + TextRelativeY); + text.Y = (int)((Rect.Y + (Rect.H - bounds.Height) / 2) + _TextRelativeY); else - text.Y = (int)((Rect.Y + (Rect.H - bounds.Height)) + TextRelativeY); + text.Y = (int)((Rect.Y + (Rect.H - bounds.Height)) + _TextRelativeY); text.Z = Rect.Z; text.Draw(); @@ -707,13 +665,12 @@ namespace VocaluxeLib.Menu public void LoadSkin() { - _Theme.Color.Get(_PartyModeID, out Color); - _Theme.SColor.Get(_PartyModeID, out SelColor); - _Theme.HColor.Get(_PartyModeID, out HighlightColor); - _Theme.ArrowColor.Get(_PartyModeID, out ColorArrow); - _Theme.ArrowSColor.Get(_PartyModeID, out SelColorArrow); - _Theme.TextColor.Get(_PartyModeID, out TextColor); - _Theme.TextSColor.Get(_PartyModeID, out SelTextColor); + _Theme.Color.Get(_PartyModeID, out _Color); + _Theme.SColor.Get(_PartyModeID, out _SelColor); + _Theme.ArrowColor.Get(_PartyModeID, out _ColorArrow); + _Theme.ArrowSColor.Get(_PartyModeID, out _SelColorArrow); + _Theme.TextColor.Get(_PartyModeID, out _TextColor); + _Theme.TextSColor.Get(_PartyModeID, out _SelTextColor); MaxRect = _Theme.Rect; RectArrowLeft = _Theme.RectArrowLeft; @@ -721,10 +678,18 @@ namespace VocaluxeLib.Menu NumVisible = _Theme.NumVisible; - TextH = _Theme.TextH; - TextRelativeX = _Theme.TextRelativeX; - TextRelativeY = _Theme.TextRelativeY; - MaxW = _Theme.TextMaxW; + _TextH = _Theme.TextH; + _TextRelativeX = _Theme.TextRelativeX; + _TextRelativeY = _Theme.TextRelativeY; + _MaxW = _Theme.TextMaxW; + + _Texture = CBase.Themes.GetSkinTexture(_Theme.Skin, _PartyModeID); + _TextureArrowLeft = CBase.Themes.GetSkinTexture(_Theme.SkinArrowLeft, _PartyModeID); + _TextureArrowRight = CBase.Themes.GetSkinTexture(_Theme.SkinArrowRight, _PartyModeID); + + _SelTexture = CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeID); + _SelTextureArrowLeft = CBase.Themes.GetSkinTexture(_Theme.SkinArrowLeftSelected, _PartyModeID); + _SelTextureArrowRight = CBase.Themes.GetSkinTexture(_Theme.SkinArrowRightSelected, _PartyModeID); } public void ReloadSkin() diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 7d27eec5..8c8f0925 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -43,11 +43,11 @@ namespace VocaluxeLib.Menu SRectF ScreenArea { get; } - void NextInteraction(); - void PrevInteraction(); + void NextElement(); + void PrevElement(); - bool NextElement(); - bool PrevElement(); + bool NextValue(); + bool PrevValue(); void ProcessMouseClick(int x, int y); void ProcessMouseMove(int x, int y);