eeclass.cpp.notused 3.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/**********************************************************/
/*	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"


/************************************************************/
18
void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
19 20
/************************************************************/
{
21
    switch( Struct->Type() )
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
    {
    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;
    }
44 45
}

46

47
/*************************************************************/
48
void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
49 50
/*************************************************************/
{
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
    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
67 68 69
}


70 71 72 73
/**************************************************/
/* 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 */
74 75

/* Constructeur de SCREEN */
76 77
SCH_SCREEN::SCH_SCREEN( EDA_BaseStruct* parent, WinEDA_DrawFrame* frame_source, int idtype ) :
    BASE_SCREEN( parent, frame_source, idtype )
78
{
79 80 81 82 83 84
    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;
85 86
}

87

88
/****************************/
89
SCH_SCREEN::~SCH_SCREEN()
90 91
/****************************/
{
92 93
    ClearUndoRedoList();
    FreeDrawList();
94 95
}

96

97
/*************************************/
98
SCH_SCREEN* SCH_SCREEN::GenCopy()
99 100 101
/*************************************/
{
// TODO
102
    return NULL;
103 104
}

105

106
/***********************************/
107
void SCH_SCREEN::FreeDrawList()
108
/***********************************/
109

110
/* Routine to clear EESchema drawing list of a screen.
111
 */
112
{
113 114 115 116 117 118 119 120
    EDA_BaseStruct* DrawStruct;

    while( EEDrawList != NULL )
    {
        DrawStruct = EEDrawList;
        EEDrawList = EEDrawList->Pnext;
        delete DrawStruct;
    }
121
}