Qt TAS row selection in work.

This commit is contained in:
mjbudd77 2021-11-06 09:47:03 -04:00
parent 4acf8ab61b
commit b2244b3a0b
2 changed files with 46 additions and 40 deletions

View File

@ -425,20 +425,8 @@ void SELECTION::noteThatItemRangeChanged(int startItem, int endItem, int newValu
}
void SELECTION::noteThatItemChanged(int item, int newValue )
{
int oldValue = 0;
std::map <int, int>::iterator it;
if ( selList.size() > 0 )
{
it = selList.find(item);
if ( it != selList.end() )
{
oldValue = it->second;
}
}
bool ON = !oldValue && newValue;
bool OFF = oldValue && !newValue;
bool ON = newValue;
bool OFF = !newValue;
//if the item is -1, apply the change to all items
if (item == -1)
@ -579,8 +567,11 @@ void SELECTION::clearSingleRowSelection(int index)
if ( it != selList.end() )
{
noteThatItemChanged(index, 1);
it->second = 0;
if ( it->second )
{
noteThatItemChanged(index, 0);
}
selList.erase(it);
}
}
void SELECTION::clearRegionOfRowsSelection(int start, int end)
@ -596,6 +587,7 @@ void SELECTION::clearRegionOfRowsSelection(int start, int end)
{
selList[i] = 0;
}
noteThatItemRangeChanged(start, end, 0);
}
void SELECTION::selectAllRows(void)
@ -610,10 +602,24 @@ void SELECTION::selectAllRows(void)
}
void SELECTION::setRowSelection(int index)
{
noteThatItemChanged(index, 1);
selList[index] = 1;
std::map <int, int>::iterator it;
it = selList.find(index);
if ( it != selList.end() )
{
if ( !it->second )
{
noteThatItemChanged(index, 1);
it->second = 1;
}
}
else
{
noteThatItemChanged(index, 1);
selList[index] = 1;
}
//ListView_SetItemState(pianoRoll.hwndList, index, LVIS_SELECTED, LVIS_SELECTED);
printf("Set Row Selection:%i\n", index);
}
void SELECTION::setRegionOfRowsSelection(int start, int end)
{

View File

@ -11,18 +11,18 @@ typedef std::set<int> RowsSelection;
class SELECTION
{
public:
SELECTION();
void init();
void free();
void reset();
void reset_vars();
void update();
SELECTION(void);
void init(void);
void free(void);
void reset(void);
void reset_vars(void);
void update(void);
void updateSelectionSize();
void updateSelectionSize(void);
void updateHistoryLogSize();
void updateHistoryLogSize(void);
void redrawMarkerData();
void redrawMarkerData(void);
void save(EMUFILE *os, bool really_save = true);
bool load(EMUFILE *is, unsigned int offset);
@ -33,26 +33,26 @@ public:
void noteThatItemRangeChanged(int startItem, int endItem, int newValue);
void noteThatItemChanged(int itemIndex, int value);
void addNewSelectionToHistory();
void addCurrentSelectionToHistory();
void addNewSelectionToHistory(void);
void addCurrentSelectionToHistory(void);
void undo();
void redo();
void undo(void);
void redo(void);
bool isRowSelected(int index);
void clearAllRowsSelection();
void clearAllRowsSelection(void);
void clearSingleRowSelection(int index);
void clearRegionOfRowsSelection(int start, int end);
void selectAllRows();
void selectAllRows(void);
void setRowSelection(int index);
void setRegionOfRowsSelection(int start, int end);
void setRegionOfRowsSelectionUsingPattern(int start, int end);
void selectAllRowsBetweenMarkers();
void selectAllRowsBetweenMarkers(void);
void reselectClipboard();
void reselectClipboard(void);
void transposeVertically(int shift);
@ -62,10 +62,10 @@ public:
void jumpToFrame(int frame);
// getters
int getCurrentRowsSelectionSize();
int getCurrentRowsSelectionBeginning();
int getCurrentRowsSelectionEnd();
RowsSelection* getCopyOfCurrentRowsSelection();
int getCurrentRowsSelectionSize(void);
int getCurrentRowsSelectionBeginning(void);
int getCurrentRowsSelectionEnd(void);
RowsSelection* getCopyOfCurrentRowsSelection(void);
bool mustFindCurrentMarker;
int displayedMarkerNumber;