1 /***************************************************************************
2 * Copyright (C) 2008-2012 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
30 #include "interfaces.h"
32 #include "mutable_song.h"
33 #include "regex_filter.h"
36 class TagEditor
: public Screen
<NC::Window
>, public Filterable
, public HasSongs
, public Searchable
39 TagEditor() : FParser(0), FParserHelper(0), FParserLegend(0), FParserPreview(0), itsBrowsedDir("/") { }
41 virtual void Resize();
42 virtual void SwitchTo();
44 virtual std::basic_string
<my_char_t
> Title();
46 virtual void Refresh();
47 virtual void Update();
49 virtual void EnterPressed();
50 virtual void SpacePressed();
51 virtual void MouseButtonPressed(MEVENT
);
52 virtual bool isTabbable() { return true; }
54 /// Filterable implementation
55 virtual std::string
currentFilter();
56 virtual void applyFilter(const std::string
&filter
);
58 /// Searchable implementation
59 virtual bool search(const std::string
&constraint
);
60 virtual void nextFound(bool wrap
);
61 virtual void prevFound(bool wrap
);
63 /// HasSongs implementation
64 virtual std::shared_ptr
<ProxySongList
> getProxySongList();
66 virtual bool allowsSelection();
67 virtual void reverseSelection();
68 virtual MPD::SongList
getSelectedSongs();
70 virtual bool isMergable() { return true; }
72 bool isNextColumnAvailable();
74 bool isPrevColumnAvailable();
77 void LocateSong(const MPD::Song
&s
);
79 NC::Menu
< std::pair
<std::string
, std::string
> > *LeftColumn
;
80 NC::Menu
< std::pair
<std::string
, std::string
> > *Albums
;
81 NC::Menu
< std::pair
<std::string
, std::string
> > *Dirs
;
82 NC::Menu
<std::string
> *TagTypes
;
83 NC::Menu
<MPD::MutableSong
> *Tags
;
85 /// NOTICE: this string is always in utf8, no need to convert it
86 const std::string
&CurrentDir() { return itsBrowsedDir
; }
88 static void ReadTags(MPD::MutableSong
&);
89 static bool WriteTags(MPD::MutableSong
&);
93 virtual bool isLockable() { return true; }
96 void SetDimensions(size_t, size_t);
98 std::vector
<MPD::MutableSong
*> EditedSongs
;
99 NC::Menu
<std::string
> *FParserDialog
;
100 NC::Menu
<std::string
> *FParser
;
101 NC::Scrollpad
*FParserHelper
;
102 NC::Scrollpad
*FParserLegend
;
103 NC::Scrollpad
*FParserPreview
;
104 bool FParserUsePreview
;
106 std::string itsBrowsedDir
;
107 std::string itsHighlightedDir
;
110 extern TagEditor
*myTagEditor
;