aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-11-18 16:04:42 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-11-18 16:04:42 +0000
commit91bb1d1517faa4b1abe25d2e0adc7cbaecb6b84d (patch)
tree71c7dc34aca3a531fdcce2c59d43862d948890cd /src
parent64e2aab2ea368ed666ad1afd7105e06917eeadb7 (diff)
downloadusdx-91bb1d1517faa4b1abe25d2e0adc7cbaecb6b84d.tar.gz
usdx-91bb1d1517faa4b1abe25d2e0adc7cbaecb6b84d.tar.xz
usdx-91bb1d1517faa4b1abe25d2e0adc7cbaecb6b84d.zip
select songs by clicking on them
click on front song starts singing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1952 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src')
-rw-r--r--src/screens/UScreenSong.pas77
1 files changed, 67 insertions, 10 deletions
diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas
index e74ea75d..a9c47401 100644
--- a/src/screens/UScreenSong.pas
+++ b/src/screens/UScreenSong.pas
@@ -752,6 +752,9 @@ begin
end;
function TScreenSong.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean;
+ var
+ I, J: Integer;
+ Btn: Integer;
begin
Result := true;
@@ -767,20 +770,74 @@ begin
end
else // no extension visible
begin
- if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then
+ if (BtnDown) then
+ begin
//if RightMbESC is set, send ESC keypress
- Result:=ParseInput(SDLK_ESCAPE, 0, true);
+ if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) then
+ Result:=ParseInput(SDLK_ESCAPE, 0, true)
+
+ //song scrolling with mousewheel
+ else if (MouseButton = SDL_BUTTON_WHEELDOWN) then
+ ParseInput(SDLK_RIGHT, 0, true)
+
+ else if (MouseButton = SDL_BUTTON_WHEELUP) then
+ ParseInput(SDLK_LEFT, 0, true)
+
+ //LMB anywhere starts
+ else if (MouseButton = SDL_BUTTON_LEFT) then
+ begin
+ if (CatSongs.VisibleSongs > 4) then
+ begin
+ // select the second visible button left from selected
+ I := 0;
+ Btn := Interaction;
+ while (I < 2) do
+ begin
+ Dec(Btn);
+ if (Btn < 0) then
+ Btn := High(CatSongs.Song);
+
+ if (CatSongs.Song[Btn].Visible) then
+ Inc(I);
+ end;
- //song scrolling with mousewheel
- if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then
- ParseInput(SDLK_RIGHT, 0, true);
+ // test the 5 front buttons for click
+ for I := 0 to 4 do
+ begin
+ if InRegion(X, Y, Button[Btn].GetMouseOverArea) then
+ begin
+ // song cover clicked
+ if (I = 2) then
+ begin // Selected Song clicked -> start singing
+ ParseInput(SDLK_RETURN, 0, true);
+ end
+ else
+ begin // one of the other 4 covers in the front clicked -> select it
+ J := I - 2;
+ while (J < 0) do
+ begin
+ ParseInput(SDLK_LEFT, 0, true);
+ Inc(J);
+ end;
- if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then
- ParseInput(SDLK_LEFT, 0, true);
+ while (J > 0) do
+ begin
+ ParseInput(SDLK_RIGHT, 0, true);
+ Dec(J);
+ end;
+ end;
+ Break;
+ end;
- //LMB anywhere starts
- if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then
- ParseInput(SDLK_RETURN, 0, true);
+ Btn := CatSongs.FindNextVisible(Btn);
+ if (Btn = -1) then
+ Break;
+ end;
+ end
+ else
+ ParseInput(SDLK_RETURN, 0, true);
+ end;
+ end;
end;
end;