playlists management support and playlist editor screen added
This commit is contained in:
@@ -35,6 +35,8 @@
|
|||||||
#
|
#
|
||||||
#key_volume_down = 260 '-'
|
#key_volume_down = 260 '-'
|
||||||
#
|
#
|
||||||
|
#key_toggle_space_mode = 't'
|
||||||
|
#
|
||||||
#key_screen_switcher = 9
|
#key_screen_switcher = 9
|
||||||
#
|
#
|
||||||
#key_help = '1' 265
|
#key_help = '1' 265
|
||||||
@@ -47,6 +49,8 @@
|
|||||||
#
|
#
|
||||||
#key_media_library = '5' 269
|
#key_media_library = '5' 269
|
||||||
#
|
#
|
||||||
|
#key_playlist_editor = '6' 270
|
||||||
|
#
|
||||||
#key_stop = 's'
|
#key_stop = 's'
|
||||||
#
|
#
|
||||||
#key_pause = 'P'
|
#key_pause = 'P'
|
||||||
@@ -93,6 +97,8 @@
|
|||||||
#
|
#
|
||||||
#key_deselect_all = 'V'
|
#key_deselect_all = 'V'
|
||||||
#
|
#
|
||||||
|
#key_add_selected_items = 'A'
|
||||||
|
#
|
||||||
#key_clear = 'c'
|
#key_clear = 'c'
|
||||||
#
|
#
|
||||||
#key_crop = 'C'
|
#key_crop = 'C'
|
||||||
|
|||||||
@@ -80,7 +80,9 @@
|
|||||||
#
|
#
|
||||||
#repeat_one_mode = "no"
|
#repeat_one_mode = "no"
|
||||||
#
|
#
|
||||||
#find_mode = "wrapped"
|
#default_find_mode = "wrapped"
|
||||||
|
#
|
||||||
|
#default_space_mode = "add"
|
||||||
#
|
#
|
||||||
#header_visibility = "yes"
|
#header_visibility = "yes"
|
||||||
#
|
#
|
||||||
@@ -110,5 +112,5 @@
|
|||||||
#
|
#
|
||||||
#statusbar_color = "default"
|
#statusbar_color = "default"
|
||||||
#
|
#
|
||||||
#library_active_column_color = "red"
|
#active_column_color = "red"
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -29,10 +29,12 @@ extern Menu *mPlaylist;
|
|||||||
extern Menu *mBrowser;
|
extern Menu *mBrowser;
|
||||||
extern Menu *mTagEditor;
|
extern Menu *mTagEditor;
|
||||||
extern Menu *mSearcher;
|
extern Menu *mSearcher;
|
||||||
|
extern Menu *mPlaylistEditor;
|
||||||
|
|
||||||
extern Window *wFooter;
|
extern Window *wFooter;
|
||||||
|
|
||||||
extern SongList vPlaylist;
|
extern SongList vPlaylist;
|
||||||
|
extern SongList vPlaylistContent;
|
||||||
extern ItemList vBrowser;
|
extern ItemList vBrowser;
|
||||||
|
|
||||||
extern NcmpcppScreen current_screen;
|
extern NcmpcppScreen current_screen;
|
||||||
@@ -70,6 +72,14 @@ void DeleteSong(int id)
|
|||||||
mPlaylist->DeleteOption(id+1);
|
mPlaylist->DeleteOption(id+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlaylistDeleteSong(const string &path, int id)
|
||||||
|
{
|
||||||
|
Mpd->QueueDeleteFromPlaylist(path, id);
|
||||||
|
delete vPlaylistContent[id];
|
||||||
|
vPlaylistContent.erase(vPlaylistContent.begin()+id);
|
||||||
|
mPlaylistEditor->DeleteOption(id+1);
|
||||||
|
}
|
||||||
|
|
||||||
bool MoveSongUp(int pos)
|
bool MoveSongUp(int pos)
|
||||||
{
|
{
|
||||||
if (pos > 0 && !mPlaylist->Empty() && current_screen == csPlaylist)
|
if (pos > 0 && !mPlaylist->Empty() && current_screen == csPlaylist)
|
||||||
@@ -96,6 +106,30 @@ bool MoveSongDown(int pos)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PlaylistMoveSongUp(const string &path, int pos)
|
||||||
|
{
|
||||||
|
if (pos > 0 && !mPlaylistEditor->Empty() && current_screen == csPlaylistEditor)
|
||||||
|
{
|
||||||
|
mPlaylistEditor->Swap(pos, pos-1);
|
||||||
|
Mpd->Move(path, pos, pos-1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PlaylistMoveSongDown(const string &path, int pos)
|
||||||
|
{
|
||||||
|
if (pos+1 < mPlaylistEditor->MaxChoice() && !mPlaylistEditor->Empty() && current_screen == csPlaylistEditor)
|
||||||
|
{
|
||||||
|
mPlaylistEditor->Swap(pos+1, pos);
|
||||||
|
Mpd->Move(path, pos, pos+1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
string DisplayKeys(int *key, int size)
|
string DisplayKeys(int *key, int size)
|
||||||
{
|
{
|
||||||
bool backspace = 1;
|
bool backspace = 1;
|
||||||
|
|||||||
@@ -31,8 +31,11 @@
|
|||||||
extern ncmpcpp_config Config;
|
extern ncmpcpp_config Config;
|
||||||
|
|
||||||
void DeleteSong(int);
|
void DeleteSong(int);
|
||||||
|
void PlaylistDeleteSong(const string &, int);
|
||||||
bool MoveSongUp(int);
|
bool MoveSongUp(int);
|
||||||
bool MoveSongDown(int);
|
bool MoveSongDown(int);
|
||||||
|
bool PlaylistMoveSongUp(const string &, int);
|
||||||
|
bool PlaylistMoveSongDown(const string &, int);
|
||||||
|
|
||||||
string DisplayKeys(int *, int = 2);
|
string DisplayKeys(int *, int = 2);
|
||||||
bool Keypressed(int, const int *);
|
bool Keypressed(int, const int *);
|
||||||
|
|||||||
37
src/menu.cpp
37
src/menu.cpp
@@ -21,6 +21,23 @@
|
|||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
|
Menu::Menu(const Menu &m) : Window(m)
|
||||||
|
{
|
||||||
|
for (vector<Option *>::const_iterator it = m.itsOptions.begin(); it != m.itsOptions.end(); it++)
|
||||||
|
{
|
||||||
|
Option *new_option = new Option(**it);
|
||||||
|
itsOptions.push_back(new_option);
|
||||||
|
}
|
||||||
|
NeedsRedraw = m.NeedsRedraw;
|
||||||
|
itsSelectedPrefix = m.itsSelectedPrefix;
|
||||||
|
itsSelectedSuffix = m.itsSelectedSuffix;
|
||||||
|
itsStaticsNumber = m.itsStaticsNumber;
|
||||||
|
itsBeginning = m.itsBeginning;
|
||||||
|
itsHighlight = m.itsHighlight;
|
||||||
|
itsHighlightColor = m.itsHighlightColor;
|
||||||
|
itsHighlightEnabled = m.itsHighlightEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
Menu::~Menu()
|
Menu::~Menu()
|
||||||
{
|
{
|
||||||
for (vector<Option *>::iterator it = itsOptions.begin(); it != itsOptions.end(); it++)
|
for (vector<Option *>::iterator it = itsOptions.begin(); it != itsOptions.end(); it++)
|
||||||
@@ -274,7 +291,10 @@ void Menu::Refresh(bool redraw_whole_window)
|
|||||||
Highlight(itsOptions.size());
|
Highlight(itsOptions.size());
|
||||||
|
|
||||||
if (redraw_whole_window)
|
if (redraw_whole_window)
|
||||||
|
{
|
||||||
|
Window::Clear();
|
||||||
redraw_screen();
|
redraw_screen();
|
||||||
|
}
|
||||||
|
|
||||||
for (vector<int>::const_iterator it = NeedsRedraw.begin(); it != NeedsRedraw.end(); it++)
|
for (vector<int>::const_iterator it = NeedsRedraw.begin(); it != NeedsRedraw.end(); it++)
|
||||||
{
|
{
|
||||||
@@ -356,17 +376,12 @@ void Menu::Refresh(bool redraw_whole_window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*it == itsHighlight && itsHighlightEnabled)
|
SetBaseColor(old_basecolor);
|
||||||
{
|
SetColor(old_basecolor);
|
||||||
Reverse(0);
|
while (!itsColors.empty()) // clear color stack and disable bold and reverse as
|
||||||
SetBaseColor(old_basecolor);
|
itsColors.pop(); // some items are too long to close all tags properly
|
||||||
SetColor(old_basecolor);
|
Reverse(0);
|
||||||
}
|
Bold(0);
|
||||||
if (itsOptions[*it]->is_bold)
|
|
||||||
Bold(0);
|
|
||||||
|
|
||||||
while (!itsColors.empty()) // clear color stack as some items are
|
|
||||||
itsColors.pop(); // too long to close all tags properly
|
|
||||||
}
|
}
|
||||||
NeedsRedraw.clear();
|
NeedsRedraw.clear();
|
||||||
wrefresh(itsWindow);
|
wrefresh(itsWindow);
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class Menu : public Window
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Menu(int startx, int starty, int width, int height, string title, COLOR color, BORDER border) : Window(startx, starty, width, height, title, color, border), itsSelectedPrefix("[r]"), itsSelectedSuffix("[/r]"), itsStaticsNumber(0), itsBeginning(0), itsHighlight(0), itsHighlightColor(itsBaseColor), itsHighlightEnabled(1) { SetColor(color); }
|
Menu(int startx, int starty, int width, int height, string title, COLOR color, BORDER border) : Window(startx, starty, width, height, title, color, border), itsSelectedPrefix("[r]"), itsSelectedSuffix("[/r]"), itsStaticsNumber(0), itsBeginning(0), itsHighlight(0), itsHighlightColor(itsBaseColor), itsHighlightEnabled(1) { SetColor(color); }
|
||||||
|
Menu(const Menu &);
|
||||||
virtual ~Menu();
|
virtual ~Menu();
|
||||||
|
|
||||||
virtual void Add(string str) { AddOption(str); }
|
virtual void Add(string str) { AddOption(str); }
|
||||||
@@ -87,6 +88,7 @@ class Menu : public Window
|
|||||||
|
|
||||||
bool Empty() { return itsOptions.empty(); }
|
bool Empty() { return itsOptions.empty(); }
|
||||||
bool IsStatic(int);
|
bool IsStatic(int);
|
||||||
|
virtual Window * Clone() { return new Menu(*this); }
|
||||||
virtual Window * EmptyClone();
|
virtual Window * EmptyClone();
|
||||||
protected:
|
protected:
|
||||||
vector<Option *> itsOptions;
|
vector<Option *> itsOptions;
|
||||||
|
|||||||
@@ -266,6 +266,30 @@ void MPDConnection::ClearPlaylist() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MPDConnection::AddToPlaylist(const string &path, const Song &s) const
|
||||||
|
{
|
||||||
|
if (!s.Empty())
|
||||||
|
AddToPlaylist(path, s.GetFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MPDConnection::AddToPlaylist(const string &path, const string &file) const
|
||||||
|
{
|
||||||
|
if (isConnected)
|
||||||
|
{
|
||||||
|
mpd_sendPlaylistAddCommand(itsConnection, (char *) path.c_str(), (char *) file.c_str());
|
||||||
|
mpd_finishCommand(itsConnection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MPDConnection::Move(const string &path, int from, int to) const
|
||||||
|
{
|
||||||
|
if (isConnected)
|
||||||
|
{
|
||||||
|
mpd_sendPlaylistMoveCommand(itsConnection, (char *) path.c_str(), from, to);
|
||||||
|
mpd_finishCommand(itsConnection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MPDConnection::GetPlaylistChanges(long long id, SongList &v) const
|
void MPDConnection::GetPlaylistChanges(long long id, SongList &v) const
|
||||||
{
|
{
|
||||||
if (isConnected)
|
if (isConnected)
|
||||||
@@ -411,7 +435,7 @@ void MPDConnection::QueueAddSong(const string &path)
|
|||||||
{
|
{
|
||||||
QueueCommand *q = new QueueCommand;
|
QueueCommand *q = new QueueCommand;
|
||||||
q->type = qctAdd;
|
q->type = qctAdd;
|
||||||
q->path = path;
|
q->item_path = path;
|
||||||
itsQueue.push_back(q);
|
itsQueue.push_back(q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -422,6 +446,24 @@ void MPDConnection::QueueAddSong(const Song &s)
|
|||||||
QueueAddSong(s.GetFile());
|
QueueAddSong(s.GetFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MPDConnection::QueueAddToPlaylist(const string &playlist, const string &path)
|
||||||
|
{
|
||||||
|
if (isConnected)
|
||||||
|
{
|
||||||
|
QueueCommand *q = new QueueCommand;
|
||||||
|
q->type = qctAddToPlaylist;
|
||||||
|
q->playlist_path = playlist;
|
||||||
|
q->item_path = path;
|
||||||
|
itsQueue.push_back(q);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MPDConnection::QueueAddToPlaylist(const string &playlist, const Song &s)
|
||||||
|
{
|
||||||
|
if (!s.Empty())
|
||||||
|
QueueAddToPlaylist(playlist, s.GetFile());
|
||||||
|
}
|
||||||
|
|
||||||
void MPDConnection::QueueDeleteSong(int id)
|
void MPDConnection::QueueDeleteSong(int id)
|
||||||
{
|
{
|
||||||
if (isConnected)
|
if (isConnected)
|
||||||
@@ -444,6 +486,18 @@ void MPDConnection::QueueDeleteSongId(int id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MPDConnection::QueueDeleteFromPlaylist(const string &playlist, int pos)
|
||||||
|
{
|
||||||
|
if (isConnected)
|
||||||
|
{
|
||||||
|
QueueCommand *q = new QueueCommand;
|
||||||
|
q->type = qctDeleteFromPlaylist;
|
||||||
|
q->playlist_path = playlist;
|
||||||
|
q->id = pos;
|
||||||
|
itsQueue.push_back(q);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool MPDConnection::CommitQueue()
|
bool MPDConnection::CommitQueue()
|
||||||
{
|
{
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
@@ -455,7 +509,10 @@ bool MPDConnection::CommitQueue()
|
|||||||
switch ((*it)->type)
|
switch ((*it)->type)
|
||||||
{
|
{
|
||||||
case qctAdd:
|
case qctAdd:
|
||||||
mpd_sendAddCommand(itsConnection, (*it)->path.c_str());
|
mpd_sendAddCommand(itsConnection, (*it)->item_path.c_str());
|
||||||
|
break;
|
||||||
|
case qctAddToPlaylist:
|
||||||
|
mpd_sendPlaylistAddCommand(itsConnection, (char *) (*it)->playlist_path.c_str(), (char *) (*it)->item_path.c_str());
|
||||||
break;
|
break;
|
||||||
case qctDelete:
|
case qctDelete:
|
||||||
mpd_sendDeleteCommand(itsConnection, (*it)->id);
|
mpd_sendDeleteCommand(itsConnection, (*it)->id);
|
||||||
@@ -463,6 +520,9 @@ bool MPDConnection::CommitQueue()
|
|||||||
case qctDeleteID:
|
case qctDeleteID:
|
||||||
mpd_sendDeleteIdCommand(itsConnection, (*it)->id);
|
mpd_sendDeleteIdCommand(itsConnection, (*it)->id);
|
||||||
break;
|
break;
|
||||||
|
case qctDeleteFromPlaylist:
|
||||||
|
mpd_sendPlaylistDeleteCommand(itsConnection, (char *) (*it)->playlist_path.c_str(), (*it)->id);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mpd_sendCommandListEnd(itsConnection);
|
mpd_sendCommandListEnd(itsConnection);
|
||||||
@@ -497,6 +557,21 @@ bool MPDConnection::SavePlaylist(const string &name) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MPDConnection::GetPlaylists(TagList &v) const
|
||||||
|
{
|
||||||
|
if (isConnected)
|
||||||
|
{
|
||||||
|
ItemList list;
|
||||||
|
GetDirectory("/", list);
|
||||||
|
for (ItemList::const_iterator it = list.begin(); it != list.end(); it++)
|
||||||
|
{
|
||||||
|
if (it->type == itPlaylist)
|
||||||
|
v.push_back(it->name);
|
||||||
|
}
|
||||||
|
FreeItemList(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MPDConnection::GetArtists(TagList &v) const
|
void MPDConnection::GetArtists(TagList &v) const
|
||||||
{
|
{
|
||||||
if (isConnected)
|
if (isConnected)
|
||||||
|
|||||||
13
src/mpdpp.h
13
src/mpdpp.h
@@ -24,7 +24,7 @@
|
|||||||
#include "ncmpcpp.h"
|
#include "ncmpcpp.h"
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
|
|
||||||
enum QueueCommandType { qctAdd, qctDelete, qctDeleteID };
|
enum QueueCommandType { qctAdd, qctAddToPlaylist, qctDelete, qctDeleteID, qctDeleteFromPlaylist };
|
||||||
enum ItemType { itDirectory, itSong, itPlaylist };
|
enum ItemType { itDirectory, itSong, itPlaylist };
|
||||||
enum PlayerState { psUnknown, psStop, psPlay, psPause };
|
enum PlayerState { psUnknown, psStop, psPlay, psPause };
|
||||||
|
|
||||||
@@ -47,7 +47,8 @@ struct QueueCommand
|
|||||||
{
|
{
|
||||||
QueueCommand() : id(0) { }
|
QueueCommand() : id(0) { }
|
||||||
QueueCommandType type;
|
QueueCommandType type;
|
||||||
string path;
|
string playlist_path;
|
||||||
|
string item_path;
|
||||||
int id;
|
int id;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -132,12 +133,19 @@ class MPDConnection
|
|||||||
int AddSong(const Song &); // returns id of added song
|
int AddSong(const Song &); // returns id of added song
|
||||||
void QueueAddSong(const string &);
|
void QueueAddSong(const string &);
|
||||||
void QueueAddSong(const Song &);
|
void QueueAddSong(const Song &);
|
||||||
|
void QueueAddToPlaylist(const string &, const string &);
|
||||||
|
void QueueAddToPlaylist(const string &, const Song &);
|
||||||
void QueueDeleteSong(int);
|
void QueueDeleteSong(int);
|
||||||
void QueueDeleteSongId(int);
|
void QueueDeleteSongId(int);
|
||||||
|
void QueueDeleteFromPlaylist(const string &, int);
|
||||||
bool CommitQueue();
|
bool CommitQueue();
|
||||||
|
|
||||||
void DeletePlaylist(const string &) const;
|
void DeletePlaylist(const string &) const;
|
||||||
bool SavePlaylist(const string &) const;
|
bool SavePlaylist(const string &) const;
|
||||||
|
void ClearPlaylist(const string &) const;
|
||||||
|
void AddToPlaylist(const string &, const Song &) const;
|
||||||
|
void AddToPlaylist(const string &, const string &) const;
|
||||||
|
void Move(const string &, int, int) const;
|
||||||
|
|
||||||
void StartSearch(bool) const;
|
void StartSearch(bool) const;
|
||||||
void StartFieldSearch(mpd_TagItems);
|
void StartFieldSearch(mpd_TagItems);
|
||||||
@@ -145,6 +153,7 @@ class MPDConnection
|
|||||||
void CommitSearch(SongList &) const;
|
void CommitSearch(SongList &) const;
|
||||||
void CommitSearch(TagList &) const;
|
void CommitSearch(TagList &) const;
|
||||||
|
|
||||||
|
void GetPlaylists(TagList &) const;
|
||||||
void GetArtists(TagList &) const;
|
void GetArtists(TagList &) const;
|
||||||
void GetAlbums(string, TagList &) const;
|
void GetAlbums(string, TagList &) const;
|
||||||
void GetDirectory(const string &, ItemList &) const;
|
void GetDirectory(const string &, ItemList &) const;
|
||||||
|
|||||||
777
src/ncmpcpp.cpp
777
src/ncmpcpp.cpp
File diff suppressed because it is too large
Load Diff
@@ -52,7 +52,7 @@ const bool UNICODE = 0;
|
|||||||
#include "scrollpad.h"
|
#include "scrollpad.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
enum NcmpcppScreen { csHelp, csPlaylist, csBrowser, csTagEditor, csSearcher, csLibrary, csLyrics };
|
enum NcmpcppScreen { csHelp, csPlaylist, csBrowser, csTagEditor, csSearcher, csLibrary, csLyrics, csPlaylistEditor };
|
||||||
|
|
||||||
const int ncmpcpp_window_timeout = 500;
|
const int ncmpcpp_window_timeout = 500;
|
||||||
const int search_engine_static_option = 17;
|
const int search_engine_static_option = 17;
|
||||||
|
|||||||
@@ -20,6 +20,15 @@
|
|||||||
|
|
||||||
#include "scrollpad.h"
|
#include "scrollpad.h"
|
||||||
|
|
||||||
|
Scrollpad::Scrollpad(const Scrollpad &s) : Window(s)
|
||||||
|
{
|
||||||
|
itsContent = s.itsContent;
|
||||||
|
itsRawContent = s.itsRawContent;
|
||||||
|
itsBeginning = s.itsBeginning;
|
||||||
|
itsRealHeight = s.itsRealHeight;
|
||||||
|
itsXPos = s.itsXPos;
|
||||||
|
}
|
||||||
|
|
||||||
void Scrollpad::Add(string str)
|
void Scrollpad::Add(string str)
|
||||||
{
|
{
|
||||||
if (itsXPos > 0 && (str[0] != ' ' || str[0] != '\n'))
|
if (itsXPos > 0 && (str[0] != ' ' || str[0] != '\n'))
|
||||||
@@ -220,20 +229,3 @@ Window * Scrollpad::EmptyClone()
|
|||||||
return new Scrollpad(GetStartX(),GetStartY(),GetWidth(),GetHeight(),itsTitle,itsBaseColor,itsBorder);
|
return new Scrollpad(GetStartX(),GetStartY(),GetWidth(),GetHeight(),itsTitle,itsBaseColor,itsBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scrollpad & Scrollpad::operator=(const Scrollpad &base)
|
|
||||||
{
|
|
||||||
if (this == &base)
|
|
||||||
return *this;
|
|
||||||
itsWindow = base.itsWindow;
|
|
||||||
itsStartX = base.itsStartX;
|
|
||||||
itsStartY = base.itsStartY;
|
|
||||||
itsWidth = base.itsWidth;
|
|
||||||
itsHeight = base.itsHeight;
|
|
||||||
itsTitle = base.itsTitle;
|
|
||||||
itsBorder = base.itsBorder;
|
|
||||||
itsColor = base.itsColor;
|
|
||||||
itsContent = base.itsContent;
|
|
||||||
itsBeginning = base.itsBeginning;
|
|
||||||
itsRealHeight = base.itsRealHeight;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class Scrollpad: public Window
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Scrollpad(int startx, int starty, int width, int height, string title, COLOR color, BORDER border) : Window(startx, starty, width, height, title, color, border), itsBeginning(0), itsRealHeight(1), itsXPos(0) { delwin(itsWindow); itsWindow = newpad(itsHeight,itsWidth); }
|
Scrollpad(int startx, int starty, int width, int height, string title, COLOR color, BORDER border) : Window(startx, starty, width, height, title, color, border), itsBeginning(0), itsRealHeight(1), itsXPos(0) { delwin(itsWindow); itsWindow = newpad(itsHeight,itsWidth); }
|
||||||
|
Scrollpad(const Scrollpad &);
|
||||||
virtual ~Scrollpad() {}
|
virtual ~Scrollpad() {}
|
||||||
virtual void Add(string);
|
virtual void Add(string);
|
||||||
virtual void Display(bool = 0);
|
virtual void Display(bool = 0);
|
||||||
@@ -37,8 +38,8 @@ class Scrollpad: public Window
|
|||||||
virtual void SetBorder(BORDER);
|
virtual void SetBorder(BORDER);
|
||||||
virtual void SetTitle(string);
|
virtual void SetTitle(string);
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
virtual Window * Clone() { return new Scrollpad(*this); }
|
||||||
virtual Window * EmptyClone();
|
virtual Window * EmptyClone();
|
||||||
Scrollpad & operator=(const Scrollpad &);
|
|
||||||
protected:
|
protected:
|
||||||
void print_content();
|
void print_content();
|
||||||
virtual void recreate_win();
|
virtual void recreate_win();
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ void DefaultKeys(ncmpcpp_keys &keys)
|
|||||||
keys.Browser[0] = '3';
|
keys.Browser[0] = '3';
|
||||||
keys.SearchEngine[0] = '4';
|
keys.SearchEngine[0] = '4';
|
||||||
keys.MediaLibrary[0] = '5';
|
keys.MediaLibrary[0] = '5';
|
||||||
|
keys.PlaylistEditor[0] = '6';
|
||||||
keys.Stop[0] = 's';
|
keys.Stop[0] = 's';
|
||||||
keys.Pause[0] = 'P';
|
keys.Pause[0] = 'P';
|
||||||
keys.Next[0] = '>';
|
keys.Next[0] = '>';
|
||||||
@@ -53,6 +54,7 @@ void DefaultKeys(ncmpcpp_keys &keys)
|
|||||||
keys.ToggleRepeat[0] = 'r';
|
keys.ToggleRepeat[0] = 'r';
|
||||||
keys.ToggleRepeatOne[0] = 'R';
|
keys.ToggleRepeatOne[0] = 'R';
|
||||||
keys.ToggleRandom[0] = 'z';
|
keys.ToggleRandom[0] = 'z';
|
||||||
|
keys.ToggleSpaceMode[0] = 't';
|
||||||
keys.Shuffle[0] = 'Z';
|
keys.Shuffle[0] = 'Z';
|
||||||
keys.ToggleCrossfade[0] = 'x';
|
keys.ToggleCrossfade[0] = 'x';
|
||||||
keys.SetCrossfade[0] = 'X';
|
keys.SetCrossfade[0] = 'X';
|
||||||
@@ -67,6 +69,7 @@ void DefaultKeys(ncmpcpp_keys &keys)
|
|||||||
keys.Lyrics[0] = 'l';
|
keys.Lyrics[0] = 'l';
|
||||||
keys.ReverseSelection[0] = 'v';
|
keys.ReverseSelection[0] = 'v';
|
||||||
keys.DeselectAll[0] = 'V';
|
keys.DeselectAll[0] = 'V';
|
||||||
|
keys.AddSelected[0] = 'A';
|
||||||
keys.Clear[0] = 'c';
|
keys.Clear[0] = 'c';
|
||||||
keys.Crop[0] = 'C';
|
keys.Crop[0] = 'C';
|
||||||
keys.MvSongUp[0] = 'm';
|
keys.MvSongUp[0] = 'm';
|
||||||
@@ -90,11 +93,12 @@ void DefaultKeys(ncmpcpp_keys &keys)
|
|||||||
keys.VolumeUp[1] = '+';
|
keys.VolumeUp[1] = '+';
|
||||||
keys.VolumeDown[1] = '-';
|
keys.VolumeDown[1] = '-';
|
||||||
keys.ScreenSwitcher[1] = null_key;
|
keys.ScreenSwitcher[1] = null_key;
|
||||||
keys.Help[1] = null_key;
|
keys.Help[1] = 265;
|
||||||
keys.Playlist[1] = null_key;
|
keys.Playlist[1] = 266;
|
||||||
keys.Browser[1] = null_key;
|
keys.Browser[1] = 267;
|
||||||
keys.SearchEngine[1] = null_key;
|
keys.SearchEngine[1] = 268;
|
||||||
keys.MediaLibrary[1] = null_key;
|
keys.MediaLibrary[1] = 269;
|
||||||
|
keys.PlaylistEditor[1] = 270;
|
||||||
keys.Stop[1] = null_key;
|
keys.Stop[1] = null_key;
|
||||||
keys.Pause[1] = null_key;
|
keys.Pause[1] = null_key;
|
||||||
keys.Next[1] = null_key;
|
keys.Next[1] = null_key;
|
||||||
@@ -104,6 +108,7 @@ void DefaultKeys(ncmpcpp_keys &keys)
|
|||||||
keys.ToggleRepeat[1] = null_key;
|
keys.ToggleRepeat[1] = null_key;
|
||||||
keys.ToggleRepeatOne[1] = null_key;
|
keys.ToggleRepeatOne[1] = null_key;
|
||||||
keys.ToggleRandom[1] = null_key;
|
keys.ToggleRandom[1] = null_key;
|
||||||
|
keys.ToggleSpaceMode[1] = null_key;
|
||||||
keys.Shuffle[1] = null_key;
|
keys.Shuffle[1] = null_key;
|
||||||
keys.ToggleCrossfade[1] = null_key;
|
keys.ToggleCrossfade[1] = null_key;
|
||||||
keys.SetCrossfade[1] = null_key;
|
keys.SetCrossfade[1] = null_key;
|
||||||
@@ -118,6 +123,7 @@ void DefaultKeys(ncmpcpp_keys &keys)
|
|||||||
keys.Lyrics[1] = null_key;
|
keys.Lyrics[1] = null_key;
|
||||||
keys.ReverseSelection[1] = null_key;
|
keys.ReverseSelection[1] = null_key;
|
||||||
keys.DeselectAll[1] = null_key;
|
keys.DeselectAll[1] = null_key;
|
||||||
|
keys.AddSelected[1] = null_key;
|
||||||
keys.Clear[1] = null_key;
|
keys.Clear[1] = null_key;
|
||||||
keys.Crop[1] = null_key;
|
keys.Crop[1] = null_key;
|
||||||
keys.MvSongUp[1] = null_key;
|
keys.MvSongUp[1] = null_key;
|
||||||
@@ -149,13 +155,14 @@ void DefaultConfiguration(ncmpcpp_config &conf)
|
|||||||
conf.main_highlight_color = conf.main_color;
|
conf.main_highlight_color = conf.main_color;
|
||||||
conf.progressbar_color = clDefault;
|
conf.progressbar_color = clDefault;
|
||||||
conf.statusbar_color = clDefault;
|
conf.statusbar_color = clDefault;
|
||||||
conf.library_active_column_color = clRed;
|
conf.active_column_color = clRed;
|
||||||
conf.colors_enabled = true;
|
conf.colors_enabled = true;
|
||||||
conf.header_visibility = true;
|
conf.header_visibility = true;
|
||||||
conf.statusbar_visibility = true;
|
conf.statusbar_visibility = true;
|
||||||
conf.autocenter_mode = false;
|
conf.autocenter_mode = false;
|
||||||
conf.repeat_one_mode = false;
|
conf.repeat_one_mode = false;
|
||||||
conf.wrapped_search = true;
|
conf.wrapped_search = true;
|
||||||
|
conf.space_selects = false;
|
||||||
conf.set_window_title = true;
|
conf.set_window_title = true;
|
||||||
conf.mpd_connection_timeout = 15;
|
conf.mpd_connection_timeout = 15;
|
||||||
conf.crossfade_time = 5;
|
conf.crossfade_time = 5;
|
||||||
@@ -305,6 +312,8 @@ void ReadKeys(ncmpcpp_keys &keys)
|
|||||||
GetKeys(*it, keys.SearchEngine);
|
GetKeys(*it, keys.SearchEngine);
|
||||||
else if (it->find("key_media_library ") != string::npos)
|
else if (it->find("key_media_library ") != string::npos)
|
||||||
GetKeys(*it, keys.MediaLibrary);
|
GetKeys(*it, keys.MediaLibrary);
|
||||||
|
else if (it->find("key_playlist_editor ") != string::npos)
|
||||||
|
GetKeys(*it, keys.PlaylistEditor);
|
||||||
else if (it->find("key_stop ") != string::npos)
|
else if (it->find("key_stop ") != string::npos)
|
||||||
GetKeys(*it, keys.Stop);
|
GetKeys(*it, keys.Stop);
|
||||||
else if (it->find("key_pause ") != string::npos)
|
else if (it->find("key_pause ") != string::npos)
|
||||||
@@ -323,6 +332,8 @@ void ReadKeys(ncmpcpp_keys &keys)
|
|||||||
GetKeys(*it, keys.ToggleRepeatOne);
|
GetKeys(*it, keys.ToggleRepeatOne);
|
||||||
else if (it->find("key_toggle_random ") != string::npos)
|
else if (it->find("key_toggle_random ") != string::npos)
|
||||||
GetKeys(*it, keys.ToggleRandom);
|
GetKeys(*it, keys.ToggleRandom);
|
||||||
|
else if (it->find("key_toggle_space_mode ") != string::npos)
|
||||||
|
GetKeys(*it, keys.ToggleSpaceMode);
|
||||||
else if (it->find("key_shuffle ") != string::npos)
|
else if (it->find("key_shuffle ") != string::npos)
|
||||||
GetKeys(*it, keys.Shuffle);
|
GetKeys(*it, keys.Shuffle);
|
||||||
else if (it->find("key_toggle_crossfade ") != string::npos)
|
else if (it->find("key_toggle_crossfade ") != string::npos)
|
||||||
@@ -351,6 +362,8 @@ void ReadKeys(ncmpcpp_keys &keys)
|
|||||||
GetKeys(*it, keys.ReverseSelection);
|
GetKeys(*it, keys.ReverseSelection);
|
||||||
else if (it->find("key_deselect_all ") != string::npos)
|
else if (it->find("key_deselect_all ") != string::npos)
|
||||||
GetKeys(*it, keys.DeselectAll);
|
GetKeys(*it, keys.DeselectAll);
|
||||||
|
else if (it->find("key_add_selected_items ") != string::npos)
|
||||||
|
GetKeys(*it, keys.AddSelected);
|
||||||
else if (it->find("key_clear ") != string::npos)
|
else if (it->find("key_clear ") != string::npos)
|
||||||
GetKeys(*it, keys.Clear);
|
GetKeys(*it, keys.Clear);
|
||||||
else if (it->find("key_crop ") != string::npos)
|
else if (it->find("key_crop ") != string::npos)
|
||||||
@@ -460,8 +473,10 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
|||||||
conf.autocenter_mode = v == "yes";
|
conf.autocenter_mode = v == "yes";
|
||||||
else if (it->find("repeat_one_mode") != string::npos)
|
else if (it->find("repeat_one_mode") != string::npos)
|
||||||
conf.repeat_one_mode = v == "yes";
|
conf.repeat_one_mode = v == "yes";
|
||||||
else if (it->find("find_mode") != string::npos)
|
else if (it->find("default_find_mode") != string::npos)
|
||||||
conf.wrapped_search = v == "wrapped";
|
conf.wrapped_search = v == "wrapped";
|
||||||
|
else if (it->find("default_space_mode") != string::npos)
|
||||||
|
conf.space_selects = v == "select";
|
||||||
else if (it->find("enable_window_title") != string::npos)
|
else if (it->find("enable_window_title") != string::npos)
|
||||||
conf.set_window_title = v == "yes";
|
conf.set_window_title = v == "yes";
|
||||||
else if (it->find("song_window_title_format") != string::npos)
|
else if (it->find("song_window_title_format") != string::npos)
|
||||||
@@ -514,10 +529,10 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
|||||||
if (!v.empty())
|
if (!v.empty())
|
||||||
conf.statusbar_color = IntoColor(v);
|
conf.statusbar_color = IntoColor(v);
|
||||||
}
|
}
|
||||||
else if (it->find("library_active_column_color") != string::npos)
|
else if (it->find("active_column_color") != string::npos)
|
||||||
{
|
{
|
||||||
if (!v.empty())
|
if (!v.empty())
|
||||||
conf.library_active_column_color = IntoColor(v);
|
conf.active_column_color = IntoColor(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f.close();
|
f.close();
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ struct ncmpcpp_keys
|
|||||||
int Browser[2];
|
int Browser[2];
|
||||||
int SearchEngine[2];
|
int SearchEngine[2];
|
||||||
int MediaLibrary[2];
|
int MediaLibrary[2];
|
||||||
|
int PlaylistEditor[2];
|
||||||
int Stop[2];
|
int Stop[2];
|
||||||
int Pause[2];
|
int Pause[2];
|
||||||
int Next[2];
|
int Next[2];
|
||||||
@@ -55,6 +56,7 @@ struct ncmpcpp_keys
|
|||||||
int ToggleRepeat[2];
|
int ToggleRepeat[2];
|
||||||
int ToggleRepeatOne[2];
|
int ToggleRepeatOne[2];
|
||||||
int ToggleRandom[2];
|
int ToggleRandom[2];
|
||||||
|
int ToggleSpaceMode[2];
|
||||||
int Shuffle[2];
|
int Shuffle[2];
|
||||||
int ToggleCrossfade[2];
|
int ToggleCrossfade[2];
|
||||||
int SetCrossfade[2];
|
int SetCrossfade[2];
|
||||||
@@ -69,6 +71,7 @@ struct ncmpcpp_keys
|
|||||||
int Lyrics[2];
|
int Lyrics[2];
|
||||||
int ReverseSelection[2];
|
int ReverseSelection[2];
|
||||||
int DeselectAll[2];
|
int DeselectAll[2];
|
||||||
|
int AddSelected[2];
|
||||||
int Clear[2];
|
int Clear[2];
|
||||||
int Crop[2];
|
int Crop[2];
|
||||||
int MvSongUp[2];
|
int MvSongUp[2];
|
||||||
@@ -102,7 +105,7 @@ struct ncmpcpp_config
|
|||||||
COLOR main_highlight_color;
|
COLOR main_highlight_color;
|
||||||
COLOR progressbar_color;
|
COLOR progressbar_color;
|
||||||
COLOR statusbar_color;
|
COLOR statusbar_color;
|
||||||
COLOR library_active_column_color;
|
COLOR active_column_color;
|
||||||
|
|
||||||
bool colors_enabled;
|
bool colors_enabled;
|
||||||
bool set_window_title;
|
bool set_window_title;
|
||||||
@@ -111,6 +114,7 @@ struct ncmpcpp_config
|
|||||||
bool autocenter_mode;
|
bool autocenter_mode;
|
||||||
bool repeat_one_mode;
|
bool repeat_one_mode;
|
||||||
bool wrapped_search;
|
bool wrapped_search;
|
||||||
|
bool space_selects;
|
||||||
|
|
||||||
int mpd_connection_timeout;
|
int mpd_connection_timeout;
|
||||||
int crossfade_time;
|
int crossfade_time;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ extern Window *wFooter;
|
|||||||
|
|
||||||
extern SongList vPlaylist;
|
extern SongList vPlaylist;
|
||||||
extern SongList vSearched;
|
extern SongList vSearched;
|
||||||
|
extern SongList vLibSongs;
|
||||||
extern ItemList vBrowser;
|
extern ItemList vBrowser;
|
||||||
|
|
||||||
extern TagList vArtists;
|
extern TagList vArtists;
|
||||||
@@ -71,7 +72,6 @@ extern bool allow_statusbar_unblock;
|
|||||||
extern bool block_progressbar_update;
|
extern bool block_progressbar_update;
|
||||||
extern bool block_statusbar_update;
|
extern bool block_statusbar_update;
|
||||||
extern bool block_playlist_update;
|
extern bool block_playlist_update;
|
||||||
extern bool block_library_update;
|
|
||||||
|
|
||||||
extern bool redraw_me;
|
extern bool redraw_me;
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (current_screen == csSearcher)
|
else if (current_screen == csSearcher)
|
||||||
{
|
{
|
||||||
bool bold = 0;
|
bool bold = 0;
|
||||||
int i = search_engine_static_option;
|
int i = search_engine_static_option;
|
||||||
@@ -261,28 +261,29 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
|
|||||||
bold = 0;
|
bold = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
block_library_update = 0;
|
else if (current_screen == csLibrary)
|
||||||
|
{
|
||||||
|
bool bold = 0;
|
||||||
|
for (int i = 0; i < vLibSongs.size(); i++)
|
||||||
|
{
|
||||||
|
for (SongList::const_iterator it = vPlaylist.begin(); it != vPlaylist.end(); it++)
|
||||||
|
{
|
||||||
|
if ((*it)->GetHash() == vLibSongs[i]->GetHash())
|
||||||
|
{
|
||||||
|
bold = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mLibSongs->BoldOption(i+1, bold);
|
||||||
|
bold = 0;
|
||||||
|
}
|
||||||
|
mLibSongs->Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (changed.Database)
|
if (changed.Database)
|
||||||
{
|
{
|
||||||
GetDirectory(browsed_dir);
|
GetDirectory(browsed_dir);
|
||||||
if (!mLibArtists->Empty())
|
mLibArtists->Clear(0);
|
||||||
{
|
|
||||||
ShowMessage("Updating artists' list...");
|
|
||||||
mLibArtists->Clear(0);
|
|
||||||
vArtists.clear();
|
|
||||||
Mpd->GetArtists(vArtists);
|
|
||||||
sort(vArtists.begin(), vArtists.end(), CaseInsensitiveComparison);
|
|
||||||
for (TagList::const_iterator it = vArtists.begin(); it != vArtists.end(); it++)
|
|
||||||
mLibArtists->AddOption(*it);
|
|
||||||
if (current_screen == csLibrary)
|
|
||||||
{
|
|
||||||
mLibArtists->Hide();
|
|
||||||
mLibArtists->Display();
|
|
||||||
}
|
|
||||||
ShowMessage("List updated!");
|
|
||||||
}
|
|
||||||
block_library_update = 0;
|
|
||||||
}
|
}
|
||||||
if (changed.PlayerState)
|
if (changed.PlayerState)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,6 +49,25 @@ Window::Window(int startx, int starty, int width, int height, string title, COLO
|
|||||||
SetColor(itsColor);
|
SetColor(itsColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Window::Window(const Window &w)
|
||||||
|
{
|
||||||
|
itsWindow = dupwin(w.itsWindow);
|
||||||
|
itsWinBorder = dupwin(w.itsWinBorder);
|
||||||
|
itsStartX = w.itsStartX;
|
||||||
|
itsStartY = w.itsStartY;
|
||||||
|
itsWidth = w.itsWidth;
|
||||||
|
itsHeight = w.itsHeight;
|
||||||
|
BBEnabled = w.BBEnabled;
|
||||||
|
AutoRefreshEnabled = w.AutoRefreshEnabled;
|
||||||
|
itsTitle = w.itsTitle;
|
||||||
|
itsColors = w.itsColors;
|
||||||
|
itsColor = w.itsColor;
|
||||||
|
itsBaseColor = w.itsBaseColor;
|
||||||
|
itsBgColor = w.itsBgColor;
|
||||||
|
itsBaseBgColor = w.itsBaseBgColor;
|
||||||
|
itsBorder = w.itsBorder;
|
||||||
|
}
|
||||||
|
|
||||||
Window::~Window()
|
Window::~Window()
|
||||||
{
|
{
|
||||||
delwin(itsWindow);
|
delwin(itsWindow);
|
||||||
@@ -193,6 +212,7 @@ void Window::show_border() const
|
|||||||
attron(COLOR_PAIR(itsBaseColor));
|
attron(COLOR_PAIR(itsBaseColor));
|
||||||
mvhline(itsStartY-1, itsStartX, 0, itsWidth);
|
mvhline(itsStartY-1, itsStartX, 0, itsWidth);
|
||||||
attron(A_BOLD);
|
attron(A_BOLD);
|
||||||
|
mvhline(itsStartY-2, itsStartX, 32, itsWidth); // clear title line
|
||||||
mvaddstr(itsStartY-2, itsStartX, itsTitle.c_str());
|
mvaddstr(itsStartY-2, itsStartX, itsTitle.c_str());
|
||||||
attroff(COLOR_PAIR(itsBorder) | A_BOLD);
|
attroff(COLOR_PAIR(itsBorder) | A_BOLD);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class Window
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Window(int, int, int, int, string, COLOR, BORDER);
|
Window(int, int, int, int, string, COLOR, BORDER);
|
||||||
|
Window(const Window &);
|
||||||
virtual ~Window();
|
virtual ~Window();
|
||||||
virtual WINDOW *RawWin() { return itsWindow; }
|
virtual WINDOW *RawWin() { return itsWindow; }
|
||||||
virtual void SetColor(COLOR, COLOR = clDefault);
|
virtual void SetColor(COLOR, COLOR = clDefault);
|
||||||
@@ -107,6 +108,7 @@ class Window
|
|||||||
virtual COLOR GetColor() const;
|
virtual COLOR GetColor() const;
|
||||||
virtual BORDER GetBorder() const;
|
virtual BORDER GetBorder() const;
|
||||||
|
|
||||||
|
virtual Window * Clone() { return new Window(*this); }
|
||||||
virtual Window * EmptyClone();
|
virtual Window * EmptyClone();
|
||||||
|
|
||||||
virtual void Go(WHERE) { } // for Menu and Scrollpad class
|
virtual void Go(WHERE) { } // for Menu and Scrollpad class
|
||||||
|
|||||||
Reference in New Issue
Block a user