enhance tged somewhat to attempt to main the scrolled listview position;

82-dvmbridge---implement-notch-filter-for-2175hz-trc-guard-tone
Bryan Biedenkapp 1 year ago
parent a9c75a3101
commit b6191bde56

@ -35,6 +35,44 @@
// Externs
// ---------------------------------------------------------------------------
/**
* bryanb: This is some low-down, dirty, C++ hack-o-ramma.
*/
/**
* @brief Implements RTTI type defining.
* @typedef Tag
*/
template<typename Tag>
struct RTTIResult {
typedef typename Tag::type type;
static type ptr;
};
template<typename Tag>
typename RTTIResult<Tag>::type RTTIResult<Tag>::ptr;
/**
* @brief Implements nasty hack to access private members of a class.
* @typedef Tag
* @typedef TypePtr
*/
template<typename Tag, typename Tag::type TypePtr>
struct HackTheGibson : RTTIResult<Tag> {
/* fill it ... */
struct filler {
filler() { RTTIResult<Tag>::ptr = TypePtr; }
};
static filler fillerObj;
};
template<typename Tag, typename Tag::type TypePtr>
typename HackTheGibson<Tag, TypePtr>::filler HackTheGibson<Tag, TypePtr>::fillerObj;
// ---------------------------------------------------------------------------
// Externs
// ---------------------------------------------------------------------------
/** @brief */
extern std::string g_progExe;
/** @brief */

@ -23,6 +23,11 @@
#include <final/final.h>
using namespace finalcut;
struct PrivateFListViewScrollToY { typedef void(FListView::*type)(int); };
template class HackTheGibson<PrivateFListViewScrollToY, &FListView::scrollToY>;
struct PrivateFListViewIteratorFirst { typedef FListViewIterator FListView::*type; };
template class HackTheGibson<PrivateFListViewIteratorFirst, &FListView::first_visible_line>;
// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------
@ -94,6 +99,15 @@ public:
auto entry = g_tidLookups->groupVoice()[0U];
m_selected = entry;
// bryanb: HACK -- use HackTheGibson to access the private current listview iterator to get the scroll position
/*
* This uses the RTTI hack to access private members on FListView; and this code *could* break as a consequence.
*/
int firstScrollLinePos = 0;
if (m_listView.getCount() > 0) {
firstScrollLinePos = (m_listView.*RTTIResult<PrivateFListViewIteratorFirst>::ptr).getPosition();
}
m_listView.clear();
for (auto entry : g_tidLookups->groupVoice()) {
// pad TGs properly
@ -114,6 +128,16 @@ public:
m_listView.insert(line);
}
// bryanb: HACK -- use HackTheGibson to access the private set scroll Y to set the scroll position
/*
* This uses the RTTI hack to access private members on FListView; and this code *could* break as a consequence.
*/
if (firstScrollLinePos > m_listView.getCount())
firstScrollLinePos = 0;
if (firstScrollLinePos > 0 && m_listView.getCount() > 0) {
(m_listView.*RTTIResult<PrivateFListViewScrollToY>::ptr)(firstScrollLinePos);
}
// generate dialog title
uint32_t len = g_tidLookups->groupVoice().size();
std::stringstream ss;

Loading…
Cancel
Save

Powered by TurnKey Linux.