2007-09-13 11:28:58 +00:00
|
|
|
/*********************************************************************/
|
2009-06-26 12:52:24 +00:00
|
|
|
/* EESchema */
|
2007-09-13 11:28:58 +00:00
|
|
|
/* edit_label.cpp: label, global label and text creation or edition */
|
|
|
|
/*********************************************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "common.h"
|
2009-05-30 16:06:01 +00:00
|
|
|
#include "base_struct.h"
|
|
|
|
#include "drawtxt.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "class_sch_screen.h"
|
|
|
|
#include "wxEeschemaStruct.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "general.h"
|
|
|
|
#include "protos.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_text.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase );
|
2011-01-21 19:30:59 +00:00
|
|
|
static void ExitMoveTexte( EDA_DRAW_PANEL* panel, wxDC* DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
static wxPoint ItemInitialPosition;
|
2007-08-20 01:20:48 +00:00
|
|
|
static int OldOrient;
|
|
|
|
static wxSize OldSize;
|
2010-03-16 18:22:59 +00:00
|
|
|
static int lastGlobalLabelShape = (int) NET_INPUT;
|
|
|
|
static int lastTextOrientation = 0;
|
|
|
|
static bool lastTextBold = false;
|
|
|
|
static bool lastTextItalic = false;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( TextStruct == NULL )
|
|
|
|
return;
|
|
|
|
|
2011-01-12 21:47:54 +00:00
|
|
|
m_itemToRepeat = NULL;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
if( !TextStruct->IsNew() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
delete g_ItemToUndoCopy;
|
2010-12-21 15:13:09 +00:00
|
|
|
g_ItemToUndoCopy = TextStruct->Clone();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TextStruct->m_Flags |= IS_MOVED;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( TextStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
|
|
|
case SCH_TEXT_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
ItemInitialPosition = TextStruct->m_Pos;
|
|
|
|
OldSize = TextStruct->m_Size;
|
2009-05-12 12:12:34 +00:00
|
|
|
OldOrient = TextStruct->GetSchematicTextOrientation();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOff( DC );
|
|
|
|
GetScreen()->SetCrossHairPosition( ItemInitialPosition );
|
|
|
|
DrawPanel->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-02-18 20:07:29 +00:00
|
|
|
OnModify( );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->SetMouseCapture( ShowWhileMoving,ExitMoveTexte );
|
2008-03-20 01:50:21 +00:00
|
|
|
GetScreen()->SetCurItem( TextStruct );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOn( DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( TextStruct == NULL )
|
2011-02-11 20:48:13 +00:00
|
|
|
TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->GetCrossHairPosition(),
|
2011-01-25 14:06:17 +00:00
|
|
|
GetScreen(), TEXT_T | LABEL_T );
|
2007-08-20 01:20:48 +00:00
|
|
|
if( TextStruct == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* save old text in undo list if is not already in edit */
|
|
|
|
if( TextStruct->m_Flags == 0 )
|
2009-07-26 17:16:42 +00:00
|
|
|
SaveCopyInUndoList( TextStruct, UR_CHANGED );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-11-02 20:36:20 +00:00
|
|
|
/* Erase old text */
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOff( DC );
|
2011-01-10 16:50:40 +00:00
|
|
|
TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-05-12 12:12:34 +00:00
|
|
|
int orient;
|
2009-06-26 12:52:24 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( TextStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
|
|
|
case SCH_TEXT_T:
|
2009-06-26 12:52:24 +00:00
|
|
|
orient = TextStruct->GetSchematicTextOrientation() + 1;
|
2009-05-12 12:12:34 +00:00
|
|
|
orient &= 3;
|
|
|
|
TextStruct->SetSchematicTextOrientation( orient );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-02-18 20:07:29 +00:00
|
|
|
OnModify( );
|
2011-01-10 16:50:40 +00:00
|
|
|
TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOn( DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Routine to create new text struct (GraphicText, label or Glabel).
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
|
2009-12-06 18:04:41 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_TEXT* NewText = NULL;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-01-12 21:47:54 +00:00
|
|
|
m_itemToRepeat = NULL;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
switch( type )
|
|
|
|
{
|
|
|
|
case LAYER_NOTES:
|
2011-02-11 20:48:13 +00:00
|
|
|
NewText = new SCH_TEXT( GetScreen()->GetCrossHairPosition() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LAYER_LOCLABEL:
|
2011-02-11 20:48:13 +00:00
|
|
|
NewText = new SCH_LABEL( GetScreen()->GetCrossHairPosition() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
case LAYER_HIERLABEL:
|
2011-02-11 20:48:13 +00:00
|
|
|
NewText = new SCH_HIERLABEL( GetScreen()->GetCrossHairPosition() );
|
2010-03-16 18:22:59 +00:00
|
|
|
NewText->m_Shape = lastGlobalLabelShape;
|
2008-02-12 21:12:46 +00:00
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case LAYER_GLOBLABEL:
|
2011-02-11 20:48:13 +00:00
|
|
|
NewText = new SCH_GLOBALLABEL( GetScreen()->GetCrossHairPosition() );
|
2010-03-16 18:22:59 +00:00
|
|
|
NewText->m_Shape = lastGlobalLabelShape;
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-12-08 20:12:46 +00:00
|
|
|
DisplayError( this, wxT( "SCH_EDIT_FRAME::CreateNewText() Internal error" ) );
|
2007-09-13 11:28:58 +00:00
|
|
|
return NULL;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
NewText->m_Bold = lastTextBold;
|
|
|
|
NewText->m_Italic = lastTextItalic;
|
|
|
|
NewText->SetSchematicTextOrientation( lastTextOrientation );
|
2007-09-13 11:28:58 +00:00
|
|
|
NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize;
|
|
|
|
NewText->m_Flags = IS_NEW | IS_MOVED;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-01-10 16:50:40 +00:00
|
|
|
NewText->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
|
2009-12-27 14:01:21 +00:00
|
|
|
EditSchematicText( NewText );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
if( NewText->m_Text.IsEmpty() )
|
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
SAFE_DELETE( NewText );
|
2007-08-20 01:20:48 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
lastTextBold = NewText->m_Bold;
|
|
|
|
lastTextItalic = NewText->m_Italic;
|
|
|
|
lastTextOrientation = NewText->GetSchematicTextOrientation();
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-03-16 18:22:59 +00:00
|
|
|
lastGlobalLabelShape = NewText->m_Shape;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-01-10 16:50:40 +00:00
|
|
|
NewText->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->SetMouseCapture( ShowWhileMoving, ExitMoveTexte );
|
2008-03-20 01:50:21 +00:00
|
|
|
GetScreen()->SetCurItem( NewText );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
return NewText;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
/************************************/
|
2007-09-19 15:29:50 +00:00
|
|
|
/* Redraw a Text while moving */
|
2007-09-13 11:28:58 +00:00
|
|
|
/************************************/
|
2011-02-03 19:27:28 +00:00
|
|
|
static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-02-03 19:27:28 +00:00
|
|
|
SCH_ITEM* TextStruct = (SCH_ITEM*) aPanel->GetScreen()->GetCurItem();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-09-19 15:29:50 +00:00
|
|
|
/* "Undraw" the current text at its old position*/
|
2011-02-03 19:27:28 +00:00
|
|
|
if( aErase )
|
|
|
|
TextStruct->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-09-19 15:29:50 +00:00
|
|
|
/* redraw the text */
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( TextStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
|
|
|
case SCH_TEXT_T:
|
2011-02-11 20:48:13 +00:00
|
|
|
( (SCH_TEXT*) TextStruct )->m_Pos = aPanel->GetScreen()->GetCrossHairPosition();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
TextStruct->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
/* Abort function for the command move text */
|
2011-01-21 19:30:59 +00:00
|
|
|
static void ExitMoveTexte( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
2009-11-03 13:26:31 +00:00
|
|
|
{
|
2009-06-26 12:52:24 +00:00
|
|
|
BASE_SCREEN* screen = Panel->GetScreen();
|
|
|
|
SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem();
|
2011-01-12 21:47:54 +00:00
|
|
|
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-01-12 21:47:54 +00:00
|
|
|
parent->SetRepeatItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-09-19 15:29:50 +00:00
|
|
|
if( Struct == NULL ) /* no current item */
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
/* "Undraw" the text, and delete it if new (i.e. it was being just
|
|
|
|
* created)*/
|
2011-01-10 16:50:40 +00:00
|
|
|
Struct->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
if( Struct->IsNew() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
SAFE_DELETE( Struct );
|
2007-08-20 01:20:48 +00:00
|
|
|
screen->SetCurItem( NULL );
|
|
|
|
}
|
2009-11-03 13:26:31 +00:00
|
|
|
else /* this was a move command on "old" text: restore its old settings. */
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( Struct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
|
|
|
case SCH_TEXT_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_TEXT* Text = (SCH_TEXT*) Struct;
|
2009-06-26 12:52:24 +00:00
|
|
|
Text->m_Pos = ItemInitialPosition;
|
|
|
|
Text->m_Size = OldSize;
|
2009-05-12 12:12:34 +00:00
|
|
|
Text->SetSchematicTextOrientation( OldOrient );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2009-06-26 12:52:24 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-01-10 16:50:40 +00:00
|
|
|
Struct->Draw( Panel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
2007-08-20 01:20:48 +00:00
|
|
|
Struct->m_Flags = 0;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-11-26 11:55:34 +00:00
|
|
|
/* Routine to change a text type to an other one (GraphicText, label or Glabel).
|
|
|
|
* A new test, label or hierarchical or global label is created from the old text.
|
2007-09-13 11:28:58 +00:00
|
|
|
* the old text is deleted
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
|
2010-03-16 18:22:59 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( Text == NULL )
|
|
|
|
return;
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_TEXT* newtext;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
switch( newtype )
|
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LABEL_T:
|
2008-03-20 01:50:21 +00:00
|
|
|
newtext = new SCH_LABEL( Text->m_Pos, Text->m_Text );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_GLOBAL_LABEL_T:
|
2008-04-14 19:22:48 +00:00
|
|
|
newtext = new SCH_GLOBALLABEL( Text->m_Pos, Text->m_Text );
|
2008-03-20 01:50:21 +00:00
|
|
|
break;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
2008-04-14 19:22:48 +00:00
|
|
|
newtext = new SCH_HIERLABEL( Text->m_Pos, Text->m_Text );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_TEXT_T:
|
2008-03-20 01:50:21 +00:00
|
|
|
newtext = new SCH_TEXT( Text->m_Pos, Text->m_Text );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2007-09-13 11:28:58 +00:00
|
|
|
newtext = NULL;
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, wxT( "ConvertTextType: Internal error" ) );
|
2007-09-13 11:28:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-06-26 12:52:24 +00:00
|
|
|
/* copy the old text settings
|
|
|
|
* Justifications are not copied because they are not used in labels,
|
|
|
|
* and can be used in texts
|
|
|
|
* So they will be set to default in conversion.
|
|
|
|
*/
|
|
|
|
newtext->m_Shape = Text->m_Shape;
|
2009-05-12 12:12:34 +00:00
|
|
|
newtext->SetSchematicTextOrientation( Text->GetSchematicTextOrientation() );
|
2009-06-26 12:52:24 +00:00
|
|
|
newtext->m_Size = Text->m_Size;
|
2010-11-27 13:09:18 +00:00
|
|
|
newtext->m_Thickness = Text->m_Thickness;
|
2009-06-26 12:52:24 +00:00
|
|
|
newtext->m_Italic = Text->m_Italic;
|
|
|
|
newtext->m_Bold = Text->m_Bold;
|
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
|
|
|
|
// save current text flag:
|
|
|
|
int flags = Text->m_Flags;
|
|
|
|
|
|
|
|
/* add the new text in linked list if old text is in list */
|
|
|
|
if( (flags & IS_NEW) == 0 )
|
|
|
|
{
|
2010-12-08 20:12:46 +00:00
|
|
|
newtext->SetNext( GetScreen()->GetDrawItems() );
|
|
|
|
GetScreen()->SetDrawItems( newtext );
|
|
|
|
OnModify();
|
2007-09-13 11:28:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* now delete the old text
|
2011-02-11 20:48:13 +00:00
|
|
|
* If it is a text flagged IS_NEW it will be deleted by m_endMouseCaptureCallback()
|
2007-09-13 11:28:58 +00:00
|
|
|
* If not, we must delete it.
|
|
|
|
*/
|
2011-02-11 20:48:13 +00:00
|
|
|
if( DrawPanel->m_mouseCaptureCallback && DrawPanel->m_endMouseCaptureCallback )
|
2007-09-13 11:28:58 +00:00
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC );
|
2007-09-13 11:28:58 +00:00
|
|
|
}
|
2010-11-26 11:55:34 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
if( (flags & IS_NEW) == 0 ) // Remove old text from current list and
|
|
|
|
// save it in undo list
|
2007-09-13 11:28:58 +00:00
|
|
|
{
|
|
|
|
Text->m_Flags = 0;
|
2009-11-03 13:26:31 +00:00
|
|
|
DeleteStruct( DrawPanel, DC, Text ); // old text is really saved in
|
|
|
|
// undo list
|
2008-03-20 01:50:21 +00:00
|
|
|
GetScreen()->SetCurItem( NULL );
|
2011-01-12 21:47:54 +00:00
|
|
|
m_itemToRepeat = NULL;
|
2007-09-13 11:28:58 +00:00
|
|
|
}
|
2008-02-21 15:50:35 +00:00
|
|
|
|
|
|
|
GetScreen()->SetCurItem( NULL );
|
2007-09-13 11:28:58 +00:00
|
|
|
|
2010-11-26 11:55:34 +00:00
|
|
|
delete g_ItemToUndoCopy;
|
|
|
|
g_ItemToUndoCopy = NULL;
|
2007-09-13 11:28:58 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOff( DC ); // Erase schematic cursor
|
2007-09-13 11:28:58 +00:00
|
|
|
|
2010-11-26 11:55:34 +00:00
|
|
|
/* Save the new text in undo list if the old text was not itself a "new created text"
|
|
|
|
* In this case, the old text is already in undo list as a deleted item.
|
2009-11-03 13:26:31 +00:00
|
|
|
* Of course if the old text was a "new created text" the new text will be
|
2010-11-26 11:55:34 +00:00
|
|
|
* put in undo list later, at the end of the current command (if not aborted)
|
2007-09-13 11:28:58 +00:00
|
|
|
*/
|
|
|
|
if( (flags & IS_NEW) == 0 )
|
|
|
|
{
|
2009-07-26 17:16:42 +00:00
|
|
|
SaveCopyInUndoList( newtext, UR_NEW );
|
2007-09-13 11:28:58 +00:00
|
|
|
}
|
|
|
|
else
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
|
|
|
GetScreen()->SetCurItem( newtext );
|
2007-09-13 11:28:58 +00:00
|
|
|
newtext->m_Flags = IS_NEW;
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
2007-09-13 11:28:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
if( (flags & IS_MOVED) != 0 )
|
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
GetScreen()->SetCurItem( newtext );
|
2007-09-13 11:28:58 +00:00
|
|
|
StartMoveTexte( newtext, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-01-10 16:50:40 +00:00
|
|
|
newtext->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOn( DC ); // redraw schematic cursor
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|