Commit 5eb7b41f authored by jean-pierre charras's avatar jean-pierre charras

Dialogs edit footprint in module editor and edit footprint in board editor:...

Dialogs edit footprint in module editor and edit footprint in board editor: add button to edit the selected 3D shape filename.
Dialog edit component in library editor: add button to edit the selected footprint filter.
parent b1cd42cf
......@@ -107,6 +107,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg()
{
m_ButtonDeleteAllFootprintFilter->Enable( false );
m_ButtonDeleteOneFootprintFilter->Enable( false );
m_buttonEditOneFootprintFilter->Enable( false );
}
m_NoteBook->SetSelection( m_lastOpenedPage );
......@@ -486,6 +487,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent&
m_FootprintFilterListBox->Clear();
m_ButtonDeleteAllFootprintFilter->Enable( false );
m_ButtonDeleteOneFootprintFilter->Enable( false );
m_buttonEditOneFootprintFilter->Enable( false );
}
}
......@@ -526,6 +528,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& event
m_FootprintFilterListBox->Append( Line );
m_ButtonDeleteAllFootprintFilter->Enable( true );
m_ButtonDeleteOneFootprintFilter->Enable( true );
m_buttonEditOneFootprintFilter->Enable( true );
}
......@@ -540,5 +543,28 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter( wxCommandEvent&
{
m_ButtonDeleteAllFootprintFilter->Enable( false );
m_ButtonDeleteOneFootprintFilter->Enable( false );
m_buttonEditOneFootprintFilter->Enable( false );
}
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::EditOneFootprintFilter( wxCommandEvent& event )
{
int idx = m_FootprintFilterListBox->GetSelection();
if( idx < 0 )
return;
wxString filter = m_FootprintFilterListBox->GetStringSelection();
wxTextEntryDialog dlg( this, wxEmptyString, _( "Edit footprint filter" ), filter );
if( dlg.ShowModal() != wxID_OK )
return; // Aborted by user
filter = dlg.GetValue();
if( filter.IsEmpty() )
return; // do not accept blank filter.
m_FootprintFilterListBox->SetString( idx, filter );
}
......@@ -63,7 +63,7 @@ private:
void DeleteAllFootprintFilter(wxCommandEvent& event);
void DeleteOneFootprintFilter(wxCommandEvent& event);
void AddFootprintFilter(wxCommandEvent& event);
void EditOneFootprintFilter( wxCommandEvent& event );
};
#endif
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -225,6 +225,9 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_buttonAddFpF = new wxButton( m_PanelFootprintFilter, ID_ADD_FOOTPRINT_FILTER, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bFpFilterRightBoxSizer->Add( m_buttonAddFpF, 0, wxALL|wxEXPAND, 5 );
m_buttonEditOneFootprintFilter = new wxButton( m_PanelFootprintFilter, wxID_ANY, _("Edit"), wxDefaultPosition, wxDefaultSize, 0 );
bFpFilterRightBoxSizer->Add( m_buttonEditOneFootprintFilter, 0, wxALL|wxEXPAND, 5 );
m_ButtonDeleteOneFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ONE_FOOTPRINT_FILTER, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
bFpFilterRightBoxSizer->Add( m_ButtonDeleteOneFootprintFilter, 0, wxALL|wxEXPAND, 5 );
......@@ -266,6 +269,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_ButtonDeleteOneAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this );
m_ButtonDeleteAllAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this );
m_buttonAddFpF->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this );
m_buttonEditOneFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::EditOneFootprintFilter ), NULL, this );
m_ButtonDeleteOneFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this );
m_ButtonDeleteAllFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this );
m_stdSizerButtonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this );
......@@ -281,6 +285,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE()
m_ButtonDeleteOneAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this );
m_ButtonDeleteAllAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this );
m_buttonAddFpF->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this );
m_buttonEditOneFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::EditOneFootprintFilter ), NULL, this );
m_ButtonDeleteOneFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this );
m_ButtonDeleteAllFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this );
m_stdSizerButtonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -88,6 +88,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM
wxStaticText* m_staticTextFootprints;
wxListBox* m_FootprintFilterListBox;
wxButton* m_buttonAddFpF;
wxButton* m_buttonEditOneFootprintFilter;
wxButton* m_ButtonDeleteOneFootprintFilter;
wxButton* m_ButtonDeleteAllFootprintFilter;
wxStdDialogButtonSizer* m_stdSizerButton;
......@@ -101,6 +102,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM
virtual void DeleteAliasOfPart( wxCommandEvent& event ) { event.Skip(); }
virtual void DeleteAllAliasOfPart( wxCommandEvent& event ) { event.Skip(); }
virtual void AddFootprintFilter( wxCommandEvent& event ) { event.Skip(); }
virtual void EditOneFootprintFilter( wxCommandEvent& event ) { event.Skip(); }
virtual void DeleteOneFootprintFilter( wxCommandEvent& event ) { event.Skip(); }
virtual void DeleteAllFootprintFilter( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
......
......@@ -27,6 +27,9 @@
* @brief Custom text control validator definitions.
*/
#ifndef VALIDATORS_H
#define VALIDATORS_H
#include <wx/valtext.h>
/**
......@@ -56,3 +59,5 @@ class FILE_NAME_WITH_PATH_CHAR_VALIDATOR : public wxTextValidator
public:
FILE_NAME_WITH_PATH_CHAR_VALIDATOR( wxString* aValue = NULL );
};
#endif // #ifndef VALIDATORS_H
......@@ -5,9 +5,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras
* Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2015 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
......@@ -43,10 +43,13 @@
#include <class_module.h>
#include <class_text_mod.h>
#include <validators.h>
#include <dialog_edit_module_for_BoardEditor.h>
#include <wildcards_and_files_ext.h>
size_t DIALOG_MODULE_BOARD_EDITOR::m_page = 0; // remember the last open page during session
DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent,
MODULE* aModule,
......@@ -65,14 +68,19 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent
InitModeditProperties();
InitBoardProperties();
m_NoteBook->SetSelection( m_page );
m_sdbSizerStdButtonsOK->SetDefault();
GetSizer()->SetSizeHints( this );
Centre();
}
DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR()
{
m_page = m_NoteBook->GetSelection();
for( unsigned ii = 0; ii < m_Shapes3D_list.size(); ii++ )
delete m_Shapes3D_list[ii];
......@@ -417,6 +425,25 @@ void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape( wxCommandEvent& event )
}
}
void DIALOG_MODULE_BOARD_EDITOR::Edit3DShapeFileName()
{
int idx = m_3D_ShapeNameListBox->GetSelection();
if( idx < 0 )
return;
// Edit filename
wxString filename = m_3D_ShapeNameListBox->GetStringSelection();
wxTextEntryDialog dlg( this, wxEmptyString, wxEmptyString, filename );
dlg.SetTextValidator( FILE_NAME_WITH_PATH_CHAR_VALIDATOR( &filename ) );
if( dlg.ShowModal() != wxID_OK || filename.IsEmpty() )
return; //Aborted by user
m_3D_ShapeNameListBox->SetString( idx, filename );
}
void DIALOG_MODULE_BOARD_EDITOR::BrowseAndAdd3DShapeFile()
{
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2010-2015 Jean-Pierre Charras, jean-pierre.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
......@@ -38,6 +38,7 @@ private:
S3DPOINT_VALUE_CTRL * m_3D_Scale;
S3DPOINT_VALUE_CTRL * m_3D_Offset;
S3DPOINT_VALUE_CTRL * m_3D_Rotation;
static size_t m_page; // remember the last open page during session
public:
......@@ -51,17 +52,22 @@ private:
void InitModeditProperties();
void Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource );
void TransfertDisplayTo3DValues( int aIndexSelection );
void Edit3DShapeFileName();
// virtual event functions
void OnEditValue( wxCommandEvent& event );
void OnEditReference( wxCommandEvent& event );
void On3DShapeSelection( wxCommandEvent& event );
void On3DShapeNameSelected( wxCommandEvent& event );
void Add3DShape( wxCommandEvent& event )
void Edit3DShapeFilename( wxCommandEvent& event )
{
BrowseAndAdd3DShapeFile();
Edit3DShapeFileName();
}
void Remove3DShape( wxCommandEvent& event );
void Add3DShape( wxCommandEvent& event )
{
BrowseAndAdd3DShapeFile();
}
void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void GotoModuleEditor( wxCommandEvent& event );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -356,14 +356,14 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
wxBoxSizer* bSizer3DButtons;
bSizer3DButtons = new wxBoxSizer( wxVERTICAL );
m_buttonBrowse = new wxButton( m_Panel3D, ID_BROWSE_3D_LIB, _("Browse Shapes"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3DButtons->Add( m_buttonBrowse, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonAdd = new wxButton( m_Panel3D, ID_ADD_3D_SHAPE, _("Add 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3DButtons->Add( m_buttonAdd, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
bSizer3DButtons->Add( m_buttonAdd, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_buttonRemove = new wxButton( m_Panel3D, ID_REMOVE_3D_SHAPE, _("Remove 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3DButtons->Add( m_buttonRemove, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
bSizer3DButtons->Add( m_buttonRemove, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_buttonEdit = new wxButton( m_Panel3D, wxID_ANY, _("Edit Filename"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3DButtons->Add( m_buttonEdit, 0, wxALL|wxEXPAND, 5 );
bLowerSizer3D->Add( bSizer3DButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
......@@ -399,9 +399,9 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
m_buttonExchange->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this );
m_buttonModuleEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this );
m_3D_ShapeNameListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::On3DShapeNameSelected ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Browse3DLib ), NULL, this );
m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Add3DShape ), NULL, this );
m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Remove3DShape ), NULL, this );
m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Edit3DShapeFilename ), NULL, this );
m_sdbSizerStdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizerStdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnOkClick ), NULL, this );
}
......@@ -415,9 +415,9 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::~DIALOG_MODULE_BOARD_EDITOR_BASE()
m_buttonExchange->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this );
m_buttonModuleEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this );
m_3D_ShapeNameListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::On3DShapeNameSelected ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Browse3DLib ), NULL, this );
m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Add3DShape ), NULL, this );
m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Remove3DShape ), NULL, this );
m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Edit3DShapeFilename ), NULL, this );
m_sdbSizerStdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizerStdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnOkClick ), NULL, this );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -42,9 +42,8 @@ class DIALOG_SHIM;
#define ID_LISTBOX_ORIENT_SELECT 1001
#define ID_MODULE_PROPERTIES_EXCHANGE 1002
#define ID_GOTO_MODULE_EDITOR 1003
#define ID_BROWSE_3D_LIB 1004
#define ID_ADD_3D_SHAPE 1005
#define ID_REMOVE_3D_SHAPE 1006
#define ID_ADD_3D_SHAPE 1004
#define ID_REMOVE_3D_SHAPE 1005
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_MODULE_BOARD_EDITOR_BASE
......@@ -114,9 +113,9 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public DIALOG_SHIM
wxStaticText* m_staticTextShapeOffset;
wxBoxSizer* m_bSizerShapeRotation;
wxStaticText* m_staticTextShapeRotation;
wxButton* m_buttonBrowse;
wxButton* m_buttonAdd;
wxButton* m_buttonRemove;
wxButton* m_buttonEdit;
wxStdDialogButtonSizer* m_sdbSizerStdButtons;
wxButton* m_sdbSizerStdButtonsOK;
wxButton* m_sdbSizerStdButtonsCancel;
......@@ -128,9 +127,9 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public DIALOG_SHIM
virtual void ExchangeModule( wxCommandEvent& event ) { event.Skip(); }
virtual void GotoModuleEditor( wxCommandEvent& event ) { event.Skip(); }
virtual void On3DShapeNameSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void Browse3DLib( wxCommandEvent& event ) { event.Skip(); }
virtual void Add3DShape( wxCommandEvent& event ) { event.Skip(); }
virtual void Remove3DShape( wxCommandEvent& event ) { event.Skip(); }
virtual void Edit3DShapeFilename( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
......
......@@ -7,10 +7,10 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2008-2014 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2015 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
......@@ -51,6 +51,8 @@
#include <dialog_edit_module_for_Modedit.h>
#include <wildcards_and_files_ext.h>
size_t DIALOG_MODULE_MODULE_EDITOR::m_page = 0; // remember the last open page during session
DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* aParent,
MODULE* aModule ) :
......@@ -66,6 +68,9 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME*
m_FootprintNameCtrl->SetValidator( FILE_NAME_CHAR_VALIDATOR() );
initModeditProperties();
m_NoteBook->SetSelection( m_page );
m_sdbSizerStdButtonsOK->SetDefault();
GetSizer()->SetSizeHints( this );
Centre();
......@@ -74,6 +79,8 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME*
DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR()
{
m_page = m_NoteBook->GetSelection();
for( unsigned ii = 0; ii < m_shapes3D_list.size(); ii++ )
delete m_shapes3D_list[ii];
......@@ -287,6 +294,26 @@ void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event)
}
void DIALOG_MODULE_MODULE_EDITOR::Edit3DShapeFileName()
{
int idx = m_3D_ShapeNameListBox->GetSelection();
if( idx < 0 )
return;
// Edit filename
wxString filename = m_3D_ShapeNameListBox->GetStringSelection();
wxTextEntryDialog dlg( this, wxEmptyString, wxEmptyString, filename );
dlg.SetTextValidator( FILE_NAME_WITH_PATH_CHAR_VALIDATOR( &filename ) );
if( dlg.ShowModal() != wxID_OK || filename.IsEmpty() )
return; //Aborted by user
m_3D_ShapeNameListBox->SetString( idx, filename );
}
void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DShapeFile()
{
PROJECT& prj = Prj();
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2010-2015 Jean-Pierre Charras, jean-pierre.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
......@@ -42,6 +42,7 @@ private:
S3DPOINT_VALUE_CTRL * m_3D_Scale;
S3DPOINT_VALUE_CTRL * m_3D_Offset;
S3DPOINT_VALUE_CTRL * m_3D_Rotation;
static size_t m_page; // remember the last open page during session
public:
......@@ -54,6 +55,7 @@ private:
void initModeditProperties();
void Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource );
void TransfertDisplayTo3DValues( int aIndexSelection );
void Edit3DShapeFileName();
// virtual event functions
void OnEditValue( wxCommandEvent& event );
......@@ -65,6 +67,10 @@ private:
BrowseAndAdd3DShapeFile();
}
void Remove3DShape( wxCommandEvent& event );
void Edit3DShapeFilename( wxCommandEvent& event )
{
Edit3DShapeFileName();
}
void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
};
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -291,10 +291,13 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa
bSizer3DButtons = new wxBoxSizer( wxVERTICAL );
m_buttonBrowse = new wxButton( m_Panel3D, ID_BROWSE_3D_LIB, _("Add 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3DButtons->Add( m_buttonBrowse, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
bSizer3DButtons->Add( m_buttonBrowse, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_buttonRemove = new wxButton( m_Panel3D, ID_REMOVE_3D_SHAPE, _("Remove 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3DButtons->Add( m_buttonRemove, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
bSizer3DButtons->Add( m_buttonRemove, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_buttonEdit = new wxButton( m_Panel3D, wxID_ANY, _("Edit Filename"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer3DButtons->Add( m_buttonEdit, 0, wxALL|wxEXPAND, 5 );
bLowerSizer3D->Add( bSizer3DButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
......@@ -329,6 +332,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa
m_3D_ShapeNameListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::On3DShapeNameSelected ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Add3DShape ), NULL, this );
m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Remove3DShape ), NULL, this );
m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Edit3DShapeFilename ), NULL, this );
m_sdbSizerStdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizerStdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnOkClick ), NULL, this );
}
......@@ -341,6 +345,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::~DIALOG_MODULE_MODULE_EDITOR_BASE()
m_3D_ShapeNameListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::On3DShapeNameSelected ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Add3DShape ), NULL, this );
m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Remove3DShape ), NULL, this );
m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Edit3DShapeFilename ), NULL, this );
m_sdbSizerStdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizerStdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnOkClick ), NULL, this );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -101,6 +101,7 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public DIALOG_SHIM
wxStaticText* m_staticTextShapeRotation;
wxButton* m_buttonBrowse;
wxButton* m_buttonRemove;
wxButton* m_buttonEdit;
wxStdDialogButtonSizer* m_sdbSizerStdButtons;
wxButton* m_sdbSizerStdButtonsOK;
wxButton* m_sdbSizerStdButtonsCancel;
......@@ -111,6 +112,7 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public DIALOG_SHIM
virtual void On3DShapeNameSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void Add3DShape( wxCommandEvent& event ) { event.Skip(); }
virtual void Remove3DShape( wxCommandEvent& event ) { event.Skip(); }
virtual void Edit3DShapeFilename( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment