From aa35045840b78d3f48212db45da59a2e5c69b223 Mon Sep 17 00:00:00 2001 From: saurabhb17 Date: Wed, 26 Feb 2020 15:57:49 +0530 Subject: Added main execs --- cvpcb/dialogs/dialog_config_equfiles.cpp | 308 ++++++ cvpcb/dialogs/dialog_config_equfiles.h | 71 ++ cvpcb/dialogs/dialog_config_equfiles_base.cpp | 151 +++ cvpcb/dialogs/dialog_config_equfiles_base.fbp | 1108 ++++++++++++++++++++ cvpcb/dialogs/dialog_config_equfiles_base.h | 82 ++ cvpcb/dialogs/dialog_cvpcb_config_fbp.h | 100 ++ cvpcb/dialogs/dialog_display_options.cpp | 136 +++ cvpcb/dialogs/dialog_display_options.h | 61 ++ cvpcb/dialogs/dialog_display_options_base.cpp | 93 ++ cvpcb/dialogs/dialog_display_options_base.fbp | 861 +++++++++++++++ cvpcb/dialogs/dialog_display_options_base.h | 68 ++ cvpcb/dialogs/fp_conflict_assignment_selector.cpp | 190 ++++ cvpcb/dialogs/fp_conflict_assignment_selector.h | 79 ++ .../fp_conflict_assignment_selector_base.cpp | 58 + .../fp_conflict_assignment_selector_base.fbp | 313 ++++++ .../dialogs/fp_conflict_assignment_selector_base.h | 59 ++ 16 files changed, 3738 insertions(+) create mode 100644 cvpcb/dialogs/dialog_config_equfiles.cpp create mode 100644 cvpcb/dialogs/dialog_config_equfiles.h create mode 100644 cvpcb/dialogs/dialog_config_equfiles_base.cpp create mode 100644 cvpcb/dialogs/dialog_config_equfiles_base.fbp create mode 100644 cvpcb/dialogs/dialog_config_equfiles_base.h create mode 100644 cvpcb/dialogs/dialog_cvpcb_config_fbp.h create mode 100644 cvpcb/dialogs/dialog_display_options.cpp create mode 100644 cvpcb/dialogs/dialog_display_options.h create mode 100644 cvpcb/dialogs/dialog_display_options_base.cpp create mode 100644 cvpcb/dialogs/dialog_display_options_base.fbp create mode 100644 cvpcb/dialogs/dialog_display_options_base.h create mode 100644 cvpcb/dialogs/fp_conflict_assignment_selector.cpp create mode 100644 cvpcb/dialogs/fp_conflict_assignment_selector.h create mode 100644 cvpcb/dialogs/fp_conflict_assignment_selector_base.cpp create mode 100644 cvpcb/dialogs/fp_conflict_assignment_selector_base.fbp create mode 100644 cvpcb/dialogs/fp_conflict_assignment_selector_base.h (limited to 'cvpcb/dialogs') diff --git a/cvpcb/dialogs/dialog_config_equfiles.cpp b/cvpcb/dialogs/dialog_config_equfiles.cpp new file mode 100644 index 0000000..3ae03fd --- /dev/null +++ b/cvpcb/dialogs/dialog_config_equfiles.cpp @@ -0,0 +1,308 @@ +/** + * @file dialog_config_equfiles.cpp + */ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * 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 + */ + +#include +#include +#include +#include +#include +#include +#include // For PROJECT_VAR_NAME definition +#include // For KISYSMOD definition + +#include +#include + +#include +#include + + +DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* aParent ) : + DIALOG_CONFIG_EQUFILES_BASE( aParent ) +{ + m_Parent = aParent; + m_Config = Pgm().CommonSettings(); + + PROJECT& prj = Prj(); + SetTitle( wxString::Format( _( "Project file: '%s'" ), GetChars( prj.GetProjectFullName() ) ) ); + + Init( ); + + GetSizer()->SetSizeHints( this ); + Center(); +} + +void CVPCB_MAINFRAME::OnEditEquFilesList( wxCommandEvent& aEvent ) +{ + DIALOG_CONFIG_EQUFILES dlg( this ); + + dlg.ShowModal(); +} + + +void DIALOG_CONFIG_EQUFILES::Init() +{ + m_sdbSizerOK->SetDefault(); + m_ListChanged = false; + m_ListEquiv->InsertItems( m_Parent->m_EquFilesNames, 0 ); + + if( getEnvVarCount() < 2 ) + m_gridEnvVars->AppendRows(2 - getEnvVarCount() ); + + wxString evValue; + int row = 0; + + m_gridEnvVars->SetCellValue( row++, 0, PROJECT_VAR_NAME ); + m_gridEnvVars->SetCellValue( row, 0, FP_LIB_TABLE::GlobalPathEnvVariableName() ); + + for( row = 0; row < getEnvVarCount(); row++ ) + { + if( wxGetEnv( m_gridEnvVars->GetCellValue( row, 0 ), &evValue ) ) + m_gridEnvVars->SetCellValue( row, 1, evValue ); + } + + m_gridEnvVars->AutoSizeColumns(); + +} + +void DIALOG_CONFIG_EQUFILES::OnEditEquFile( wxCommandEvent& event ) +{ + wxString editorname = Pgm().GetEditorName(); + + if( editorname.IsEmpty() ) + { + wxMessageBox( _( "No editor defined in Kicad. Please chose it" ) ); + return; + } + + wxArrayInt selections; + m_ListEquiv->GetSelections( selections ); + + wxString fullFileNames, tmp; + + for( unsigned ii = 0; ii < selections.GetCount(); ii++ ) + { + tmp = m_ListEquiv->GetString( selections[ii] ); + fullFileNames << wxT( " \"" ) << wxExpandEnvVars( tmp ) << wxT( "\"" ); + m_ListChanged = true; + } + + ExecuteFile( this, editorname, fullFileNames ); +} + + +void DIALOG_CONFIG_EQUFILES::OnCancelClick( wxCommandEvent& event ) +{ + EndModal( wxID_CANCEL ); +} + + +void DIALOG_CONFIG_EQUFILES::OnOkClick( wxCommandEvent& event ) +{ + // Save new equ file list if the files list was modified + if( m_ListChanged ) + { + // Recreate equ list + m_Parent->m_EquFilesNames.Clear(); + + for( unsigned ii = 0; ii < m_ListEquiv->GetCount(); ii++ ) + m_Parent->m_EquFilesNames.Add( m_ListEquiv->GetString( ii ) ); + + wxCommandEvent evt( ID_SAVE_PROJECT ); + m_Parent->SaveProjectFile( evt ); + } + + EndModal( wxID_OK ); +} + + +void DIALOG_CONFIG_EQUFILES::OnCloseWindow( wxCloseEvent& event ) +{ + EndModal( wxID_CANCEL ); +} + + +/********************************************************************/ +void DIALOG_CONFIG_EQUFILES::OnButtonMoveUp( wxCommandEvent& event ) +/********************************************************************/ +{ + wxArrayInt selections; + + m_ListEquiv->GetSelections( selections ); + + if ( selections.GetCount() <= 0 ) // No selection. + return; + + if( selections[0] == 0 ) // The first lib is selected. cannot move up it + return; + + wxArrayString libnames = m_ListEquiv->GetStrings(); + + for( size_t ii = 0; ii < selections.GetCount(); ii++ ) + { + int jj = selections[ii]; + std::swap( libnames[jj], libnames[jj-1] ); + } + + m_ListEquiv->Set( libnames ); + + // Reselect previously selected names + for( size_t ii = 0; ii < selections.GetCount(); ii++ ) + { + int jj = selections[ii]; + m_ListEquiv->SetSelection( jj-1 ); + } + + m_ListChanged = true; +} + + +/*********************************************************************/ +void DIALOG_CONFIG_EQUFILES::OnButtonMoveDown( wxCommandEvent& event ) +/*********************************************************************/ +{ + wxArrayInt selections; + m_ListEquiv->GetSelections( selections ); + + if ( selections.GetCount() <= 0 ) // No selection. + return; + + // The last lib is selected. cannot move down it + if( selections.Last() == int( m_ListEquiv->GetCount()-1 ) ) + return; + + wxArrayString libnames = m_ListEquiv->GetStrings(); + + for( int ii = selections.GetCount()-1; ii >= 0; ii-- ) + { + int jj = selections[ii]; + std::swap( libnames[jj], libnames[jj+1]); + } + + m_ListEquiv->Set( libnames ); + + // Reselect previously selected names + for( size_t ii = 0; ii < selections.GetCount(); ii++ ) + { + int jj = selections[ii]; + m_ListEquiv->SetSelection(jj+1); + } + + m_ListChanged = true; +} + + +/* Remove a library to the library list. + * The real list (g_LibName_List) is not changed, so the change can be canceled + */ +void DIALOG_CONFIG_EQUFILES::OnRemoveFiles( wxCommandEvent& event ) +{ + wxArrayInt selections; + m_ListEquiv->GetSelections( selections ); + + std::sort( selections.begin(), selections.end() ); + + for( int ii = selections.GetCount()-1; ii >= 0; ii-- ) + { + m_ListEquiv->Delete(selections[ii] ); + m_ListChanged = true; + } +} + + +/* Insert or add a library to the library list: + * The new library is put in list before (insert button) the selection, + * or added (add button) to end of list + */ +void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event ) +{ + wxString equFilename, wildcard; + wxFileName fn; + + wildcard = EquFilesWildcard; + wxListBox* list = m_ListEquiv; + + // Get a default path to open the file dialog: + wxString libpath; + wxArrayInt selectedRows = m_gridEnvVars->GetSelectedRows(); + + int row = selectedRows.GetCount() ? selectedRows[0] : + m_gridEnvVars->GetGridCursorRow(); + + libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) ); + + wxFileDialog FilesDialog( this, _( "Equ files:" ), libpath, + wxEmptyString, wildcard, + wxFD_DEFAULT_STYLE | wxFD_MULTIPLE ); + + if( FilesDialog.ShowModal() != wxID_OK ) + return; + + wxArrayString Filenames; + FilesDialog.GetPaths( Filenames ); + + for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ ) + { + fn = Filenames[jj]; + equFilename.Empty(); + + if( isPathRelativeAllowed() ) // try to use relative path + { + for( row = 0; row < getEnvVarCount(); row++ ) + { + libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) ); + + if( fn.MakeRelativeTo( libpath ) ) + { + equFilename.Printf( wxT("${%s}%c%s"), + GetChars( m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 0 ) ) ), + fn.GetPathSeparator(), + GetChars( fn.GetFullPath() ) ); + break; + } + } + } + + if( equFilename.IsEmpty() ) + equFilename = Filenames[jj]; + + // Add or insert new library name, if not already in list + if( list->FindString( equFilename, fn.IsCaseSensitive() ) == wxNOT_FOUND ) + { + m_ListChanged = true; + equFilename.Replace( wxT("\\"), wxT("/") ); // Use unix separators only. + list->Append( equFilename ); + } + else + { + wxString msg; + msg.Printf( _( "File '%s' already exists in list" ), equFilename.GetData() ); + DisplayError( this, msg ); + } + } +} diff --git a/cvpcb/dialogs/dialog_config_equfiles.h b/cvpcb/dialogs/dialog_config_equfiles.h new file mode 100644 index 0000000..aeb4868 --- /dev/null +++ b/cvpcb/dialogs/dialog_config_equfiles.h @@ -0,0 +1,71 @@ +/** + * @file dialog_config_equfiles.h + */ + +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2010-2015 Jean-Pierre Charras jp.charras at wanadoo.fr + * Copyright (C) 1992-2015 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 + */ + +#ifndef _DIALOG_CONFIG_EQUFILES_H_ +#define _DIALOG_CONFIG_EQUFILES_H_ + +#include + +class DIALOG_CONFIG_EQUFILES : public DIALOG_CONFIG_EQUFILES_BASE +{ +private: + CVPCB_MAINFRAME* m_Parent; + wxConfigBase* m_Config; + wxString m_UserLibDirBufferImg; + + bool m_ListChanged; + +private: + void Init(); + + // Virtual event handlers + void OnCloseWindow( wxCloseEvent& event ); + void OnOkClick( wxCommandEvent& event ); + void OnCancelClick( wxCommandEvent& event ); + void OnAddFiles( wxCommandEvent& event ); + void OnEditEquFile( wxCommandEvent& event ); + void OnRemoveFiles( wxCommandEvent& event ); + void OnButtonMoveUp( wxCommandEvent& event ); + void OnButtonMoveDown( wxCommandEvent& event ); + + int getEnvVarCount() // Get the number of rows in env var table + { + return m_gridEnvVars->GetTable()->GetRowsCount(); + } + + bool isPathRelativeAllowed() + { + return m_rbPathOptionChoice->GetSelection() == 1; + } + +public: + DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* parent ); + ~DIALOG_CONFIG_EQUFILES() {}; +}; + +#endif // _DIALOG_CONFIG_EQUFILES_H_ diff --git a/cvpcb/dialogs/dialog_config_equfiles_base.cpp b/cvpcb/dialogs/dialog_config_equfiles_base.cpp new file mode 100644 index 0000000..e4b8a8c --- /dev/null +++ b/cvpcb/dialogs/dialog_config_equfiles_base.cpp @@ -0,0 +1,151 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_config_equfiles_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_CONFIG_EQUFILES_BASE::DIALOG_CONFIG_EQUFILES_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 ); + + wxStaticBoxSizer* sbEquivChoiceSizer; + sbEquivChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprint/Component equ files (.equ files)") ), wxHORIZONTAL ); + + wxBoxSizer* bSizerFlist; + bSizerFlist = new wxBoxSizer( wxVERTICAL ); + + m_ListEquiv = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE ); + m_ListEquiv->SetMinSize( wxSize( 350,-1 ) ); + + bSizerFlist->Add( m_ListEquiv, 1, wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + + sbEquivChoiceSizer->Add( bSizerFlist, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizerButtons; + bSizerButtons = new wxBoxSizer( wxVERTICAL ); + + m_buttonAddEqu = new wxButton( this, ID_ADD_EQU, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonAddEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_buttonRemoveEqu = new wxButton( this, ID_REMOVE_EQU, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonRemoveEqu->SetToolTip( _("Unload the selected library") ); + + bSizerButtons->Add( m_buttonRemoveEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_buttonMoveUp = new wxButton( this, ID_EQU_UP, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonMoveUp, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_buttonMoveDown = new wxButton( this, ID_EQU_DOWN, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonMoveDown, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_buttonEdit = new wxButton( this, wxID_ANY, _("Edit Equ File"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButtons->Add( m_buttonEdit, 0, wxALL|wxEXPAND, 5 ); + + + sbEquivChoiceSizer->Add( bSizerButtons, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bMainSizer->Add( sbEquivChoiceSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerLower; + bSizerLower = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerEnvVar; + bSizerEnvVar = new wxBoxSizer( wxVERTICAL ); + + m_staticText2 = new wxStaticText( this, wxID_ANY, _("Available environment variables for relative paths:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2->Wrap( -1 ); + bSizerEnvVar->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_gridEnvVars = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridEnvVars->CreateGrid( 2, 2 ); + m_gridEnvVars->EnableEditing( true ); + m_gridEnvVars->EnableGridLines( true ); + m_gridEnvVars->EnableDragGridSize( false ); + m_gridEnvVars->SetMargins( 0, 0 ); + + // Columns + m_gridEnvVars->EnableDragColMove( false ); + m_gridEnvVars->EnableDragColSize( true ); + m_gridEnvVars->SetColLabelSize( 25 ); + m_gridEnvVars->SetColLabelValue( 0, _("Name") ); + m_gridEnvVars->SetColLabelValue( 1, _("Value") ); + m_gridEnvVars->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_gridEnvVars->AutoSizeRows(); + m_gridEnvVars->EnableDragRowSize( true ); + m_gridEnvVars->SetRowLabelSize( 30 ); + m_gridEnvVars->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_gridEnvVars->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + bSizerEnvVar->Add( m_gridEnvVars, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerLower->Add( bSizerEnvVar, 1, wxEXPAND, 5 ); + + wxString m_rbPathOptionChoiceChoices[] = { _("Absolute path"), _("Relative path") }; + int m_rbPathOptionChoiceNChoices = sizeof( m_rbPathOptionChoiceChoices ) / sizeof( wxString ); + m_rbPathOptionChoice = new wxRadioBox( this, wxID_ANY, _("Path option:"), wxDefaultPosition, wxDefaultSize, m_rbPathOptionChoiceNChoices, m_rbPathOptionChoiceChoices, 1, wxRA_SPECIFY_COLS ); + m_rbPathOptionChoice->SetSelection( 1 ); + bSizerLower->Add( m_rbPathOptionChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bMainSizer->Add( bSizerLower, 0, wxEXPAND, 5 ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bMainSizer->Add( m_staticline2, 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_sdbSizer->Realize(); + + bMainSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCloseWindow ) ); + m_buttonAddEqu->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnAddFiles ), NULL, this ); + m_buttonRemoveEqu->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnRemoveFiles ), NULL, this ); + m_buttonMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveUp ), NULL, this ); + m_buttonMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveDown ), NULL, this ); + m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnEditEquFile ), NULL, this ); + m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnOkClick ), NULL, this ); +} + +DIALOG_CONFIG_EQUFILES_BASE::~DIALOG_CONFIG_EQUFILES_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCloseWindow ) ); + m_buttonAddEqu->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnAddFiles ), NULL, this ); + m_buttonRemoveEqu->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnRemoveFiles ), NULL, this ); + m_buttonMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveUp ), NULL, this ); + m_buttonMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveDown ), NULL, this ); + m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnEditEquFile ), NULL, this ); + m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnOkClick ), NULL, this ); + +} diff --git a/cvpcb/dialogs/dialog_config_equfiles_base.fbp b/cvpcb/dialogs/dialog_config_equfiles_base.fbp new file mode 100644 index 0000000..38e625e --- /dev/null +++ b/cvpcb/dialogs/dialog_config_equfiles_base.fbp @@ -0,0 +1,1108 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_config_equfiles_base + 1000 + none + 1 + dialog_cvpcb_config_equfile_base + + . + + 1 + 1 + 1 + 1 + UI + 1 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_CONFIG_EQUFILES_BASE + + 454,338 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + + + + + + + + + + + + + + + OnCloseWindow + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bMainSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 1 + + wxID_ANY + Footprint/Component equ files (.equ files) + + sbEquivChoiceSizer + wxHORIZONTAL + none + + + 5 + wxEXPAND + 1 + + + bSizerFlist + wxVERTICAL + none + + 5 + wxRIGHT|wxLEFT|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + -1,-1 + + 0 + 350,-1 + 1 + m_ListEquiv + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + + bSizerButtons + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_ADD_EQU + Add + + 0 + + + 0 + + 1 + m_buttonAddEqu + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddFiles + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_REMOVE_EQU + Remove + + 0 + + + 0 + + 1 + m_buttonRemoveEqu + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Unload the selected library + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRemoveFiles + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_EQU_UP + Move Up + + 0 + + + 0 + + 1 + m_buttonMoveUp + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnButtonMoveUp + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_EQU_DOWN + Move Down + + 0 + + + 0 + + 1 + m_buttonMoveDown + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnButtonMoveDown + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Edit Equ File + + 0 + + + 0 + + 1 + m_buttonEdit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnEditEquFile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizerLower + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizerEnvVar + 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 + Available environment variables for relative paths: + + 0 + + + 0 + + 1 + m_staticText2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + 1 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 25 + "Name" "Value" + wxALIGN_CENTRE + 2 + + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 1 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_gridEnvVars + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 30 + + wxALIGN_CENTRE + + 2 + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Absolute path" "Relative path" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Path option: + 1 + + 0 + + + 0 + + 1 + m_rbPathOptionChoice + 1 + + + protected + 1 + + Resizable + 1 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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_staticline2 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + OnCancelClick + + + + OnOkClick + + + + + + + + diff --git a/cvpcb/dialogs/dialog_config_equfiles_base.h b/cvpcb/dialogs/dialog_config_equfiles_base.h new file mode 100644 index 0000000..2220da5 --- /dev/null +++ b/cvpcb/dialogs/dialog_config_equfiles_base.h @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_CONFIG_EQUFILES_BASE_H__ +#define __DIALOG_CONFIG_EQUFILES_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_CONFIG_EQUFILES_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_CONFIG_EQUFILES_BASE : public DIALOG_SHIM +{ + private: + + protected: + enum + { + ID_ADD_EQU = 1000, + ID_REMOVE_EQU, + ID_EQU_UP, + ID_EQU_DOWN + }; + + wxListBox* m_ListEquiv; + wxButton* m_buttonAddEqu; + wxButton* m_buttonRemoveEqu; + wxButton* m_buttonMoveUp; + wxButton* m_buttonMoveDown; + wxButton* m_buttonEdit; + wxStaticText* m_staticText2; + wxGrid* m_gridEnvVars; + wxRadioBox* m_rbPathOptionChoice; + wxStaticLine* m_staticline2; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); } + virtual void OnAddFiles( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveFiles( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonMoveUp( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonMoveDown( wxCommandEvent& event ) { event.Skip(); } + virtual void OnEditEquFile( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_CONFIG_EQUFILES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 454,338 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_CONFIG_EQUFILES_BASE(); + +}; + +#endif //__DIALOG_CONFIG_EQUFILES_BASE_H__ diff --git a/cvpcb/dialogs/dialog_cvpcb_config_fbp.h b/cvpcb/dialogs/dialog_cvpcb_config_fbp.h new file mode 100644 index 0000000..7481dcd --- /dev/null +++ b/cvpcb/dialogs/dialog_cvpcb_config_fbp.h @@ -0,0 +1,100 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 10 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_CVPCB_CONFIG_FBP_H__ +#define __DIALOG_CVPCB_CONFIG_FBP_H__ + +#include +#include +#include +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_CVPCB_CONFIG_FBP +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_CVPCB_CONFIG_FBP : public DIALOG_SHIM +{ + private: + + protected: + enum + { + ID_ADD_LIB = 1000, + ID_INSERT_LIB, + ID_REMOVE_LIB, + ID_LIB_UP, + ID_LIB_DOWN, + ID_ADD_EQU, + ID_INSERT_EQU, + ID_REMOVE_EQU, + ID_EQU_UP, + ID_EQU_DOWN, + ID_BROWSE_MOD_DOC, + ID_LIB_PATH_SEL, + ID_INSERT_PATH, + ID_REMOVE_PATH + }; + + wxListBox* m_ListLibr; + wxButton* m_buttonAddLib; + wxButton* m_buttonInsLib; + wxButton* m_buttonRemoveLib; + wxButton* m_buttonLibUp; + wxButton* m_buttonLibDown; + wxListBox* m_ListEquiv; + wxButton* m_buttonAddEqu; + wxButton* m_buttonInsEqu; + wxButton* m_buttonRemoveEqu; + wxButton* m_buttonEquUp; + wxButton* m_buttonEquDown; + wxTextCtrl* m_TextHelpModulesFileName; + wxButton* m_buttonModDoc; + wxListBox* m_listUserPaths; + wxButton* m_buttonAddPath; + wxButton* m_buttonInsPath; + wxButton* m_buttonRemovePath; + wxListBox* m_DefaultLibraryPathslistBox; + wxStaticLine* m_staticline2; + wxStdDialogButtonSizer* m_sdbSizer2; + wxButton* m_sdbSizer2OK; + wxButton* m_sdbSizer2Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); } + virtual void OnAddOrInsertLibClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveLibClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonUpClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonDownClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnBrowseModDocFile( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAddOrInsertPath( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveUserPath( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_CVPCB_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 570,625 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_CVPCB_CONFIG_FBP(); + +}; + +#endif //__DIALOG_CVPCB_CONFIG_FBP_H__ diff --git a/cvpcb/dialogs/dialog_display_options.cpp b/cvpcb/dialogs/dialog_display_options.cpp new file mode 100644 index 0000000..9911ebc --- /dev/null +++ b/cvpcb/dialogs/dialog_display_options.cpp @@ -0,0 +1,136 @@ +/** + * @file cvpcb/dialogs/dialog_display_options.cpp + */ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 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 + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include + + +void DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay( wxCommandEvent& event ) +{ + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS* OptionWindow = + new DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( this ); + + OptionWindow->ShowModal(); + OptionWindow->Destroy(); +} + + +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( PCB_BASE_FRAME* parent ) + : DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( parent ) +{ + m_Parent = parent; + + initDialog(); + m_sdbSizer1OK->SetDefault(); + GetSizer()->SetSizeHints( this ); + Centre(); +} + +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( ) +{ +} + + +/*! + * Control creation for DIALOG_FOOTPRINTS_DISPLAY_OPTIONS + */ + +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog() +{ + /* mandatory to use escape key as cancel under wxGTK. */ + SetFocus(); + + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); + + m_EdgesDisplayOption->SetValue( not displ_opts->m_DisplayModEdgeFill ); + m_TextDisplayOption->SetValue( not displ_opts->m_DisplayModTextFill ); + m_ShowPadSketch->SetValue( not displ_opts->m_DisplayPadFill ); + m_ShowPadNum->SetValue( displ_opts->m_DisplayPadNum ); + m_IsZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() ); + m_IsMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() ); + m_IsMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() ); + m_IsMiddleButtonPanLimited->Enable( m_IsMiddleButtonPan->GetValue() ); +} + + + +/*! + * Update settings related to edges, text strings, and pads + */ + +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void ) +{ + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); + + displ_opts->m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue(); + displ_opts->m_DisplayModTextFill = not m_TextDisplayOption->GetValue(); + displ_opts->m_DisplayPadNum = m_ShowPadNum->GetValue(); + displ_opts->m_DisplayPadFill = not m_ShowPadSketch->GetValue(); + m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_IsZoomNoCenter->GetValue() ); + m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_IsMiddleButtonPan->GetValue() ); + m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_IsMiddleButtonPanLimited->GetValue() ); + m_Parent->GetCanvas()->Refresh(); +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK + */ + +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnOkClick( wxCommandEvent& event ) +{ + UpdateObjectSettings(); + EndModal( 1 ); +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL + */ + +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnCancelClick( wxCommandEvent& event ) +{ + EndModal( -1 ); +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY + */ + +void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::OnApplyClick( wxCommandEvent& event ) +{ + UpdateObjectSettings(); +} diff --git a/cvpcb/dialogs/dialog_display_options.h b/cvpcb/dialogs/dialog_display_options.h new file mode 100644 index 0000000..fada3f0 --- /dev/null +++ b/cvpcb/dialogs/dialog_display_options.h @@ -0,0 +1,61 @@ +/** + * @file cvpcb/dialogs/dialog_display_options.h + */ + +#ifndef _DIALOG_DISPLAY_OPTIONS_H_ +#define _DIALOG_DISPLAY_OPTIONS_H_ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 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 + */ + +#include + +/* Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS + * derived from DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE, + * created by wxformBuilder +*/ + +class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS : + public DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE +{ +private: +PCB_BASE_FRAME * m_Parent; + +public: + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS( PCB_BASE_FRAME* parent ); + ~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS(); + + +private: + void initDialog( ); + void UpdateObjectSettings( void ); + void OnApplyClick( wxCommandEvent& event ); + void OnCancelClick( wxCommandEvent& event ); + void OnOkClick( wxCommandEvent& event ); + void OnMiddleBtnPanEnbl( wxCommandEvent& event ) + { + m_IsMiddleButtonPanLimited->Enable( m_IsMiddleButtonPan->GetValue() ); + } +}; + +#endif // _DIALOG_DISPLAY_OPTIONS_H_ diff --git a/cvpcb/dialogs/dialog_display_options_base.cpp b/cvpcb/dialogs/dialog_display_options_base.cpp new file mode 100644 index 0000000..99be007 --- /dev/null +++ b/cvpcb/dialogs/dialog_display_options_base.cpp @@ -0,0 +1,93 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_display_options_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_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* bUpperSizer; + bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* sbSizerDrawMode; + sbSizerDrawMode = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Draw options") ), wxVERTICAL ); + + m_EdgesDisplayOption = new wxCheckBox( this, wxID_ANY, _("Graphic items sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_EdgesDisplayOption, 0, wxALL, 5 ); + + m_TextDisplayOption = new wxCheckBox( this, wxID_ANY, _("Texts sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_TextDisplayOption, 0, wxALL, 5 ); + + m_ShowPadSketch = new wxCheckBox( this, ID_PADFILL_OPT, _("Pad sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_ShowPadSketch, 0, wxEXPAND|wxALL, 5 ); + + m_ShowPadNum = new wxCheckBox( this, wxID_ANY, _("Show pad &number"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_ShowPadNum, 0, wxALL|wxEXPAND, 5 ); + + + bUpperSizer->Add( sbSizerDrawMode, 1, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizerViewOpt; + sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL ); + + m_IsZoomNoCenter = new wxCheckBox( this, wxID_ANY, _("Do not center and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); + m_IsZoomNoCenter->SetToolTip( _("Keep the cursor at its current location when zooming") ); + + sbSizerViewOpt->Add( m_IsZoomNoCenter, 0, wxEXPAND|wxALL, 5 ); + + m_IsMiddleButtonPan = new wxCheckBox( this, wxID_ANY, _("Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerViewOpt->Add( m_IsMiddleButtonPan, 0, wxEXPAND|wxALL, 5 ); + + m_IsMiddleButtonPanLimited = new wxCheckBox( this, wxID_ANY, _("Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerViewOpt->Add( m_IsMiddleButtonPanLimited, 0, wxALL|wxEXPAND, 5 ); + + + bUpperSizer->Add( sbSizerViewOpt, 1, wxALL|wxEXPAND, 5 ); + + + bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Apply = new wxButton( this, wxID_APPLY ); + m_sdbSizer1->AddButton( m_sdbSizer1Apply ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + + bSizerMain->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + + // Connect Events + m_IsMiddleButtonPan->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnMiddleBtnPanEnbl ), NULL, this ); + m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); + m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); +} + +DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE() +{ + // Disconnect Events + m_IsMiddleButtonPan->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnMiddleBtnPanEnbl ), NULL, this ); + m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); + m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); + +} diff --git a/cvpcb/dialogs/dialog_display_options_base.fbp b/cvpcb/dialogs/dialog_display_options_base.fbp new file mode 100644 index 0000000..1a7fb17 --- /dev/null +++ b/cvpcb/dialogs/dialog_display_options_base.fbp @@ -0,0 +1,861 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_display_options_base + 1000 + none + 1 + dialog_display_options_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE + + 425,206 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Display Options + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bUpperSizer + wxHORIZONTAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Draw options + + sbSizerDrawMode + wxVERTICAL + none + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Graphic items sketch mode + + 0 + + + 0 + + 1 + m_EdgesDisplayOption + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Texts sketch mode + + 0 + + + 0 + + 1 + m_TextDisplayOption + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_PADFILL_OPT + Pad sketch mode + + 0 + + + 0 + + 1 + m_ShowPadSketch + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show pad &number + + 0 + + + 0 + + 1 + m_ShowPadNum + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + wxID_ANY + Pan and Zoom + + sbSizerViewOpt + wxVERTICAL + none + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Do not center and warp cursor on zoom + + 0 + + + 0 + + 1 + m_IsZoomNoCenter + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Keep the cursor at its current location when zooming + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Use middle mouse button to pan + + 0 + + + 0 + + 1 + m_IsMiddleButtonPan + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnMiddleBtnPanEnbl + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Limit panning to scroll size + + 0 + + + 0 + + 1 + m_IsMiddleButtonPanLimited + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + wxEXPAND|wxALL + 0 + + 1 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + OnApplyClick + OnCancelClick + + + + OnOkClick + + + + + + + + diff --git a/cvpcb/dialogs/dialog_display_options_base.h b/cvpcb/dialogs/dialog_display_options_base.h new file mode 100644 index 0000000..febdd1f --- /dev/null +++ b/cvpcb/dialogs/dialog_display_options_base.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_DISPLAY_OPTIONS_BASE_H__ +#define __DIALOG_DISPLAY_OPTIONS_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_PADFILL_OPT 1000 + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxCheckBox* m_EdgesDisplayOption; + wxCheckBox* m_TextDisplayOption; + wxCheckBox* m_ShowPadSketch; + wxCheckBox* m_ShowPadNum; + wxCheckBox* m_IsZoomNoCenter; + wxCheckBox* m_IsMiddleButtonPan; + wxCheckBox* m_IsMiddleButtonPanLimited; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Apply; + wxButton* m_sdbSizer1Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); } + virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 425,206 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(); + +}; + +#endif //__DIALOG_DISPLAY_OPTIONS_BASE_H__ diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector.cpp b/cvpcb/dialogs/fp_conflict_assignment_selector.cpp new file mode 100644 index 0000000..35dcd8f --- /dev/null +++ b/cvpcb/dialogs/fp_conflict_assignment_selector.cpp @@ -0,0 +1,190 @@ +/** + * @file fp_conflict_assignment_selector.cpp + */ + +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2010-2014 Jean-Pierre Charras + * 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 + + +DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR( wxWindow* aParent ) + : DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE( aParent ) +{ + m_listFp->AppendColumn( _( "Ref" ) ); + m_listFp->AppendColumn( _( "Schematic assignment" ) ); + m_listFp->AppendColumn( wxT( "<=" ) ); + m_listFp->AppendColumn( wxT( "=>" ) ); + m_listFp->AppendColumn( _( "Cmp file assignment" ) ); + + m_lineCount = 0; +} + +void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::Add( const wxString& aRef, const wxString& aFpSchName, + const wxString& aFpCmpName ) +{ + long idx = m_listFp->InsertItem(m_lineCount, aRef ); + + m_listFp->SetItem(idx, COL_FPSCH, aFpSchName ); + m_listFp->SetItem(idx, COL_SELSCH, wxT("") ); + m_listFp->SetItem(idx, COL_SELCMP, wxT("X") ); + m_listFp->SetItem(idx, COL_FPCMP, aFpCmpName ); + + m_lineCount ++; +} + +int DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::GetSelection( const wxString& aReference ) +{ + // Find Reference + for( int ii = 0; ii < m_listFp->GetItemCount(); ii++ ) + { + if( m_listFp->GetItemText( ii, COL_REF ) == aReference ) + { + if( m_listFp->GetItemText( ii, COL_SELSCH ) != wxT("X") ) + return 1; + + return 0; + } + } + + return -1; +} + +void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnColumnClick( wxListEvent& event ) +{ + // When clicking on the column title: + // when it is the COL_SELCMP column, set all item choices to cmp file assigment. + // when it is the COL_SELSCH column, set all item choices to schematic assigment. + + wxListItem item = event.GetItem(); + + int column = event.GetColumn(); + int colclr, colset; + + switch( column ) + { + case COL_SELSCH: + colclr = COL_SELCMP; + colset = COL_SELSCH; + break; + + case COL_SELCMP: + colclr = COL_SELSCH; + colset = COL_SELCMP; + break; + + default: + return; + } + + for( int i = 0; i < m_listFp->GetItemCount(); i++ ) + { + m_listFp->SetItem( i, colclr, wxT("") ); + m_listFp->SetItem( i, colset, wxT("X") ); + } +} + +void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnItemClicked( wxMouseEvent& event ) +{ + wxPoint pos = event.GetPosition(); + int flgs = wxLIST_HITTEST_ONITEMLABEL; + long idx = m_listFp->HitTest( pos, flgs ); + + // Try to find the column clicked (must be COL_SELCMP or COL_SELSCH) + int colclr = -1, colset; + int minpx = m_listFp->GetColumnWidth( 0 ) + m_listFp->GetColumnWidth( 1 ); + int maxpx = minpx + m_listFp->GetColumnWidth( 2 ); + + if( pos.x > minpx && pos.x < maxpx ) + { + colclr = COL_SELCMP; + colset = COL_SELSCH; + } + + else + { + minpx = maxpx; + int maxpx = minpx + m_listFp->GetColumnWidth( 3 ); + + if( pos.x > minpx && pos.x < maxpx ) + { + colclr = COL_SELSCH; + colset = COL_SELCMP; + } + } + + if( colclr < 0 ) + return; + + // Move selection to schematic or cmp file choice + // according to the column position (COL_SELCMP or COL_SELSCH) + m_listFp->SetItem( idx, colclr, wxT("") ); + m_listFp->SetItem( idx, colset, wxT("X") ); + + event.Skip(); +} + + +void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnSize( wxSizeEvent& aEvent ) +{ + recalculateColumns(); + aEvent.Skip(); +} + + +void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::recalculateColumns() +{ + const int margin = 16; + int totalLength = 0; + int sel_length = GetTextSize( wxT("XX"), m_listFp ).x; + int maxRefLength = GetTextSize( wxT("XXX"), m_listFp ).x; + + sel_length += margin; + m_listFp->SetColumnWidth( COL_SELSCH, sel_length ); + m_listFp->SetColumnWidth( COL_SELCMP, sel_length ); + + // Find max character width of column Reference + for( int i = 0; i < m_listFp->GetItemCount(); i++ ) + { + int length = GetTextSize( m_listFp->GetItemText( i, COL_REF ), m_listFp ).x; + + if( length > maxRefLength ) + maxRefLength = length; + } + + + // Use the lengths of column texts to create a scale of the max list width + // to set the column widths + maxRefLength += margin; + totalLength = maxRefLength + sel_length + sel_length; + + int cwidth = (GetClientSize().x - totalLength) / 2; + + m_listFp->SetColumnWidth( COL_REF, maxRefLength ); + m_listFp->SetColumnWidth( COL_FPSCH, cwidth - 2 ); + m_listFp->SetColumnWidth( COL_FPCMP, cwidth ); +} + diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector.h b/cvpcb/dialogs/fp_conflict_assignment_selector.h new file mode 100644 index 0000000..9beeb3f --- /dev/null +++ b/cvpcb/dialogs/fp_conflict_assignment_selector.h @@ -0,0 +1,79 @@ +/** + * @file fp_conflict_assignment_selector.h + */ + +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 2010-2014 Jean-Pierre Charras + * 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 + + +class DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR : public DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE +{ + private: + enum COL_ID + { + COL_REF, COL_FPSCH, COL_SELSCH, COL_SELCMP, COL_FPCMP, + COL_COUNT + }; + + int m_lineCount; + + public: + + DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR( wxWindow* parent ); + + /** + * Add a line to the selection list. + * @param aRef = component reference text + * @param aFpSchName = fpid text from the netlist + * @param aFpCmpName = fpid text from the .cmp file + */ + void Add( const wxString& aRef, const wxString& aFpSchName, + const wxString& aFpCmpName ); + + /** + * @return the selection option: + * 0 for fpid text from the netlist + * 1 for fpid text from the cmp file + * -1 on error + * @param aReference = the compoent schematic reference + */ + int GetSelection( const wxString& aReference ); + + private: + void OnSize( wxSizeEvent& event ); + + // Virtual: called when clicking on the column title: + // when it is a column choice, set all item choices. + void OnColumnClick( wxListEvent& event ); + + void OnItemClicked( wxMouseEvent& event ); + + void OnCancelClick( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); } + void OnOKClick( wxCommandEvent& event ) { EndModal( wxID_OK ); } + + void recalculateColumns(); + +}; diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector_base.cpp b/cvpcb/dialogs/fp_conflict_assignment_selector_base.cpp new file mode 100644 index 0000000..8f0d9f7 --- /dev/null +++ b/cvpcb/dialogs/fp_conflict_assignment_selector_base.cpp @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "fp_conflict_assignment_selector_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_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 ); + + m_staticTextInfo = new wxStaticText( this, wxID_ANY, wxT("Footprint assignments from schematic netlist and from .cmp file are conflicting\nPlease choose the assignment."), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE ); + m_staticTextInfo->Wrap( -1 ); + bSizerMain->Add( m_staticTextInfo, 0, wxALL|wxEXPAND, 5 ); + + m_listFp = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES ); + bSizerMain->Add( m_listFp, 1, wxALL|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(); + + bSizerMain->Add( m_sdbSizer, 0, wxALIGN_RIGHT, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnSize ) ); + m_listFp->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnItemClicked ), NULL, this ); + m_listFp->Connect( wxEVT_COMMAND_LIST_COL_CLICK, wxListEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnColumnClick ), NULL, this ); + m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnOKClick ), NULL, this ); +} + +DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::~DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnSize ) ); + m_listFp->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnItemClicked ), NULL, this ); + m_listFp->Disconnect( wxEVT_COMMAND_LIST_COL_CLICK, wxListEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnColumnClick ), NULL, this ); + m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnOKClick ), NULL, this ); + +} diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector_base.fbp b/cvpcb/dialogs/fp_conflict_assignment_selector_base.fbp new file mode 100644 index 0000000..fb57694 --- /dev/null +++ b/cvpcb/dialogs/fp_conflict_assignment_selector_base.fbp @@ -0,0 +1,313 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + fp_conflict_assignment_selector_base + 1000 + none + 0 + fp_conflict_assignment_selector + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE + + 478,294 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Footprint Assignment Conflicts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnSize + + + + bSizerMain + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Footprint assignments from schematic netlist and from .cmp file are conflicting Please choose the assignment. + + 0 + + + 0 + + 1 + m_staticTextInfo + 1 + + + protected + 1 + + Resizable + 1 + + wxALIGN_CENTRE + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_listFp + 1 + + + protected + 1 + + Resizable + 1 + + wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + OnItemClicked + + + + + + + OnColumnClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + OnCancelClick + + + + OnOKClick + + + + + + + + diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector_base.h b/cvpcb/dialogs/fp_conflict_assignment_selector_base.h new file mode 100644 index 0000000..b56df23 --- /dev/null +++ b/cvpcb/dialogs/fp_conflict_assignment_selector_base.h @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE_H__ +#define __FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE_H__ + +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticText* m_staticTextInfo; + wxListCtrl* m_listFp; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnSize( wxSizeEvent& event ) { event.Skip(); } + virtual void OnItemClicked( wxMouseEvent& event ) { event.Skip(); } + virtual void OnColumnClick( wxListEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Footprint Assignment Conflicts"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 478,294 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE(); + +}; + +#endif //__FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE_H__ -- cgit