MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / LoadState

Method LoadState

Source/UIGrid.cpp:567–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565}
566
567void UIGrid::LoadState(FileStreamIn& in, bool shouldSetValue)
568{
569 int rev;
570 in >> rev;
571 LoadStateValidate(rev <= kSaveStateRev);
572
573 int cols;
574 int rows;
575
576 if (rev < 1)
577 {
578 cols = 100;
579 rows = 100;
580 }
581 else if (rev == 1)
582 {
583 cols = 128;
584 rows = 128;
585 }
586 else
587 {
588 in >> mCols;
589 in >> mRows;
590 cols = mCols;
591 rows = mRows;
592 }
593
594 for (int col = 0; col < cols; ++col)
595 {
596 for (int row = 0; row < rows; ++row)
597 {
598 int dataIndex;
599 if (rev < 2)
600 dataIndex = GetDataIndex(row, col);
601 else
602 dataIndex = GetDataIndex(col, row);
603 float oldVal = mData[dataIndex];
604 in >> mData[dataIndex];
605 if (mListener)
606 mListener->GridUpdated(this, col, row, mData[dataIndex], oldVal);
607 }
608 }
609}

Callers

nothing calls this directly

Calls 2

LoadStateValidateFunction · 0.85
GridUpdatedMethod · 0.45

Tested by

no test coverage detected