Remove a useless file and move the 2 methods to suitable files.

This commit is contained in:
jean-pierre charras 2018-01-31 14:54:31 +01:00
parent be746a8e3d
commit c758e72c1d
7 changed files with 106 additions and 153 deletions

View File

@ -223,7 +223,6 @@ set( PCBNEW_CLASS_SRCS
edit_pcb_text.cpp
edit_track_width.cpp
editedge.cpp
editmod.cpp
editrack-part2.cpp
editrack.cpp
edtxtmod.cpp

View File

@ -876,7 +876,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
break;
InstallModuleOptionsFrame( (MODULE*) GetCurItem(), &dc );
InstallFootprintPropertiesDialog( (MODULE*) GetCurItem(), &dc );
m_canvas->MoveCursorToCrossHair();
break;

View File

@ -1,149 +0,0 @@
/*
* 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
*/
/**
* @file edit.cpp
* @brief Module editor dialog box for editing module properties and characteristics.
*/
#include <fctsys.h>
#include <kiface_i.h>
#include <kiway.h>
#include <confirm.h>
#include <class_drawpanel.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <footprint_edit_frame.h>
#include <3d_viewer/eda_3d_viewer.h>
#include <class_module.h>
#include <class_pad.h>
#include <class_edge_mod.h>
#include <dialog_edit_module_for_BoardEditor.h>
/*
* Show module property dialog.
*/
void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
{
if( Module == NULL )
return;
#ifdef __WXMAC__
// avoid Avoid "writes" in the dialog, creates errors with WxOverlay and NSView & Modal
// Raising an Exception - Fixes #764678
DC = NULL;
#endif
DIALOG_MODULE_BOARD_EDITOR* dlg = new DIALOG_MODULE_BOARD_EDITOR( this, Module, DC );
int retvalue = dlg->ShowModal();
/* retvalue =
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_ABORT if abort,
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_EXCHANGE_FP if exchange module,
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_EDIT_OK for normal edition
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_MODEDIT for a goto editor command
*/
dlg->Close();
dlg->Destroy();
#ifdef __WXMAC__
// If something edited, push a refresh request
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_EDIT_OK )
m_canvas->Refresh();
#endif
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_MODEDIT )
{
FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
editor->Load_Module_From_BOARD( Module );
SetCurItem( NULL );
editor->Show( true );
editor->Raise(); // Iconize( false );
}
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_UPDATE_FP )
{
InstallExchangeModuleFrame( Module, true );
}
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_EXCHANGE_FP )
{
InstallExchangeModuleFrame( Module, false );
}
}
void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
{
if( Item == NULL )
return;
switch( Item->Type() )
{
case PCB_PAD_T:
DeletePad( (D_PAD*) Item, false );
break;
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( Item );
switch( text->GetType() )
{
case TEXTE_MODULE::TEXT_is_REFERENCE:
DisplayError( this, _( "Cannot delete REFERENCE!" ) );
break;
case TEXTE_MODULE::TEXT_is_VALUE:
DisplayError( this, _( "Cannot delete VALUE!" ) );
break;
case TEXTE_MODULE::TEXT_is_DIVERS:
DeleteTextModule( text );
}
}
break;
case PCB_MODULE_EDGE_T:
Delete_Edge_Module( (EDGE_MODULE*) Item );
m_canvas->Refresh();
break;
case PCB_MODULE_T:
break;
default:
{
wxString Line;
Line.Printf( wxT( " RemoveStruct: item type %d unknown." ), Item->Type() );
wxMessageBox( Line );
}
break;
}
}

View File

@ -988,6 +988,55 @@ void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent )
}
void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
{
if( Item == NULL )
return;
switch( Item->Type() )
{
case PCB_PAD_T:
DeletePad( (D_PAD*) Item, false );
break;
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( Item );
switch( text->GetType() )
{
case TEXTE_MODULE::TEXT_is_REFERENCE:
DisplayError( this, _( "Cannot delete REFERENCE!" ) );
break;
case TEXTE_MODULE::TEXT_is_VALUE:
DisplayError( this, _( "Cannot delete VALUE!" ) );
break;
case TEXTE_MODULE::TEXT_is_DIVERS:
DeleteTextModule( text );
}
}
break;
case PCB_MODULE_EDGE_T:
Delete_Edge_Module( (EDGE_MODULE*) Item );
m_canvas->Refresh();
break;
case PCB_MODULE_T:
break;
default:
{
wxString Line;
Line.Printf( wxT( " RemoveStruct: item type %d unknown." ), Item->Type() );
wxMessageBox( Line );
}
break;
}
}
COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor()
{
return Settings().Colors().GetItemColor( LAYER_GRID );

View File

@ -586,7 +586,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
break;
case PCB_MODULE_T:
InstallModuleOptionsFrame( static_cast<MODULE*>( aItem ), aDC );
InstallFootprintPropertiesDialog( static_cast<MODULE*>( aItem ), aDC );
break;
case PCB_TARGET_T:

View File

@ -51,6 +51,7 @@
#include <dialog_helpers.h>
#include <dialog_plot.h>
#include <dialog_exchange_modules.h>
#include <dialog_edit_module_for_BoardEditor.h>
#include <convert_to_biu.h>
#include <view/view.h>
#include <view/view_controls.h>
@ -1280,6 +1281,59 @@ void PCB_EDIT_FRAME::PythonPluginsReload()
}
void PCB_EDIT_FRAME::InstallFootprintPropertiesDialog( MODULE* Module, wxDC* DC )
{
if( Module == NULL )
return;
#ifdef __WXMAC__
// avoid Avoid "writes" in the dialog, creates errors with WxOverlay and NSView & Modal
// Raising an Exception - Fixes #764678
DC = NULL;
#endif
DIALOG_MODULE_BOARD_EDITOR* dlg = new DIALOG_MODULE_BOARD_EDITOR( this, Module, DC );
int retvalue = dlg->ShowModal();
/* retvalue =
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_ABORT if abort,
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_EXCHANGE_FP if exchange module,
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_EDIT_OK for normal edition
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_MODEDIT for a goto editor command
*/
dlg->Close();
dlg->Destroy();
#ifdef __WXMAC__
// If something edited, push a refresh request
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_EDIT_OK )
m_canvas->Refresh();
#endif
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_MODEDIT )
{
FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
editor->Load_Module_From_BOARD( Module );
SetCurItem( NULL );
editor->Show( true );
editor->Raise(); // Iconize( false );
}
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_UPDATE_FP )
{
InstallExchangeModuleFrame( Module, true );
}
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_EXCHANGE_FP )
{
InstallExchangeModuleFrame( Module, false );
}
}
int PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* Module, bool updateMode )
{
DIALOG_EXCHANGE_MODULE dialog( this, Module, updateMode );

View File

@ -1092,7 +1092,7 @@ public:
void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC );
// Footprint edition (see also PCB_BASE_FRAME)
void InstallModuleOptionsFrame( MODULE* Module, wxDC* DC );
void InstallFootprintPropertiesDialog( MODULE* Module, wxDC* DC );
/**
* Function StartMoveModule