Eeschema, printing: fix incorrect number of available pages to print.
The page count was incorrect because the new virtual root sheet was counted. Fixes https://gitlab.com/kicad/code/kicad/-/issues/22019
This commit is contained in:
@@ -53,13 +53,13 @@ SCH_PRINTOUT::SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle ) :
|
||||
void SCH_PRINTOUT::GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo )
|
||||
{
|
||||
*minPage = *selPageFrom = 1;
|
||||
*maxPage = *selPageTo = m_parent->Schematic().Root().CountSheets();
|
||||
*maxPage = *selPageTo = m_parent->Schematic().Root().CountActiveSheets();
|
||||
}
|
||||
|
||||
|
||||
bool SCH_PRINTOUT::HasPage( int pageNum )
|
||||
{
|
||||
return m_parent->Schematic().Root().CountSheets() >= pageNum;
|
||||
return m_parent->Schematic().Root().CountActiveSheets() >= pageNum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -850,6 +850,17 @@ int SCH_SHEET::CountSheets() const
|
||||
}
|
||||
|
||||
|
||||
int SCH_SHEET::CountActiveSheets() const
|
||||
{
|
||||
int count = CountSheets();
|
||||
|
||||
if( IsVirtualRootSheet() )
|
||||
count--;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHEET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
|
||||
@@ -316,6 +316,15 @@ public:
|
||||
*/
|
||||
int CountSheets() const;
|
||||
|
||||
/**
|
||||
* Count the number of sheets found in "this" sheet including all of the subsheets.
|
||||
*
|
||||
* @return the full count of active sheets+subsheets contained by "this"
|
||||
* An active sheet is a "physical" sheet actually used in schematic, and not a virtual sheet only
|
||||
* used to handle a set of sheets in a hierarchy and having no UUID
|
||||
*/
|
||||
int CountActiveSheets() const;
|
||||
|
||||
/**
|
||||
* Count the number of sheets that refer to a specific file
|
||||
* including all of the subsheets.
|
||||
|
||||
Reference in New Issue
Block a user