1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
/*
* 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 <wxPcbStruct.h>
#include <module_editor_frame.h>
#include <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->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_EXCHANGE_FP )
{
InstallExchangeModuleFrame( Module );
// Warning: the current item can be deleted by exchange module
SetCurItem( NULL );
}
}
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;
}
}
|