'go to dir containing found item' function added

This commit is contained in:
unK
2008-09-02 04:14:36 +02:00
parent a37882f62a
commit 2f4463080a
4 changed files with 20 additions and 1 deletions

View File

@@ -115,6 +115,8 @@
# #
#key_toggle_auto_center = 'U' #key_toggle_auto_center = 'U'
# #
#key_go_to_containing_directory = 'G'
#
#key_go_to_parent_dir = 263 127 #key_go_to_parent_dir = 263 127
# #
#key_quit = 'q' 'Q' #key_quit = 'q' 'Q'

View File

@@ -295,7 +295,8 @@ int main(int argc, char *argv[])
sHelp->Add(" [b]Keys - Search engine\n -----------------------------------------[/b]\n"); sHelp->Add(" [b]Keys - Search engine\n -----------------------------------------[/b]\n");
sHelp->Add(DisplayKeys(Key.Enter) + "Add item to playlist and play/change option\n"); sHelp->Add(DisplayKeys(Key.Enter) + "Add item to playlist and play/change option\n");
sHelp->Add(DisplayKeys(Key.Space) + "Add item to playlist\n\n\n"); sHelp->Add(DisplayKeys(Key.Space) + "Add item to playlist\n");
sHelp->Add(DisplayKeys(Key.GoToContainingDir) + "Go to directory containing found item\n\n\n");
sHelp->Add(" [b]Keys - Media library\n -----------------------------------------[/b]\n"); sHelp->Add(" [b]Keys - Media library\n -----------------------------------------[/b]\n");
sHelp->Add(DisplayKeys(&Key.VolumeDown[0], 1) + "Previous column\n"); sHelp->Add(DisplayKeys(&Key.VolumeDown[0], 1) + "Previous column\n");
@@ -1836,6 +1837,17 @@ int main(int argc, char *argv[])
ShowMessage("Cannot read file!"); ShowMessage("Cannot read file!");
} }
} }
else if (Keypressed(input, Key.GoToContainingDir))
{
if (wCurrent == mSearcher && !vSearched.empty() && mSearcher->GetChoice() > search_engine_static_option)
{
GetDirectory(vSearched[mSearcher->GetChoice()-search_engine_static_option-1]->GetDirectory());
for (int i = 1; i < mBrowser->MaxChoice(); i++)
if (mSearcher->GetCurrentOption() == mBrowser->GetOption(i))
mBrowser->Highlight(i);
goto SWITCHER_BROWSER_REDIRECT;
}
}
else if (Keypressed(input, Key.GoToPosition)) else if (Keypressed(input, Key.GoToPosition))
{ {
if (now_playing < 0) if (now_playing < 0)

View File

@@ -77,6 +77,7 @@ void DefaultKeys(ncmpcpp_keys &keys)
keys.Add[0] = 'a'; keys.Add[0] = 'a';
keys.SavePlaylist[0] = 'S'; keys.SavePlaylist[0] = 'S';
keys.GoToNowPlaying[0] = 'o'; keys.GoToNowPlaying[0] = 'o';
keys.GoToContainingDir[0] = 'G';
keys.ToggleAutoCenter[0] = 'U'; keys.ToggleAutoCenter[0] = 'U';
keys.GoToParentDir[0] = 263; keys.GoToParentDir[0] = 263;
keys.Quit[0] = 'q'; keys.Quit[0] = 'q';
@@ -131,6 +132,7 @@ void DefaultKeys(ncmpcpp_keys &keys)
keys.Add[1] = null_key; keys.Add[1] = null_key;
keys.SavePlaylist[1] = null_key; keys.SavePlaylist[1] = null_key;
keys.GoToNowPlaying[1] = null_key; keys.GoToNowPlaying[1] = null_key;
keys.GoToContainingDir[1] = null_key;
keys.ToggleAutoCenter[1] = null_key; keys.ToggleAutoCenter[1] = null_key;
keys.GoToParentDir[1] = 127; keys.GoToParentDir[1] = 127;
keys.Quit[1] = 'Q'; keys.Quit[1] = 'Q';
@@ -380,6 +382,8 @@ void ReadKeys(ncmpcpp_keys &keys)
GetKeys(*it, keys.GoToNowPlaying); GetKeys(*it, keys.GoToNowPlaying);
else if (it->find("key_toggle_auto_center ") != string::npos) else if (it->find("key_toggle_auto_center ") != string::npos)
GetKeys(*it, keys.ToggleAutoCenter); GetKeys(*it, keys.ToggleAutoCenter);
else if (it->find("key_go_to_containing_directory ") != string::npos)
GetKeys(*it, keys.GoToContainingDir);
else if (it->find("key_go_to_parent_dir ") != string::npos) else if (it->find("key_go_to_parent_dir ") != string::npos)
GetKeys(*it, keys.GoToParentDir); GetKeys(*it, keys.GoToParentDir);
else if (it->find("key_quit ") != string::npos) else if (it->find("key_quit ") != string::npos)

View File

@@ -79,6 +79,7 @@ struct ncmpcpp_keys
int Add[2]; int Add[2];
int SavePlaylist[2]; int SavePlaylist[2];
int GoToNowPlaying[2]; int GoToNowPlaying[2];
int GoToContainingDir[2];
int ToggleAutoCenter[2]; int ToggleAutoCenter[2];
int GoToParentDir[2]; int GoToParentDir[2];
int Quit[2]; int Quit[2];