2007-06-05 12:10:51 +00:00
|
|
|
/**********************************************************/
|
|
|
|
/* EECLASS.CPP */
|
|
|
|
/* fonctions relatives aux classes definies dans EESCHEMA */
|
|
|
|
/**********************************************************/
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "program.h"
|
|
|
|
#include "libcmp.h"
|
|
|
|
#include "general.h"
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
|
2007-06-05 12:10:51 +00:00
|
|
|
/************************************************************/
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( Struct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
|
|
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
|
|
|
case DRAW_TEXT_STRUCT_TYPE:
|
|
|
|
case DRAW_LABEL_STRUCT_TYPE:
|
|
|
|
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
|
|
|
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
|
|
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
|
|
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
|
|
|
case DRAW_SHEET_STRUCT_TYPE:
|
|
|
|
case DRAW_MARKER_STRUCT_TYPE:
|
|
|
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
|
|
|
Struct->m_Parent = Screen;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAW_SHEETLABEL_STRUCT_TYPE:
|
|
|
|
case DRAW_PICK_ITEM_STRUCT_TYPE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************************/
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( m_Flags & IS_NEW )
|
|
|
|
{
|
|
|
|
Pnext = frame->m_CurrentScreen->EEDrawList;
|
|
|
|
frame->m_CurrentScreen->EEDrawList = this;
|
|
|
|
g_ItemToRepeat = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_Flags = 0;
|
|
|
|
SetFlagModify( frame->GetScreen() );
|
|
|
|
frame->GetScreen()->SetCurItem( NULL );
|
|
|
|
frame->DrawPanel->ManageCurseur = NULL;
|
|
|
|
frame->DrawPanel->ForceCloseManageCurseur = NULL;
|
|
|
|
|
|
|
|
frame->DrawPanel->CursorOff( DC ); // Erase schematic cursor
|
|
|
|
RedrawOneStruct( frame->DrawPanel, DC, this, GR_DEFAULT_DRAWMODE );
|
|
|
|
frame->DrawPanel->CursorOn( DC ); // Display schematic cursor
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
/**************************************************/
|
|
|
|
/* Class SCH_SCREEN: classe de gestion d'un affichage pour schematique */
|
|
|
|
/***************************************************/
|
|
|
|
static int table_zoom[] = { 1, 2, 4, 8, 16, 32, 64, 128, 0 }; /* Valeurs standards du zoom */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Constructeur de SCREEN */
|
2007-08-20 01:20:48 +00:00
|
|
|
SCH_SCREEN::SCH_SCREEN( EDA_BaseStruct* parent, WinEDA_DrawFrame* frame_source, int idtype ) :
|
|
|
|
BASE_SCREEN( parent, frame_source, idtype )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
EEDrawList = NULL; /* Schematic items list */
|
|
|
|
m_Zoom = 32;
|
|
|
|
m_Grid = wxSize( 50, 50 ); /* pas de la grille */
|
|
|
|
SetZoomList( table_zoom );
|
|
|
|
SetGridList( g_GridList );
|
|
|
|
m_UndoRedoCountMax = 10;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/****************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
SCH_SCREEN::~SCH_SCREEN()
|
2007-06-05 12:10:51 +00:00
|
|
|
/****************************/
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
ClearUndoRedoList();
|
|
|
|
FreeDrawList();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
SCH_SCREEN* SCH_SCREEN::GenCopy()
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************/
|
|
|
|
{
|
|
|
|
// TODO
|
2007-08-20 01:20:48 +00:00
|
|
|
return NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/***********************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
void SCH_SCREEN::FreeDrawList()
|
2007-06-05 12:10:51 +00:00
|
|
|
/***********************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Routine to clear EESchema drawing list of a screen.
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
EDA_BaseStruct* DrawStruct;
|
|
|
|
|
|
|
|
while( EEDrawList != NULL )
|
|
|
|
{
|
|
|
|
DrawStruct = EEDrawList;
|
|
|
|
EEDrawList = EEDrawList->Pnext;
|
|
|
|
delete DrawStruct;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|