Eeschema: adjust the working/drawing area size on the page size.
This makes using Scrollbars more easy to use, especially for "small" page sizes like A or B. Note also the working/drawing area size is bigger than the page size (3 times)
This commit is contained in:
parent
73b52f2e23
commit
ab3ff61faa
|
@ -240,6 +240,9 @@ void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
|
|||
|
||||
if( LocalPrjConfigChanged() )
|
||||
m_parent->SaveProjectSettings( false );
|
||||
|
||||
// Call the post processing (if any) after changes
|
||||
m_parent->OnPageSettingsChange();
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
|
|
|
@ -284,6 +284,15 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
GetGalCanvas()->GetView()->UseDrawPriority( true );
|
||||
GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
|
||||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
||||
|
||||
// Set the working/draw area size to display a symbol to a reasonable value:
|
||||
// A 600mm x 600mm with a origin at the area center looks like a large working area
|
||||
double max_size_x = Millimeter2iu( 600 );
|
||||
double max_size_y = Millimeter2iu( 600 );
|
||||
BOX2D bbox;
|
||||
bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
|
||||
bbox.SetSize( max_size_x, max_size_y );
|
||||
GetCanvas()->GetView()->SetBoundary( bbox );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -659,10 +659,6 @@ void SCH_BASE_FRAME::SyncView()
|
|||
auto gal = GetGalCanvas()->GetGAL();
|
||||
|
||||
auto gs = screen->GetGridSize();
|
||||
|
||||
gal->SetGridSize( VECTOR2D( gs.x, gs.y ));
|
||||
|
||||
DBG(printf("SyncView: grid %d %d\n", (int)gs.x, (int)gs.y );)
|
||||
|
||||
GetGalCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
|
||||
}
|
||||
|
|
|
@ -150,12 +150,14 @@ void SCH_DRAW_PANEL::DisplayComponent( const LIB_PART* aComponent )
|
|||
|
||||
}
|
||||
|
||||
|
||||
void SCH_DRAW_PANEL::DisplaySheet( const SCH_SHEET* aSheet )
|
||||
{
|
||||
view()->Clear();
|
||||
view()->DisplaySheet( const_cast<SCH_SHEET*>(aSheet) );
|
||||
}
|
||||
|
||||
|
||||
void SCH_DRAW_PANEL::DisplaySheet( const SCH_SCREEN *aScreen )
|
||||
{
|
||||
view()->Clear();
|
||||
|
@ -164,6 +166,7 @@ void SCH_DRAW_PANEL::DisplaySheet( const SCH_SCREEN *aScreen )
|
|||
view()->DisplaySheet( const_cast<SCH_SCREEN*>( aScreen ) );
|
||||
}
|
||||
|
||||
|
||||
void SCH_DRAW_PANEL::OnShow()
|
||||
{
|
||||
//m_view->RecacheAllItems();
|
||||
|
|
|
@ -1514,6 +1514,13 @@ void SCH_EDIT_FRAME::CommonSettingsChanged()
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnPageSettingsChange()
|
||||
{
|
||||
// Rebuild the sheet view (draw area and any other items):
|
||||
DisplayCurrentSheet();
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::ShowChangedLanguage()
|
||||
{
|
||||
// call my base class
|
||||
|
|
|
@ -636,6 +636,13 @@ public:
|
|||
*/
|
||||
void DisplayCurrentSheet();
|
||||
|
||||
/**
|
||||
* Called when modifying the page settings.
|
||||
* In derived classes it can be used to modify parameters like draw area size,
|
||||
* and any other local parameter related to the page settings.
|
||||
*/
|
||||
void OnPageSettingsChange() override;
|
||||
|
||||
/**
|
||||
* Set or reset the BRIGHTENED of connected objects inside the current sheet,
|
||||
* according to the highlighted net name.
|
||||
|
|
|
@ -47,11 +47,14 @@ SCH_VIEW::SCH_VIEW( bool aIsDynamic, SCH_BASE_FRAME* aFrame ) :
|
|||
{
|
||||
m_frame = aFrame;
|
||||
// Set m_boundary to define the max working area size. The default value
|
||||
// is acceptable for Pcbnew and Gerbview, but too large for Eeschema.
|
||||
// is acceptable for Pcbnew and Gerbview, but too large for Eeschema due to
|
||||
// very different internal units.
|
||||
// So we have to use a smaller value.
|
||||
// A better size could be a size depending on the worksheet size.
|
||||
m_boundary.SetOrigin( -Millimeter2iu( 3200.0 ), -Millimeter2iu( 2000.0 ) );
|
||||
m_boundary.SetSize( Millimeter2iu( 6400.0 ), Millimeter2iu( 4000.0 ) );
|
||||
// A full size = 3 * MAX_PAGE_SIZE_EDITORS_MILS size allows a wide margin
|
||||
// around the worksheet.
|
||||
double max_size = MAX_PAGE_SIZE_EDITORS_MILS * IU_PER_MILS * 3.0;
|
||||
m_boundary.SetOrigin( -max_size/4, -max_size/4 );
|
||||
m_boundary.SetSize( max_size, max_size );
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,9 +63,20 @@ SCH_VIEW::~SCH_VIEW()
|
|||
}
|
||||
|
||||
|
||||
void SCH_VIEW::ResizeSheetWorkingArea( SCH_SCREEN *aScreen )
|
||||
{
|
||||
const PAGE_INFO& page_info = aScreen->GetPageSettings();
|
||||
// A full size = 3 * page size allows a wide margin around the worksheet.
|
||||
// This is useful to have a large working area.
|
||||
double max_size_x = page_info.GetWidthMils() * IU_PER_MILS * 2.0;
|
||||
double max_size_y = page_info.GetHeightMils() * IU_PER_MILS * 2.0;
|
||||
m_boundary.SetOrigin( -max_size_x /4, -max_size_y/4 );
|
||||
m_boundary.SetSize( max_size_x, max_size_y );
|
||||
}
|
||||
|
||||
|
||||
void SCH_VIEW::DisplaySheet( SCH_SCREEN *aScreen )
|
||||
{
|
||||
|
||||
for( auto item = aScreen->GetDrawItems(); item; item = item->Next() )
|
||||
Add( item );
|
||||
|
||||
|
@ -77,6 +91,8 @@ void SCH_VIEW::DisplaySheet( SCH_SCREEN *aScreen )
|
|||
else
|
||||
m_worksheet->SetSheetName( "" );
|
||||
|
||||
ResizeSheetWorkingArea( aScreen );
|
||||
|
||||
m_selectionArea.reset( new KIGFX::PREVIEW::SELECTION_AREA( ) );
|
||||
m_preview.reset( new KIGFX::VIEW_GROUP () );
|
||||
|
||||
|
|
|
@ -78,6 +78,9 @@ public:
|
|||
void DisplaySheet( SCH_SCREEN *aScreen );
|
||||
void DisplayComponent( LIB_PART *aPart );
|
||||
|
||||
// Call it to set new draw area limits (max working and draw area size)
|
||||
void ResizeSheetWorkingArea( SCH_SCREEN *aScreen );
|
||||
|
||||
KIGFX::PREVIEW::SELECTION_AREA* GetSelectionArea() const { return m_selectionArea.get(); }
|
||||
|
||||
KIGFX::VIEW_GROUP* GetPreview() const { return m_preview.get(); }
|
||||
|
|
|
@ -206,6 +206,15 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
|||
GetGalCanvas()->GetViewControls()->SetSnapping( true );
|
||||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
||||
GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
|
||||
|
||||
// Set the working/draw area size to display a symbol to a reasonable value:
|
||||
// A 450mm x 450mm with a origin at the area center looks like a large working area
|
||||
double max_size_x = Millimeter2iu( 450 );
|
||||
double max_size_y = Millimeter2iu( 450 );
|
||||
BOX2D bbox;
|
||||
bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
|
||||
bbox.SetSize( max_size_x, max_size_y );
|
||||
GetCanvas()->GetView()->SetBoundary( bbox );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -749,6 +749,13 @@ public:
|
|||
virtual void ToolOnRightClick( wxCommandEvent& event );
|
||||
void AdjustScrollBars( const wxPoint& aCenterPosition );
|
||||
|
||||
/**
|
||||
* Called when modifying the page settings.
|
||||
* In derived classes it can be used to modify parameters like draw area size,
|
||||
* and any other local parameter related to the page settings.
|
||||
*/
|
||||
virtual void OnPageSettingsChange() {};
|
||||
|
||||
/**
|
||||
* Called when activating the frame.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue