commit edcb162245fcd6185961fddd45825feb6ec5ba6c
parent 1f572f8f999a3a45df88a171599a231b74a90c85
Author: cfillion <cfillion@users.noreply.github.com>
Date: Wed, 18 Jan 2017 00:58:56 -0500
browser: add ellipsis on the pkg count button to hint at its menu (#18)
also removes number formating which was ugly and, on macOS, inconsistent
(one worked when REAPER was ran from the terminal)
closes #18
Diffstat:
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/src/browser.cpp b/src/browser.cpp
@@ -27,10 +27,7 @@
#include "resource.hpp"
#include "transaction.hpp"
-#include <boost/algorithm/string.hpp>
#include <boost/range/adaptor/reversed.hpp>
-#include <locale>
-#include <sstream>
using namespace std;
@@ -410,15 +407,12 @@ void Browser::fillMenu(Menu &menu)
void Browser::updateDisplayLabel()
{
- basic_ostringstream<auto_char> btnLabel;
- btnLabel.imbue(locale("")); // enable number formatting
- btnLabel << m_list->rowCount() << AUTO_STR('/') << m_entries.size()
- << AUTO_STR(" package");
+ auto_char btnLabel[32] = {};
+ auto_snprintf(btnLabel, auto_size(btnLabel), AUTO_STR("%d/%zu package%s..."),
+ m_list->rowCount(), m_entries.size(),
+ m_entries.size() == 1 ? AUTO_STR("") : AUTO_STR("s"));
- if(m_entries.size() != 1)
- btnLabel << AUTO_STR('s');
-
- SetWindowText(m_displayBtn, btnLabel.str().c_str());
+ SetWindowText(m_displayBtn, btnLabel);
}
void Browser::displayButton()