KiCad PCB EDA Suite
dialog_show_page_borders.cpp
Go to the documentation of this file.
1 
6 /*
7  * This program source code file is part of KiCad, a free EDA CAD application.
8  *
9  * Copyright (C) 2011 jean-pierre.charras@gipsa-lab.inpg.fr
10  * Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, you may find one here:
24  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
25  * or you may search the http://www.gnu.org website for the version 2 license,
26  * or you may write to the Free Software Foundation, Inc.,
27  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28  */
29 
30 #include <fctsys.h>
31 #include <common.h>
32 #include <macros.h>
33 
34 #include <gerbview.h>
35 #include <gerbview_frame.h>
37 
38 
40  DIALOG_PAGE_SHOW_PAGE_BORDERS_BASE( parent, wxID_ANY )
41 {
42  m_Parent = parent;
43  SetFocus();
44 
45  m_ShowPageLimits->SetSelection(0);
46 
48  {
49  wxString curPaperType = m_Parent->GetPageSettings().GetType();
50 
51  for( unsigned i = 1; i<DIM( g_GerberPageSizeList ); ++i )
52  {
53  if( curPaperType == g_GerberPageSizeList[i] )
54  {
55  m_ShowPageLimits->SetSelection( i );
56  break;
57  }
58  }
59  }
60 
61  GetSizer()->Fit( this );
62  GetSizer()->SetSizeHints( this );
63  Center();
64  m_sdbSizer1OK->SetDefault();
65 }
66 
67 
69 {
70  EndModal( wxID_CANCEL );
71 }
72 
73 
75 {
76  int idx = m_ShowPageLimits->GetSelection();
77 
78  m_Parent->SetShowBorderAndTitleBlock( idx > 0 ? true : false );
79 
81 
82  EndModal( wxID_OK );
83 }
84 
#define DIM(x)
of elements in an array
Definition: macros.h:98
void SetPageSettings(const PAGE_INFO &aPageSettings) override
bool GetShowBorderAndTitleBlock() const
Definition: draw_frame.h:331
This file contains miscellaneous commonly used macros and functions.
void OnOKBUttonClick(wxCommandEvent &event) override
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
DIALOG_PAGE_SHOW_PAGE_BORDERS(GERBVIEW_FRAME *parent)
void OnCancelButtonClick(wxCommandEvent &event) override
Class DIALOG_PAGE_SHOW_PAGE_BORDERS_BASE.
const PAGE_INFO & GetPageSettings() const override
Dialog to show/hide frame reference and select paper size for printing.
The common library.
const wxString & GetType() const
void SetShowBorderAndTitleBlock(bool aShow)
Definition: draw_frame.h:333
const wxChar * g_GerberPageSizeList[]
List of page sizes.
Definition: gerbview.cpp:38