diff --git a/common/dialogs/dialog_env_var_config_base.cpp b/common/dialogs/dialog_env_var_config_base.cpp index b786df5c58..8f857c74eb 100644 --- a/common/dialogs/dialog_env_var_config_base.cpp +++ b/common/dialogs/dialog_env_var_config_base.cpp @@ -14,10 +14,13 @@ DIALOG_ENV_VAR_CONFIG_BASE::DIALOG_ENV_VAR_CONFIG_BASE( wxWindow* parent, wxWind this->SetSizeHints( wxDefaultSize, wxDefaultSize ); wxBoxSizer* mainSizer; - mainSizer = new wxBoxSizer( wxHORIZONTAL ); + mainSizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizer1; - bSizer1 = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bupperSizer; + bupperSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bleftSizer; + bleftSizer = new wxBoxSizer( wxVERTICAL ); m_grid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); @@ -45,48 +48,54 @@ DIALOG_ENV_VAR_CONFIG_BASE::DIALOG_ENV_VAR_CONFIG_BASE( wxWindow* parent, wxWind // Cell Defaults m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - bSizer1->Add( m_grid, 1, wxALL|wxEXPAND, 5 ); + bleftSizer->Add( m_grid, 1, wxALL|wxEXPAND, 5 ); - mainSizer->Add( bSizer1, 1, wxEXPAND, 5 ); + bupperSizer->Add( bleftSizer, 1, wxEXPAND, 5 ); - wxBoxSizer* bSizer2; - bSizer2 = new wxBoxSizer( wxVERTICAL ); - - m_buttonOk = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonOk->SetDefault(); - bSizer2->Add( m_buttonOk, 0, wxALL, 5 ); - - m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer2->Add( m_buttonCancel, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + wxBoxSizer* brightSizer; + brightSizer = new wxBoxSizer( wxVERTICAL ); m_buttonAdd = new wxButton( this, wxID_ANY, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonAdd->SetToolTip( _("Add a new entry to the table.") ); - bSizer2->Add( m_buttonAdd, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + brightSizer->Add( m_buttonAdd, 0, wxALL|wxEXPAND, 5 ); m_buttonDelete = new wxButton( this, wxID_ANY, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonDelete->SetToolTip( _("Remove the selectect entry from the table.") ); - bSizer2->Add( m_buttonDelete, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - - m_buttonHelp = new wxButton( this, wxID_ANY, _("Help"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer2->Add( m_buttonHelp, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + brightSizer->Add( m_buttonDelete, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - mainSizer->Add( bSizer2, 0, wxEXPAND, 5 ); + bupperSizer->Add( brightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + mainSizer->Add( bupperSizer, 1, wxEXPAND, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + mainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizerHelp = new wxButton( this, wxID_HELP ); + m_sdbSizer->AddButton( m_sdbSizerHelp ); + m_sdbSizer->Realize(); + + mainSizer->Add( m_sdbSizer, 0, wxALL|wxALIGN_RIGHT, 5 ); this->SetSizer( mainSizer ); this->Layout(); - mainSizer->Fit( this ); this->Centre( wxBOTH ); // Connect Events m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnAddRow ), NULL, this ); m_buttonDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnDeleteSelectedRows ), NULL, this ); - m_buttonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnHelpRequest ), NULL, this ); + m_sdbSizerHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnHelpRequest ), NULL, this ); } DIALOG_ENV_VAR_CONFIG_BASE::~DIALOG_ENV_VAR_CONFIG_BASE() @@ -94,6 +103,6 @@ DIALOG_ENV_VAR_CONFIG_BASE::~DIALOG_ENV_VAR_CONFIG_BASE() // Disconnect Events m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnAddRow ), NULL, this ); m_buttonDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnDeleteSelectedRows ), NULL, this ); - m_buttonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnHelpRequest ), NULL, this ); + m_sdbSizerHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnHelpRequest ), NULL, this ); } diff --git a/common/dialogs/dialog_env_var_config_base.fbp b/common/dialogs/dialog_env_var_config_base.fbp index 37e55b6c48..fa78eb7dc0 100644 --- a/common/dialogs/dialog_env_var_config_base.fbp +++ b/common/dialogs/dialog_env_var_config_base.fbp @@ -44,7 +44,7 @@ DIALOG_ENV_VAR_CONFIG_BASE - -1,-1 + 363,177 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Path Configuration @@ -91,7 +91,7 @@ mainSizer - wxHORIZONTAL + wxVERTICAL none 5 @@ -99,603 +99,457 @@ 1 - bSizer1 - wxVERTICAL + bupperSizer + wxHORIZONTAL none 5 - wxALL|wxEXPAND + wxEXPAND 1 - - 1 - 1 - 1 - 1 - - - - - 0 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 30 - "Name" "Path" - wxALIGN_CENTRE - 2 - - - 1 - 0 - Dock - 0 - Left - 0 - 1 - 1 - 1 - 1 - 1 - - 1 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 + - 1 - m_grid - 1 - - - protected - 1 - - Resizable - wxALIGN_CENTRE - 40 - - wxALIGN_CENTRE - - 0 - 1 - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + bleftSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 30 + "Name" "Path" + wxALIGN_CENTRE + 2 + + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 1 + 1 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_grid + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 40 + + wxALIGN_CENTRE + + 0 + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + + brightSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Add + + 0 + + + 0 + + 1 + m_buttonAdd + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Add a new entry to the table. + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddRow + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Delete + + 0 + + + 0 + + 1 + m_buttonDelete + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Remove the selectect entry from the table. + + wxFILTER_NONE + wxDefaultValidator + + + + + OnDeleteSelectedRows + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxEXPAND + wxEXPAND | wxALL 0 - + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 - bSizer2 - wxVERTICAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_OK - OK - - 0 - - - 0 - - 1 - m_buttonOk - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Cancel - - 0 - - - 0 - - 1 - m_buttonCancel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Add - - 0 - - - 0 - - 1 - m_buttonAdd - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Add a new entry to the table. - - wxFILTER_NONE - wxDefaultValidator - - - - - OnAddRow - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Delete - - 0 - - - 0 - - 1 - m_buttonDelete - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Remove the selectect entry from the table. - - wxFILTER_NONE - wxDefaultValidator - - - - - OnDeleteSelectedRows - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Help - - 0 - - - 0 - - 1 - m_buttonHelp - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnHelpRequest - - - - - - - - - - - - - - - - - - - - - - - - - + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_RIGHT + 0 + + 0 + 1 + 0 + 1 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + + + OnHelpRequest + + + + diff --git a/common/dialogs/dialog_env_var_config_base.h b/common/dialogs/dialog_env_var_config_base.h index 2b20344c2a..69b74f2146 100644 --- a/common/dialogs/dialog_env_var_config_base.h +++ b/common/dialogs/dialog_env_var_config_base.h @@ -22,6 +22,7 @@ class DIALOG_SHIM; #include #include #include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -36,11 +37,13 @@ class DIALOG_ENV_VAR_CONFIG_BASE : public DIALOG_SHIM protected: wxGrid* m_grid; - wxButton* m_buttonOk; - wxButton* m_buttonCancel; wxButton* m_buttonAdd; wxButton* m_buttonDelete; - wxButton* m_buttonHelp; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + wxButton* m_sdbSizerHelp; // Virtual event handlers, overide them in your derived class virtual void OnAddRow( wxCommandEvent& event ) { event.Skip(); } @@ -50,7 +53,7 @@ class DIALOG_ENV_VAR_CONFIG_BASE : public DIALOG_SHIM public: - DIALOG_ENV_VAR_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Path Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_ENV_VAR_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Path Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 363,177 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_ENV_VAR_CONFIG_BASE(); }; diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp index c40fb462e8..7c4fb4aab3 100644 --- a/common/draw_panel.cpp +++ b/common/draw_panel.cpp @@ -724,7 +724,6 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC ) if( org.y < m_ClipBox.GetY() ) org.y += KiROUND( gridSize.y ); -#if ( defined( __WXMAC__ ) || 1 ) // Use a pixel based draw to display grid. There are a lot of calls, so the cost is // high and grid is slowly drawn on some platforms. Please note that this should // always be enabled until the bitmap based solution below is fixed. @@ -748,61 +747,6 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC ) aDC->DrawPoint( xpos, KiROUND( y ) ); } } -#else - /* This is fast only if the Blit function is fast. Not true on all platforms. - * - * A first grid column is drawn in a temporary bitmap, and after is duplicated using - * the Blit function (copy from a screen area to an other screen area). - */ - wxMemoryDC tmpDC; - wxBitmap tmpBM( 1, aDC->LogicalToDeviceYRel( m_ClipBox.GetHeight() ) ); - tmpDC.SelectObject( tmpBM ); - tmpDC.SetLogicalFunction( wxCOPY ); - tmpDC.SetBackground( wxBrush( GetBackgroundColour() ) ); - tmpDC.Clear(); - tmpDC.SetPen( MakeColour( GetParent()->GetGridColor() ) ); - - double usx, usy; - int lox, loy, dox, doy; - - aDC->GetUserScale( &usx, &usy ); - aDC->GetLogicalOrigin( &lox, &loy ); - aDC->GetDeviceOrigin( &dox, &doy ); - - // Create a dummy DC for coordinate translation because the actual DC scale and origin - // must be reset in order to work correctly. - wxBitmap tmpBitmap( 1, 1 ); - wxMemoryDC scaleDC( tmpBitmap ); - scaleDC.SetUserScale( usx, usy ); - scaleDC.SetLogicalOrigin( lox, loy ); - scaleDC.SetDeviceOrigin( dox, doy ); - - double bottom = ( double ) m_ClipBox.GetBottom(); - - // Draw a column of grid points. - for( double y = (double) org.y; y <= bottom; y += gridSize.y ) - { - tmpDC.DrawPoint( 0, scaleDC.LogicalToDeviceY( KiROUND( y ) ) ); - } - - // Reset the device context scale and origin and restore on exit. - EDA_BLIT_NORMALIZER blitNorm( aDC ); - - // Mask of everything but the grid points. - tmpDC.SelectObject( wxNullBitmap ); - tmpBM.SetMask( new wxMask( tmpBM, GetBackgroundColour() ) ); - tmpDC.SelectObject( tmpBM ); - - double right = m_ClipBox.GetRight(); - - // Blit the column for each row of the damaged region. - for( double x = (double) org.x; x <= right; x += gridSize.x ) - { - aDC->Blit( scaleDC.LogicalToDeviceX( KiROUND( x ) ), - scaleDC.LogicalToDeviceY( m_ClipBox.GetY() ), - 1, tmpBM.GetHeight(), &tmpDC, 0, 0, wxCOPY, true ); - } -#endif } diff --git a/pcb_calculator/board_classes_values.cpp b/pcb_calculator/board_classes_values.cpp index a0476afa62..4398105227 100644 --- a/pcb_calculator/board_classes_values.cpp +++ b/pcb_calculator/board_classes_values.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 2011 jean-pierre.charras - * Copyright (C) 2011 Kicad Developers, see change_log.txt for contributors. + * Copyright (C) 2015 jean-pierre.charras + * Copyright (C) 2015 Kicad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -137,5 +137,8 @@ void PCB_CALCULATOR_FRAME::BoardClassesUpdateData( double aUnitScale ) txt = NOVAL; m_gridClassesValuesDisplay->SetCellValue(4, ii, txt ); } + + m_gridClassesValuesDisplay->SetRowLabelSize( wxGRID_AUTOSIZE ); + m_gridClassesValuesDisplay->AutoSize(); } diff --git a/pcb_calculator/electrical_spacing_values.cpp b/pcb_calculator/electrical_spacing_values.cpp index 5a9213b61f..6725953c91 100644 --- a/pcb_calculator/electrical_spacing_values.cpp +++ b/pcb_calculator/electrical_spacing_values.cpp @@ -121,10 +121,13 @@ void PCB_CALCULATOR_FRAME::ElectricalSpacingUpdateData( double aUnitScale ) wxString txt; double voltage = 500.0; // to calculate values at V > 500V txt = m_ElectricalSpacingVoltage->GetValue(); + if( ! txt.IsEmpty() ) voltage = DoubleFromString(txt); + if( voltage < 500.0 ) voltage = 500.0; + txt.Printf( wxT( "%g" ), voltage ); m_ElectricalSpacingVoltage->SetValue( txt ); @@ -145,4 +148,6 @@ void PCB_CALCULATOR_FRAME::ElectricalSpacingUpdateData( double aUnitScale ) txt.Printf( wxT( "%g" ), spacing / aUnitScale ); m_gridElectricalSpacingValues->SetCellValue( CLASS_COUNT-1, jj, txt ); } + + m_gridElectricalSpacingValues->SetRowLabelSize( wxGRID_AUTOSIZE ); } diff --git a/pcbnew/dialogs/dialog_design_rules.cpp b/pcbnew/dialogs/dialog_design_rules.cpp index f339e682ce..fb9f8fbc5d 100644 --- a/pcbnew/dialogs/dialog_design_rules.cpp +++ b/pcbnew/dialogs/dialog_design_rules.cpp @@ -5,7 +5,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2009 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr + * Copyright (C) 2004-2009 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2009-2015 KiCad Developers, see change_log.txt for contributors. * @@ -276,11 +276,15 @@ void DIALOG_DESIGN_RULES::InitDimensionsLists() m_gridViaSizeList->AutoSizeColumns( true ); m_gridTrackWidthList->SetColMinimalWidth( 0, 150 ); m_gridTrackWidthList->AutoSizeColumns( true ); + m_gridViaSizeList->SetColMinimalWidth( 1, 150 ); // Fill cells with actual values: m_gridViaSizeList->SetCellValue( 0, 0, wxEmptyString ); m_gridViaSizeList->SetCellValue( 0, 1, wxEmptyString ); - m_gridTrackWidthList->SetCellValue( 0, 0, wxEmptyString ); + + // Give a correct size to row labels column + m_gridViaSizeList->SetRowLabelSize( wxGRID_AUTOSIZE ); + m_gridTrackWidthList->SetRowLabelSize( wxGRID_AUTOSIZE ); for( unsigned ii = 0; ii < m_TracksWidthList.size(); ii++ ) {