Allow incrementing different parts of strings with modifiers

Primary increment is the right most bit, secondary is the next
rightmost. So you can increment 'A1' to 'A2' or 'B1' with
Shift-Alt-Scroll and Ctrl-Alt-Scroll respectively.
This commit is contained in:
John Beard
2024-10-26 16:01:07 +08:00
parent 1511f9a43c
commit 2c2ff64911
10 changed files with 476 additions and 77 deletions
+4 -19
View File
@@ -23,6 +23,8 @@
#include <array_axis.h>
#include <increment.h>
/**
* @return False for schemes like 0,1...9,10
@@ -134,26 +136,9 @@ wxString ARRAY_AXIS::GetItemNumber( int n ) const
{
wxString itemNum;
const wxString& alphabet = GetAlphabet();
const bool nonUnitColsStartAt0 = schemeNonUnitColsStartAt0( m_type );
bool firstRound = true;
int radix = alphabet.Length();
const bool nonUnitColsStartAt0 = schemeNonUnitColsStartAt0( m_type );
n = m_offset + m_step * n;
do
{
int modN = n % radix;
if( nonUnitColsStartAt0 && !firstRound )
modN--; // Start the "tens/hundreds/etc column" at "Ax", not "Bx"
itemNum.insert( 0, 1, alphabet[modN] );
n /= radix;
firstRound = false;
} while( n );
return itemNum;
return AlphabeticFromIndex( n, alphabet, nonUnitColsStartAt0 );
}