change version to 0.6.4_pre
[ncmpcpp.git] / src / tag_editor.h
blob3013d35e8542ded48c8c76848cc0cc332b31e70d
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"
35 struct TagEditor: Screen<NC::Window *>, Filterable, HasColumns, HasSongs, Searchable, Tabbable
37 TagEditor();
39 virtual void resize() OVERRIDE;
40 virtual void switchTo() OVERRIDE;
42 virtual std::wstring title() OVERRIDE;
43 virtual ScreenType type() OVERRIDE { return ScreenType::TagEditor; }
45 virtual void refresh() OVERRIDE;
46 virtual void update() OVERRIDE;
48 virtual void enterPressed() OVERRIDE;
49 virtual void spacePressed() OVERRIDE;
50 virtual void mouseButtonPressed(MEVENT) OVERRIDE;
52 virtual bool isMergable() OVERRIDE { return true; }
54 // Filterable implementation
55 virtual bool allowsFiltering() OVERRIDE;
56 virtual std::string currentFilter() OVERRIDE;
57 virtual void applyFilter(const std::string &filter) OVERRIDE;
59 // Searchable implementation
60 virtual bool allowsSearching() OVERRIDE;
61 virtual bool search(const std::string &constraint) OVERRIDE;
62 virtual void nextFound(bool wrap) OVERRIDE;
63 virtual void prevFound(bool wrap) OVERRIDE;
65 // HasSongs implementation
66 virtual ProxySongList proxySongList() OVERRIDE;
68 virtual bool allowsSelection() OVERRIDE;
69 virtual void reverseSelection() OVERRIDE;
70 virtual MPD::SongList getSelectedSongs() OVERRIDE;
72 // HasColumns implementation
73 virtual bool previousColumnAvailable() OVERRIDE;
74 virtual void previousColumn() OVERRIDE;
76 virtual bool nextColumnAvailable() OVERRIDE;
77 virtual void nextColumn() OVERRIDE;
79 // private members
80 bool ifAnyModifiedAskForDiscarding();
81 void LocateSong(const MPD::Song &s);
82 const std::string &CurrentDir() { return itsBrowsedDir; }
84 NC::Menu< std::pair<std::string, std::string> > *Dirs;
85 NC::Menu<std::string> *TagTypes;
86 NC::Menu<MPD::MutableSong> *Tags;
88 protected:
89 virtual bool isLockable() OVERRIDE { return true; }
91 private:
92 void SetDimensions(size_t, size_t);
94 std::vector<MPD::MutableSong *> EditedSongs;
95 NC::Menu<std::string> *FParserDialog;
96 NC::Menu<std::string> *FParser;
97 NC::Scrollpad *FParserHelper;
98 NC::Scrollpad *FParserLegend;
99 NC::Scrollpad *FParserPreview;
100 bool FParserUsePreview;
102 std::string itsBrowsedDir;
103 std::string itsHighlightedDir;
106 extern TagEditor *myTagEditor;
108 #endif // HAVE_TAGLIB_H
110 #endif // NCMPCPP_TAG_EDITOR_H