Pcbnew: ignore start values in "first available" grid numbering
The using the "first available" numbering option, force an artifical linear numbering scheme starting at '1'. Start the pad name provider at the 0'th pad index. Also adds a few related tests and adjusts tests affected by this change to reflect that the offset still applies. This can be expanded in future to be more general by skipping pad (which would allow a custom start and numbering scheme while still avoiding duplication), but for now, this does what the UI says and avoids string changes in 5.1rc. Fixes: lp:1814918 * https://bugs.launchpad.net/kicad/+bug/1814918 Fixes: lp:1814917 * https://bugs.launchpad.net/kicad/+bug/1814917
This commit is contained in:
@@ -397,6 +397,7 @@ struct GRID_ARRAY_NAMING_PARAMS
|
||||
std::string m_start_at_x;
|
||||
std::string m_start_at_y;
|
||||
bool m_2d_numbering;
|
||||
bool m_h_then_v;
|
||||
int m_nx;
|
||||
int m_ny;
|
||||
};
|
||||
@@ -420,20 +421,54 @@ static const std::vector<GRID_ARRAY_NAMING_CASE> grid_name_cases = {
|
||||
"1",
|
||||
"2",
|
||||
false,
|
||||
false, // doesn't matter
|
||||
2,
|
||||
3,
|
||||
},
|
||||
{ "1", "2", "3", "4", "5", "6" },
|
||||
},
|
||||
{
|
||||
// Tests a 2d grid
|
||||
"2D grid A1",
|
||||
{
|
||||
ARRAY_OPTIONS::NUMBERING_TYPE_T::NUMBERING_ALPHA_FULL,
|
||||
ARRAY_OPTIONS::NUMBERING_TYPE_T::NUMBERING_NUMERIC,
|
||||
"A",
|
||||
"1",
|
||||
true,
|
||||
true,
|
||||
2,
|
||||
3,
|
||||
},
|
||||
{ "A1", "B1", "A2", "B2", "A3", "B3" },
|
||||
},
|
||||
{
|
||||
// Tests a 2d grid
|
||||
"2D grid 11",
|
||||
{
|
||||
ARRAY_OPTIONS::NUMBERING_TYPE_T::NUMBERING_NUMERIC,
|
||||
ARRAY_OPTIONS::NUMBERING_TYPE_T::NUMBERING_NUMERIC,
|
||||
"1",
|
||||
"1",
|
||||
true,
|
||||
false,
|
||||
2,
|
||||
3,
|
||||
},
|
||||
// moving down the "long axis" first
|
||||
// so the first coordinate has a range of 1-3, the second 1-2
|
||||
{ "11", "21", "31", "12", "22", "32" },
|
||||
},
|
||||
{
|
||||
// Tests a 2d grid, with different types and offsets (and alphabet wrap)
|
||||
"2D grid",
|
||||
"2D grid offsets",
|
||||
{
|
||||
ARRAY_OPTIONS::NUMBERING_TYPE_T::NUMBERING_NUMERIC,
|
||||
ARRAY_OPTIONS::NUMBERING_TYPE_T::NUMBERING_ALPHA_FULL,
|
||||
"5",
|
||||
"Z",
|
||||
true,
|
||||
true,
|
||||
2,
|
||||
3,
|
||||
},
|
||||
@@ -457,6 +492,8 @@ BOOST_AUTO_TEST_CASE( GridNaming )
|
||||
grid_opts.m_nx = c.m_prms.m_nx;
|
||||
grid_opts.m_ny = c.m_prms.m_ny;
|
||||
|
||||
grid_opts.m_horizontalThenVertical = c.m_prms.m_h_then_v;
|
||||
|
||||
ARRAY_OPTIONS::GetNumberingOffset(
|
||||
c.m_prms.m_start_at_x, c.m_prms.m_pri_type, grid_opts.m_numberingOffsetX );
|
||||
ARRAY_OPTIONS::GetNumberingOffset(
|
||||
|
||||
Reference in New Issue
Block a user