2007-08-24 15:10:46 +00:00
|
|
|
/*********************************************************************/
|
2009-09-04 18:57:37 +00:00
|
|
|
/* EESchema - symbdraw.cpp */
|
2007-08-24 15:10:46 +00:00
|
|
|
/* Create, move .. graphic shapes used to build and draw a component */
|
2009-09-04 18:57:37 +00:00
|
|
|
/* (lines, arcs .. */
|
2007-08-24 15:10:46 +00:00
|
|
|
/*********************************************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-01-29 14:26:20 +00:00
|
|
|
#include "gr_basic.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
#include "eeschema_id.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "program.h"
|
2010-10-23 10:09:23 +00:00
|
|
|
#include "general.h"
|
2010-02-16 16:21:52 +00:00
|
|
|
#include "libeditframe.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_libentry.h"
|
2009-10-20 19:36:58 +00:00
|
|
|
#include "dialog_lib_edit_draw_item.h"
|
2010-10-08 20:40:57 +00:00
|
|
|
#include "lib_arc.h"
|
|
|
|
#include "lib_circle.h"
|
|
|
|
#include "lib_polyline.h"
|
|
|
|
#include "lib_rectangle.h"
|
2010-10-22 12:11:52 +00:00
|
|
|
#include "lib_text.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
|
|
|
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-10-20 19:36:58 +00:00
|
|
|
/*
|
|
|
|
* Show the dialog box for editing a graphical item properties
|
2007-08-24 15:10:46 +00:00
|
|
|
*/
|
2009-10-20 19:36:58 +00:00
|
|
|
void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-10-20 19:36:58 +00:00
|
|
|
if( DrawItem == NULL )
|
2009-09-25 18:49:04 +00:00
|
|
|
return;
|
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
LIB_COMPONENT* component = DrawItem->GetParent();
|
2008-09-09 16:56:47 +00:00
|
|
|
|
2010-10-25 15:43:42 +00:00
|
|
|
DIALOG_LIB_EDIT_DRAW_ITEM dialog( this, DrawItem->GetTypeName() );
|
2008-09-09 16:56:47 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
dialog.SetWidthUnits( ReturnUnitSymbol( g_UserUnit ) );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-10-08 20:40:57 +00:00
|
|
|
wxString val = ReturnStringFromValue( g_UserUnit, m_drawLineWidth, m_InternalUnits );
|
2010-02-04 17:46:12 +00:00
|
|
|
dialog.SetWidth( val );
|
|
|
|
dialog.SetApplyToAllUnits( !m_drawSpecificUnit );
|
|
|
|
dialog.EnableApplyToAllUnits( component && component->GetPartCount() > 1 );
|
|
|
|
dialog.SetApplyToAllConversions( !m_drawSpecificConvert );
|
|
|
|
dialog.EnableApplyToAllConversions( component && component->HasConversion() );
|
2010-02-25 19:45:34 +00:00
|
|
|
// dialog.SetFillStyle( m_drawFillStyle ); // could better to show the current setting
|
2010-10-25 15:43:42 +00:00
|
|
|
dialog.SetFillStyle( DrawItem->GetFillMode() );
|
2010-02-04 17:46:12 +00:00
|
|
|
dialog.EnableFillStyle( DrawItem->IsFillable() );
|
|
|
|
|
|
|
|
if( dialog.ShowModal() == wxID_CANCEL )
|
2009-10-20 19:36:58 +00:00
|
|
|
return;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
val = dialog.GetWidth();
|
2010-10-08 20:40:57 +00:00
|
|
|
m_drawLineWidth = ReturnValueFromString( g_UserUnit, val, m_InternalUnits );
|
2010-02-04 17:46:12 +00:00
|
|
|
m_drawSpecificConvert = !dialog.GetApplyToAllConversions();
|
|
|
|
m_drawSpecificUnit = !dialog.GetApplyToAllUnits();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-02-25 19:45:34 +00:00
|
|
|
#if 0
|
|
|
|
/* TODO: see if m_drawFillStyle must retain the last fill option or not.
|
|
|
|
* if the last is Filled, having next new graphic items created
|
|
|
|
* with filled body is often bad.
|
2010-10-23 10:09:23 +00:00
|
|
|
* currently m_drawFillStyle is left with the default value (not filled)
|
2010-02-25 19:45:34 +00:00
|
|
|
*/
|
2009-10-20 19:36:58 +00:00
|
|
|
if( DrawItem->IsFillable() )
|
2010-02-04 17:46:12 +00:00
|
|
|
m_drawFillStyle = (FILL_T) dialog.GetFillStyle();
|
2010-02-25 19:45:34 +00:00
|
|
|
#endif
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2010-10-23 10:09:23 +00:00
|
|
|
// Save copy for undo if not in edit (edit command already handle the save copy)
|
2010-10-23 13:49:14 +00:00
|
|
|
if( !DrawItem->InEditMode() )
|
2009-10-20 19:36:58 +00:00
|
|
|
SaveCopyInUndoList( DrawItem->GetParent() );
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2009-10-20 19:36:58 +00:00
|
|
|
if( m_drawSpecificUnit )
|
2010-10-25 15:43:42 +00:00
|
|
|
DrawItem->SetUnit( GetUnit() );
|
2009-10-20 19:36:58 +00:00
|
|
|
else
|
2010-10-25 15:43:42 +00:00
|
|
|
DrawItem->SetUnit( 0 );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-10-20 19:36:58 +00:00
|
|
|
if( m_drawSpecificConvert )
|
2010-10-25 15:43:42 +00:00
|
|
|
DrawItem->SetConvert( GetConvert() );
|
2009-10-20 19:36:58 +00:00
|
|
|
else
|
2010-10-25 15:43:42 +00:00
|
|
|
DrawItem->SetConvert( 0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-10-20 19:36:58 +00:00
|
|
|
if( DrawItem->IsFillable() )
|
2010-10-25 15:43:42 +00:00
|
|
|
DrawItem->SetFillMode( (FILL_T) dialog.GetFillStyle() );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-10-20 19:36:58 +00:00
|
|
|
DrawItem->SetWidth( m_drawLineWidth );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-10-20 19:36:58 +00:00
|
|
|
if( component )
|
|
|
|
component->GetDrawItemList().sort();
|
2010-02-18 20:07:29 +00:00
|
|
|
OnModify( );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-10-20 19:36:58 +00:00
|
|
|
DrawItem->DisplayInfo( this );
|
|
|
|
DrawPanel->Refresh();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-02-04 17:46:12 +00:00
|
|
|
WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) Panel->GetParent();
|
2010-10-20 20:24:26 +00:00
|
|
|
LIB_DRAW_ITEM* item = parent->GetDrawItem();
|
2009-09-25 18:49:04 +00:00
|
|
|
|
|
|
|
if( item == NULL )
|
|
|
|
return;
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
Panel->ManageCurseur = NULL;
|
2007-08-24 15:10:46 +00:00
|
|
|
Panel->ForceCloseManageCurseur = NULL;
|
|
|
|
|
2010-10-23 10:09:23 +00:00
|
|
|
bool newItem = item->IsNew();
|
2010-10-20 20:24:26 +00:00
|
|
|
item->EndEdit( parent->GetScreen()->GetCursorDrawPosition(), true );
|
|
|
|
|
2010-10-23 10:09:23 +00:00
|
|
|
if( newItem )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2010-10-23 10:09:23 +00:00
|
|
|
delete item;
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
2010-10-23 10:09:23 +00:00
|
|
|
else
|
|
|
|
parent->RestoreComponent();
|
2010-03-28 14:46:49 +00:00
|
|
|
|
2010-10-23 13:49:14 +00:00
|
|
|
parent->SetDrawItem( NULL );
|
2010-10-20 20:24:26 +00:00
|
|
|
Panel->Refresh();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-08 20:40:57 +00:00
|
|
|
LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-24 15:10:46 +00:00
|
|
|
DrawPanel->ManageCurseur = SymbolDisplayDraw;
|
|
|
|
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn;
|
2010-10-20 20:24:26 +00:00
|
|
|
wxPoint drawPos = GetScreen()->GetCursorDrawPosition();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-10-23 13:49:14 +00:00
|
|
|
// no temp copy -> the current version of component will be used for Undo
|
|
|
|
// This is normal when adding new items to the current component
|
|
|
|
ClearTempCopyComponent();
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
switch( m_ID_current_state )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
case ID_LIBEDIT_BODY_ARC_BUTT:
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2010-10-20 20:24:26 +00:00
|
|
|
m_drawItem = new LIB_ARC( LibEntry );
|
|
|
|
break;
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
2009-09-25 18:49:04 +00:00
|
|
|
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
|
2010-10-20 20:24:26 +00:00
|
|
|
m_drawItem = new LIB_CIRCLE( LibEntry );
|
|
|
|
break;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
case ID_LIBEDIT_BODY_RECT_BUTT:
|
2010-10-20 20:24:26 +00:00
|
|
|
m_drawItem = new LIB_RECTANGLE( LibEntry );
|
|
|
|
break;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
case ID_LIBEDIT_BODY_LINE_BUTT:
|
2010-10-20 20:24:26 +00:00
|
|
|
m_drawItem = new LIB_POLYLINE( LibEntry );
|
|
|
|
break;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
case ID_LIBEDIT_BODY_TEXT_BUTT:
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
LIB_TEXT* Text = new LIB_TEXT( LibEntry );
|
2010-02-04 17:46:12 +00:00
|
|
|
Text->m_Size.x = Text->m_Size.y = m_textSize;
|
|
|
|
Text->m_Orient = m_textOrientation;
|
2010-01-13 13:43:36 +00:00
|
|
|
|
2009-12-29 10:35:11 +00:00
|
|
|
// Enter the graphic text info
|
|
|
|
DrawPanel->m_IgnoreMouseEvents = true;
|
2007-08-24 15:10:46 +00:00
|
|
|
EditSymbolText( NULL, Text );
|
2009-12-29 10:35:11 +00:00
|
|
|
DrawPanel->m_IgnoreMouseEvents = false;
|
2010-10-23 13:49:14 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
2010-01-13 13:43:36 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
if( Text->m_Text.IsEmpty() )
|
|
|
|
{
|
2010-10-23 13:49:14 +00:00
|
|
|
delete Text;
|
2009-09-25 18:49:04 +00:00
|
|
|
m_drawItem = NULL;
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-20 20:24:26 +00:00
|
|
|
m_drawItem = Text;
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
2010-10-20 20:24:26 +00:00
|
|
|
break;
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
2009-09-25 18:49:04 +00:00
|
|
|
default:
|
2010-04-06 14:09:52 +00:00
|
|
|
DisplayError( this, wxT( "WinEDA_LibeditFrame::CreateGraphicItem() error" ) );
|
2009-09-25 18:49:04 +00:00
|
|
|
return NULL;
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
if( m_drawItem )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2010-10-20 20:24:26 +00:00
|
|
|
m_drawItem->BeginEdit( IS_NEW, drawPos );
|
|
|
|
m_drawItem->SetWidth( m_drawLineWidth );
|
2010-10-25 15:43:42 +00:00
|
|
|
m_drawItem->SetFillMode( m_drawFillStyle );
|
2010-10-20 20:24:26 +00:00
|
|
|
|
2009-10-19 19:00:47 +00:00
|
|
|
if( m_drawSpecificUnit )
|
2010-10-25 15:43:42 +00:00
|
|
|
m_drawItem->SetUnit( m_unit );
|
2009-10-19 19:00:47 +00:00
|
|
|
if( m_drawSpecificConvert )
|
2010-10-25 15:43:42 +00:00
|
|
|
m_drawItem->SetConvert( m_convert );
|
2010-10-20 20:24:26 +00:00
|
|
|
|
2010-10-23 13:49:14 +00:00
|
|
|
// Draw initial symbol:
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, false );
|
2010-10-20 20:24:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
|
|
|
return NULL;
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
return m_drawItem;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
/* Create new library component graphic object.
|
2007-08-24 15:10:46 +00:00
|
|
|
*/
|
2009-09-29 18:38:21 +00:00
|
|
|
void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
if( m_drawItem == NULL )
|
2007-08-24 15:10:46 +00:00
|
|
|
return;
|
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
wxPoint pos = GetScreen()->GetCursorDrawPosition();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
if( m_drawItem->ContinueEdit( pos ) )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2010-10-20 20:24:26 +00:00
|
|
|
m_drawItem->Draw( DrawPanel, DC, pos, -1, g_XorMode, NULL, DefaultTransform );
|
|
|
|
return;
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
EndDrawGraphicItem( DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
/*
|
2009-11-04 20:46:53 +00:00
|
|
|
* Redraw the graphic shape while moving
|
2009-09-25 18:49:04 +00:00
|
|
|
*/
|
2010-04-06 14:09:52 +00:00
|
|
|
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
LIB_DRAW_ITEM* item;
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
item = ( (WinEDA_LibeditFrame*) panel->GetParent() )->GetDrawItem();
|
2009-09-25 18:49:04 +00:00
|
|
|
|
|
|
|
if( item == NULL )
|
|
|
|
return;
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
BASE_SCREEN* Screen = panel->GetScreen();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-10-23 10:09:23 +00:00
|
|
|
item->SetEraseLastDrawItem( erase );
|
2010-10-20 20:24:26 +00:00
|
|
|
item->Draw( panel, DC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL,
|
|
|
|
DefaultTransform );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
if( m_drawItem == NULL )
|
2007-08-24 15:10:46 +00:00
|
|
|
return;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
SetCursor( wxCURSOR_HAND );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-10-25 15:43:42 +00:00
|
|
|
if( m_drawItem->GetUnit() != m_unit )
|
|
|
|
m_drawItem->SetUnit( m_unit );
|
2010-10-20 20:24:26 +00:00
|
|
|
|
2010-10-23 10:09:23 +00:00
|
|
|
TempCopyComponent();
|
2010-10-20 20:24:26 +00:00
|
|
|
m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCursorDrawPosition() );
|
2007-08-24 15:10:46 +00:00
|
|
|
DrawPanel->ManageCurseur = RedrawWhileMovingCursor;
|
|
|
|
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn;
|
2010-10-20 20:24:26 +00:00
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, true );
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
// @brief Modify a graphic symbol (drag edges etc.)
|
|
|
|
void WinEDA_LibeditFrame::StartModifyDrawSymbol( wxDC* DC )
|
|
|
|
{
|
|
|
|
if( m_drawItem == NULL )
|
|
|
|
return;
|
|
|
|
|
2010-10-23 10:09:23 +00:00
|
|
|
TempCopyComponent();
|
2010-10-20 20:24:26 +00:00
|
|
|
m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCursorDrawPosition() );
|
2010-02-04 17:46:12 +00:00
|
|
|
DrawPanel->ManageCurseur = SymbolDisplayDraw;
|
|
|
|
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn;
|
2010-10-20 20:24:26 +00:00
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, true );
|
2010-02-04 17:46:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! @brief Manage mouse events when creating new graphic object or modifying an graphic object.
|
2007-08-24 15:10:46 +00:00
|
|
|
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-02-04 17:46:12 +00:00
|
|
|
BASE_SCREEN* Screen = panel->GetScreen();
|
2010-10-20 20:24:26 +00:00
|
|
|
LIB_DRAW_ITEM* item = ( (WinEDA_LibeditFrame*) panel->GetParent() )->GetDrawItem();
|
2009-09-25 18:49:04 +00:00
|
|
|
|
|
|
|
if( item == NULL )
|
|
|
|
return;
|
|
|
|
|
2010-10-23 13:49:14 +00:00
|
|
|
item->SetEraseLastDrawItem( erase );
|
2010-10-20 20:24:26 +00:00
|
|
|
item->Draw( panel, DC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL,
|
|
|
|
DefaultTransform );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
/*
|
2010-10-23 13:49:14 +00:00
|
|
|
* Place the new graphic object in the list of component drawing objects,
|
|
|
|
* or terminate a draw item edition
|
2007-08-24 15:10:46 +00:00
|
|
|
*/
|
2009-09-29 18:38:21 +00:00
|
|
|
void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
if( m_component == NULL || m_drawItem == NULL )
|
2007-08-24 15:10:46 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if( m_ID_current_state )
|
|
|
|
SetCursor( wxCURSOR_PENCIL );
|
|
|
|
else
|
|
|
|
SetCursor( wxCURSOR_ARROW );
|
|
|
|
|
2010-10-23 13:49:14 +00:00
|
|
|
if( GetTempCopyComponent() ) // used when editing an existing item
|
|
|
|
SaveCopyInUndoList( GetTempCopyComponent() );
|
|
|
|
else // When creating a new item, there is still no change for the current component
|
|
|
|
// So save it.
|
|
|
|
SaveCopyInUndoList( m_component );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
if( m_drawItem->IsNew() )
|
|
|
|
m_component->AddDrawItem( m_drawItem );
|
|
|
|
|
|
|
|
m_drawItem->EndEdit( GetScreen()->GetCursorDrawPosition() );
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
m_drawItem = NULL;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
OnModify();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
2010-10-20 20:24:26 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|