1 /*******************************************************************************
2 * Goggles Music Manager *
3 ********************************************************************************
4 * Copyright (C) 2006-2021 by Sander Jansen. All Rights Reserved *
5 * --- *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see http://www.gnu.org/licenses. *
18 ********************************************************************************/
19 #include "gmdefs.h"
20 #include "GMTrack.h"
21 #include "GMList.h"
22 #include "GMDatabase.h"
23 #include "GMTrackDatabase.h"
24 #include "GMTrackList.h"
25 #include "GMTrackView.h"
26 #include "GMSource.h"
27 #include "GMPlayerManager.h"
28 #include "GMWindow.h"
29 #include "GMIconTheme.h"
30 #include "GMClipboard.h"
31
32
33 FXIMPLEMENT(GMSource,FXObject,nullptr,0);
34
GMSource()35 GMSource::GMSource() {
36 }
37
~GMSource()38 GMSource::~GMSource() {
39 }
40
findCurrent(GMTrackList * list,GMSource * src)41 FXbool GMSource::findCurrent(GMTrackList * list,GMSource * src) {
42 if (src==nullptr || src->current_track==-1) return false;
43 for (FXint i=0;i<list->getNumItems();i++){
44 if (list->getItemId(i)==src->current_track) {
45 list->setActiveItem(i);
46 list->setCurrentItem(i);
47 return true;
48 }
49 }
50 return false;
51 }
52
findCurrentArtist(GMList *,GMSource *)53 FXbool GMSource::findCurrentArtist(GMList *,GMSource *){
54 return false;
55 }
56
findCurrentAlbum(GMAlbumList *,GMSource *)57 FXbool GMSource::findCurrentAlbum(GMAlbumList *,GMSource *){
58 return false;
59 }
60
dragged(GMTrackList * tracklist)61 void GMSource::dragged(GMTrackList * tracklist) {
62 tracklist->markUnsorted();
63 }
64
markCurrent(const GMTrackItem * item)65 void GMSource::markCurrent(const GMTrackItem*item) {
66 if (item)
67 current_track = item->getId();
68 else
69 current_track = -1;
70 }
71
getNumTracks() const72 FXint GMSource::getNumTracks() const{
73 return 0;
74 }
75
getTrack(GMTrack &) const76 FXbool GMSource::getTrack(GMTrack &) const{
77 return false;
78 }
79
getAlbumIcon() const80 FXIcon* GMSource::getAlbumIcon() const {
81 return GMIconTheme::instance()->icon_album;
82 }
83
84
85