change version to 0.7.3
[ncmpcpp.git] / src / tag_editor.h
blobbd72ae594e667131c61601e7eecf45f3fdb97947
1 /***************************************************************************
2 * Copyright (C) 2008-2014 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
4 * *
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. *
9 * *
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. *
14 * *
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
24 #include "config.h"
26 #ifdef HAVE_TAGLIB_H
28 #include <list>
30 #include "interfaces.h"
31 #include "mutable_song.h"
32 #include "regex_filter.h"
33 #include "screen.h"
34 #include "song_list.h"
36 struct TagsWindow: NC::Menu<MPD::MutableSong>, SongList
38 TagsWindow() { }
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 *>, HasActions, HasColumns, HasSongs, Searchable, Tabbable
54 TagEditor();
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 mouseButtonPressed(MEVENT) OVERRIDE;
67 virtual bool isLockable() OVERRIDE { return true; }
68 virtual bool isMergable() OVERRIDE { return true; }
70 // Searchable implementation
71 virtual bool allowsSearching() OVERRIDE;
72 virtual void setSearchConstraint(const std::string &constraint) OVERRIDE;
73 virtual void clearConstraint() OVERRIDE;
74 virtual bool find(SearchDirection direction, bool wrap, bool skip_current) OVERRIDE;
76 // HasActions implementation
77 virtual bool actionRunnable() OVERRIDE;
78 virtual void runAction() OVERRIDE;
80 // HasSongs implementation
81 virtual bool itemAvailable() OVERRIDE;
82 virtual bool addItemToPlaylist(bool play) OVERRIDE;
83 virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
85 // HasColumns implementation
86 virtual bool previousColumnAvailable() OVERRIDE;
87 virtual void previousColumn() OVERRIDE;
89 virtual bool nextColumnAvailable() OVERRIDE;
90 virtual void nextColumn() OVERRIDE;
92 // private members
93 bool enterDirectory();
94 void LocateSong(const MPD::Song &s);
95 const std::string &CurrentDir() { return itsBrowsedDir; }
97 NC::Menu< std::pair<std::string, std::string> > *Dirs;
98 NC::Menu<std::string> *TagTypes;
99 TagsWindow *Tags;
101 private:
102 void SetDimensions(size_t, size_t);
104 std::vector<MPD::MutableSong *> EditedSongs;
105 NC::Menu<std::string> *FParserDialog;
106 NC::Menu<std::string> *FParser;
107 NC::Scrollpad *FParserHelper;
108 NC::Scrollpad *FParserLegend;
109 NC::Scrollpad *FParserPreview;
110 bool FParserUsePreview;
112 std::string itsBrowsedDir;
113 std::string itsHighlightedDir;
115 Regex::Filter<std::pair<std::string, std::string>> m_directories_search_predicate;
116 Regex::Filter<MPD::MutableSong> m_songs_search_predicate;
119 extern TagEditor *myTagEditor;
121 #endif // HAVE_TAGLIB_H
123 #endif // NCMPCPP_TAG_EDITOR_H