public override bool HandleMouse(MouseEvent MouseEvent) { base.HandleMouse(MouseEvent); if (DragAndDropActive) { DragAndDropCover.Rect.X += MouseEvent.X - OldMousePosX; DragAndDropCover.Rect.Y += MouseEvent.Y - OldMousePosY; } OldMousePosX = MouseEvent.X; OldMousePosY = MouseEvent.Y; if (Playlists[htPlaylists(Playlist)].Visible && Playlists[htPlaylists(Playlist)].IsMouseOver(MouseEvent)) { _PlaylistActive = true; Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); ToggleSongOptions(ESongOptionsView.None); } else if (CHelper.IsInBounds(SongMenus[htSongMenus(SongMenu)].Rect, MouseEvent.X, MouseEvent.Y)) { _PlaylistActive = false; Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); } if (Playlists[htPlaylists(Playlist)].Visible && _PlaylistActive) { if (Playlists[htPlaylists(Playlist)].HandleMouse(MouseEvent)) { if (CPlaylists.NumPlaylists != SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].NumValues) { UpdatePlaylistNames(); } return(true); } } if (MouseEvent.RB) { if (_SongOptionsActive) { ToggleSongOptions(ESongOptionsView.None); return(true); } if (CSongs.Category < 0) { CGraphics.FadeTo(EScreens.ScreenMain); return(true); } } if (MouseEvent.MB) { if (CSongs.Category != -1) { ToggleSongOptions(ESongOptionsView.None); SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); return(true); } if (CSongs.Category == -1) { ToggleSongOptions(ESongOptionsView.None); SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); return(true); } } if (MouseEvent.LD) { if (CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) { ToggleSongOptions(ESongOptionsView.None); StartVisibleSong(SongMenus[htSongMenus(SongMenu)].GetActualSelection()); return(true); } } SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent); if (MouseEvent.LB) { if (IsMouseOver(MouseEvent)) { if (Buttons[htButtons(ButtonOpenOptions)].Selected) { ToggleSongOptions(ESongOptionsView.General); return(true); } if (Buttons[htButtons(ButtonOptionsClose)].Selected) { ToggleSongOptions(ESongOptionsView.None); return(true); } if (Buttons[htButtons(ButtonOptionsSing)].Selected) { ToggleSongOptions(ESongOptionsView.None); StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); return(true); } if (Buttons[htButtons(ButtonOptionsPlaylist)].Selected) { ToggleSongOptions(ESongOptionsView.None); OpenAndAddPlaylistAction(); return(true); } if (Buttons[htButtons(ButtonOptionsRandom)].Selected) { if (CSongs.Category != -1) { SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); return(true); } } if (Buttons[htButtons(ButtonOptionsRandomCategory)].Selected) { if (CSongs.Category == -1) { SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); return(true); } } if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) { ToggleSongOptions(ESongOptionsView.None); StartRandomAllSongs(); return(true); } if (Buttons[htButtons(ButtonOptionsSingAllVisible)].Selected) { ToggleSongOptions(ESongOptionsView.None); StartRandomVisibleSongs(); return(true); } if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected) { ToggleSongOptions(ESongOptionsView.None); OpenPlaylistAction(); return(true); } } if (CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) { if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) { ToggleSongOptions(ESongOptionsView.Song); return(true); } else { ToggleSongOptions(ESongOptionsView.None); return(true); } } } if (MouseEvent.LBH) { if (!DragAndDropActive && Playlists[htPlaylists(Playlist)].Visible && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) { DragAndDropCover = SongMenus[htSongMenus(SongMenu)].GetSelectedSongCover(); DragAndDropCover.Rect.Z = CSettings.zNear; Playlists[htPlaylists(Playlist)].DragAndDropSongID = CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetActualSelection()].ID; DragAndDropActive = true; return(true); } } if (!MouseEvent.LBH && DragAndDropActive) { DragAndDropActive = false; Playlists[htPlaylists(Playlist)].DragAndDropSongID = -1; return(true); } return(true); }
public override bool HandleInput(KeyEvent KeyEvent) { base.HandleInput(KeyEvent); if (KeyEvent.Handled) { return(true); } if (_PlaylistActive) { if (!KeyEvent.KeyPressed && KeyEvent.Key == Keys.Tab) { _PlaylistActive = !_PlaylistActive; Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); return(true); } Playlists[htPlaylists(Playlist)].HandleInput(KeyEvent); if (CPlaylists.NumPlaylists != SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].NumValues) { UpdatePlaylistNames(); } return(true); } if (!_SongOptionsActive) { if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode)) { if (_SearchActive) { ApplyNewSearchFilter(_SearchText + KeyEvent.Unicode); } /* * else if (!Char.IsControl(KeyEvent.Unicode)) * { * JumpTo(KeyEvent.Unicode); * return true; * } */ } else { SongMenus[htSongMenus(SongMenu)].HandleInput(ref KeyEvent); if (KeyEvent.Handled) { return(true); } switch (KeyEvent.Key) { case Keys.Escape: if (CSongs.Category < 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) { CGraphics.FadeTo(EScreens.ScreenMain); } break; case Keys.Enter: if (CSongs.NumVisibleSongs > 0) { if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) { ToggleSongOptions(ESongOptionsView.Song); } } break; case Keys.Tab: if (Playlists[htPlaylists(Playlist)].Visible) { _PlaylistActive = !_PlaylistActive; Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); } break; case Keys.Back: if (_SearchText.Length > 0) { ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1)); } if (!_SearchActive && CSongs.Category < 0) { CGraphics.FadeTo(EScreens.ScreenMain); } break; case Keys.Space: if (!_SearchActive) { ToggleSongOptions(ESongOptionsView.General); } break; case Keys.F3: if (_SearchActive) { _SearchActive = false; _SearchText = String.Empty; ApplyNewSearchFilter(_SearchText); } else { _SearchActive = true; } break; //TODO: Delete it! ??? Shouldn't we keep this as shortcut? case Keys.A: if (!_SearchActive && KeyEvent.Mod == EModifier.None) { StartRandomAllSongs(); } if (KeyEvent.Mod == EModifier.Ctrl) { StartRandomVisibleSongs(); } break; //TODO: Delete that from here and from wiki! case Keys.F: if (KeyEvent.Mod == EModifier.Ctrl) { if (_SearchActive) { _SearchActive = false; _SearchText = String.Empty; ApplyNewSearchFilter(_SearchText); } else { _SearchActive = true; } } break; //TODO: We need another key for random! case Keys.R: if (!_SearchActive && CSongs.Category != -1 && KeyEvent.Mod == EModifier.Ctrl) { SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); } else if (CSongs.Category == -1 && KeyEvent.Mod == EModifier.Ctrl) { SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); } break; //TODO: Delete that! case Keys.S: if (!_SearchActive && CSongs.NumVisibleSongs > 0) { StartMedleySong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); } break; } } } else { switch (KeyEvent.Key) { case Keys.Enter: if (Buttons[htButtons(ButtonOptionsClose)].Selected) { ToggleSongOptions(ESongOptionsView.None); } else if (Buttons[htButtons(ButtonOptionsSing)].Selected) { ToggleSongOptions(ESongOptionsView.None); StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); } else if (Buttons[htButtons(ButtonOptionsPlaylist)].Selected) { ToggleSongOptions(ESongOptionsView.None); OpenAndAddPlaylistAction(); } else if (Buttons[htButtons(ButtonOptionsRandom)].Selected) { if (CSongs.Category != -1) { SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); } } else if (Buttons[htButtons(ButtonOptionsRandom)].Selected) { if (CSongs.Category == -1) { SongMenus[htSongMenus(SongMenu)].SetSelectedCategory(CSongs.GetRandomCategory()); } } else if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) { StartRandomAllSongs(); } else if (Buttons[htButtons(ButtonOptionsSingAllVisible)].Selected) { StartRandomVisibleSongs(); } else if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected) { ToggleSongOptions(ESongOptionsView.None); OpenPlaylistAction(); } break; case Keys.Escape: case Keys.Back: case Keys.Space: ToggleSongOptions(ESongOptionsView.None); break; } } if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Add || KeyEvent.Key == Keys.PageUp)) { CConfig.PreviewMusicVolume = CConfig.PreviewMusicVolume + 5; if (CConfig.PreviewMusicVolume > 100) { CConfig.PreviewMusicVolume = 100; } CConfig.SaveConfig(); ApplyVolume(); } else if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Subtract || KeyEvent.Key == Keys.PageDown)) { CConfig.PreviewMusicVolume = CConfig.PreviewMusicVolume - 5; if (CConfig.PreviewMusicVolume < 0) { CConfig.PreviewMusicVolume = 0; } CConfig.SaveConfig(); ApplyVolume(); } return(true); }