diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2009-05-25 21:46:36 +0200 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2009-05-25 21:46:36 +0200 |
commit | d965f4e517e749ec1d93810b77088aca30c57df5 (patch) | |
tree | 3d4113b4ac1c96e3dcc36dcc4673229a6ffb63ae /src/playlist_editor.cpp | |
parent | dd266b0103b5cd05e509c209503d46bbcdcc97b0 (diff) |
new feature: mouse support
Diffstat (limited to 'src/playlist_editor.cpp')
-rw-r--r-- | src/playlist_editor.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/playlist_editor.cpp b/src/playlist_editor.cpp index fc5af08b..1e87731a 100644 --- a/src/playlist_editor.cpp +++ b/src/playlist_editor.cpp @@ -281,6 +281,44 @@ void PlaylistEditor::SpacePressed() AddToPlaylist(0); } +void PlaylistEditor::MouseButtonPressed(MEVENT me) +{ + if (!Playlists->Empty() && Playlists->hasCoords(me.x, me.y)) + { + if (w != Playlists) + PrevColumn(); + if (size_t(me.y) < Playlists->Size() && (me.bstate & BUTTON1_PRESSED || me.bstate & BUTTON3_PRESSED)) + { + Playlists->Goto(me.y); + if (me.bstate & BUTTON3_PRESSED) + EnterPressed(); + } + else + Screen<Window>::MouseButtonPressed(me); + Content->Clear(0); + } + else if (!Content->Empty() && Content->hasCoords(me.x, me.y)) + { + if (w != Content) + NextColumn(); + if (size_t(me.y) < Content->Size() && (me.bstate & BUTTON1_PRESSED || me.bstate & BUTTON3_PRESSED)) + { + Content->Goto(me.y); + if (me.bstate & BUTTON1_PRESSED) + { + size_t pos = Content->GetPosition(); + SpacePressed(); + if (pos < Content->Size()-1) + Content->Scroll(wUp); + } + else + EnterPressed(); + } + else + Screen<Window>::MouseButtonPressed(me); + } +} + MPD::Song *PlaylistEditor::CurrentSong() { return w == Content && !Content->Empty() ? &Content->Current() : 0; |