Added hotkey E to edit items. Minor code cleaning

This commit is contained in:
jean-pierre charras 2010-08-10 20:36:21 +02:00
commit fa863b088d
33 changed files with 395 additions and 301 deletions

View File

@ -1,8 +1,4 @@
/* XPM */
#ifndef XPMMAIN
extern const char *erc_xpm[];
#else
const char *erc_xpm[] = {
"16 16 100 2",
" c None",
@ -121,4 +117,3 @@ const char *erc_xpm[] = {
" . . . . #.$.. . ",
" . . %.&.. ",
" . . "};
#endif

View File

@ -1,8 +1,4 @@
/* XPM */
#ifndef XPMMAIN
extern const char *palette_xpm[];
#else
const char * palette_xpm[] = {
"16 15 14 1",
" c #c0c0c0",
@ -34,5 +30,4 @@ const char * palette_xpm[] = {
" .oXo---Xo. ",
" *#.oXXoXo.. ",
" *# ...... "}
#endif
;

View File

@ -1,8 +1,4 @@
/* XPM */
#ifndef XPMMAIN
extern const char *tools_xpm[];
#else
const char *tools_xpm[] = {
/* columns rows colors const chars-per-pixel */
"16 16 5 1",
@ -27,5 +23,3 @@ const char *tools_xpm[] = {
".+++++++++++++. ",
"............... ",
" "};
#endif

View File

@ -0,0 +1,27 @@
/*
Copyright 2008 Intel Corporation
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
*/
#ifndef GTL_GTL_HPP
#define GTL_GTL_HPP
#ifdef __ICC
#pragma warning (disable:1125)
#endif
#ifdef WIN32
#pragma warning( disable: 4996 )
#pragma warning( disable: 4800 )
#endif
#define BOOST_POLYGON_NO_DEPS
#include "polygon.hpp"
namespace gtl = boost::polygon;
using namespace boost::polygon::operators;
#if __ICC
#pragma warning (default:1125)
#endif
#endif

View File

@ -663,6 +663,14 @@ public:
// Board handling
void RemoveStruct( BOARD_ITEM* Item, wxDC* DC );
/** Function OnEditItemRequest
* Install the corresponding dialog editor for the given item
* @param DC = the current device context
* @param aItem = a pointer to the BOARD_ITEM to edit
*/
void OnEditItemRequest( wxDC* DC, BOARD_ITEM* aItem );
// Highlight functions:
int Select_High_Light( wxDC* DC );
void High_Light( wxDC* DC );
@ -922,8 +930,7 @@ public:
void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC );
void Place_Mire( MIREPCB* MirePcb, wxDC* DC );
void InstallMireOptionsFrame( MIREPCB* MirePcb,
wxDC* DC,
const wxPoint& pos );
wxDC* DC );
// Graphic segments type DRAWSEGMENT handling:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC );
@ -933,8 +940,7 @@ public:
// Dimension handling:
void Install_Edit_Dimension( DIMENSION* Dimension,
wxDC* DC,
const wxPoint& pos );
wxDC* DC );
DIMENSION* Begin_Dimension( DIMENSION* Dimension, wxDC* DC );
void Delete_Dimension( DIMENSION* Dimension, wxDC* DC );
@ -1051,194 +1057,4 @@ public:
};
/*********************************************************/
/* class WinEDA_ModuleEditFrame: public WinEDA_DrawFrame */
/* Class for the footprint editor */
/*********************************************************/
class WinEDA_ModuleEditFrame : public WinEDA_BasePcbFrame
{
public:
MODULE* CurrentModule;
wxString m_CurrentLib;
public:
WinEDA_ModuleEditFrame( wxWindow* father,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_ModuleEditFrame();
void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event );
void CloseModuleEditor( wxCommandEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateAuxiliaryToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars();
void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
/** function LoadModuleFromBoard
* called from the main toolbar
* to load a footprint from board mainly to edit it
*/
void LoadModuleFromBoard( wxCommandEvent& event );
/** Virtual Function OnModify()
* Must be called after a footprint change
* in order to set the "modify" flag of the current screen
* and prepare, if needed the refresh of the 3D frame showing the footprint
* do not forget to call the basic OnModify function to update auxiliary info
*/
virtual void OnModify( );
/** function ToPrinter
* Install the print dialog
*/
void ToPrinter( wxCommandEvent& event );
/** Virtual function PrintPage
* used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMask, bool aPrintMirrorMode,
void * aData = NULL);
// BOARD handling
/** function Clear_Pcb()
* delete all and reinitialize the current board
* @param aQuery = true to prompt user for confirmation, false to
* initialize silently
*/
bool Clear_Pcb( bool aQuery );
/* handlers for block commands */
int ReturnBlockCommand( int key );
virtual void HandleBlockPlace( wxDC* DC );
virtual int HandleBlockEnd( wxDC* DC );
BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 );
/* Undo and redo functions */
public:
/** Function SaveCopyInUndoList.
* Creates a new entry in undo list of commands.
* add a picker to handle aItemToCopy
* @param aItem = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for
* commands like move
*/
virtual void SaveCopyInUndoList( BOARD_ITEM* aItem,
UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint =
wxPoint( 0, 0 ) );
/** Function SaveCopyInUndoList (overloaded).
* Creates a new entry in undo list of commands.
* add a list of pickers to handle a list of items
* @param aItemsList = the list of items modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for
* commands like move
*/
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint =
wxPoint( 0, 0 ) );
private:
void GetComponentFromUndoList( wxCommandEvent& event );
void GetComponentFromRedoList( wxCommandEvent& event );
public:
// Footprint edition
void Place_Ancre( MODULE* module );
void RemoveStruct( EDA_BaseStruct* Item );
void Transform( MODULE* module, int transform );
// importing / exporting Footprint
void Export_Module( MODULE* ptmod, bool createlib );
/**
* Function Import_Module
* Read a file containing only one footprint.
* Used to import (after exporting) a footprint
* Exported files have the standard ext .emp
* This is the same format as .mod files but restricted to only one footprint
* The import function can also read gpcb footprint file, in Newlib format
* (One footprint per file, Newlib files have no special ext.)
* @param DC = Current Device Context (can be NULL)
*/
MODULE* Import_Module( );
/** function Load_Module_From_BOARD
* load in Modedit a footfrint from the main board
* @param Module = the module to load. If NULL, a module reference will we asked to user
* @return true if a module isloaded, false otherwise.
*/
bool Load_Module_From_BOARD( MODULE* Module );
/** Function Select_1_Module_From_BOARD
* Display the list of modules currently existing on the BOARD
* @return a pointer to a module if this module is selected or NULL otherwise
* @param aPcb = the board from modules can be loaded
*/
MODULE* Select_1_Module_From_BOARD( BOARD* aPcb );
// functions to edit footprint edges
/** Function Edit_Edge_Width
* changes the width of module perimeter lines, EDGE_MODULEs.
* param ModuleSegmentWidth (global) = new width
* @param aEdge = edge to edit, or NULL. If aEdge == NULL change
* the width of all footprint's edges
*/
void Edit_Edge_Width( EDGE_MODULE* aEdge );
void Edit_Edge_Layer( EDGE_MODULE* Edge );
void Delete_Edge_Module( EDGE_MODULE* Edge );
EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge );
void End_Edge_Module( EDGE_MODULE* Edge );
/** function Enter_Edge_Width
* Edition of the edge items width
* Ask for a new width.
* Change the width of EDGE_MODULE Edge if aEdge != NULL
* @param aEdge = edge to edit, or NULL
* @output ModuleSegmentWidth (global) = new width
*/
void Enter_Edge_Width( EDGE_MODULE* aEdge );
void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
void Place_EdgeMod( EDGE_MODULE* drawitem );
// handlers for libraries:
void Delete_Module_In_Library( const wxString& libname );
int Create_Librairie( const wxString& LibName );
void Select_Active_Library();
DECLARE_EVENT_TABLE()
};
#endif /* WXPCB_STRUCT_H */

View File

@ -13,6 +13,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "autorout.h"
#include "pcbplot.h"
#include "trigo.h"

View File

@ -13,6 +13,7 @@
#include "3d_struct.h"
#include "3d_viewer.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "dialog_edit_module_for_Modedit.h"
/**************************************************************************************/

View File

@ -8,6 +8,7 @@
#include "common.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "pcbnew_id.h"

View File

@ -12,6 +12,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "pcbplot.h"
#include "dialog_print_for_modedit_base.h"

View File

@ -11,19 +11,19 @@
#include "class_board_design_settings.h"
#include "drawtxt.h"
/* Routines Locales */
/* Loca functions */
static void Exit_EditDimension( WinEDA_DrawPanel* Panel, wxDC* DC );
static void Montre_Position_New_Dimension( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* Variables "locales" : */
static int status_dimension; /* = 0 : pas de dimension en cours
* = 1 : debut place, fin a placer
* = 2 : fin placee, texte a ajuster */
/* Local variables : */
static int status_dimension; /* Used in cimension creation:
* = 0 : initial value: no dimension in progress
* = 1 : First point created
* = 2 : Secont point created, the text must be placed */
/*
* Les routines generent une dimension de la forme
* - cote usuelle:
*
* A dimension has this shape:
* It has 2 reference points, and a text
* | |
* | dist |
* |<---------->|
@ -53,7 +53,7 @@ public:
// Constructor and destructor
DIMENSION_EDITOR_DIALOG( WinEDA_PcbFrame* parent,
DIMENSION* Dimension, wxDC* DC, const wxPoint& pos );
DIMENSION* Dimension, wxDC* DC );
~DIMENSION_EDITOR_DIALOG()
{
}
@ -73,10 +73,9 @@ END_EVENT_TABLE()
DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( WinEDA_PcbFrame* parent,
DIMENSION* Dimension, wxDC* DC,
const wxPoint& framepos ) :
wxDialog( parent, -1, _( "Dimension properties" ), framepos, wxSize( 340, 270 ),
DIALOG_STYLE )
DIMENSION* Dimension, wxDC* DC
) :
wxDialog( parent, -1, _( "Dimension properties" ) )
{
wxButton* Button;
@ -350,14 +349,13 @@ static void Montre_Position_New_Dimension( WinEDA_DrawPanel* panel, wxDC* DC, bo
/***************************************************************/
void WinEDA_PcbFrame::Install_Edit_Dimension( DIMENSION* Dimension,
wxDC* DC, const wxPoint& pos )
void WinEDA_PcbFrame::Install_Edit_Dimension( DIMENSION* Dimension, wxDC* DC )
/***************************************************************/
{
if( Dimension == NULL )
return;
DIMENSION_EDITOR_DIALOG* frame = new DIMENSION_EDITOR_DIALOG( this, Dimension, DC, pos );
DIMENSION_EDITOR_DIALOG* frame = new DIMENSION_EDITOR_DIALOG( this, Dimension, DC );
frame->ShowModal();
frame->Destroy();
}

View File

@ -16,6 +16,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
static void ShowEdgeModule( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );

View File

@ -12,6 +12,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "class_board_design_settings.h"
#include "autorout.h"
#include "protos.h"
@ -807,7 +808,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_EDIT_MIRE:
InstallMireOptionsFrame( (MIREPCB*) GetCurItem(), &dc, pos );
InstallMireOptionsFrame( (MIREPCB*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema();
break;
@ -824,7 +825,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_EDIT_DIMENSION:
Install_Edit_Dimension( (DIMENSION*) GetCurItem(), &dc, pos );
Install_Edit_Dimension( (DIMENSION*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema();
break;

View File

@ -9,6 +9,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "trigo.h"
#include "3d_viewer.h"

View File

@ -6,6 +6,7 @@
#include "common.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "pcbnew_id.h"
#include "class_drawpanel.h"
#include "confirm.h"
@ -72,13 +73,14 @@ static Ki_HotkeyInfo HkSwitchTrackPosture( wxT( "Switch Track Posture" ),
static Ki_HotkeyInfo HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V'
+ GR_KB_CTRL );
static Ki_HotkeyInfo HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
static Ki_HotkeyInfo HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' );
static Ki_HotkeyInfo HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT,
'F' );
static Ki_HotkeyInfo HkRotateFootprint( wxT( "Rotate Footprint" ),
HK_ROTATE_FOOTPRINT, 'R' );
static Ki_HotkeyInfo HkMoveFootprint( wxT( "Move Footprint" ), HK_MOVE_FOOTPRINT,
static Ki_HotkeyInfo HkMoveFootprint( wxT( "Move Footprint" ), HK_MOVE_FOOTPRINT_OR_TRACK,
'M' );
static Ki_HotkeyInfo HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_FOOTPRINT,
static Ki_HotkeyInfo HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_FOOTPRINT_OR_TRACK,
'G' );
static Ki_HotkeyInfo HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ),
HK_GET_AND_MOVE_FOOTPRINT, 'T' );
@ -163,8 +165,8 @@ Ki_HotkeyInfo* s_board_edit_Hotkey_List[] =
&HkEndTrack, &HkMoveFootprint,
&HkFlipFootprint, &HkRotateFootprint, &HkDragFootprint,
&HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile,
&HkLoadfile, &HkFindItem, &HkSwitch2CopperLayer,
&HkSwitch2InnerLayer1,
&HkLoadfile, &HkFindItem, &HkEditBoardItem,
&HkSwitch2CopperLayer, &HkSwitch2InnerLayer1,
&HkSwitch2InnerLayer2, &HkSwitch2InnerLayer3, &HkSwitch2InnerLayer4,
&HkSwitch2InnerLayer5, &HkSwitch2InnerLayer6, &HkSwitch2ComponentLayer,
&HkSwitch2NextCopperLayer, &HkSwitch2PreviousCopperLayer,&HkAddModule,
@ -540,6 +542,17 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
}
break;
case HK_EDIT_ITEM: // Edit board item
if( ItemFree )
{
BOARD_ITEM * item = PcbGeneralLocateAndDisplay();
if ( item == NULL )
break;
//An item is found, and some can be edited:
OnEditItemRequest( DC, item );
}
break;
// Footprint edition:
case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status:
// get any module, locked or not locked and toggle its locked status
@ -556,11 +569,11 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
}
break;
case HK_DRAG_FOOTPRINT: // Start move (and drag) module
case HK_MOVE_FOOTPRINT: // Start move module
case HK_DRAG_FOOTPRINT_OR_TRACK: // Start move (and drag) module or track segment
case HK_MOVE_FOOTPRINT_OR_TRACK: // Start move module or track segment
if( PopupOn )
break;
// Fall through on hot key
case HK_ROTATE_FOOTPRINT: // Rotation
case HK_FLIP_FOOTPRINT: // move to other side
int exit = 0;
@ -575,7 +588,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
|| DrawStruct->Type() == TYPE_VIA) )
switch( HK_Descr->m_Idcommand )
{
case HK_DRAG_FOOTPRINT: // Start move (and drag) module
case HK_DRAG_FOOTPRINT_OR_TRACK: // Start drag track segment
DrawPanel->MouseToCursorSchema();
//Start_DragTrackSegmentAndKeepSlope( (TRACK*) DrawStruct,DC );
@ -584,7 +597,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
break;
// fall through
case HK_MOVE_FOOTPRINT: // Start move module
case HK_MOVE_FOOTPRINT_OR_TRACK: // Start move track segment
DrawPanel->MouseToCursorSchema();
Start_MoveOneNodeOrSegment( (TRACK*) DrawStruct, DC,
ID_POPUP_PCB_MOVE_TRACK_NODE );
@ -646,7 +659,6 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
{
// Send the module via socket to EESCHEMA's search facility.
SendMessageToEESCHEMA( module );
SetCurItem( module );
}
@ -664,11 +676,11 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
Change_Side_Module( module, DC );
break;
case HK_DRAG_FOOTPRINT: // Start move (and drag) module
case HK_DRAG_FOOTPRINT_OR_TRACK: // Start move (and drag) module
g_Drag_Pistes_On = TRUE;
// fall through
case HK_MOVE_FOOTPRINT: // Start move module
case HK_MOVE_FOOTPRINT_OR_TRACK: // Start move module
GetScreen()->m_Curseur = module->m_Pos;
DrawPanel->MouseToCursorSchema();
StartMove_Module( module, DC );

View File

@ -14,8 +14,8 @@ enum hotkey_id_commnand {
HK_DELETE = HK_COMMON_END,
HK_BACK_SPACE,
HK_ROTATE_FOOTPRINT,
HK_MOVE_FOOTPRINT,
HK_DRAG_FOOTPRINT,
HK_MOVE_FOOTPRINT_OR_TRACK,
HK_DRAG_FOOTPRINT_OR_TRACK,
HK_FLIP_FOOTPRINT,
HK_GET_AND_MOVE_FOOTPRINT,
HK_LOCK_UNLOCK_FOOTPRINT,
@ -28,6 +28,7 @@ enum hotkey_id_commnand {
HK_SWITCH_UNITS,
HK_SWITCH_TRACK_DISPLAY_MODE,
HK_FIND_ITEM,
HK_EDIT_ITEM,
HK_SWITCH_LAYER_TO_COPPER,
HK_SWITCH_LAYER_TO_COMPONENT,
HK_SWITCH_LAYER_TO_NEXT,

View File

@ -9,6 +9,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "class_board_design_settings.h"
#include "protos.h"

View File

@ -11,6 +11,7 @@
#include "gestfich.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "protos.h"
/*

View File

@ -15,6 +15,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "protos.h"
class ModList

View File

@ -7,6 +7,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "bitmaps.h"
#include "protos.h"

View File

@ -28,10 +28,10 @@ static MIREPCB s_TargetCopy( NULL ); /* Used to store "old" values of the
*/
/************************************/
/* class WinEDA_MirePropertiesFrame */
/* class TARGET_PROPERTIES_DIALOG_EDITOR */
/************************************/
class WinEDA_MirePropertiesFrame : public wxDialog
class TARGET_PROPERTIES_DIALOG_EDITOR : public wxDialog
{
private:
@ -42,11 +42,10 @@ private:
WinEDA_ValueCtrl* m_MireSizeCtrl;
wxRadioBox* m_MireShape;
public: WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
public: TARGET_PROPERTIES_DIALOG_EDITOR( WinEDA_PcbFrame* parent,
MIREPCB* Mire,
wxDC* DC,
const wxPoint& pos );
~WinEDA_MirePropertiesFrame() { }
wxDC* DC );
~TARGET_PROPERTIES_DIALOG_EDITOR() { }
private:
void OnOkClick( wxCommandEvent& event );
@ -55,29 +54,26 @@ private:
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE( WinEDA_MirePropertiesFrame, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_MirePropertiesFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_MirePropertiesFrame::OnCancelClick )
BEGIN_EVENT_TABLE( TARGET_PROPERTIES_DIALOG_EDITOR, wxDialog )
EVT_BUTTON( wxID_OK, TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick )
EVT_BUTTON( wxID_CANCEL, TARGET_PROPERTIES_DIALOG_EDITOR::OnCancelClick )
END_EVENT_TABLE()
void WinEDA_PcbFrame::InstallMireOptionsFrame( MIREPCB* MirePcb,
wxDC* DC, const wxPoint& pos )
void WinEDA_PcbFrame::InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC )
{
WinEDA_MirePropertiesFrame* frame =
new WinEDA_MirePropertiesFrame( this, MirePcb, DC, pos );
TARGET_PROPERTIES_DIALOG_EDITOR* frame =
new TARGET_PROPERTIES_DIALOG_EDITOR( this, MirePcb, DC );
frame->ShowModal();
frame->Destroy();
}
WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame(
TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(
WinEDA_PcbFrame* parent,
MIREPCB* Mire, wxDC* DC,
const wxPoint& framepos ) :
wxDialog( parent, -1, _( "Target Properties" ), framepos, wxSize( 270, 210 ),
DIALOG_STYLE )
MIREPCB* Mire, wxDC* DC ) :
wxDialog( parent, wxID_ANY, _( "Target Properties" ) )
{
wxString number;
wxButton* Button;
@ -128,7 +124,7 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame(
}
void WinEDA_MirePropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED(
void TARGET_PROPERTIES_DIALOG_EDITOR::OnCancelClick( wxCommandEvent& WXUNUSED(
event ) )
{
EndModal( -1 );
@ -137,7 +133,7 @@ void WinEDA_MirePropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED(
/* Updates the different parameters for the component being edited
*/
void WinEDA_MirePropertiesFrame::OnOkClick( wxCommandEvent& event )
void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event )
{
m_MirePcb->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );

View File

@ -15,6 +15,7 @@
#include "3d_viewer.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "protos.h"
#include "kicad_device_context.h"

View File

@ -10,6 +10,7 @@
#include "3d_viewer.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "dialog_edit_module_for_Modedit.h"
#include "bitmaps.h"

View File

@ -8,6 +8,7 @@
#include "common.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "protos.h"

View File

@ -9,6 +9,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "pcbnew_id.h"

View File

@ -0,0 +1,197 @@
/*********************************************************/
/* class WinEDA_ModuleEditFrame: public WinEDA_DrawFrame */
/* Class for the footprint editor */
/*********************************************************/
#ifndef _MODULE_EDITOR_FRAME_H_
#define _MODULE_EDITOR_FRAME_H_
class WinEDA_ModuleEditFrame : public WinEDA_BasePcbFrame
{
public:
MODULE* CurrentModule;
wxString m_CurrentLib;
public:
WinEDA_ModuleEditFrame( wxWindow* father,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_ModuleEditFrame();
void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event );
void CloseModuleEditor( wxCommandEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateAuxiliaryToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars();
void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
/** function LoadModuleFromBoard
* called from the main toolbar
* to load a footprint from board mainly to edit it
*/
void LoadModuleFromBoard( wxCommandEvent& event );
/** Virtual Function OnModify()
* Must be called after a footprint change
* in order to set the "modify" flag of the current screen
* and prepare, if needed the refresh of the 3D frame showing the footprint
* do not forget to call the basic OnModify function to update auxiliary info
*/
virtual void OnModify( );
/** function ToPrinter
* Install the print dialog
*/
void ToPrinter( wxCommandEvent& event );
/** Virtual function PrintPage
* used to print a page
* Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMask, bool aPrintMirrorMode,
void * aData = NULL);
// BOARD handling
/** function Clear_Pcb()
* delete all and reinitialize the current board
* @param aQuery = true to prompt user for confirmation, false to
* initialize silently
*/
bool Clear_Pcb( bool aQuery );
/* handlers for block commands */
int ReturnBlockCommand( int key );
virtual void HandleBlockPlace( wxDC* DC );
virtual int HandleBlockEnd( wxDC* DC );
BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 );
/* Undo and redo functions */
public:
/** Function SaveCopyInUndoList.
* Creates a new entry in undo list of commands.
* add a picker to handle aItemToCopy
* @param aItem = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for
* commands like move
*/
virtual void SaveCopyInUndoList( BOARD_ITEM* aItem,
UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint =
wxPoint( 0, 0 ) );
/** Function SaveCopyInUndoList (overloaded).
* Creates a new entry in undo list of commands.
* add a list of pickers to handle a list of items
* @param aItemsList = the list of items modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for
* commands like move
*/
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint =
wxPoint( 0, 0 ) );
private:
void GetComponentFromUndoList( wxCommandEvent& event );
void GetComponentFromRedoList( wxCommandEvent& event );
public:
// Footprint edition
void Place_Ancre( MODULE* module );
void RemoveStruct( EDA_BaseStruct* Item );
void Transform( MODULE* module, int transform );
// importing / exporting Footprint
void Export_Module( MODULE* ptmod, bool createlib );
/**
* Function Import_Module
* Read a file containing only one footprint.
* Used to import (after exporting) a footprint
* Exported files have the standard ext .emp
* This is the same format as .mod files but restricted to only one footprint
* The import function can also read gpcb footprint file, in Newlib format
* (One footprint per file, Newlib files have no special ext.)
* @param DC = Current Device Context (can be NULL)
*/
MODULE* Import_Module( );
/** function Load_Module_From_BOARD
* load in Modedit a footfrint from the main board
* @param Module = the module to load. If NULL, a module reference will we asked to user
* @return true if a module isloaded, false otherwise.
*/
bool Load_Module_From_BOARD( MODULE* Module );
/** Function Select_1_Module_From_BOARD
* Display the list of modules currently existing on the BOARD
* @return a pointer to a module if this module is selected or NULL otherwise
* @param aPcb = the board from modules can be loaded
*/
MODULE* Select_1_Module_From_BOARD( BOARD* aPcb );
// functions to edit footprint edges
/** Function Edit_Edge_Width
* changes the width of module perimeter lines, EDGE_MODULEs.
* param ModuleSegmentWidth (global) = new width
* @param aEdge = edge to edit, or NULL. If aEdge == NULL change
* the width of all footprint's edges
*/
void Edit_Edge_Width( EDGE_MODULE* aEdge );
void Edit_Edge_Layer( EDGE_MODULE* Edge );
void Delete_Edge_Module( EDGE_MODULE* Edge );
EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge );
void End_Edge_Module( EDGE_MODULE* Edge );
/** function Enter_Edge_Width
* Edition of the edge items width
* Ask for a new width.
* Change the width of EDGE_MODULE Edge if aEdge != NULL
* @param aEdge = edge to edit, or NULL
* @output ModuleSegmentWidth (global) = new width
*/
void Enter_Edge_Width( EDGE_MODULE* aEdge );
void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
void Place_EdgeMod( EDGE_MODULE* drawitem );
// handlers for libraries:
void Delete_Module_In_Library( const wxString& libname );
int Create_Librairie( const wxString& LibName );
void Select_Active_Library();
DECLARE_EVENT_TABLE()
};
#endif // #define _MODULE_EDITOR_FRAME_H_

View File

@ -9,6 +9,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "bitmaps.h"
#include "protos.h"
#include "pcbnew_id.h"

View File

@ -389,15 +389,11 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
/********************************************************************************/
void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/********************************************************************************/
/* handle the double click on the mouse left button
*/
void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{
BOARD_ITEM* DrawStruct = GetCurItem();
wxPoint pos = GetPosition();
switch( m_ID_current_state )
{
@ -431,43 +427,23 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break;
case TYPE_TEXTE:
InstallTextPCBOptionsFrame( (TEXTE_PCB*) DrawStruct, DC );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_PAD:
InstallPadOptionsFrame( (D_PAD*) DrawStruct );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_MODULE:
InstallModuleOptionsFrame( (MODULE*) DrawStruct, DC );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_MIRE:
InstallMireOptionsFrame( (MIREPCB*) DrawStruct, DC, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_DIMENSION:
Install_Edit_Dimension( (DIMENSION*) DrawStruct, DC, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_TEXTE_MODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, DC );
OnEditItemRequest( DC, DrawStruct );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_DRAWSEGMENT:
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) DrawStruct, DC );
OnEditItemRequest( DC, DrawStruct );
break;
case TYPE_ZONE_CONTAINER:
if( DrawStruct->m_Flags )
break;
Edit_Zone_Params( DC, (ZONE_CONTAINER*) DrawStruct );
OnEditItemRequest( DC, DrawStruct );
break;
default:
@ -512,3 +488,57 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break;
}
}
/** Function OnEditItemRequest
* Install the corresponding dialog editor for the given item
* @param DC = the current device context
* @param aItem = a pointer to the BOARD_ITEM to edit
*/
void WinEDA_PcbFrame::OnEditItemRequest( wxDC* DC, BOARD_ITEM* aItem )
{
switch( aItem->Type() )
{
case TYPE_TRACK:
case TYPE_VIA:
Edit_TrackSegm_Width( DC, (TRACK*) aItem );
break;
case TYPE_TEXTE:
InstallTextPCBOptionsFrame( (TEXTE_PCB*) aItem, DC );
break;
case TYPE_PAD:
InstallPadOptionsFrame( (D_PAD*) aItem );
break;
case TYPE_MODULE:
InstallModuleOptionsFrame( (MODULE*) aItem, DC );
break;
case TYPE_MIRE:
InstallMireOptionsFrame( (MIREPCB*) aItem, DC );
break;
case TYPE_DIMENSION:
Install_Edit_Dimension( (DIMENSION*) aItem, DC );
break;
case TYPE_TEXTE_MODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) aItem, DC );
break;
case TYPE_DRAWSEGMENT:
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) aItem, DC );
break;
case TYPE_ZONE_CONTAINER:
Edit_Zone_Params( DC, (ZONE_CONTAINER*) aItem );
break;
default:
break;
}
}

View File

@ -214,8 +214,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case TYPE_DIMENSION:
if( !flags )
{
msg = AddHotkeyName( _( "Edit Dimension" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DIMENSION,
_( "Edit Dimension" ), edit_xpm );
msg, edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION,
_( "Delete Dimension" ), delete_xpm );
}
@ -226,8 +227,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST,
_( "Move Target" ), move_xpm );
msg = AddHotkeyName( _( "Edit Target" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_MIRE,
_( "Edit Target" ), edit_xpm );
msg, edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MIRE,
_( "Delete Target" ), delete_xpm );
}
@ -471,8 +473,9 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
}
else
{
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, _(
"Change Segment Width" ), width_segment_xpm );
msg = AddHotkeyName( _( "Change Segment Width" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG,
msg, width_segment_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACK,
_( "Change Track Width" ), width_track_xpm );
}
@ -543,6 +546,8 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
/* Create the wxMenuitem list for zone outlines editing and zone filling
*/
{
wxString msg;
if( edge_zone->m_Flags == IS_DRAGGED )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT,
@ -599,8 +604,9 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_MOVE_ZONE_OUTLINES,
_( "Move Zone" ), move_xpm );
msg = AddHotkeyName( _( "Edit Zone Params" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_EDIT_ZONE_PARAMS,
_( "Edit Zone Params" ), edit_xpm );
msg, edit_xpm );
zones_menu->AppendSeparator();
if( index >= 0 && edge_zone->m_Poly->IsCutoutContour( edge_zone->m_CornerSelection ) )
@ -630,10 +636,10 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm );
if( !flags )
{
msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_FOOTPRINT );
msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_FOOTPRINT_OR_TRACK );
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST,
msg, move_module_xpm );
msg = AddHotkeyName( _( "Drag" ), s_Board_Editor_Hokeys_Descr, HK_DRAG_FOOTPRINT );
msg = AddHotkeyName( _( "Drag" ), s_Board_Editor_Hokeys_Descr, HK_DRAG_FOOTPRINT_OR_TRACK );
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST,
msg, drag_module_xpm );
}
@ -648,8 +654,9 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men
if( !flags )
{
msg = AddHotkeyName( _( "Edit" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE,
_( "Edit" ), edit_module_xpm );
msg, edit_module_xpm );
sub_menu_footprint->AppendSeparator();
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE,
_( "Delete Module" ), delete_module_xpm );
@ -680,8 +687,11 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_ROTATE_TEXTMODULE,
_( "Rotate" ), rotate_field_xpm );
if( !flags )
{
msg = AddHotkeyName( _( "Edit" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_EDIT_TEXTMODULE,
_( "Edit" ), edit_text_xpm );
msg, edit_text_xpm );
}
if( !flags && FpText->m_Type == TEXT_is_DIVERS ) // Graphic texts can be deleted only if are not currently edited
{
@ -729,7 +739,8 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST,
_( "Drag" ), drag_pad_xpm );
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, _( "Edit Pad" ), options_pad_xpm );
msg = AddHotkeyName( _( "Edit Pad" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, msg, options_pad_xpm );
sub_menu_Pad->AppendSeparator();
ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
@ -785,8 +796,9 @@ void WinEDA_PcbFrame::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
}
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB,
_( "Rotate" ), rotate_pos_xpm );
msg = AddHotkeyName( _( "Edit" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB,
_( "Edit" ), edit_text_xpm );
msg, edit_text_xpm );
sub_menu_Text->AppendSeparator();
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_DELETE_TEXTEPCB,

View File

@ -48,6 +48,7 @@
#include "class_pcb_layer_widget.h"
#include "hotkeys.h"
#include "pcbnew_config.h"
#include "module_editor_frame.h"
extern int g_DrawDefaultLineThickness;

View File

@ -8,6 +8,7 @@
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "class_board_design_settings.h"
#include "pcbplot.h"
#include "printout_controler.h"

View File

@ -7,6 +7,7 @@
#include "common.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "protos.h"

View File

@ -7,6 +7,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "dialog_design_rules.h"
#include "pcbnew_id.h"

View File

@ -15,6 +15,7 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "pcbplot.h"
#include "protos.h"