summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2012-09-05 20:52:33 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2012-09-05 20:52:33 +0200
commit10e88ec6b4fb0fb4e42fce8c16dc863999a32f4e (patch)
tree18a552268a80772385810f5eee1da3196f7a1d78 /src
parenteff1d672b93cdb792dd53217d4a99758b5c2032e (diff)
display: pass screen to functions by pointer
Diffstat (limited to 'src')
-rw-r--r--src/actions.cpp13
-rw-r--r--src/display.cpp8
-rw-r--r--src/display.h4
-rw-r--r--src/media_library.cpp2
-rw-r--r--src/playlist.cpp4
-rw-r--r--src/playlist_editor.cpp4
6 files changed, 19 insertions, 16 deletions
diff --git a/src/actions.cpp b/src/actions.cpp
index 20213dc8..57512a27 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -1117,12 +1117,15 @@ void ToggleDisplayMode::Run()
if (Config.columns_in_playlist)
{
- myPlaylist->Items->setItemDisplayer(std::bind(Display::SongsInColumns, _1, *myPlaylist));
- myPlaylist->Items->setTitle(Config.titles_visibility ? Display::Columns(myPlaylist->Items->getWidth()) : "");
+ myPlaylist->Items->setItemDisplayer(std::bind(Display::SongsInColumns, _1, myPlaylist));
+ if (Config.titles_visibility)
+ myPlaylist->Items->setTitle(Display::Columns(myPlaylist->Items->getWidth()));
+ else
+ myPlaylist->Items->setTitle("");
}
else
{
- myPlaylist->Items->setItemDisplayer(std::bind(Display::Songs, _1, *myPlaylist, Config.song_list_format));
+ myPlaylist->Items->setItemDisplayer(std::bind(Display::Songs, _1, myPlaylist, Config.song_list_format));
myPlaylist->Items->setTitle("");
}
}
@@ -1144,9 +1147,9 @@ void ToggleDisplayMode::Run()
Config.columns_in_playlist_editor = !Config.columns_in_playlist_editor;
ShowMessage("Playlist editor display mode: %s", Config.columns_in_playlist_editor ? "Columns" : "Classic");
if (Config.columns_in_playlist_editor)
- myPlaylistEditor->Content->setItemDisplayer(std::bind(Display::SongsInColumns, _1, *myPlaylistEditor));
+ myPlaylistEditor->Content->setItemDisplayer(std::bind(Display::SongsInColumns, _1, myPlaylistEditor));
else
- myPlaylistEditor->Content->setItemDisplayer(std::bind(Display::Songs, _1, *myPlaylistEditor, Config.song_list_format));
+ myPlaylistEditor->Content->setItemDisplayer(std::bind(Display::Songs, _1, myPlaylistEditor, Config.song_list_format));
}
}
diff --git a/src/display.cpp b/src/display.cpp
index 735be5cd..89cbf7b7 100644
--- a/src/display.cpp
+++ b/src/display.cpp
@@ -336,14 +336,14 @@ std::string Display::Columns(size_t list_width)
return result;
}
-void Display::SongsInColumns(NC::Menu<MPD::Song> &menu, HasSongs &screen)
+void Display::SongsInColumns(NC::Menu<MPD::Song> &menu, HasSongs *screen)
{
- showSongsInColumns(menu, menu.drawn()->value(), screen);
+ showSongsInColumns(menu, menu.drawn()->value(), *screen);
}
-void Display::Songs(NC::Menu<MPD::Song> &menu, HasSongs &screen, const std::string &format)
+void Display::Songs(NC::Menu<MPD::Song> &menu, HasSongs *screen, const std::string &format)
{
- showSongs(menu, menu.drawn()->value(), screen, format);
+ showSongs(menu, menu.drawn()->value(), *screen, format);
}
void Display::Tags(NC::Menu<MPD::MutableSong> &menu)
diff --git a/src/display.h b/src/display.h
index b79208cb..948882f5 100644
--- a/src/display.h
+++ b/src/display.h
@@ -40,9 +40,9 @@ namespace Display
menu << menu.drawn()->value().first;
}
- void SongsInColumns(NC::Menu<MPD::Song> &menu, HasSongs &screen);
+ void SongsInColumns(NC::Menu<MPD::Song> &menu, HasSongs *screen);
- void Songs(NC::Menu<MPD::Song> &menu, HasSongs &screen, const std::string &format);
+ void Songs(NC::Menu<MPD::Song> &menu, HasSongs *screen, const std::string &format);
void Tags(NC::Menu<MPD::MutableSong> &menu);
diff --git a/src/media_library.cpp b/src/media_library.cpp
index 8d1979c1..6624be91 100644
--- a/src/media_library.cpp
+++ b/src/media_library.cpp
@@ -107,7 +107,7 @@ void MediaLibrary::Init()
Songs->centeredCursor(Config.centered_cursor);
Songs->setSelectedPrefix(Config.selected_item_prefix);
Songs->setSelectedSuffix(Config.selected_item_suffix);
- Songs->setItemDisplayer(std::bind(Display::Songs, _1, *this, Config.song_library_format));
+ Songs->setItemDisplayer(std::bind(Display::Songs, _1, this, Config.song_library_format));
w = Tags;
isInitialized = 1;
diff --git a/src/playlist.cpp b/src/playlist.cpp
index d04d5ebe..84330095 100644
--- a/src/playlist.cpp
+++ b/src/playlist.cpp
@@ -63,9 +63,9 @@ void Playlist::Init()
Items->setSelectedPrefix(Config.selected_item_prefix);
Items->setSelectedSuffix(Config.selected_item_suffix);
if (Config.columns_in_playlist)
- Items->setItemDisplayer(std::bind(Display::SongsInColumns, _1, *this));
+ Items->setItemDisplayer(std::bind(Display::SongsInColumns, _1, this));
else
- Items->setItemDisplayer(std::bind(Display::Songs, _1, *this, Config.song_list_format));
+ Items->setItemDisplayer(std::bind(Display::Songs, _1, this, Config.song_list_format));
if (!SortDialog)
{
diff --git a/src/playlist_editor.cpp b/src/playlist_editor.cpp
index 47312c83..f3f69264 100644
--- a/src/playlist_editor.cpp
+++ b/src/playlist_editor.cpp
@@ -73,9 +73,9 @@ void PlaylistEditor::Init()
Content->setSelectedPrefix(Config.selected_item_prefix);
Content->setSelectedSuffix(Config.selected_item_suffix);
if (Config.columns_in_playlist_editor)
- Content->setItemDisplayer(std::bind(Display::SongsInColumns, _1, *this));
+ Content->setItemDisplayer(std::bind(Display::SongsInColumns, _1, this));
else
- Content->setItemDisplayer(std::bind(Display::Songs, _1, *this, Config.song_list_format));
+ Content->setItemDisplayer(std::bind(Display::Songs, _1, this, Config.song_list_format));
w = Playlists;
isInitialized = 1;