menu: get rid of RealChoice
This commit is contained in:
14
src/menu.h
14
src/menu.h
@@ -337,11 +337,6 @@ template <typename T> struct Menu : public Window, public List
|
|||||||
///
|
///
|
||||||
size_t Choice() const;
|
size_t Choice() const;
|
||||||
|
|
||||||
/// @return real current positions, i.e it doesn't
|
|
||||||
/// count positions that are static or separators
|
|
||||||
///
|
|
||||||
size_t RealChoice() const;
|
|
||||||
|
|
||||||
/// Searches the list for a given contraint. It uses ItemStringifier to convert stored items
|
/// Searches the list for a given contraint. It uses ItemStringifier to convert stored items
|
||||||
/// into strings and then performs pattern matching. Note that this supports regular expressions.
|
/// into strings and then performs pattern matching. Note that this supports regular expressions.
|
||||||
/// @param constraint a search constraint to be used
|
/// @param constraint a search constraint to be used
|
||||||
@@ -931,15 +926,6 @@ template <typename T> size_t Menu<T>::Choice() const
|
|||||||
return m_highlight;
|
return m_highlight;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> size_t Menu<T>::RealChoice() const
|
|
||||||
{
|
|
||||||
size_t result = 0;
|
|
||||||
for (auto it = m_options_ptr->begin(); it != m_options_ptr->begin()+m_highlight; ++it)
|
|
||||||
if (!(*it)->isInactive())
|
|
||||||
result++;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> void Menu<T>::ReverseSelection(size_t beginning)
|
template <typename T> void Menu<T>::ReverseSelection(size_t beginning)
|
||||||
{
|
{
|
||||||
auto it = m_options_ptr->begin()+beginning;
|
auto it = m_options_ptr->begin()+beginning;
|
||||||
|
|||||||
@@ -348,8 +348,8 @@ void TagEditor::EnterPressed()
|
|||||||
}
|
}
|
||||||
else if (w == FParserDialog)
|
else if (w == FParserDialog)
|
||||||
{
|
{
|
||||||
size_t choice = FParserDialog->RealChoice();
|
size_t choice = FParserDialog->Choice();
|
||||||
if (choice == 2) // cancel
|
if (choice == 3) // cancel
|
||||||
{
|
{
|
||||||
w = TagTypes;
|
w = TagTypes;
|
||||||
Refresh();
|
Refresh();
|
||||||
@@ -404,9 +404,9 @@ void TagEditor::EnterPressed()
|
|||||||
else if (w == FParser)
|
else if (w == FParser)
|
||||||
{
|
{
|
||||||
bool quit = 0;
|
bool quit = 0;
|
||||||
size_t pos = FParser->RealChoice();
|
size_t pos = FParser->Choice();
|
||||||
|
|
||||||
if (pos == 3) // save
|
if (pos == 4) // save
|
||||||
FParserUsePreview = 0;
|
FParserUsePreview = 0;
|
||||||
|
|
||||||
if (pos == 0) // change pattern
|
if (pos == 0) // change pattern
|
||||||
@@ -422,7 +422,7 @@ void TagEditor::EnterPressed()
|
|||||||
FParser->at(0).value() += Config.pattern;
|
FParser->at(0).value() += Config.pattern;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pos == 1 || pos == 3) // preview or proceed
|
else if (pos == 1 || pos == 4) // preview or proceed
|
||||||
{
|
{
|
||||||
bool success = 1;
|
bool success = 1;
|
||||||
ShowMessage("Parsing...");
|
ShowMessage("Parsing...");
|
||||||
@@ -476,7 +476,7 @@ void TagEditor::EnterPressed()
|
|||||||
Patterns.insert(Patterns.begin(), Config.pattern);
|
Patterns.insert(Patterns.begin(), Config.pattern);
|
||||||
quit = 1;
|
quit = 1;
|
||||||
}
|
}
|
||||||
if (pos != 3 || success)
|
if (pos != 4 || success)
|
||||||
ShowMessage("Operation finished");
|
ShowMessage("Operation finished");
|
||||||
}
|
}
|
||||||
else if (pos == 2) // show legend
|
else if (pos == 2) // show legend
|
||||||
@@ -484,7 +484,7 @@ void TagEditor::EnterPressed()
|
|||||||
FParserHelper = FParserLegend;
|
FParserHelper = FParserLegend;
|
||||||
FParserHelper->Display();
|
FParserHelper->Display();
|
||||||
}
|
}
|
||||||
else if (pos == 4) // cancel
|
else if (pos == 5) // cancel
|
||||||
{
|
{
|
||||||
quit = 1;
|
quit = 1;
|
||||||
}
|
}
|
||||||
@@ -518,7 +518,7 @@ void TagEditor::EnterPressed()
|
|||||||
for (size_t i = 0; i < Tags->Size(); ++i)
|
for (size_t i = 0; i < Tags->Size(); ++i)
|
||||||
EditedSongs.push_back(&(*Tags)[i].value());
|
EditedSongs.push_back(&(*Tags)[i].value());
|
||||||
|
|
||||||
size_t id = TagTypes->RealChoice();
|
size_t id = TagTypes->Choice();
|
||||||
|
|
||||||
if (w == TagTypes && id == 5)
|
if (w == TagTypes && id == 5)
|
||||||
{
|
{
|
||||||
@@ -566,7 +566,7 @@ void TagEditor::EnterPressed()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (id == 11) // filename related options
|
if (id == 12) // filename related options
|
||||||
{
|
{
|
||||||
if (w == TagTypes)
|
if (w == TagTypes)
|
||||||
{
|
{
|
||||||
@@ -594,26 +594,26 @@ void TagEditor::EnterPressed()
|
|||||||
Tags->Scroll(wDown);
|
Tags->Scroll(wDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (id == 12) // capitalize first letters
|
else if (id == 16) // capitalize first letters
|
||||||
{
|
{
|
||||||
ShowMessage("Processing...");
|
ShowMessage("Processing...");
|
||||||
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
||||||
CapitalizeFirstLetters(**it);
|
CapitalizeFirstLetters(**it);
|
||||||
ShowMessage("Done");
|
ShowMessage("Done");
|
||||||
}
|
}
|
||||||
else if (id == 13) // lower all letters
|
else if (id == 17) // lower all letters
|
||||||
{
|
{
|
||||||
ShowMessage("Processing...");
|
ShowMessage("Processing...");
|
||||||
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
||||||
LowerAllLetters(**it);
|
LowerAllLetters(**it);
|
||||||
ShowMessage("Done");
|
ShowMessage("Done");
|
||||||
}
|
}
|
||||||
else if (id == 14) // reset
|
else if (id == 18) // reset
|
||||||
{
|
{
|
||||||
Tags->Clear();
|
Tags->Clear();
|
||||||
ShowMessage("Changes reset");
|
ShowMessage("Changes reset");
|
||||||
}
|
}
|
||||||
else if (id == 15) // save
|
else if (id == 19) // save
|
||||||
{
|
{
|
||||||
bool success = 1;
|
bool success = 1;
|
||||||
ShowMessage("Writing changes...");
|
ShowMessage("Writing changes...");
|
||||||
|
|||||||
Reference in New Issue
Block a user