1 /***************************************************************************
2 * Copyright (C) 2008-2014 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 ***************************************************************************/
21 #ifndef NCMPCPP_TAG_EDITOR_H
22 #define NCMPCPP_TAG_EDITOR_H
30 #include "interfaces.h"
31 #include "mutable_song.h"
32 #include "regex_filter.h"
34 #include "song_list.h"
36 struct TagsWindow
: NC::Menu
<MPD::MutableSong
>, SongList
39 TagsWindow(NC::Menu
<MPD::MutableSong
> &&base
)
40 : NC::Menu
<MPD::MutableSong
>(std::move(base
)) { }
42 virtual SongIterator
currentS() OVERRIDE
;
43 virtual ConstSongIterator
currentS() const OVERRIDE
;
44 virtual SongIterator
beginS() OVERRIDE
;
45 virtual ConstSongIterator
beginS() const OVERRIDE
;
46 virtual SongIterator
endS() OVERRIDE
;
47 virtual ConstSongIterator
endS() const OVERRIDE
;
49 virtual std::vector
<MPD::Song
> getSelectedSongs() OVERRIDE
;
52 struct TagEditor
: Screen
<NC::Window
*>, HasColumns
, HasSongs
, Searchable
, Tabbable
56 virtual void resize() OVERRIDE
;
57 virtual void switchTo() OVERRIDE
;
59 virtual std::wstring
title() OVERRIDE
;
60 virtual ScreenType
type() OVERRIDE
{ return ScreenType::TagEditor
; }
62 virtual void refresh() OVERRIDE
;
63 virtual void update() OVERRIDE
;
65 virtual void enterPressed() OVERRIDE
;
66 virtual void mouseButtonPressed(MEVENT
) OVERRIDE
;
68 virtual bool isLockable() OVERRIDE
{ return true; }
69 virtual bool isMergable() OVERRIDE
{ return true; }
71 // Searchable implementation
72 virtual bool allowsSearching() OVERRIDE
;
73 virtual void setSearchConstraint(const std::string
&constraint
) OVERRIDE
;
74 virtual void clearConstraint() OVERRIDE
;
75 virtual bool find(SearchDirection direction
, bool wrap
, bool skip_current
) OVERRIDE
;
77 // HasSongs implementation
78 virtual bool addItemToPlaylist() OVERRIDE
;
79 virtual std::vector
<MPD::Song
> getSelectedSongs() OVERRIDE
;
81 // HasColumns implementation
82 virtual bool previousColumnAvailable() OVERRIDE
;
83 virtual void previousColumn() OVERRIDE
;
85 virtual bool nextColumnAvailable() OVERRIDE
;
86 virtual void nextColumn() OVERRIDE
;
89 void LocateSong(const MPD::Song
&s
);
90 const std::string
&CurrentDir() { return itsBrowsedDir
; }
92 NC::Menu
< std::pair
<std::string
, std::string
> > *Dirs
;
93 NC::Menu
<std::string
> *TagTypes
;
97 void SetDimensions(size_t, size_t);
99 std::vector
<MPD::MutableSong
*> EditedSongs
;
100 NC::Menu
<std::string
> *FParserDialog
;
101 NC::Menu
<std::string
> *FParser
;
102 NC::Scrollpad
*FParserHelper
;
103 NC::Scrollpad
*FParserLegend
;
104 NC::Scrollpad
*FParserPreview
;
105 bool FParserUsePreview
;
107 std::string itsBrowsedDir
;
108 std::string itsHighlightedDir
;
110 Regex::Filter
<std::pair
<std::string
, std::string
>> m_directories_search_predicate
;
111 Regex::Filter
<MPD::MutableSong
> m_songs_search_predicate
;
114 extern TagEditor
*myTagEditor
;
116 #endif // HAVE_TAGLIB_H
118 #endif // NCMPCPP_TAG_EDITOR_H