Commit 197371de authored by jean-pierre charras's avatar jean-pierre charras

dialog non copper zones: better look. dialog copper zones: fix a minor bug.

parent a525c890
......@@ -133,6 +133,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
EDA_PANEINFO mesg;
mesg.MessageToolbarPane();
// Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
// the Layers Manager is floatable, but initially docked at far right
EDA_PANEINFO lyrs;
lyrs.LayersToolbarPane();
lyrs.MinSize( m_LayersManager->GetBestSize() );
......
......@@ -102,6 +102,7 @@ set( PCBNEW_DIALOGS
dialogs/dialog_pcb_text_properties_base.cpp
dialogs/dialog_pns_settings.cpp
dialogs/dialog_pns_settings_base.cpp
dialogs/dialog_non_copper_zones_properties.cpp
dialogs/dialog_non_copper_zones_properties_base.cpp
dialogs/dialog_pad_properties.cpp
dialogs/dialog_pad_properties_base.cpp
......@@ -250,7 +251,6 @@ set( PCBNEW_CLASS_SRCS
zones_by_polygon_fill_functions.cpp
zone_filling_algorithm.cpp
zones_functions_for_undo_redo.cpp
zones_non_copper_type_functions.cpp
zones_polygons_insulated_copper_islands.cpp
zones_polygons_test_connections.cpp
zones_test_and_combine_areas.cpp
......
......@@ -253,10 +253,11 @@ void DIALOG_COPPER_ZONE::initDialog()
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names
int imgIdx = 0;
LSET cu_set = LSET::AllCuMask( board->GetCopperLayerCount() );
for( LSEQ cu_stack = cu_set.UIOrder(); cu_stack; ++cu_stack )
for( LSEQ cu_stack = cu_set.UIOrder(); cu_stack; ++cu_stack, imgIdx++ )
{
LAYER_ID layer = *cu_stack;
......@@ -271,7 +272,7 @@ void DIALOG_COPPER_ZONE::initDialog()
imageList->Add( makeLayerBitmap( layerColor ) );
int itemIndex = m_LayerSelectionCtrl->InsertItem(
m_LayerSelectionCtrl->GetItemCount(), msg, layer );
m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx );
if( m_settings.m_CurrentZone_Layer == layer )
m_LayerSelectionCtrl->Select( itemIndex );
......
/**
* @file zones_non_copper_type_functions.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h>
#include <confirm.h>
#include <wxPcbStruct.h>
......@@ -17,17 +40,19 @@
#include <dialog_non_copper_zones_properties_base.h>
#define LAYER_BITMAP_SIZE_X 20
#define LAYER_BITMAP_SIZE_Y 10
/**
* Class DIALOG_NON_COPPER_ZONES_EDITOR
* is a dialog editor for non copper zones properties,
* derived from DialogNonCopperZonesPropertiesBase, which is maintained and
* derived from DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE, which is maintained and
* created by wxFormBuilder
*/
class DIALOG_NON_COPPER_ZONES_EDITOR : public DialogNonCopperZonesPropertiesBase
class DIALOG_NON_COPPER_ZONES_EDITOR : public DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE
{
private:
PCB_BASE_FRAME* m_Parent;
PCB_BASE_FRAME* m_parent;
ZONE_CONTAINER* m_zone;
ZONE_SETTINGS* m_ptr;
ZONE_SETTINGS m_settings; // working copy of zone settings
......@@ -39,6 +64,14 @@ private:
public:
DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
ZONE_CONTAINER* aZone, ZONE_SETTINGS* aSettings );
private:
/**
* Function makeLayerBitmap
* creates the colored rectangle bitmaps used in the layer selection widget.
* @param aColor is the color to fill the rectangle with.
*/
wxBitmap makeLayerBitmap( EDA_COLOR_T aColor );
};
......@@ -49,8 +82,6 @@ ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent,
ZONE_EDIT_T result = ZONE_EDIT_T( dlg.ShowModal() );
// D(printf( "%s: result:%d\n", __FUNCTION__, result );)
return result;
}
......@@ -58,9 +89,9 @@ ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent,
DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
ZONE_CONTAINER* aZone,
ZONE_SETTINGS* aSettings ) :
DialogNonCopperZonesPropertiesBase( aParent )
DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( aParent )
{
m_Parent = aParent;
m_parent = aParent;
m_zone = aZone;
m_ptr = aSettings;
......@@ -75,6 +106,8 @@ DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME*
void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{
BOARD* board = m_parent->GetBoard();
SetReturnCode( ZONE_ABORT ); // Will be changed on button click
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
......@@ -99,28 +132,36 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
break;
}
// Create one column in m_LayerSelectionCtrl
wxListItem column0;
column0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, column0 );
// Create an icon list:
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
int ii = 0;
int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer;
if( m_zone )
lyrSelect = m_zone->GetLayer();
for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++ii )
for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++ii )
{
LAYER_ID layer = *seq;
wxString msg = m_Parent->GetBoard()->GetLayerName( layer );
EDA_COLOR_T layerColor = board->GetLayerColor( layer );
imageList->Add( makeLayerBitmap( layerColor ) );
wxString msg = board->GetLayerName( layer );
msg.Trim();
m_LayerSelectionCtrl->InsertItems( 1, &msg, ii );
if( m_zone )
{
if( m_zone->GetLayer() == layer )
m_LayerSelectionCtrl->SetSelection( ii );
}
else
{
if( ( (PCB_SCREEN*) m_Parent->GetScreen() )->m_Active_Layer == layer )
m_LayerSelectionCtrl->SetSelection( ii );
}
int itemIndex = m_LayerSelectionCtrl->InsertItem(
m_LayerSelectionCtrl->GetItemCount(), msg, ii );
if(lyrSelect == layer )
m_LayerSelectionCtrl->Select( itemIndex );
}
}
......@@ -166,7 +207,7 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event )
m_settings.m_Zone_45_Only = true;
// Get the layer selection for this zone
int ii = m_LayerSelectionCtrl->GetSelection();
int ii = m_LayerSelectionCtrl->GetFirstSelected();
if( ii < 0 )
{
......@@ -191,3 +232,24 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnCancelClick( wxCommandEvent& event )
EndModal( ZONE_ABORT );
}
wxBitmap DIALOG_NON_COPPER_ZONES_EDITOR::makeLayerBitmap( EDA_COLOR_T aColor )
{
wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
wxBrush brush;
wxMemoryDC iconDC;
iconDC.SelectObject( bitmap );
brush.SetColour( MakeColour( aColor ) );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID );
#endif
iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
return bitmap;
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -9,12 +9,12 @@
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DialogNonCopperZonesPropertiesBase, DIALOG_SHIM )
EVT_BUTTON( wxID_CANCEL, DialogNonCopperZonesPropertiesBase::_wxFB_OnCancelClick )
EVT_BUTTON( wxID_OK, DialogNonCopperZonesPropertiesBase::_wxFB_OnOkClick )
BEGIN_EVENT_TABLE( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE, DIALOG_SHIM )
EVT_BUTTON( wxID_CANCEL, DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::_wxFB_OnCancelClick )
EVT_BUTTON( wxID_OK, DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::_wxFB_OnOkClick )
END_EVENT_TABLE()
DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::DIALOG_NONCOPPER_ZONES_PROPERTIES_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( wxDefaultSize, wxDefaultSize );
......@@ -31,8 +31,8 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
m_staticTextLayerSelection->Wrap( -1 );
bSizerLeft->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_LayerSelectionCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bSizerLeft->Add( m_LayerSelectionCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_LayerSelectionCtrl = new wxListView( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL );
bSizerLeft->Add( m_LayerSelectionCtrl, 1, wxALL|wxEXPAND, 5 );
m_UpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 );
......@@ -63,6 +63,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
bSizerRight->Add( m_MinThicknessValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ZoneMinThicknessCtrl->SetMaxLength( 0 );
bSizerRight->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
......@@ -90,6 +91,6 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
this->Centre( wxBOTH );
}
DialogNonCopperZonesPropertiesBase::~DialogNonCopperZonesPropertiesBase()
DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::~DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE()
{
}
......@@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
......@@ -40,7 +42,7 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DialogNonCopperZonesPropertiesBase</property>
<property name="name">DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">369,317</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
......@@ -194,9 +196,9 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxListBox" expanded="1">
<object class="wxListCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
......@@ -210,7 +212,6 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices"></property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
......@@ -242,8 +243,8 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="style">wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL</property>
<property name="subclass">wxListView; </property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
......@@ -263,8 +264,26 @@
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnListBox"></event>
<event name="OnListBoxDClick"></event>
<event name="OnListBeginDrag"></event>
<event name="OnListBeginLabelEdit"></event>
<event name="OnListBeginRDrag"></event>
<event name="OnListCacheHint"></event>
<event name="OnListColBeginDrag"></event>
<event name="OnListColClick"></event>
<event name="OnListColDragging"></event>
<event name="OnListColEndDrag"></event>
<event name="OnListColRightClick"></event>
<event name="OnListDeleteAllItems"></event>
<event name="OnListDeleteItem"></event>
<event name="OnListEndLabelEdit"></event>
<event name="OnListInsertItem"></event>
<event name="OnListItemActivated"></event>
<event name="OnListItemDeselected"></event>
<event name="OnListItemFocused"></event>
<event name="OnListItemMiddleClick"></event>
<event name="OnListItemRightClick"></event>
<event name="OnListItemSelected"></event>
<event name="OnListKeyDown"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,6 +11,9 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
class wxListView;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
......@@ -18,7 +21,7 @@
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/listbox.h>
#include <wx/listctrl.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/statbox.h>
......@@ -30,9 +33,9 @@
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DialogNonCopperZonesPropertiesBase
/// Class DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DialogNonCopperZonesPropertiesBase : public DIALOG_SHIM
class DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
......@@ -44,7 +47,7 @@ class DialogNonCopperZonesPropertiesBase : public DIALOG_SHIM
protected:
wxStaticText* m_staticTextLayerSelection;
wxListBox* m_LayerSelectionCtrl;
wxListView* m_LayerSelectionCtrl;
wxRadioBox* m_OrientEdgesOpt;
wxRadioBox* m_OutlineAppearanceCtrl;
wxStaticText* m_MinThicknessValueTitle;
......@@ -61,8 +64,8 @@ class DialogNonCopperZonesPropertiesBase : public DIALOG_SHIM
public:
DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 369,317 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER );
~DialogNonCopperZonesPropertiesBase();
DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 369,317 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER );
~DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE();
};
......
......@@ -420,6 +420,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
lyrs.MinSize( m_Layers->GetBestSize() ); // updated in ReFillLayerWidget
lyrs.BestSize( m_Layers->GetBestSize() );
lyrs.Caption( _( "Visibles" ) );
lyrs.TopDockable( false ).BottomDockable( false );
if( m_mainToolBar ) // The main horizontal toolbar
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment