Commit a6fc1329 authored by charras's avatar charras

More about undo/redo in pcbnew

parent 5c3f35c2
......@@ -265,7 +265,8 @@ wxString ReturnUnitSymbol( int Units )
void AddUnitSymbol( wxStaticText& Stext, int Units )
/**************************************************/
{
wxString msg = Stext.GetLabel() + ReturnUnitSymbol( Units );
wxString msg = Stext.GetLabel();
msg += ReturnUnitSymbol( Units );
Stext.SetLabel( msg );
}
......
......@@ -271,7 +271,6 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint )
{
SCH_ITEM* CopyOfItem;
PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
commandToUndo->m_TransformPoint = aTransformPoint;
// Copy picker list:
......@@ -342,7 +341,9 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bo
SCH_ITEM* item;
SCH_ITEM* alt_item;
for( unsigned ii = 0; ii < aList->GetCount(); ii++ )
// Undo in the reverse order of list creation: (this can allow stacked changes
// like the same item can be changes and deleted in the same complex command
for( int ii = aList->GetCount()-1; ii >= 0 ; ii-- )
{
ITEM_PICKER itemWrapper = aList->GetItemWrapper( ii );
item = (SCH_ITEM*) itemWrapper.m_PickedItem;
......@@ -420,12 +421,16 @@ void WinEDA_SchematicFrame::GetSchematicFromUndoList(wxCommandEvent& event)
if( GetScreen()->GetUndoCommandCount() <= 0 )
return;
/* Get the old wrapper and put it in RedoList */
/* Get the old list */
PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromUndoList();
GetScreen()->PushCommandToRedoList( List );
/* Undo the command */
PutDataInPreviousState( List, false );
/* Put the old list in RedoList */
List->ReversePickersListOrder();
GetScreen()->PushCommandToRedoList( List );
CurrentDrawItem = NULL;
GetScreen()->SetModify();
SetSheetNumberAndCount();
......@@ -451,13 +456,16 @@ void WinEDA_SchematicFrame::GetSchematicFromRedoList(wxCommandEvent& event)
return;
/* Get the old wrapper and put it in UndoList */
/* Get the old list */
PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromRedoList();
GetScreen()->PushCommandToUndoList( List );
/* Redo the command: */
PutDataInPreviousState( List, true );
/* Put the old list in UndoList */
List->ReversePickersListOrder();
GetScreen()->PushCommandToUndoList( List );
CurrentDrawItem = NULL;
GetScreen()->SetModify();
SetSheetNumberAndCount();
......
......@@ -173,7 +173,6 @@ public:
int DrawMode, int color, int type );
// Gestion des modules
void InstallModuleOptionsFrame( MODULE* Module, wxDC * DC );
MODULE* Copie_Module( MODULE* module );
/** Function Save_Module_In_Library
......@@ -202,9 +201,6 @@ public:
bool incremental );
void Place_Module( MODULE* module, wxDC* DC, bool aDoNotRecreateRatsnest = false );
// Graphic items edition:
void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC );
// module texts
void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC );
void DeleteTextModule( TEXTE_MODULE* Text );
......@@ -213,8 +209,7 @@ public:
TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC );
void InstallPadOptionsFrame( D_PAD* pad, wxDC* DC, const wxPoint& pos );
void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod,
wxDC* DC, const wxPoint& pos );
void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC );
// Pads sur modules
void AddPad( MODULE* Module, bool draw );
......
......@@ -333,8 +333,10 @@ public:
// Graphic Segments type DRAWSEGMENT
void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC ); // Graphic items edition
// Footprint edition (see also WinEDA_BasePcbFrame)
void InstallModuleOptionsFrame( MODULE* Module, wxDC * DC );
void StartMove_Module( MODULE* module, wxDC* DC );
bool Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDeleting );
void Change_Side_Module( MODULE* Module, wxDC* DC );
......@@ -578,7 +580,7 @@ public:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Drawings_All_Layer( int aLayer );
// Dimension handling:
void Install_Edit_Cotation( COTATION* Cotation, wxDC* DC, const wxPoint& pos );
......
No preview for this file type
This diff is collapsed.
......@@ -39,9 +39,12 @@ set(PCBNEW_SRCS
dialog_display_options_base.cpp
dialog_drc_base.cpp
dialog_drc.cpp
dialog_edit_module_for_BoardEditor.cpp
dialog_edit_module_for_BoardEditor_base.cpp
dialog_edit_module_for_modedit_base.cpp
dialog_edit_module_for_modedit.cpp
dialog_edit_module_text.cpp
dialog_edit_module_text_base.cpp
dialog_edit_module.cpp
dialog_exchange_modules_base.cpp
dialog_freeroute_exchange.cpp
# dialog_gendrill.cpp
......
......@@ -156,10 +156,10 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
break;
case TYPE_DRAWSEGMENT:
EXCHG( ( (TRACK*) aItem )->m_Start, ( (TRACK*) aImage )->m_Start );
EXCHG( ( (TRACK*) aItem )->m_End, ( (TRACK*) aImage )->m_End );
EXCHG( ( (TRACK*) aItem )->m_Width, ( (TRACK*) aImage )->m_Width );
EXCHG( ( (TRACK*) aItem )->m_Shape, ( (TRACK*) aImage )->m_Shape );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Start, ( (DRAWSEGMENT*) aImage )->m_Start );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_End, ( (DRAWSEGMENT*) aImage )->m_End );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Width, ( (DRAWSEGMENT*) aImage )->m_Width );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Shape, ( (DRAWSEGMENT*) aImage )->m_Shape );
break;
case TYPE_TRACK:
......@@ -581,7 +581,7 @@ void WinEDA_PcbFrame::GetBoardFromUndoList( wxCommandEvent& event )
/* Undo the command */
PutDataInPreviousState( List, false );
/* Pu the old list in RedoList */
/* Put the old list in RedoList */
List->ReversePickersListOrder();
GetScreen()->PushCommandToRedoList( List );
......
......@@ -239,8 +239,7 @@ void TEXTE_MODULE:: SetDrawCoord()
NORMALIZE_ANGLE_POS( angle );
RotatePoint( &m_Pos.x, &m_Pos.y, angle );
m_Pos.x += Module->m_Pos.x;
m_Pos.y += Module->m_Pos.y;
m_Pos += Module->m_Pos;
}
......@@ -250,10 +249,12 @@ void TEXTE_MODULE:: SetLocalCoord()
MODULE* Module = (MODULE*) m_Parent;
if( Module == NULL )
{
m_Pos0 = m_Pos;
return;
}
m_Pos0.x = m_Pos.x - Module->m_Pos.x;
m_Pos0.y = m_Pos.y - Module->m_Pos.y;
m_Pos0 = m_Pos - Module->m_Pos;
int angle = Module->m_Orient;
NORMALIZE_ANGLE_POS( angle );
......@@ -447,18 +448,12 @@ int TEXTE_MODULE::GetDrawRotation()
// see class_text_mod.h
void TEXTE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
{
wxString msg, Line;
int ii;
MODULE* module = (MODULE*) m_Parent;
wxASSERT( module );
if( !module )
if( module == NULL ) // Happens in modedit, and for new texts
return;
BOARD* board = (BOARD*) module->GetParent();
wxASSERT( board );
wxString msg, Line;
int ii;
static const wxString text_type_msg[3] = {
_( "Ref." ), _( "Value" ), _( "Text" )
......@@ -484,11 +479,13 @@ void TEXTE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
msg = _( "Yes" );
Affiche_1_Parametre( frame, 25, _( "Display" ), msg, DARKGREEN );
ii = m_Layer;
if( ii < NB_LAYERS )
msg = board->GetLayerName( ii );
// Display text layer (use layer name if possible)
BOARD* board = NULL;
board = (BOARD*) module->GetParent();
if( m_Layer < NB_LAYERS && board )
msg = board->GetLayerName( m_Layer );
else
msg.Printf( wxT( "%d" ), ii );
msg.Printf( wxT( "%d" ), m_Layer );
Affiche_1_Parametre( frame, 31, _( "Layer" ), msg, DARKGREEN );
msg = _( " No" );
......
This diff is collapsed.
/************************************************/
/* Module editor: Dialog box for editing module */
/* properties and carateristics */
/************************************************/
enum id_Module_properties
{
ID_GOTO_MODULE_EDITOR =1900,
ID_MODULE_PROPERTIES_EXCHANGE,
ID_MODULE_EDIT_ADD_TEXT,
ID_MODULE_EDIT_EDIT_TEXT,
ID_MODULE_EDIT_DELETE_TEXT,
ID_MODULE_LISTBOX_SELECT,
ID_LISTBOX_ORIENT_SELECT,
ID_BROWSE_3D_LIB,
ID_ADD_3D_SHAPE,
ID_REMOVE_3D_SHAPE,
ID_NOTEBOOK,
ID_MODULE_EDIT_X_POSITION,
ID_MODULE_EDIT_Y_POSITION
};
class Panel3D_Ctrl;
/**************************************/
/* class WinEDA_ModulePropertiesFrame */
/**************************************/
class WinEDA_ModulePropertiesFrame: public wxDialog
{
private:
WinEDA_BasePcbFrame * m_Parent;
wxDC * m_DC;
MODULE * m_CurrentModule;
wxNotebook* m_NoteBook;
wxPanel * m_PanelProperties;
Panel3D_Ctrl * m_Panel3D;
WinEDAChoiceBox * m_TextListBox;
wxRadioBox * m_LayerCtrl;
wxRadioBox * m_OrientCtrl;
wxTextCtrl * m_OrientValue;
wxRadioBox * m_AttributsCtrl;
wxRadioBox * m_AutoPlaceCtrl;
wxSlider * m_CostRot90Ctrl, * m_CostRot180Ctrl;
wxButton * m_DeleteFieddButton;
wxTextCtrl *m_Doc, *m_Keyword;
wxBoxSizer * m_GeneralBoxSizer;
wxBoxSizer* m_PanelPropertiesBoxSizer;
wxTextCtrl *m_ModPositionX, *m_ModPositionY;
wxString *m_ModPosXStr, *m_ModPosYStr;
public:
// Constructor and destructor
WinEDA_ModulePropertiesFrame(WinEDA_BasePcbFrame *parent,
MODULE * Module, wxDC * DC);
~WinEDA_ModulePropertiesFrame()
{
}
private:
void CreateControls();
void OnCancelClick(wxCommandEvent& event);
void OnOkClick(wxCommandEvent& event);
void CreateTextModule(wxCommandEvent& event);
void EditOrDelTextModule(wxCommandEvent& event);
void SelectTextListBox(wxCommandEvent& event);
void ReCreateFieldListBox();
void SetTextListButtons();
void BuildPanelModuleProperties(bool FullOptions);
void ModuleOrientEvent(wxCommandEvent& event);
void ExchangeModule(wxCommandEvent& event);
void GotoModuleEditor(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
/*********************************/
class Panel3D_Ctrl: public wxPanel
/*********************************/
/* panel d'entree des caract 3D */
{
public:
Panel3D_Ctrl * m_Pnext, * m_Pback; // Chainage
wxNotebook * m_Parent;
WinEDA_ModulePropertiesFrame * m_ParentFrame;
wxBoxSizer* m_Panel3DBoxSizer;
wxTextCtrl * m_3D_ShapeName;
WinEDA_VertexCtrl *m_3D_Scale, *m_3D_Offset, *m_3D_Rotation;
public:
Panel3D_Ctrl(WinEDA_ModulePropertiesFrame * parentframe,
wxNotebook * parent, int id, S3D_MASTER * struct3D);
~Panel3D_Ctrl();
void Browse3DLib(wxCommandEvent& event);
void AddOrRemove3DShape(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
This diff is collapsed.
/************************************************/
/* Module editor: Dialog box for editing module */
/* properties and carateristics */
/************************************************/
#include "dialog_edit_module_for_BoardEditor_base.h"
/**************************************/
/* class DIALOG_MODULE_BOARD_EDITOR */
/**************************************/
class DIALOG_MODULE_BOARD_EDITOR: public DIALOG_MODULE_BOARD_EDITOR_BASE
{
private:
WinEDA_PcbFrame * m_Parent;
wxDC * m_DC;
MODULE* m_CurrentModule;
TEXTE_MODULE* m_ReferenceCopy;
TEXTE_MODULE* m_ValueCopy;
std::vector <S3D_MASTER*> m_Shapes3D_list;
int m_LastSelected3DShapeIndex;
WinEDA_VertexCtrl * m_3D_Scale;
WinEDA_VertexCtrl * m_3D_Offset;
WinEDA_VertexCtrl * m_3D_Rotation;
public:
// Constructor and destructor
DIALOG_MODULE_BOARD_EDITOR( WinEDA_PcbFrame* aParent, MODULE* aModule, wxDC* aDC );
~DIALOG_MODULE_BOARD_EDITOR();
private:
void InitBoardProperties();
void InitModeditProperties();
void Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource );
void TransfertDisplayTo3DValues( int aIndexSelection );
void OnEditValue( wxCommandEvent& event );
void OnEditReference( wxCommandEvent& event );
void On3DShapeSelection( wxCommandEvent& event );
void On3DShapeNameSelected( wxCommandEvent& event );
void Browse3DLib( wxCommandEvent& event );
void Add3DShape( wxCommandEvent& event );
void Remove3DShape( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void GotoModuleEditor( wxCommandEvent& event );
void ExchangeModule( wxCommandEvent& event );
void ModuleOrientEvent( wxCommandEvent& event );
};
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_edit_module_for_BoardEditor_base__
#define __dialog_edit_module_for_BoardEditor_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/stattext.h>
#include <wx/slider.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/listbox.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_NOTEBOOK 1000
#define ID_LISTBOX_ORIENT_SELECT 1001
#define ID_MODULE_PROPERTIES_EXCHANGE 1002
#define ID_GOTO_MODULE_EDITOR 1003
#define ID_BROWSE_3D_LIB 1004
#define ID_ADD_3D_SHAPE 1005
#define ID_REMOVE_3D_SHAPE 1006
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_MODULE_BOARD_EDITOR_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_MODULE_BOARD_EDITOR_BASE : public wxDialog
{
private:
wxBoxSizer* m_GeneralBoxSizer;
wxBoxSizer* m_PropRightSizer;
protected:
wxNotebook* m_NoteBook;
wxPanel* m_PanelProperties;
wxTextCtrl* m_ReferenceCtrl;
wxButton* m_button4;
wxTextCtrl* m_ValueCtrl;
wxButton* m_button5;
wxRadioBox* m_LayerCtrl;
wxRadioBox* m_OrientCtrl;
wxStaticText* m_staticText4;
wxTextCtrl* m_OrientValue;
wxStaticText* XPositionStatic;
wxTextCtrl* m_ModPositionX;
wxStaticText* YPositionStatic;
wxTextCtrl* m_ModPositionY;
wxButton* m_buttonExchange;
wxButton* m_buttonModuleEditor;
wxRadioBox* m_AttributsCtrl;
wxRadioBox* m_AutoPlaceCtrl;
wxStaticText* m_staticText11;
wxSlider* m_CostRot90Ctrl;
wxStaticText* m_staticText12;
wxSlider* m_CostRot180Ctrl;
wxPanel* m_Panel3D;
wxStaticText* m_staticText3Dname;
wxListBox* m_3D_ShapeNameListBox;
wxButton* m_buttonBrowse;
wxButton* m_buttonAdd;
wxButton* m_buttonRemove;
wxStdDialogButtonSizer* m_sdbSizerStdButtons;
wxButton* m_sdbSizerStdButtonsOK;
wxButton* m_sdbSizerStdButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnEditReference( wxCommandEvent& event ){ event.Skip(); }
virtual void OnEditValue( wxCommandEvent& event ){ event.Skip(); }
virtual void ModuleOrientEvent( wxCommandEvent& event ){ event.Skip(); }
virtual void ExchangeModule( wxCommandEvent& event ){ event.Skip(); }
virtual void GotoModuleEditor( wxCommandEvent& event ){ event.Skip(); }
virtual void On3DShapeNameSelected( wxCommandEvent& event ){ event.Skip(); }
virtual void Browse3DLib( wxCommandEvent& event ){ event.Skip(); }
virtual void Add3DShape( wxCommandEvent& event ){ event.Skip(); }
virtual void Remove3DShape( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
public:
wxStaticBoxSizer* m_Sizer3DValues;
DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Module properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 422,583 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_MODULE_BOARD_EDITOR_BASE();
};
#endif //__dialog_edit_module_for_BoardEditor_base__
This diff is collapsed.
/*****************************************************************************/
/* Module editor: Dialog box for editing module properties and carateristics */
/*****************************************************************************/
#ifndef __DIALOG_EDIT_MODULE_FOR_MODEDIT__
#define __DIALOG_EDIT_MODULE_FOR_MODEDIT__
// Include the wxFormBuider header base:
#include <vector>
#include "dialog_edit_module_for_modedit_base.h"
/**************************************/
/* class DIALOG_MODULE_MODULE_EDITOR */
/**************************************/
class DIALOG_MODULE_MODULE_EDITOR : public DIALOG_MODULE_MODULE_EDITOR_BASE
{
private:
WinEDA_ModuleEditFrame* m_Parent;
MODULE* m_CurrentModule;
TEXTE_MODULE* m_ReferenceCopy;
TEXTE_MODULE* m_ValueCopy;
std::vector <S3D_MASTER*> m_Shapes3D_list;
int m_LastSelected3DShapeIndex;
WinEDA_VertexCtrl * m_3D_Scale;
WinEDA_VertexCtrl * m_3D_Offset;
WinEDA_VertexCtrl * m_3D_Rotation;
public:
// Constructor and destructor
DIALOG_MODULE_MODULE_EDITOR( WinEDA_ModuleEditFrame* aParent, MODULE* aModule );
~DIALOG_MODULE_MODULE_EDITOR();
private:
void InitModeditProperties();
void Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource );
void TransfertDisplayTo3DValues( int aIndexSelection );
void OnEditValue( wxCommandEvent& event );
void OnEditReference( wxCommandEvent& event );
void On3DShapeSelection( wxCommandEvent& event );
void On3DShapeNameSelected( wxCommandEvent& event );
void Browse3DLib( wxCommandEvent& event );
void Add3DShape( wxCommandEvent& event );
void Remove3DShape( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
};
#endif // __DIALOG_EDIT_MODULE_FOR_MODEDIT__
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_edit_module_for_Modedit_base__
#define __dialog_edit_module_for_Modedit_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/radiobox.h>
#include <wx/stattext.h>
#include <wx/slider.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/listbox.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_NOTEBOOK 1000
#define ID_BROWSE_3D_LIB 1001
#define ID_ADD_3D_SHAPE 1002
#define ID_REMOVE_3D_SHAPE 1003
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_MODULE_MODULE_EDITOR_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_MODULE_MODULE_EDITOR_BASE : public wxDialog
{
private:
wxBoxSizer* m_GeneralBoxSizer;
wxBoxSizer* m_PropRightSizer;
protected:
wxNotebook* m_NoteBook;
wxPanel* m_PanelProperties;
wxTextCtrl* m_DocCtrl;
wxTextCtrl* m_KeywordCtrl;
wxTextCtrl* m_ReferenceCtrl;
wxButton* m_button4;
wxTextCtrl* m_ValueCtrl;
wxButton* m_button5;
wxRadioBox* m_AttributsCtrl;
wxRadioBox* m_AutoPlaceCtrl;
wxStaticText* m_staticText11;
wxSlider* m_CostRot90Ctrl;
wxStaticText* m_staticText12;
wxSlider* m_CostRot180Ctrl;
wxPanel* m_Panel3D;
wxStaticText* m_staticText3Dname;
wxListBox* m_3D_ShapeNameListBox;
wxButton* m_buttonBrowse;
wxButton* m_buttonAdd;
wxButton* m_buttonRemove;
wxStdDialogButtonSizer* m_sdbSizerStdButtons;
wxButton* m_sdbSizerStdButtonsOK;
wxButton* m_sdbSizerStdButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnEditReference( wxCommandEvent& event ){ event.Skip(); }
virtual void OnEditValue( wxCommandEvent& event ){ event.Skip(); }
virtual void On3DShapeNameSelected( wxCommandEvent& event ){ event.Skip(); }
virtual void Browse3DLib( wxCommandEvent& event ){ event.Skip(); }
virtual void Add3DShape( wxCommandEvent& event ){ event.Skip(); }
virtual void Remove3DShape( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
public:
wxStaticBoxSizer* m_Sizer3DValues;
DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Module properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 422,422 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_MODULE_MODULE_EDITOR_BASE();
};
#endif //__dialog_edit_module_for_Modedit_base__
......@@ -38,23 +38,18 @@ private:
void OnCancelClick( wxCommandEvent& event );
};
/***************************************************************************/
void WinEDA_BasePcbFrame::InstallTextModOptionsFrame( TEXTE_MODULE* TextMod,
wxDC* DC, const wxPoint& pos )
/***************************************************************************/
/*************************************************************************************/
void WinEDA_BasePcbFrame::InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC )
/**************************************************************************************/
{
DrawPanel->m_IgnoreMouseEvents = TRUE;
DialogEditModuleText* frame = new DialogEditModuleText( this,
TextMod, DC );
frame->ShowModal(); frame->Destroy();
DrawPanel->MouseToCursorSchema();
DialogEditModuleText dialog( this, TextMod, DC );
dialog.ShowModal();
DrawPanel->m_IgnoreMouseEvents = FALSE;
}
DialogEditModuleText::DialogEditModuleText( WinEDA_BasePcbFrame* parent,
TEXTE_MODULE* TextMod,
wxDC* DC ) :
DialogEditModuleText::DialogEditModuleText( WinEDA_BasePcbFrame* parent, TEXTE_MODULE* TextMod, wxDC* DC ) :
DialogEditModuleText_base(parent)
{
......@@ -90,9 +85,14 @@ void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event )
m_Module->m_Reference->m_Text.GetData(),
m_Module->m_Value->m_Text.GetData(),
(float) (m_Module->m_Orient / 10) );
m_ModuleInfoText->SetLabel( msg );
}
else
msg.Empty();
m_ModuleInfoText->SetLabel( msg );
if( m_CurrentTextMod->m_Type == TEXT_is_VALUE )
m_TextDataTitle->SetLabel( _( "Value:" ) );
else if( m_CurrentTextMod->m_Type == TEXT_is_DIVERS )
......@@ -200,7 +200,8 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
(m_CurrentTextMod->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ) );
}
m_Parent->GetScreen()->SetModify();
( (MODULE*) m_CurrentTextMod->GetParent() )->m_LastEdit_Time = time( NULL );
if( m_Module )
m_Module->m_LastEdit_Time = time( NULL );
Close( TRUE );
}
......@@ -16,6 +16,7 @@
#include "confirm.h"
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "dialog_graphic_item_properties_base.h"
......@@ -24,37 +25,40 @@
class DialogGraphicItemProperties: public DialogGraphicItemProperties_base
{
private:
WinEDA_BasePcbFrame* m_Parent;
WinEDA_PcbFrame* m_Parent;
wxDC* m_DC;
DRAWSEGMENT* m_Item;
public:
DialogGraphicItemProperties( WinEDA_BasePcbFrame* aParent, DRAWSEGMENT * aItem, wxDC * aDC);
DialogGraphicItemProperties( WinEDA_PcbFrame* aParent, DRAWSEGMENT * aItem, wxDC * aDC);
~DialogGraphicItemProperties() {};
private:
void OnInitDialog( wxInitDialogEvent& event );
void Init( );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnLayerChoice( wxCommandEvent& event );
};
DialogGraphicItemProperties::DialogGraphicItemProperties( WinEDA_BasePcbFrame* aParent, DRAWSEGMENT * aItem, wxDC * aDC):
DialogGraphicItemProperties::DialogGraphicItemProperties( WinEDA_PcbFrame* aParent, DRAWSEGMENT * aItem, wxDC * aDC):
DialogGraphicItemProperties_base( aParent )
{
m_Parent = aParent;
m_DC = aDC;
m_Item = aItem;
Init();
Layout();
GetSizer()->SetSizeHints( this );
}
/*******************************************************************************************/
void WinEDA_BasePcbFrame::InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wxDC* aDC)
void WinEDA_PcbFrame::InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wxDC* aDC)
/*******************************************************************************************/
{
if ( aItem == NULL )
{
DisplayError(this, wxT("nstallGraphicItemPropertiesDialog() error: NULL item"));
DisplayError(this, wxT("InstallGraphicItemPropertiesDialog() error: NULL item"));
return;
}
DrawPanel->m_IgnoreMouseEvents = TRUE;
......@@ -66,7 +70,7 @@ void WinEDA_BasePcbFrame::InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem
}
/**************************************************************************/
void DialogGraphicItemProperties::OnInitDialog( wxInitDialogEvent& event )
void DialogGraphicItemProperties::Init( )
/**************************************************************************/
/* Initialize messages and values in text control,
* according to the item parameters values
......@@ -102,6 +106,7 @@ void DialogGraphicItemProperties::OnInitDialog( wxInitDialogEvent& event )
break;
}
AddUnitSymbol( *m_Start_Center_XText );
PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->m_Start.x,
m_Parent->m_InternalUnits );
......@@ -163,9 +168,11 @@ void DialogGraphicItemProperties::OnLayerChoice( wxCommandEvent& event )
/*******************************************************************/
void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
/*******************************************************************/
/* Copy values in text contro to the item parameters
/* Copy values in text control to the item parameters
*/
{
m_Parent->SaveCopyInUndoList( m_Item, UR_CHANGED );
wxString msg;
if ( m_DC )
m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
......
......@@ -107,7 +107,6 @@ DialogGraphicItemProperties_base::DialogGraphicItemProperties_base( wxWindow* pa
this->Layout();
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogGraphicItemProperties_base::OnInitDialog ) );
m_LayerSelection->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnLayerChoice ), NULL, this );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnCancelClick ), NULL, this );
......@@ -116,7 +115,6 @@ DialogGraphicItemProperties_base::DialogGraphicItemProperties_base( wxWindow* pa
DialogGraphicItemProperties_base::~DialogGraphicItemProperties_base()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogGraphicItemProperties_base::OnInitDialog ) );
m_LayerSelection->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnLayerChoice ), NULL, this );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnOkClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGraphicItemProperties_base::OnCancelClick ), NULL, this );
......
......@@ -32,7 +32,7 @@
<property name="minimum_size"></property>
<property name="name">DialogGraphicItemProperties_base</property>
<property name="pos"></property>
<property name="size">348,247</property>
<property name="size">399,247</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass"></property>
<property name="title">Graphic item properties</property>
......@@ -49,7 +49,7 @@
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog">OnInitDialog</event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
......
......@@ -58,14 +58,13 @@ class DialogGraphicItemProperties_base : public wxDialog
wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnLayerChoice( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
public:
DialogGraphicItemProperties_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Graphic item properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 348,247 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
DialogGraphicItemProperties_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Graphic item properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 399,247 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DialogGraphicItemProperties_base();
};
......
......@@ -821,7 +821,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_EDIT_TEXTMODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetCurItem(), &dc, pos );
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema();
break;
......@@ -944,9 +944,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
Delete_Drawings_All_Layer( (DRAWSEGMENT*) GetCurItem(), &dc );
if( GetCurItem()->m_Flags != 0 )
break;
Delete_Drawings_All_Layer( GetCurItem()->GetLayer() );
SetCurItem( NULL );
DrawPanel->MouseToCursorSchema();
DrawPanel->Refresh();
break;
case ID_POPUP_PCB_EDIT_DRAWING:
......
......@@ -115,7 +115,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
DisplayOpt.DisplayDrawItems = track_fill_copy;
SetCurItem( NULL );
}
else
else if( Segment->m_Flags == 0)
{
Segment->Draw( DrawPanel, DC, GR_XOR );
Segment->m_Flags = 0;
......@@ -128,24 +128,16 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
/******************************************************************************/
void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC )
void WinEDA_PcbFrame::Delete_Drawings_All_Layer( int aLayer )
/******************************************************************************/
{
int layer = Segment->GetLayer();
if( layer <= LAST_COPPER_LAYER )
if( aLayer <= LAST_COPPER_LAYER )
{
DisplayError( this, _( "Copper layer global delete not allowed!" ), 20 );
return;
}
if( Segment->m_Flags )
{
DisplayError( this, _( "Segment is being edited" ), 10 );
return;
}
wxString msg = _( "Delete Layer " ) + GetBoard()->GetLayerName( layer );
wxString msg = _( "Delete Layer " ) + GetBoard()->GetLayerName( aLayer );
if( !IsOK( this, msg ) )
return;
......@@ -162,9 +154,9 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_COTATION:
if( item->GetLayer() == layer )
case TYPE_MIRE:
if( item->GetLayer() == aLayer )
{
item->Draw( DrawPanel, DC, GR_XOR );
item->UnLink();
picker.m_PickedItem = item;
pickList.PushItem(picker);
......@@ -172,15 +164,19 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
break;
default:
DisplayError( this, wxT( "Type Drawing Inconnu" ) );
{
wxString msg;
msg.Printf( wxT("Delete_Drawings_All_Layer() error: unknown type %d"), item->Type());
wxMessageBox( msg );
break;
}
}
}
if( pickList.GetCount() )
{
GetScreen()->SetModify();
SaveCopyInUndoList(Segment, UR_DELETED);
SaveCopyInUndoList(pickList, UR_DELETED);
}
}
......
......@@ -7,33 +7,35 @@
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "gestfich.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "trigo.h"
#include "bitmaps.h"
#include "3d_struct.h"
#include "3d_viewer.h"
#include "dialog_edit_module.h"
#include "protos.h"
bool GoToEditor = FALSE;
#include "dialog_edit_module_for_BoardEditor.h"
/*******************************************************************/
void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC * DC )
void WinEDA_PcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
/*******************************************************************/
/* Fonction relai d'installation de la frame d'dition des proprietes
* du module*/
{
WinEDA_ModulePropertiesFrame* frame =
new WinEDA_ModulePropertiesFrame( this, Module, DC );
if( Module == NULL )
return;
frame->ShowModal(); frame->Destroy();
DIALOG_MODULE_BOARD_EDITOR* dialog =
new DIALOG_MODULE_BOARD_EDITOR( this, Module, DC );
int retvalue = dialog->ShowModal(); /* retvalue =
* -1 if abort,
* 0 if exchange module,
* 1 for normal edition
* and 2 for a goto editor command
*/
dialog->Destroy();
if( GoToEditor && GetScreen()->GetCurItem() )
if( retvalue == 2 )
{
if( m_ModuleEditFrame == NULL )
{
......@@ -43,10 +45,9 @@ void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC * DC )
wxSize( 600, 400 ) );
}
m_ModuleEditFrame->Load_Module_From_BOARD( (MODULE*) GetScreen()->GetCurItem() );
m_ModuleEditFrame->Load_Module_From_BOARD( Module );
SetCurItem( NULL );
GoToEditor = FALSE;
m_ModuleEditFrame->Show( TRUE );
m_ModuleEditFrame->Iconize( FALSE );
}
......@@ -59,30 +60,29 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod )
/*
* Repositionne l'ancre sous le curseur souris
* Le module doit etre d'abort selectionne
*/
{
wxPoint delta;
wxPoint moveVector;
EDA_BaseStruct* PtStruct;
D_PAD* pt_pad;
if( pt_mod == NULL )
return;
delta = pt_mod->m_Pos - GetScreen()->m_Curseur;
moveVector = pt_mod->m_Pos - GetScreen()->m_Curseur;
pt_mod->m_Pos = GetScreen()->m_Curseur;
/* Mise a jour des coord relatives des elements:
* les coordonnees relatives sont relatives a l'ancre, pour orient 0.
* il faut donc recalculer deltaX et deltaY en orientation 0 */
RotatePoint( &delta, -pt_mod->m_Orient );
RotatePoint( &moveVector, -pt_mod->m_Orient );
/* Mise a jour des coord relatives des pads */
pt_pad = (D_PAD*) pt_mod->m_Pads;
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{
pt_pad->m_Pos0 += delta;
pt_pad->m_Pos0 += moveVector;
}
/* Mise a jour des coord relatives contours .. */
......@@ -94,14 +94,14 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod )
case TYPE_EDGE_MODULE:
#undef STRUCT
#define STRUCT ( (EDGE_MODULE*) PtStruct )
STRUCT->m_Start0 += delta;
STRUCT->m_End0 += delta;
STRUCT->m_Start0 += moveVector;
STRUCT->m_End0 += moveVector;
break;
case TYPE_TEXTE_MODULE:
#undef STRUCT
#define STRUCT ( (TEXTE_MODULE*) PtStruct )
STRUCT->m_Pos0 += delta;
STRUCT->m_Pos0 += moveVector;
break;
default:
......
......@@ -22,7 +22,8 @@ static void ExitTextModule( WinEDA_DrawPanel* Panel, wxDC* DC );
/* local variables */
wxPoint MoveVector; // Move vector for move edge, exported to dialog_edit mod_text.cpp
static wxPoint CursorInitialPosition; // Mouse cursor inital position for move command
static wxPoint TextInitialPosition; // Mouse cursor inital position for undo/abort move command
static int TextInitialOrientation; // module text inital orientation for undo/abort move+rot command+rot
/******************************************************************************/
......@@ -39,6 +40,7 @@ TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC )
Text = new TEXTE_MODULE( Module );
/* Chainage de la nouvelle structure en tete de liste drawings */
if( Module )
Module->m_Drawings.PushFront( Text );
Text->m_Flags = IS_NEW;
......@@ -52,9 +54,11 @@ TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC )
Text->m_Pos = GetScreen()->m_Curseur;
Text->SetLocalCoord();
InstallTextModOptionsFrame( Text, NULL, wxPoint( -1, -1 ) );
InstallTextModOptionsFrame( Text, NULL );
DrawPanel->MouseToCursorSchema();
Text->m_Flags = 0;
if( DC )
Text->Draw( DrawPanel, DC, GR_OR );
Text->DisplayInfo( this );
......@@ -73,6 +77,12 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
MODULE* module = (MODULE*) Text->GetParent();
if( module && module->m_Flags == 0 && Text->m_Flags == 0 ) // simple rot command
{ // prepare undo command
if( this->m_Ident == PCB_FRAME )
SaveCopyInUndoList( module,UR_CHANGED );
}
// we expect MoveVector to be (0,0) if there is no move in progress
Text->Draw( DrawPanel, DC, GR_XOR, MoveVector );
......@@ -85,6 +95,7 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
Text->DisplayInfo( this );
if( module )
module->m_LastEdit_Time = time( NULL );
GetScreen()->SetModify();
}
......@@ -173,7 +184,8 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
MoveVector.x = MoveVector.y = 0;
CursorInitialPosition = Text->m_Pos;
TextInitialPosition = Text->m_Pos;
TextInitialOrientation = Text->m_Orient;
Text->DisplayInfo( this );
......@@ -190,7 +202,7 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
/*************************************************************************/
/* Routine complementaire a StartMoveTexteModule().
* Place le texte en cours de deplacement ou nouvellement cree
* Place le texte en cours de deplacement
*/
{
if( Text != NULL )
......@@ -202,18 +214,24 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
MODULE* Module = (MODULE*) Text->GetParent();
if( Module )
{
int px = Text->m_Pos.x - Module->m_Pos.x;
int py = Text->m_Pos.y - Module->m_Pos.y;
RotatePoint( &px, &py, -Module->m_Orient );
Text->m_Pos0.x = px;
Text->m_Pos0.y = py;
// Prepare undo command for Board Editor:
if( m_Ident == PCB_FRAME )
{
EXCHG(Text->m_Pos, TextInitialPosition);
EXCHG(Text->m_Orient, TextInitialOrientation);
SaveCopyInUndoList(Module, UR_CHANGED);
EXCHG(Text->m_Pos, TextInitialPosition);
EXCHG(Text->m_Orient, TextInitialOrientation);
}
wxPoint textRelPos = Text->m_Pos - Module->m_Pos;
RotatePoint( &textRelPos, -Module->m_Orient );
Text->m_Pos0 = textRelPos;
Text->m_Flags = 0;
Module->m_Flags = 0;
Module->m_LastEdit_Time = time( NULL );
GetScreen()->SetModify();
/* Redessin du Texte */
//Text->Draw( DrawPanel, DC, GR_OR );
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
}
}
......@@ -232,20 +250,16 @@ static void Show_MoveTexte_Module( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
{
BASE_SCREEN* screen = panel->GetScreen();
TEXTE_MODULE* Text = (TEXTE_MODULE*) screen->GetCurItem();
MODULE* Module;
if( Text == NULL )
return;
Module = (MODULE*) Text->GetParent();
/* effacement du texte : */
/* Undraw the text : */
if( erase )
Text->Draw( panel, DC, GR_XOR, MoveVector );
MoveVector.x = -(screen->m_Curseur.x - CursorInitialPosition.x);
MoveVector.y = -(screen->m_Curseur.y - CursorInitialPosition.y);
MoveVector = TextInitialPosition - screen->m_Curseur;
/* Redessin du Texte */
/* Redraw the text */
Text->Draw( panel, DC, GR_XOR, MoveVector );
}
......@@ -200,7 +200,7 @@ static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
}
else /* it is an existing item: retrieve initial values of parameters */
{
if( (MirePcb->m_Flags & IN_EDIT) )
if( (MirePcb->m_Flags & (IN_EDIT |IS_MOVED)) )
{
MirePcb->m_Pos = s_TargetCopy.m_Pos;
MirePcb->m_Width = s_TargetCopy.m_Width;
......
......@@ -17,6 +17,8 @@
#include "wxPcbStruct.h"
#include "protos.h"
#include "dialog_edit_module_for_modedit.h"
#include "collectors.h"
/****************************************************************************/
......@@ -396,10 +398,12 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_EDIT_MODULE_PROPERTIES:
if( GetBoard()->m_Modules )
{
SET_DC;
SetCurItem( GetBoard()->m_Modules );
InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(), &dc );
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) GetScreen()->GetCurItem() );
int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->m_Flags = 0;
if( ret > 0 )
DrawPanel->Refresh();
}
break;
......@@ -453,10 +457,13 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_MODULE:
{
SET_DC;
InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(), &dc );
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) GetScreen()->GetCurItem() );
int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->m_Flags = 0;
GetScreen()->GetCurItem()->m_Flags = 0;
DrawPanel->MouseToCursorSchema();
if( ret > 0 )
DrawPanel->Refresh();
}
break;
......@@ -504,9 +511,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_TEXTMODULE:
{
SET_DC;
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
&dc, pos );
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema();
}
break;
......@@ -522,8 +527,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
{
SET_DC;
RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
&dc );
RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema();
}
break;
......
......@@ -7,8 +7,10 @@
#include "class_drawpanel.h"
#include "confirm.h"
#include "3d_viewer.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "dialog_edit_module_for_modedit.h"
#include "bitmaps.h"
#include "protos.h"
......@@ -403,13 +405,19 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break;
case TYPE_MODULE:
InstallModuleOptionsFrame( (MODULE*) DrawStruct, &dc );
{
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) DrawStruct );
int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->m_Flags = 0;
GetScreen()->GetCurItem()->m_Flags = 0;
DrawPanel->MouseToCursorSchema();
if( ret > 0 )
DrawPanel->Refresh();
}
break;
case TYPE_TEXTE_MODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct,
&dc, pos );
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, &dc );
DrawPanel->MouseToCursorSchema();
break;
......
......@@ -400,7 +400,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break;
case TYPE_TEXTE_MODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, &dc, pos );
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, &dc );
DrawPanel->MouseToCursorSchema();
break;
......
......@@ -165,21 +165,22 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
createPopUpMenuForFpTexts( (TEXTE_MODULE*) item, aPopMenu );
break;
case TYPE_DRAWSEGMENT:
case TYPE_DRAWSEGMENT: // Some graphic items on technical layers
if( (flags & IS_NEW) )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING,
_( "End Drawing" ), apply_xpm );
}
if( !flags )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_DRAWING_REQUEST,
_( "Move Drawing" ), move_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DRAWING, _( "Edit Drawing" ), edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING, _( "Delete Drawing" ), delete_xpm );
if( item->GetLayer() > LAST_COPPER_LAYER )
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING_LAYER,
_( "Delete All Drawing on Layer" ), delete_body_xpm );
}
if( flags & IS_NEW )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING,
_( "End Drawing" ), apply_xpm );
}
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DRAWING,
_( "Edit Drawing" ), edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING,
_( "Delete Drawing" ), delete_xpm );
break;
case TYPE_ZONE: // Item used to fill a zone
......@@ -218,9 +219,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_COTATION,
_( "Edit Dimension" ), edit_xpm );
}
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_COTATION,
_( "Delete Dimension" ), delete_xpm );
}
break;
case TYPE_MIRE:
......@@ -228,11 +229,11 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST,
_( "Move Target" ), move_xpm );
}
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_MIRE,
_( "Edit Target" ), edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MIRE,
_( "Delete Target" ), delete_xpm );
}
break;
case TYPE_EDGE_MODULE:
......@@ -709,9 +710,11 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_EDIT_TEXTMODULE,
_( "Edit" ), edit_text_xpm );
if( FpText->m_Type == TEXT_is_DIVERS )
if( !flags && FpText->m_Type == TEXT_is_DIVERS ) // Graphic texts can be deleted only if are not currently edited
{
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE,
_( "Delete" ), delete_xpm );
}
if( !flags )
{
......
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