Commit dcf75425 authored by jean-pierre charras's avatar jean-pierre charras

Added hotkey E to edit items. Minor code cleaning

parent 3c878aec
/* XPM */ /* XPM */
#ifndef XPMMAIN
extern const char *erc_xpm[];
#else
const char *erc_xpm[] = { const char *erc_xpm[] = {
"16 16 100 2", "16 16 100 2",
" c None", " c None",
...@@ -121,4 +117,3 @@ const char *erc_xpm[] = { ...@@ -121,4 +117,3 @@ const char *erc_xpm[] = {
" . . . . #.$.. . ", " . . . . #.$.. . ",
" . . %.&.. ", " . . %.&.. ",
" . . "}; " . . "};
#endif
/* XPM */ /* XPM */
#ifndef XPMMAIN
extern const char *palette_xpm[];
#else
const char * palette_xpm[] = { const char * palette_xpm[] = {
"16 15 14 1", "16 15 14 1",
" c #c0c0c0", " c #c0c0c0",
...@@ -34,5 +30,4 @@ const char * palette_xpm[] = { ...@@ -34,5 +30,4 @@ const char * palette_xpm[] = {
" .oXo---Xo. ", " .oXo---Xo. ",
" *#.oXXoXo.. ", " *#.oXXoXo.. ",
" *# ...... "} " *# ...... "}
#endif
; ;
/* XPM */ /* XPM */
#ifndef XPMMAIN
extern const char *tools_xpm[];
#else
const char *tools_xpm[] = { const char *tools_xpm[] = {
/* columns rows colors const chars-per-pixel */ /* columns rows colors const chars-per-pixel */
"16 16 5 1", "16 16 5 1",
...@@ -27,5 +23,3 @@ const char *tools_xpm[] = { ...@@ -27,5 +23,3 @@ const char *tools_xpm[] = {
".+++++++++++++. ", ".+++++++++++++. ",
"............... ", "............... ",
" "}; " "};
#endif
/*
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
...@@ -663,6 +663,14 @@ public: ...@@ -663,6 +663,14 @@ public:
// Board handling // Board handling
void RemoveStruct( BOARD_ITEM* Item, wxDC* DC ); 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: // Highlight functions:
int Select_High_Light( wxDC* DC ); int Select_High_Light( wxDC* DC );
void High_Light( wxDC* DC ); void High_Light( wxDC* DC );
...@@ -922,8 +930,7 @@ public: ...@@ -922,8 +930,7 @@ public:
void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC ); void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC );
void Place_Mire( MIREPCB* MirePcb, wxDC* DC ); void Place_Mire( MIREPCB* MirePcb, wxDC* DC );
void InstallMireOptionsFrame( MIREPCB* MirePcb, void InstallMireOptionsFrame( MIREPCB* MirePcb,
wxDC* DC, wxDC* DC );
const wxPoint& pos );
// Graphic segments type DRAWSEGMENT handling: // Graphic segments type DRAWSEGMENT handling:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC ); DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC );
...@@ -933,8 +940,7 @@ public: ...@@ -933,8 +940,7 @@ public:
// Dimension handling: // Dimension handling:
void Install_Edit_Dimension( DIMENSION* Dimension, void Install_Edit_Dimension( DIMENSION* Dimension,
wxDC* DC, wxDC* DC );
const wxPoint& pos );
DIMENSION* Begin_Dimension( DIMENSION* Dimension, wxDC* DC ); DIMENSION* Begin_Dimension( DIMENSION* Dimension, wxDC* DC );
void Delete_Dimension( DIMENSION* Dimension, wxDC* DC ); void Delete_Dimension( DIMENSION* Dimension, wxDC* DC );
...@@ -1051,194 +1057,4 @@ public: ...@@ -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 */ #endif /* WXPCB_STRUCT_H */
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "autorout.h" #include "autorout.h"
#include "pcbplot.h" #include "pcbplot.h"
#include "trigo.h" #include "trigo.h"
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "3d_struct.h" #include "3d_struct.h"
#include "3d_viewer.h" #include "3d_viewer.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "dialog_edit_module_for_Modedit.h" #include "dialog_edit_module_for_Modedit.h"
/**************************************************************************************/ /**************************************************************************************/
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "confirm.h" #include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "pcbplot.h" #include "pcbplot.h"
#include "dialog_print_for_modedit_base.h" #include "dialog_print_for_modedit_base.h"
......
...@@ -11,19 +11,19 @@ ...@@ -11,19 +11,19 @@
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "drawtxt.h" #include "drawtxt.h"
/* Routines Locales */ /* Loca functions */
static void Exit_EditDimension( WinEDA_DrawPanel* Panel, wxDC* DC ); static void Exit_EditDimension( WinEDA_DrawPanel* Panel, wxDC* DC );
static void Montre_Position_New_Dimension( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Montre_Position_New_Dimension( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* Variables "locales" : */ /* Local variables : */
static int status_dimension; /* = 0 : pas de dimension en cours static int status_dimension; /* Used in cimension creation:
* = 1 : debut place, fin a placer * = 0 : initial value: no dimension in progress
* = 2 : fin placee, texte a ajuster */ * = 1 : First point created
* = 2 : Secont point created, the text must be placed */
/* /*
* Les routines generent une dimension de la forme * A dimension has this shape:
* - cote usuelle: * It has 2 reference points, and a text
*
* | | * | |
* | dist | * | dist |
* |<---------->| * |<---------->|
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
// Constructor and destructor // Constructor and destructor
DIMENSION_EDITOR_DIALOG( WinEDA_PcbFrame* parent, DIMENSION_EDITOR_DIALOG( WinEDA_PcbFrame* parent,
DIMENSION* Dimension, wxDC* DC, const wxPoint& pos ); DIMENSION* Dimension, wxDC* DC );
~DIMENSION_EDITOR_DIALOG() ~DIMENSION_EDITOR_DIALOG()
{ {
} }
...@@ -73,10 +73,9 @@ END_EVENT_TABLE() ...@@ -73,10 +73,9 @@ END_EVENT_TABLE()
DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( WinEDA_PcbFrame* parent, DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( WinEDA_PcbFrame* parent,
DIMENSION* Dimension, wxDC* DC, DIMENSION* Dimension, wxDC* DC
const wxPoint& framepos ) : ) :
wxDialog( parent, -1, _( "Dimension properties" ), framepos, wxSize( 340, 270 ), wxDialog( parent, -1, _( "Dimension properties" ) )
DIALOG_STYLE )
{ {
wxButton* Button; wxButton* Button;
...@@ -350,14 +349,13 @@ static void Montre_Position_New_Dimension( WinEDA_DrawPanel* panel, wxDC* DC, bo ...@@ -350,14 +349,13 @@ static void Montre_Position_New_Dimension( WinEDA_DrawPanel* panel, wxDC* DC, bo
/***************************************************************/ /***************************************************************/
void WinEDA_PcbFrame::Install_Edit_Dimension( DIMENSION* Dimension, void WinEDA_PcbFrame::Install_Edit_Dimension( DIMENSION* Dimension, wxDC* DC )
wxDC* DC, const wxPoint& pos )
/***************************************************************/ /***************************************************************/
{ {
if( Dimension == NULL ) if( Dimension == NULL )
return; 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->ShowModal();
frame->Destroy(); frame->Destroy();
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
static void ShowEdgeModule( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ShowEdgeModule( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "autorout.h" #include "autorout.h"
#include "protos.h" #include "protos.h"
...@@ -807,7 +808,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -807,7 +808,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_EDIT_MIRE: case ID_POPUP_PCB_EDIT_MIRE:
InstallMireOptionsFrame( (MIREPCB*) GetCurItem(), &dc, pos ); InstallMireOptionsFrame( (MIREPCB*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
...@@ -824,7 +825,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -824,7 +825,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_EDIT_DIMENSION: case ID_POPUP_PCB_EDIT_DIMENSION:
Install_Edit_Dimension( (DIMENSION*) GetCurItem(), &dc, pos ); Install_Edit_Dimension( (DIMENSION*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "confirm.h" #include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "trigo.h" #include "trigo.h"
#include "3d_viewer.h" #include "3d_viewer.h"
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
...@@ -72,13 +73,14 @@ static Ki_HotkeyInfo HkSwitchTrackPosture( wxT( "Switch Track Posture" ), ...@@ -72,13 +73,14 @@ static Ki_HotkeyInfo HkSwitchTrackPosture( wxT( "Switch Track Posture" ),
static Ki_HotkeyInfo HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' static Ki_HotkeyInfo HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V'
+ GR_KB_CTRL ); + GR_KB_CTRL );
static Ki_HotkeyInfo HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END ); 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, static Ki_HotkeyInfo HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT,
'F' ); 'F' );
static Ki_HotkeyInfo HkRotateFootprint( wxT( "Rotate Footprint" ), static Ki_HotkeyInfo HkRotateFootprint( wxT( "Rotate Footprint" ),
HK_ROTATE_FOOTPRINT, 'R' ); 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' ); 'M' );
static Ki_HotkeyInfo HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_FOOTPRINT, static Ki_HotkeyInfo HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_FOOTPRINT_OR_TRACK,
'G' ); 'G' );
static Ki_HotkeyInfo HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ), static Ki_HotkeyInfo HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ),
HK_GET_AND_MOVE_FOOTPRINT, 'T' ); HK_GET_AND_MOVE_FOOTPRINT, 'T' );
...@@ -163,8 +165,8 @@ Ki_HotkeyInfo* s_board_edit_Hotkey_List[] = ...@@ -163,8 +165,8 @@ Ki_HotkeyInfo* s_board_edit_Hotkey_List[] =
&HkEndTrack, &HkMoveFootprint, &HkEndTrack, &HkMoveFootprint,
&HkFlipFootprint, &HkRotateFootprint, &HkDragFootprint, &HkFlipFootprint, &HkRotateFootprint, &HkDragFootprint,
&HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile, &HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile,
&HkLoadfile, &HkFindItem, &HkSwitch2CopperLayer, &HkLoadfile, &HkFindItem, &HkEditBoardItem,
&HkSwitch2InnerLayer1, &HkSwitch2CopperLayer, &HkSwitch2InnerLayer1,
&HkSwitch2InnerLayer2, &HkSwitch2InnerLayer3, &HkSwitch2InnerLayer4, &HkSwitch2InnerLayer2, &HkSwitch2InnerLayer3, &HkSwitch2InnerLayer4,
&HkSwitch2InnerLayer5, &HkSwitch2InnerLayer6, &HkSwitch2ComponentLayer, &HkSwitch2InnerLayer5, &HkSwitch2InnerLayer6, &HkSwitch2ComponentLayer,
&HkSwitch2NextCopperLayer, &HkSwitch2PreviousCopperLayer,&HkAddModule, &HkSwitch2NextCopperLayer, &HkSwitch2PreviousCopperLayer,&HkAddModule,
...@@ -540,6 +542,17 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -540,6 +542,17 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
} }
break; 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: // Footprint edition:
case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status: case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status:
// get any module, locked or not locked and toggle its 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 ...@@ -556,11 +569,11 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
} }
break; break;
case HK_DRAG_FOOTPRINT: // Start move (and drag) module case HK_DRAG_FOOTPRINT_OR_TRACK: // Start move (and drag) module or track segment
case HK_MOVE_FOOTPRINT: // Start move module case HK_MOVE_FOOTPRINT_OR_TRACK: // Start move module or track segment
if( PopupOn ) if( PopupOn )
break; break;
// Fall through on hot key
case HK_ROTATE_FOOTPRINT: // Rotation case HK_ROTATE_FOOTPRINT: // Rotation
case HK_FLIP_FOOTPRINT: // move to other side case HK_FLIP_FOOTPRINT: // move to other side
int exit = 0; int exit = 0;
...@@ -575,7 +588,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -575,7 +588,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
|| DrawStruct->Type() == TYPE_VIA) ) || DrawStruct->Type() == TYPE_VIA) )
switch( HK_Descr->m_Idcommand ) 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(); DrawPanel->MouseToCursorSchema();
//Start_DragTrackSegmentAndKeepSlope( (TRACK*) DrawStruct,DC ); //Start_DragTrackSegmentAndKeepSlope( (TRACK*) DrawStruct,DC );
...@@ -584,7 +597,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -584,7 +597,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
break; break;
// fall through // fall through
case HK_MOVE_FOOTPRINT: // Start move module case HK_MOVE_FOOTPRINT_OR_TRACK: // Start move track segment
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Start_MoveOneNodeOrSegment( (TRACK*) DrawStruct, DC, Start_MoveOneNodeOrSegment( (TRACK*) DrawStruct, DC,
ID_POPUP_PCB_MOVE_TRACK_NODE ); ID_POPUP_PCB_MOVE_TRACK_NODE );
...@@ -646,7 +659,6 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -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. // Send the module via socket to EESCHEMA's search facility.
SendMessageToEESCHEMA( module ); SendMessageToEESCHEMA( module );
SetCurItem( module ); SetCurItem( module );
} }
...@@ -664,11 +676,11 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ...@@ -664,11 +676,11 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
Change_Side_Module( module, DC ); Change_Side_Module( module, DC );
break; 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; g_Drag_Pistes_On = TRUE;
// fall through // fall through
case HK_MOVE_FOOTPRINT: // Start move module case HK_MOVE_FOOTPRINT_OR_TRACK: // Start move module
GetScreen()->m_Curseur = module->m_Pos; GetScreen()->m_Curseur = module->m_Pos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMove_Module( module, DC ); StartMove_Module( module, DC );
......
...@@ -14,8 +14,8 @@ enum hotkey_id_commnand { ...@@ -14,8 +14,8 @@ enum hotkey_id_commnand {
HK_DELETE = HK_COMMON_END, HK_DELETE = HK_COMMON_END,
HK_BACK_SPACE, HK_BACK_SPACE,
HK_ROTATE_FOOTPRINT, HK_ROTATE_FOOTPRINT,
HK_MOVE_FOOTPRINT, HK_MOVE_FOOTPRINT_OR_TRACK,
HK_DRAG_FOOTPRINT, HK_DRAG_FOOTPRINT_OR_TRACK,
HK_FLIP_FOOTPRINT, HK_FLIP_FOOTPRINT,
HK_GET_AND_MOVE_FOOTPRINT, HK_GET_AND_MOVE_FOOTPRINT,
HK_LOCK_UNLOCK_FOOTPRINT, HK_LOCK_UNLOCK_FOOTPRINT,
...@@ -28,6 +28,7 @@ enum hotkey_id_commnand { ...@@ -28,6 +28,7 @@ enum hotkey_id_commnand {
HK_SWITCH_UNITS, HK_SWITCH_UNITS,
HK_SWITCH_TRACK_DISPLAY_MODE, HK_SWITCH_TRACK_DISPLAY_MODE,
HK_FIND_ITEM, HK_FIND_ITEM,
HK_EDIT_ITEM,
HK_SWITCH_LAYER_TO_COPPER, HK_SWITCH_LAYER_TO_COPPER,
HK_SWITCH_LAYER_TO_COMPONENT, HK_SWITCH_LAYER_TO_COMPONENT,
HK_SWITCH_LAYER_TO_NEXT, HK_SWITCH_LAYER_TO_NEXT,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "confirm.h" #include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "protos.h" #include "protos.h"
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "gestfich.h" #include "gestfich.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "protos.h" #include "protos.h"
/* /*
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "protos.h" #include "protos.h"
class ModList class ModList
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "protos.h" #include "protos.h"
......
...@@ -28,10 +28,10 @@ static MIREPCB s_TargetCopy( NULL ); /* Used to store "old" values of the ...@@ -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: private:
...@@ -42,11 +42,10 @@ private: ...@@ -42,11 +42,10 @@ private:
WinEDA_ValueCtrl* m_MireSizeCtrl; WinEDA_ValueCtrl* m_MireSizeCtrl;
wxRadioBox* m_MireShape; wxRadioBox* m_MireShape;
public: WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent, public: TARGET_PROPERTIES_DIALOG_EDITOR( WinEDA_PcbFrame* parent,
MIREPCB* Mire, MIREPCB* Mire,
wxDC* DC, wxDC* DC );
const wxPoint& pos ); ~TARGET_PROPERTIES_DIALOG_EDITOR() { }
~WinEDA_MirePropertiesFrame() { }
private: private:
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
...@@ -55,29 +54,26 @@ private: ...@@ -55,29 +54,26 @@ private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
BEGIN_EVENT_TABLE( WinEDA_MirePropertiesFrame, wxDialog ) BEGIN_EVENT_TABLE( TARGET_PROPERTIES_DIALOG_EDITOR, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_MirePropertiesFrame::OnOkClick ) EVT_BUTTON( wxID_OK, TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_MirePropertiesFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, TARGET_PROPERTIES_DIALOG_EDITOR::OnCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
void WinEDA_PcbFrame::InstallMireOptionsFrame( MIREPCB* MirePcb, void WinEDA_PcbFrame::InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC )
wxDC* DC, const wxPoint& pos )
{ {
WinEDA_MirePropertiesFrame* frame = TARGET_PROPERTIES_DIALOG_EDITOR* frame =
new WinEDA_MirePropertiesFrame( this, MirePcb, DC, pos ); new TARGET_PROPERTIES_DIALOG_EDITOR( this, MirePcb, DC );
frame->ShowModal(); frame->ShowModal();
frame->Destroy(); frame->Destroy();
} }
WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(
WinEDA_PcbFrame* parent, WinEDA_PcbFrame* parent,
MIREPCB* Mire, wxDC* DC, MIREPCB* Mire, wxDC* DC ) :
const wxPoint& framepos ) : wxDialog( parent, wxID_ANY, _( "Target Properties" ) )
wxDialog( parent, -1, _( "Target Properties" ), framepos, wxSize( 270, 210 ),
DIALOG_STYLE )
{ {
wxString number; wxString number;
wxButton* Button; wxButton* Button;
...@@ -128,7 +124,7 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( ...@@ -128,7 +124,7 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame(
} }
void WinEDA_MirePropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED( void TARGET_PROPERTIES_DIALOG_EDITOR::OnCancelClick( wxCommandEvent& WXUNUSED(
event ) ) event ) )
{ {
EndModal( -1 ); EndModal( -1 );
...@@ -137,7 +133,7 @@ void WinEDA_MirePropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED( ...@@ -137,7 +133,7 @@ void WinEDA_MirePropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED(
/* Updates the different parameters for the component being edited /* 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 ); m_MirePcb->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "3d_viewer.h" #include "3d_viewer.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "protos.h" #include "protos.h"
#include "kicad_device_context.h" #include "kicad_device_context.h"
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "3d_viewer.h" #include "3d_viewer.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "dialog_edit_module_for_Modedit.h" #include "dialog_edit_module_for_Modedit.h"
#include "bitmaps.h" #include "bitmaps.h"
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "protos.h" #include "protos.h"
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
......
/*********************************************************/
/* 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_
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "confirm.h" #include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "protos.h" #include "protos.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
......
...@@ -389,15 +389,11 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -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 /* handle the double click on the mouse left button
*/ */
void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{ {
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
wxPoint pos = GetPosition();
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
...@@ -431,43 +427,23 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -431,43 +427,23 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break; break;
case TYPE_TEXTE: case TYPE_TEXTE:
InstallTextPCBOptionsFrame( (TEXTE_PCB*) DrawStruct, DC );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_PAD: case TYPE_PAD:
InstallPadOptionsFrame( (D_PAD*) DrawStruct );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_MODULE: case TYPE_MODULE:
InstallModuleOptionsFrame( (MODULE*) DrawStruct, DC );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_MIRE: case TYPE_MIRE:
InstallMireOptionsFrame( (MIREPCB*) DrawStruct, DC, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_DIMENSION: case TYPE_DIMENSION:
Install_Edit_Dimension( (DIMENSION*) DrawStruct, DC, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, DC ); OnEditItemRequest( DC, DrawStruct );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case TYPE_DRAWSEGMENT: case TYPE_DRAWSEGMENT:
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) DrawStruct, DC ); OnEditItemRequest( DC, DrawStruct );
break; break;
case TYPE_ZONE_CONTAINER: case TYPE_ZONE_CONTAINER:
if( DrawStruct->m_Flags ) if( DrawStruct->m_Flags )
break; break;
Edit_Zone_Params( DC, (ZONE_CONTAINER*) DrawStruct ); OnEditItemRequest( DC, DrawStruct );
break; break;
default: default:
...@@ -512,3 +488,57 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -512,3 +488,57 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break; 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;
}
}
...@@ -214,8 +214,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -214,8 +214,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case TYPE_DIMENSION: case TYPE_DIMENSION:
if( !flags ) if( !flags )
{ {
msg = AddHotkeyName( _( "Edit Dimension" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DIMENSION, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DIMENSION,
_( "Edit Dimension" ), edit_xpm ); msg, edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION,
_( "Delete Dimension" ), delete_xpm ); _( "Delete Dimension" ), delete_xpm );
} }
...@@ -226,8 +227,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -226,8 +227,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
{ {
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST,
_( "Move Target" ), move_xpm ); _( "Move Target" ), move_xpm );
msg = AddHotkeyName( _( "Edit Target" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_MIRE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_MIRE,
_( "Edit Target" ), edit_xpm ); msg, edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MIRE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MIRE,
_( "Delete Target" ), delete_xpm ); _( "Delete Target" ), delete_xpm );
} }
...@@ -471,8 +473,9 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) ...@@ -471,8 +473,9 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
} }
else else
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, _( msg = AddHotkeyName( _( "Change Segment Width" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
"Change Segment Width" ), width_segment_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG,
msg, width_segment_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACK, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACK,
_( "Change Track Width" ), width_track_xpm ); _( "Change Track Width" ), width_track_xpm );
} }
...@@ -543,6 +546,8 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu ...@@ -543,6 +546,8 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
/* Create the wxMenuitem list for zone outlines editing and zone filling /* Create the wxMenuitem list for zone outlines editing and zone filling
*/ */
{ {
wxString msg;
if( edge_zone->m_Flags == IS_DRAGGED ) if( edge_zone->m_Flags == IS_DRAGGED )
{ {
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT,
...@@ -599,8 +604,9 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu ...@@ -599,8 +604,9 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_MOVE_ZONE_OUTLINES, ADD_MENUITEM( zones_menu, ID_POPUP_PCB_MOVE_ZONE_OUTLINES,
_( "Move Zone" ), move_xpm ); _( "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, ADD_MENUITEM( zones_menu, ID_POPUP_PCB_EDIT_ZONE_PARAMS,
_( "Edit Zone Params" ), edit_xpm ); msg, edit_xpm );
zones_menu->AppendSeparator(); zones_menu->AppendSeparator();
if( index >= 0 && edge_zone->m_Poly->IsCutoutContour( edge_zone->m_CornerSelection ) ) if( index >= 0 && edge_zone->m_Poly->IsCutoutContour( edge_zone->m_CornerSelection ) )
...@@ -630,10 +636,10 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men ...@@ -630,10 +636,10 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm ); ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm );
if( !flags ) 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, ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST,
msg, move_module_xpm ); 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, ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST,
msg, drag_module_xpm ); msg, drag_module_xpm );
} }
...@@ -648,8 +654,9 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men ...@@ -648,8 +654,9 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men
if( !flags ) if( !flags )
{ {
msg = AddHotkeyName( _( "Edit" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE, ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE,
_( "Edit" ), edit_module_xpm ); msg, edit_module_xpm );
sub_menu_footprint->AppendSeparator(); sub_menu_footprint->AppendSeparator();
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE, ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE,
_( "Delete Module" ), delete_module_xpm ); _( "Delete Module" ), delete_module_xpm );
...@@ -680,8 +687,11 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m ...@@ -680,8 +687,11 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_ROTATE_TEXTMODULE, ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_ROTATE_TEXTMODULE,
_( "Rotate" ), rotate_field_xpm ); _( "Rotate" ), rotate_field_xpm );
if( !flags ) if( !flags )
{
msg = AddHotkeyName( _( "Edit" ), s_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_EDIT_TEXTMODULE, 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 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 ) ...@@ -729,7 +739,8 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST, ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST,
_( "Drag" ), drag_pad_xpm ); _( "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(); sub_menu_Pad->AppendSeparator();
ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS, 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 ) ...@@ -785,8 +796,9 @@ void WinEDA_PcbFrame::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
} }
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB,
_( "Rotate" ), rotate_pos_xpm ); _( "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, ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB,
_( "Edit" ), edit_text_xpm ); msg, edit_text_xpm );
sub_menu_Text->AppendSeparator(); sub_menu_Text->AppendSeparator();
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_DELETE_TEXTEPCB, ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_DELETE_TEXTEPCB,
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "class_pcb_layer_widget.h" #include "class_pcb_layer_widget.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "pcbnew_config.h" #include "pcbnew_config.h"
#include "module_editor_frame.h"
extern int g_DrawDefaultLineThickness; extern int g_DrawDefaultLineThickness;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "pcbplot.h" #include "pcbplot.h"
#include "printout_controler.h" #include "printout_controler.h"
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "protos.h" #include "protos.h"
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "confirm.h" #include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "dialog_design_rules.h" #include "dialog_design_rules.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h"
#include "pcbplot.h" #include "pcbplot.h"
#include "protos.h" #include "protos.h"
......
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