fix problem with eeschema print dialog showing up on missing monitor
This commit is contained in:
parent
6bb2fce7d9
commit
367bfb4e14
|
@ -83,11 +83,11 @@ else (KICAD_STABLE_VERSION )
|
|||
endif(KICAD_STABLE_VERSION )
|
||||
|
||||
# Nanometers must be enabled when USE_PCBNEW_SEXPR_FILE_FORMAT=ON.
|
||||
#if( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
|
||||
# set( TMP "The Pcbnew s-expression file format requires nano-meter internal units to be " )
|
||||
# set( TMP "${TMP} enabled using -DUSE_PCBNEW_NANOMETRES=ON." )
|
||||
# message( FATAL_ERROR ${TMP} )
|
||||
#endif( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
|
||||
if( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
|
||||
set( TMP "The Pcbnew s-expression file format requires nano-meter internal units to be " )
|
||||
set( TMP "${TMP} enabled using -DUSE_PCBNEW_NANOMETRES=ON." )
|
||||
message( FATAL_ERROR ${TMP} )
|
||||
endif( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
|
||||
|
||||
#================================================
|
||||
# Set flags for GCC.
|
||||
|
|
|
@ -119,7 +119,7 @@ bool BASE_SCREEN::SetZoom( double iu_per_du )
|
|||
if( iu_per_du == m_Zoom )
|
||||
return false;
|
||||
|
||||
wxLogDebug( "Zoom:%.16g 1/Zoom:%.16g", iu_per_du, 1/iu_per_du );
|
||||
//wxLogDebug( "Zoom:%.16g 1/Zoom:%.16g", iu_per_du, 1/iu_per_du );
|
||||
|
||||
if( iu_per_du < GetMinAllowedZoom() )
|
||||
return false;
|
||||
|
|
|
@ -62,23 +62,41 @@ public:
|
|||
return ( DIALOG_PRINT_USING_PRINTER* )wxWindow::GetParent();
|
||||
}
|
||||
|
||||
void OnCloseWindow( wxCloseEvent& event )
|
||||
bool Show( bool show ) // overload
|
||||
{
|
||||
if( !IsIconized() )
|
||||
{
|
||||
GetParent()->GetParent()->SetPreviewPosition( GetPosition() );
|
||||
GetParent()->GetParent()->SetPreviewSize( GetSize() );
|
||||
}
|
||||
bool ret;
|
||||
|
||||
wxPreviewFrame::OnCloseWindow( event );
|
||||
// Show or hide the window. If hiding, save current position and size.
|
||||
// If showing, use previous position and size.
|
||||
if( show )
|
||||
{
|
||||
ret = wxPreviewFrame::Show( show );
|
||||
|
||||
if( s_size.x != 0 && s_size.y != 0 )
|
||||
SetSize( s_pos.x, s_pos.y, s_size.x, s_size.y, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save the dialog's position & size before hiding
|
||||
s_size = GetSize();
|
||||
s_pos = GetPosition();
|
||||
|
||||
ret = wxPreviewFrame::Show( show );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private:
|
||||
static wxPoint s_pos;
|
||||
static wxSize s_size;
|
||||
|
||||
DECLARE_CLASS( SCH_PREVIEW_FRAME )
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_NO_COPY_CLASS( SCH_PREVIEW_FRAME )
|
||||
};
|
||||
|
||||
wxPoint SCH_PREVIEW_FRAME::s_pos;
|
||||
wxSize SCH_PREVIEW_FRAME::s_size;
|
||||
|
||||
IMPLEMENT_CLASS( SCH_PREVIEW_FRAME, wxPreviewFrame )
|
||||
|
||||
|
@ -133,6 +151,15 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
|||
if ( GetSizer() )
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
#if 0
|
||||
Does not work on a two monitor system when the 2nd monitor is not attached,
|
||||
and when the coords were saved to disk when the playground was bigger while the
|
||||
2nd monitor was attached.
|
||||
|
||||
Simply rely on the policy in class DIALOG_SHIM, which centers the dialog
|
||||
initially during a runtime session but gives user the ability to move it in
|
||||
that session.
|
||||
|
||||
if( parent->GetPrintDialogPosition() == wxDefaultPosition &&
|
||||
parent->GetPrintDialogSize() == wxDefaultSize )
|
||||
{
|
||||
|
@ -143,12 +170,18 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
|||
SetPosition( parent->GetPrintDialogPosition() );
|
||||
SetSize( parent->GetPrintDialogSize() );
|
||||
}
|
||||
#else
|
||||
// This dialog may get moved and resized in Show(), but in case this is
|
||||
// the first time, center it for starters.
|
||||
Center();
|
||||
#endif
|
||||
|
||||
SetFocus();
|
||||
|
||||
m_buttonPrint->SetDefault();
|
||||
m_buttonPrint->SetDefault(); // on linux, this is inadequate to determine
|
||||
// what ENTER does. Must also SetFocus().
|
||||
m_buttonPrint->SetFocus();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_USING_PRINTER::GetPrintOptions()
|
||||
{
|
||||
SCH_EDIT_FRAME* parent = GetParent();
|
||||
|
@ -210,9 +243,13 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
|||
|
||||
preview->SetZoom( 100 );
|
||||
|
||||
SCH_PREVIEW_FRAME* frame = new SCH_PREVIEW_FRAME( preview, this, title,
|
||||
parent->GetPreviewPosition(),
|
||||
parent->GetPreviewSize() );
|
||||
SCH_PREVIEW_FRAME* frame = new SCH_PREVIEW_FRAME( preview, this, title );
|
||||
|
||||
// on first invocation in this runtime session, set to 2/3 size of my parent,
|
||||
// but will be changed in Show() if not first time as will position.
|
||||
frame->SetSize( (2 * parent->GetSize()) / 3 );
|
||||
frame->Center();
|
||||
|
||||
frame->Initialize();
|
||||
frame->Show( true );
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Mar 17 2012)
|
||||
// C++ code generated with wxFormBuilder (version Apr 11 2012)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
|
||||
|
||||
|
|
|
@ -25,62 +25,28 @@
|
|||
<property name="use_enum">1</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center"></property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">DIALOG_PRINT_USING_PRINTER_BASE</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size">388,185</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Print</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
|
@ -188,10 +154,6 @@
|
|||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Mar 17 2012)
|
||||
// C++ code generated with wxFormBuilder (version Apr 11 2012)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -11,6 +11,7 @@
|
|||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
|
@ -27,7 +28,7 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_PRINT_USING_PRINTER_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_PRINT_USING_PRINTER_BASE : public wxDialog
|
||||
class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ static inline const char* ShowHorizJustify( EDA_TEXT_HJUSTIFY_T horizontal )
|
|||
return rs;
|
||||
}
|
||||
|
||||
static inline EDA_TEXT_HJUSTIFY_T HorizJustify( const char* horizontal )
|
||||
static EDA_TEXT_HJUSTIFY_T horizJustify( const char* horizontal )
|
||||
{
|
||||
if( !strcmp( "L", horizontal ) )
|
||||
return GR_TEXT_HJUSTIFY_LEFT;
|
||||
|
@ -186,7 +186,7 @@ static inline EDA_TEXT_HJUSTIFY_T HorizJustify( const char* horizontal )
|
|||
return GR_TEXT_HJUSTIFY_CENTER;
|
||||
}
|
||||
|
||||
static inline EDA_TEXT_VJUSTIFY_T VertJustify( const char* vertical )
|
||||
static EDA_TEXT_VJUSTIFY_T vertJustify( const char* vertical )
|
||||
{
|
||||
if( !strcmp( "T", vertical ) )
|
||||
return GR_TEXT_VJUSTIFY_TOP;
|
||||
|
@ -1582,10 +1582,10 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText )
|
|||
aText->SetItalic( italic && *italic == 'I' );
|
||||
|
||||
if( hjust )
|
||||
aText->SetHorizJustify( HorizJustify( hjust ) );
|
||||
aText->SetHorizJustify( horizJustify( hjust ) );
|
||||
|
||||
if( vjust )
|
||||
aText->SetVertJustify( VertJustify( vjust ) );
|
||||
aText->SetVertJustify( vertJustify( vjust ) );
|
||||
|
||||
if( layer < 0 )
|
||||
layer = 0;
|
||||
|
@ -1908,7 +1908,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT()
|
|||
pcbtxt->SetItalic( !strcmp( style, "Italic" ) );
|
||||
|
||||
if( hJustify )
|
||||
pcbtxt->SetHorizJustify( HorizJustify( hJustify ) );
|
||||
pcbtxt->SetHorizJustify( horizJustify( hJustify ) );
|
||||
else
|
||||
{
|
||||
// boom, somebody changed a constructor, I was relying on this:
|
||||
|
@ -1916,7 +1916,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT()
|
|||
}
|
||||
|
||||
if( vJustify )
|
||||
pcbtxt->SetVertJustify( VertJustify( vJustify ) );
|
||||
pcbtxt->SetVertJustify( vertJustify( vJustify ) );
|
||||
|
||||
if( layer < FIRST_COPPER_LAYER )
|
||||
layer = FIRST_COPPER_LAYER;
|
||||
|
|
Loading…
Reference in New Issue