summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/media_library.cpp44
-rw-r--r--src/playlist_editor.cpp14
-rw-r--r--src/tag_editor.cpp60
3 files changed, 93 insertions, 25 deletions
diff --git a/src/media_library.cpp b/src/media_library.cpp
index fe6be16e..e5924942 100644
--- a/src/media_library.cpp
+++ b/src/media_library.cpp
@@ -410,13 +410,32 @@ void MediaLibrary::SpacePressed()
void MediaLibrary::MouseButtonPressed(MEVENT me)
{
- if (!Tags->empty() && Tags->hasCoords(me.x, me.y))
- {
+ auto tryNextColumn = [this]() -> bool {
+ bool result = true;
+ if (w != Songs)
+ {
+ if (isNextColumnAvailable())
+ NextColumn();
+ else
+ result = false;
+ }
+ return result;
+ };
+ auto tryPreviousColumn = [this]() -> bool {
+ bool result = true;
if (w != Tags)
{
- PrevColumn();
- PrevColumn();
+ if (isPrevColumnAvailable())
+ PrevColumn();
+ else
+ result = false;
}
+ return result;
+ };
+ if (!Tags->empty() && Tags->hasCoords(me.x, me.y))
+ {
+ if (!tryPreviousColumn() || !tryPreviousColumn())
+ return;
if (size_t(me.y) < Tags->size() && (me.bstate & (BUTTON1_PRESSED | BUTTON3_PRESSED)))
{
Tags->Goto(me.y);
@@ -436,7 +455,15 @@ void MediaLibrary::MouseButtonPressed(MEVENT me)
else if (!Albums->empty() && Albums->hasCoords(me.x, me.y))
{
if (w != Albums)
- w == Tags ? NextColumn() : PrevColumn();
+ {
+ bool success;
+ if (w == Tags)
+ success = tryNextColumn();
+ else
+ success = tryPreviousColumn();
+ if (!success)
+ return;
+ }
if (size_t(me.y) < Albums->size() && (me.bstate & (BUTTON1_PRESSED | BUTTON3_PRESSED)))
{
Albums->Goto(me.y);
@@ -454,11 +481,8 @@ void MediaLibrary::MouseButtonPressed(MEVENT me)
}
else if (!Songs->empty() && Songs->hasCoords(me.x, me.y))
{
- if (w != Songs)
- {
- NextColumn();
- NextColumn();
- }
+ if (!tryNextColumn() || !tryNextColumn())
+ return;
if (size_t(me.y) < Songs->size() && (me.bstate & (BUTTON1_PRESSED | BUTTON3_PRESSED)))
{
Songs->Goto(me.y);
diff --git a/src/playlist_editor.cpp b/src/playlist_editor.cpp
index 5db14da4..effc3601 100644
--- a/src/playlist_editor.cpp
+++ b/src/playlist_editor.cpp
@@ -327,7 +327,12 @@ void PlaylistEditor::MouseButtonPressed(MEVENT me)
if (!Playlists->empty() && Playlists->hasCoords(me.x, me.y))
{
if (w != Playlists)
- PrevColumn();
+ {
+ if (isPrevColumnAvailable())
+ PrevColumn();
+ else
+ return;
+ }
if (size_t(me.y) < Playlists->size() && (me.bstate & (BUTTON1_PRESSED | BUTTON3_PRESSED)))
{
Playlists->Goto(me.y);
@@ -346,7 +351,12 @@ void PlaylistEditor::MouseButtonPressed(MEVENT me)
else if (!Content->empty() && Content->hasCoords(me.x, me.y))
{
if (w != Content)
- NextColumn();
+ {
+ if (isNextColumnAvailable())
+ NextColumn();
+ else
+ return;
+ }
if (size_t(me.y) < Content->size() && (me.bstate & (BUTTON1_PRESSED | BUTTON3_PRESSED)))
{
Content->Goto(me.y);
diff --git a/src/tag_editor.cpp b/src/tag_editor.cpp
index 4e401cba..c230f910 100644
--- a/src/tag_editor.cpp
+++ b/src/tag_editor.cpp
@@ -642,6 +642,28 @@ void TagEditor::SpacePressed()
void TagEditor::MouseButtonPressed(MEVENT me)
{
+ auto tryPreviousColumn = [this]() -> bool {
+ bool result = true;
+ if (w != Dirs)
+ {
+ if (isPrevColumnAvailable())
+ PrevColumn();
+ else
+ result = false;
+ }
+ return result;
+ };
+ auto tryNextColumn = [this]() -> bool {
+ bool result = true;
+ if (w != Tags)
+ {
+ if (isNextColumnAvailable())
+ NextColumn();
+ else
+ result = false;
+ }
+ return result;
+ };
if (w == FParserDialog)
{
if (FParserDialog->hasCoords(me.x, me.y))
@@ -661,7 +683,12 @@ void TagEditor::MouseButtonPressed(MEVENT me)
if (FParser->hasCoords(me.x, me.y))
{
if (w != FParser)
- PrevColumn();
+ {
+ if (isPrevColumnAvailable())
+ PrevColumn();
+ else
+ return;
+ }
if (size_t(me.y) < FParser->size() && (me.bstate & (BUTTON1_PRESSED | BUTTON3_PRESSED)))
{
FParser->Goto(me.y);
@@ -674,17 +701,19 @@ void TagEditor::MouseButtonPressed(MEVENT me)
else if (FParserHelper->hasCoords(me.x, me.y))
{
if (w != FParserHelper)
- NextColumn();
+ {
+ if (isNextColumnAvailable())
+ NextColumn();
+ else
+ return;
+ }
ScrollpadMouseButtonPressed(FParserHelper, me);
}
}
else if (!Dirs->empty() && Dirs->hasCoords(me.x, me.y))
{
- if (w != Dirs)
- {
- PrevColumn();
- PrevColumn();
- }
+ if (!tryPreviousColumn() || !tryPreviousColumn())
+ return;
if (size_t(me.y) < Dirs->size() && (me.bstate & (BUTTON1_PRESSED | BUTTON3_PRESSED)))
{
Dirs->Goto(me.y);
@@ -700,7 +729,15 @@ void TagEditor::MouseButtonPressed(MEVENT me)
else if (!TagTypes->empty() && TagTypes->hasCoords(me.x, me.y))
{
if (w != TagTypes)
- w == Dirs ? NextColumn() : PrevColumn();
+ {
+ bool success;
+ if (w == Dirs)
+ success = tryNextColumn();
+ else
+ success = tryPreviousColumn();
+ if (!success)
+ return;
+ }
if (size_t(me.y) < TagTypes->size() && (me.bstate & (BUTTON1_PRESSED | BUTTON3_PRESSED)))
{
if (!TagTypes->Goto(me.y))
@@ -715,11 +752,8 @@ void TagEditor::MouseButtonPressed(MEVENT me)
}
else if (!Tags->empty() && Tags->hasCoords(me.x, me.y))
{
- if (w != Tags)
- {
- NextColumn();
- NextColumn();
- }
+ if (!tryNextColumn() || !tryNextColumn())
+ return;
if (size_t(me.y) < Tags->size() && (me.bstate & (BUTTON1_PRESSED | BUTTON3_PRESSED)))
{
Tags->Goto(me.y);