2013-07-19 18:27:22 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* Copyright (C) 2016-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-08-13 17:51:22 +00:00
|
|
|
* Copyright (C) 2013 CERN
|
|
|
|
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2013-07-19 18:27:22 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* 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 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
2013-07-19 18:27:22 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* 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.
|
2013-07-19 18:27:22 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2013-07-19 18:27:22 +00:00
|
|
|
*/
|
|
|
|
|
2016-06-11 13:51:05 +00:00
|
|
|
/**
|
|
|
|
* @file toolbars_pl_editor.cpp
|
|
|
|
* @brief Build tool bars
|
|
|
|
*/
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <macros.h>
|
|
|
|
#include <bitmaps.h>
|
|
|
|
#include <pl_editor_id.h>
|
|
|
|
#include <pl_editor_frame.h>
|
|
|
|
#include <hotkeys.h>
|
|
|
|
|
|
|
|
void PL_EDITOR_FRAME::ReCreateHToolbar( void )
|
|
|
|
{
|
2018-01-08 04:05:03 +00:00
|
|
|
if( m_mainToolBar )
|
|
|
|
m_mainToolBar->Clear();
|
|
|
|
else
|
2019-05-14 19:21:10 +00:00
|
|
|
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
wxString msg;
|
|
|
|
|
2018-01-11 06:18:30 +00:00
|
|
|
m_mainToolBar->AddTool( wxID_NEW, wxEmptyString, KiScaledBitmap( new_page_layout_xpm, this ),
|
2013-07-19 18:27:22 +00:00
|
|
|
_( "New page layout design" ) );
|
|
|
|
|
2018-01-11 06:18:30 +00:00
|
|
|
m_mainToolBar->AddTool( wxID_OPEN, wxEmptyString, KiScaledBitmap( open_page_layout_xpm, this ),
|
2017-08-29 15:07:48 +00:00
|
|
|
_( "Open an existing page layout design file" ) );
|
2013-07-19 18:27:22 +00:00
|
|
|
|
2018-01-11 06:18:30 +00:00
|
|
|
m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiScaledBitmap( save_xpm, this ),
|
2013-07-19 18:27:22 +00:00
|
|
|
_( "Save page layout design" ) );
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2017-08-29 15:07:48 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiScaledBitmap( sheetset_xpm, this ),
|
2013-07-19 18:27:22 +00:00
|
|
|
_( "Page settings" ) );
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiScaledBitmap( print_button_xpm, this ),
|
2013-07-19 18:27:22 +00:00
|
|
|
_( "Print page layout" ) );
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2017-08-29 15:07:48 +00:00
|
|
|
|
2019-04-25 13:04:38 +00:00
|
|
|
m_mainToolBar->AddTool( wxID_DELETE, wxEmptyString, KiScaledBitmap( delete_xpm, this ),
|
2013-07-19 18:27:22 +00:00
|
|
|
_( "Delete selected item" ) );
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2017-08-29 15:07:48 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( undo_xpm, this ), _( "Undo" ) );
|
2017-08-29 15:07:48 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( redo_xpm, this ), _( "Redo" ) );
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
// Standard Zoom controls:
|
2019-05-14 19:21:10 +00:00
|
|
|
// JEY TODO: move to COMMON_TOOLS....
|
2013-07-19 18:27:22 +00:00
|
|
|
m_mainToolBar->AddSeparator();
|
2019-04-01 17:14:16 +00:00
|
|
|
msg = AddHotkeyName( _( "Redraw view" ), PlEditorHotkeysDescr, HK_ZOOM_REDRAW, IS_COMMENT );
|
2018-03-16 12:38:36 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
|
|
|
KiScaledBitmap( zoom_redraw_xpm, this ), msg );
|
2017-06-06 13:35:20 +00:00
|
|
|
|
2019-04-01 17:14:16 +00:00
|
|
|
msg = AddHotkeyName( _( "Zoom in" ), PlEditorHotkeysDescr, HK_ZOOM_IN, IS_COMMENT );
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
|
2013-07-19 18:27:22 +00:00
|
|
|
|
2019-04-01 17:14:16 +00:00
|
|
|
msg = AddHotkeyName( _( "Zoom out" ), PlEditorHotkeysDescr, HK_ZOOM_OUT, IS_COMMENT );
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
|
2013-07-19 18:27:22 +00:00
|
|
|
|
2019-04-01 17:14:16 +00:00
|
|
|
msg = AddHotkeyName( _( "Zoom to fit page" ), PlEditorHotkeysDescr, HK_ZOOM_AUTO, IS_COMMENT );
|
2018-03-16 12:38:36 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
|
|
|
KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
|
2013-07-19 18:27:22 +00:00
|
|
|
|
2016-06-11 13:51:05 +00:00
|
|
|
// Zoom-to-selection
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
|
2017-06-06 13:35:20 +00:00
|
|
|
_( "Zoom to selection" ), wxITEM_CHECK );
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
// Display mode switch
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2013-08-13 17:51:22 +00:00
|
|
|
m_mainToolBar->AddTool( ID_SHOW_REAL_MODE, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( pagelayout_normal_view_mode_xpm, this ),
|
2013-07-19 18:27:22 +00:00
|
|
|
_( "Show title block like it will be displayed in applications\n"
|
|
|
|
"texts with format are replaced by the full text"),
|
|
|
|
wxITEM_CHECK );
|
2013-08-13 17:51:22 +00:00
|
|
|
m_mainToolBar->AddTool( ID_SHOW_PL_EDITOR_MODE,
|
2018-01-08 04:05:03 +00:00
|
|
|
wxEmptyString, KiScaledBitmap( pagelayout_special_view_mode_xpm, this ),
|
2013-08-13 17:51:22 +00:00
|
|
|
_( "Show title block in edit mode: texts are shown as is:\n"
|
2013-07-19 18:27:22 +00:00
|
|
|
"texts with format are displayed with no change"),
|
|
|
|
wxITEM_CHECK );
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
wxString choiceList[5] =
|
|
|
|
{
|
|
|
|
_("Left Top paper corner"),
|
|
|
|
_("Right Bottom page corner"),
|
|
|
|
_("Left Bottom page corner"),
|
|
|
|
_("Right Top page corner"),
|
|
|
|
_("Left Top page corner")
|
|
|
|
};
|
|
|
|
|
|
|
|
m_originSelectBox = new wxChoice( m_mainToolBar, ID_SELECT_COORDINATE_ORIGIN,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
5, choiceList );
|
|
|
|
m_mainToolBar->AddControl( m_originSelectBox );
|
2017-06-07 10:56:20 +00:00
|
|
|
m_originSelectBox->SetToolTip( _("Origin of coordinates displayed to the status bar") );
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
int minwidth = 0;
|
|
|
|
for( int ii = 0; ii < 5; ii++ )
|
|
|
|
{
|
|
|
|
int width = GetTextSize( choiceList[ii], m_originSelectBox ).x;
|
|
|
|
minwidth = std::max( minwidth, width );
|
|
|
|
}
|
|
|
|
m_originSelectBox->SetMinSize( wxSize( minwidth, -1 ) );
|
|
|
|
m_originSelectBox->SetSelection( m_originSelectChoice );
|
|
|
|
|
|
|
|
wxString pageList[5] =
|
|
|
|
{
|
|
|
|
_("Page 1"),
|
|
|
|
_("Other pages")
|
|
|
|
};
|
|
|
|
|
|
|
|
m_pageSelectBox = new wxChoice( m_mainToolBar, ID_SELECT_PAGE_NUMBER,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
2, pageList );
|
|
|
|
m_mainToolBar->AddControl( m_pageSelectBox );
|
|
|
|
m_pageSelectBox->SetToolTip( _("Simulate page 1 or other pages to show how items\n"\
|
|
|
|
"which are not on all page are displayed") );
|
|
|
|
m_pageSelectBox->SetSelection( 0 );
|
|
|
|
|
|
|
|
|
|
|
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
|
|
|
m_mainToolBar->Realize();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PL_EDITOR_FRAME::ReCreateVToolbar( void )
|
|
|
|
{
|
|
|
|
if( m_drawToolBar )
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->Clear();
|
|
|
|
else
|
2019-05-14 19:21:10 +00:00
|
|
|
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
// Set up toolbar
|
2018-03-16 12:38:36 +00:00
|
|
|
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString,
|
|
|
|
KiScaledBitmap( cursor_xpm, this ) );
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_drawToolBar, this );
|
2013-07-19 18:27:22 +00:00
|
|
|
|
|
|
|
m_drawToolBar->Realize();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PL_EDITOR_FRAME::ReCreateOptToolbar( void )
|
|
|
|
{
|
|
|
|
}
|