~cern-kicad/kicad/kicad-pns-tom

« back to all changes in this revision

Viewing changes to pagelayout_editor/toolbars_pl_editor.cpp

  • Committer: Maciej Suminski
  • Date: 2013-08-02 13:57:24 UTC
  • mfrom: (4024.1.238 kicad)
  • mto: This revision was merged to the branch mainline in revision 4221.
  • Revision ID: maciej.suminski@cern.ch-20130802135724-gix6orezshkukodv
Upstream merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/**
 
3
 * @file toolbars_gerber.cpp
 
4
 * @brief Build tool bars
 
5
 */
 
6
 
 
7
/*
 
8
 * This program source code file is part of KiCad, a free EDA CAD application.
 
9
 *
 
10
 * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
 
11
 * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
 
12
 *
 
13
 * This program is free software; you can redistribute it and/or
 
14
 * modify it under the terms of the GNU General Public License
 
15
 * as published by the Free Software Foundation; either version 2
 
16
 * of the License, or (at your option) any later version.
 
17
 *
 
18
 * This program is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
 * GNU General Public License for more details.
 
22
 *
 
23
 * You should have received a copy of the GNU General Public License
 
24
 * along with this program; if not, you may find one here:
 
25
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 
26
 * or you may search the http://www.gnu.org website for the version 2 license,
 
27
 * or you may write to the Free Software Foundation, Inc.,
 
28
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 
29
 */
 
30
 
 
31
#include <fctsys.h>
 
32
 
 
33
#include <common.h>
 
34
#include <macros.h>
 
35
#include <bitmaps.h>
 
36
#include <pl_editor_id.h>
 
37
#include <pl_editor_frame.h>
 
38
#include <hotkeys.h>
 
39
 
 
40
void PL_EDITOR_FRAME::ReCreateHToolbar( void )
 
41
{
 
42
    if( m_mainToolBar != NULL )
 
43
        return;
 
44
 
 
45
    wxString      msg;
 
46
 
 
47
    // Standard file commands
 
48
    m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
 
49
                                      wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
 
50
 
 
51
    m_mainToolBar->AddTool( wxID_NEW, wxEmptyString, KiBitmap( pagelayout_new_xpm ),
 
52
                            _( "New page layout design" ) );
 
53
 
 
54
    m_mainToolBar->AddTool( wxID_OPEN, wxEmptyString, KiBitmap( pagelayout_load_xpm ),
 
55
                            _( "Load a page layout file. Previous data will be deleted" ) );
 
56
 
 
57
    m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_project_xpm ),
 
58
                            _( "Save page layout design" ) );
 
59
 
 
60
    m_mainToolBar->AddSeparator();
 
61
    m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ),
 
62
                            _( "Page settings" ) );
 
63
 
 
64
    m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ),
 
65
                            _( "Print page layout" ) );
 
66
 
 
67
    m_mainToolBar->AddSeparator();
 
68
    m_mainToolBar->AddTool( wxID_CUT, wxEmptyString, KiBitmap( delete_xpm ),
 
69
                            _( "Delete selected item" ) );
 
70
 
 
71
    m_mainToolBar->AddSeparator();
 
72
    m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString,
 
73
                            KiBitmap( undo_xpm ), wxEmptyString );
 
74
    m_mainToolBar->AddTool( wxID_REDO, wxEmptyString,
 
75
                            KiBitmap( redo_xpm ), wxEmptyString );
 
76
 
 
77
    // Standard Zoom controls:
 
78
    m_mainToolBar->AddSeparator();
 
79
    msg = AddHotkeyName( _( "Zoom in" ), s_PlEditor_Hokeys_Descr, HK_ZOOM_IN,  IS_COMMENT );
 
80
    m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg );
 
81
 
 
82
    msg = AddHotkeyName( _( "Zoom out" ), s_PlEditor_Hokeys_Descr, HK_ZOOM_OUT,  IS_COMMENT );
 
83
    m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg );
 
84
 
 
85
    msg = AddHotkeyName( _( "Redraw view" ), s_PlEditor_Hokeys_Descr, HK_ZOOM_REDRAW,  IS_COMMENT );
 
86
    m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg );
 
87
 
 
88
    msg = AddHotkeyName( _( "Zoom auto" ), s_PlEditor_Hokeys_Descr, HK_ZOOM_AUTO,  IS_COMMENT );
 
89
    m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg );
 
90
 
 
91
    // Display mode switch
 
92
    m_mainToolBar->AddSeparator();
 
93
    m_mainToolBar->AddTool( ID_SHOW_REAL_MODE, wxEmptyString, KiBitmap( pagelayout_normal_view_mode_xpm ),
 
94
                            _( "Show title block like it will be displayed in applications\n"
 
95
                               "texts with format are replaced by the full text"),
 
96
                            wxITEM_CHECK );
 
97
    m_mainToolBar->AddTool( ID_SHOW_LPEDITOR_MODE, wxEmptyString, KiBitmap( pagelayout_special_view_mode_xpm ),
 
98
                            _( "how title block in edit mode: texts are shown as is\n"
 
99
                               "texts with format are displayed with no change"),
 
100
                            wxITEM_CHECK );
 
101
 
 
102
    m_mainToolBar->AddSeparator();
 
103
 
 
104
    wxString choiceList[5] =
 
105
    {
 
106
        _("Left Top paper corner"),
 
107
        _("Right Bottom page corner"),
 
108
        _("Left Bottom page corner"),
 
109
        _("Right Top page corner"),
 
110
        _("Left Top page corner")
 
111
    };
 
112
 
 
113
    m_originSelectBox = new wxChoice( m_mainToolBar, ID_SELECT_COORDINATE_ORIGIN,
 
114
                                      wxDefaultPosition, wxDefaultSize,
 
115
                                      5, choiceList );
 
116
    m_mainToolBar->AddControl( m_originSelectBox );
 
117
    m_originSelectBox->SetToolTip( _(" Origin of coordinates displayed to the status bar") );
 
118
 
 
119
    int minwidth = 0;
 
120
    for( int ii = 0; ii < 5; ii++ )
 
121
    {
 
122
        int width = GetTextSize( choiceList[ii], m_originSelectBox ).x;
 
123
        minwidth = std::max( minwidth, width );
 
124
    }
 
125
    m_originSelectBox->SetMinSize( wxSize( minwidth, -1 ) );
 
126
    m_originSelectBox->SetSelection( m_originSelectChoice );
 
127
 
 
128
    wxString pageList[5] =
 
129
    {
 
130
        _("Page 1"),
 
131
        _("Other pages")
 
132
    };
 
133
 
 
134
    m_pageSelectBox = new wxChoice( m_mainToolBar, ID_SELECT_PAGE_NUMBER,
 
135
                                    wxDefaultPosition, wxDefaultSize,
 
136
                                    2, pageList );
 
137
    m_mainToolBar->AddControl( m_pageSelectBox );
 
138
    m_pageSelectBox->SetToolTip( _("Simulate page 1 or other pages to show how items\n"\
 
139
                                 "which are not on all page are displayed") );
 
140
    m_pageSelectBox->SetSelection( 0 );
 
141
 
 
142
 
 
143
    // after adding the buttons to the toolbar, must call Realize() to reflect the changes
 
144
    m_mainToolBar->Realize();
 
145
}
 
146
 
 
147
 
 
148
void PL_EDITOR_FRAME::ReCreateVToolbar( void )
 
149
{
 
150
    if( m_drawToolBar )
 
151
        return;
 
152
 
 
153
    m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
 
154
                                      wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL );
 
155
 
 
156
    // Set up toolbar
 
157
    m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ) );
 
158
    m_drawToolBar->AddSeparator();
 
159
 
 
160
    m_drawToolBar->Realize();
 
161
}
 
162
 
 
163
 
 
164
void PL_EDITOR_FRAME::ReCreateOptToolbar( void )
 
165
{
 
166
}