From 039ac92480a09266146fc5b0c9ec67a32a2565ad Mon Sep 17 00:00:00 2001 From: saurabhb17 Date: Wed, 26 Feb 2020 16:04:40 +0530 Subject: Added secondary files --- common/dialogs/dialog_display_info_HTML_base.cpp | 41 + common/dialogs/dialog_display_info_HTML_base.fbp | 271 ++ common/dialogs/dialog_display_info_HTML_base.h | 53 + common/dialogs/dialog_env_var_config.cpp | 285 ++ common/dialogs/dialog_env_var_config_base.cpp | 108 + common/dialogs/dialog_env_var_config_base.fbp | 558 +++ common/dialogs/dialog_env_var_config_base.h | 61 + common/dialogs/dialog_exit_base.cpp | 98 + common/dialogs/dialog_exit_base.fbp | 754 ++++ common/dialogs/dialog_exit_base.h | 64 + common/dialogs/dialog_get_component.cpp | 144 + common/dialogs/dialog_get_component_base.cpp | 90 + common/dialogs/dialog_get_component_base.fbp | 906 +++++ common/dialogs/dialog_get_component_base.h | 67 + common/dialogs/dialog_hotkeys_editor.cpp | 389 ++ common/dialogs/dialog_hotkeys_editor_base.cpp | 60 + common/dialogs/dialog_hotkeys_editor_base.fbp | 391 ++ common/dialogs/dialog_hotkeys_editor_base.h | 58 + common/dialogs/dialog_image_editor.cpp | 179 + common/dialogs/dialog_image_editor.fbp | 978 +++++ common/dialogs/dialog_image_editor.h | 69 + common/dialogs/dialog_image_editor_base.cpp | 103 + common/dialogs/dialog_image_editor_base.h | 69 + common/dialogs/dialog_list_selector_base.cpp | 80 + common/dialogs/dialog_list_selector_base.fbp | 661 ++++ common/dialogs/dialog_list_selector_base.h | 66 + common/dialogs/dialog_page_settings.cpp | 841 ++++ common/dialogs/dialog_page_settings.h | 120 + common/dialogs/dialog_page_settings_base.cpp | 423 ++ common/dialogs/dialog_page_settings_base.fbp | 4454 ++++++++++++++++++++++ common/dialogs/dialog_page_settings_base.h | 126 + common/dialogs/wx_html_report_panel.cpp | 302 ++ common/dialogs/wx_html_report_panel.h | 122 + common/dialogs/wx_html_report_panel_base.cpp | 94 + common/dialogs/wx_html_report_panel_base.fbp | 823 ++++ common/dialogs/wx_html_report_panel_base.h | 64 + 36 files changed, 13972 insertions(+) create mode 100644 common/dialogs/dialog_display_info_HTML_base.cpp create mode 100644 common/dialogs/dialog_display_info_HTML_base.fbp create mode 100644 common/dialogs/dialog_display_info_HTML_base.h create mode 100644 common/dialogs/dialog_env_var_config.cpp create mode 100644 common/dialogs/dialog_env_var_config_base.cpp create mode 100644 common/dialogs/dialog_env_var_config_base.fbp create mode 100644 common/dialogs/dialog_env_var_config_base.h create mode 100644 common/dialogs/dialog_exit_base.cpp create mode 100644 common/dialogs/dialog_exit_base.fbp create mode 100644 common/dialogs/dialog_exit_base.h create mode 100644 common/dialogs/dialog_get_component.cpp create mode 100644 common/dialogs/dialog_get_component_base.cpp create mode 100644 common/dialogs/dialog_get_component_base.fbp create mode 100644 common/dialogs/dialog_get_component_base.h create mode 100644 common/dialogs/dialog_hotkeys_editor.cpp create mode 100644 common/dialogs/dialog_hotkeys_editor_base.cpp create mode 100644 common/dialogs/dialog_hotkeys_editor_base.fbp create mode 100644 common/dialogs/dialog_hotkeys_editor_base.h create mode 100644 common/dialogs/dialog_image_editor.cpp create mode 100644 common/dialogs/dialog_image_editor.fbp create mode 100644 common/dialogs/dialog_image_editor.h create mode 100644 common/dialogs/dialog_image_editor_base.cpp create mode 100644 common/dialogs/dialog_image_editor_base.h create mode 100644 common/dialogs/dialog_list_selector_base.cpp create mode 100644 common/dialogs/dialog_list_selector_base.fbp create mode 100644 common/dialogs/dialog_list_selector_base.h create mode 100644 common/dialogs/dialog_page_settings.cpp create mode 100644 common/dialogs/dialog_page_settings.h create mode 100644 common/dialogs/dialog_page_settings_base.cpp create mode 100644 common/dialogs/dialog_page_settings_base.fbp create mode 100644 common/dialogs/dialog_page_settings_base.h create mode 100644 common/dialogs/wx_html_report_panel.cpp create mode 100644 common/dialogs/wx_html_report_panel.h create mode 100644 common/dialogs/wx_html_report_panel_base.cpp create mode 100644 common/dialogs/wx_html_report_panel_base.fbp create mode 100644 common/dialogs/wx_html_report_panel_base.h (limited to 'common/dialogs') diff --git a/common/dialogs/dialog_display_info_HTML_base.cpp b/common/dialogs/dialog_display_info_HTML_base.cpp new file mode 100644 index 0000000..5a693c8 --- /dev/null +++ b/common/dialogs/dialog_display_info_HTML_base.cpp @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Nov 5 2013) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_display_info_HTML_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_DISPLAY_HTML_TEXT_BASE::DIALOG_DISPLAY_HTML_TEXT_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( wxSize( 400,120 ), wxDefaultSize ); + + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + m_htmlWindow = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO|wxSUNKEN_BORDER ); + bMainSizer->Add( m_htmlWindow, 1, wxEXPAND, 5 ); + + m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + m_buttonClose->SetDefault(); + bMainSizer->Add( m_buttonClose, 0, wxALIGN_RIGHT|wxALL, 10 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + + // Connect Events + m_htmlWindow->Connect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnHTMLLinkClicked ), NULL, this ); + m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnCloseButtonClick ), NULL, this ); +} + +DIALOG_DISPLAY_HTML_TEXT_BASE::~DIALOG_DISPLAY_HTML_TEXT_BASE() +{ + // Disconnect Events + m_htmlWindow->Disconnect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnHTMLLinkClicked ), NULL, this ); + m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnCloseButtonClick ), NULL, this ); + +} diff --git a/common/dialogs/dialog_display_info_HTML_base.fbp b/common/dialogs/dialog_display_info_HTML_base.fbp new file mode 100644 index 0000000..2147dcd --- /dev/null +++ b/common/dialogs/dialog_display_info_HTML_base.fbp @@ -0,0 +1,271 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_display_info_HTML_base + 1000 + none + 1 + dialog_display_info_HTML + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + 400,120 + DIALOG_DISPLAY_HTML_TEXT_BASE + + 465,202 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1,-1 + bMainSizer + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + -1,-1 + 1 + m_htmlWindow + 1 + + + public + 1 + + Resizable + 1 + + wxHW_SCROLLBAR_AUTO + + 0 + + + + wxSUNKEN_BORDER + + + + + + OnHTMLLinkClicked + + + + + + + + + + + + + + + + + + + + + + + + 10 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_CANCEL + Close + + 0 + + + 0 + + 1 + m_buttonClose + 1 + + + protected + 1 + + Resizable + 1 + + wxBU_EXACTFIT + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCloseButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/dialogs/dialog_display_info_HTML_base.h b/common/dialogs/dialog_display_info_HTML_base.h new file mode 100644 index 0000000..4cfa053 --- /dev/null +++ b/common/dialogs/dialog_display_info_HTML_base.h @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Nov 5 2013) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_DISPLAY_INFO_HTML_BASE_H__ +#define __DIALOG_DISPLAY_INFO_HTML_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_DISPLAY_HTML_TEXT_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_DISPLAY_HTML_TEXT_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxButton* m_buttonClose; + + // Virtual event handlers, overide them in your derived class + virtual void OnHTMLLinkClicked( wxHtmlLinkEvent& event ) { event.Skip(); } + virtual void OnCloseButtonClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + wxHtmlWindow* m_htmlWindow; + + DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 465,202 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_DISPLAY_HTML_TEXT_BASE(); + +}; + +#endif //__DIALOG_DISPLAY_INFO_HTML_BASE_H__ diff --git a/common/dialogs/dialog_env_var_config.cpp b/common/dialogs/dialog_env_var_config.cpp new file mode 100644 index 0000000..79ef7dd --- /dev/null +++ b/common/dialogs/dialog_env_var_config.cpp @@ -0,0 +1,285 @@ +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 2015 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 + */ + +/** + * @file dialg_env_var_config.cpp + */ + +#include + +#include +#include + +#include + + +DIALOG_ENV_VAR_CONFIG::DIALOG_ENV_VAR_CONFIG( wxWindow* aParent, const ENV_VAR_MAP& aEnvVarMap ) : + DIALOG_ENV_VAR_CONFIG_BASE( aParent ) +{ + m_extDefsChanged = false; + m_envVarMap = aEnvVarMap; + + m_grid->AppendRows( (int) m_envVarMap.size() ); + + for( size_t row = 0; row < m_envVarMap.size(); row++ ) + { + wxGridCellTextEditor* editor = new wxGridCellTextEditor; + ENVIRONMENT_VARIABLE_CHAR_VALIDATOR envVarValidator; + editor->SetValidator( envVarValidator ); + m_grid->SetCellEditor( (int) row, 0, editor ); + + editor = new wxGridCellTextEditor; + FILE_NAME_WITH_PATH_CHAR_VALIDATOR pathValidator; + editor->SetValidator( pathValidator ); + m_grid->SetCellEditor( (int) row, 1, editor ); + } +} + + +bool DIALOG_ENV_VAR_CONFIG::TransferDataToWindow() +{ + wxLogDebug( wxT( "In DIALOG_ENV_VAR_CONFIG::TransferDataToWindow()." ) ); + + if( !wxDialog::TransferDataToWindow() ) + return false; + + long row = 0L; + + for( ENV_VAR_MAP_ITER it = m_envVarMap.begin(); it != m_envVarMap.end(); ++it ) + { + m_grid->SetCellValue( row, 0, it->first ); + m_grid->SetCellValue( row, 1, it->second.GetValue() ); + + // Highlight environment variables that are externally defined. + if( it->second.GetDefinedExternally() ) + { + wxGridCellAttr* attr = m_grid->GetOrCreateCellAttr( row, 0 ); + attr->SetBackgroundColour( *wxLIGHT_GREY ); + m_grid->SetRowAttr( row, attr ); + } + + row++; + } + + m_grid->AutoSizeColumns(); + m_grid->AutoSizeRows(); + GetSizer()->Layout(); + GetSizer()->Fit( this ); + GetSizer()->SetSizeHints( this ); + + return true; +} + + +bool DIALOG_ENV_VAR_CONFIG::TransferDataFromWindow() +{ + if( !wxDialog::TransferDataFromWindow() ) + return false; + + int row; + wxArrayString envVarNames; + + for( row = 0; row < m_grid->GetNumberRows(); row++ ) + { + wxString caption = _( "Invalid Input" ); + wxString name = m_grid->GetCellValue( row, 0 ); + wxString value = m_grid->GetCellValue( row, 1 ); + + // Ignore completely empty rows. + if( name.IsEmpty() && value.IsEmpty() ) + continue; + + wxLogDebug( wxT( "Row %d, name: %s, value %s." ), row, + GetChars( name ), GetChars( value ) ); + + // Name cannot be empty. + if( name.IsEmpty() ) + { + wxMessageBox( _( "Environment variable name cannot be empty." ), + caption, wxOK | wxICON_ERROR, this ); + m_grid->GoToCell( row, 0 ); + m_grid->SetGridCursor( row, 0 ); + return false; + } + + // Value cannot be empty. + if( value.IsEmpty() ) + { + wxMessageBox( _( "Environment variable value cannot be empty." ), caption, + wxOK | wxICON_ERROR, this ); + m_grid->GoToCell( row, 1 ); + m_grid->SetGridCursor( row, 1 ); + m_grid->SetFocus(); + return false; + } + + // First character of the environment variable name cannot be a digit (0-9). + if( name.Left( 1 ).IsNumber() ) + { + wxMessageBox( _( "The first character of an environment variable name cannot be " + "a digit (0-9)." ), caption, wxOK | wxICON_ERROR, this ); + m_grid->GoToCell( row, 0 ); + m_grid->SetGridCursor( row, 0 ); + m_grid->SelectBlock( row, 0, row, 0 ); + m_grid->SetFocus(); + return false; + } + + // Check for duplicate environment variable names. + if( envVarNames.Index( name ) != wxNOT_FOUND ) + { + wxMessageBox( _( "Cannot have duplicate environment variable names." ), caption, + wxOK | wxICON_ERROR, this ); + m_grid->GoToCell( row, 0 ); + m_grid->SetGridCursor( row, 0 ); + m_grid->SelectRow( row ); + m_grid->SetFocus(); + return false; + } + + envVarNames.Add( name ); + } + + // Add new entries and update any modified entries. + for( row = 0; row < m_grid->GetNumberRows(); row++ ) + { + wxString name = m_grid->GetCellValue( row, 0 ); + wxString value = m_grid->GetCellValue( row, 1 ); + ENV_VAR_MAP_ITER it = m_envVarMap.find( name ); + + if( it == m_envVarMap.end() ) + { + ENV_VAR_ITEM item( value, wxGetEnv( name, NULL ) ); + + // Add new environment variable. + m_envVarMap[ name ] = item; + } + else if( it->second.GetValue() != value ) + { + // Environment variable already defined but it's value changed. + it->second.SetValue( value ); + + // Externally defined variable has been changed. + if( it->second.GetDefinedExternally() ) + m_extDefsChanged = true; + } + } + + std::vector< wxString > removeFromMap; + + // Remove deleted entries from the map. + for( ENV_VAR_MAP_ITER it = m_envVarMap.begin(); it != m_envVarMap.end(); ++it ) + { + bool found = false; + + for( row = 0; row < m_grid->GetNumberRows(); row++ ) + { + if( m_grid->GetCellValue( row, 0 ) == it->first ) + { + found = true; + break; + } + } + + if( !found ) + removeFromMap.push_back( it->first ); + } + + for( size_t i = 0; i < removeFromMap.size(); i++ ) + m_envVarMap.erase( removeFromMap[i] ); + + return true; +} + + +void DIALOG_ENV_VAR_CONFIG::OnAddRow( wxCommandEvent& aEvent ) +{ + m_grid->AppendRows(); + + int row = m_grid->GetNumberRows() - 1; + wxGridCellTextEditor* editor = new wxGridCellTextEditor; + ENVIRONMENT_VARIABLE_CHAR_VALIDATOR envVarNameValidator; + editor->SetValidator( envVarNameValidator ); + m_grid->SetCellEditor( row, 0, editor ); + + editor = new wxGridCellTextEditor; + FILE_NAME_WITH_PATH_CHAR_VALIDATOR pathValidator; + editor->SetValidator( pathValidator ); + m_grid->SetCellEditor( row, 1, editor ); + m_grid->GoToCell( row, 0 ); + m_grid->SetGridCursor( row, 0 ); + m_grid->SetFocus(); +} + + +void DIALOG_ENV_VAR_CONFIG::OnDeleteSelectedRows( wxCommandEvent& aEvent ) +{ + if( !m_grid->IsSelection() ) + return; + + wxGridUpdateLocker locker( m_grid ); + + for( int n = 0; n < m_grid->GetNumberRows(); ) + { + if( m_grid->IsInSelection( n , 0 ) ) + m_grid->DeleteRows( n, 1 ); + else + n++; + } +} + + +void DIALOG_ENV_VAR_CONFIG::OnHelpRequest( wxCommandEvent& aEvent ) +{ + wxString msg = _( "Enter the name and path for each environment variable. Grey entries " + "are names that have been defined externally at the system or user " + "level. Environment variables defined at the system or user level " + "take precedence over the ones defined in this table. This means the " + "values in this table are ignored." ); + msg << wxT( "

" ); + msg << _( "To ensure environment variable names are valid on all platforms, the name field " + "will only accept upper case letters, digits, and the underscore characters." ); + msg << wxT( "

" ); + msg << _( "KIGITHUB is used by KiCad to define the URL of the repository " + "of the official KiCad libraries." ); + msg << wxT( "

" ); + msg << _( "KISYS3DMOD is the base path of system footprint 3D " + "shapes (.3Dshapes folders)." ); + msg << wxT( "

" ); + msg << _( "KISYSMOD is the base path of locally installed system " + "footprint libraries (.pretty folders)." ); + msg << wxT( "

" ); + msg << _( "KIPRJMOD is internally defined by KiCad (cannot be edited) and is set " + "to the absolute path of the currently loaded project file. This environment " + "variable can be used to define files and paths relative to the currently loaded " + "project. For instance, ${KIPRJMOD}/libs/footprints.pretty can be defined as a " + "folder containing a project specific footprint library named footprints.pretty." ); + msg << wxT( "

" ); + msg << _( "KICAD_PTEMPLATES is optional and can be defined if you want to " + "create your own project templates folder." ); + + HTML_MESSAGE_BOX dlg( GetParent(), _( "Environment Variable Help" ) ); + dlg.AddHTML_Text( msg ); + dlg.ShowModal(); +} diff --git a/common/dialogs/dialog_env_var_config_base.cpp b/common/dialogs/dialog_env_var_config_base.cpp new file mode 100644 index 0000000..8f8590a --- /dev/null +++ b/common/dialogs/dialog_env_var_config_base.cpp @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 17 2015) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_env_var_config_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_ENV_VAR_CONFIG_BASE::DIALOG_ENV_VAR_CONFIG_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 ); + + wxBoxSizer* mainSizer; + mainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bupperSizer; + bupperSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bleftSizer; + bleftSizer = new wxBoxSizer( wxVERTICAL ); + + m_grid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_grid->CreateGrid( 0, 2 ); + m_grid->EnableEditing( true ); + m_grid->EnableGridLines( true ); + m_grid->EnableDragGridSize( true ); + m_grid->SetMargins( 0, 0 ); + + // Columns + m_grid->EnableDragColMove( false ); + m_grid->EnableDragColSize( true ); + m_grid->SetColLabelSize( 30 ); + m_grid->SetColLabelValue( 0, _("Name") ); + m_grid->SetColLabelValue( 1, _("Path") ); + m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_grid->EnableDragRowSize( true ); + m_grid->SetRowLabelSize( 40 ); + m_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + bleftSizer->Add( m_grid, 1, wxALL|wxEXPAND, 5 ); + + + bupperSizer->Add( bleftSizer, 1, wxEXPAND, 5 ); + + wxBoxSizer* brightSizer; + brightSizer = new wxBoxSizer( wxVERTICAL ); + + m_buttonAdd = new wxButton( this, wxID_ANY, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonAdd->SetToolTip( _("Add a new entry to the table.") ); + + brightSizer->Add( m_buttonAdd, 0, wxALL|wxEXPAND, 5 ); + + m_buttonDelete = new wxButton( this, wxID_ANY, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonDelete->SetToolTip( _("Remove the selected entry from the table.") ); + + brightSizer->Add( m_buttonDelete, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + + bupperSizer->Add( brightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + mainSizer->Add( bupperSizer, 1, wxEXPAND, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + mainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizerHelp = new wxButton( this, wxID_HELP ); + m_sdbSizer->AddButton( m_sdbSizerHelp ); + m_sdbSizer->Realize(); + + mainSizer->Add( m_sdbSizer, 0, wxALL|wxALIGN_RIGHT, 5 ); + + + this->SetSizer( mainSizer ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnAddRow ), NULL, this ); + m_buttonDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnDeleteSelectedRows ), NULL, this ); + m_sdbSizerHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnHelpRequest ), NULL, this ); +} + +DIALOG_ENV_VAR_CONFIG_BASE::~DIALOG_ENV_VAR_CONFIG_BASE() +{ + // Disconnect Events + m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnAddRow ), NULL, this ); + m_buttonDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnDeleteSelectedRows ), NULL, this ); + m_sdbSizerHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ENV_VAR_CONFIG_BASE::OnHelpRequest ), NULL, this ); + +} diff --git a/common/dialogs/dialog_env_var_config_base.fbp b/common/dialogs/dialog_env_var_config_base.fbp new file mode 100644 index 0000000..8c86db4 --- /dev/null +++ b/common/dialogs/dialog_env_var_config_base.fbp @@ -0,0 +1,558 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_env_var_config_base + 1000 + none + 1 + dialog_env_var_editor_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_ENV_VAR_CONFIG_BASE + + 363,177 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Path Configuration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mainSizer + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bupperSizer + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bleftSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 30 + "Name" "Path" + wxALIGN_CENTRE + 2 + + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 1 + 1 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_grid + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 40 + + wxALIGN_CENTRE + + 0 + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + + brightSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Add + + 0 + + + 0 + + 1 + m_buttonAdd + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Add a new entry to the table. + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddRow + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Delete + + 0 + + + 0 + + 1 + m_buttonDelete + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Remove the selected entry from the table. + + wxFILTER_NONE + wxDefaultValidator + + + + + OnDeleteSelectedRows + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_RIGHT + 0 + + 0 + 1 + 0 + 1 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + + + OnHelpRequest + + + + + + + + + + diff --git a/common/dialogs/dialog_env_var_config_base.h b/common/dialogs/dialog_env_var_config_base.h new file mode 100644 index 0000000..69b74f2 --- /dev/null +++ b/common/dialogs/dialog_env_var_config_base.h @@ -0,0 +1,61 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 17 2015) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_ENV_VAR_CONFIG_BASE_H__ +#define __DIALOG_ENV_VAR_CONFIG_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_ENV_VAR_CONFIG_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_ENV_VAR_CONFIG_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxGrid* m_grid; + wxButton* m_buttonAdd; + wxButton* m_buttonDelete; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + wxButton* m_sdbSizerHelp; + + // Virtual event handlers, overide them in your derived class + virtual void OnAddRow( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDeleteSelectedRows( wxCommandEvent& event ) { event.Skip(); } + virtual void OnHelpRequest( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_ENV_VAR_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Path Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 363,177 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_ENV_VAR_CONFIG_BASE(); + +}; + +#endif //__DIALOG_ENV_VAR_CONFIG_BASE_H__ diff --git a/common/dialogs/dialog_exit_base.cpp b/common/dialogs/dialog_exit_base.cpp new file mode 100644 index 0000000..0e1d422 --- /dev/null +++ b/common/dialogs/dialog_exit_base.cpp @@ -0,0 +1,98 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_exit_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_EXIT_BASE::DIALOG_EXIT_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 ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerUpper; + bSizerUpper = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerBitmap; + bSizerBitmap = new wxBoxSizer( wxVERTICAL ); + + m_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerBitmap->Add( m_bitmap, 0, wxALL, 5 ); + + + bSizerUpper->Add( bSizerBitmap, 0, 0, 5 ); + + wxBoxSizer* bSizerMessages; + bSizerMessages = new wxBoxSizer( wxVERTICAL ); + + m_TextInfo = new wxStaticText( this, wxID_ANY, _("Save the changes before closing?"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextInfo->Wrap( -1 ); + m_TextInfo->SetFont( wxFont( 8, 74, 90, 92, false, wxT("MS Shell Dlg 2") ) ); + + bSizerMessages->Add( m_TextInfo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizerMessages->Add( 10, 10, 0, 0, 5 ); + + m_staticText2 = new wxStaticText( this, wxID_ANY, _("If you don't save, all your changes will be permanently lost."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2->Wrap( -1 ); + bSizerMessages->Add( m_staticText2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizerUpper->Add( bSizerMessages, 1, wxEXPAND, 5 ); + + + bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizerLower; + bSizerLower = new wxBoxSizer( wxVERTICAL ); + + m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerLower->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerButtons; + bSizerButtons = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonSaveAndExit = new wxButton( this, wxID_ANY, _("Save and Exit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSaveAndExit->SetDefault(); + bSizerButtons->Add( m_buttonSaveAndExit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonExitNoSave = new wxButton( this, wxID_ANY, _("Exit without Save"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonExitNoSave, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerLower->Add( bSizerButtons, 0, wxALIGN_RIGHT, 5 ); + + + bSizerMain->Add( bSizerLower, 0, wxEXPAND, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + bSizerMain->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + m_buttonSaveAndExit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSaveAndExit ), NULL, this ); + m_buttonExitNoSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnExitNoSave ), NULL, this ); + m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnCancel ), NULL, this ); +} + +DIALOG_EXIT_BASE::~DIALOG_EXIT_BASE() +{ + // Disconnect Events + m_buttonSaveAndExit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSaveAndExit ), NULL, this ); + m_buttonExitNoSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnExitNoSave ), NULL, this ); + m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnCancel ), NULL, this ); + +} diff --git a/common/dialogs/dialog_exit_base.fbp b/common/dialogs/dialog_exit_base.fbp new file mode 100644 index 0000000..a02b755 --- /dev/null +++ b/common/dialogs/dialog_exit_base.fbp @@ -0,0 +1,754 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_exit_base + 1000 + none + 1 + dialog_exit_base + + . + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_EXIT_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizerUpper + wxHORIZONTAL + none + + 5 + + 0 + + + bSizerBitmap + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_bitmap + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerMessages + wxVERTICAL + none + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + MS Shell Dlg 2,90,92,8,74,0 + 0 + 0 + wxID_ANY + Save the changes before closing? + + 0 + + + 0 + + 1 + m_TextInfo + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + 10 + protected + 10 + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + If you don't save, all your changes will be permanently lost. + + 0 + + + 0 + + 1 + m_staticText2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizerLower + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT + 0 + + + bSizerButtons + wxHORIZONTAL + none + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Save and Exit + + 0 + + + 0 + + 1 + m_buttonSaveAndExit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnSaveAndExit + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Exit without Save + + 0 + + + 0 + + 1 + m_buttonExitNoSave + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnExitNoSave + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_CANCEL + Cancel + + 0 + + + 0 + + 1 + m_buttonCancel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCancel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/dialogs/dialog_exit_base.h b/common/dialogs/dialog_exit_base.h new file mode 100644 index 0000000..7330435 --- /dev/null +++ b/common/dialogs/dialog_exit_base.h @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_EXIT_BASE_H__ +#define __DIALOG_EXIT_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_EXIT_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_EXIT_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticBitmap* m_bitmap; + wxStaticText* m_TextInfo; + wxStaticText* m_staticText2; + wxStaticLine* m_staticline; + wxButton* m_buttonSaveAndExit; + wxButton* m_buttonExitNoSave; + wxButton* m_buttonCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnSaveAndExit( wxCommandEvent& event ) { event.Skip(); } + virtual void OnExitNoSave( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_EXIT_BASE(); + +}; + +#endif //__DIALOG_EXIT_BASE_H__ diff --git a/common/dialogs/dialog_get_component.cpp b/common/dialogs/dialog_get_component.cpp new file mode 100644 index 0000000..c0516bb --- /dev/null +++ b/common/dialogs/dialog_get_component.cpp @@ -0,0 +1,144 @@ +/*********************************/ +/* dialog_get_component.cpp */ +/*********************************/ + +#include +#include +#include +#include +#include + + +/****************************************************************************/ +/* Show a dialog frame to choose a name from an history list, or a new name */ +/* to select a component or a module */ +/****************************************************************************/ + +static unsigned s_HistoryMaxCount = 8; // Max number of items displayed in history list + + +/* + * Dialog frame to choose a component or a footprint + * This dialog shows an history of last selected items + */ +DIALOG_GET_COMPONENT::DIALOG_GET_COMPONENT( EDA_DRAW_FRAME* parent, + wxArrayString& HistoryList, + const wxString& Title, + bool show_extra_tool ) : + DIALOG_GET_COMPONENT_BASE( parent, -1, Title ) +{ + +#ifdef __WXMAC__ + m_auxToolSelector = false; +#else + m_auxToolSelector = show_extra_tool; +#endif + initDialog( HistoryList ); + + m_textCmpNameCtrl->SetFocus(); + GetSizer()->Fit( this ); + GetSizer()->SetSizeHints( this ); +} + +void DIALOG_GET_COMPONENT::initDialog( wxArrayString& aHistoryList ) +{ + SetFocus(); + m_GetExtraFunction = false; + m_selectionIsKeyword = false; + m_historyList->Append( aHistoryList ); + if( !m_auxToolSelector ) + { + m_buttonBrowse->Show( false ); + m_buttonBrowse->Enable( false ); + } +} + + +void DIALOG_GET_COMPONENT::OnCancel( wxCommandEvent& event ) +{ + m_Text = wxEmptyString; + EndModal( wxID_CANCEL ); +} + +void DIALOG_GET_COMPONENT::Accept( wxCommandEvent& event ) +{ + m_selectionIsKeyword = false; + switch( event.GetId() ) + { + case ID_SEL_BY_LISTBOX: + m_Text = m_historyList->GetStringSelection(); + break; + + case wxID_OK: + m_Text = m_textCmpNameCtrl->GetValue(); + break; + + case ID_ACCEPT_KEYWORD: + m_selectionIsKeyword = true; + m_Text = m_textCmpNameCtrl->GetValue(); + break; + + case ID_LIST_ALL: + m_Text = wxT( "*" ); + break; + } + + m_Text.Trim( false ); // Remove blanks at beginning + m_Text.Trim( true ); // Remove blanks at end + + EndModal( wxID_OK ); +} + + +/* Get the component name by the extra function */ +void DIALOG_GET_COMPONENT::GetExtraSelection( wxCommandEvent& event ) +{ + m_GetExtraFunction = true; + EndModal( wxID_OK ); +} + + +// Return the component name selected by the dialog +wxString DIALOG_GET_COMPONENT::GetComponentName( void ) +{ + return m_Text; +} + + +/* Initialize the default component name default choice +*/ +void DIALOG_GET_COMPONENT::SetComponentName( const wxString& name ) +{ + if( m_textCmpNameCtrl ) + { + m_textCmpNameCtrl->SetValue( name ); + m_textCmpNameCtrl->SetSelection(-1, -1); + } +} + + +/* + * Add the string "aName" to the history list aHistoryList + */ +void AddHistoryComponentName( wxArrayString& aHistoryList, const wxString& aName ) +{ + if( ( aHistoryList.GetCount() > 0 ) && ( aName == aHistoryList[0] ) ) + return; + + /* remove an old identical name if exists */ + for( unsigned ii = 1; ii < aHistoryList.GetCount(); ii++ ) + { + if( aName == aHistoryList[ii] ) + { + aHistoryList.RemoveAt( ii ); + ii--; + } + } + + // Add the new name at the beginning of the history list + aHistoryList.Insert(aName, 0); + + // Remove extra names + while( aHistoryList.GetCount() >= s_HistoryMaxCount ) + aHistoryList.RemoveAt( aHistoryList.GetCount()-1 ); +} diff --git a/common/dialogs/dialog_get_component_base.cpp b/common/dialogs/dialog_get_component_base.cpp new file mode 100644 index 0000000..8e8810c --- /dev/null +++ b/common/dialogs/dialog_get_component_base.cpp @@ -0,0 +1,90 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Nov 5 2013) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_get_component_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_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 ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerLeft; + bSizerLeft = new wxBoxSizer( wxVERTICAL ); + + m_staticTextName = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextName->Wrap( -1 ); + bSizerLeft->Add( m_staticTextName, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_textCmpNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textCmpNameCtrl->SetMaxLength( 0 ); + bSizerLeft->Add( m_textCmpNameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_staticTextHistory = new wxStaticText( this, wxID_ANY, _("History list:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextHistory->Wrap( -1 ); + bSizerLeft->Add( m_staticTextHistory, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_historyList = new wxListBox( this, ID_SEL_BY_LISTBOX, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + m_historyList->SetMinSize( wxSize( 200,100 ) ); + + bSizerLeft->Add( m_historyList, 1, wxALL|wxEXPAND, 5 ); + + + bSizerMain->Add( bSizerLeft, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizerRight; + bSizerRight = new wxBoxSizer( wxVERTICAL ); + + m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonOK->SetDefault(); + bSizerRight->Add( m_buttonOK, 0, wxALL|wxEXPAND, 5 ); + + m_buttonKW = new wxButton( this, ID_ACCEPT_KEYWORD, _("Search by Keyword"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_buttonKW, 0, wxALL|wxEXPAND, 5 ); + + m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 ); + + m_buttonList = new wxButton( this, ID_LIST_ALL, _("List All"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_buttonList, 0, wxALL|wxEXPAND, 5 ); + + m_buttonBrowse = new wxButton( this, ID_EXTRA_TOOL, _("Select by Browser"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_buttonBrowse, 0, wxALL|wxEXPAND, 5 ); + + + bSizerMain->Add( bSizerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + bSizerMain->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + m_historyList->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this ); + m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this ); + m_buttonKW->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this ); + m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::OnCancel ), NULL, this ); + m_buttonList->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this ); + m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::GetExtraSelection ), NULL, this ); +} + +DIALOG_GET_COMPONENT_BASE::~DIALOG_GET_COMPONENT_BASE() +{ + // Disconnect Events + m_historyList->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this ); + m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this ); + m_buttonKW->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this ); + m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::OnCancel ), NULL, this ); + m_buttonList->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::Accept ), NULL, this ); + m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GET_COMPONENT_BASE::GetExtraSelection ), NULL, this ); + +} diff --git a/common/dialogs/dialog_get_component_base.fbp b/common/dialogs/dialog_get_component_base.fbp new file mode 100644 index 0000000..10a950c --- /dev/null +++ b/common/dialogs/dialog_get_component_base.fbp @@ -0,0 +1,906 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_get_component_base + 1000 + none + 1 + dialog_get_component_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_GET_COMPONENT_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizerLeft + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Name: + + 0 + + + 0 + + 1 + m_staticTextName + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_textCmpNameCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + History list: + + 0 + + + 0 + + 1 + m_staticTextHistory + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_SEL_BY_LISTBOX + + 0 + + + 0 + 200,100 + 1 + m_historyList + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + Accept + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + + bSizerRight + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_OK + OK + + 0 + + + 0 + + 1 + m_buttonOK + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + Accept + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_ACCEPT_KEYWORD + Search by Keyword + + 0 + + + 0 + + 1 + m_buttonKW + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + Accept + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_CANCEL + Cancel + + 0 + + + 0 + + 1 + m_buttonCancel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCancel + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_LIST_ALL + List All + + 0 + + + 0 + + 1 + m_buttonList + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + Accept + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_EXTRA_TOOL + Select by Browser + + 0 + + + 0 + + 1 + m_buttonBrowse + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + GetExtraSelection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/dialogs/dialog_get_component_base.h b/common/dialogs/dialog_get_component_base.h new file mode 100644 index 0000000..a0a39d5 --- /dev/null +++ b/common/dialogs/dialog_get_component_base.h @@ -0,0 +1,67 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Nov 5 2013) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_GET_COMPONENT_BASE_H__ +#define __DIALOG_GET_COMPONENT_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +#define ID_SEL_BY_LISTBOX 1000 +#define ID_ACCEPT_KEYWORD 1001 +#define ID_LIST_ALL 1002 +#define ID_EXTRA_TOOL 1003 + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_GET_COMPONENT_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_GET_COMPONENT_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticText* m_staticTextName; + wxTextCtrl* m_textCmpNameCtrl; + wxStaticText* m_staticTextHistory; + wxListBox* m_historyList; + wxButton* m_buttonOK; + wxButton* m_buttonKW; + wxButton* m_buttonCancel; + wxButton* m_buttonList; + wxButton* m_buttonBrowse; + + // Virtual event handlers, overide them in your derived class + virtual void Accept( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + virtual void GetExtraSelection( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_GET_COMPONENT_BASE(); + +}; + +#endif //__DIALOG_GET_COMPONENT_BASE_H__ diff --git a/common/dialogs/dialog_hotkeys_editor.cpp b/common/dialogs/dialog_hotkeys_editor.cpp new file mode 100644 index 0000000..0dfedf2 --- /dev/null +++ b/common/dialogs/dialog_hotkeys_editor.cpp @@ -0,0 +1,389 @@ +/** + * @file dialog_hotkeys_editor.cpp + */ + +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 1992-2014 Kicad Developers, see CHANGELOG.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 + +#include +#include +#include +#include + +#include + + +HOTKEY_LIST_CTRL::HOTKEY_LIST_CTRL( wxWindow *aParent, struct EDA_HOTKEY_CONFIG* aSection ) : + wxListCtrl( aParent, wxID_ANY, wxDefaultPosition, + wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VIRTUAL ) +{ + m_sectionTag = aSection->m_SectionTag; + m_curEditingRow = -1; + + InsertColumn( 0, _( "Command" ) ); + InsertColumn( 1, _( "Hotkey" ) ); + + // Add a dummy hotkey_spec which is a header before each hotkey list + EDA_HOTKEY** hotkey_descr_list; + + // Add a copy of hotkeys to our list + for( hotkey_descr_list = aSection->m_HK_InfoList; *hotkey_descr_list; hotkey_descr_list++ ) + { + EDA_HOTKEY* hotkey_descr = *hotkey_descr_list; + m_hotkeys.push_back( new EDA_HOTKEY( hotkey_descr ) ); + } + + // Set item count to hotkey size, this gets it to autoload the entries + SetItemCount( m_hotkeys.size() ); + + SetColumnWidth( 0, wxLIST_AUTOSIZE ); + SetColumnWidth( 1, wxLIST_AUTOSIZE ); + + Bind( wxEVT_CHAR, &HOTKEY_LIST_CTRL::OnChar, this ); + Bind( wxEVT_LIST_ITEM_SELECTED, &HOTKEY_LIST_CTRL::OnListItemSelected, this ); + Bind( wxEVT_SIZE, &HOTKEY_LIST_CTRL::OnSize, this ); +} + + +void HOTKEY_LIST_CTRL::OnSize( wxSizeEvent& aEvent ) +{ + recalculateColumns(); + aEvent.Skip(); +} + + +void HOTKEY_LIST_CTRL::recalculateColumns() +{ + float totalLength = 0; + float scale = 0; + + // Find max character length of first column + int maxInfoMsgLength = 0; + + for( int i = 0; i < GetItemCount(); i++ ) + { + int length = GetItemText( i, 0 ).Length(); + + if( length > maxInfoMsgLength ) + maxInfoMsgLength = length; + } + + // Find max character length of second column + int maxKeyCodeLength = 0; + + for( int i = 0; i < GetItemCount(); i++ ) + { + int length = GetItemText( i, 1 ).Length(); + if( length > maxKeyCodeLength ) + maxKeyCodeLength = length; + } + + // Use the lengths of column texts to create a scale of the max list width + // to set the column widths + totalLength = maxInfoMsgLength + maxKeyCodeLength; + + scale = (double) GetClientSize().x / totalLength; + + SetColumnWidth( 0, int( maxInfoMsgLength*scale ) - 2 ); + SetColumnWidth( 1, int( maxKeyCodeLength*scale ) ); +} + + +void HOTKEY_LIST_CTRL::OnListItemSelected( wxListEvent& aEvent ) +{ + m_curEditingRow = aEvent.GetIndex(); +} + + +void HOTKEY_LIST_CTRL::DeselectRow( int aRow ) +{ + SetItemState( aRow, 0, wxLIST_STATE_SELECTED ); +} + + +wxString HOTKEY_LIST_CTRL::OnGetItemText( long aRow, long aColumn ) const +{ + EDA_HOTKEY* hotkey_descr = m_hotkeys[aRow]; + + if( aColumn == 0 ) + { + return wxGetTranslation( hotkey_descr->m_InfoMsg ); + } + else + { + return KeyNameFromKeyCode( hotkey_descr->m_KeyCode ); + } +} + + +void HOTKEY_LIST_CTRL::OnChar( wxKeyEvent& aEvent ) +{ + if( m_curEditingRow != -1 ) + { + long key = aEvent.GetKeyCode(); + + switch( key ) + { + case WXK_ESCAPE: + // Remove selection + DeselectRow( m_curEditingRow ); + m_curEditingRow = -1; + break; + + default: + if( key >= 'a' && key <= 'z' ) // convert to uppercase + key = key + ('A' - 'a'); + + // Remap Ctrl A (=1+GR_KB_CTRL) to Ctrl Z(=26+GR_KB_CTRL) + // to GR_KB_CTRL+'A' .. GR_KB_CTRL+'Z' + if( aEvent.ControlDown() && key >= WXK_CONTROL_A && key <= WXK_CONTROL_Z ) + key += 'A' - 1; + + /* Disallow shift for keys that have two keycodes on them (e.g. number and + * punctuation keys) leaving only the "letter keys" of A-Z. + * Then, you can have, e.g. Ctrl-5 and Ctrl-% (GB layout) + * and Ctrl-( and Ctrl-5 (FR layout). + * Otherwise, you'd have to have to say Ctrl-Shift-5 on a FR layout + */ + bool keyIsLetter = key >= 'A' && key <= 'Z'; + + if( aEvent.ShiftDown() && ( keyIsLetter || key > 256 ) ) + key |= GR_KB_SHIFT; + + if( aEvent.ControlDown() ) + key |= GR_KB_CTRL; + + if( aEvent.AltDown() ) + key |= GR_KB_ALT; + + // See if this key code is handled in hotkeys names list + bool exists; + KeyNameFromKeyCode( key, &exists ); + + if( exists && m_hotkeys[m_curEditingRow]->m_KeyCode != key ) + { + bool canUpdate = ((HOTKEY_SECTION_PAGE *)m_parent)->GetDialog()->CanSetKey( key, m_sectionTag ); + + if( canUpdate ) + { + m_hotkeys[m_curEditingRow]->m_KeyCode = key; + recalculateColumns(); + } + + // Remove selection + DeselectRow( m_curEditingRow ); + m_curEditingRow = -1; + } + } + } + RefreshItems(0,m_hotkeys.size()-1); +} + + +void HOTKEY_LIST_CTRL::RestoreFrom( struct EDA_HOTKEY_CONFIG* aSection ) +{ + int row = 0; + + EDA_HOTKEY** info_ptr; + + for( info_ptr = aSection->m_HK_InfoList; *info_ptr; info_ptr++ ) + { + EDA_HOTKEY* info = *info_ptr; + m_hotkeys[row++]->m_KeyCode = info->m_KeyCode; + } + + // Remove selection + DeselectRow( m_curEditingRow ); + m_curEditingRow = -1; + + RefreshItems( 0, m_hotkeys.size()-1 ); +} + + +HOTKEY_SECTION_PAGE::HOTKEY_SECTION_PAGE( HOTKEYS_EDITOR_DIALOG* aDialog, + wxNotebook* aParent, + const wxString& aTitle, + EDA_HOTKEY_CONFIG* aSection ) : + wxPanel( aParent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER ), + m_hotkeySection( aSection ), + m_dialog( aDialog ) +{ + aParent->AddPage( this, aTitle ); + + wxBoxSizer* bMainSizer = new wxBoxSizer( wxVERTICAL ); + + SetSizer( bMainSizer ); + Layout(); + bMainSizer->Fit( this ); + + m_hotkeyList = new HOTKEY_LIST_CTRL( this, aSection ); + bMainSizer->Add( m_hotkeyList, 1, wxALL|wxEXPAND, 5 ); +} + + +void HOTKEY_SECTION_PAGE::Restore() +{ + m_hotkeyList->RestoreFrom( m_hotkeySection ); + + Update(); +} + + +void InstallHotkeyFrame( EDA_BASE_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys ) +{ + HOTKEYS_EDITOR_DIALOG dialog( aParent, aHotkeys ); + + int diag = dialog.ShowModal(); + if( diag == wxID_OK ) + { + aParent->ReCreateMenuBar(); + aParent->Refresh(); + } +} + + +HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_BASE_FRAME* aParent, + EDA_HOTKEY_CONFIG* aHotkeys ) : + HOTKEYS_EDITOR_DIALOG_BASE( aParent ), + m_parent( aParent ), + m_hotkeys( aHotkeys ) +{ + EDA_HOTKEY_CONFIG* section; + + for( section = m_hotkeys; section->m_HK_InfoList; section++ ) + { + m_hotkeySectionPages.push_back( new HOTKEY_SECTION_PAGE( this, m_hotkeySections, + wxGetTranslation( *section->m_Title ), + section ) ); + } + + m_sdbSizerOK->SetDefault(); + Center(); +} + + +void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event ) +{ + std::vector::iterator i; + + for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i ) + { + std::vector& hotkey_vec = (*i)->GetHotkeys(); + EDA_HOTKEY_CONFIG* section = (*i)->GetHotkeySection(); + + EDA_HOTKEY** info_ptr; + + for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ ) + { + EDA_HOTKEY* info = *info_ptr; + + /* find the corresponding hotkey */ + std::vector::iterator j; + + for( j = hotkey_vec.begin(); j != hotkey_vec.end(); ++j ) + { + if( (*j) && (*j)->m_Idcommand == info->m_Idcommand ) + { + info->m_KeyCode = (*j)->m_KeyCode; + break; + } + } + } + } + + /* save the hotkeys */ + m_parent->WriteHotkeyConfig( m_hotkeys ); + + EndModal( wxID_OK ); +} + + + +void HOTKEYS_EDITOR_DIALOG::UndoClicked( wxCommandEvent& aEvent ) +{ + std::vector::iterator i; + + for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i ) + { + (*i)->Restore(); + } +} + + +bool HOTKEYS_EDITOR_DIALOG::CanSetKey( long aKey, const wxString* sectionTag ) +{ + std::vector::iterator i; + + EDA_HOTKEY* conflictingKey = NULL; + HOTKEY_SECTION_PAGE* conflictingSection = NULL; + + for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i ) + { + // Any non Common section can only conflict with itself and Common + if( *sectionTag != g_CommonSectionTag + && *((*i)->GetHotkeySection()->m_SectionTag) != g_CommonSectionTag + && *((*i)->GetHotkeySection()->m_SectionTag) != *sectionTag ) + continue; + + std::vector& hotkey_vec = (*i)->GetHotkeys(); + /* find the corresponding hotkey */ + std::vector::iterator j; + + for( j = hotkey_vec.begin(); j != hotkey_vec.end(); ++j ) + { + if( aKey == (*j)->m_KeyCode ) + { + conflictingKey = (*j); + conflictingSection = (*i); + + break; + } + } + } + + if( conflictingKey != NULL ) + { + wxString info = wxGetTranslation( conflictingKey->m_InfoMsg ); + wxString msg = wxString::Format( + _( "<%s> is already assigned to \"%s\" in section \"%s\". Are you sure you want " + "to change its assignment?" ), + KeyNameFromKeyCode( aKey ), GetChars( info ), + *(conflictingSection->GetHotkeySection()->m_Title) ); + + wxMessageDialog dlg( this, msg, _( "Confirm change" ), wxYES_NO | wxNO_DEFAULT ); + + if( dlg.ShowModal() == wxID_YES ) + { + conflictingKey->m_KeyCode = 0; + return true; + } + else + { + return false; + } + } + + return true; +} diff --git a/common/dialogs/dialog_hotkeys_editor_base.cpp b/common/dialogs/dialog_hotkeys_editor_base.cpp new file mode 100644 index 0000000..ef2f7c9 --- /dev/null +++ b/common/dialogs/dialog_hotkeys_editor_base.cpp @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 17 2015) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_hotkeys_editor_base.h" + +/////////////////////////////////////////////////////////////////////////// + +HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_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 ); + + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, _("Select a row and press a new key combination to alter the binding."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( 400 ); + bMainSizer->Add( m_staticText1, 0, wxALL|wxEXPAND, 5 ); + + m_hotkeySections = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + bMainSizer->Add( m_hotkeySections, 1, wxEXPAND | wxALL, 5 ); + + wxBoxSizer* b_buttonsSizer; + b_buttonsSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); + + b_buttonsSizer->Add( m_sdbSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + m_undoButton = new wxButton( this, wxID_UNDO, _("Undo"), wxDefaultPosition, wxDefaultSize, 0 ); + b_buttonsSizer->Add( m_undoButton, 0, wxALL|wxEXPAND, 5 ); + + + bMainSizer->Add( b_buttonsSizer, 0, wxALIGN_RIGHT, 5 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + + // Connect Events + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnOKClicked ), NULL, this ); + m_undoButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::UndoClicked ), NULL, this ); +} + +HOTKEYS_EDITOR_DIALOG_BASE::~HOTKEYS_EDITOR_DIALOG_BASE() +{ + // Disconnect Events + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnOKClicked ), NULL, this ); + m_undoButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::UndoClicked ), NULL, this ); + +} diff --git a/common/dialogs/dialog_hotkeys_editor_base.fbp b/common/dialogs/dialog_hotkeys_editor_base.fbp new file mode 100644 index 0000000..7b12ee4 --- /dev/null +++ b/common/dialogs/dialog_hotkeys_editor_base.fbp @@ -0,0 +1,391 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_hotkeys_editor_base + 1000 + none + 1 + dialog_hotkeys_editor_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + HOTKEYS_EDITOR_DIALOG_BASE + + 450,500 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Hotkeys Editor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bMainSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Select a row and press a new key combination to alter the binding. + + 0 + + + 0 + + 1 + m_staticText1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + 400 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_hotkeySections + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT + 0 + + + b_buttonsSizer + wxHORIZONTAL + none + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + + + + + OnOKClicked + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_UNDO + Undo + + 0 + + + 0 + + 1 + m_undoButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + UndoClicked + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/dialogs/dialog_hotkeys_editor_base.h b/common/dialogs/dialog_hotkeys_editor_base.h new file mode 100644 index 0000000..f0d4d9e --- /dev/null +++ b/common/dialogs/dialog_hotkeys_editor_base.h @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 17 2015) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_HOTKEYS_EDITOR_BASE_H__ +#define __DIALOG_HOTKEYS_EDITOR_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class HOTKEYS_EDITOR_DIALOG_BASE +/////////////////////////////////////////////////////////////////////////////// +class HOTKEYS_EDITOR_DIALOG_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticText* m_staticText1; + wxNotebook* m_hotkeySections; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + wxButton* m_undoButton; + + // Virtual event handlers, overide them in your derived class + virtual void OnOKClicked( wxCommandEvent& event ) { event.Skip(); } + virtual void UndoClicked( wxCommandEvent& event ) { event.Skip(); } + + + public: + + HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hotkeys Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 450,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~HOTKEYS_EDITOR_DIALOG_BASE(); + +}; + +#endif //__DIALOG_HOTKEYS_EDITOR_BASE_H__ diff --git a/common/dialogs/dialog_image_editor.cpp b/common/dialogs/dialog_image_editor.cpp new file mode 100644 index 0000000..9d0edd2 --- /dev/null +++ b/common/dialogs/dialog_image_editor.cpp @@ -0,0 +1,179 @@ +/** + * @file dialog_image_editor.cpp + */ + +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2011 jean-pierre.charras + * Copyright (C) 2011 Kicad Developers, see change_log.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 +#include +#include +#include + +#include + +DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem ) + : DIALOG_IMAGE_EDITOR_BASE( aParent ) +{ + m_workingImage = new BITMAP_BASE( * aItem ); + m_lastImage = NULL; + m_buttonUndoLast->Enable( false ); + wxString msg; + msg.Printf( wxT("%f"), m_workingImage->m_Scale ); + m_textCtrlScale->SetValue( msg ); + + GetSizer()->SetSizeHints( this ); + Layout(); + Fit(); + SetMinSize( GetBestSize() ); + + Centre(); + SetFocus(); +} + +void DIALOG_IMAGE_EDITOR::OnUndoLastChange( wxCommandEvent& event ) +{ + BITMAP_BASE * tmp = m_workingImage; + m_workingImage = m_lastImage; + delete tmp; + m_buttonUndoLast->Enable( false ); + m_lastImage = NULL; + m_panelDraw->Refresh(); +} + +void DIALOG_IMAGE_EDITOR::OnMirrorX_click( wxCommandEvent& event ) +{ + delete m_lastImage; + m_lastImage = new BITMAP_BASE( * m_workingImage ); + m_buttonUndoLast->Enable( true ); + m_buttonUndoLast->Enable( true ); + m_workingImage->Mirror( true ); + m_panelDraw->Refresh(); +} + +void DIALOG_IMAGE_EDITOR::OnMirrorY_click( wxCommandEvent& event ) +{ + delete m_lastImage; + m_lastImage = new BITMAP_BASE( * m_workingImage ); + m_buttonUndoLast->Enable( true ); + m_workingImage->Mirror( false ); + m_panelDraw->Refresh(); +} + +void DIALOG_IMAGE_EDITOR::OnRotateClick( wxCommandEvent& event ) +{ + delete m_lastImage; + m_lastImage = new BITMAP_BASE( * m_workingImage ); + m_buttonUndoLast->Enable( true ); + m_workingImage->Rotate( false ); + m_panelDraw->Refresh(); +} + +void DIALOG_IMAGE_EDITOR::OnGreyScaleConvert( wxCommandEvent& event ) +{ + delete m_lastImage; + m_lastImage = new BITMAP_BASE( * m_workingImage ); + m_buttonUndoLast->Enable( true ); + wxImage& image = *m_workingImage->GetImageData(); + image = image.ConvertToGreyscale(); + m_workingImage->RebuildBitmap(); + m_panelDraw->Refresh(); +} + +void DIALOG_IMAGE_EDITOR::OnHalfSize( wxCommandEvent& event ) +{ + delete m_lastImage; + m_lastImage = new BITMAP_BASE( * m_workingImage ); + m_buttonUndoLast->Enable( true ); + wxSize psize = m_workingImage->GetSizePixels(); + wxImage& image = *m_workingImage->GetImageData(); + + image = image.Scale(psize.x/2, psize.y/2, wxIMAGE_QUALITY_HIGH); + m_workingImage->RebuildBitmap(); + m_panelDraw->Refresh(); +} + +/* Test params values correctness + * Currently scale value must give an actual image + * > MIN_SIZE pixels and < MAX_SIZE pixels + */ +bool DIALOG_IMAGE_EDITOR::CheckValues() +{ + #define MIN_SIZE 16 + #define MAX_SIZE 6000 + double tmp; + wxString msg = m_textCtrlScale->GetValue(); + // Test number correctness + if( ! msg.ToDouble( &tmp ) ) + { + wxMessageBox( _("Incorrect scale number" ) ); + return false; + } + + // Test value correctness + wxSize psize = m_workingImage->GetSizePixels(); + if ( (psize.x * tmp) < MIN_SIZE || (psize.y * tmp) < MIN_SIZE ) + { + wxMessageBox( _("Scale is too small for this image" ) ); + return false; + } + if ( (psize.x * tmp) > MAX_SIZE || (psize.y * tmp) > MAX_SIZE ) + { + wxMessageBox( _("Scale is too large for this image" ) ); + return false; + } + + return true; +} + +void DIALOG_IMAGE_EDITOR::OnOK_Button( wxCommandEvent& aEvent ) +{ + if( CheckValues() ) + EndModal( wxID_OK ); + return; +} + +void DIALOG_IMAGE_EDITOR::OnCancel_Button( wxCommandEvent& aEvent ) +{ + EndModal( wxID_CANCEL ); +} + +void DIALOG_IMAGE_EDITOR::OnRedrawPanel( wxPaintEvent& event ) +{ + wxPaintDC dc( m_panelDraw ); + wxSize size = m_panelDraw->GetClientSize(); + dc.SetDeviceOrigin( size.x/2, size.y/2 ); + + double scale = 1.0 / m_workingImage->GetScalingFactor(); + dc.SetUserScale( scale, scale ); + m_workingImage->DrawBitmap( NULL, &dc, wxPoint(0,0) ); +} + +void DIALOG_IMAGE_EDITOR::TransfertToImage(BITMAP_BASE* aItem ) +{ + wxString msg = m_textCtrlScale->GetValue(); + msg.ToDouble( &m_workingImage->m_Scale ); + aItem->ImportData( m_workingImage ); +} + diff --git a/common/dialogs/dialog_image_editor.fbp b/common/dialogs/dialog_image_editor.fbp new file mode 100644 index 0000000..04c5c7e --- /dev/null +++ b/common/dialogs/dialog_image_editor.fbp @@ -0,0 +1,978 @@ + + + + + + C++ + 1 + source_name + 0 + res + UTF-8 + connect + dialog_image_editor_base + 1000 + none + 1 + dialog_image_editor + + . + + 1 + 1 + 0 + 0 + + 1 + 1 + 1 + 1 + 0 + + + + + 1 + wxBOTH + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + impl_virtual + + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + DIALOG_IMAGE_EDITOR_BASE + 1 + + + 1 + + + Resizable + + 1 + 340,299 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + Image Editor + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bUpperSizer + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizerLeft + wxHORIZONTAL + none + + 5 + wxEXPAND | wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + 256,256 + 1 + m_panelDraw + 1 + + + protected + 1 + + + Resizable + + 1 + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + wxFULL_REPAINT_ON_RESIZE|wxSIMPLE_BORDER|wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + OnRedrawPanel + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizerRight + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Mirror X + + + 0 + + + 0 + + 1 + m_buttonMirrorX + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnMirrorX_click + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Mirror Y + + + 0 + + + 0 + + 1 + m_buttonMirrorY + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnMirrorY_click + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Rotate + + + 0 + + + 0 + + 1 + m_buttonRotate + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRotateClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Grey + + + 0 + + + 0 + + 1 + m_buttonGrey + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnGreyScaleConvert + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Half Size + + + 0 + + + 0 + + 1 + m_buttonHalfSize + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnHalfSize + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Undo Last + + + 0 + + + 0 + + 1 + m_buttonUndoLast + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnUndoLastChange + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Image Scale: + + + 0 + + + 0 + + 1 + m_staticTextScale + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + 0 + + 0 + + 1 + m_textCtrlScale + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + OnCancel_Button + + + + OnOK_Button + + + + + + + + diff --git a/common/dialogs/dialog_image_editor.h b/common/dialogs/dialog_image_editor.h new file mode 100644 index 0000000..226221c --- /dev/null +++ b/common/dialogs/dialog_image_editor.h @@ -0,0 +1,69 @@ +/** + * @file dialog_image_editor.h + */ + +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2011 jean-pierre.charras + * Copyright (C) 2011 Kicad Developers, see change_log.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 + */ + +#ifndef _DIALOG_IMAGE_EDITOR_H_ +#define _DIALOG_IMAGE_EDITOR_H_ + +#include + + +class DIALOG_IMAGE_EDITOR : public DIALOG_IMAGE_EDITOR_BASE +{ +private: + BITMAP_BASE* m_workingImage; // The copy of BITMAP_BASE to be edited + BITMAP_BASE* m_lastImage; // the saved BITMAP_BASE before a new change. + // Used to undo the last change + +public: + DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem ); + ~DIALOG_IMAGE_EDITOR(){ delete m_workingImage; } + + +public: + /** + * Function TransfertToImage + * copy edited image to aItem + * @param aItem = the target + */ + void TransfertToImage( BITMAP_BASE* aItem ); + +private: + void OnUndoLastChange( wxCommandEvent& event ); + void OnGreyScaleConvert( wxCommandEvent& event ); + void OnHalfSize( wxCommandEvent& event ); + void OnMirrorX_click( wxCommandEvent& event ); + void OnMirrorY_click( wxCommandEvent& event ); + void OnRotateClick( wxCommandEvent& event ); + void OnOK_Button( wxCommandEvent& aEvent ); + void OnCancel_Button( wxCommandEvent& aEvent ); + void OnRedrawPanel( wxPaintEvent& event ); + bool CheckValues(); +}; + + +#endif // _DIALOG_IMAGE_EDITOR_H_ diff --git a/common/dialogs/dialog_image_editor_base.cpp b/common/dialogs/dialog_image_editor_base.cpp new file mode 100644 index 0000000..e11c764 --- /dev/null +++ b/common/dialogs/dialog_image_editor_base.cpp @@ -0,0 +1,103 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 30 2011) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_image_editor_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_IMAGE_EDITOR_BASE::DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bUpperSizer; + bUpperSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerLeft; + bSizerLeft = new wxBoxSizer( wxHORIZONTAL ); + + m_panelDraw = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); + m_panelDraw->SetMinSize( wxSize( 256,256 ) ); + + bSizerLeft->Add( m_panelDraw, 1, wxEXPAND | wxALL, 5 ); + + wxBoxSizer* bSizerRight; + bSizerRight = new wxBoxSizer( wxVERTICAL ); + + m_buttonMirrorX = new wxButton( this, wxID_ANY, _("Mirror X"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_buttonMirrorX, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_buttonMirrorY = new wxButton( this, wxID_ANY, _("Mirror Y"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_buttonMirrorY, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_buttonRotate = new wxButton( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_buttonRotate, 0, wxEXPAND|wxALL, 5 ); + + m_buttonGrey = new wxButton( this, wxID_ANY, _("Grey"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_buttonGrey, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_buttonHalfSize = new wxButton( this, wxID_ANY, _("Half Size"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonHalfSize->SetDefault(); + bSizerRight->Add( m_buttonHalfSize, 0, wxALL|wxEXPAND, 5 ); + + m_buttonUndoLast = new wxButton( this, wxID_ANY, _("Undo Last"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_buttonUndoLast, 0, wxALL|wxEXPAND, 5 ); + + m_staticTextScale = new wxStaticText( this, wxID_ANY, _("Image Scale:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextScale->Wrap( -1 ); + bSizerRight->Add( m_staticTextScale, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_textCtrlScale = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_textCtrlScale, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + bSizerLeft->Add( bSizerRight, 0, wxEXPAND, 5 ); + + bUpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 ); + + bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 ); + + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + bSizerMain->Add( m_sdbSizer1, 0, wxALIGN_RIGHT, 5 ); + + this->SetSizer( bSizerMain ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + m_panelDraw->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnRedrawPanel ), NULL, this ); + m_buttonMirrorX->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorX_click ), NULL, this ); + m_buttonMirrorY->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorY_click ), NULL, this ); + m_buttonRotate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnRotateClick ), NULL, this ); + m_buttonGrey->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnGreyScaleConvert ), NULL, this ); + m_buttonHalfSize->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnHalfSize ), NULL, this ); + m_buttonUndoLast->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnUndoLastChange ), NULL, this ); + m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnCancel_Button ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnOK_Button ), NULL, this ); +} + +DIALOG_IMAGE_EDITOR_BASE::~DIALOG_IMAGE_EDITOR_BASE() +{ + // Disconnect Events + m_panelDraw->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnRedrawPanel ), NULL, this ); + m_buttonMirrorX->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorX_click ), NULL, this ); + m_buttonMirrorY->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorY_click ), NULL, this ); + m_buttonRotate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnRotateClick ), NULL, this ); + m_buttonGrey->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnGreyScaleConvert ), NULL, this ); + m_buttonHalfSize->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnHalfSize ), NULL, this ); + m_buttonUndoLast->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnUndoLastChange ), NULL, this ); + m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnCancel_Button ), NULL, this ); + m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnOK_Button ), NULL, this ); + +} diff --git a/common/dialogs/dialog_image_editor_base.h b/common/dialogs/dialog_image_editor_base.h new file mode 100644 index 0000000..a7522a1 --- /dev/null +++ b/common/dialogs/dialog_image_editor_base.h @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 30 2011) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_IMAGE_EDITOR_BASE_H__ +#define __DIALOG_IMAGE_EDITOR_BASE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_IMAGE_EDITOR_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_IMAGE_EDITOR_BASE : public wxDialog +{ + private: + + protected: + wxPanel* m_panelDraw; + wxButton* m_buttonMirrorX; + wxButton* m_buttonMirrorY; + wxButton* m_buttonRotate; + wxButton* m_buttonGrey; + wxButton* m_buttonHalfSize; + wxButton* m_buttonUndoLast; + wxStaticText* m_staticTextScale; + wxTextCtrl* m_textCtrlScale; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnRedrawPanel( wxPaintEvent& event ) { event.Skip(); } + virtual void OnMirrorX_click( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMirrorY_click( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRotateClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnGreyScaleConvert( wxCommandEvent& event ) { event.Skip(); } + virtual void OnHalfSize( wxCommandEvent& event ) { event.Skip(); } + virtual void OnUndoLastChange( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel_Button( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOK_Button( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Image Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 340,299 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_IMAGE_EDITOR_BASE(); + +}; + +#endif //__DIALOG_IMAGE_EDITOR_BASE_H__ diff --git a/common/dialogs/dialog_list_selector_base.cpp b/common/dialogs/dialog_list_selector_base.cpp new file mode 100644 index 0000000..d38d417 --- /dev/null +++ b/common/dialogs/dialog_list_selector_base.cpp @@ -0,0 +1,80 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_list_selector_base.h" + +/////////////////////////////////////////////////////////////////////////// + +EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_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( wxSize( 400,400 ), wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + m_filterLabel = new wxStaticText( this, wxID_ANY, _("Filter:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_filterLabel->Wrap( -1 ); + m_filterLabel->SetToolTip( _("Enter a string to filter items.\nOnly names containing this string will be listed") ); + + bSizerMain->Add( m_filterLabel, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_filterBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerMain->Add( m_filterBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_staticText2 = new wxStaticText( this, wxID_ANY, _("Items:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2->Wrap( -1 ); + bSizerMain->Add( m_staticText2, 0, wxRIGHT|wxLEFT, 5 ); + + m_listBox = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxALWAYS_SHOW_SB|wxVSCROLL ); + m_listBox->SetMinSize( wxSize( -1,200 ) ); + + bSizerMain->Add( m_listBox, 3, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + m_staticTextMsg = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextMsg->Wrap( -1 ); + bSizerMain->Add( m_staticTextMsg, 0, wxRIGHT|wxLEFT, 5 ); + + m_messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); + m_messages->SetMinSize( wxSize( -1,80 ) ); + + bSizerMain->Add( m_messages, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); + + bSizerMain->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_LIST_DIALOG_BASE::onClose ) ); + m_filterBox->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::textChangeInFilterBox ), NULL, this ); + m_listBox->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( EDA_LIST_DIALOG_BASE::onListItemActivated ), NULL, this ); + m_listBox->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( EDA_LIST_DIALOG_BASE::onListItemSelected ), NULL, this ); + m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onCancelClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onOkClick ), NULL, this ); +} + +EDA_LIST_DIALOG_BASE::~EDA_LIST_DIALOG_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_LIST_DIALOG_BASE::onClose ) ); + m_filterBox->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::textChangeInFilterBox ), NULL, this ); + m_listBox->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( EDA_LIST_DIALOG_BASE::onListItemActivated ), NULL, this ); + m_listBox->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( EDA_LIST_DIALOG_BASE::onListItemSelected ), NULL, this ); + m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onCancelClick ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EDA_LIST_DIALOG_BASE::onOkClick ), NULL, this ); + +} diff --git a/common/dialogs/dialog_list_selector_base.fbp b/common/dialogs/dialog_list_selector_base.fbp new file mode 100644 index 0000000..1d1d0e2 --- /dev/null +++ b/common/dialogs/dialog_list_selector_base.fbp @@ -0,0 +1,661 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_list_selector_base + 1000 + none + 1 + dialog_list_selector_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + decl_pure_virtual + + + + 0 + wxID_ANY + + 400,400 + EDA_LIST_DIALOG_BASE + + 400,400 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + + + + + + + + + + + + + + + onClose + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Filter: + + 0 + + + 0 + + 1 + m_filterLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Enter a string to filter items. Only names containing this string will be listed + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_filterBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + textChangeInFilterBox + + + + + + + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Items: + + 0 + + + 0 + + 1 + m_staticText2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 3 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + -1,200 + 1 + m_listBox + 1 + + + protected + 1 + + Resizable + 1 + + wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + wxALWAYS_SHOW_SB|wxVSCROLL + + + + + + + + + + + + + + + + + + + + + + + + onListItemActivated + + + + + onListItemSelected + + + + + + + + + + + + + + + + + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Messages: + + 0 + + + 0 + + 1 + m_staticTextMsg + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + -1,80 + 1 + m_messages + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_MULTILINE|wxTE_READONLY + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + onCancelClick + + + + onOkClick + + + + + + + + diff --git a/common/dialogs/dialog_list_selector_base.h b/common/dialogs/dialog_list_selector_base.h new file mode 100644 index 0000000..c274c2c --- /dev/null +++ b/common/dialogs/dialog_list_selector_base.h @@ -0,0 +1,66 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_LIST_SELECTOR_BASE_H__ +#define __DIALOG_LIST_SELECTOR_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class EDA_LIST_DIALOG_BASE +/////////////////////////////////////////////////////////////////////////////// +class EDA_LIST_DIALOG_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticText* m_filterLabel; + wxTextCtrl* m_filterBox; + wxStaticText* m_staticText2; + wxListCtrl* m_listBox; + wxStaticText* m_staticTextMsg; + wxTextCtrl* m_messages; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void onClose( wxCloseEvent& event ) = 0; + virtual void textChangeInFilterBox( wxCommandEvent& event ) = 0; + virtual void onListItemActivated( wxListEvent& event ) = 0; + virtual void onListItemSelected( wxListEvent& event ) = 0; + virtual void onCancelClick( wxCommandEvent& event ) = 0; + virtual void onOkClick( wxCommandEvent& event ) = 0; + + + public: + + EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,400 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~EDA_LIST_DIALOG_BASE(); + +}; + +#endif //__DIALOG_LIST_SELECTOR_BASE_H__ diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp new file mode 100644 index 0000000..ef17651 --- /dev/null +++ b/common/dialogs/dialog_page_settings.cpp @@ -0,0 +1,841 @@ +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 1992-2015 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 + */ + +/** + * @file dialog_page_settings.cpp + */ + +#include +#include // DIM() +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef EESCHEMA +#include +#include +#endif + +#include +#include + + +// List of page formats. +// they are prefixed by "_HKI" (already in use for hotkeys) instead of "_", +// because we need both the translated and the not translated version. +// when displayed in dialog we should explicitely call wxGetTranslation() +// to show the translated version. +// See hotkeys_basic.h for more info +#define _HKI( x ) wxT( x ) +static const wxString pageFmts[] = +{ + _HKI("A4 210x297mm"), + _HKI("A3 297x420mm"), + _HKI("A2 420x594mm"), + _HKI("A1 594x841mm"), + _HKI("A0 841x1189mm"), + _HKI("A 8.5x11in"), + _HKI("B 11x17in"), + _HKI("C 17x22in"), + _HKI("D 22x34in"), + _HKI("E 34x44in"), + _HKI("USLetter 8.5x11in"), // USLetter without space is correct + _HKI("USLegal 8.5x14in"), // USLegal without space is correct + _HKI("USLedger 11x17in"), // USLedger without space is correct + _HKI("User (Custom)"), // size defined by user. The string must contain "Custom" + // to be reconized in code +}; + +void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event ) +{ + DIALOG_PAGES_SETTINGS dlg( this ); + dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName ); + + if( dlg.ShowModal() == wxID_OK ) + { + if( m_canvas ) + m_canvas->Refresh(); + } +} + + +DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ) : + DIALOG_PAGES_SETTINGS_BASE( parent ), + m_initialized( false ) +{ + m_parent = parent; + m_screen = m_parent->GetScreen(); + m_projectPath = Prj().GetProjectPath(); + m_page_bitmap = NULL; + m_tb = m_parent->GetTitleBlock(); + m_customFmt = false; + m_localPrjConfigChanged = false; + m_pagelayout = NULL; + + initDialog(); + + GetSizer()->SetSizeHints( this ); + Centre(); +} + + +DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS() +{ + delete m_page_bitmap; + delete m_pagelayout; +} + + +void DIALOG_PAGES_SETTINGS::initDialog() +{ + wxString msg; + double customSizeX; + double customSizeY; + + // initalize page format choice box and page format list. + // The first shows translated strings, the second contains not translated strings + m_paperSizeComboBox->Clear(); + + for( unsigned ii = 0; ii < DIM(pageFmts); ii++ ) + { + m_pageFmt.Add( pageFmts[ii] ); + m_paperSizeComboBox->Append( wxGetTranslation( pageFmts[ii] ) ); + } + + // initialize the page layout descr filename + SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName ); + + +#ifdef EESCHEMA + // Init display value for schematic sub-sheet number + wxString format = m_TextSheetCount->GetLabel(); + msg.Printf( format, m_screen->m_NumberOfScreens ); + m_TextSheetCount->SetLabel( msg ); + + format = m_TextSheetNumber->GetLabel(); + msg.Printf( format, m_screen->m_ScreenNumber ); + m_TextSheetNumber->SetLabel( msg ); +#else + m_TextSheetCount->Show( false ); + m_TextSheetNumber->Show( false ); +#endif + + m_pageInfo = m_parent->GetPageSettings(); + SetCurrentPageSizeSelection( m_pageInfo.GetType() ); + m_orientationComboBox->SetSelection( m_pageInfo.IsPortrait() ); + + // only a click fires the "selection changed" event, so have to fabricate this check + wxCommandEvent dummy; + OnPaperSizeChoice( dummy ); + + if( m_customFmt) // The custom value is defined by the page size + { + customSizeX = m_pageInfo.GetWidthMils(); + customSizeY = m_pageInfo.GetHeightMils(); + } + else // The custom value is set to a default value, or the last defined value + { + customSizeX = m_pageInfo.GetCustomWidthMils(); + customSizeY = m_pageInfo.GetCustomHeightMils(); + } + + switch( g_UserUnit ) + { + case MILLIMETRES: + customSizeX *= 25.4e-3; + customSizeY *= 25.4e-3; + + msg.Printf( wxT( "%.2f" ), customSizeX ); + m_TextUserSizeX->SetValue( msg ); + + msg.Printf( wxT( "%.2f" ), customSizeY ); + m_TextUserSizeY->SetValue( msg ); + break; + + default: + case INCHES: + customSizeX /= 1000.0; + customSizeY /= 1000.0; + + msg.Printf( wxT( "%.3f" ), customSizeX ); + m_TextUserSizeX->SetValue( msg ); + + msg.Printf( wxT( "%.3f" ), customSizeY ); + m_TextUserSizeY->SetValue( msg ); + break; + } + + m_TextRevision->SetValue( m_tb.GetRevision() ); + m_TextDate->SetValue( m_tb.GetDate() ); + m_TextTitle->SetValue( m_tb.GetTitle() ); + m_TextCompany->SetValue( m_tb.GetCompany() ); + m_TextComment1->SetValue( m_tb.GetComment1() ); + m_TextComment2->SetValue( m_tb.GetComment2() ); + m_TextComment3->SetValue( m_tb.GetComment3() ); + m_TextComment4->SetValue( m_tb.GetComment4() ); + +#ifndef EESCHEMA + // these options have meaning only for Eeschema. + // disable them for other apps + m_RevisionExport->Show( false ); + m_DateExport->Show( false ); + m_TitleExport->Show( false ); + m_CompanyExport->Show( false ); + m_Comment1Export->Show( false ); + m_Comment2Export->Show( false ); + m_Comment3Export->Show( false ); + m_Comment4Export->Show( false ); +#endif + + GetPageLayoutInfoFromDialog(); + UpdatePageLayoutExample(); + + // Make the OK button the default. + m_sdbSizerOK->SetDefault(); + m_initialized = true; +} + + +void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event ) +{ + if( SavePageSettings() ) + { + m_screen->SetModify(); + m_parent->GetCanvas()->Refresh(); + + if( LocalPrjConfigChanged() ) + m_parent->SaveProjectSettings( true ); + } + + event.Skip(); +} + + +void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event ) +{ + int idx = m_paperSizeComboBox->GetSelection(); + + if( idx < 0 ) + idx = 0; + + const wxString paperType = m_pageFmt[idx]; + + if( paperType.Contains( PAGE_INFO::Custom ) ) + { + m_orientationComboBox->Enable( false ); + m_TextUserSizeX->Enable( true ); + m_TextUserSizeY->Enable( true ); + m_customFmt = true; + } + else + { + m_orientationComboBox->Enable( true ); + +#if 0 + // ForcePortrait() does not exist, but could be useful. + // so I leave these lines, which could be seen as a todo feature + if( paperType.ForcePortrait() ) + { + m_orientationComboBox->SetStringSelection( _( "Portrait" ) ); + m_orientationComboBox->Enable( false ); + } +#endif + m_TextUserSizeX->Enable( false ); + m_TextUserSizeY->Enable( false ); + m_customFmt = false; + } + + GetPageLayoutInfoFromDialog(); + UpdatePageLayoutExample(); +} + + +void DIALOG_PAGES_SETTINGS::OnUserPageSizeXTextUpdated( wxCommandEvent& event ) +{ + if( m_initialized && m_TextUserSizeX->IsModified() ) + { + GetPageLayoutInfoFromDialog(); + UpdatePageLayoutExample(); + } +} + + +void DIALOG_PAGES_SETTINGS::OnUserPageSizeYTextUpdated( wxCommandEvent& event ) +{ + if( m_initialized && m_TextUserSizeY->IsModified() ) + { + GetPageLayoutInfoFromDialog(); + UpdatePageLayoutExample(); + } +} + + +void DIALOG_PAGES_SETTINGS::OnPageOrientationChoice( wxCommandEvent& event ) +{ + if( m_initialized ) + { + GetPageLayoutInfoFromDialog(); + UpdatePageLayoutExample(); + } +} + + +void DIALOG_PAGES_SETTINGS::OnRevisionTextUpdated( wxCommandEvent& event ) +{ + if( m_initialized && m_TextRevision->IsModified() ) + { + GetPageLayoutInfoFromDialog(); + m_tb.SetRevision( m_TextRevision->GetValue() ); + UpdatePageLayoutExample(); + } +} + + +void DIALOG_PAGES_SETTINGS::OnDateTextUpdated( wxCommandEvent& event ) +{ + if( m_initialized && m_TextDate->IsModified() ) + { + GetPageLayoutInfoFromDialog(); + m_tb.SetDate( m_TextDate->GetValue() ); + UpdatePageLayoutExample(); + } +} + + +void DIALOG_PAGES_SETTINGS::OnTitleTextUpdated( wxCommandEvent& event ) +{ + if( m_initialized && m_TextTitle->IsModified() ) + { + GetPageLayoutInfoFromDialog(); + m_tb.SetTitle( m_TextTitle->GetValue() ); + UpdatePageLayoutExample(); + } +} + + +void DIALOG_PAGES_SETTINGS::OnCompanyTextUpdated( wxCommandEvent& event ) +{ + if( m_initialized && m_TextCompany->IsModified() ) + { + GetPageLayoutInfoFromDialog(); + m_tb.SetCompany( m_TextCompany->GetValue() ); + UpdatePageLayoutExample(); + } +} + + +void DIALOG_PAGES_SETTINGS::OnComment1TextUpdated( wxCommandEvent& event ) +{ + if( m_initialized && m_TextComment1->IsModified() ) + { + GetPageLayoutInfoFromDialog(); + m_tb.SetComment1( m_TextComment1->GetValue() ); + UpdatePageLayoutExample(); + } +} + + +void DIALOG_PAGES_SETTINGS::OnComment2TextUpdated( wxCommandEvent& event ) +{ + if( m_initialized && m_TextComment2->IsModified() ) + { + GetPageLayoutInfoFromDialog(); + m_tb.SetComment2( m_TextComment2->GetValue() ); + UpdatePageLayoutExample(); + } +} + + +void DIALOG_PAGES_SETTINGS::OnComment3TextUpdated( wxCommandEvent& event ) +{ + if( m_initialized && m_TextComment3->IsModified() ) + { + GetPageLayoutInfoFromDialog(); + m_tb.SetComment3( m_TextComment3->GetValue() ); + UpdatePageLayoutExample(); + } +} + + +void DIALOG_PAGES_SETTINGS::OnComment4TextUpdated( wxCommandEvent& event ) +{ + if( m_initialized && m_TextComment4->IsModified() ) + { + GetPageLayoutInfoFromDialog(); + m_tb.SetComment4( m_TextComment4->GetValue() ); + UpdatePageLayoutExample(); + } +} + + +void DIALOG_PAGES_SETTINGS::OnDateApplyClick( wxCommandEvent& event ) +{ + wxDateTime datetime = m_PickDate->GetValue(); + wxString date = + // We can choose different formats. Only one must be uncommented + // + // datetime.Format( wxLocale::GetInfo( wxLOCALE_SHORT_DATE_FMT ) ); + // datetime.Format( wxLocale::GetInfo( wxLOCALE_LONG_DATE_FMT ) ); + // datetime.Format( wxT("%Y-%b-%d") ); + datetime.FormatISODate(); + + m_TextDate->SetValue( date ); +} + + +bool DIALOG_PAGES_SETTINGS::SavePageSettings() +{ + bool retSuccess = false; + + wxString fileName = GetWksFileName(); + + if( fileName != BASE_SCREEN::m_PageLayoutDescrFileName ) + { + wxString fullFileName = + WORKSHEET_LAYOUT::MakeFullFileName( fileName, m_projectPath ); + + if( !fullFileName.IsEmpty() ) + { + + if( !wxFileExists( fullFileName ) ) + { + wxString msg; + msg.Printf( _("Page layout description file <%s> not found. Abort"), + GetChars( fullFileName ) ); + wxMessageBox( msg ); + return false; + } + } + + BASE_SCREEN::m_PageLayoutDescrFileName = fileName; + WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance(); + pglayout.SetPageLayout( fullFileName ); + m_localPrjConfigChanged = true; + } + + int idx = m_paperSizeComboBox->GetSelection(); + + if( idx < 0 ) + idx = 0; + + const wxString paperType = m_pageFmt[idx]; + + if( paperType.Contains( PAGE_INFO::Custom ) ) + { + GetCustomSizeMilsFromDialog(); + + retSuccess = m_pageInfo.SetType( PAGE_INFO::Custom ); + + if( retSuccess ) + { + if( m_layout_size.x < MIN_PAGE_SIZE || m_layout_size.y < MIN_PAGE_SIZE || + m_layout_size.x > MAX_PAGE_SIZE || m_layout_size.y > MAX_PAGE_SIZE ) + { + wxString msg = wxString::Format( _( "Selected custom paper size\nis out of the permissible \ +limits\n%.1f - %.1f %s!\nSelect another custom paper size?" ), + g_UserUnit == INCHES ? MIN_PAGE_SIZE / 1000. : MIN_PAGE_SIZE * 25.4 / 1000, + g_UserUnit == INCHES ? MAX_PAGE_SIZE / 1000. : MAX_PAGE_SIZE * 25.4 / 1000, + g_UserUnit == INCHES ? _( "inches" ) : _( "mm" ) ); + + if( wxMessageBox( msg, _( "Warning!" ), wxYES_NO | wxICON_EXCLAMATION, this ) == wxYES ) + { + return false; + } + + m_layout_size.x = Clamp( MIN_PAGE_SIZE, m_layout_size.x, MAX_PAGE_SIZE ); + m_layout_size.y = Clamp( MIN_PAGE_SIZE, m_layout_size.y, MAX_PAGE_SIZE ); + } + + PAGE_INFO::SetCustomWidthMils( m_layout_size.x ); + PAGE_INFO::SetCustomHeightMils( m_layout_size.y ); + + m_pageInfo.SetWidthMils( m_layout_size.x ); + m_pageInfo.SetHeightMils( m_layout_size.y ); + } + } + else + { + // search for longest common string first, e.g. A4 before A + if( paperType.Contains( PAGE_INFO::USLetter ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::USLetter ); + else if( paperType.Contains( PAGE_INFO::USLegal ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::USLegal ); + else if( paperType.Contains( PAGE_INFO::USLedger ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::USLedger ); + else if( paperType.Contains( PAGE_INFO::GERBER ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::GERBER ); + else if( paperType.Contains( PAGE_INFO::A4 ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::A4 ); + else if( paperType.Contains( PAGE_INFO::A3 ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::A3 ); + else if( paperType.Contains( PAGE_INFO::A2 ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::A2 ); + else if( paperType.Contains( PAGE_INFO::A1 ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::A1 ); + else if( paperType.Contains( PAGE_INFO::A0 ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::A0 ); + else if( paperType.Contains( PAGE_INFO::A ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::A ); + else if( paperType.Contains( PAGE_INFO::B ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::B ); + else if( paperType.Contains( PAGE_INFO::C ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::C ); + else if( paperType.Contains( PAGE_INFO::D ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::D ); + else if( paperType.Contains( PAGE_INFO::E ) ) + retSuccess = m_pageInfo.SetType( PAGE_INFO::E ); + + if( retSuccess ) + { + int choice = m_orientationComboBox->GetSelection(); + m_pageInfo.SetPortrait( choice != 0 ); + } + } + + if( !retSuccess ) + { + wxASSERT_MSG( false, wxT( "the translation for paper size must preserve original spellings" ) ); + m_pageInfo.SetType( PAGE_INFO::A4 ); + } + + m_parent->SetPageSettings( m_pageInfo ); + + m_tb.SetRevision( m_TextRevision->GetValue() ); + m_tb.SetDate( m_TextDate->GetValue() ); + m_tb.SetCompany( m_TextCompany->GetValue() ); + m_tb.SetTitle( m_TextTitle->GetValue() ); + m_tb.SetComment1( m_TextComment1->GetValue() ); + m_tb.SetComment2( m_TextComment2->GetValue() ); + m_tb.SetComment3( m_TextComment3->GetValue() ); + m_tb.SetComment4( m_TextComment4->GetValue() ); + + m_parent->SetTitleBlock( m_tb ); + + +#ifdef EESCHEMA + // Exports settings to other sheets if requested: + SCH_SCREEN* screen; + + // Build the screen list + SCH_SCREENS ScreenList; + + // Update title blocks for all screens + for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) + { + if( screen == m_screen ) + continue; + + TITLE_BLOCK tb2 = screen->GetTitleBlock(); + + if( m_RevisionExport->IsChecked() ) + tb2.SetRevision( m_tb.GetRevision() ); + + if( m_DateExport->IsChecked() ) + tb2.SetDate( m_tb.GetDate() ); + + if( m_TitleExport->IsChecked() ) + tb2.SetTitle( m_tb.GetTitle() ); + + if( m_CompanyExport->IsChecked() ) + tb2.SetCompany( m_tb.GetCompany() ); + + if( m_Comment1Export->IsChecked() ) + tb2.SetComment1( m_tb.GetComment1() ); + + if( m_Comment2Export->IsChecked() ) + tb2.SetComment2( m_tb.GetComment2() ); + + if( m_Comment3Export->IsChecked() ) + tb2.SetComment3( m_tb.GetComment3() ); + + if( m_Comment4Export->IsChecked() ) + tb2.SetComment4( m_tb.GetComment4() ); + + screen->SetTitleBlock( tb2 ); + } + +#endif + + return true; +} + + +void DIALOG_PAGES_SETTINGS::SetCurrentPageSizeSelection( const wxString& aPaperSize ) +{ + // search all the not translated label list containing our paper type + for( unsigned i = 0; i < m_pageFmt.GetCount(); ++i ) + { + // parse each label looking for aPaperSize within it + wxStringTokenizer st( m_pageFmt[i] ); + + while( st.HasMoreTokens() ) + { + if( st.GetNextToken() == aPaperSize ) + { + m_paperSizeComboBox->SetSelection( i ); + return; + } + } + } +} + + +void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample() +{ + int lyWidth, lyHeight; + + wxSize clamped_layout_size( Clamp( MIN_PAGE_SIZE, m_layout_size.x, MAX_PAGE_SIZE ), + Clamp( MIN_PAGE_SIZE, m_layout_size.y, MAX_PAGE_SIZE ) ); + + double lyRatio = clamped_layout_size.x < clamped_layout_size.y ? + (double) clamped_layout_size.y / clamped_layout_size.x : + (double) clamped_layout_size.x / clamped_layout_size.y; + + if( clamped_layout_size.x < clamped_layout_size.y ) + { + lyHeight = MAX_PAGE_EXAMPLE_SIZE; + lyWidth = KiROUND( (double) lyHeight / lyRatio ); + } + else + { + lyWidth = MAX_PAGE_EXAMPLE_SIZE; + lyHeight = KiROUND( (double) lyWidth / lyRatio ); + } + + if( m_page_bitmap ) + { + m_PageLayoutExampleBitmap->SetBitmap( wxNullBitmap ); + delete m_page_bitmap; + } + + m_page_bitmap = new wxBitmap( lyWidth + 1, lyHeight + 1 ); + + if( m_page_bitmap->IsOk() ) + { + // Calculate layout preview scale. + int appScale = m_screen->MilsToIuScalar(); + + double scaleW = (double) lyWidth / clamped_layout_size.x / appScale; + double scaleH = (double) lyHeight / clamped_layout_size.y / appScale; + + // Prepare DC. + wxSize example_size( lyWidth + 1, lyHeight + 1 ); + wxMemoryDC memDC; + memDC.SelectObject( *m_page_bitmap ); + memDC.SetClippingRegion( wxPoint( 0, 0 ), example_size ); + memDC.Clear(); + memDC.SetUserScale( scaleW, scaleH ); + + // Get logical page size and margins. + PAGE_INFO pageDUMMY; + + // Get page type + int idx = m_paperSizeComboBox->GetSelection(); + + if( idx < 0 ) + idx = 0; + + wxString pageFmtName = m_pageFmt[idx].BeforeFirst( ' ' ); + bool portrait = clamped_layout_size.x < clamped_layout_size.y; + pageDUMMY.SetType( pageFmtName, portrait ); + if( m_customFmt ) + { + pageDUMMY.SetWidthMils( clamped_layout_size.x ); + pageDUMMY.SetHeightMils( clamped_layout_size.y ); + } + + // Draw layout preview. + wxString emptyString; + GRResetPenAndBrush( &memDC ); + + WORKSHEET_LAYOUT::SetAltInstance( m_pagelayout ); + DrawPageLayout( &memDC, NULL, pageDUMMY, + emptyString, emptyString, + m_tb, m_screen->m_NumberOfScreens, + m_screen->m_ScreenNumber, 1, appScale, DARKGRAY, RED ); + + memDC.SelectObject( wxNullBitmap ); + m_PageLayoutExampleBitmap->SetBitmap( *m_page_bitmap ); + WORKSHEET_LAYOUT::SetAltInstance( NULL ); + + // Refresh the dialog. + Layout(); + Refresh(); + } +} + + +void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog() +{ + int idx = m_paperSizeComboBox->GetSelection(); + + if( idx < 0 ) + idx = 0; + + const wxString paperType = m_pageFmt[idx]; + + // here we assume translators will keep original paper size spellings + if( paperType.Contains( PAGE_INFO::Custom ) ) + { + GetCustomSizeMilsFromDialog(); + + if( m_layout_size.x && m_layout_size.y ) + { + if( m_layout_size.x < m_layout_size.y ) + m_orientationComboBox->SetStringSelection( _( "Portrait" ) ); + else + m_orientationComboBox->SetStringSelection( _( "Landscape" ) ); + } + } + else + { + PAGE_INFO pageInfo; // SetType() later to lookup size + + static const wxChar* papers[] = { + // longest common string first, since sequential search below + PAGE_INFO::A4, + PAGE_INFO::A3, + PAGE_INFO::A2, + PAGE_INFO::A1, + PAGE_INFO::A0, + PAGE_INFO::A, + PAGE_INFO::B, + PAGE_INFO::C, + PAGE_INFO::D, + PAGE_INFO::E, + PAGE_INFO::USLetter, + PAGE_INFO::USLegal, + PAGE_INFO::USLedger, + }; + + unsigned i; + + for( i=0; i < DIM( papers ); ++i ) + { + if( paperType.Contains( papers[i] ) ) + { + pageInfo.SetType( papers[i] ); + break; + } + } + + wxASSERT( i != DIM(papers) ); // dialog UI match the above list? + + m_layout_size = pageInfo.GetSizeMils(); + + // swap sizes to match orientation + bool isPortrait = (bool) m_orientationComboBox->GetSelection(); + + if( ( isPortrait && m_layout_size.x >= m_layout_size.y ) || + ( !isPortrait && m_layout_size.x < m_layout_size.y ) ) + { + m_layout_size.Set( m_layout_size.y, m_layout_size.x ); + } + } +} + + +void DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog() +{ + double customSizeX; + double customSizeY; + wxString msg; + + msg = m_TextUserSizeX->GetValue(); + msg.ToDouble( &customSizeX ); + + msg = m_TextUserSizeY->GetValue(); + msg.ToDouble( &customSizeY ); + + switch( g_UserUnit ) + { + case MILLIMETRES: + customSizeX *= 1000. / 25.4; + customSizeY *= 1000. / 25.4; + break; + + default: + case INCHES: + customSizeX *= 1000.; + customSizeY *= 1000.; + } + + // Prepare to painless double -> int conversion. + customSizeX = Clamp( double( INT_MIN ), customSizeX, double( INT_MAX ) ); + customSizeY = Clamp( double( INT_MIN ), customSizeY, double( INT_MAX ) ); + m_layout_size = wxSize( KiROUND( customSizeX ), KiROUND( customSizeY ) ); +} + +// Called on .kicad_wks file description selection change +void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event ) +{ + // Display a file picker dialog + wxFileDialog fileDialog( this, _( "Select Page Layout Descr File" ), + m_projectPath, GetWksFileName(), + PageLayoutDescrFileWildcard, + wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST ); + + if( fileDialog.ShowModal() != wxID_OK ) + return; + + wxString fileName = fileDialog.GetPath(); + + // Try to remove the path, if the path is the current working dir, + // or the dir of kicad.pro (template), and use a relative path + wxString shortFileName = WORKSHEET_LAYOUT::MakeShortFileName( fileName, m_projectPath ); + + // For Win/Linux/macOS compatibility, a relative path is a good idea + if( shortFileName != GetWksFileName() && shortFileName != fileName ) + { + wxString msg = wxString::Format( _( + "The page layout descr filename has changed.\n" + "Do you want to use the relative path:\n" + "'%s'\n" + "instead of\n" + "'%s'" ), GetChars( shortFileName ), GetChars( fileName ) ); + + if( !IsOK( this, msg ) ) + shortFileName = fileName; + } + + SetWksFileName( shortFileName ); + + if( m_pagelayout == NULL ) + m_pagelayout = new WORKSHEET_LAYOUT; + + m_pagelayout->SetPageLayout( fileName ); + + GetPageLayoutInfoFromDialog(); + UpdatePageLayoutExample(); +} diff --git a/common/dialogs/dialog_page_settings.h b/common/dialogs/dialog_page_settings.h new file mode 100644 index 0000000..5127886 --- /dev/null +++ b/common/dialogs/dialog_page_settings.h @@ -0,0 +1,120 @@ +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 1992-2013 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 + */ + +#ifndef _DIALOG_PAGES_SETTINGS_H_ +#define _DIALOG_PAGES_SETTINGS_H_ + +#include + +#define MAX_PAGE_EXAMPLE_SIZE 200 + +/*! + * DIALOG_PAGES_SETTINGS class declaration + */ + +class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE +{ +private: + EDA_DRAW_FRAME* m_parent; + BASE_SCREEN* m_screen; + wxString m_projectPath; // the curr project path + wxArrayString m_pageFmt; /// list of page sizes (not translated) + bool m_initialized; + bool m_localPrjConfigChanged; /// the page layuout filename was changed + wxBitmap* m_page_bitmap; /// Temporary bitmap for the page layout example. + wxSize m_layout_size; /// Logical page layout size. + PAGE_INFO m_pageInfo; /// Temporary page info. + bool m_customFmt; /// true if the page selection is custom + TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions). + WORKSHEET_LAYOUT *m_pagelayout; // the alternate and temporary page layout shown by the dialog + // when the initial one is replaced by a new one + +public: + DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ); + ~DIALOG_PAGES_SETTINGS(); + + const wxString GetWksFileName() + { + return m_textCtrlFilePicker->GetValue(); + } + + void SetWksFileName(const wxString& aFilename ) + { + m_textCtrlFilePicker->SetValue( aFilename ); + } + + void EnableWksFileNamePicker( bool aEnable ) + { + m_textCtrlFilePicker->Enable( aEnable ); + m_buttonBrowse->Enable( aEnable ); + } + +private: + void initDialog(); // Initialisation of member variables + + // event handler for button OK + void OnOkClick( wxCommandEvent& event ); + + // event handlers for page size choice + void OnPaperSizeChoice( wxCommandEvent& event ); + void OnUserPageSizeXTextUpdated( wxCommandEvent& event ); + void OnUserPageSizeYTextUpdated( wxCommandEvent& event ); + void OnPageOrientationChoice( wxCommandEvent& event ); + + // event handler for texts in title block + void OnRevisionTextUpdated( wxCommandEvent& event ); + void OnDateTextUpdated( wxCommandEvent& event ); + void OnTitleTextUpdated( wxCommandEvent& event ); + void OnCompanyTextUpdated( wxCommandEvent& event ); + void OnComment1TextUpdated( wxCommandEvent& event ); + void OnComment2TextUpdated( wxCommandEvent& event ); + void OnComment3TextUpdated( wxCommandEvent& event ); + void OnComment4TextUpdated( wxCommandEvent& event ); + + // Handle button click for setting the date from the picker + void OnDateApplyClick( wxCommandEvent& event ); + + // .kicad_wks file description selection + void OnWksFileSelection( wxCommandEvent& event ); + + // Save in the current title block the new page settings + // return true if changes are made, or false if not + bool SavePageSettings(); + + void SetCurrentPageSizeSelection( const wxString& aPaperSize ); + + // Update page layout example + void UpdatePageLayoutExample(); + + // Get page layout info from selected dialog items + void GetPageLayoutInfoFromDialog(); + + // Get custom page size in mils from dialog + void GetCustomSizeMilsFromDialog(); + + /// @return true if the local prj config is chande + /// i.e. if the page layout descr file has chnaged + bool LocalPrjConfigChanged() { return m_localPrjConfigChanged; } +}; + +#endif // _DIALOG_PAGES_SETTINGS_H_ diff --git a/common/dialogs/dialog_page_settings_base.cpp b/common/dialogs/dialog_page_settings_base.cpp new file mode 100644 index 0000000..197a255 --- /dev/null +++ b/common/dialogs/dialog_page_settings_base.cpp @@ -0,0 +1,423 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Mar 9 2015) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_page_settings_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_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 ); + + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bUpperSizerH; + bUpperSizerH = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bleftSizer; + bleftSizer = new wxBoxSizer( wxVERTICAL ); + + m_staticTextPaper = new wxStaticText( this, wxID_ANY, _("Paper"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPaper->Wrap( -1 ); + bleftSizer->Add( m_staticTextPaper, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bleftSizer->Add( m_staticline2, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_staticTextSize = new wxStaticText( this, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextSize->Wrap( -1 ); + bleftSizer->Add( m_staticTextSize, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxString m_paperSizeComboBoxChoices[] = { _("dummy text") }; + int m_paperSizeComboBoxNChoices = sizeof( m_paperSizeComboBoxChoices ) / sizeof( wxString ); + m_paperSizeComboBox = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_paperSizeComboBoxNChoices, m_paperSizeComboBoxChoices, 0 ); + m_paperSizeComboBox->SetSelection( 0 ); + bleftSizer->Add( m_paperSizeComboBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextOrient->Wrap( -1 ); + bleftSizer->Add( m_staticTextOrient, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxString m_orientationComboBoxChoices[] = { _("Landscape"), _("Portrait") }; + int m_orientationComboBoxNChoices = sizeof( m_orientationComboBoxChoices ) / sizeof( wxString ); + m_orientationComboBox = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_orientationComboBoxNChoices, m_orientationComboBoxChoices, 0 ); + m_orientationComboBox->SetSelection( 0 ); + bleftSizer->Add( m_orientationComboBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_staticTextCustSize = new wxStaticText( this, wxID_ANY, _("Custom Size:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextCustSize->Wrap( -1 ); + bleftSizer->Add( m_staticTextCustSize, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerCustSize; + bSizerCustSize = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizercustHeight; + bSizercustHeight = new wxBoxSizer( wxVERTICAL ); + + m_staticTextHeight = new wxStaticText( this, wxID_ANY, _("Height:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextHeight->Wrap( -1 ); + bSizercustHeight->Add( m_staticTextHeight, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_TextUserSizeY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); + m_TextUserSizeY->SetMaxLength( 6 ); + m_TextUserSizeY->SetToolTip( _("Custom paper height.") ); + + bSizercustHeight->Add( m_TextUserSizeY, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerCustSize->Add( bSizercustHeight, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizercustWidth; + bSizercustWidth = new wxBoxSizer( wxVERTICAL ); + + m_staticTextWidth = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextWidth->Wrap( -1 ); + bSizercustWidth->Add( m_staticTextWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_TextUserSizeX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); + m_TextUserSizeX->SetMaxLength( 6 ); + m_TextUserSizeX->SetToolTip( _("Custom paper width.") ); + + bSizercustWidth->Add( m_TextUserSizeX, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerCustSize->Add( bSizercustWidth, 1, wxEXPAND, 5 ); + + + bleftSizer->Add( bSizerCustSize, 0, wxEXPAND, 5 ); + + m_staticTextPreview = new wxStaticText( this, wxID_ANY, _("Layout Preview"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPreview->Wrap( -1 ); + bleftSizer->Add( m_staticTextPreview, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_PageLayoutExampleBitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxFULL_REPAINT_ON_RESIZE|wxSIMPLE_BORDER ); + m_PageLayoutExampleBitmap->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_PageLayoutExampleBitmap->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + + bleftSizer->Add( m_PageLayoutExampleBitmap, 1, wxALL|wxEXPAND, 5 ); + + + bUpperSizerH->Add( bleftSizer, 0, wxEXPAND, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + bUpperSizerH->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + wxBoxSizer* bSizerRight; + bSizerRight = new wxBoxSizer( wxVERTICAL ); + + m_staticTexttbprm = new wxStaticText( this, wxID_ANY, _("Title Block Parameters"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTexttbprm->Wrap( -1 ); + bSizerRight->Add( m_staticTexttbprm, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerRight->Add( m_staticline3, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* SheetInfoSizer; + SheetInfoSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_TextSheetCount = new wxStaticText( this, wxID_ANY, _("Number of sheets: %d"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextSheetCount->Wrap( -1 ); + SheetInfoSizer->Add( m_TextSheetCount, 0, wxALL, 5 ); + + + SheetInfoSizer->Add( 5, 5, 1, wxEXPAND, 5 ); + + m_TextSheetNumber = new wxStaticText( this, wxID_ANY, _("Sheet number: %d"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextSheetNumber->Wrap( -1 ); + SheetInfoSizer->Add( m_TextSheetNumber, 0, wxALL, 5 ); + + + bSizerRight->Add( SheetInfoSizer, 0, 0, 5 ); + + wxBoxSizer* bSizerDate; + bSizerDate = new wxBoxSizer( wxVERTICAL ); + + m_staticTextDate = new wxStaticText( this, wxID_ANY, _("Issue Date"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextDate->Wrap( -1 ); + bSizerDate->Add( m_staticTextDate, 0, wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerissuedate; + bSizerissuedate = new wxBoxSizer( wxHORIZONTAL ); + + m_TextDate = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextDate->SetMaxLength( 0 ); + m_TextDate->SetMinSize( wxSize( 100,-1 ) ); + + bSizerissuedate->Add( m_TextDate, 3, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + m_ApplyDate = new wxButton( this, wxID_ANY, _("<<<"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + bSizerissuedate->Add( m_ApplyDate, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + m_PickDate = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT ); + bSizerissuedate->Add( m_PickDate, 2, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + m_DateExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerissuedate->Add( m_DateExport, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + + bSizerDate->Add( bSizerissuedate, 1, wxEXPAND, 5 ); + + + bSizerRight->Add( bSizerDate, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerRev; + bSizerRev = new wxBoxSizer( wxVERTICAL ); + + m_staticTextRev = new wxStaticText( this, wxID_ANY, _("Revision"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextRev->Wrap( -1 ); + bSizerRev->Add( m_staticTextRev, 0, wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer9; + bSizer9 = new wxBoxSizer( wxHORIZONTAL ); + + m_TextRevision = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextRevision->SetMaxLength( 0 ); + m_TextRevision->SetMinSize( wxSize( 100,-1 ) ); + + bSizer9->Add( m_TextRevision, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + m_RevisionExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer9->Add( m_RevisionExport, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + + bSizerRev->Add( bSizer9, 1, wxEXPAND, 5 ); + + + bSizerRight->Add( bSizerRev, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerTitle; + bSizerTitle = new wxBoxSizer( wxVERTICAL ); + + m_staticTextTitle = new wxStaticText( this, wxID_ANY, _("Title"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTitle->Wrap( -1 ); + bSizerTitle->Add( m_staticTextTitle, 0, wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer12; + bSizer12 = new wxBoxSizer( wxHORIZONTAL ); + + m_TextTitle = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextTitle->SetMaxLength( 0 ); + m_TextTitle->SetMinSize( wxSize( 360,-1 ) ); + + bSizer12->Add( m_TextTitle, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + m_TitleExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer12->Add( m_TitleExport, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + + bSizerTitle->Add( bSizer12, 1, wxEXPAND, 5 ); + + + bSizerRight->Add( bSizerTitle, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerCompany; + bSizerCompany = new wxBoxSizer( wxVERTICAL ); + + m_staticText13 = new wxStaticText( this, wxID_ANY, _("Company"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText13->Wrap( -1 ); + bSizerCompany->Add( m_staticText13, 0, wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer14; + bSizer14 = new wxBoxSizer( wxHORIZONTAL ); + + m_TextCompany = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextCompany->SetMaxLength( 0 ); + m_TextCompany->SetMinSize( wxSize( 360,-1 ) ); + + bSizer14->Add( m_TextCompany, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + m_CompanyExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer14->Add( m_CompanyExport, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + + bSizerCompany->Add( bSizer14, 1, wxEXPAND, 5 ); + + + bSizerRight->Add( bSizerCompany, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerComment1; + bSizerComment1 = new wxBoxSizer( wxVERTICAL ); + + m_staticTextComment1 = new wxStaticText( this, wxID_ANY, _("Comment1"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextComment1->Wrap( -1 ); + bSizerComment1->Add( m_staticTextComment1, 0, wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizercmt1; + bSizercmt1 = new wxBoxSizer( wxHORIZONTAL ); + + m_TextComment1 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextComment1->SetMaxLength( 0 ); + m_TextComment1->SetMinSize( wxSize( 360,-1 ) ); + + bSizercmt1->Add( m_TextComment1, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + m_Comment1Export = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizercmt1->Add( m_Comment1Export, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + + bSizerComment1->Add( bSizercmt1, 1, wxEXPAND, 5 ); + + + bSizerRight->Add( bSizerComment1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerComment2; + bSizerComment2 = new wxBoxSizer( wxVERTICAL ); + + m_staticTextComment2 = new wxStaticText( this, wxID_ANY, _("Comment2"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextComment2->Wrap( -1 ); + bSizerComment2->Add( m_staticTextComment2, 0, wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizercmt2; + bSizercmt2 = new wxBoxSizer( wxHORIZONTAL ); + + m_TextComment2 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextComment2->SetMaxLength( 0 ); + m_TextComment2->SetMinSize( wxSize( 360,-1 ) ); + + bSizercmt2->Add( m_TextComment2, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + m_Comment2Export = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizercmt2->Add( m_Comment2Export, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + + bSizerComment2->Add( bSizercmt2, 1, wxEXPAND, 5 ); + + + bSizerRight->Add( bSizerComment2, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerComment12; + bSizerComment12 = new wxBoxSizer( wxVERTICAL ); + + m_staticTextComment3 = new wxStaticText( this, wxID_ANY, _("Comment3"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextComment3->Wrap( -1 ); + bSizerComment12->Add( m_staticTextComment3, 0, wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizercmt3; + bSizercmt3 = new wxBoxSizer( wxHORIZONTAL ); + + m_TextComment3 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextComment3->SetMaxLength( 0 ); + m_TextComment3->SetMinSize( wxSize( 360,-1 ) ); + + bSizercmt3->Add( m_TextComment3, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + m_Comment3Export = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizercmt3->Add( m_Comment3Export, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + + bSizerComment12->Add( bSizercmt3, 1, wxEXPAND, 5 ); + + + bSizerRight->Add( bSizerComment12, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerComment4; + bSizerComment4 = new wxBoxSizer( wxVERTICAL ); + + m_staticTextComment4 = new wxStaticText( this, wxID_ANY, _("Comment4"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextComment4->Wrap( -1 ); + bSizerComment4->Add( m_staticTextComment4, 0, wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizercmt4; + bSizercmt4 = new wxBoxSizer( wxHORIZONTAL ); + + m_TextComment4 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_TextComment4->SetMaxLength( 0 ); + m_TextComment4->SetMinSize( wxSize( 360,-1 ) ); + + bSizercmt4->Add( m_TextComment4, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + m_Comment4Export = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizercmt4->Add( m_Comment4Export, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + + bSizerComment4->Add( bSizercmt4, 1, wxEXPAND, 5 ); + + + bSizerRight->Add( bSizerComment4, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerFilename; + bSizerFilename = new wxBoxSizer( wxVERTICAL ); + + m_staticTextfilename = new wxStaticText( this, wxID_ANY, _("Page layout description file"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextfilename->Wrap( -1 ); + bSizerFilename->Add( m_staticTextfilename, 0, wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerfileSelection; + bSizerfileSelection = new wxBoxSizer( wxHORIZONTAL ); + + m_textCtrlFilePicker = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerfileSelection->Add( m_textCtrlFilePicker, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_buttonBrowse = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + bSizerfileSelection->Add( m_buttonBrowse, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerFilename->Add( bSizerfileSelection, 1, wxEXPAND, 5 ); + + + bSizerRight->Add( bSizerFilename, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + + bUpperSizerH->Add( bSizerRight, 1, wxEXPAND, 5 ); + + + bMainSizer->Add( bUpperSizerH, 1, wxEXPAND, 5 ); + + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); + + bMainSizer->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + + // Connect Events + m_paperSizeComboBox->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPaperSizeChoice ), NULL, this ); + m_orientationComboBox->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPageOrientationChoice ), NULL, this ); + m_TextUserSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeYTextUpdated ), NULL, this ); + m_TextUserSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeXTextUpdated ), NULL, this ); + m_TextDate->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateTextUpdated ), NULL, this ); + m_ApplyDate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateApplyClick ), NULL, this ); + m_TextRevision->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnRevisionTextUpdated ), NULL, this ); + m_TextTitle->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTitleTextUpdated ), NULL, this ); + m_TitleExport->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCheckboxTitleClick ), NULL, this ); + m_TextCompany->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCompanyTextUpdated ), NULL, this ); + m_TextComment1->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment1TextUpdated ), NULL, this ); + m_TextComment2->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment2TextUpdated ), NULL, this ); + m_TextComment3->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment3TextUpdated ), NULL, this ); + m_TextComment4->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment4TextUpdated ), NULL, this ); + m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnWksFileSelection ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this ); +} + +DIALOG_PAGES_SETTINGS_BASE::~DIALOG_PAGES_SETTINGS_BASE() +{ + // Disconnect Events + m_paperSizeComboBox->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPaperSizeChoice ), NULL, this ); + m_orientationComboBox->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPageOrientationChoice ), NULL, this ); + m_TextUserSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeYTextUpdated ), NULL, this ); + m_TextUserSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeXTextUpdated ), NULL, this ); + m_TextDate->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateTextUpdated ), NULL, this ); + m_ApplyDate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateApplyClick ), NULL, this ); + m_TextRevision->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnRevisionTextUpdated ), NULL, this ); + m_TextTitle->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTitleTextUpdated ), NULL, this ); + m_TitleExport->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCheckboxTitleClick ), NULL, this ); + m_TextCompany->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCompanyTextUpdated ), NULL, this ); + m_TextComment1->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment1TextUpdated ), NULL, this ); + m_TextComment2->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment2TextUpdated ), NULL, this ); + m_TextComment3->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment3TextUpdated ), NULL, this ); + m_TextComment4->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment4TextUpdated ), NULL, this ); + m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnWksFileSelection ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this ); + +} diff --git a/common/dialogs/dialog_page_settings_base.fbp b/common/dialogs/dialog_page_settings_base.fbp new file mode 100644 index 0000000..a456426 --- /dev/null +++ b/common/dialogs/dialog_page_settings_base.fbp @@ -0,0 +1,4454 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_page_settings_base + 1000 + none + 1 + dialog_page_settings_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_PAGES_SETTINGS_BASE + + 748,470 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Page Settings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1,-1 + bMainSizer + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bUpperSizerH + wxHORIZONTAL + none + + 5 + wxEXPAND + 0 + + + bleftSizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Paper + + 0 + + + 0 + + 1 + m_staticTextPaper + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline2 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Size: + + 0 + + + 0 + + 1 + m_staticTextSize + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "dummy text" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_paperSizeComboBox + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnPaperSizeChoice + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Orientation: + + 0 + + + 0 + + 1 + m_staticTextOrient + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Landscape" "Portrait" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_orientationComboBox + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnPageOrientationChoice + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Custom Size: + + 0 + + + 0 + + 1 + m_staticTextCustSize + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizerCustSize + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizercustHeight + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Height: + + 0 + + + 0 + + 1 + m_staticTextHeight + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 6 + + 0 + + 1 + m_TextUserSizeY + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_LEFT + + 0 + Custom paper height. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnUserPageSizeYTextUpdated + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizercustWidth + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Width: + + 0 + + + 0 + + 1 + m_staticTextWidth + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 6 + + 0 + + 1 + m_TextUserSizeX + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_LEFT + + 0 + Custom paper width. + + wxFILTER_NONE + wxTextValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnUserPageSizeXTextUpdated + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Layout Preview + + 0 + + + 0 + + 1 + m_staticTextPreview + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + wxSYS_COLOUR_WINDOW + Load From Icon Resource; + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + wxSYS_COLOUR_WINDOW + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + -1,-1 + 1 + m_PageLayoutExampleBitmap + 1 + + + protected + 1 + + Resizable + 1 + -1,-1 + + 0 + + + + wxFULL_REPAINT_ON_RESIZE|wxSIMPLE_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_VERTICAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerRight + wxVERTICAL + none + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Title Block Parameters + + 0 + + + 0 + + 1 + m_staticTexttbprm + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline3 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + + SheetInfoSizer + wxHORIZONTAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Number of sheets: %d + + 0 + + + 0 + + 1 + m_TextSheetCount + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 5 + protected + 5 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Sheet number: %d + + 0 + + + 0 + + 1 + m_TextSheetNumber + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizerDate + wxVERTICAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Issue Date + + 0 + + + 0 + + 1 + m_staticTextDate + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerissuedate + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 3 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + 100,-1 + 1 + m_TextDate + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnDateTextUpdated + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + <<< + + 0 + + + 0 + + 1 + m_ApplyDate + 1 + + + protected + 1 + + Resizable + 1 + + wxBU_EXACTFIT + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnDateApplyClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 2 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_PickDate + 1 + + + protected + 1 + + Resizable + 1 + + wxDP_DEFAULT + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Export to other sheets + + 0 + + + 0 + + 1 + m_DateExport + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizerRev + wxVERTICAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Revision + + 0 + + + 0 + + 1 + m_staticTextRev + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizer9 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + 100,-1 + 1 + m_TextRevision + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnRevisionTextUpdated + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Export to other sheets + + 0 + + + 0 + + 1 + m_RevisionExport + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizerTitle + wxVERTICAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Title + + 0 + + + 0 + + 1 + m_staticTextTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizer12 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + 360,-1 + 1 + m_TextTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnTitleTextUpdated + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Export to other sheets + + 0 + + + 0 + + 1 + m_TitleExport + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnCheckboxTitleClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizerCompany + wxVERTICAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Company + + 0 + + + 0 + + 1 + m_staticText13 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizer14 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + 360,-1 + 1 + m_TextCompany + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnCompanyTextUpdated + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Export to other sheets + + 0 + + + 0 + + 1 + m_CompanyExport + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizerComment1 + wxVERTICAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Comment1 + + 0 + + + 0 + + 1 + m_staticTextComment1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizercmt1 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + 360,-1 + 1 + m_TextComment1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnComment1TextUpdated + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Export to other sheets + + 0 + + + 0 + + 1 + m_Comment1Export + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizerComment2 + wxVERTICAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Comment2 + + 0 + + + 0 + + 1 + m_staticTextComment2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizercmt2 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + 360,-1 + 1 + m_TextComment2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnComment2TextUpdated + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Export to other sheets + + 0 + + + 0 + + 1 + m_Comment2Export + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizerComment12 + wxVERTICAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Comment3 + + 0 + + + 0 + + 1 + m_staticTextComment3 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizercmt3 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + 360,-1 + 1 + m_TextComment3 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnComment3TextUpdated + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Export to other sheets + + 0 + + + 0 + + 1 + m_Comment3Export + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizerComment4 + wxVERTICAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Comment4 + + 0 + + + 0 + + 1 + m_staticTextComment4 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizercmt4 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + 360,-1 + 1 + m_TextComment4 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnComment4TextUpdated + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Export to other sheets + + 0 + + + 0 + + 1 + m_Comment4Export + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizerFilename + wxVERTICAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Page layout description file + + 0 + + + 0 + + 1 + m_staticTextfilename + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerfileSelection + wxHORIZONTAL + none + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_textCtrlFilePicker + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Browse + + 0 + + + 0 + + 1 + m_buttonBrowse + 1 + + + protected + 1 + + Resizable + 1 + + wxBU_EXACTFIT + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnWksFileSelection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + + + + + OnOkClick + + + + + + + + diff --git a/common/dialogs/dialog_page_settings_base.h b/common/dialogs/dialog_page_settings_base.h new file mode 100644 index 0000000..13ccf6f --- /dev/null +++ b/common/dialogs/dialog_page_settings_base.h @@ -0,0 +1,126 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Mar 9 2015) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_PAGE_SETTINGS_BASE_H__ +#define __DIALOG_PAGE_SETTINGS_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_PAGES_SETTINGS_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_PAGES_SETTINGS_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticText* m_staticTextPaper; + wxStaticLine* m_staticline2; + wxStaticText* m_staticTextSize; + wxChoice* m_paperSizeComboBox; + wxStaticText* m_staticTextOrient; + wxChoice* m_orientationComboBox; + wxStaticText* m_staticTextCustSize; + wxStaticText* m_staticTextHeight; + wxTextCtrl* m_TextUserSizeY; + wxStaticText* m_staticTextWidth; + wxTextCtrl* m_TextUserSizeX; + wxStaticText* m_staticTextPreview; + wxStaticBitmap* m_PageLayoutExampleBitmap; + wxStaticLine* m_staticline1; + wxStaticText* m_staticTexttbprm; + wxStaticLine* m_staticline3; + wxStaticText* m_TextSheetCount; + wxStaticText* m_TextSheetNumber; + wxStaticText* m_staticTextDate; + wxTextCtrl* m_TextDate; + wxButton* m_ApplyDate; + wxDatePickerCtrl* m_PickDate; + wxCheckBox* m_DateExport; + wxStaticText* m_staticTextRev; + wxTextCtrl* m_TextRevision; + wxCheckBox* m_RevisionExport; + wxStaticText* m_staticTextTitle; + wxTextCtrl* m_TextTitle; + wxCheckBox* m_TitleExport; + wxStaticText* m_staticText13; + wxTextCtrl* m_TextCompany; + wxCheckBox* m_CompanyExport; + wxStaticText* m_staticTextComment1; + wxTextCtrl* m_TextComment1; + wxCheckBox* m_Comment1Export; + wxStaticText* m_staticTextComment2; + wxTextCtrl* m_TextComment2; + wxCheckBox* m_Comment2Export; + wxStaticText* m_staticTextComment3; + wxTextCtrl* m_TextComment3; + wxCheckBox* m_Comment3Export; + wxStaticText* m_staticTextComment4; + wxTextCtrl* m_TextComment4; + wxCheckBox* m_Comment4Export; + wxStaticText* m_staticTextfilename; + wxTextCtrl* m_textCtrlFilePicker; + wxButton* m_buttonBrowse; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnPaperSizeChoice( wxCommandEvent& event ) { event.Skip(); } + virtual void OnPageOrientationChoice( wxCommandEvent& event ) { event.Skip(); } + virtual void OnUserPageSizeYTextUpdated( wxCommandEvent& event ) { event.Skip(); } + virtual void OnUserPageSizeXTextUpdated( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDateTextUpdated( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDateApplyClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRevisionTextUpdated( wxCommandEvent& event ) { event.Skip(); } + virtual void OnTitleTextUpdated( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCheckboxTitleClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCompanyTextUpdated( wxCommandEvent& event ) { event.Skip(); } + virtual void OnComment1TextUpdated( wxCommandEvent& event ) { event.Skip(); } + virtual void OnComment2TextUpdated( wxCommandEvent& event ) { event.Skip(); } + virtual void OnComment3TextUpdated( wxCommandEvent& event ) { event.Skip(); } + virtual void OnComment4TextUpdated( wxCommandEvent& event ) { event.Skip(); } + virtual void OnWksFileSelection( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Page Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 748,470 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_PAGES_SETTINGS_BASE(); + +}; + +#endif //__DIALOG_PAGE_SETTINGS_BASE_H__ diff --git a/common/dialogs/wx_html_report_panel.cpp b/common/dialogs/wx_html_report_panel.cpp new file mode 100644 index 0000000..c9dca09 --- /dev/null +++ b/common/dialogs/wx_html_report_panel.cpp @@ -0,0 +1,302 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2015 CERN + * Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors. + * Author: Tomasz Wlostowski + * + * 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, see . + */ + +#include "wx_html_report_panel.h" + +#include +#include + +WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style ) : + WX_HTML_REPORT_PANEL_BASE( parent, id, pos, size, style ), + m_reporter( this ), + m_severities( -1 ), + m_showAll( true ), + m_lazyUpdate( false ) +{ + syncCheckboxes(); + m_htmlView->SetPage( addHeader( "" ) ); +} + + +WX_HTML_REPORT_PANEL::~WX_HTML_REPORT_PANEL() +{ +} + + +void WX_HTML_REPORT_PANEL::MsgPanelSetMinSize( const wxSize& aMinSize ) +{ + m_htmlView->SetMinSize( aMinSize ); + GetSizer()->SetSizeHints( this ); +} + + +REPORTER& WX_HTML_REPORT_PANEL::Reporter() +{ + return m_reporter; +} + + +void WX_HTML_REPORT_PANEL::Report( const wxString& aText, REPORTER::SEVERITY aSeverity ) +{ + REPORT_LINE line; + line.message = aText; + line.severity = aSeverity; + + m_report.push_back( line ); + + m_html += generateHtml( line ); + + if( !m_lazyUpdate ) + { + m_htmlView->AppendToPage( generateHtml( line ) ); + scrollToBottom(); + } +} + + +void WX_HTML_REPORT_PANEL::SetLazyUpdate( bool aLazyUpdate ) +{ + m_lazyUpdate = aLazyUpdate; +} + + +void WX_HTML_REPORT_PANEL::Flush() +{ + m_htmlView->SetPage( addHeader( m_html ) ); + scrollToBottom(); +} + + +void WX_HTML_REPORT_PANEL::scrollToBottom() +{ + int x, y, xUnit, yUnit; + + m_htmlView->GetVirtualSize( &x, &y ); + m_htmlView->GetScrollPixelsPerUnit( &xUnit, &yUnit ); + m_htmlView->Scroll( 0, y / yUnit ); +} + + +void WX_HTML_REPORT_PANEL::refreshView() +{ + wxString html; + + BOOST_FOREACH( REPORT_LINE l, m_report ) + { + html += generateHtml( l ); + } + + m_htmlView->SetPage( addHeader( html ) ); + scrollToBottom(); +} + + +wxString WX_HTML_REPORT_PANEL::addHeader( const wxString& aBody ) +{ + wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ); + wxColour fgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ); + wxString s = ""; + s += aBody; + s += ""; + + return s; +} + + +wxString WX_HTML_REPORT_PANEL::generateHtml( const REPORT_LINE& aLine ) +{ + if( !m_showAll && ! ( m_severities & aLine.severity ) ) + return wxEmptyString; + + switch( aLine.severity ) + { + case REPORTER::RPT_ERROR: + return wxString( "" ) + _( "Error: " ) + aLine.message + wxString( "
" ); + case REPORTER::RPT_WARNING: + return wxString( "" ) + _( "Warning: " ) + aLine.message + wxString( "
" ); + case REPORTER::RPT_INFO: + return wxString( "" ) + _( "Info: " ) + aLine.message + wxString( "
" ); + case REPORTER::RPT_ACTION: + return wxString( "" ) + aLine.message + wxString( "
" ); + default: + return wxString( "" ) + aLine.message + wxString( "
" ); + } +} + + +wxString WX_HTML_REPORT_PANEL::generatePlainText( const REPORT_LINE& aLine ) +{ + switch( aLine.severity ) + { + case REPORTER::RPT_ERROR: + return _( "Error: " ) + aLine.message + wxT( "\n" ); + case REPORTER::RPT_WARNING: + return _( "Warning: " ) + aLine.message + wxT( "\n" ); + case REPORTER::RPT_INFO: + return _( "Info: " ) + aLine.message + wxT( "\n" ); + default: + return aLine.message + wxT( "\n" ); + } +} + + +void WX_HTML_REPORT_PANEL::onCheckBoxShowAll( wxCommandEvent& event ) +{ + if ( event.IsChecked() ) + m_showAll = true; + else + m_showAll = false; + + syncCheckboxes(); + refreshView(); +} + + +void WX_HTML_REPORT_PANEL::syncCheckboxes() +{ + m_checkBoxShowAll->SetValue( m_showAll ); + m_checkBoxShowWarnings->Enable( !m_showAll ); + m_checkBoxShowWarnings->SetValue( m_severities & REPORTER::RPT_WARNING ); + m_checkBoxShowErrors->Enable( !m_showAll ); + m_checkBoxShowErrors->SetValue( m_severities & REPORTER::RPT_ERROR ); + m_checkBoxShowInfos->Enable( !m_showAll ); + m_checkBoxShowInfos->SetValue( m_severities & REPORTER::RPT_INFO ); + m_checkBoxShowActions->Enable( !m_showAll ); + m_checkBoxShowActions->SetValue( m_severities & REPORTER::RPT_ACTION ); +} + + +void WX_HTML_REPORT_PANEL::onCheckBoxShowWarnings( wxCommandEvent& event ) +{ + if ( event.IsChecked() ) + m_severities |= REPORTER::RPT_WARNING; + else + m_severities &= ~REPORTER::RPT_WARNING; + + refreshView(); +} + + +void WX_HTML_REPORT_PANEL::onCheckBoxShowErrors( wxCommandEvent& event ) +{ + if ( event.IsChecked() ) + m_severities |= REPORTER::RPT_ERROR; + else + m_severities &= ~REPORTER::RPT_ERROR; + + refreshView(); +} + + +void WX_HTML_REPORT_PANEL::onCheckBoxShowInfos( wxCommandEvent& event ) +{ + if ( event.IsChecked() ) + m_severities |= REPORTER::RPT_INFO; + else + m_severities &= ~REPORTER::RPT_INFO; + + refreshView(); +} + + +void WX_HTML_REPORT_PANEL::onCheckBoxShowActions( wxCommandEvent& event ) +{ + if ( event.IsChecked() ) + m_severities |= REPORTER::RPT_ACTION; + else + m_severities &= ~REPORTER::RPT_ACTION; + + refreshView(); +} + + +void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event ) +{ + wxFileName fn( "./report.txt" ); + + wxFileDialog dlg( this, _( "Save report to file" ), fn.GetPath(), fn.GetName(), + TextWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + + if( dlg.ShowModal() != wxID_OK ) + return; + + fn = dlg.GetPath(); + + if( fn.GetExt().IsEmpty() ) + fn.SetExt( wxT( "txt" ) ); + + wxFile f( fn.GetFullPath(), wxFile::write ); + + if( !f.IsOpened() ) + { + wxString msg; + + msg.Printf( _( "Cannot write report to file '%s'." ), + fn.GetFullPath().GetData() ); + wxMessageBox( msg, _( "File save error" ), wxOK | wxICON_ERROR, this ); + return; + } + + BOOST_FOREACH( REPORT_LINE l, m_report ) + { + f.Write( generatePlainText( l ) ); + } + + f.Close(); +} + + +void WX_HTML_REPORT_PANEL::Clear() +{ + m_html.clear(); + m_report.clear(); +} + + +void WX_HTML_REPORT_PANEL::SetLabel( const wxString& aLabel ) +{ + m_box->GetStaticBox()->SetLabel( aLabel ); +} + + +void WX_HTML_REPORT_PANEL::SetVisibleSeverities( int aSeverities ) +{ + if( aSeverities < 0 ) + m_showAll = true; + else + { + m_showAll = false; + m_severities = aSeverities; + } + + syncCheckboxes(); +} + + +int WX_HTML_REPORT_PANEL::GetVisibleSeverities() +{ + return m_showAll ? m_severities | 0x80000000 : m_severities & ~0x80000000; +} diff --git a/common/dialogs/wx_html_report_panel.h b/common/dialogs/wx_html_report_panel.h new file mode 100644 index 0000000..03e351f --- /dev/null +++ b/common/dialogs/wx_html_report_panel.h @@ -0,0 +1,122 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2015 CERN + * Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors. + * Author: Tomasz Wlostowski + * + * 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, see . + */ + +#ifndef __WX_HTML_REPORT_PANEL_H__ +#define __WX_HTML_REPORT_PANEL_H__ + +#include +#include +#include + +#include "wx_html_report_panel_base.h" + + +/** + * Class WX_HTML_REPORT_PANEL + * + * A widget for browsing a rich text error/status report. Used in numerous + * dialogs in eeschema and pcbnew. Provides error filtering functionality + * and saving report files. + * + * The messages are reported throuth a REPORTER object + */ +class WX_HTML_REPORT_PANEL : public WX_HTML_REPORT_PANEL_BASE +{ +public: + WX_HTML_REPORT_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL ); + ~WX_HTML_REPORT_PANEL(); + + ///> Set the min size of the area which displays html messages: + void MsgPanelSetMinSize( const wxSize& aMinSize ); + + ///> returns the reporter object that reports to this panel + REPORTER& Reporter(); + + ///> reports a string directly. + void Report( const wxString& aText, REPORTER::SEVERITY aSeverity ); + + ///> clears the report panel + void Clear(); + + ///> sets the frame label + void SetLabel( const wxString& aLabel ); + + ///> Sets the lasy update. If this mode is on, messages are stored but the display + ///> is not updated (Updating display can be very time consumming if there are many messages) + ///> A call to Flush() will be needed after build the report + void SetLazyUpdate( bool aLazyUpdate ); + + ///> Forces updating the HTML page, after the report is built in lazy mode + void Flush(); + + ///> Set the visible severity filter. + ///> if aSeverities < 0 the m_showAll option is set + void SetVisibleSeverities( int aSeverities ); + + ///> @return the visible severity filter. + ///> If the m_showAll option is set, the mask is < 0 + int GetVisibleSeverities(); + +private: + struct REPORT_LINE + { + REPORTER::SEVERITY severity; + wxString message; + }; + + typedef std::vector REPORT_LINES; + + wxString addHeader( const wxString& aBody ); + wxString generateHtml( const REPORT_LINE& aLine ); + wxString generatePlainText( const REPORT_LINE& aLine ); + + void refreshView(); + void scrollToBottom(); + void syncCheckboxes(); + + void onCheckBoxShowAll( wxCommandEvent& event ); + void onCheckBoxShowWarnings( wxCommandEvent& event ); + void onCheckBoxShowErrors( wxCommandEvent& event ); + void onCheckBoxShowInfos( wxCommandEvent& event ); + void onCheckBoxShowActions( wxCommandEvent& event ); + + void onBtnSaveToFile( wxCommandEvent& event ); + + ///> copy of the report, stored for filtering + REPORT_LINES m_report; + + ///> the reporter + WX_HTML_PANEL_REPORTER m_reporter; + + ///> message severities to display (mask) + int m_severities; + + ///> show all messages flag (overrides m_severities) + bool m_showAll; + + wxString m_html; + + bool m_lazyUpdate; +}; + +#endif //__WX_HTML_REPORT_PANEL_H__ diff --git a/common/dialogs/wx_html_report_panel_base.cpp b/common/dialogs/wx_html_report_panel_base.cpp new file mode 100644 index 0000000..bd33c8c --- /dev/null +++ b/common/dialogs/wx_html_report_panel_base.cpp @@ -0,0 +1,94 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 17 2015) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "wx_html_report_panel_base.h" + +/////////////////////////////////////////////////////////////////////////// + +WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) +{ + m_box = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer4; + fgSizer4 = new wxFlexGridSizer( 2, 1, 0, 0 ); + fgSizer4->AddGrowableCol( 0 ); + fgSizer4->AddGrowableRow( 0 ); + fgSizer4->SetFlexibleDirection( wxBOTH ); + fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_htmlView = new wxHtmlWindow( m_box->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO ); + m_htmlView->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + + fgSizer4->Add( m_htmlView, 1, wxEXPAND, 5 ); + + wxFlexGridSizer* fgSizer3; + fgSizer3 = new wxFlexGridSizer( 1, 7, 0, 0 ); + fgSizer3->AddGrowableCol( 6 ); + fgSizer3->SetFlexibleDirection( wxBOTH ); + fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText3 = new wxStaticText( m_box->GetStaticBox(), wxID_ANY, _("Filter:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText3->Wrap( -1 ); + fgSizer3->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 ); + + m_checkBoxShowAll = new wxCheckBox( m_box->GetStaticBox(), wxID_ANY, _("All"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxShowAll->SetValue(true); + fgSizer3->Add( m_checkBoxShowAll, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_checkBoxShowWarnings = new wxCheckBox( m_box->GetStaticBox(), wxID_ANY, _("Warnings"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxShowWarnings->Enable( false ); + + fgSizer3->Add( m_checkBoxShowWarnings, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_checkBoxShowErrors = new wxCheckBox( m_box->GetStaticBox(), wxID_ANY, _("Errors"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxShowErrors->Enable( false ); + + fgSizer3->Add( m_checkBoxShowErrors, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_checkBoxShowInfos = new wxCheckBox( m_box->GetStaticBox(), wxID_ANY, _("Infos"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxShowInfos->Enable( false ); + + fgSizer3->Add( m_checkBoxShowInfos, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_checkBoxShowActions = new wxCheckBox( m_box->GetStaticBox(), wxID_ANY, _("Actions"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxShowActions->Enable( false ); + + fgSizer3->Add( m_checkBoxShowActions, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_btnSaveReportToFile = new wxButton( m_box->GetStaticBox(), wxID_ANY, _("Save report to file..."), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer3->Add( m_btnSaveReportToFile, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxLEFT, 5 ); + + + fgSizer4->Add( fgSizer3, 1, wxEXPAND, 5 ); + + + m_box->Add( fgSizer4, 1, wxEXPAND|wxALL, 5 ); + + + this->SetSizer( m_box ); + this->Layout(); + + // Connect Events + m_checkBoxShowAll->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowAll ), NULL, this ); + m_checkBoxShowWarnings->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowWarnings ), NULL, this ); + m_checkBoxShowErrors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowErrors ), NULL, this ); + m_checkBoxShowInfos->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowInfos ), NULL, this ); + m_checkBoxShowActions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowActions ), NULL, this ); + m_btnSaveReportToFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onBtnSaveToFile ), NULL, this ); +} + +WX_HTML_REPORT_PANEL_BASE::~WX_HTML_REPORT_PANEL_BASE() +{ + // Disconnect Events + m_checkBoxShowAll->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowAll ), NULL, this ); + m_checkBoxShowWarnings->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowWarnings ), NULL, this ); + m_checkBoxShowErrors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowErrors ), NULL, this ); + m_checkBoxShowInfos->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowInfos ), NULL, this ); + m_checkBoxShowActions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onCheckBoxShowActions ), NULL, this ); + m_btnSaveReportToFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WX_HTML_REPORT_PANEL_BASE::onBtnSaveToFile ), NULL, this ); + +} diff --git a/common/dialogs/wx_html_report_panel_base.fbp b/common/dialogs/wx_html_report_panel_base.fbp new file mode 100644 index 0000000..8b635e0 --- /dev/null +++ b/common/dialogs/wx_html_report_panel_base.fbp @@ -0,0 +1,823 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + wx_html_report_panel_base + 1000 + none + 1 + WX_HTML_REPORT_PANEL_BASE + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 1 + impl_virtual + + + 0 + wxID_ANY + + + WX_HTML_REPORT_PANEL_BASE + + 500,300 + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + wxID_ANY + Messages: + + m_box + wxVERTICAL + protected + + + 5 + wxEXPAND|wxALL + 1 + + 1 + wxBOTH + 0 + 0 + 0 + + fgSizer4 + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 0 + 0 + Dock + 0 + Left + 1 + + 1 + ,90,90,10,70,0 + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_htmlView + 1 + + + protected + 1 + + Resizable + 1 + + wxHW_SCROLLBAR_AUTO + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 7 + wxBOTH + 6 + + 0 + + fgSizer3 + wxFLEX_GROWMODE_SPECIFIED + none + 1 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Filter: + + 0 + + + 0 + + 1 + m_staticText3 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + All + + 0 + + + 0 + + 1 + m_checkBoxShowAll + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + onCheckBoxShowAll + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + + 1 + + 0 + 0 + wxID_ANY + Warnings + + 0 + + + 0 + + 1 + m_checkBoxShowWarnings + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + onCheckBoxShowWarnings + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + + 1 + + 0 + 0 + wxID_ANY + Errors + + 0 + + + 0 + + 1 + m_checkBoxShowErrors + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + onCheckBoxShowErrors + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + + 1 + + 0 + 0 + wxID_ANY + Infos + + 0 + + + 0 + + 1 + m_checkBoxShowInfos + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + onCheckBoxShowInfos + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + + 1 + + 0 + 0 + wxID_ANY + Actions + + 0 + + + 0 + + 1 + m_checkBoxShowActions + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + onCheckBoxShowActions + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Save report to file... + + 0 + -1,-1 + + 0 + + 1 + m_btnSaveReportToFile + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onBtnSaveToFile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/dialogs/wx_html_report_panel_base.h b/common/dialogs/wx_html_report_panel_base.h new file mode 100644 index 0000000..b65449e --- /dev/null +++ b/common/dialogs/wx_html_report_panel_base.h @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 17 2015) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_HTML_REPORT_PANEL_BASE_H__ +#define __WX_HTML_REPORT_PANEL_BASE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class WX_HTML_REPORT_PANEL_BASE +/////////////////////////////////////////////////////////////////////////////// +class WX_HTML_REPORT_PANEL_BASE : public wxPanel +{ + private: + + protected: + wxStaticBoxSizer* m_box; + wxHtmlWindow* m_htmlView; + wxStaticText* m_staticText3; + wxCheckBox* m_checkBoxShowAll; + wxCheckBox* m_checkBoxShowWarnings; + wxCheckBox* m_checkBoxShowErrors; + wxCheckBox* m_checkBoxShowInfos; + wxCheckBox* m_checkBoxShowActions; + wxButton* m_btnSaveReportToFile; + + // Virtual event handlers, overide them in your derived class + virtual void onCheckBoxShowAll( wxCommandEvent& event ) { event.Skip(); } + virtual void onCheckBoxShowWarnings( wxCommandEvent& event ) { event.Skip(); } + virtual void onCheckBoxShowErrors( wxCommandEvent& event ) { event.Skip(); } + virtual void onCheckBoxShowInfos( wxCommandEvent& event ) { event.Skip(); } + virtual void onCheckBoxShowActions( wxCommandEvent& event ) { event.Skip(); } + virtual void onBtnSaveToFile( wxCommandEvent& event ) { event.Skip(); } + + + public: + + WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL ); + ~WX_HTML_REPORT_PANEL_BASE(); + +}; + +#endif //__WX_HTML_REPORT_PANEL_BASE_H__ -- cgit