KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_multichannel_generate_rule_areas.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2014 John Beard, [email protected]
5 * Copyright (C) 2018-2020 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
26#include <widgets/wx_grid.h>
27#include <pcb_edit_frame.h>
28
30
32 PCB_BASE_FRAME* aFrame,
33 MULTICHANNEL_TOOL* aParentTool ) :
35 m_parentTool( aParentTool )
36{
37 int i = 0;
38
40
41 m_sheetsGrid->EnableEditing( true );
42 m_sheetsGrid->HideRowLabels();
43 m_sheetsGrid->SetColLabelValue( 0, wxT("Generate") );
44 m_sheetsGrid->SetColLabelValue( 1, wxT("Sheet Path") );
45 m_sheetsGrid->SetColLabelValue( 2, wxT("Sheet Name") );
46 m_sheetsGrid->AppendRows( raData->m_areas.size() - 1 );
47 m_sheetsGrid->AutoSizeColumn( 1 );
48
49 for( RULE_AREA& sheet : raData->m_areas )
50 {
51 m_sheetsGrid->SetCellValue( i, 1, sheet.m_sheetPath );
52 m_sheetsGrid->SetCellValue( i, 2, sheet.m_sheetName );
53 m_sheetsGrid->SetCellRenderer( i, 0, new wxGridCellBoolRenderer );
54 m_sheetsGrid->SetCellEditor( i, 0, new wxGridCellBoolEditor );
55 m_sheetsGrid->SetCellValue( i, 0, sheet.m_generateEnabled ? wxT("1") : wxT( "" ) );
56 i++;
57 }
58
59 m_sheetsGrid->SetMaxSize( wxSize( -1, 800 ) );
60 m_sheetsGrid->Fit();
61 m_cbGroupItems->SetValue( raData->m_groupItems );
62 m_cbReplaceExisting->SetValue( raData->m_replaceExisting );
63
64 Layout();
67}
68
69
71{
73
74 for( size_t i = 0; i < raData->m_areas.size(); i++ )
75 {
76 wxString enabled = m_sheetsGrid->GetCellValue( i, 0 );
77 raData->m_areas[i].m_generateEnabled = ( !enabled.CompareTo( wxT( "1" ) ) ) ? true : false;
78 }
79
80 raData->m_replaceExisting = m_cbReplaceExisting->GetValue();
81 raData->m_groupItems = m_cbGroupItems->GetValue();
82
83 return true;
84}
85
86
88{
89 // fixme: no idea how to make the wxGrid autoresize to the actual window width when setting
90 // grid cells from within this method.
91 return true;
92}
Class DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS_BASE.
DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS(PCB_BASE_FRAME *aFrame, MULTICHANNEL_TOOL *aParentTool)
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
RULE_AREAS_DATA * GetData()
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
std::vector< RULE_AREA > m_areas
wxString m_sheetName
wxString m_sheetPath
bool m_generateEnabled