--User changes

-Make Shift+F keys select the flames in the file, and Shift +/- cycle through them.
This commit is contained in:
Person 2021-03-08 08:20:35 -07:00
parent 6156036370
commit 897ccdd375
4 changed files with 55 additions and 12 deletions

View File

@ -589,6 +589,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember,
#else
os <<
"\n"
" firstPoint = secondPoint;\n";//For testing, using straight rand flam4/fractron style instead of cuburn.
#endif
os <<

View File

@ -372,6 +372,8 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
static int commacount = 0;
static int periodcount = 0;
static int lcount = 0;
const bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
const bool ctrl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
if (o == ui.GLParentScrollArea && e->type() == QEvent::Resize)
{
@ -393,7 +395,12 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
{
const int val = ke->key() - (int)Qt::Key_F1;
if (val < combo->count())
if (shift)
{
if (val < ui.LibraryTree->topLevelItem(0)->childCount())
m_Controller->SetEmber(val, true);
}
else if (val < combo->count())
combo->setCurrentIndex(val);
fcount = 0;
@ -407,7 +414,7 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
//Require shift for deleting to prevent it from triggering when the user enters delete in the edit box.
if (ke->key() == Qt::Key_Delete && e->type() == QEvent::KeyRelease && shift)
{
auto v = GetCurrentEmberIndex();
auto v = GetCurrentEmberIndex(false);
if (ui.LibraryTree->topLevelItem(0)->childCount() > 1)
OnDelete(v);
@ -428,16 +435,26 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
!focusedctrlCombo &&
!QGuiApplication::keyboardModifiers().testFlag(Qt::AltModifier))//Must exclude these because otherwise, typing a minus key in any of the spinners will switch the xform. Also exclude alt.
{
unsigned int index = combo->currentIndex();
unsigned int index;
double vdist = 0.01;
double hdist = 0.01;
double zoom = 1;
double rot = 1;
double grow = 0.01;
const bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
const bool ctrl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
bool pre = true;
if (shift)
{
auto v = GetCurrentEmberIndex(true);
if (v.size() > 0)
index = v[0].first;
else
index = 0;
}
else
index = combo->currentIndex();
if (const auto r = m_Controller->Renderer())
{
hdist = std::abs(r->UpperRightX() - r->LowerLeftX()) * 0.01 * m_Controller->AffineScaleLockedToCurrent();
@ -471,7 +488,12 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
if (xfupcount >= times)
{
xfupcount = 0;
combo->setCurrentIndex((index + 1) % combo->count());
if (shift)
m_Controller->SetEmber((index + 1) % ui.LibraryTree->topLevelItem(0)->childCount(), true);
else
combo->setCurrentIndex((index + 1) % combo->count());
//qDebug() << "global arrow plus key press: " << ke->key() << " " << o->metaObject()->className() << " " << o->objectName();
}
@ -485,10 +507,21 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
{
xfdncount = 0;
if (index == 0)
index = combo->count();
if (shift)
{
if (index == 0)
index = ui.LibraryTree->topLevelItem(0)->childCount();
m_Controller->SetEmber((index - 1) % ui.LibraryTree->topLevelItem(0)->childCount(), true);
}
else
{
if (index == 0)
index = combo->count();
combo->setCurrentIndex((index - 1) % combo->count());
}
combo->setCurrentIndex((index - 1) % combo->count());
//qDebug() << "global arrow minus key press: " << ke->key() << " " << o->metaObject()->className() << " " << o->objectName();
}

View File

@ -436,7 +436,7 @@ private:
//Library.
void SelectLibraryItem(size_t index);
vector<pair<size_t, QTreeWidgetItem*>> GetCurrentEmberIndex();
vector<pair<size_t, QTreeWidgetItem*>> GetCurrentEmberIndex(bool isChecked);
void SyncSequenceSettings();
//Params.

View File

@ -85,8 +85,9 @@ void Fractorium::SelectLibraryItem(size_t index)
/// <summary>
/// Get the index of the currently selected ember in the library tree.
/// </summary>
/// <param name="isChecked">Whether to search for items that are checked or items that are only selected</param>
/// <returns>A pair containing the index of the item clicked and a pointer to the item</param>
vector<pair<size_t, QTreeWidgetItem*>> Fractorium::GetCurrentEmberIndex()
vector<pair<size_t, QTreeWidgetItem*>> Fractorium::GetCurrentEmberIndex(bool isChecked)
{
int index = 0;
QTreeWidgetItem* item = nullptr;
@ -100,7 +101,15 @@ vector<pair<size_t, QTreeWidgetItem*>> Fractorium::GetCurrentEmberIndex()
item = top->child(index);
if (item && item->isSelected())
v.push_back(make_pair(index, item));
{
if (isChecked)
{
if (item->checkState(0) == Qt::Checked)
v.push_back(make_pair(index, item));
}
else
v.push_back(make_pair(index, item));
}
index++;
}