GetScreen() work, menu capitalization, beautifying

This commit is contained in:
dickelbeck 2008-04-17 16:25:29 +00:00
parent 25d0403221
commit 721d878fcf
95 changed files with 3356 additions and 2832 deletions

View File

@ -5,18 +5,33 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Apr-17 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+all
* Made a little more sense out of the GetScreen() problem by making it
non-virtual, and having the two types of frame classes (eeschema's and pcbnew's)
each return their respective types of screens {SCH,PCB}_SCREEN*.
* Added GetBaseScreen() as the virtual function which always returns BASE_SCREEN*.
* Made WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint Mouse ){ dummy }
* Added WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint Mouse );
* Moved to void <class>::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) from
void <class>::Place( WinEDA_DrawFrame* frame, wxDC* DC ) so that these
functions can use the new SCH_SCREEN* WinEDA_SchematicFrame::GetScreen()
function (the non-virtual one that returns SCH_SCREEN* not BASE_SCREEN*).
* Made some menus conformant to UIpolicies.txt regarding uppercase.
* Beautified 5-10 files.
2008-Apr-17 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Apr-17 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+eeschema +eeschema
very small bug in display component info removed very small bug in display component info removed
+pcbnew +pcbnew
+cvpcb +cvpcb
removed bug: forgotten paths when adding lib files when not in the default lib path removed bug: forgotten paths when adding lib files when not in the default lib path
(same problem as in eeschema, solved in 2008-Apr-09 Update) (same problem as in eeschema, solved in 2008-Apr-09 Update)
2008-Apr-16 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Apr-16 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+eeschema +eeschema

View File

@ -131,7 +131,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
* Init the Block infos: command type, initial position, and other variables.. * Init the Block infos: command type, initial position, and other variables..
*/ */
{ {
DrawBlockStruct* Block = & GetScreen()->BlockLocate; DrawBlockStruct* Block = & GetBaseScreen()->BlockLocate;
if( (Block->m_Command != BLOCK_IDLE) if( (Block->m_Command != BLOCK_IDLE)
|| ( Block->m_State != STATE_NO_BLOCK) ) || ( Block->m_State != STATE_NO_BLOCK) )
@ -169,7 +169,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
if( Block->m_BlockDrawStruct == NULL ) /* No data to paste */ if( Block->m_BlockDrawStruct == NULL ) /* No data to paste */
{ {
DisplayError( this, wxT( "No Block to paste" ), 20 ); DisplayError( this, wxT( "No Block to paste" ), 20 );
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE; GetBaseScreen()->BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
return TRUE; return TRUE;
} }

View File

@ -42,7 +42,7 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD ) if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
{ {
if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE ) if( GetBaseScreen()->BlockLocate.m_Command != BLOCK_IDLE )
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor = DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
DrawPanel->m_PanelDefaultCursor ) ); DrawPanel->m_PanelDefaultCursor ) );

View File

@ -321,7 +321,7 @@ wxString WinEDA_DrawFrame::GetScreenDesc()
{ {
wxString msg; wxString msg;
msg << GetScreen()->m_ScreenNumber << wxT( "/" ) << msg << GetBaseScreen()->m_ScreenNumber << wxT( "/" )
GetScreen()->m_NumberOfScreen; << GetBaseScreen()->m_NumberOfScreen;
return msg; return msg;
} }

View File

@ -138,6 +138,7 @@ public:
wxString OnGetItemText( long item, long column ) const; wxString OnGetItemText( long item, long column ) const;
void OnLeftClick( wxListEvent& event ); void OnLeftClick( wxListEvent& event );
void OnLeftDClick( wxListEvent& event ); void OnLeftDClick( wxListEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@ -208,4 +209,3 @@ public:
#endif //#ifndef CVSTRUCT_H #endif //#ifndef CVSTRUCT_H

View File

@ -53,7 +53,7 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent,
m_Pcb = new BOARD( NULL, this ); m_Pcb = new BOARD( NULL, this );
m_CurrentScreen = new PCB_SCREEN( CVPCB_DISPLAY_FRAME ); SetBaseScreen( new PCB_SCREEN( CVPCB_DISPLAY_FRAME ) );
GetSettings(); GetSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
@ -66,10 +66,9 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent,
/******************************************/ /******************************************/
WinEDA_DisplayFrame::~WinEDA_DisplayFrame() WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
/******************************************/ /******************************************/
// Destructor
{ {
delete m_CurrentScreen; delete GetBaseScreen();
SetBaseScreen( 0 );
delete m_Pcb; delete m_Pcb;
@ -177,14 +176,14 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
{ {
wxSize delta; wxSize delta;
int flagcurseur = 0; int flagcurseur = 0;
int zoom = m_CurrentScreen->GetZoom(); int zoom = GetScreen()->GetZoom();
wxPoint curpos, oldpos; wxPoint curpos, oldpos;
curpos = DrawPanel->CursorRealPosition( Mouse ); curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = m_CurrentScreen->m_Curseur; oldpos = GetScreen()->m_Curseur;
delta.x = m_CurrentScreen->GetGrid().x / zoom; delta.x = GetScreen()->GetGrid().x / zoom;
delta.y = m_CurrentScreen->GetGrid().y / zoom; delta.y = GetScreen()->GetGrid().y / zoom;
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
if( delta.y <= 0 ) if( delta.y <= 0 )
@ -197,13 +196,13 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
case WXK_F1: case WXK_F1:
OnZoom( ID_ZOOM_IN_KEY ); OnZoom( ID_ZOOM_IN_KEY );
flagcurseur = 2; flagcurseur = 2;
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case WXK_F2: case WXK_F2:
OnZoom( ID_ZOOM_OUT_KEY ); OnZoom( ID_ZOOM_OUT_KEY );
flagcurseur = 2; flagcurseur = 2;
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case WXK_F3: case WXK_F3:
@ -214,11 +213,11 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
case WXK_F4: case WXK_F4:
OnZoom( ID_ZOOM_CENTER_KEY ); OnZoom( ID_ZOOM_CENTER_KEY );
flagcurseur = 2; flagcurseur = 2;
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case ' ': case ' ':
m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break; break;
case WXK_NUMPAD8: /* cursor moved up */ case WXK_NUMPAD8: /* cursor moved up */
@ -251,26 +250,26 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
} }
} }
m_CurrentScreen->m_Curseur = curpos; GetScreen()->m_Curseur = curpos;
/* Put cursor on grid */ /* Put cursor on grid */
PutOnGrid( &m_CurrentScreen->m_Curseur ); PutOnGrid( &GetScreen()->m_Curseur );
if( m_CurrentScreen->IsRefreshReq() ) if( GetScreen()->IsRefreshReq() )
{ {
flagcurseur = 2; flagcurseur = 2;
RedrawActiveWindow( DC, TRUE ); RedrawActiveWindow( DC, TRUE );
} }
if( (oldpos.x != m_CurrentScreen->m_Curseur.x) if( (oldpos.x != GetScreen()->m_Curseur.x)
|| (oldpos.y != m_CurrentScreen->m_Curseur.y) ) || (oldpos.y != GetScreen()->m_Curseur.y) )
{ {
if( flagcurseur != 2 ) if( flagcurseur != 2 )
{ {
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
m_CurrentScreen->m_Curseur = oldpos; GetScreen()->m_Curseur = oldpos;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
m_CurrentScreen->m_Curseur = curpos; GetScreen()->m_Curseur = curpos;
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
} }

View File

@ -479,7 +479,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
DrawBlockStruct* PtBlock; DrawBlockStruct* PtBlock;
DrawPickedStruct* PickedList; DrawPickedStruct* PickedList;
BASE_SCREEN* screen = panel->m_Parent->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
PtBlock = &panel->GetScreen()->BlockLocate; PtBlock = &panel->GetScreen()->BlockLocate;
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );

View File

@ -435,7 +435,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
*/ */
{ {
DrawBlockStruct* PtBlock; DrawBlockStruct* PtBlock;
BASE_SCREEN* screen = panel->m_Parent->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
LibEDA_BaseStruct* item; LibEDA_BaseStruct* item;
wxPoint move_offset; wxPoint move_offset;

View File

@ -370,7 +370,7 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
*/ */
{ {
EDA_DrawLineStruct* CurrentLine = EDA_DrawLineStruct* CurrentLine =
(EDA_DrawLineStruct*) panel->m_Parent->GetScreen()->GetCurItem(); (EDA_DrawLineStruct*) panel->GetScreen()->GetCurItem();
EDA_DrawLineStruct* segment; EDA_DrawLineStruct* segment;
int color; int color;
@ -390,7 +390,7 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
} }
wxPoint endpos = panel->m_Parent->GetScreen()->m_Curseur; wxPoint endpos = panel->GetScreen()->m_Curseur;
if( g_HVLines ) /* Coerce the line to vertical or horizontal one: */ if( g_HVLines ) /* Coerce the line to vertical or horizontal one: */
{ {
ComputeBreakPoint( CurrentLine, endpos ); ComputeBreakPoint( CurrentLine, endpos );
@ -463,11 +463,11 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras
*/ */
{ {
DrawPolylineStruct* NewPoly = DrawPolylineStruct* NewPoly =
(DrawPolylineStruct*) panel->m_Parent->GetScreen()->GetCurItem(); (DrawPolylineStruct*) panel->GetScreen()->GetCurItem();
int color; int color;
wxPoint endpos; wxPoint endpos;
endpos = panel->m_Parent->GetScreen()->m_Curseur; endpos = panel->GetScreen()->m_Curseur;
color = ReturnLayerColor( NewPoly->GetLayer() ); color = ReturnLayerColor( NewPoly->GetLayer() );
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );

View File

@ -56,7 +56,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* Dessin du Segment "BusEntry" lors des deplacements du curseur /* Dessin du Segment "BusEntry" lors des deplacements du curseur
*/ */
{ {
BASE_SCREEN* screen = panel->m_Parent->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
DrawBusEntryStruct* BusEntry = (DrawBusEntryStruct*) screen->GetCurItem(); DrawBusEntryStruct* BusEntry = (DrawBusEntryStruct*) screen->GetCurItem();
if( BusEntry == NULL ) if( BusEntry == NULL )

View File

@ -218,13 +218,13 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
/****************************************************************/ /****************************************************************/
void DrawSheetStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/****************************************************************/ /****************************************************************/
{ {
/* Placement en liste des structures si nouveau composant:*/ /* Placement en liste des structures si nouveau composant:*/
if( m_Flags & IS_NEW ) if( m_Flags & IS_NEW )
{ {
if( !( (WinEDA_SchematicFrame*) frame )->EditSheet( this, DC ) ) if( !frame->EditSheet( this, DC ) )
{ {
frame->GetScreen()->SetCurItem( NULL ); frame->GetScreen()->SetCurItem( NULL );
frame->DrawPanel->ManageCurseur = NULL; frame->DrawPanel->ManageCurseur = NULL;

View File

@ -40,13 +40,13 @@ public:
Hierarchical_PIN_Sheet_Struct* Next() Hierarchical_PIN_Sheet_Struct* Next()
{ return (Hierarchical_PIN_Sheet_Struct*) Pnext; } { return (Hierarchical_PIN_Sheet_Struct*) Pnext; }
void Place( WinEDA_DrawFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.sch" format.
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
@ -99,7 +99,7 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
void Place( WinEDA_DrawFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
DrawSheetStruct* GenCopy(); DrawSheetStruct* GenCopy();
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame );
void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC ); void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC );

View File

@ -42,7 +42,7 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
/***************************************************************/ /***************************************************************/
void SCH_ITEM::Place( WinEDA_DrawFrame* frame, wxDC* DC ) void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/***************************************************************/ /***************************************************************/
/* place the struct in EEDrawList. /* place the struct in EEDrawList.
@ -52,12 +52,12 @@ void SCH_ITEM::Place( WinEDA_DrawFrame* frame, wxDC* DC )
{ {
if( m_Flags & IS_NEW ) if( m_Flags & IS_NEW )
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) frame->GetScreen(); SCH_SCREEN* screen = frame->GetScreen();
if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop! if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop!
screen->AddToDrawList( this ); screen->AddToDrawList( this );
g_ItemToRepeat = this; g_ItemToRepeat = this;
if( frame->m_Ident == SCHEMATIC_FRAME ) if( frame->m_Ident == SCHEMATIC_FRAME )
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_NEW ); frame->SaveCopyInUndoList( this, IS_NEW );
} }
m_Flags = 0; m_Flags = 0;

View File

@ -94,7 +94,7 @@ void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
/***************************************************************/ /***************************************************************/
void SCH_TEXT::Place( WinEDA_DrawFrame* frame, wxDC* DC ) void SCH_TEXT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/***************************************************************/ /***************************************************************/
{ {
/* save old text in undo list */ /* save old text in undo list */
@ -104,7 +104,7 @@ void SCH_TEXT::Place( WinEDA_DrawFrame* frame, wxDC* DC )
SwapData( (SCH_TEXT*) g_ItemToUndoCopy ); SwapData( (SCH_TEXT*) g_ItemToUndoCopy );
/* save in undo list */ /* save in undo list */
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED ); frame->SaveCopyInUndoList( this, IS_CHANGED );
/* restore new values */ /* restore new values */
SwapData( (SCH_TEXT*) g_ItemToUndoCopy ); SwapData( (SCH_TEXT*) g_ItemToUndoCopy );

View File

@ -101,7 +101,7 @@ public:
void SwapData( SCH_TEXT* copyitem ); void SwapData( SCH_TEXT* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
/** /**

View File

@ -418,7 +418,7 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
/***********************************************************************/ /***********************************************************************/
void SCH_COMPONENT::Place( WinEDA_DrawFrame* frame, wxDC* DC ) void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/***********************************************************************/ /***********************************************************************/
{ {
/* save old text in undo list */ /* save old text in undo list */
@ -430,7 +430,7 @@ void SCH_COMPONENT::Place( WinEDA_DrawFrame* frame, wxDC* DC )
SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy ); SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
/* save in undo list */ /* save in undo list */
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED ); frame->SaveCopyInUndoList( this, IS_CHANGED );
/* restore new values */ /* restore new values */
SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy ); SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );

View File

@ -57,7 +57,7 @@ public:
void PartTextCopy( PartTextStruct* target ); void PartTextCopy( PartTextStruct* target );
void Place( WinEDA_DrawFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
EDA_Rect GetBoundaryBox() const; EDA_Rect GetBoundaryBox() const;
bool IsVoid(); bool IsVoid();
@ -164,7 +164,7 @@ public:
void SwapData( SCH_COMPONENT* copyitem ); void SwapData( SCH_COMPONENT* copyitem );
void Place( WinEDA_DrawFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
//returns a unique ID, in the form of a path. //returns a unique ID, in the form of a path.

View File

@ -217,11 +217,11 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
/***********************************************************************/ /***********************************************************************/
void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ) void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
/***********************************************************************/ /***********************************************************************/
{ {
wxSize delta; wxSize delta;
SCH_SCREEN* screen = (SCH_SCREEN*)GetScreen(); SCH_SCREEN* screen = GetScreen();
int zoom = screen->GetZoom(); int zoom = screen->GetZoom();
wxPoint curpos, oldpos; wxPoint curpos, oldpos;
int hotkey = 0; int hotkey = 0;
@ -323,7 +323,7 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
curpos = screen->m_Curseur; curpos = screen->m_Curseur;
screen->m_Curseur = oldpos; screen->m_Curseur = oldpos;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = curpos; screen->m_Curseur = curpos;
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )

View File

@ -1,4 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: dialog_options.cpp // Name: dialog_options.cpp
// Purpose: // Purpose:
// Author: jean-pierre Charras // Author: jean-pierre Charras
@ -47,13 +48,13 @@
////@end XPM images ////@end XPM images
/**************************************************************************/ /**************************************************************************/
void DisplayOptionFrame( WinEDA_DrawFrame* parent, const wxPoint& framepos ) void DisplayOptionFrame( WinEDA_DrawFrame* parent, const wxPoint& framepos )
/**************************************************************************/ /**************************************************************************/
{ {
WinEDA_SetOptionsFrame* frame = WinEDA_SetOptionsFrame* frame =
new WinEDA_SetOptionsFrame( parent ); new WinEDA_SetOptionsFrame( parent );
frame->ShowModal(); frame->Destroy(); frame->ShowModal(); frame->Destroy();
} }
@ -87,15 +88,23 @@ WinEDA_SetOptionsFrame::WinEDA_SetOptionsFrame( )
{ {
} }
WinEDA_SetOptionsFrame::WinEDA_SetOptionsFrame( WinEDA_DrawFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
WinEDA_SetOptionsFrame::WinEDA_SetOptionsFrame( WinEDA_DrawFrame* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{ {
m_Parent = parent; m_Parent = parent;
Create( parent, id, caption, pos, size, style ); Create( parent, id, caption, pos, size, style );
BASE_SCREEN* screen = m_Parent->GetBaseScreen();
/* Init options */ /* Init options */
if ( m_Parent->GetScreen() ) if( screen )
{ {
switch( m_Parent->GetScreen()->GetGrid().x ) switch( screen->GetGrid().x )
{ {
case 50: case 50:
m_SelGridSize->SetSelection( 0 ); m_SelGridSize->SetSelection( 0 );
@ -134,9 +143,11 @@ WinEDA_SetOptionsFrame::WinEDA_SetOptionsFrame( WinEDA_DrawFrame* parent, wxWind
m_Selunits->SetSelection( g_UnitMetric ? 0 : 1 ); m_Selunits->SetSelection( g_UnitMetric ? 0 : 1 );
m_SelDirWires->SetSelection( g_HVLines ? 0 : 1 ); m_SelDirWires->SetSelection( g_HVLines ? 0 : 1 );
m_Show_Page_Limits->SetSelection( g_ShowPageLimits ? 0 : 1 ); m_Show_Page_Limits->SetSelection( g_ShowPageLimits ? 0 : 1 );
wxString msg; wxString msg;
msg = ReturnStringFromValue( g_UnitMetric, g_RepeatStep.x, m_Parent->m_InternalUnits ); msg = ReturnStringFromValue( g_UnitMetric, g_RepeatStep.x, m_Parent->m_InternalUnits );
m_DeltaStepCtrl_X->SetValue( msg ); m_DeltaStepCtrl_X->SetValue( msg );
wxString title = _( "Delta Step X" ) + ReturnUnitSymbol( g_UnitMetric ); wxString title = _( "Delta Step X" ) + ReturnUnitSymbol( g_UnitMetric );
m_DeltaStepXTitle->SetLabel( title ); m_DeltaStepXTitle->SetLabel( title );
@ -146,14 +157,19 @@ wxString title = _("Delta Step X") + ReturnUnitSymbol(g_UnitMetric);
m_DeltaStepYTitle->SetLabel( title ); m_DeltaStepYTitle->SetLabel( title );
m_DeltaLabelCtrl->SetValue( g_RepeatDeltaLabel ); m_DeltaLabelCtrl->SetValue( g_RepeatDeltaLabel );
} }
/*! /*!
* WinEDA_SetOptionsFrame creator * WinEDA_SetOptionsFrame creator
*/ */
bool WinEDA_SetOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) bool WinEDA_SetOptionsFrame::Create( wxWindow* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{ {
////@begin WinEDA_SetOptionsFrame member initialisation ////@begin WinEDA_SetOptionsFrame member initialisation
m_DrawOptionsSizer = NULL; m_DrawOptionsSizer = NULL;
@ -171,6 +187,7 @@ bool WinEDA_SetOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxSt
m_DeltaStepCtrl_Y = NULL; m_DeltaStepCtrl_Y = NULL;
m_DeltaIncTitle = NULL; m_DeltaIncTitle = NULL;
m_DeltaLabelCtrl = NULL; m_DeltaLabelCtrl = NULL;
////@end WinEDA_SetOptionsFrame member initialisation ////@end WinEDA_SetOptionsFrame member initialisation
////@begin WinEDA_SetOptionsFrame creation ////@begin WinEDA_SetOptionsFrame creation
@ -183,10 +200,12 @@ bool WinEDA_SetOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxSt
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
} }
Centre(); Centre();
////@end WinEDA_SetOptionsFrame creation ////@end WinEDA_SetOptionsFrame creation
return true; return true;
} }
/*! /*!
* Control creation for WinEDA_SetOptionsFrame * Control creation for WinEDA_SetOptionsFrame
*/ */
@ -194,22 +213,33 @@ bool WinEDA_SetOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxSt
void WinEDA_SetOptionsFrame::CreateControls() void WinEDA_SetOptionsFrame::CreateControls()
{ {
SetFont( *g_DialogFont ); SetFont( *g_DialogFont );
////@begin WinEDA_SetOptionsFrame content construction ////@begin WinEDA_SetOptionsFrame content construction
// Generated by DialogBlocks, 23/02/2007 10:59:46 (unregistered) // Generated by DialogBlocks, 23/02/2007 10:59:46 (unregistered)
WinEDA_SetOptionsFrame* itemDialog1 = this; WinEDA_SetOptionsFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxHORIZONTAL );
itemDialog1->SetSizer( itemBoxSizer2 ); itemDialog1->SetSizer( itemBoxSizer2 );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Draw Options:")); wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox( itemDialog1, wxID_ANY, _(
m_DrawOptionsSizer = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL); "Draw Options:" ) );
m_DrawOptionsSizer = new wxStaticBoxSizer( itemStaticBoxSizer4Static,
wxVERTICAL );
itemBoxSizer3->Add( m_DrawOptionsSizer, 0, wxGROW | wxALL, 5 ); itemBoxSizer3->Add( m_DrawOptionsSizer, 0, wxGROW | wxALL, 5 );
m_ShowGridOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Show grid"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowGridOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _(
"Show grid" ),
wxDefaultPosition, wxDefaultSize,
wxCHK_2STATE );
m_ShowGridOpt->SetValue( false ); m_ShowGridOpt->SetValue( false );
m_DrawOptionsSizer->Add( m_ShowGridOpt, 0, wxALIGN_LEFT | wxALL, 5 ); m_DrawOptionsSizer->Add( m_ShowGridOpt, 0, wxALIGN_LEFT | wxALL, 5 );
@ -221,7 +251,10 @@ void WinEDA_SetOptionsFrame::CreateControls()
_( "Special (2 mils)" ), _( "Special (2 mils)" ),
_( "Special (1 mil)" ) _( "Special (1 mil)" )
}; };
m_SelGridSize = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Grid Size"), wxDefaultPosition, wxDefaultSize, 6, m_SelGridSizeStrings, 1, wxRA_SPECIFY_COLS ); m_SelGridSize = new wxRadioBox( itemDialog1, ID_RADIOBOX, _(
"Grid Size" ), wxDefaultPosition, wxDefaultSize, 6,
m_SelGridSizeStrings, 1, wxRA_SPECIFY_COLS );
m_SelGridSize->SetSelection( 0 ); m_SelGridSize->SetSelection( 0 );
itemBoxSizer3->Add( m_SelGridSize, 0, wxGROW | wxALL, 5 ); itemBoxSizer3->Add( m_SelGridSize, 0, wxGROW | wxALL, 5 );
@ -229,14 +262,22 @@ void WinEDA_SetOptionsFrame::CreateControls()
_( "Normal" ), _( "Normal" ),
_( "Show alls" ) _( "Show alls" )
}; };
m_SelShowPins = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Show pins"), wxDefaultPosition, wxDefaultSize, 2, m_SelShowPinsStrings, 1, wxRA_SPECIFY_COLS ); m_SelShowPins = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _(
"Show pins" ), wxDefaultPosition,
wxDefaultSize, 2, m_SelShowPinsStrings, 1,
wxRA_SPECIFY_COLS );
m_SelShowPins->SetSelection( 0 ); m_SelShowPins->SetSelection( 0 );
itemBoxSizer3->Add( m_SelShowPins, 0, wxGROW | wxALL, 5 ); itemBoxSizer3->Add( m_SelShowPins, 0, wxGROW | wxALL, 5 );
wxBoxSizer* itemBoxSizer8 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* itemBoxSizer8 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer2->Add( itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); itemBoxSizer2->Add( itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
m_AutoPANOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Auto PAN"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_AutoPANOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX, _(
"Auto PAN" ), wxDefaultPosition, wxDefaultSize,
wxCHK_2STATE );
m_AutoPANOpt->SetValue( false ); m_AutoPANOpt->SetValue( false );
m_AutoPANOpt->SetForegroundColour( wxColour( 0, 0, 255 ) ); m_AutoPANOpt->SetForegroundColour( wxColour( 0, 0, 255 ) );
itemBoxSizer8->Add( m_AutoPANOpt, 0, wxGROW | wxALL, 5 ); itemBoxSizer8->Add( m_AutoPANOpt, 0, wxGROW | wxALL, 5 );
@ -245,18 +286,26 @@ void WinEDA_SetOptionsFrame::CreateControls()
_( "millimeter" ), _( "millimeter" ),
_( "inches" ) _( "inches" )
}; };
m_Selunits = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Units"), wxDefaultPosition, wxDefaultSize, 2, m_SelunitsStrings, 1, wxRA_SPECIFY_COLS ); m_Selunits = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _(
"Units" ), wxDefaultPosition, wxDefaultSize, 2,
m_SelunitsStrings, 1, wxRA_SPECIFY_COLS );
m_Selunits->SetSelection( 0 ); m_Selunits->SetSelection( 0 );
itemBoxSizer8->Add( m_Selunits, 0, wxGROW | wxALL, 5 ); itemBoxSizer8->Add( m_Selunits, 0, wxGROW | wxALL, 5 );
m_LabelSizeCtrlSizer = new wxBoxSizer( wxVERTICAL ); m_LabelSizeCtrlSizer = new wxBoxSizer( wxVERTICAL );
itemBoxSizer8->Add( m_LabelSizeCtrlSizer, 0, wxGROW | wxALL, 5 ); itemBoxSizer8->Add( m_LabelSizeCtrlSizer, 0, wxGROW | wxALL, 5 );
wxString m_SelDirWiresStrings[] = { wxString m_SelDirWiresStrings[] = {
_( "Horiz/Vertical" ), _( "Horiz/Vertical" ),
_( "Any" ) _( "Any" )
}; };
m_SelDirWires = new wxRadioBox( itemDialog1, ID_RADIOBOX3, _("Wires - Bus orient"), wxDefaultPosition, wxDefaultSize, 2, m_SelDirWiresStrings, 1, wxRA_SPECIFY_COLS ); m_SelDirWires = new wxRadioBox( itemDialog1, ID_RADIOBOX3, _(
"Wires - Bus orient" ), wxDefaultPosition, wxDefaultSize,
2, m_SelDirWiresStrings, 1,
wxRA_SPECIFY_COLS );
m_SelDirWires->SetSelection( 0 ); m_SelDirWires->SetSelection( 0 );
itemBoxSizer8->Add( m_SelDirWires, 0, wxGROW | wxALL, 5 ); itemBoxSizer8->Add( m_SelDirWires, 0, wxGROW | wxALL, 5 );
@ -264,55 +313,107 @@ void WinEDA_SetOptionsFrame::CreateControls()
_( "Yes" ), _( "Yes" ),
_( "No" ) _( "No" )
}; };
m_Show_Page_Limits = new wxRadioBox( itemDialog1, ID_RADIOBOX4, _("Show page limits"), wxDefaultPosition, wxDefaultSize, 2, m_Show_Page_LimitsStrings, 1, wxRA_SPECIFY_COLS ); m_Show_Page_Limits = new wxRadioBox( itemDialog1, ID_RADIOBOX4, _(
"Show page limits" ), wxDefaultPosition,
wxDefaultSize, 2, m_Show_Page_LimitsStrings, 1,
wxRA_SPECIFY_COLS );
m_Show_Page_Limits->SetSelection( 0 ); m_Show_Page_Limits->SetSelection( 0 );
itemBoxSizer8->Add( m_Show_Page_Limits, 0, wxGROW | wxALL, 5 ); itemBoxSizer8->Add( m_Show_Page_Limits, 0, wxGROW | wxALL, 5 );
wxBoxSizer* itemBoxSizer14 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* itemBoxSizer14 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer2->Add( itemBoxSizer14, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); itemBoxSizer2->Add( itemBoxSizer14, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxButton* itemButton15 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton15 = new wxButton( itemDialog1, wxID_OK, _(
"&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
itemButton15->SetForegroundColour( wxColour( 202, 0, 0 ) ); itemButton15->SetForegroundColour( wxColour( 202, 0, 0 ) );
itemBoxSizer14->Add( itemButton15, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); itemBoxSizer14->Add( itemButton15, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxButton* itemButton16 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton16 = new wxButton( itemDialog1, wxID_CANCEL, _(
"&Cancel" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemButton16->SetForegroundColour( wxColour( 0, 0, 255 ) ); itemButton16->SetForegroundColour( wxColour( 0, 0, 255 ) );
itemBoxSizer14->Add( itemButton16, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); itemBoxSizer14->Add( itemButton16, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
itemBoxSizer14->Add( 5, 5, 0, wxGROW | wxALL, 5 ); itemBoxSizer14->Add( 5, 5, 0, wxGROW | wxALL, 5 );
wxStaticBox* itemStaticBoxSizer18Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Auto increment params")); wxStaticBox* itemStaticBoxSizer18Static = new wxStaticBox( itemDialog1, wxID_ANY, _(
wxStaticBoxSizer* itemStaticBoxSizer18 = new wxStaticBoxSizer(itemStaticBoxSizer18Static, wxVERTICAL); "Auto increment params" ) );
wxStaticBoxSizer* itemStaticBoxSizer18 = new wxStaticBoxSizer(
itemStaticBoxSizer18Static,
wxVERTICAL );
itemBoxSizer14->Add( itemStaticBoxSizer18, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); itemBoxSizer14->Add( itemStaticBoxSizer18, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
m_DeltaStepXTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta Step X"), wxDefaultPosition, wxDefaultSize, 0 ); m_DeltaStepXTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
itemStaticBoxSizer18->Add(m_DeltaStepXTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); "Delta Step X" ),
wxDefaultPosition,
wxDefaultSize, 0 );
itemStaticBoxSizer18->Add( m_DeltaStepXTitle,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_DeltaStepCtrl_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(
"" ), wxDefaultPosition,
wxDefaultSize, 0 );
m_DeltaStepCtrl_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer18->Add( m_DeltaStepCtrl_X, 0, wxGROW | wxALL, 5 ); itemStaticBoxSizer18->Add( m_DeltaStepCtrl_X, 0, wxGROW | wxALL, 5 );
m_DeltaStepYTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta Step Y"), wxDefaultPosition, wxDefaultSize, 0 ); m_DeltaStepYTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
itemStaticBoxSizer18->Add(m_DeltaStepYTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); "Delta Step Y" ),
wxDefaultPosition,
wxDefaultSize, 0 );
itemStaticBoxSizer18->Add( m_DeltaStepYTitle,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_DeltaStepCtrl_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(
"" ), wxDefaultPosition,
wxDefaultSize, 0 );
m_DeltaStepCtrl_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer18->Add( m_DeltaStepCtrl_Y, 0, wxGROW | wxALL, 5 ); itemStaticBoxSizer18->Add( m_DeltaStepCtrl_Y, 0, wxGROW | wxALL, 5 );
m_DeltaIncTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta Label:"), wxDefaultPosition, wxDefaultSize, 0 ); m_DeltaIncTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
itemStaticBoxSizer18->Add(m_DeltaIncTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); "Delta Label:" ),
wxDefaultPosition,
wxDefaultSize, 0 );
itemStaticBoxSizer18->Add( m_DeltaIncTitle,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_DeltaLabelCtrl = new wxSpinCtrl( itemDialog1, ID_SPINCTRL, _T(
"0" ), wxDefaultPosition,
wxDefaultSize, wxSP_ARROW_KEYS,
-16, 16, 0 );
m_DeltaLabelCtrl = new wxSpinCtrl( itemDialog1, ID_SPINCTRL, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -16, 16, 0 );
itemStaticBoxSizer18->Add( m_DeltaLabelCtrl, 0, wxGROW | wxALL, 5 ); itemStaticBoxSizer18->Add( m_DeltaLabelCtrl, 0, wxGROW | wxALL, 5 );
////@end WinEDA_SetOptionsFrame content construction ////@end WinEDA_SetOptionsFrame content construction
m_DefaultDrawLineWidthCtrl = new WinEDA_ValueCtrl(this, _("Default Line Width"),g_DrawMinimunLineWidth, m_DefaultDrawLineWidthCtrl = new WinEDA_ValueCtrl( this, _(
g_UnitMetric, m_DrawOptionsSizer, EESCHEMA_INTERNAL_UNIT); "Default Line Width" ),
g_DrawMinimunLineWidth,
m_DefaultLabelSizeCtrl = new WinEDA_ValueCtrl(this, _("Default Label Size"),g_DefaultTextLabelSize, g_UnitMetric, m_DrawOptionsSizer,
g_UnitMetric, m_LabelSizeCtrlSizer, EESCHEMA_INTERNAL_UNIT); EESCHEMA_INTERNAL_UNIT );
m_DefaultLabelSizeCtrl = new WinEDA_ValueCtrl( this, _(
"Default Label Size" ),
g_DefaultTextLabelSize,
g_UnitMetric, m_LabelSizeCtrlSizer,
EESCHEMA_INTERNAL_UNIT );
} }
/*! /*!
* Should we show tooltips? * Should we show tooltips?
*/ */
@ -322,6 +423,7 @@ bool WinEDA_SetOptionsFrame::ShowToolTips()
return true; return true;
} }
/*! /*!
* Get bitmap resources * Get bitmap resources
*/ */
@ -332,9 +434,11 @@ wxBitmap WinEDA_SetOptionsFrame::GetBitmapResource( const wxString& name )
////@begin WinEDA_SetOptionsFrame bitmap retrieval ////@begin WinEDA_SetOptionsFrame bitmap retrieval
wxUnusedVar( name ); wxUnusedVar( name );
return wxNullBitmap; return wxNullBitmap;
////@end WinEDA_SetOptionsFrame bitmap retrieval ////@end WinEDA_SetOptionsFrame bitmap retrieval
} }
/*! /*!
* Get icon resources * Get icon resources
*/ */
@ -345,8 +449,11 @@ wxIcon WinEDA_SetOptionsFrame::GetIconResource( const wxString& name )
////@begin WinEDA_SetOptionsFrame icon retrieval ////@begin WinEDA_SetOptionsFrame icon retrieval
wxUnusedVar( name ); wxUnusedVar( name );
return wxNullIcon; return wxNullIcon;
////@end WinEDA_SetOptionsFrame icon retrieval ////@end WinEDA_SetOptionsFrame icon retrieval
} }
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/ */
@ -354,9 +461,11 @@ wxIcon WinEDA_SetOptionsFrame::GetIconResource( const wxString& name )
void WinEDA_SetOptionsFrame::OnOkClick( wxCommandEvent& event ) void WinEDA_SetOptionsFrame::OnOkClick( wxCommandEvent& event )
{ {
Accept( event ); Accept( event );
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_SetOptionsFrame. ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_SetOptionsFrame.
// Before editing this code, remove the block markers. // Before editing this code, remove the block markers.
event.Skip(); event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_SetOptionsFrame. ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_SetOptionsFrame.
} }
@ -370,6 +479,7 @@ void WinEDA_SetOptionsFrame::OnCancelClick( wxCommandEvent& event )
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_SetOptionsFrame. ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_SetOptionsFrame.
// Before editing this code, remove the block markers. // Before editing this code, remove the block markers.
event.Skip(); event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_SetOptionsFrame. ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_SetOptionsFrame.
} }
@ -383,12 +493,16 @@ bool setgrid = TRUE;
wxString msg; wxString msg;
g_DrawMinimunLineWidth = m_DefaultDrawLineWidthCtrl->GetValue(); g_DrawMinimunLineWidth = m_DefaultDrawLineWidthCtrl->GetValue();
if ( g_DrawMinimunLineWidth < 0 ) g_DrawMinimunLineWidth = 0; if( g_DrawMinimunLineWidth < 0 )
if ( g_DrawMinimunLineWidth > 100 ) g_DrawMinimunLineWidth = 100; g_DrawMinimunLineWidth = 0;
if( g_DrawMinimunLineWidth > 100 )
g_DrawMinimunLineWidth = 100;
g_DefaultTextLabelSize = m_DefaultLabelSizeCtrl->GetValue(); g_DefaultTextLabelSize = m_DefaultLabelSizeCtrl->GetValue();
if ( g_DefaultTextLabelSize < 0 ) g_DefaultTextLabelSize = 0; if( g_DefaultTextLabelSize < 0 )
if ( g_DefaultTextLabelSize > 1000 ) g_DefaultTextLabelSize = 1000; g_DefaultTextLabelSize = 0;
if( g_DefaultTextLabelSize > 1000 )
g_DefaultTextLabelSize = 1000;
msg = m_DeltaStepCtrl_X->GetValue(); msg = m_DeltaStepCtrl_X->GetValue();
g_RepeatStep.x = g_RepeatStep.x =
@ -399,22 +513,31 @@ wxString msg;
g_RepeatDeltaLabel = m_DeltaLabelCtrl->GetValue(); g_RepeatDeltaLabel = m_DeltaLabelCtrl->GetValue();
if ( m_Show_Page_Limits->GetSelection() == 0 ) g_ShowPageLimits = TRUE; if( m_Show_Page_Limits->GetSelection() == 0 )
else g_ShowPageLimits = FALSE; g_ShowPageLimits = TRUE;
else
g_ShowPageLimits = FALSE;
if ( m_SelDirWires->GetSelection() == 0 ) g_HVLines = 1; if( m_SelDirWires->GetSelection() == 0 )
else g_HVLines = 0; g_HVLines = 1;
else
g_HVLines = 0;
if ( m_Selunits->GetSelection() == 0 ) g_UnitMetric = 1; if( m_Selunits->GetSelection() == 0 )
else g_UnitMetric = 0; g_UnitMetric = 1;
else
g_UnitMetric = 0;
if ( m_SelShowPins->GetSelection() == 0 ) g_ShowAllPins = FALSE; if( m_SelShowPins->GetSelection() == 0 )
else g_ShowAllPins = TRUE; g_ShowAllPins = FALSE;
else
g_ShowAllPins = TRUE;
g_ShowGrid = m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue(); g_ShowGrid = m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue();
m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue(); m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue();
m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue(); m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue();
switch( m_SelGridSize->GetSelection() ) switch( m_SelGridSize->GetSelection() )
{ {
default: default:
@ -424,6 +547,7 @@ wxString msg;
case 0: case 0:
grid = wxSize( 50, 50 ); grid = wxSize( 50, 50 );
break; break;
case 1: case 1:
grid = wxSize( 25, 25 ); grid = wxSize( 25, 25 );
break; break;
@ -433,10 +557,10 @@ wxString msg;
break; break;
} }
if ( m_Parent->GetScreen() ) if( m_Parent->GetBaseScreen() )
{ {
if ( setgrid ) m_Parent->GetScreen()->SetGrid(grid); if( setgrid )
m_Parent->GetScreen()->SetRefreshReq(); m_Parent->GetBaseScreen()->SetGrid( grid );
m_Parent->GetBaseScreen()->SetRefreshReq();
} }
} }

View File

@ -694,7 +694,7 @@ void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC )
/*********************************************************************/ /*********************************************************************/
void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) void PartTextStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/*********************************************************************/ /*********************************************************************/
{ {
int FieldNumber; int FieldNumber;

View File

@ -179,7 +179,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
/*************************************************************************/ /*************************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
/*************************************************************************/ /*************************************************************************/
/* Routine to create new text struct (GraphicText, label or Glabel). /* Routine to create new text struct (GraphicText, label or Glabel).
@ -278,7 +278,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************************/ /*************************************************************/
/* Abort function for the command move text */ /* Abort function for the command move text */
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->GetScreen(); BASE_SCREEN* screen = Panel->GetScreen();
SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem(); SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem();
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;

View File

@ -142,7 +142,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask
wxBeginBusyCursor(); wxBeginBusyCursor();
ActiveScreen = screen = m_Parent->GetScreen(); ActiveScreen = screen = m_Parent->GetBaseScreen();
RedrawStructList( this, DC, screen->EEDrawList, GR_COPY ); RedrawStructList( this, DC, screen->EEDrawList, GR_COPY );
if( Print_Sheet_Ref ) if( Print_Sheet_Ref )

View File

@ -255,8 +255,9 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
wxPoint move_vector; wxPoint move_vector;
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
panel->m_Parent->GetScreen()->GetCurItem();
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) screen->GetCurItem();
/* Effacement du composant */ /* Effacement du composant */
if( erase ) if( erase )
@ -264,8 +265,8 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
} }
move_vector.x = panel->m_Parent->GetScreen()->m_Curseur.x - DrawLibItem->m_Pos.x; move_vector.x = screen->m_Curseur.x - DrawLibItem->m_Pos.x;
move_vector.y = panel->m_Parent->GetScreen()->m_Curseur.y - DrawLibItem->m_Pos.y; move_vector.y = screen->m_Curseur.y - DrawLibItem->m_Pos.y;
MoveOneStruct( DrawLibItem, move_vector ); MoveOneStruct( DrawLibItem, move_vector );
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
@ -320,8 +321,9 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
/* Routine de sortie de la fonction de placement de composant /* Routine de sortie de la fonction de placement de composant
*/ */
{ {
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) SCH_SCREEN* screen = (SCH_SCREEN*) Panel->GetScreen();
Panel->m_Parent->GetScreen()->GetCurItem();
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) screen->GetCurItem();
if( DrawLibItem->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */ if( DrawLibItem->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
{ {
@ -342,12 +344,11 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
DrawLibItem->m_Flags = 0; DrawLibItem->m_Flags = 0;
} }
D(printf("refresh\n");)
Panel->Refresh( TRUE ); Panel->Refresh( TRUE );
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
Panel->m_Parent->GetScreen()->SetCurItem( NULL ); screen->SetCurItem( NULL );
} }

View File

@ -280,7 +280,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->Type() == TYPE_SCH_COMPONENT ) if( DrawStruct->Type() == TYPE_SCH_COMPONENT )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
} }
@ -332,7 +332,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_MIRROR_X_COMPONENT: // Mirror X (Component) case HK_MIRROR_X_COMPONENT: // Mirror X (Component)
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
@ -347,7 +347,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component) case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
@ -365,10 +365,10 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct && (DrawStruct->m_Flags ==0) ) if( DrawStruct && (DrawStruct->m_Flags ==0) )
{ {
((SCH_SCREEN*)GetScreen())->SetCurItem( DrawStruct ); GetScreen()->SetCurItem( (SCH_ITEM*) DrawStruct );
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent ); wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent( this, event ); wxPostEvent( this, event );
@ -378,7 +378,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if(DrawStruct) if(DrawStruct)
{ {
EditComponentValue( EditComponentValue(
@ -390,7 +390,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if(DrawStruct) if(DrawStruct)
{ {
EditComponentFootprint( EditComponentFootprint(

View File

@ -35,10 +35,10 @@ static void ExitMoveField(WinEDA_DrawPanel * Panel, wxDC * DC)
if(CurrentDrawItem == NULL) return; if(CurrentDrawItem == NULL) return;
wxPoint curpos; wxPoint curpos;
curpos = Panel->m_Parent->GetScreen()->m_Curseur; curpos = Panel->GetScreen()->m_Curseur;
Panel->m_Parent->GetScreen()->m_Curseur = StartCursor; Panel->GetScreen()->m_Curseur = StartCursor;
ShowMoveField(Panel, DC, TRUE); ShowMoveField(Panel, DC, TRUE);
Panel->m_Parent->GetScreen()->m_Curseur = curpos; Panel->GetScreen()->m_Curseur = curpos;
CurrentDrawItem->m_Flags = 0; CurrentDrawItem->m_Flags = 0;
CurrentDrawItem = NULL; CurrentDrawItem = NULL;

View File

@ -73,7 +73,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
// Give an icon // Give an icon
SetIcon( wxIcon( libedit_xpm ) ); SetIcon( wxIcon( libedit_xpm ) );
m_CurrentScreen = ScreenLib; SetBaseScreen( ScreenLib );
GetSettings(); GetSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
if( DrawPanel ) if( DrawPanel )
@ -90,7 +90,6 @@ WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
/**********************************************/ /**********************************************/
{ {
m_Parent->m_LibeditFrame = NULL; m_Parent->m_LibeditFrame = NULL;
//m_CurrentScreen = ScreenSch; humm, is this needed?
} }
@ -118,7 +117,8 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
msg.Printf( _( "Library \"%s\" was modified!\nDiscard changes?" ), Lib->m_Name.GetData() ); msg.Printf( _( "Library \"%s\" was modified!\nDiscard changes?" ), Lib->m_Name.GetData() );
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
{ {
Event.Veto(); return; Event.Veto();
return;
} }
} }
} }

View File

@ -157,7 +157,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
// if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move noconnect"); // if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move noconnect");
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "delete noconn" ), delete_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Noconn" ), delete_xpm );
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
@ -167,17 +167,17 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
if( !flags ) if( !flags )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
_( "Move bus entry" ), move_xpm ); _( "Move Bus Entry" ), move_xpm );
if( GetBusEntryShape( (DrawBusEntryStruct*) DrawStruct ) == '\\' ) if( GetBusEntryShape( (DrawBusEntryStruct*) DrawStruct ) == '\\' )
PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_SLASH, _( "set bus entry /" ) ); PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_SLASH, _( "Set Bus Entry /" ) );
else else
PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH, _( "set bus entry \\" ) ); PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH, _( "Set Bus Entry \\" ) );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE,
_( "delete bus entry" ), delete_bus_xpm ); _( "Delete Bus Entry" ), delete_bus_xpm );
break; break;
case DRAW_MARKER_STRUCT_TYPE: case DRAW_MARKER_STRUCT_TYPE:
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "delete Marker" ), delete_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), delete_xpm );
break; break;
case TYPE_SCH_TEXT: case TYPE_SCH_TEXT:
@ -230,9 +230,9 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
default: default:
if( is_new ) if( is_new )
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "End drawing" ), apply_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ), apply_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE,
_( "Delete drawing" ), delete_xpm ); _( "Delete Drawing" ), delete_xpm );
break; break;
} }
@ -417,7 +417,7 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
_( "Change to Text" ), glabel2text_xpm ); _( "Change to Text" ), glabel2text_xpm );
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL,
_( "Change to Global label" ), label2glabel_xpm ); _( "Change to Global Label" ), label2glabel_xpm );
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type,
ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm ); ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm );
} }
@ -444,7 +444,7 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
_( "Change to Text" ), label2text_xpm ); _( "Change to Text" ), label2text_xpm );
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL,
_( "Change to Global label" ), label2glabel_xpm ); _( "Change to Global Label" ), label2glabel_xpm );
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type,
ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm ); ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm );
} }
@ -494,14 +494,14 @@ void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm );
} }
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "delete junction" ), delete_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Junction" ), delete_xpm );
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(), if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(),
WIREITEM | BUSITEM ) ) WIREITEM | BUSITEM ) )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete node" ), delete_node_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _(
"Delete connection" ), delete_connection_xpm ); "Delete Connection" ), delete_connection_xpm );
} }
} }
@ -525,9 +525,9 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
if( is_new ) if( is_new )
return; return;
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete node" ), delete_node_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _(
"Delete connection" ), delete_connection_xpm ); "Delete Connection" ), delete_connection_xpm );
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(), if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(),
WIREITEM | BUSITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) ) WIREITEM | BUSITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) )
@ -535,13 +535,13 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add junction" ), add_junction_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add Junction" ), add_junction_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add label" ), add_line_label_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ), add_line_label_xpm );
// Place Global label command only if the cursor is over one end of the Wire: // Place Global label command only if the cursor is over one end of the Wire:
if( ( pos.x == Wire->m_Start.x && pos.y == Wire->m_Start.y) if( ( pos.x == Wire->m_Start.x && pos.y == Wire->m_Start.y)
|| ( pos.x == Wire->m_End.x && pos.y == Wire->m_End.y ) ) || ( pos.x == Wire->m_End.x && pos.y == Wire->m_End.y ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add global label" ), add_glabel_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm );
} }
@ -567,13 +567,13 @@ void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
_( "Break Bus" ), break_bus_xpm ); _( "Break Bus" ), break_bus_xpm );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add junction" ), add_junction_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add Junction" ), add_junction_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add label" ), add_line_label_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ), add_line_label_xpm );
// Place Global label command only if the cursor is over one end of the Bus: // Place Global label command only if the cursor is over one end of the Bus:
if( ( pos.x == Bus->m_Start.x && pos.y == Bus->m_Start.y) if( ( pos.x == Bus->m_Start.x && pos.y == Bus->m_Start.y)
|| ( pos.x == Bus->m_End.x && pos.y == Bus->m_End.y ) ) || ( pos.x == Bus->m_End.x && pos.y == Bus->m_End.y ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add global label" ), add_glabel_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm );
} }
@ -645,14 +645,14 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
{ {
wxMenu* menu_other_block_commands = new wxMenu; wxMenu* menu_other_block_commands = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_other_block_commands, ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_other_block_commands,
-1, _( "Other block commands" ), right_xpm ); -1, _( "Other Block Commands" ), right_xpm );
ADD_MENUITEM( menu_other_block_commands, wxID_COPY, _( "Save Block" ), copy_button ); ADD_MENUITEM( menu_other_block_commands, wxID_COPY, _( "Save Block" ), copy_button );
ADD_MENUITEM( menu_other_block_commands, ID_POPUP_COPY_BLOCK, ADD_MENUITEM( menu_other_block_commands, ID_POPUP_COPY_BLOCK,
_( "Copy Block (shift + drag mouse)" ), copyblock_xpm ); _( "Copy Block (shift + drag mouse)" ), copyblock_xpm );
ADD_MENUITEM( menu_other_block_commands, ID_POPUP_DRAG_BLOCK, ADD_MENUITEM( menu_other_block_commands, ID_POPUP_DRAG_BLOCK,
_( "Drag Block (ctrl + drag mouse)" ), move_xpm ); _( "Drag Block (ctrl + drag mouse)" ), move_xpm );
ADD_MENUITEM( menu_other_block_commands, ID_POPUP_DELETE_BLOCK, ADD_MENUITEM( menu_other_block_commands, ID_POPUP_DELETE_BLOCK,
_( "Del. Block (shift+ctrl + drag mouse)" ), delete_xpm ); _( "Delelet Block (shift+ctrl + drag mouse)" ), delete_xpm );
ADD_MENUITEM( menu_other_block_commands, ID_POPUP_MIRROR_Y_BLOCK, _( ADD_MENUITEM( menu_other_block_commands, ID_POPUP_MIRROR_Y_BLOCK, _(
"Mirror Block ||" ), mirror_H_xpm ); "Mirror Block ||" ), mirror_H_xpm );
#if 0 #if 0

View File

@ -54,6 +54,7 @@ static int LastPinType = PIN_INPUT,
/*************************************************************************/ /*************************************************************************/
void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event ) void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event )
/*************************************************************************/ /*************************************************************************/
/* Met a jour les differents parametres pour le composant en cours d'<27>dition /* Met a jour les differents parametres pour le composant en cours d'<27>dition
*/ */
{ {
@ -77,14 +78,17 @@ wxString msg;
m_Parent->SaveCopyInUndoList( CurrentLibEntry ); m_Parent->SaveCopyInUndoList( CurrentLibEntry );
LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem;
wxClientDC dc( m_Parent->DrawPanel ); wxClientDC dc( m_Parent->DrawPanel );
m_Parent->DrawPanel->PrepareGraphicContext( &dc ); m_Parent->DrawPanel->PrepareGraphicContext( &dc );
if( m_Parent->DrawPanel->ManageCurseur ) // Pin is moving if( m_Parent->DrawPanel->ManageCurseur ) // Pin is moving
m_Parent->DrawPanel->ManageCurseur( m_Parent->DrawPanel, &dc, FALSE ); m_Parent->DrawPanel->ManageCurseur( m_Parent->DrawPanel, &dc, FALSE );
else DrawLibraryDrawStruct(m_Parent->DrawPanel, &dc, CurrentLibEntry, else
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry,
0, 0, CurrentPin, CurrentUnit, g_XorMode ); 0, 0, CurrentPin, CurrentUnit, g_XorMode );
SetPinName( m_PinNameCtrl->GetValue(), LastPinNameSize ); SetPinName( m_PinNameCtrl->GetValue(), LastPinNameSize );
msg = m_PinNumCtrl->GetValue(); if ( msg.IsEmpty() ) msg = wxT("~"); msg = m_PinNumCtrl->GetValue(); if( msg.IsEmpty() )
msg = wxT( "~" );
SetPinNum( msg, LastPinNumSize ); SetPinNum( msg, LastPinNumSize );
NewSizePin( LastPinSize ); NewSizePin( LastPinSize );
SetPinShape( LastPinShape ); SetPinShape( LastPinShape );
@ -93,7 +97,8 @@ wxString msg;
SetAttributsPin( TRUE, TRUE, TRUE ); SetAttributsPin( TRUE, TRUE, TRUE );
if( m_Parent->DrawPanel->ManageCurseur ) if( m_Parent->DrawPanel->ManageCurseur )
m_Parent->DrawPanel->ManageCurseur( m_Parent->DrawPanel, &dc, FALSE ); m_Parent->DrawPanel->ManageCurseur( m_Parent->DrawPanel, &dc, FALSE );
else DrawLibraryDrawStruct(m_Parent->DrawPanel, &dc, CurrentLibEntry, else
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry,
0, 0, CurrentPin, CurrentUnit, g_XorMode ); 0, 0, CurrentPin, CurrentUnit, g_XorMode );
} }
@ -104,32 +109,36 @@ wxString msg;
} }
/*********************************************/ /*********************************************/
void WinEDA_LibeditFrame::InitEditOnePin() void WinEDA_LibeditFrame::InitEditOnePin()
/*********************************************/ /*********************************************/
/* Routine d'installation du menu d'edition d'une pin /* Routine d'installation du menu d'edition d'une pin
*/ */
{ {
LibDrawPin* Pin; LibDrawPin* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem;
if(CurrentLibEntry == NULL) return; if( CurrentLibEntry == NULL )
if(CurrentPin == NULL) return; return;
if( CurrentPin == NULL )
return;
/* Marquage des pins a traiter,Si edition d'une pin non deja selectionnee */ /* Marquage des pins a traiter,Si edition d'une pin non deja selectionnee */
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if ( Pin == CurrentPin ) continue; continue;
if( (Pin->m_Pos == CurrentPin->m_Pos) && if( Pin == CurrentPin )
(Pin->m_Orient == CurrentPin->m_Orient) && continue;
(! (CurrentPin->m_Flags & IS_NEW)) && if( (Pin->m_Pos == CurrentPin->m_Pos)
(g_EditPinByPinIsOn == FALSE) ) && (Pin->m_Orient == CurrentPin->m_Orient)
&& ( !(CurrentPin->m_Flags & IS_NEW) )
&& (g_EditPinByPinIsOn == FALSE) )
Pin->m_Flags |= IS_LINKED | IN_EDIT; Pin->m_Flags |= IS_LINKED | IN_EDIT;
else Pin->m_Flags = 0; else
Pin->m_Flags = 0;
} }
CurrentPin->Display_Infos_DrawEntry( this ); CurrentPin->Display_Infos_DrawEntry( this );
@ -139,6 +148,7 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem;
/*************************************************************/ /*************************************************************/
static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC ) static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************************/ /*************************************************************/
/* Used to abort the move pin command. /* Used to abort the move pin command.
*/ */
{ {
@ -149,7 +159,8 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem;
/* clear edit flags */ /* clear edit flags */
LibEDA_BaseStruct* item = CurrentLibEntry->m_Drawings; LibEDA_BaseStruct* item = CurrentLibEntry->m_Drawings;
for ( ; item != NULL; item = item->Next() ) item->m_Flags = 0; for( ; item != NULL; item = item->Next() )
item->m_Flags = 0;
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
@ -170,19 +181,25 @@ bool ask_for_pin = TRUE;
wxPoint newpos; wxPoint newpos;
bool status; bool status;
if( CurrentPin == NULL ) return; if( CurrentPin == NULL )
return;
newpos.x = GetScreen()->m_Curseur.x; newpos.x = GetScreen()->m_Curseur.x;
newpos.y = -GetScreen()->m_Curseur.y; newpos.y = -GetScreen()->m_Curseur.y;
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
// Tst for an other pin in same new position: // Tst for an other pin in same new position:
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if ( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if ( Pin == CurrentPin ) continue; continue;
if( newpos != Pin->m_Pos ) continue; if( Pin == CurrentPin )
if ( Pin->m_Flags ) continue; continue;
if( newpos != Pin->m_Pos )
continue;
if( Pin->m_Flags )
continue;
if( ask_for_pin ) if( ask_for_pin )
{ {
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
@ -191,7 +208,8 @@ bool status;
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
if( !status ) if( !status )
return; return;
else ask_for_pin = FALSE; else
ask_for_pin = FALSE;
} }
} }
@ -213,8 +231,10 @@ bool status;
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if( Pin->m_Flags == 0 ) continue; continue;
if( Pin->m_Flags == 0 )
continue;
Pin->m_Pos = CurrentPin->m_Pos; Pin->m_Pos = CurrentPin->m_Pos;
Pin->m_Flags = 0; Pin->m_Flags = 0;
} }
@ -235,8 +255,10 @@ void WinEDA_PinPropertiesFrame::SetPinOrient(int neworient)
LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem;
LibDrawPin* Pin, * RefPin = CurrentPin; LibDrawPin* Pin, * RefPin = CurrentPin;
if( CurrentLibEntry == NULL ) return; if( CurrentLibEntry == NULL )
if ( RefPin == NULL ) return; return;
if( RefPin == NULL )
return;
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
@ -246,9 +268,11 @@ LibDrawPin * Pin, *RefPin = CurrentPin;
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if( Pin->m_Flags == 0 ) continue; if( Pin->m_Flags == 0 )
continue;
Pin->m_Orient = RefPin->m_Orient; Pin->m_Orient = RefPin->m_Orient;
if(CurrentPin == NULL ) Pin->m_Flags = 0; if( CurrentPin == NULL )
Pin->m_Flags = 0;
} }
} }
@ -256,9 +280,10 @@ LibDrawPin * Pin, *RefPin = CurrentPin;
/*************************************************/ /*************************************************/
void WinEDA_LibeditFrame::StartMovePin( wxDC* DC ) void WinEDA_LibeditFrame::StartMovePin( wxDC* DC )
/*************************************************/ /*************************************************/
/* Prepare le deplacement d'une pin : /* Prepare le deplacement d'une pin :
Localise la pin pointee par le curseur, et si elle existe active * Localise la pin pointee par le curseur, et si elle existe active
la fonction de gestion curseur ( DrawMovePin() ). * la fonction de gestion curseur ( DrawMovePin() ).
*/ */
{ {
LibDrawPin* Pin; LibDrawPin* Pin;
@ -270,12 +295,15 @@ wxPoint startPos;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
Pin->m_Flags = 0; Pin->m_Flags = 0;
if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if ( Pin == CurrentPin) continue; continue;
if ( (Pin->m_Pos == CurrentPin->m_Pos) && (Pin->m_Orient == CurrentPin->m_Orient) && if( Pin == CurrentPin )
(g_EditPinByPinIsOn == FALSE ) ) continue;
if( (Pin->m_Pos == CurrentPin->m_Pos) && (Pin->m_Orient == CurrentPin->m_Orient)
&& (g_EditPinByPinIsOn == FALSE ) )
Pin->m_Flags |= IS_LINKED | IS_MOVED; Pin->m_Flags |= IS_LINKED | IS_MOVED;
} }
CurrentPin->m_Flags |= IS_LINKED | IS_MOVED; CurrentPin->m_Flags |= IS_LINKED | IS_MOVED;
PinPreviousPos = OldPos = CurrentPin->m_Pos; PinPreviousPos = OldPos = CurrentPin->m_Pos;
@ -311,26 +339,26 @@ wxPoint pinpos = CurrentPin->m_Pos;
} }
/* Redraw pin in new position */ /* Redraw pin in new position */
CurrentPin->m_Pos.x = panel->m_Parent->GetScreen()->m_Curseur.x; CurrentPin->m_Pos.x = panel->GetScreen()->m_Curseur.x;
CurrentPin->m_Pos.y = - panel->m_Parent->GetScreen()->m_Curseur.y; CurrentPin->m_Pos.y = -panel->GetScreen()->m_Curseur.y;
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, CurrentPin, CurrentUnit, g_XorMode ); DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, CurrentPin, CurrentUnit, g_XorMode );
PinPreviousPos = CurrentPin->m_Pos; PinPreviousPos = CurrentPin->m_Pos;
/* Keep the original position for existing pin (for Undo command) /* Keep the original position for existing pin (for Undo command)
and the current position for a new pin */ * and the current position for a new pin */
if( (CurrentPin->m_Flags & IS_NEW) == 0 ) if( (CurrentPin->m_Flags & IS_NEW) == 0 )
CurrentPin->m_Pos = pinpos; CurrentPin->m_Pos = pinpos;
} }
/**********************************************************/ /**********************************************************/
void WinEDA_PinPropertiesFrame::SetPinShape( int newshape ) void WinEDA_PinPropertiesFrame::SetPinShape( int newshape )
/**********************************************************/ /**********************************************************/
/* Changement de la forme de la pin courante. /* Changement de la forme de la pin courante.
Le changement est egalement fait sur les autres pins correspondantes * Le changement est egalement fait sur les autres pins correspondantes
des autres unites de la seule forme convert courante * des autres unites de la seule forme convert courante
*/ */
{ {
LibDrawPin* Pin; LibDrawPin* Pin;
@ -345,9 +373,12 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem;
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if( Pin->m_Flags == 0 ) continue; continue;
if( Pin->m_Convert != CurrentPin->m_Convert ) continue; if( Pin->m_Flags == 0 )
continue;
if( Pin->m_Convert != CurrentPin->m_Convert )
continue;
Pin->m_PinShape = newshape; Pin->m_PinShape = newshape;
} }
} }
@ -357,15 +388,17 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem;
/******************************************************/ /******************************************************/
void WinEDA_PinPropertiesFrame::SetPinType( int newtype ) void WinEDA_PinPropertiesFrame::SetPinType( int newtype )
/******************************************************/ /******************************************************/
/* Changement du type electrique de la pin courante. /* Changement du type electrique de la pin courante.
Le changement est egalement fait sur les autres pins correspondantes * Le changement est egalement fait sur les autres pins correspondantes
des autres unites du boitier * des autres unites du boitier
*/ */
{ {
LibDrawPin* Pin; LibDrawPin* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem;
if(CurrentPin == NULL) return; if( CurrentPin == NULL )
return;
CurrentPin->m_PinType = newtype; CurrentPin->m_PinType = newtype;
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
@ -373,18 +406,22 @@ LibDrawPin * CurrentPin = (LibDrawPin*)CurrentDrawItem;
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if( Pin->m_Flags == 0 ) continue; continue;
if( Pin->m_Flags == 0 )
continue;
Pin->m_PinType = newtype; Pin->m_PinType = newtype;
} }
} }
/********************************************************************************/ /********************************************************************************/
void WinEDA_PinPropertiesFrame::SetPinName( const wxString& newname, int newsize ) void WinEDA_PinPropertiesFrame::SetPinName( const wxString& newname, int newsize )
/********************************************************************************/ /********************************************************************************/
/* Met a jour le nom et la taille de ce nom de la pin courante /* Met a jour le nom et la taille de ce nom de la pin courante
si newname == NULL, pas de changement de nom * si newname == NULL, pas de changement de nom
si newsize < 0 : pas de changement de taille * si newsize < 0 : pas de changement de taille
*/ */
{ {
LibDrawPin* Pin; LibDrawPin* Pin;
@ -394,7 +431,8 @@ wxString buf;
buf = newname; buf = newname;
buf.Replace( wxT( " " ), wxT( "_" ) ); buf.Replace( wxT( " " ), wxT( "_" ) );
if ( newsize >= 0 ) CurrentPin->m_PinNameSize = newsize; if( newsize >= 0 )
CurrentPin->m_PinNameSize = newsize;
CurrentPin->m_PinName = buf; CurrentPin->m_PinName = buf;
@ -404,21 +442,26 @@ wxString buf;
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if( (Pin->m_Flags & IS_LINKED) == 0 ) continue; continue;
if (newsize >= 0 ) Pin->m_PinNameSize = newsize; if( (Pin->m_Flags & IS_LINKED) == 0 )
continue;
if( newsize >= 0 )
Pin->m_PinNameSize = newsize;
Pin->m_PinName = buf; Pin->m_PinName = buf;
} }
} }
/******************************************************************************/ /******************************************************************************/
void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize ) void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize )
/******************************************************************************/ /******************************************************************************/
/* Changement du numero de la pin courante. /* Changement du numero de la pin courante.
Le changement est egalement fait sur les autres pins correspondantes * Le changement est egalement fait sur les autres pins correspondantes
a la forme convertie * a la forme convertie
Si newnum == NULL: pas de changement de numero * Si newnum == NULL: pas de changement de numero
Si newsize < 0 ) pase de changement de taille * Si newsize < 0 ) pase de changement de taille
*/ */
{ {
LibDrawPin* Pin; LibDrawPin* Pin;
@ -428,22 +471,29 @@ wxString buf;
buf = newnum; buf = newnum;
buf.Replace( wxT( " " ), wxT( "_" ) ); buf.Replace( wxT( " " ), wxT( "_" ) );
if(CurrentPin == NULL ) return; if( CurrentPin == NULL )
return;
CurrentPin->m_PinNum = 0; CurrentPin->m_PinNum = 0;
if ( newsize >= 0) CurrentPin->m_PinNumSize = newsize; if( newsize >= 0 )
CurrentPin->m_PinNumSize = newsize;
CurrentPin->SetPinNumFromString( buf ); CurrentPin->SetPinNumFromString( buf );
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if( (Pin->m_Flags & IS_LINKED) == 0 ) continue; continue;
if( Pin->m_Unit != CurrentPin->m_Unit ) continue; if( (Pin->m_Flags & IS_LINKED) == 0 )
if ( newsize >= 0) Pin->m_PinNumSize = newsize; continue;
if ( newnum ) Pin->m_PinNum = CurrentPin->m_PinNum; if( Pin->m_Unit != CurrentPin->m_Unit )
continue;
if( newsize >= 0 )
Pin->m_PinNumSize = newsize;
if( newnum )
Pin->m_PinNum = CurrentPin->m_PinNum;
} }
} }
@ -453,17 +503,20 @@ void WinEDA_LibeditFrame::DeletePin(wxDC * DC,
EDA_LibComponentStruct* LibEntry, EDA_LibComponentStruct* LibEntry,
LibDrawPin* Pin ) LibDrawPin* Pin )
/*************************************************/ /*************************************************/
/* Routine d'effacement de la pin pointee par la souris /* Routine d'effacement de la pin pointee par la souris
Si g_EditPinByPinIsOn == FALSE : * Si g_EditPinByPinIsOn == FALSE :
toutes les pins de meme coordonnee seront effacees. * toutes les pins de meme coordonnee seront effacees.
Sinon seule la pin de l'unite en convert courante sera effacee * Sinon seule la pin de l'unite en convert courante sera effacee
*/ */
{ {
LibEDA_BaseStruct* DrawItem; LibEDA_BaseStruct* DrawItem;
wxPoint PinPos; wxPoint PinPos;
if(LibEntry == NULL ) return; if( LibEntry == NULL )
if(Pin == NULL ) return; return;
if( Pin == NULL )
return;
PinPos = Pin->m_Pos; PinPos = Pin->m_Pos;
DeleteOneLibraryDrawStruct( DrawPanel, DC, LibEntry, Pin, TRUE ); DeleteOneLibraryDrawStruct( DrawPanel, DC, LibEntry, Pin, TRUE );
@ -480,7 +533,8 @@ wxPoint PinPos;
} }
Pin = (LibDrawPin*) DrawItem; Pin = (LibDrawPin*) DrawItem;
DrawItem = DrawItem->Next(); DrawItem = DrawItem->Next();
if( Pin->m_Pos != PinPos ) continue; if( Pin->m_Pos != PinPos )
continue;
DeleteOneLibraryDrawStruct( DrawPanel, DC, LibEntry, Pin, 0 ); DeleteOneLibraryDrawStruct( DrawPanel, DC, LibEntry, Pin, 0 );
} }
} }
@ -496,8 +550,10 @@ void WinEDA_LibeditFrame::CreatePin(wxDC * DC)
LibEDA_BaseStruct* DrawItem; LibEDA_BaseStruct* DrawItem;
LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem;
if(CurrentLibEntry == NULL ) return; if( CurrentLibEntry == NULL )
if(CurrentPin != NULL ) return; return;
if( CurrentPin != NULL )
return;
/* Effacement des flags */ /* Effacement des flags */
DrawItem = CurrentLibEntry->m_Drawings; DrawItem = CurrentLibEntry->m_Drawings;
@ -505,14 +561,17 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem;
DrawItem->m_Flags = 0; DrawItem->m_Flags = 0;
CurrentPin = new LibDrawPin(); CurrentPin = new LibDrawPin();
CurrentDrawItem = CurrentPin; CurrentDrawItem = CurrentPin;
if(CurrentPin == NULL ) return; if( CurrentPin == NULL )
return;
CurrentPin->m_Flags = IS_NEW; CurrentPin->m_Flags = IS_NEW;
CurrentPin->m_Unit = CurrentUnit; CurrentPin->m_Unit = CurrentUnit;
CurrentPin->m_Convert = CurrentConvert; CurrentPin->m_Convert = CurrentConvert;
/* Marquage des pins a traiter */ /* Marquage des pins a traiter */
if( g_EditPinByPinIsOn == FALSE ) CurrentPin->m_Flags |= IS_LINKED; if( g_EditPinByPinIsOn == FALSE )
CurrentPin->m_Flags |= IS_LINKED;
CurrentPin->m_Pos.x = GetScreen()->m_Curseur.x; CurrentPin->m_Pos.x = GetScreen()->m_Curseur.x;
CurrentPin->m_Pos.y = -GetScreen()->m_Curseur.y; CurrentPin->m_Pos.y = -GetScreen()->m_Curseur.y;
@ -522,18 +581,25 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem;
CurrentPin->m_PinShape = LastPinShape; CurrentPin->m_PinShape = LastPinShape;
CurrentPin->m_PinNameSize = LastPinNameSize; CurrentPin->m_PinNameSize = LastPinNameSize;
CurrentPin->m_PinNumSize = LastPinNumSize; CurrentPin->m_PinNumSize = LastPinNumSize;
if ( LastPinCommonConvert ) CurrentPin->m_Convert = 0; if( LastPinCommonConvert )
else CurrentPin->m_Convert = CurrentConvert; CurrentPin->m_Convert = 0;
if ( LastPinCommonUnit ) CurrentPin->m_Unit = 0; else
else CurrentPin->m_Unit = CurrentUnit; CurrentPin->m_Convert = CurrentConvert;
if( LastPinNoDraw ) CurrentPin->m_Attributs |= PINNOTDRAW; if( LastPinCommonUnit )
else CurrentPin->m_Attributs &= ~PINNOTDRAW; CurrentPin->m_Unit = 0;
else
CurrentPin->m_Unit = CurrentUnit;
if( LastPinNoDraw )
CurrentPin->m_Attributs |= PINNOTDRAW;
else
CurrentPin->m_Attributs &= ~PINNOTDRAW;
CurrentPin->Pnext = CurrentLibEntry->m_Drawings; CurrentPin->Pnext = CurrentLibEntry->m_Drawings;
CurrentLibEntry->m_Drawings = CurrentPin; CurrentLibEntry->m_Drawings = CurrentPin;
CurrentLibEntry->SortDrawItems(); CurrentLibEntry->SortDrawItems();
if ( DC ) DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, if( DC )
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry,
0, 0, CurrentPin, CurrentUnit, g_XorMode ); 0, 0, CurrentPin, CurrentUnit, g_XorMode );
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
@ -551,36 +617,39 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem;
} }
/*********************************************************/ /*********************************************************/
void WinEDA_PinPropertiesFrame::SetAttributsPin( bool draw, void WinEDA_PinPropertiesFrame::SetAttributsPin( bool draw,
bool unit, bool convert ) bool unit, bool convert )
/*********************************************************/ /*********************************************************/
/* si draw == TRUE /* si draw == TRUE
- Ajuste le flag visible / invisible (.U.Pin.Flags bit 0 ) de la pin * - Ajuste le flag visible / invisible (.U.Pin.Flags bit 0 ) de la pin
editee * editee
*
si unit == TRUE * si unit == TRUE
- Modifie l'attribut Commun / Particulier U.Pin.Unit = 0 ou Num Unite * - Modifie l'attribut Commun / Particulier U.Pin.Unit = 0 ou Num Unite
de la pin editee * de la pin editee
*
si convert == TRUE * si convert == TRUE
- Modifie l'attribut Commun / Particulier U.Pin.Convert = 0 ou Num Unite * - Modifie l'attribut Commun / Particulier U.Pin.Convert = 0 ou Num Unite
de la pin editee * de la pin editee
*
*/ */
{ {
LibEDA_BaseStruct* DrawItem; LibEDA_BaseStruct* DrawItem;
LibDrawPin* Pin, * CurrentPin = (LibDrawPin*) CurrentDrawItem; LibDrawPin* Pin, * CurrentPin = (LibDrawPin*) CurrentDrawItem;
if(CurrentPin == NULL) return; if( CurrentPin == NULL )
return;
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
if( unit ) if( unit )
{ {
if ( LastPinCommonUnit ) CurrentPin->m_Unit = 0; if( LastPinCommonUnit )
else CurrentPin->m_Unit = CurrentUnit; CurrentPin->m_Unit = 0;
else
CurrentPin->m_Unit = CurrentUnit;
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
@ -591,13 +660,18 @@ LibDrawPin * Pin, * CurrentPin = (LibDrawPin * ) CurrentDrawItem;
{ {
Pin = (LibDrawPin*) DrawItem; Pin = (LibDrawPin*) DrawItem;
DrawItem = DrawItem->Next(); DrawItem = DrawItem->Next();
if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if( Pin->m_Flags == 0 ) continue; continue;
if( Pin == CurrentPin) continue; if( Pin->m_Flags == 0 )
continue;
if( Pin == CurrentPin )
continue;
if( CurrentPin->m_Convert && (CurrentPin->m_Convert != Pin->m_Convert) ) if( CurrentPin->m_Convert && (CurrentPin->m_Convert != Pin->m_Convert) )
continue; continue;
if( CurrentPin->m_Pos != Pin->m_Pos ) continue; if( CurrentPin->m_Pos != Pin->m_Pos )
if(Pin->m_Orient != CurrentPin->m_Orient) continue; continue;
if( Pin->m_Orient != CurrentPin->m_Orient )
continue;
DeleteOneLibraryDrawStruct( m_Parent->DrawPanel, NULL, DeleteOneLibraryDrawStruct( m_Parent->DrawPanel, NULL,
CurrentLibEntry, Pin, 0 ); CurrentLibEntry, Pin, 0 );
} }
@ -606,8 +680,10 @@ LibDrawPin * Pin, * CurrentPin = (LibDrawPin * ) CurrentDrawItem;
if( convert ) if( convert )
{ {
if ( LastPinCommonConvert ) CurrentPin->m_Convert = 0; if( LastPinCommonConvert )
else CurrentPin->m_Convert = CurrentConvert; CurrentPin->m_Convert = 0;
else
CurrentPin->m_Convert = CurrentConvert;
if( CurrentPin->m_Convert == 0 ) /* Effacement des pins redondantes */ if( CurrentPin->m_Convert == 0 ) /* Effacement des pins redondantes */
{ {
@ -615,13 +691,18 @@ LibDrawPin * Pin, * CurrentPin = (LibDrawPin * ) CurrentDrawItem;
for( ; DrawItem != NULL; ) for( ; DrawItem != NULL; )
{ {
Pin = (LibDrawPin*) DrawItem; DrawItem = DrawItem->Next(); Pin = (LibDrawPin*) DrawItem; DrawItem = DrawItem->Next();
if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if( Pin->m_Flags == 0 ) continue; continue;
if( Pin == CurrentPin) continue; if( Pin->m_Flags == 0 )
continue;
if( Pin == CurrentPin )
continue;
if( CurrentPin->m_Unit && (CurrentPin->m_Unit != Pin->m_Unit) ) if( CurrentPin->m_Unit && (CurrentPin->m_Unit != Pin->m_Unit) )
continue; continue;
if( CurrentPin->m_Pos != Pin->m_Pos ) continue; if( CurrentPin->m_Pos != Pin->m_Pos )
if(Pin->m_Orient != CurrentPin->m_Orient) continue; continue;
if( Pin->m_Orient != CurrentPin->m_Orient )
continue;
DeleteOneLibraryDrawStruct( m_Parent->DrawPanel, NULL, DeleteOneLibraryDrawStruct( m_Parent->DrawPanel, NULL,
CurrentLibEntry, Pin, 0 ); CurrentLibEntry, Pin, 0 );
} }
@ -630,13 +711,16 @@ LibDrawPin * Pin, * CurrentPin = (LibDrawPin * ) CurrentDrawItem;
if( draw ) if( draw )
{ {
if( LastPinNoDraw ) CurrentPin->m_Attributs |= PINNOTDRAW; if( LastPinNoDraw )
else CurrentPin->m_Attributs &= ~PINNOTDRAW; CurrentPin->m_Attributs |= PINNOTDRAW;
else
CurrentPin->m_Attributs &= ~PINNOTDRAW;
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if( Pin->m_Flags == 0 ) continue; if( Pin->m_Flags == 0 )
continue;
Pin->m_Attributs &= ~PINNOTDRAW; Pin->m_Attributs &= ~PINNOTDRAW;
if( CurrentPin->m_Attributs & PINNOTDRAW ) if( CurrentPin->m_Attributs & PINNOTDRAW )
Pin->m_Attributs |= PINNOTDRAW; Pin->m_Attributs |= PINNOTDRAW;
@ -648,16 +732,19 @@ LibDrawPin * Pin, * CurrentPin = (LibDrawPin * ) CurrentDrawItem;
/******************************************************/ /******************************************************/
void WinEDA_PinPropertiesFrame::NewSizePin( int newsize ) void WinEDA_PinPropertiesFrame::NewSizePin( int newsize )
/******************************************************/ /******************************************************/
/* Fonction permettant la mise aux dimensions courantes:
- longueur, dimension des textes
de la pin courante
/* Fonction permettant la mise aux dimensions courantes:
* - longueur, dimension des textes
* de la pin courante
*
*/ */
{ {
LibDrawPin* RefPin, * Pin = (LibDrawPin*) CurrentDrawItem; LibDrawPin* RefPin, * Pin = (LibDrawPin*) CurrentDrawItem;
if(CurrentLibEntry == NULL ) return; if( CurrentLibEntry == NULL )
if(Pin == NULL ) return; return;
if( Pin == NULL )
return;
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
@ -672,90 +759,110 @@ LibDrawPin * RefPin, * Pin = (LibDrawPin *) CurrentDrawItem;
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if( Pin->m_Pos != RefPin->m_Pos ) continue; continue;
if(Pin->m_Orient != RefPin->m_Orient) continue; if( Pin->m_Pos != RefPin->m_Pos )
if( Pin->m_Convert == RefPin->m_Convert ) Pin->m_PinLen = newsize; continue;
if( Pin->m_Orient != RefPin->m_Orient )
continue;
if( Pin->m_Convert == RefPin->m_Convert )
Pin->m_PinLen = newsize;
} }
} }
} }
/********************************************/ /********************************************/
static void CreateImagePins( LibDrawPin* Pin ) static void CreateImagePins( LibDrawPin* Pin )
/********************************************/ /********************************************/
/* Creation des autres pins pour les autres unites et pour convert, apres /* Creation des autres pins pour les autres unites et pour convert, apres
creation d'une pin * creation d'une pin
*/ */
{ {
int ii, CreateConv = FALSE; int ii, CreateConv = FALSE;
LibDrawPin* NewPin; LibDrawPin* NewPin;
if( g_EditPinByPinIsOn ) return; if( g_EditPinByPinIsOn )
return;
if( g_AsDeMorgan && (Pin->m_Convert != 0 ) ) CreateConv = TRUE; if( g_AsDeMorgan && (Pin->m_Convert != 0 ) )
CreateConv = TRUE;
/* Creation de la pin " convert " pour la part courante */ /* Creation de la pin " convert " pour la part courante */
if( CreateConv == TRUE ) if( CreateConv == TRUE )
{ {
NewPin = Pin->GenCopy(); NewPin = Pin->GenCopy();
if( Pin->m_Convert > 1 ) NewPin->m_Convert = 1; if( Pin->m_Convert > 1 )
else NewPin->m_Convert = 2; NewPin->m_Convert = 1;
else
NewPin->m_Convert = 2;
NewPin->Pnext = CurrentLibEntry->m_Drawings; NewPin->Pnext = CurrentLibEntry->m_Drawings;
CurrentLibEntry->m_Drawings = NewPin; CurrentLibEntry->m_Drawings = NewPin;
} }
for( ii = 1; ii <= CurrentLibEntry->m_UnitCount; ii++ ) for( ii = 1; ii <= CurrentLibEntry->m_UnitCount; ii++ )
{ {
if ( ii == CurrentUnit ) continue; /* Deja fait */ if( ii == CurrentUnit )
if( Pin->m_Unit == 0 ) continue; /* Pin commune a toutes les unites */ continue; /* Deja fait */
if( Pin->m_Unit == 0 )
continue; /* Pin commune a toutes les unites */
/* Creation pour la representation "normale" */ /* Creation pour la representation "normale" */
NewPin = Pin->GenCopy(); NewPin = Pin->GenCopy();
if( CurrentConvert != 0 ) NewPin->m_Convert = 1; if( CurrentConvert != 0 )
NewPin->m_Convert = 1;
NewPin->m_Unit = ii; NewPin->m_Unit = ii;
NewPin->Pnext = CurrentLibEntry->m_Drawings; NewPin->Pnext = CurrentLibEntry->m_Drawings;
CurrentLibEntry->m_Drawings = NewPin; CurrentLibEntry->m_Drawings = NewPin;
/* Creation pour la representation "Convert" */ /* Creation pour la representation "Convert" */
if( CreateConv == FALSE ) continue; if( CreateConv == FALSE )
continue;
NewPin = Pin->GenCopy(); NewPin = Pin->GenCopy();
NewPin->m_Convert = 2; NewPin->m_Convert = 2;
if( Pin->m_Unit != 0 ) NewPin->m_Unit = ii; if( Pin->m_Unit != 0 )
NewPin->m_Unit = ii;
NewPin->Pnext = CurrentLibEntry->m_Drawings; NewPin->Pnext = CurrentLibEntry->m_Drawings;
CurrentLibEntry->m_Drawings = NewPin; CurrentLibEntry->m_Drawings = NewPin;
} }
} }
/*************************************************/ /*************************************************/
void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC, void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
LibDrawPin* MasterPin, int id ) LibDrawPin* MasterPin, int id )
/*************************************************/ /*************************************************/
/* Depending on "id":
- Change pin text size (name or num) (range 10 .. 1000 mil)
- Change pin lenght.
If Pin is selected ( .m_flag == IS_SELECTED ) only the other selected pis are modified /* Depending on "id":
* - Change pin text size (name or num) (range 10 .. 1000 mil)
* - Change pin lenght.
*
* If Pin is selected ( .m_flag == IS_SELECTED ) only the other selected pis are modified
*/ */
{ {
LibDrawPin* Pin; LibDrawPin* Pin;
bool selected = (MasterPin->m_Selected & IS_SELECTED) != 0; bool selected = (MasterPin->m_Selected & IS_SELECTED) != 0;
if( (CurrentLibEntry == NULL) || (MasterPin == NULL) ) return; if( (CurrentLibEntry == NULL) || (MasterPin == NULL) )
if(MasterPin->Type() != COMPONENT_PIN_DRAW_TYPE ) return; return;
if( MasterPin->Type() != COMPONENT_PIN_DRAW_TYPE )
return;
GetScreen()->SetModify(); GetScreen()->SetModify();
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if ( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
if ( (Pin->m_Convert) && (Pin->m_Convert != CurrentConvert) ) continue; continue;
if( (Pin->m_Convert) && (Pin->m_Convert != CurrentConvert) )
continue;
// Is it the "selected mode" ? // Is it the "selected mode" ?
if (selected && (Pin->m_Selected & IS_SELECTED) == 0 ) continue; if( selected && (Pin->m_Selected & IS_SELECTED) == 0 )
continue;
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, Pin, CurrentUnit, g_XorMode ); DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, Pin, CurrentUnit, g_XorMode );
@ -780,8 +887,6 @@ bool selected = (MasterPin->m_Selected & IS_SELECTED) != 0;
} }
/************************************************************************/ /************************************************************************/
void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LibDrawPin* SourcePin ) void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LibDrawPin* SourcePin )
/************************************************************************/ /************************************************************************/
@ -791,9 +896,12 @@ LibDrawPin * Pin;
wxString msg; wxString msg;
int ox = 0, oy = 0; int ox = 0, oy = 0;
if(CurrentLibEntry == NULL ) return; if( CurrentLibEntry == NULL )
if(SourcePin == NULL ) return; return;
if(SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE ) return; if( SourcePin == NULL )
return;
if( SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE )
return;
Pin = SourcePin->GenCopy(); Pin = SourcePin->GenCopy();
Pin->Pnext = CurrentLibEntry->m_Drawings; Pin->Pnext = CurrentLibEntry->m_Drawings;
@ -812,7 +920,8 @@ int ox = 0, oy = 0;
CurrentDrawItem = Pin; CurrentDrawItem = Pin;
/* Marquage des pins a traiter */ /* Marquage des pins a traiter */
if( g_EditPinByPinIsOn == FALSE ) Pin->m_Flags |= IS_LINKED; if( g_EditPinByPinIsOn == FALSE )
Pin->m_Flags |= IS_LINKED;
wxPoint savepos = GetScreen()->m_Curseur; wxPoint savepos = GetScreen()->m_Curseur;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
@ -820,6 +929,7 @@ wxPoint savepos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur.y = -Pin->m_Pos.y; GetScreen()->m_Curseur.y = -Pin->m_Pos.y;
PlacePin( DC ); PlacePin( DC );
GetScreen()->m_Curseur = savepos; GetScreen()->m_Curseur = savepos;
// DrawPanel->MouseToCursorSchema(); // DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
@ -827,38 +937,48 @@ wxPoint savepos = GetScreen()->m_Curseur;
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
int sort_by_pin_number( const void* ref, const void* tst ) int sort_by_pin_number( const void* ref, const void* tst )
{ {
const LibDrawPin* Ref = *(LibDrawPin**) ref; const LibDrawPin* Ref = *(LibDrawPin**) ref;
const LibDrawPin* Tst = *(LibDrawPin**) tst; const LibDrawPin* Tst = *(LibDrawPin**) tst;
return ( Ref->m_PinNum - Tst->m_PinNum);
return Ref->m_PinNum - Tst->m_PinNum;
} }
/***************************************************************/ /***************************************************************/
bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry ) bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry )
/***************************************************************/ /***************************************************************/
// Test des pins ( duplicates...) // Test des pins ( duplicates...)
{ {
int nb_pins, ii, error; int nb_pins, ii, error;
LibDrawPin* Pin, ** PinList; LibDrawPin* Pin, ** PinList;
wxString msg; wxString msg;
if( CurrentLibEntry == NULL ) return FALSE; if( CurrentLibEntry == NULL )
return FALSE;
// Construction de la liste des pins: // Construction de la liste des pins:
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( nb_pins = 0; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( nb_pins = 0; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if ( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) nb_pins++; if( Pin->Type() == COMPONENT_PIN_DRAW_TYPE )
nb_pins++;
} }
PinList = (LibDrawPin**) MyZMalloc( (nb_pins + 1) * sizeof(LibDrawPin*) ); PinList = (LibDrawPin**) MyZMalloc( (nb_pins + 1) * sizeof(LibDrawPin*) );
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ii = 0; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ii = 0; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext )
{ {
if ( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) PinList[ii++] = Pin; if( Pin->Type() == COMPONENT_PIN_DRAW_TYPE )
PinList[ii++] = Pin;
} }
// Classement des pins par numero de pin // Classement des pins par numero de pin
qsort( PinList, nb_pins, sizeof(LibDrawPin*), sort_by_pin_number ); qsort( PinList, nb_pins, sizeof(LibDrawPin*), sort_by_pin_number );
// Controle des duplicates: // Controle des duplicates:
error = 0; error = 0;
for( ii = 1; ii < nb_pins; ii++ ) for( ii = 1; ii < nb_pins; ii++ )
@ -866,13 +986,17 @@ wxString msg;
wxString aux_msg, StringPinNum; wxString aux_msg, StringPinNum;
LibDrawPin* curr_pin = PinList[ii]; LibDrawPin* curr_pin = PinList[ii];
Pin = PinList[ii - 1]; Pin = PinList[ii - 1];
if ( Pin->m_PinNum != curr_pin->m_PinNum ) continue; if( Pin->m_PinNum != curr_pin->m_PinNum )
if ( Pin->m_Convert != curr_pin->m_Convert ) continue; continue;
if ( Pin->m_Unit != curr_pin->m_Unit ) continue; if( Pin->m_Convert != curr_pin->m_Convert )
continue;
if( Pin->m_Unit != curr_pin->m_Unit )
continue;
error++; error++;
curr_pin->ReturnPinStringNum( StringPinNum ); curr_pin->ReturnPinStringNum( StringPinNum );
msg.Printf( _( "Duplicate Pin %4.4s (Pin %s loc %d, %d, and Pin %s loc %d, %d)" ), msg.Printf( _( "Duplicate Pin %4.4s (Pin %s loc %d, %d, and Pin %s loc %d, %d)" ),
StringPinNum.GetData(), curr_pin->m_PinName.GetData(), curr_pin->m_Pos.x, -curr_pin->m_Pos.y, StringPinNum.GetData(),
curr_pin->m_PinName.GetData(), curr_pin->m_Pos.x, -curr_pin->m_Pos.y,
Pin->m_PinName.GetData(), Pin->m_Pos.x, -Pin->m_Pos.y ); Pin->m_PinName.GetData(), Pin->m_Pos.x, -Pin->m_Pos.y );
if( CurrentLibEntry->m_UnitCount > 1 ) if( CurrentLibEntry->m_UnitCount > 1 )
{ {
@ -881,8 +1005,10 @@ wxString msg;
} }
if( g_AsDeMorgan ) if( g_AsDeMorgan )
{ {
if( curr_pin->m_Convert) msg += _(" Convert"); if( curr_pin->m_Convert )
else msg += _(" Normal"); msg += _( " Convert" );
else
msg += _( " Normal" );
} }
DisplayError( this, msg ); DisplayError( this, msg );
} }
@ -890,4 +1016,3 @@ wxString msg;
free( PinList ); free( PinList );
return error ? TRUE : FALSE; return error ? TRUE : FALSE;
} }

View File

@ -1,4 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: plothpgl.cpp // Name: plothpgl.cpp
// Purpose: // Purpose:
// Author: jean-pierre Charras // Author: jean-pierre Charras
@ -93,17 +94,17 @@ static Ki_PageDescr * Plot_sheet_list[] =
/* Routines Locales */ /* Routines Locales */
/**************************************************************/ /**************************************************************/
void WinEDA_SchematicFrame::ToPlot_HPGL( wxCommandEvent& event ) void WinEDA_SchematicFrame::ToPlot_HPGL( wxCommandEvent& event )
/**************************************************************/ /**************************************************************/
{ {
WinEDA_PlotHPGLFrame* HPGL_frame = new WinEDA_PlotHPGLFrame( this ); WinEDA_PlotHPGLFrame* HPGL_frame = new WinEDA_PlotHPGLFrame( this );
HPGL_frame->ShowModal(); HPGL_frame->ShowModal();
HPGL_frame->Destroy(); HPGL_frame->Destroy();
} }
/*! /*!
* WinEDA_PlotHPGLFrame type definition * WinEDA_PlotHPGLFrame type definition
*/ */
@ -145,18 +146,30 @@ WinEDA_PlotHPGLFrame::WinEDA_PlotHPGLFrame( )
{ {
} }
WinEDA_PlotHPGLFrame::WinEDA_PlotHPGLFrame( WinEDA_DrawFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
WinEDA_PlotHPGLFrame::WinEDA_PlotHPGLFrame( WinEDA_DrawFrame* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{ {
m_Parent = parent; m_Parent = parent;
Create( parent, id, caption, pos, size, style ); Create( parent, id, caption, pos, size, style );
SetPageOffsetValue(); SetPageOffsetValue();
} }
/*! /*!
* WinEDA_PlotHPGLFrame creator * WinEDA_PlotHPGLFrame creator
*/ */
bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{ {
////@begin WinEDA_PlotHPGLFrame member initialisation ////@begin WinEDA_PlotHPGLFrame member initialisation
m_SizeOption = NULL; m_SizeOption = NULL;
@ -166,6 +179,7 @@ bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, wxWindowID id, const wxStri
m_PlotOrgPosition_X = NULL; m_PlotOrgPosition_X = NULL;
m_PlotOrgPosition_Y = NULL; m_PlotOrgPosition_Y = NULL;
m_MsgBox = NULL; m_MsgBox = NULL;
////@end WinEDA_PlotHPGLFrame member initialisation ////@end WinEDA_PlotHPGLFrame member initialisation
////@begin WinEDA_PlotHPGLFrame creation ////@begin WinEDA_PlotHPGLFrame creation
@ -176,10 +190,12 @@ bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, wxWindowID id, const wxStri
GetSizer()->Fit( this ); GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Centre(); Centre();
////@end WinEDA_PlotHPGLFrame creation ////@end WinEDA_PlotHPGLFrame creation
return true; return true;
} }
/*! /*!
* Control creation for WinEDA_PlotHPGLFrame * Control creation for WinEDA_PlotHPGLFrame
*/ */
@ -187,18 +203,22 @@ bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, wxWindowID id, const wxStri
void WinEDA_PlotHPGLFrame::CreateControls() void WinEDA_PlotHPGLFrame::CreateControls()
{ {
SetFont( *g_DialogFont ); SetFont( *g_DialogFont );
////@begin WinEDA_PlotHPGLFrame content construction ////@begin WinEDA_PlotHPGLFrame content construction
// Generated by DialogBlocks, 04/02/2006 16:54:19 (unregistered) // Generated by DialogBlocks, 04/02/2006 16:54:19 (unregistered)
WinEDA_PlotHPGLFrame* itemDialog1 = this; WinEDA_PlotHPGLFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
itemDialog1->SetSizer( itemBoxSizer2 ); itemDialog1->SetSizer( itemBoxSizer2 );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer4, 0, wxGROW | wxALL, 5 ); itemBoxSizer3->Add( itemBoxSizer4, 0, wxGROW | wxALL, 5 );
wxString m_SizeOptionStrings[] = { wxString m_SizeOptionStrings[] = {
@ -214,74 +234,169 @@ void WinEDA_PlotHPGLFrame::CreateControls()
_( "Page Size D" ), _( "Page Size D" ),
_( "Page Size E" ) _( "Page Size E" )
}; };
m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot page size:"), wxDefaultPosition, wxDefaultSize, 11, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS ); m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _(
"Plot page size:" ),
wxDefaultPosition,
wxDefaultSize, 11, m_SizeOptionStrings, 1,
wxRA_SPECIFY_COLS );
itemBoxSizer4->Add( m_SizeOption, 0, wxALIGN_LEFT | wxALL, 5 ); itemBoxSizer4->Add( m_SizeOption, 0, wxALIGN_LEFT | wxALL, 5 );
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer6, 0, wxALIGN_TOP | wxALL, 5 ); itemBoxSizer3->Add( itemBoxSizer6, 0, wxALIGN_TOP | wxALL, 5 );
wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Pen control:")); wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox( itemDialog1, wxID_ANY, _(
wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL); "Pen control:" ) );
wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(
itemStaticBoxSizer7Static,
wxVERTICAL );
itemBoxSizer6->Add( itemStaticBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); itemBoxSizer6->Add( itemStaticBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Width ( mils )"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _(
itemStaticBoxSizer7->Add(itemStaticText8, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); "Pen Width ( mils )" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer7->Add( itemStaticText8,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_ButtPenWidth = new wxSpinCtrl( itemDialog1,
ID_PEN_WIDTH_UPDATED,
_T( "0" ),
wxDefaultPosition,
wxDefaultSize,
wxSP_ARROW_KEYS | wxSP_WRAP,
1,
100,
0 );
m_ButtPenWidth = new wxSpinCtrl( itemDialog1, ID_PEN_WIDTH_UPDATED, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 1, 100, 0 );
itemStaticBoxSizer7->Add( m_ButtPenWidth, 0, wxALIGN_LEFT | wxALL, 5 ); itemStaticBoxSizer7->Add( m_ButtPenWidth, 0, wxALIGN_LEFT | wxALL, 5 );
wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Speed ( cm/s )"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _(
itemStaticBoxSizer7->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); "Pen Speed ( cm/s )" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer7->Add( itemStaticText10,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_ButtPenSpeed = new wxSpinCtrl( itemDialog1,
ID_PEN_SPEED_UPDATED,
_T( "0" ),
wxDefaultPosition,
wxDefaultSize,
wxSP_ARROW_KEYS,
1,
100,
0 );
m_ButtPenSpeed = new wxSpinCtrl( itemDialog1, ID_PEN_SPEED_UPDATED, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 );
itemStaticBoxSizer7->Add( m_ButtPenSpeed, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); itemStaticBoxSizer7->Add( m_ButtPenSpeed, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Number"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _(
itemStaticBoxSizer7->Add(itemStaticText12, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); "Pen Number" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer7->Add( itemStaticText12,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_ButtPenNum = new wxSpinCtrl( itemDialog1,
ID_PEN_NUMBER_UPDATED,
_T( "0" ),
wxDefaultPosition,
wxDefaultSize,
wxSP_ARROW_KEYS,
1,
8,
0 );
m_ButtPenNum = new wxSpinCtrl( itemDialog1, ID_PEN_NUMBER_UPDATED, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 8, 0 );
itemStaticBoxSizer7->Add( m_ButtPenNum, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); itemStaticBoxSizer7->Add( m_ButtPenNum, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Page offset:")); wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox( itemDialog1, wxID_ANY, _(
wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer(itemStaticBoxSizer14Static, wxVERTICAL); "Page offset:" ) );
wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer(
itemStaticBoxSizer14Static,
wxVERTICAL );
itemBoxSizer6->Add( itemStaticBoxSizer14, 0, wxALIGN_LEFT | wxALL, 5 ); itemBoxSizer6->Add( itemStaticBoxSizer14, 0, wxALIGN_LEFT | wxALL, 5 );
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset X"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _(
itemStaticBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); "Plot Offset X" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer14->Add( itemStaticText15,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(
"" ), wxDefaultPosition,
wxDefaultSize, 0 );
m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer14->Add( m_PlotOrgPosition_X, 0, wxALIGN_LEFT | wxALL, 5 ); itemStaticBoxSizer14->Add( m_PlotOrgPosition_X, 0, wxALIGN_LEFT | wxALL, 5 );
wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset Y"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _(
itemStaticBoxSizer14->Add(itemStaticText17, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); "Plot Offset Y" ),
wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer14->Add( itemStaticText17,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(
"" ), wxDefaultPosition,
wxDefaultSize, 0 );
m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticBoxSizer14->Add( m_PlotOrgPosition_Y, 0, wxALIGN_LEFT | wxALL, 5 ); itemStaticBoxSizer14->Add( m_PlotOrgPosition_Y, 0, wxALIGN_LEFT | wxALL, 5 );
itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* itemBoxSizer20 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer20, 0, wxALIGN_TOP | wxLEFT | wxTOP | wxBOTTOM, 5 ); itemBoxSizer3->Add( itemBoxSizer20, 0, wxALIGN_TOP | wxLEFT | wxTOP | wxBOTTOM, 5 );
wxButton* itemButton21 = new wxButton( itemDialog1, ID_PLOT_HPGL_CURRENT_EXECUTE, _("&Plot CURRENT"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton21 = new wxButton( itemDialog1, ID_PLOT_HPGL_CURRENT_EXECUTE, _(
"&Plot CURRENT" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemButton21->SetForegroundColour( wxColour( 0, 128, 0 ) ); itemButton21->SetForegroundColour( wxColour( 0, 128, 0 ) );
itemBoxSizer20->Add( itemButton21, 0, wxGROW | wxALL, 5 ); itemBoxSizer20->Add( itemButton21, 0, wxGROW | wxALL, 5 );
wxButton* itemButton22 = new wxButton( itemDialog1, ID_PLOT_HPGL_ALL_EXECUTE, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton22 = new wxButton( itemDialog1, ID_PLOT_HPGL_ALL_EXECUTE, _(
"Plot A&LL" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemButton22->SetForegroundColour( wxColour( 0, 0, 255 ) ); itemButton22->SetForegroundColour( wxColour( 0, 0, 255 ) );
itemBoxSizer20->Add( itemButton22, 0, wxGROW | wxALL, 5 ); itemBoxSizer20->Add( itemButton22, 0, wxGROW | wxALL, 5 );
wxButton* itemButton23 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton23 = new wxButton( itemDialog1, wxID_CANCEL, _(
"&Cancel" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemButton23->SetForegroundColour( wxColour( 128, 0, 0 ) ); itemButton23->SetForegroundColour( wxColour( 128, 0, 0 ) );
itemBoxSizer20->Add( itemButton23, 0, wxGROW | wxALL, 5 ); itemBoxSizer20->Add( itemButton23, 0, wxGROW | wxALL, 5 );
itemBoxSizer20->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); itemBoxSizer20->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxButton* itemButton25 = new wxButton( itemDialog1, ID_PLOT_ACCEPT_OFFSET, _("&Accept Offset"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton25 = new wxButton( itemDialog1, ID_PLOT_ACCEPT_OFFSET, _(
"&Accept Offset" ), wxDefaultPosition,
wxDefaultSize, 0 );
itemButton25->SetForegroundColour( wxColour( 101, 123, 68 ) ); itemButton25->SetForegroundColour( wxColour( 101, 123, 68 ) );
itemBoxSizer20->Add( itemButton25, 0, wxGROW | wxALL, 5 ); itemBoxSizer20->Add( itemButton25, 0, wxGROW | wxALL, 5 );
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 110), wxTE_MULTILINE ); m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(
"" ), wxDefaultPosition, wxSize( -1,
110 ), wxTE_MULTILINE );
itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL, 5 ); itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL, 5 );
@ -290,11 +405,11 @@ void WinEDA_PlotHPGLFrame::CreateControls()
m_ButtPenWidth->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Diam ) ); m_ButtPenWidth->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Diam ) );
m_ButtPenSpeed->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Speed ) ); m_ButtPenSpeed->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Speed ) );
m_ButtPenNum->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Num ) ); m_ButtPenNum->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Num ) );
////@end WinEDA_PlotHPGLFrame content construction ////@end WinEDA_PlotHPGLFrame content construction
} }
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_HPGL_CURRENT_EXECUTE * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_HPGL_CURRENT_EXECUTE
*/ */
@ -304,6 +419,7 @@ void WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick( wxCommandEvent& event
HPGL_Plot( event ); HPGL_Plot( event );
} }
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_HPGL_ALL_EXECUTE * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_HPGL_ALL_EXECUTE
*/ */
@ -313,6 +429,7 @@ void WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick( wxCommandEvent& event )
HPGL_Plot( event ); HPGL_Plot( event );
} }
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/ */
@ -322,9 +439,11 @@ void WinEDA_PlotHPGLFrame::OnCancelClick( wxCommandEvent& event )
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame. ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame.
// Before editing this code, remove the block markers. // Before editing this code, remove the block markers.
event.Skip(); event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame. ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame.
} }
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_ACCEPT_OFFSET * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_ACCEPT_OFFSET
*/ */
@ -334,6 +453,7 @@ void WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick( wxCommandEvent& event )
AcceptPlotOffset( event ); AcceptPlotOffset( event );
} }
/*! /*!
* Should we show tooltips? * Should we show tooltips?
*/ */
@ -343,6 +463,7 @@ bool WinEDA_PlotHPGLFrame::ShowToolTips()
return true; return true;
} }
/*! /*!
* Get bitmap resources * Get bitmap resources
*/ */
@ -353,9 +474,11 @@ wxBitmap WinEDA_PlotHPGLFrame::GetBitmapResource( const wxString& name )
////@begin WinEDA_PlotHPGLFrame bitmap retrieval ////@begin WinEDA_PlotHPGLFrame bitmap retrieval
wxUnusedVar( name ); wxUnusedVar( name );
return wxNullBitmap; return wxNullBitmap;
////@end WinEDA_PlotHPGLFrame bitmap retrieval ////@end WinEDA_PlotHPGLFrame bitmap retrieval
} }
/*! /*!
* Get icon resources * Get icon resources
*/ */
@ -366,16 +489,17 @@ wxIcon WinEDA_PlotHPGLFrame::GetIconResource( const wxString& name )
////@begin WinEDA_PlotHPGLFrame icon retrieval ////@begin WinEDA_PlotHPGLFrame icon retrieval
wxUnusedVar( name ); wxUnusedVar( name );
return wxNullIcon; return wxNullIcon;
////@end WinEDA_PlotHPGLFrame icon retrieval ////@end WinEDA_PlotHPGLFrame icon retrieval
} }
/***************************************************/ /***************************************************/
void WinEDA_PlotHPGLFrame::SetPageOffsetValue() void WinEDA_PlotHPGLFrame::SetPageOffsetValue()
/***************************************************/ /***************************************************/
{ {
wxString msg; wxString msg;
if( HPGL_SizeSelect != PAGE_DEFAULT ) if( HPGL_SizeSelect != PAGE_DEFAULT )
{ {
msg = ReturnStringFromValue( g_UnitMetric, msg = ReturnStringFromValue( g_UnitMetric,
@ -387,7 +511,6 @@ wxString msg;
m_PlotOrgPosition_X->Enable( TRUE ); m_PlotOrgPosition_X->Enable( TRUE );
m_PlotOrgPosition_Y->Enable( TRUE ); m_PlotOrgPosition_Y->Enable( TRUE );
} }
else else
{ {
@ -396,14 +519,17 @@ wxString msg;
} }
} }
/*****************************************************************/ /*****************************************************************/
void WinEDA_PlotHPGLFrame::AcceptPlotOffset( wxCommandEvent& event ) void WinEDA_PlotHPGLFrame::AcceptPlotOffset( wxCommandEvent& event )
/*****************************************************************/ /*****************************************************************/
{ {
int ii = m_SizeOption->GetSelection(); int ii = m_SizeOption->GetSelection();
if ( ii <= 0 ) HPGL_SizeSelect = 0; if( ii <= 0 )
else HPGL_SizeSelect = ii; HPGL_SizeSelect = 0;
else
HPGL_SizeSelect = ii;
if( HPGL_SizeSelect != PAGE_DEFAULT ) if( HPGL_SizeSelect != PAGE_DEFAULT )
{ {
@ -422,8 +548,10 @@ void WinEDA_PlotHPGLFrame::SetPenWidth(wxSpinEvent & event)
/************************************************************/ /************************************************************/
{ {
g_HPGL_Pen_Descr.m_Pen_Diam = m_ButtPenWidth->GetValue(); g_HPGL_Pen_Descr.m_Pen_Diam = m_ButtPenWidth->GetValue();
if ( g_HPGL_Pen_Descr.m_Pen_Diam > 100 ) g_HPGL_Pen_Descr.m_Pen_Diam = 100; if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 )
if ( g_HPGL_Pen_Descr.m_Pen_Diam < 1 ) g_HPGL_Pen_Descr.m_Pen_Diam = 1; g_HPGL_Pen_Descr.m_Pen_Diam = 100;
if( g_HPGL_Pen_Descr.m_Pen_Diam < 1 )
g_HPGL_Pen_Descr.m_Pen_Diam = 1;
} }
@ -432,17 +560,22 @@ void WinEDA_PlotHPGLFrame::SetPenSpeed(wxSpinEvent& event)
/*********************************************************/ /*********************************************************/
{ {
g_HPGL_Pen_Descr.m_Pen_Speed = m_ButtPenSpeed->GetValue(); g_HPGL_Pen_Descr.m_Pen_Speed = m_ButtPenSpeed->GetValue();
if ( g_HPGL_Pen_Descr.m_Pen_Speed > 40 ) g_HPGL_Pen_Descr.m_Pen_Speed = 40; if( g_HPGL_Pen_Descr.m_Pen_Speed > 40 )
if ( g_HPGL_Pen_Descr.m_Pen_Speed < 1 ) g_HPGL_Pen_Descr.m_Pen_Speed = 1; g_HPGL_Pen_Descr.m_Pen_Speed = 40;
if( g_HPGL_Pen_Descr.m_Pen_Speed < 1 )
g_HPGL_Pen_Descr.m_Pen_Speed = 1;
} }
/*******************************************************/ /*******************************************************/
void WinEDA_PlotHPGLFrame::SetPenNum( wxSpinEvent& event ) void WinEDA_PlotHPGLFrame::SetPenNum( wxSpinEvent& event )
/*******************************************************/ /*******************************************************/
{ {
g_HPGL_Pen_Descr.m_Pen_Num = m_ButtPenNum->GetValue(); g_HPGL_Pen_Descr.m_Pen_Num = m_ButtPenNum->GetValue();
if ( g_HPGL_Pen_Descr.m_Pen_Num > 8 ) g_HPGL_Pen_Descr.m_Pen_Num = 8; if( g_HPGL_Pen_Descr.m_Pen_Num > 8 )
if ( g_HPGL_Pen_Descr.m_Pen_Num < 1 ) g_HPGL_Pen_Descr.m_Pen_Num = 1; g_HPGL_Pen_Descr.m_Pen_Num = 8;
if( g_HPGL_Pen_Descr.m_Pen_Num < 1 )
g_HPGL_Pen_Descr.m_Pen_Num = 1;
} }
@ -452,7 +585,8 @@ void WinEDA_PlotHPGLFrame::HPGL_Plot(wxCommandEvent& event)
{ {
int Select_PlotAll = FALSE; int Select_PlotAll = FALSE;
if( event.GetId() == ID_PLOT_HPGL_ALL_EXECUTE ) Select_PlotAll = TRUE; if( event.GetId() == ID_PLOT_HPGL_ALL_EXECUTE )
Select_PlotAll = TRUE;
if( HPGL_SizeSelect ) if( HPGL_SizeSelect )
{ {
@ -467,17 +601,20 @@ int Select_PlotAll = FALSE;
Plot_Schematic_HPGL( Select_PlotAll, HPGL_SizeSelect ); Plot_Schematic_HPGL( Select_PlotAll, HPGL_SizeSelect );
} }
/*******************************************************************/ /*******************************************************************/
void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN* screen, void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN* screen,
wxSize& SheetSize, wxPoint& SheetOffset ) wxSize& SheetSize, wxPoint& SheetOffset )
/*******************************************************************/ /*******************************************************************/
/* Fonction calculant les dims et offsets de trace de la feuille selectionnee /* Fonction calculant les dims et offsets de trace de la feuille selectionnee
retourne: * retourne:
*/ */
{ {
Ki_PageDescr* PlotSheet; Ki_PageDescr* PlotSheet;
if( screen == NULL ) screen = m_Parent->GetScreen(); if( screen == NULL )
screen = m_Parent->GetBaseScreen();
PlotSheet = screen->m_CurrentSheetDesc; PlotSheet = screen->m_CurrentSheetDesc;
@ -485,6 +622,7 @@ Ki_PageDescr * PlotSheet;
SheetOffset = PlotSheet->m_Offset; SheetOffset = PlotSheet->m_Offset;
} }
/***********************************************************************************/ /***********************************************************************************/
void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_SheetSize ) void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_SheetSize )
/***********************************************************************************/ /***********************************************************************************/
@ -501,8 +639,10 @@ int margin;
/* Build the screen list */ /* Build the screen list */
EDA_ScreenList ScreenList; EDA_ScreenList ScreenList;
if ( Select_PlotAll == TRUE ) screen = ScreenList.GetFirst(); if( Select_PlotAll == TRUE )
else screen = m_Parent->GetScreen(); screen = ScreenList.GetFirst();
else
screen = m_Parent->GetBaseScreen();
for( ; screen != NULL; screen = ScreenList.GetNext() ) for( ; screen != NULL; screen = ScreenList.GetNext() )
{ {
ReturnSheetDims( screen, SheetSize, SheetOffset ); ReturnSheetDims( screen, SheetSize, SheetOffset );
@ -526,14 +666,16 @@ int margin;
wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; wxString dirbuf = wxGetCwd() + STRING_DIR_SEP;
if( !ShortFileName.IsEmpty() ) if( !ShortFileName.IsEmpty() )
PlotFileName = MakeFileName( dirbuf, ShortFileName, wxT( ".plt" ) ); PlotFileName = MakeFileName( dirbuf, ShortFileName, wxT( ".plt" ) );
else PlotFileName = MakeFileName(dirbuf, g_DefaultSchematicFileName, wxT(".plt")); else
PlotFileName = MakeFileName( dirbuf, g_DefaultSchematicFileName, wxT( ".plt" ) );
setlocale( LC_NUMERIC, "C" ); setlocale( LC_NUMERIC, "C" );
InitPlotParametresHPGL( PlotOffset, g_PlotScaleX, g_PlotScaleY ); InitPlotParametresHPGL( PlotOffset, g_PlotScaleX, g_PlotScaleY );
Plot_1_Page_HPGL( PlotFileName, screen ); Plot_1_Page_HPGL( PlotFileName, screen );
setlocale( LC_NUMERIC, "" ); setlocale( LC_NUMERIC, "" );
screen = (BASE_SCREEN*) screen->Pnext; screen = (BASE_SCREEN*) screen->Pnext;
if ( Select_PlotAll == FALSE ) break; if( Select_PlotAll == FALSE )
break;
} }
m_MsgBox->AppendText( _( "** Plot End **\n" ) ); m_MsgBox->AppendText( _( "** Plot End **\n" ) );
@ -546,7 +688,7 @@ void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL(const wxString & FullFileName,
/**************************************************************************/ /**************************************************************************/
/* Trace en format HPGL. d'une feuille de dessin /* Trace en format HPGL. d'une feuille de dessin
1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) . * 1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) .
*/ */
{ {
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
@ -574,6 +716,7 @@ wxString msg;
{ {
Plume( 'U' ); Plume( 'U' );
layer = LAYER_NOTES; layer = LAYER_NOTES;
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
@ -582,6 +725,7 @@ wxString msg;
x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y; x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y;
x2 = STRUCT->m_End().x; y2 = STRUCT->m_End().y; x2 = STRUCT->m_End().x; y2 = STRUCT->m_End().y;
layer = STRUCT->GetLayer(); layer = STRUCT->GetLayer();
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_DrawLineStruct*) DrawList ) #define STRUCT ( (EDA_DrawLineStruct*) DrawList )
@ -591,6 +735,7 @@ wxString msg;
x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y; x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y;
layer = STRUCT->GetLayer(); layer = STRUCT->GetLayer();
} }
switch( layer ) switch( layer )
{ {
case LAYER_NOTES: /* Trace en pointilles */ case LAYER_NOTES: /* Trace en pointilles */
@ -603,8 +748,10 @@ wxString msg;
case LAYER_BUS: /* Trait large */ case LAYER_BUS: /* Trait large */
{ {
int deltaX = 0, deltaY = 0; double angle; int deltaX = 0, deltaY = 0; double angle;
if( (x2 - x1) == 0 ) deltaX = 8; if( (x2 - x1) == 0 )
else if( (y2 - y1) == 0 ) deltaY = 8; deltaX = 8;
else if( (y2 - y1) == 0 )
deltaY = 8;
else else
{ {
angle = atan2( (double) (x2 - x1), (double) (y1 - y2) ); angle = atan2( (double) (x2 - x1), (double) (y1 - y2) );
@ -624,6 +771,7 @@ wxString msg;
Move_Plume( wxPoint( x2, y2 ), 'D' ); Move_Plume( wxPoint( x2, y2 ), 'D' );
break; break;
} }
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
@ -645,10 +793,17 @@ wxString msg;
PlotLibPart( DrawLibItem ); PlotLibPart( DrawLibItem );
break; break;
case DRAW_PICK_ITEM_STRUCT_TYPE : break; case DRAW_PICK_ITEM_STRUCT_TYPE:
case DRAW_POLYLINE_STRUCT_TYPE : break; break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE : break;
case DRAW_MARKER_STRUCT_TYPE : break; case DRAW_POLYLINE_STRUCT_TYPE:
break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
break;
case DRAW_MARKER_STRUCT_TYPE:
break;
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
@ -674,6 +829,7 @@ wxString msg;
CloseFileHPGL( PlotOutput ); CloseFileHPGL( PlotOutput );
} }
/*! /*!
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX * wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX
*/ */
@ -685,8 +841,6 @@ void WinEDA_PlotHPGLFrame::OnRadioboxSelected( wxCommandEvent& event )
} }
/*! /*!
* wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_PEN_WIDTH_UPDATED * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_PEN_WIDTH_UPDATED
*/ */
@ -696,6 +850,7 @@ void WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated( wxSpinEvent& event )
SetPenWidth( event ); SetPenWidth( event );
} }
/*! /*!
* wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_PEN_SPEED_UPDATED * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_PEN_SPEED_UPDATED
*/ */
@ -705,6 +860,7 @@ void WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated( wxSpinEvent& event )
SetPenSpeed( event ); SetPenSpeed( event );
} }
/*! /*!
* wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_PEN_NUMBER_UPDATED * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_PEN_NUMBER_UPDATED
*/ */
@ -713,4 +869,3 @@ void WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated( wxSpinEvent& event )
{ {
SetPenNum( event ); SetPenNum( event );
} }

View File

@ -26,6 +26,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );
SCH_SCREEN* screen = GetScreen();
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
@ -119,7 +120,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE ) if( screen->BlockLocate.m_Command != BLOCK_IDLE )
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor = DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
DrawPanel-> DrawPanel->
m_PanelDefaultCursor ) ); m_PanelDefaultCursor ) );
@ -129,11 +130,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
/* ne devrait pas etre execute, sauf bug: */ /* ne devrait pas etre execute, sauf bug: */
if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE ) if( screen->BlockLocate.m_Command != BLOCK_IDLE )
{ {
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE; screen->BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK; screen->BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; screen->BlockLocate.m_BlockDrawStruct = NULL;
} }
break; break;
@ -166,14 +167,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case wxID_CUT: case wxID_CUT:
if( GetScreen()->BlockLocate.m_Command != BLOCK_MOVE ) if( screen->BlockLocate.m_Command != BLOCK_MOVE )
break; break;
HandleBlockEndByPopUp( BLOCK_DELETE, &dc ); HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
break; break;
case wxID_PASTE: case wxID_PASTE:
HandleBlockBegin( &dc, BLOCK_PASTE, GetScreen()->m_Curseur ); HandleBlockBegin( &dc, BLOCK_PASTE, screen->m_Curseur );
break; break;
case ID_HIERARCHY_PUSH_POP_BUTT: case ID_HIERARCHY_PUSH_POP_BUTT:
@ -247,13 +248,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ENTRY_SELECT_SLASH: case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
SetBusEntryShape( &dc, SetBusEntryShape( &dc,
(DrawBusEntryStruct*) GetScreen()->GetCurItem(), '/' ); (DrawBusEntryStruct*) screen->GetCurItem(), '/' );
break; break;
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH: case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
SetBusEntryShape( &dc, SetBusEntryShape( &dc,
(DrawBusEntryStruct*) GetScreen()->GetCurItem(), '\\' ); (DrawBusEntryStruct*) screen->GetCurItem(), '\\' );
break; break;
case ID_NO_SELECT_BUTT: case ID_NO_SELECT_BUTT:
@ -271,35 +272,35 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_EDIT_TEXT: case ID_POPUP_SCH_EDIT_TEXT:
EditSchematicText( (SCH_TEXT*) GetScreen()->GetCurItem(), &dc ); EditSchematicText( (SCH_TEXT*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_ROTATE_TEXT: case ID_POPUP_SCH_ROTATE_TEXT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ChangeTextOrient( (SCH_TEXT*) GetScreen()->GetCurItem(), &dc ); ChangeTextOrient( (SCH_TEXT*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(), ConvertTextType( (SCH_TEXT*) screen->GetCurItem(),
&dc, TYPE_SCH_LABEL ); &dc, TYPE_SCH_LABEL );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(), ConvertTextType( (SCH_TEXT*) screen->GetCurItem(),
&dc, TYPE_SCH_GLOBALLABEL ); &dc, TYPE_SCH_GLOBALLABEL );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(), ConvertTextType( (SCH_TEXT*) screen->GetCurItem(),
&dc, TYPE_SCH_HIERLABEL ); &dc, TYPE_SCH_HIERLABEL );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(), ConvertTextType( (SCH_TEXT*) screen->GetCurItem(),
&dc, TYPE_SCH_TEXT ); &dc, TYPE_SCH_TEXT );
break; break;
@ -310,11 +311,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ROTATE_FIELD: case ID_POPUP_SCH_ROTATE_FIELD:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
RotateCmpField( (PartTextStruct*) GetScreen()->GetCurItem(), &dc ); RotateCmpField( (PartTextStruct*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_FIELD: case ID_POPUP_SCH_EDIT_FIELD:
EditCmpFieldText( (PartTextStruct*) GetScreen()->GetCurItem(), &dc ); EditCmpFieldText( (PartTextStruct*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_DELETE_NODE: case ID_POPUP_SCH_DELETE_NODE:
@ -322,41 +323,43 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DeleteConnection( &dc, DeleteConnection( &dc,
id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE ); id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE );
GetScreen()->SetCurItem( NULL ); screen->SetCurItem( NULL );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
TestDanglingEnds( GetScreen()->EEDrawList, &dc ); TestDanglingEnds( screen->EEDrawList, &dc );
break; break;
case ID_POPUP_SCH_BREAK_WIRE: case ID_POPUP_SCH_BREAK_WIRE:
{ {
DrawPickedStruct* ListForUndo; DrawPickedStruct* ListForUndo;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ListForUndo = BreakSegment( (SCH_SCREEN*) GetScreen(), ListForUndo = BreakSegment( screen, screen->m_Curseur, TRUE );
GetScreen()->m_Curseur, TRUE );
if( ListForUndo ) if( ListForUndo )
SaveCopyInUndoList( ListForUndo, IS_NEW | IS_CHANGED ); SaveCopyInUndoList( ListForUndo, IS_NEW | IS_CHANGED );
TestDanglingEnds( GetScreen()->EEDrawList, &dc ); TestDanglingEnds( screen->EEDrawList, &dc );
} }
break; break;
case ID_POPUP_SCH_DELETE_CMP: case ID_POPUP_SCH_DELETE_CMP:
if( GetScreen()->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) screen->SetCurItem( LocateSmallestComponent( screen ) );
GetScreen() ) );
case ID_POPUP_SCH_DELETE: case ID_POPUP_SCH_DELETE:
if( GetScreen()->GetCurItem() == NULL ) {
SCH_ITEM* item = screen->GetCurItem();
if( item == NULL )
break; break;
DeleteStruct( DrawPanel, &dc, (SCH_ITEM*)GetScreen()->GetCurItem() );
GetScreen()->SetCurItem( NULL ); DeleteStruct( DrawPanel, &dc, item );
screen->SetCurItem( NULL );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
TestDanglingEnds( GetScreen()->EEDrawList, &dc ); TestDanglingEnds( screen->EEDrawList, &dc );
GetScreen()->SetModify(); screen->SetModify();
}
break; break;
case ID_SCHEMATIC_DELETE_ITEM_BUTT: case ID_SCHEMATIC_DELETE_ITEM_BUTT:
@ -365,33 +368,33 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_END_SHEET: case ID_POPUP_SCH_END_SHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
((SCH_ITEM*)GetScreen()->GetCurItem())->Place( this, &dc ); screen->GetCurItem()->Place( this, &dc );
break; break;
case ID_POPUP_SCH_RESIZE_SHEET: case ID_POPUP_SCH_RESIZE_SHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ReSizeSheet( (DrawSheetStruct*) GetScreen()->GetCurItem(), &dc ); ReSizeSheet( (DrawSheetStruct*) screen->GetCurItem(), &dc );
TestDanglingEnds( GetScreen()->EEDrawList, &dc ); TestDanglingEnds( screen->EEDrawList, &dc );
break; break;
case ID_POPUP_SCH_EDIT_SHEET: case ID_POPUP_SCH_EDIT_SHEET:
EditSheet( (DrawSheetStruct*) GetScreen()->GetCurItem(), &dc ); EditSheet( (DrawSheetStruct*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_CLEANUP_SHEET: case ID_POPUP_SCH_CLEANUP_SHEET:
( (DrawSheetStruct*) ( (DrawSheetStruct*)
GetScreen()->GetCurItem() )->CleanupSheet( this, &dc ); screen->GetCurItem() )->CleanupSheet( this, &dc );
break; break;
case ID_POPUP_SCH_EDIT_PINSHEET: case ID_POPUP_SCH_EDIT_PINSHEET:
Edit_PinSheet( (Hierarchical_PIN_Sheet_Struct*) Edit_PinSheet( (Hierarchical_PIN_Sheet_Struct*)
GetScreen()->GetCurItem(), &dc ); screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_MOVE_PINSHEET: case ID_POPUP_SCH_MOVE_PINSHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMove_PinSheet( (Hierarchical_PIN_Sheet_Struct*) StartMove_PinSheet( (Hierarchical_PIN_Sheet_Struct*)
GetScreen()->GetCurItem(), &dc ); screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_DRAG_CMP_REQUEST: case ID_POPUP_SCH_DRAG_CMP_REQUEST:
@ -399,10 +402,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) screen->SetCurItem( LocateSmallestComponent( screen ) );
GetScreen() ) ); if( screen->GetCurItem() == NULL )
if( GetScreen()->GetCurItem() == NULL )
break; break;
case ID_POPUP_SCH_MOVE_ITEM_REQUEST: case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
@ -411,29 +413,28 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
// The easiest way to handle a drag component is simulate a // The easiest way to handle a drag component is simulate a
// block drag command // block drag command
if( GetScreen()->BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->BlockLocate.m_State == STATE_NO_BLOCK )
{ {
if( !HandleBlockBegin( &dc, BLOCK_DRAG, if( !HandleBlockBegin( &dc, BLOCK_DRAG,
GetScreen()->m_Curseur ) ) screen->m_Curseur ) )
break; break;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
} }
} }
else else
Process_Move_Item( (SCH_ITEM*) GetScreen()->GetCurItem(), &dc ); Process_Move_Item( (SCH_ITEM*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_CMP: case ID_POPUP_SCH_EDIT_CMP:
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) screen->SetCurItem( LocateSmallestComponent( screen ) );
GetScreen() ) ); if( screen->GetCurItem() == NULL )
if( GetScreen()->GetCurItem() == NULL )
break; break;
InstallCmpeditFrame( this, pos, InstallCmpeditFrame( this, pos,
(SCH_COMPONENT*) GetScreen()->GetCurItem() ); (SCH_COMPONENT*) screen->GetCurItem() );
break; break;
case ID_POPUP_SCH_MIROR_X_CMP: case ID_POPUP_SCH_MIROR_X_CMP:
@ -444,10 +445,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) screen->SetCurItem( LocateSmallestComponent( screen ) );
GetScreen() ) ); if( screen->GetCurItem() == NULL )
if( GetScreen()->GetCurItem() == NULL )
break; break;
{ {
int option; int option;
@ -472,11 +472,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( GetScreen()->GetCurItem()->m_Flags == 0 ) if( screen->GetCurItem()->m_Flags == 0 )
SaveCopyInUndoList( (SCH_ITEM*) GetScreen()->GetCurItem(), IS_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(), IS_CHANGED );
CmpRotationMiroir( CmpRotationMiroir(
(SCH_COMPONENT*) GetScreen()->GetCurItem(), (SCH_COMPONENT*) screen->GetCurItem(),
&dc, option ); &dc, option );
break; break;
} }
@ -489,41 +489,38 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) screen->SetCurItem( LocateSmallestComponent( screen ) );
GetScreen() ) ); if( screen->GetCurItem() == NULL )
if( GetScreen()->GetCurItem() == NULL )
break; break;
EditComponentValue( EditComponentValue(
(SCH_COMPONENT*) GetScreen()->GetCurItem(), &dc ); (SCH_COMPONENT*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_REF_CMP: case ID_POPUP_SCH_EDIT_REF_CMP:
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) screen->SetCurItem( LocateSmallestComponent( screen ) );
GetScreen() ) ); if( screen->GetCurItem() == NULL )
if( GetScreen()->GetCurItem() == NULL )
break; break;
EditComponentReference( EditComponentReference(
(SCH_COMPONENT*) GetScreen()->GetCurItem(), &dc ); (SCH_COMPONENT*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP: case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP:
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) screen->SetCurItem( LocateSmallestComponent( screen ) );
GetScreen() ) ); if( screen->GetCurItem() == NULL )
if( GetScreen()->GetCurItem() == NULL )
break; break;
EditComponentFootprint( EditComponentFootprint(
(SCH_COMPONENT*) GetScreen()->GetCurItem(), &dc ); (SCH_COMPONENT*) screen->GetCurItem(), &dc );
break; break;
@ -531,14 +528,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) screen->SetCurItem( LocateSmallestComponent( screen ) );
GetScreen() ) ); if( screen->GetCurItem() == NULL )
if( GetScreen()->GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertPart( ConvertPart(
(SCH_COMPONENT*) GetScreen()->GetCurItem(), (SCH_COMPONENT*) screen->GetCurItem(),
&dc ); &dc );
break; break;
@ -546,10 +542,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
{ {
SCH_COMPONENT* olditem, * newitem; SCH_COMPONENT* olditem, * newitem;
if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) screen->SetCurItem( LocateSmallestComponent( screen ) );
GetScreen() ) ); olditem = (SCH_COMPONENT*) screen->GetCurItem();
olditem = (SCH_COMPONENT*) GetScreen()->GetCurItem();
if( olditem == NULL ) if( olditem == NULL )
break; break;
newitem = olditem->GenCopy(); newitem = olditem->GenCopy();
@ -593,14 +588,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) screen->SetCurItem( LocateSmallestComponent( screen ) );
GetScreen() ) ); if( screen->GetCurItem() == NULL )
if( GetScreen()->GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
SelPartUnit( SelPartUnit(
(SCH_COMPONENT*) GetScreen()->GetCurItem(), (SCH_COMPONENT*) screen->GetCurItem(),
id + 1 - ID_POPUP_SCH_SELECT_UNIT1, id + 1 - ID_POPUP_SCH_SELECT_UNIT1,
&dc ); &dc );
break; break;
@ -609,15 +603,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a piece of a // Ensure the struct is a component (could be a piece of a
// component, like Field, text..) // component, like Field, text..)
if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) screen->SetCurItem( LocateSmallestComponent( screen ) );
GetScreen() ) ); if( screen->GetCurItem() == NULL )
if( GetScreen()->GetCurItem() == NULL )
break; break;
{ {
EDA_LibComponentStruct* LibEntry; EDA_LibComponentStruct* LibEntry;
LibEntry = FindLibPart( LibEntry = FindLibPart(
( (SCH_COMPONENT*) GetScreen()->GetCurItem() )->m_ChipName, ( (SCH_COMPONENT*) screen->GetCurItem() )->m_ChipName,
wxEmptyString, wxEmptyString,
FIND_ALIAS ); FIND_ALIAS );
if( LibEntry && LibEntry->m_DocFile != wxEmptyString ) if( LibEntry && LibEntry->m_DocFile != wxEmptyString )
@ -629,7 +622,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ENTER_SHEET: case ID_POPUP_SCH_ENTER_SHEET:
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); EDA_BaseStruct* DrawStruct = screen->GetCurItem();
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) ) if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
{ {
InstallNextScreen( (DrawSheetStruct*) DrawStruct ); InstallNextScreen( (DrawSheetStruct*) DrawStruct );
@ -687,30 +680,30 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ADD_JUNCTION: case ID_POPUP_SCH_ADD_JUNCTION:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
GetScreen()->SetCurItem( screen->SetCurItem(
CreateNewJunctionStruct( &dc, GetScreen()->m_Curseur, TRUE ) ); CreateNewJunctionStruct( &dc, screen->m_Curseur, TRUE ) );
TestDanglingEnds( GetScreen()->EEDrawList, &dc ); TestDanglingEnds( screen->EEDrawList, &dc );
GetScreen()->SetCurItem( NULL ); screen->SetCurItem( NULL );
break; break;
case ID_POPUP_SCH_ADD_LABEL: case ID_POPUP_SCH_ADD_LABEL:
case ID_POPUP_SCH_ADD_GLABEL: case ID_POPUP_SCH_ADD_GLABEL:
GetScreen()->SetCurItem( screen->SetCurItem(
CreateNewText( &dc, CreateNewText( &dc,
id == ID_POPUP_SCH_ADD_LABEL ? id == ID_POPUP_SCH_ADD_LABEL ?
LAYER_LOCLABEL : LAYER_GLOBLABEL ) ); LAYER_LOCLABEL : LAYER_GLOBLABEL ) );
if( GetScreen()->GetCurItem() ) if( screen->GetCurItem() )
{ {
((SCH_ITEM*)GetScreen()->GetCurItem())->Place( this, &dc ); ((SCH_ITEM*)screen->GetCurItem())->Place( this, &dc );
TestDanglingEnds( GetScreen()->EEDrawList, &dc ); TestDanglingEnds( screen->EEDrawList, &dc );
GetScreen()->SetCurItem( NULL ); screen->SetCurItem( NULL );
} }
break; break;
case ID_SCHEMATIC_UNDO: case ID_SCHEMATIC_UNDO:
if( GetSchematicFromUndoList() ) if( GetSchematicFromUndoList() )
{ {
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( screen->EEDrawList, NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
break; break;
@ -718,7 +711,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_SCHEMATIC_REDO: case ID_SCHEMATIC_REDO:
if( GetSchematicFromRedoList() ) if( GetSchematicFromRedoList() )
{ {
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( screen->EEDrawList, NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
break; break;

View File

@ -151,10 +151,13 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
#endif #endif
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
/* Get config */ /* Get config */
GetSettings(); GetSettings();
g_DrawMinimunLineWidth = g_DrawMinimunLineWidth =
m_Parent->m_EDA_Config->Read( MINI_DRAW_LINE_WIDTH_KEY, (long) 0 ); m_Parent->m_EDA_Config->Read( MINI_DRAW_LINE_WIDTH_KEY, (long) 0 );
g_PlotPSMinimunLineWidth = g_PlotPSMinimunLineWidth =
m_Parent->m_EDA_Config->Read( MINI_PLOTPS_LINE_WIDTH_KEY, (long) 4 ); m_Parent->m_EDA_Config->Read( MINI_PLOTPS_LINE_WIDTH_KEY, (long) 4 );
@ -183,6 +186,12 @@ WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
} }
BASE_SCREEN* WinEDA_SchematicFrame::GetBaseScreen() const
{
return GetScreen();
}
/***************/ /***************/
/* utility functions */ /* utility functions */
/***************/ /***************/
@ -192,7 +201,7 @@ DrawSheetPath* WinEDA_SchematicFrame::GetSheet()
} }
BASE_SCREEN* WinEDA_SchematicFrame::GetScreen() SCH_SCREEN* WinEDA_SchematicFrame::GetScreen() const
{ {
return m_CurrentSheet->LastScreen(); return m_CurrentSheet->LastScreen();
} }

View File

@ -468,7 +468,7 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
wxPoint move_vector; wxPoint move_vector;
Hierarchical_PIN_Sheet_Struct* SheetLabel; Hierarchical_PIN_Sheet_Struct* SheetLabel;
BASE_SCREEN* screen = panel->m_Parent->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
DrawSheetStruct* Sheet = (DrawSheetStruct*) DrawSheetStruct* Sheet = (DrawSheetStruct*)
screen->GetCurItem(); screen->GetCurItem();
@ -479,10 +479,8 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( Sheet->m_Flags & IS_RESIZED ) if( Sheet->m_Flags & IS_RESIZED )
{ {
Sheet->m_Size.x = MAX( s_SheetMindx, Sheet->m_Size.x = MAX( s_SheetMindx, screen->m_Curseur.x - Sheet->m_Pos.x );
screen->m_Curseur.x - Sheet->m_Pos.x ); Sheet->m_Size.y = MAX( s_SheetMindy, screen->m_Curseur.y - Sheet->m_Pos.y );
Sheet->m_Size.y = MAX( s_SheetMindy,
screen->m_Curseur.y - Sheet->m_Pos.y );
SheetLabel = Sheet->m_Label; SheetLabel = Sheet->m_Label;
while( SheetLabel ) while( SheetLabel )
{ {
@ -507,7 +505,7 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/****************************************/ /****************************************/
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC ) static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->m_Parent->GetScreen(); SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->GetScreen();
DrawSheetStruct* Sheet = (DrawSheetStruct*) Screen->GetCurItem(); DrawSheetStruct* Sheet = (DrawSheetStruct*) Screen->GetCurItem();
if( Sheet == NULL ) if( Sheet == NULL )
@ -530,7 +528,7 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
else if( Sheet->m_Flags & IS_MOVED ) /* move en cours: on l'annule */ else if( Sheet->m_Flags & IS_MOVED ) /* move en cours: on l'annule */
{ {
wxPoint curspos = Screen->m_Curseur; wxPoint curspos = Screen->m_Curseur;
Panel->m_Parent->GetScreen()->m_Curseur = s_OldPos; Panel->GetScreen()->m_Curseur = s_OldPos;
DeplaceSheet( Panel, DC, TRUE ); DeplaceSheet( Panel, DC, TRUE );
RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE );
Sheet->m_Flags = 0; Sheet->m_Flags = 0;

View File

@ -169,7 +169,7 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
* de deplacement * de deplacement
* Si le NetSheet est nouveau, il est pointe par NewSheetLabel * Si le NetSheet est nouveau, il est pointe par NewSheetLabel
*/ */
void Hierarchical_PIN_Sheet_Struct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) void Hierarchical_PIN_Sheet_Struct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
{ {
DrawSheetStruct* Sheet = (DrawSheetStruct*) m_Parent; DrawSheetStruct* Sheet = (DrawSheetStruct*) m_Parent;
@ -237,7 +237,7 @@ void WinEDA_SchematicFrame::StartMove_PinSheet( Hierarchical_PIN_Sheet_Struct* S
static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
Hierarchical_PIN_Sheet_Struct* SheetLabel = (Hierarchical_PIN_Sheet_Struct*) Hierarchical_PIN_Sheet_Struct* SheetLabel = (Hierarchical_PIN_Sheet_Struct*)
panel->m_Parent->GetScreen()->GetCurItem(); panel->GetScreen()->GetCurItem();
if( SheetLabel == NULL ) if( SheetLabel == NULL )
return; return;
@ -251,13 +251,13 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
SheetLabel->m_Edge = 0; SheetLabel->m_Edge = 0;
SheetLabel->m_Pos.x = Sheet->m_Pos.x; SheetLabel->m_Pos.x = Sheet->m_Pos.x;
if( panel->m_Parent->GetScreen()->m_Curseur.x > ( Sheet->m_Pos.x + (Sheet->m_Size.x / 2) ) ) if( panel->GetScreen()->m_Curseur.x > ( Sheet->m_Pos.x + (Sheet->m_Size.x / 2) ) )
{ {
SheetLabel->m_Edge = 1; SheetLabel->m_Edge = 1;
SheetLabel->m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x; SheetLabel->m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x;
} }
SheetLabel->m_Pos.y = panel->m_Parent->GetScreen()->m_Curseur.y; SheetLabel->m_Pos.y = panel->GetScreen()->m_Curseur.y;
if( SheetLabel->m_Pos.y < Sheet->m_Pos.y ) if( SheetLabel->m_Pos.y < Sheet->m_Pos.y )
SheetLabel->m_Pos.y = Sheet->m_Pos.y; SheetLabel->m_Pos.y = Sheet->m_Pos.y;
if( SheetLabel->m_Pos.y > (Sheet->m_Pos.y + Sheet->m_Size.y) ) if( SheetLabel->m_Pos.y > (Sheet->m_Pos.y + Sheet->m_Size.y) )

View File

@ -383,7 +383,7 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool era
/* Redraw the graphoc shape while moving /* Redraw the graphoc shape while moving
*/ */
{ {
BASE_SCREEN* Screen = panel->m_Parent->GetScreen(); BASE_SCREEN* Screen = panel->GetScreen();
int mx, my; int mx, my;
/* Erase shape in the old positon*/ /* Erase shape in the old positon*/
@ -529,7 +529,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
int DrawMode = g_XorMode; int DrawMode = g_XorMode;
int* ptpoly; int* ptpoly;
int dx, dy; int dx, dy;
BASE_SCREEN* Screen = panel->m_Parent->GetScreen(); BASE_SCREEN* Screen = panel->GetScreen();
int mx = Screen->m_Curseur.x, int mx = Screen->m_Curseur.x,
my = Screen->m_Curseur.y; my = Screen->m_Curseur.y;

View File

@ -69,7 +69,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
if( m_Semaphore ) if( m_Semaphore )
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP ); SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
m_CurrentScreen = new SCH_SCREEN( VIEWER_FRAME ); SetBaseScreen( new SCH_SCREEN( VIEWER_FRAME ) );
GetScreen()->SetZoom( 16 ); GetScreen()->SetZoom( 16 );
if( Library == NULL ) if( Library == NULL )
@ -110,7 +110,9 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame() WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
{ {
SAFE_DELETE( m_CurrentScreen ); delete GetScreen();
SetBaseScreen( 0 );
m_Parent->m_ViewlibFrame = NULL; m_Parent->m_ViewlibFrame = NULL;
} }

View File

@ -239,7 +239,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
} }
} }
if( panel->m_Parent->GetScreen()->BlockLocate.m_State != STATE_BLOCK_STOP ) if( panel->GetScreen()->BlockLocate.m_State != STATE_BLOCK_STOP )
{ {
screen->BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->BlockLocate.GetRight(); screen->BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->BlockLocate.GetRight();
screen->BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom(); screen->BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom();

View File

@ -22,8 +22,9 @@
/**********************************************************************/ /**********************************************************************/
EDA_BaseStruct* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay() { BOARD_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
/**********************************************************************/ /**********************************************************************/
{
return Locate( CURSEUR_OFF_GRILLE ); return Locate( CURSEUR_OFF_GRILLE );
} }
@ -72,22 +73,22 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
{ {
case EDA_PANNING_UP_KEY: case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP ); OnZoom( ID_ZOOM_PANNING_UP );
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case EDA_PANNING_DOWN_KEY: case EDA_PANNING_DOWN_KEY:
OnZoom( ID_ZOOM_PANNING_DOWN ); OnZoom( ID_ZOOM_PANNING_DOWN );
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case EDA_PANNING_LEFT_KEY: case EDA_PANNING_LEFT_KEY:
OnZoom( ID_ZOOM_PANNING_LEFT ); OnZoom( ID_ZOOM_PANNING_LEFT );
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case EDA_PANNING_RIGHT_KEY: case EDA_PANNING_RIGHT_KEY:
OnZoom( ID_ZOOM_PANNING_RIGHT ); OnZoom( ID_ZOOM_PANNING_RIGHT );
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case EDA_ZOOM_IN_FROM_MOUSE: case EDA_ZOOM_IN_FROM_MOUSE:

View File

@ -70,6 +70,7 @@ Outils et D_CODES
GERBER_Descr::GERBER_Descr( int layer ) GERBER_Descr::GERBER_Descr( int layer )
{ {
int ii; int ii;
m_Layer = layer; // Layer Number m_Layer = layer; // Layer Number
m_Selected_Tool = FIRST_DCODE; m_Selected_Tool = FIRST_DCODE;
ResetDefaultValues(); ResetDefaultValues();
@ -78,8 +79,6 @@ int ii;
} }
GERBER_Descr::~GERBER_Descr() GERBER_Descr::~GERBER_Descr()
{ {
int ii; int ii;
@ -94,6 +93,7 @@ int ii;
} }
} }
/******************************************/ /******************************************/
void GERBER_Descr::ResetDefaultValues() void GERBER_Descr::ResetDefaultValues()
/******************************************/ /******************************************/
@ -134,6 +134,7 @@ void GERBER_Descr::ResetDefaultValues()
m_PolygonFillModeState = 0; m_PolygonFillModeState = 0;
} }
/********************************************/ /********************************************/
int GERBER_Descr::ReturnUsedDcodeNumber() int GERBER_Descr::ReturnUsedDcodeNumber()
/********************************************/ /********************************************/
@ -153,12 +154,12 @@ int ii, jj;
} }
/******************************/ /******************************/
void GERBER_Descr::InitToolTable() void GERBER_Descr::InitToolTable()
/******************************/ /******************************/
/* Creation du tableau des MAX_TOOLS DCodes utilisables, si il n'existe pas, /* Creation du tableau des MAX_TOOLS DCodes utilisables, si il n'existe pas,
et Init des DCodes <EFBFBD> une valeur raisonnable * et Init des DCodes <EFBFBD> une valeur raisonnable
*/ */
{ {
int count; int count;
@ -166,7 +167,8 @@ int count;
/* Init du buffer des D_CODES a des valeurs raisonnables */ /* Init du buffer des D_CODES a des valeurs raisonnables */
for( count = 0; count < MAX_TOOLS; count++ ) for( count = 0; count < MAX_TOOLS; count++ )
{ {
if (m_Aperture_List[count] == NULL ) continue; if( m_Aperture_List[count] == NULL )
continue;
m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE; m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE;
m_Aperture_List[count]->Clear_D_CODE_Data(); m_Aperture_List[count]->Clear_D_CODE_Data();
} }
@ -188,10 +190,12 @@ D_CODE::D_CODE(int num_dcode)
Clear_D_CODE_Data(); Clear_D_CODE_Data();
} }
D_CODE::~D_CODE() D_CODE::~D_CODE()
{ {
} }
void D_CODE::Clear_D_CODE_Data() void D_CODE::Clear_D_CODE_Data()
{ {
m_Size.x = DEFAULT_SIZE; m_Size.x = DEFAULT_SIZE;
@ -207,25 +211,26 @@ void D_CODE::Clear_D_CODE_Data()
/******************************************************************************/ /******************************************************************************/
int WinEDA_GerberFrame::Read_D_Code_File( const wxString& D_Code_FullFileName ) int WinEDA_GerberFrame::Read_D_Code_File( const wxString& D_Code_FullFileName )
/******************************************************************************/ /******************************************************************************/
/* Routine de Lecture d'un fichier de D Codes. /* Routine de Lecture d'un fichier de D Codes.
Accepte format standard ou ALSPCB * Accepte format standard ou ALSPCB
un ';' demarre un commentaire. * un ';' demarre un commentaire.
*
Format Standard: * Format Standard:
tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)] * tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)]
ex: 1, 12, 12, 0, 0, 0, 3 ; D10 * ex: 1, 12, 12, 0, 0, 0, 3 ; D10
*
Format: * Format:
Ver , Hor , Type , Tool [,Drill] * Ver , Hor , Type , Tool [,Drill]
ex: 0.012, 0.012, L , D10 * ex: 0.012, 0.012, L , D10
*
Classe les caract en buf_tmp sous forme de tableau de structures D_CODE. * Classe les caract en buf_tmp sous forme de tableau de structures D_CODE.
Retourne: * Retourne:
< 0 si erreur: * < 0 si erreur:
-1 = Fichier non trouve * -1 = Fichier non trouve
-2 = Erreur lecture fichier * -2 = Erreur lecture fichier
0 si pas de nom de fichier (inits seules) * 0 si pas de nom de fichier (inits seules)
1 si OK * 1 si OK
*/ */
{ {
int current_Dcode, ii, dcode_scale; int current_Dcode, ii, dcode_scale;
@ -237,7 +242,7 @@ char Line[2000];
wxString msg; wxString msg;
D_CODE* pt_Dcode; D_CODE* pt_Dcode;
FILE* dest; FILE* dest;
int layer = GetPCBScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
D_CODE** ListeDCode; D_CODE** ListeDCode;
@ -248,10 +253,11 @@ D_CODE ** ListeDCode;
/* Mise a jour de l'echelle gerber : */ /* Mise a jour de l'echelle gerber : */
dcode_scale = 10; /* ici unit dcode = mil, unit interne = 0.1 mil dcode_scale = 10; /* ici unit dcode = mil, unit interne = 0.1 mil
-> 1 unite dcode = 10 unit PCB */ * -> 1 unite dcode = 10 unit PCB */
current_Dcode = 0; current_Dcode = 0;
if ( D_Code_FullFileName.IsEmpty() ) return 0; if( D_Code_FullFileName.IsEmpty() )
return 0;
dest = wxFopen( D_Code_FullFileName, wxT( "rt" ) ); dest = wxFopen( D_Code_FullFileName, wxT( "rt" ) );
@ -268,13 +274,17 @@ D_CODE ** ListeDCode;
while( fgets( Line, sizeof(Line) - 1, dest ) != NULL ) while( fgets( Line, sizeof(Line) - 1, dest ) != NULL )
{ {
if (*Line == ';') continue; /* Commentaire */ if( *Line == ';' )
if (strlen(Line) < 10 ) continue ; /* Probablemant ligne vide */ continue; /* Commentaire */
if( strlen( Line ) < 10 )
continue; /* Probablemant ligne vide */
pt_Dcode = NULL; current_Dcode = 0; pt_Dcode = NULL; current_Dcode = 0;
/* Determination du type de fichier D_Code */ /* Determination du type de fichier D_Code */
ptcar = Line; ii = 0; ptcar = Line; ii = 0;
while( *ptcar ) if (*(ptcar++) == ',') ii++ ; while( *ptcar )
if( *(ptcar++) == ',' )
ii++;
if( ii >= 6 ) /* valeurs en mils */ if( ii >= 6 ) /* valeurs en mils */
{ {
@ -285,7 +295,8 @@ D_CODE ** ListeDCode;
dimH = (int) ( (dimH * dcode_scale) + 0.5 ); dimH = (int) ( (dimH * dcode_scale) + 0.5 );
dimV = (int) ( (dimV * dcode_scale) + 0.5 ); dimV = (int) ( (dimV * dcode_scale) + 0.5 );
drill = (int) ( (drill * dcode_scale) + 0.5 ); drill = (int) ( (drill * dcode_scale) + 0.5 );
if ( ii < 1 ) ii = 1; if( ii < 1 )
ii = 1;
current_Dcode = ii - 1 + FIRST_DCODE; current_Dcode = ii - 1 + FIRST_DCODE;
} }
else /* valeurs en inches a convertir en mils */ else /* valeurs en inches a convertir en mils */
@ -299,22 +310,32 @@ D_CODE ** ListeDCode;
{ {
sscanf( ptcar + 1, "%d,%f", &current_Dcode, &fdrill ); break; sscanf( ptcar + 1, "%d,%f", &current_Dcode, &fdrill ); break;
} }
else ptcar++ ; else
ptcar++;
} }
dimH = (int) ( (fdimH * dcode_scale * 1000) + 0.5 ); dimH = (int) ( (fdimH * dcode_scale * 1000) + 0.5 );
dimV = (int) ( (fdimV * dcode_scale * 1000) + 0.5 ); dimV = (int) ( (fdimV * dcode_scale * 1000) + 0.5 );
drill = (int) ( (fdrill * dcode_scale * 1000) + 0.5 ); drill = (int) ( (fdrill * dcode_scale * 1000) + 0.5 );
type_outil = -1; type_outil = -1;
if(c_type_outil[0] == 'L') type_outil = GERB_LINE; if( c_type_outil[0] == 'L' )
if(c_type_outil[0] == 'R') type_outil = GERB_RECT; type_outil = GERB_LINE;
if(c_type_outil[0] == 'C') type_outil = GERB_CIRCLE; if( c_type_outil[0] == 'R' )
if(c_type_outil[0] == 'O') type_outil = GERB_OVALE; type_outil = GERB_RECT;
if(type_outil == -1) {fclose(dest); return(-2);} if( c_type_outil[0] == 'C' )
type_outil = GERB_CIRCLE;
if( c_type_outil[0] == 'O' )
type_outil = GERB_OVALE;
if( type_outil == -1 )
{
fclose( dest ); return -2;
}
} }
/* Mise a jour de la liste des d_codes si valeurs lues coherentes*/ /* Mise a jour de la liste des d_codes si valeurs lues coherentes*/
if (current_Dcode < FIRST_DCODE ) continue; if( current_Dcode < FIRST_DCODE )
if (current_Dcode >= MAX_TOOLS ) continue; continue;
if( current_Dcode >= MAX_TOOLS )
continue;
pt_Dcode = ReturnToolDescr( layer, current_Dcode ); pt_Dcode = ReturnToolDescr( layer, current_Dcode );
pt_Dcode->m_Size.x = dimH; pt_Dcode->m_Size.x = dimH;
pt_Dcode->m_Size.y = dimV; pt_Dcode->m_Size.y = dimV;
@ -322,15 +343,17 @@ D_CODE ** ListeDCode;
pt_Dcode->m_Drill.x = pt_Dcode->m_Drill.y = drill; pt_Dcode->m_Drill.x = pt_Dcode->m_Drill.y = drill;
pt_Dcode->m_Defined = TRUE; pt_Dcode->m_Defined = TRUE;
} }
fclose( dest ); fclose( dest );
return(1); return 1;
} }
/***************************************************/ /***************************************************/
void WinEDA_GerberFrame::CopyDCodesSizeToItems() void WinEDA_GerberFrame::CopyDCodesSizeToItems()
/***************************************************/ /***************************************************/
/* Set Size Items (Lines, Flashes) from DCodes List /* Set Size Items (Lines, Flashes) from DCodes List
*/ */
{ {
@ -344,16 +367,15 @@ D_CODE * pt_Dcode; /* Pointeur sur le D code*/
pt_Dcode->m_InUse = TRUE; pt_Dcode->m_InUse = TRUE;
if( // Line Item if( // Line Item
(track->m_Shape == S_SEGMENT ) || /* segment rectiligne */ (track->m_Shape == S_SEGMENT ) /* segment rectiligne */
(track->m_Shape == S_RECT ) || /* segment forme rect (i.e. bouts non arrondis) */ || (track->m_Shape == S_RECT ) /* segment forme rect (i.e. bouts non arrondis) */
(track->m_Shape == S_ARC ) || /* segment en arc de cercle (bouts arrondis)*/ || (track->m_Shape == S_ARC ) /* segment en arc de cercle (bouts arrondis)*/
(track->m_Shape == S_CIRCLE ) || /* segment en cercle (anneau)*/ || (track->m_Shape == S_CIRCLE ) /* segment en cercle (anneau)*/
(track->m_Shape == S_ARC_RECT ) /* segment en arc de cercle (bouts droits) (GERBER)*/ || (track->m_Shape == S_ARC_RECT ) /* segment en arc de cercle (bouts droits) (GERBER)*/
) )
{ {
track->m_Width = pt_Dcode->m_Size.x; track->m_Width = pt_Dcode->m_Size.x;
} }
else // Spots ( Flashed Items ) else // Spots ( Flashed Items )
{ {
int width, len; int width, len;
@ -367,6 +389,7 @@ D_CODE * pt_Dcode; /* Pointeur sur le D code*/
track->m_Start.x = (track->m_Start.x + track->m_End.x) / 2; track->m_Start.x = (track->m_Start.x + track->m_End.x) / 2;
track->m_Start.y = (track->m_Start.y + track->m_End.y) / 2; track->m_Start.y = (track->m_Start.y + track->m_End.y) / 2;
track->m_End = track->m_Start; // m_Start = m_End = Spot center track->m_End = track->m_Start; // m_Start = m_End = Spot center
switch( pt_Dcode->m_Shape ) switch( pt_Dcode->m_Shape )
{ {
case GERB_LINE: // ne devrait pas etre utilis<69> ici case GERB_LINE: // ne devrait pas etre utilis<69> ici
@ -389,7 +412,6 @@ D_CODE * pt_Dcode; /* Pointeur sur le D code*/
track->m_Start.x -= len; track->m_Start.x -= len;
track->m_End.x += len; track->m_End.x += len;
} }
else else
{ {
track->m_Start.y -= len; track->m_Start.y -= len;
@ -405,17 +427,19 @@ D_CODE * ReturnToolDescr(int layer, int Dcode, int * index)
/*********************************************************/ /*********************************************************/
/* Retourne un pointeur sur la description de l'outil DCode de reference Dcode /* Retourne un pointeur sur la description de l'outil DCode de reference Dcode
(rappel : Dcode >= 10) * (rappel : Dcode >= 10)
*/ */
{ {
GERBER_Descr* DcodeList = g_GERBER_Descr_List[layer]; GERBER_Descr* DcodeList = g_GERBER_Descr_List[layer];
D_CODE* pt_dcode = NULL; D_CODE* pt_dcode = NULL;
if (index) *index = 0; if( index )
*index = 0;
if( DcodeList && Dcode >= FIRST_DCODE && Dcode < MAX_TOOLS ) if( DcodeList && Dcode >= FIRST_DCODE && Dcode < MAX_TOOLS )
{ {
pt_dcode = DcodeList->m_Aperture_List[Dcode - FIRST_DCODE]; pt_dcode = DcodeList->m_Aperture_List[Dcode - FIRST_DCODE];
if ( index ) *index = Dcode - FIRST_DCODE + 1; if( index )
*index = Dcode - FIRST_DCODE + 1;
} }
return pt_dcode; return pt_dcode;
} }
@ -430,7 +454,7 @@ D_CODE * pt_D_code ;
wxString Line; wxString Line;
WinEDA_TextFrame* List; WinEDA_TextFrame* List;
int scale = 10000; int scale = 10000;
int curr_layer = GetPCBScreen()->m_Active_Layer; int curr_layer = GetScreen()->m_Active_Layer;
int layer; int layer;
GERBER_Descr* DcodeList; GERBER_Descr* DcodeList;
@ -440,19 +464,23 @@ GERBER_Descr * DcodeList;
for( layer = 0; layer < 32; layer++ ) for( layer = 0; layer < 32; layer++ )
{ {
DcodeList = g_GERBER_Descr_List[layer]; DcodeList = g_GERBER_Descr_List[layer];
if ( DcodeList == NULL ) continue; if( DcodeList == NULL )
continue;
if( DcodeList->ReturnUsedDcodeNumber() == 0 ) if( DcodeList->ReturnUsedDcodeNumber() == 0 )
continue; continue;
if( layer == curr_layer ) if( layer == curr_layer )
Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 ); Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 );
else Line.Printf( wxT("*** layer %2.2d ***"), layer+1); else
Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
List->Append( Line ); List->Append( Line );
for( ii = 0, jj = 1; ii < MAX_TOOLS; ii++ ) for( ii = 0, jj = 1; ii < MAX_TOOLS; ii++ )
{ {
pt_D_code = DcodeList->m_Aperture_List[ii]; pt_D_code = DcodeList->m_Aperture_List[ii];
if ( pt_D_code == NULL ) continue; if( pt_D_code == NULL )
if ( !pt_D_code->m_InUse && !pt_D_code->m_Defined ) continue; continue;
if( !pt_D_code->m_InUse && !pt_D_code->m_Defined )
continue;
Line.Printf( wxT( Line.Printf( wxT(
"tool %2.2d: D%2.2d V %2.4f H %2.4f %s" ), "tool %2.2d: D%2.2d V %2.4f H %2.4f %s" ),
jj, jj,
@ -460,22 +488,28 @@ GERBER_Descr * DcodeList;
(float) pt_D_code->m_Size.y / scale, (float) pt_D_code->m_Size.y / scale,
(float) pt_D_code->m_Size.x / scale, (float) pt_D_code->m_Size.x / scale,
g_GERBER_Tool_Type[pt_D_code->m_Shape] ); g_GERBER_Tool_Type[pt_D_code->m_Shape] );
if ( ! pt_D_code->m_Defined ) Line += wxT(" ?");
if ( ! pt_D_code->m_InUse ) Line += wxT(" *"); if( !pt_D_code->m_Defined )
Line += wxT( " ?" );
if( !pt_D_code->m_InUse )
Line += wxT( " *" );
List->Append( Line ); List->Append( Line );
jj++; jj++;
} }
} }
ii = List->ShowModal(); List->Destroy(); ii = List->ShowModal(); List->Destroy();
if (ii < 0) return; if( ii < 0 )
return;
#if 0 #if 0
// Mise en surbrillance des <20>l<EFBFBD>ments correspondant au DCode s<>lectionn<6E> // Mise en surbrillance des <20>l<EFBFBD>ments correspondant au DCode s<>lectionn<6E>
if(Etat_Surbrillance) Hight_Light(DrawPanel, DC); if( Etat_Surbrillance )
Hight_Light( DrawPanel, DC );
net_code_Surbrillance = (GetScreen()->m_Active_Layer << 16) + ii; net_code_Surbrillance = (GetScreen()->m_Active_Layer << 16) + ii;
Hight_Light( DrawPanel, DC ); Hight_Light( DrawPanel, DC );
#endif #endif
} }

View File

@ -23,7 +23,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
* quand un outil est deja selectionn<EFBFBD> * quand un outil est deja selectionn<EFBFBD>
*/ */
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg; wxString msg;
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
@ -84,7 +84,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
*/ */
{ {
int id = event.GetId(); int id = event.GetId();
int layer = GetPCBScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
GERBER_Descr* gerber_layer = g_GERBER_Descr_List[layer]; GERBER_Descr* gerber_layer = g_GERBER_Descr_List[layer];
wxPoint pos; wxPoint pos;
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );
@ -114,11 +114,11 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
/* ne devrait pas etre execute, sauf bug */ /* ne devrait pas etre execute, sauf bug */
if( m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE ) if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE )
{ {
m_CurrentScreen->BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
m_CurrentScreen->BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
m_CurrentScreen->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
} }
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
@ -267,21 +267,21 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_COPY; GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;

View File

@ -41,10 +41,13 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
case ID_MENU_INC_LAYER_AND_APPEND_FILE: case ID_MENU_INC_LAYER_AND_APPEND_FILE:
case ID_INC_LAYER_AND_APPEND_FILE: case ID_INC_LAYER_AND_APPEND_FILE:
{ {
int layer = GetPCBScreen()->m_Active_Layer; int origLayer = GetScreen()->m_Active_Layer;
((PCB_SCREEN*)GetScreen())->m_Active_Layer++;
GetScreen()->m_Active_Layer++;
if( !LoadOneGerberFile( wxEmptyString, &dc, 0 ) ) if( !LoadOneGerberFile( wxEmptyString, &dc, 0 ) )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = layer; GetScreen()->m_Active_Layer = origLayer;
SetToolbars(); SetToolbars();
} }
break; break;

View File

@ -22,9 +22,7 @@
/****************************************/ /****************************************/
BEGIN_EVENT_TABLE( WinEDA_GerberFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_GerberFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_CLOSE(WinEDA_GerberFrame::OnCloseWindow)
EVT_SIZE( WinEDA_GerberFrame::OnSize ) EVT_SIZE( WinEDA_GerberFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
@ -76,6 +74,7 @@ BEGIN_EVENT_TABLE(WinEDA_GerberFrame, wxFrame)
// menu Miscellaneous // menu Miscellaneous
EVT_MENU( ID_PCB_GLOBAL_DELETE, WinEDA_GerberFrame::Process_Special_Functions ) EVT_MENU( ID_PCB_GLOBAL_DELETE, WinEDA_GerberFrame::Process_Special_Functions )
// Menu Help // Menu Help
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp ) EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout ) EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
@ -123,8 +122,12 @@ END_EVENT_TABLE()
/* Constructeur */ /* Constructeur */
/****************/ /****************/
WinEDA_GerberFrame::WinEDA_GerberFrame(wxWindow * father, WinEDA_App *parent, WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
const wxString & title, const wxPoint& pos, const wxSize& size, long style) : WinEDA_App* parent,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style ) :
WinEDA_BasePcbFrame( father, parent, GERBER_FRAME, title, pos, size, style ) WinEDA_BasePcbFrame( father, parent, GERBER_FRAME, title, pos, size, style )
{ {
m_FrameName = wxT( "GerberFrame" ); m_FrameName = wxT( "GerberFrame" );
@ -134,7 +137,9 @@ WinEDA_GerberFrame::WinEDA_GerberFrame(wxWindow * father, WinEDA_App *parent,
m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin<69> m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin<69>
m_Ident = GERBER_FRAME; m_Ident = GERBER_FRAME;
m_ZoomMaxValue = 1024; m_ZoomMaxValue = 1024;
if ( DrawPanel ) DrawPanel->m_Block_Enable = TRUE; if( DrawPanel )
DrawPanel->m_Block_Enable = TRUE;
// Give an icon // Give an icon
#ifdef __WINDOWS__ #ifdef __WINDOWS__
SetIcon( wxICON( a_icon_gerbview ) ); SetIcon( wxICON( a_icon_gerbview ) );
@ -142,7 +147,7 @@ WinEDA_GerberFrame::WinEDA_GerberFrame(wxWindow * father, WinEDA_App *parent,
SetIcon( wxICON( icon_gerbview ) ); SetIcon( wxICON( icon_gerbview ) );
#endif #endif
m_CurrentScreen = ActiveScreen = ScreenPcb; SetBaseScreen( ActiveScreen = ScreenPcb );
GetSettings(); GetSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
@ -156,7 +161,7 @@ WinEDA_GerberFrame::WinEDA_GerberFrame(wxWindow * father, WinEDA_App *parent,
WinEDA_GerberFrame::~WinEDA_GerberFrame() WinEDA_GerberFrame::~WinEDA_GerberFrame()
{ {
m_Parent->m_GerberFrame = NULL; m_Parent->m_GerberFrame = NULL;
m_CurrentScreen = ScreenPcb; SetBaseScreen( ScreenPcb );
} }
@ -164,12 +169,12 @@ WinEDA_GerberFrame::~WinEDA_GerberFrame()
void WinEDA_GerberFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_GerberFrame::OnCloseWindow( wxCloseEvent& Event )
/***********************************************************/ /***********************************************************/
{ {
PCB_SCREEN * screen; PCB_SCREEN* screen = ScreenPcb;
screen = ScreenPcb ;
while( screen ) while( screen )
{ {
if(screen->IsModify()) break; if( screen->IsModify() )
break;
screen = screen->Next(); screen = screen->Next();
} }
@ -188,17 +193,17 @@ PCB_SCREEN * screen;
screen = screen->Next(); screen = screen->Next();
} }
/* Reselection de l'ecran de base, SetBaseScreen( ActiveScreen = ScreenPcb );
pour les evenements de refresh g<EFBFBD>n<EFBFBD>r<EFBFBD>s par wxWindows */
m_CurrentScreen = ActiveScreen = ScreenPcb;
SaveSettings(); SaveSettings();
Destroy(); Destroy();
} }
/*******************************************/ /*******************************************/
void WinEDA_GerberFrame::SetToolbars() void WinEDA_GerberFrame::SetToolbars()
/*******************************************/ /*******************************************/
/** Function SetToolbars() /** Function SetToolbars()
* Set the tools state for the toolbars, accordint to display options * Set the tools state for the toolbars, accordint to display options
*/ */
@ -206,7 +211,8 @@ void WinEDA_GerberFrame::SetToolbars()
int layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer; int layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
GERBER_Descr* Gerber_layer_descr = g_GERBER_Descr_List[layer]; GERBER_Descr* Gerber_layer_descr = g_GERBER_Descr_List[layer];
if( m_HToolBar == NULL ) return; if( m_HToolBar == NULL )
return;
if( GetScreen()->BlockLocate.m_Command == BLOCK_MOVE ) if( GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
{ {
@ -288,6 +294,7 @@ GERBER_Descr * Gerber_layer_descr = g_GERBER_Descr_List[layer];
DisplayUnitsMsg(); DisplayUnitsMsg();
} }
/*************************************/ /*************************************/
int WinEDA_GerberFrame::BestZoom() int WinEDA_GerberFrame::BestZoom()
/*************************************/ /*************************************/
@ -306,11 +313,13 @@ wxSize size;
/* determination du zoom existant le plus proche */ /* determination du zoom existant le plus proche */
for( ii = 1; ii < 2048; ii <<= 1 ) for( ii = 1; ii < 2048; ii <<= 1 )
{ {
if(ii >= bestzoom) break; if( ii >= bestzoom )
break;
} }
bestzoom = ii; bestzoom = ii;
GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre();
return(bestzoom); return bestzoom;
} }

View File

@ -74,8 +74,8 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
m_Pcb->m_NbSegmZone = 0; m_Pcb->m_NbSegmZone = 0;
/* Init parametres de gestion des ecrans PAD et PCB */ /* Init parametres de gestion des ecrans PAD et PCB */
m_CurrentScreen = ActiveScreen = ScreenPcb; SetBaseScreen( ActiveScreen = ScreenPcb );
GetPCBScreen()->Init(); GetScreen()->Init();
return TRUE; return TRUE;
} }
@ -104,7 +104,7 @@ void WinEDA_GerberFrame::Erase_Segments_Pcb( bool all_layers, bool query )
{ {
BOARD_ITEM* PtStruct; BOARD_ITEM* PtStruct;
BOARD_ITEM* PtNext; BOARD_ITEM* PtNext;
int layer = GetPCBScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
if( all_layers ) if( all_layers )
layer = -1; layer = -1;
@ -189,7 +189,7 @@ void WinEDA_GerberFrame::Erase_Textes_Pcb( bool query )
void WinEDA_GerberFrame::Erase_Current_Layer( bool query ) void WinEDA_GerberFrame::Erase_Current_Layer( bool query )
/*********************************************************/ /*********************************************************/
{ {
int layer = GetPCBScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
wxString msg; wxString msg;
msg.Printf( _( "Delete Layer %d" ), layer + 1 ); msg.Printf( _( "Delete Layer %d" ), layer + 1 );

View File

@ -34,7 +34,7 @@ static int distance( int seuil );
/*************************************************************/ /*************************************************************/
EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc ) BOARD_ITEM* WinEDA_GerberFrame::Locate( int typeloc )
/*************************************************************/ /*************************************************************/
/* Fonction de localisation generale /* Fonction de localisation generale
@ -48,7 +48,7 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
int layer; int layer;
/* Localistion des pistes et vias, avec priorite aux vias */ /* Localistion des pistes et vias, avec priorite aux vias */
layer = GetPCBScreen()->m_Active_Layer; layer = GetScreen()->m_Active_Layer;
Track = Locate_Pistes( m_Pcb->m_Track, -1, typeloc ); Track = Locate_Pistes( m_Pcb->m_Track, -1, typeloc );
if( Track != NULL ) if( Track != NULL )
{ {
@ -80,7 +80,7 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
} }
if( ( TrackLocate = Locate_Zone( (TRACK*) m_Pcb->m_Zone, if( ( TrackLocate = Locate_Zone( (TRACK*) m_Pcb->m_Zone,
GetPCBScreen()->m_Active_Layer, typeloc ) ) != NULL ) GetScreen()->m_Active_Layer, typeloc ) ) != NULL )
{ {
TrackLocate->Display_Infos( this ); TrackLocate->Display_Infos( this );
return TrackLocate; return TrackLocate;

View File

@ -20,9 +20,9 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
* The menu already has a list of zoom commands. * The menu already has a list of zoom commands.
*/ */
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg; wxString msg;
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu

View File

@ -126,7 +126,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
wxPoint pos; wxPoint pos;
int error = 0; int error = 0;
layer = GetPCBScreen()->m_Active_Layer; layer = GetScreen()->m_Active_Layer;
if( g_GERBER_Descr_List[layer] == NULL ) if( g_GERBER_Descr_List[layer] == NULL )
{ {

View File

@ -107,7 +107,7 @@ static void Append_1_Flash_ROND_GERBER( int Dcode_tool,
track->Insert( frame->m_Pcb, NULL ); track->Insert( frame->m_Pcb, NULL );
track->SetLayer( frame->GetPCBScreen()->m_Active_Layer ); track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = diametre; track->m_Width = diametre;
track->m_Start = track->m_End = pos; track->m_Start = track->m_End = pos;
NEGATE( track->m_Start.y ); NEGATE( track->m_Start.y );
@ -140,7 +140,7 @@ static void Append_1_Flash_GERBER( int Dcode_index,
track->Insert( frame->m_Pcb, NULL ); track->Insert( frame->m_Pcb, NULL );
track->SetLayer( frame->GetPCBScreen()->m_Active_Layer ); track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = width; track->m_Width = width;
track->m_Start = track->m_End = pos; track->m_Start = track->m_End = pos;
NEGATE( track->m_Start.y ); NEGATE( track->m_Start.y );
@ -181,7 +181,7 @@ static void Append_1_Line_GERBER( int Dcode_index,
track->Insert( frame->m_Pcb, NULL ); track->Insert( frame->m_Pcb, NULL );
track->SetLayer( frame->GetPCBScreen()->m_Active_Layer ); track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = largeur; track->m_Width = largeur;
track->m_Start = startpoint; track->m_Start = startpoint;
NEGATE( track->m_Start.y ); NEGATE( track->m_Start.y );
@ -220,7 +220,7 @@ static void Append_1_SEG_ARC_GERBER( int Dcode_index,
track->Insert( frame->m_Pcb, NULL ); track->Insert( frame->m_Pcb, NULL );
track->m_Shape = S_ARC; track->m_Shape = S_ARC;
track->SetLayer( frame->GetPCBScreen()->m_Active_Layer ); track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = largeur; track->m_Width = largeur;
if( multiquadrant ) if( multiquadrant )
@ -741,7 +741,7 @@ bool GERBER_Descr::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
edge_poly->Insert( frame->m_Pcb, last ); edge_poly->Insert( frame->m_Pcb, last );
edge_poly->SetLayer( frame->GetPCBScreen()->m_Active_Layer ); edge_poly->SetLayer( frame->GetScreen()->m_Active_Layer );
edge_poly->m_Width = 1; edge_poly->m_Width = 1;
edge_poly->m_Start = m_PreviousPos; edge_poly->m_Start = m_PreviousPos;
NEGATE( edge_poly->m_Start.y ); NEGATE( edge_poly->m_Start.y );

View File

@ -200,7 +200,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
if( GetScreen() ) if( GetScreen() )
{ {
layer = GetPCBScreen()->m_Active_Layer; layer = GetScreen()->m_Active_Layer;
gerber_layer = g_GERBER_Descr_List[layer]; gerber_layer = g_GERBER_Descr_List[layer];
} }
@ -313,7 +313,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
m_SelLayerBox = new WinEDAChoiceBox( m_HToolBar, ID_TOOLBARH_PCB_SELECT_LAYER, m_SelLayerBox = new WinEDAChoiceBox( m_HToolBar, ID_TOOLBARH_PCB_SELECT_LAYER,
wxDefaultPosition, wxSize( 150, -1 ), choices ); wxDefaultPosition, wxSize( 150, -1 ), choices );
m_SelLayerBox->SetSelection( GetPCBScreen()->m_Active_Layer ); m_SelLayerBox->SetSelection( GetScreen()->m_Active_Layer );
m_HToolBar->AddControl( m_SelLayerBox ); m_HToolBar->AddControl( m_SelLayerBox );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();

View File

@ -26,6 +26,21 @@ public:
SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE ); SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
~SCH_SCREEN(); ~SCH_SCREEN();
/**
* Function GetCurItem
* returns the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
* @return SCH_ITEM* - the one selected, or NULL.
*/
SCH_ITEM* GetCurItem() const { return (SCH_ITEM*) BASE_SCREEN::GetCurItem(); }
/**
* Function SetCurItem
* sets the currently selected object, m_CurrentItem.
* @param current Any object derived from SCH_ITEM
*/
void SetCurItem( SCH_ITEM* aItem ) { BASE_SCREEN::SetCurItem( aItem ); }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "SCH_SCREEN" ); return wxT( "SCH_SCREEN" );
@ -34,7 +49,8 @@ public:
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies) void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { }; void Place( WinEDA_SchematicFrame* frame, wxDC* DC ) { };
void RemoveFromDrawList( SCH_ITEM* DrawStruct ); /* remove DrawStruct from EEDrawList. */ void RemoveFromDrawList( SCH_ITEM* DrawStruct ); /* remove DrawStruct from EEDrawList. */
bool CheckIfOnDrawList( SCH_ITEM* st ); bool CheckIfOnDrawList( SCH_ITEM* st );
void AddToDrawList( SCH_ITEM* DrawStruct ); void AddToDrawList( SCH_ITEM* DrawStruct );

View File

@ -23,7 +23,7 @@ class SCH_ITEM;
/* classe representant un ecran graphique de dessin */ /* classe representant un ecran graphique de dessin */
/****************************************************/ /****************************************************/
class WinEDA_DrawPanel : public EDA_DRAW_PANEL class WinEDA_DrawPanel : public wxScrolledWindow
{ {
public: public:
int m_Ident; int m_Ident;
@ -59,8 +59,10 @@ public:
// Constructor and destructor // Constructor and destructor
WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size ); WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size );
~WinEDA_DrawPanel() { } ~WinEDA_DrawPanel() { }
/****************************/ /****************************/
virtual BASE_SCREEN* GetScreen() { return m_Parent->GetScreen(); } BASE_SCREEN* GetScreen();
void PrepareGraphicContext( wxDC* DC ); void PrepareGraphicContext( wxDC* DC );
wxPoint CalcAbsolutePosition( const wxPoint& rel_pos ); wxPoint CalcAbsolutePosition( const wxPoint& rel_pos );
@ -140,6 +142,7 @@ public:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
/**************************/ /**************************/
/* class DrawBlockStruct */ /* class DrawBlockStruct */
/**************************/ /**************************/
@ -264,6 +267,14 @@ public:
BASE_SCREEN( int idscreen, KICAD_T aType = SCREEN_STRUCT_TYPE ); BASE_SCREEN( int idscreen, KICAD_T aType = SCREEN_STRUCT_TYPE );
~BASE_SCREEN(); ~BASE_SCREEN();
/**
* Function setCurItem
* sets the currently selected object, m_CurrentItem.
* @param current Any object derived from EDA_BaseStruct
*/
void SetCurItem( EDA_BaseStruct* current ) { m_CurrentItem = current; }
EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; }
void InitDatas(); /* Inits completes des variables */ void InitDatas(); /* Inits completes des variables */
wxSize ReturnPageSize(); wxSize ReturnPageSize();
int GetInternalUnits(); int GetInternalUnits();
@ -289,15 +300,6 @@ public:
int IsSave() { return m_FlagSave & 1; } int IsSave() { return m_FlagSave & 1; }
/**
* Function SetCurItem
* sets the currently selected object, m_CurrentItem.
* @param current Any object derived from EDA_BaseStruct
*/
void SetCurItem( EDA_BaseStruct* current ) { m_CurrentItem = current; }
EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; }
//----<zoom stuff>---------------------------------------------------------- //----<zoom stuff>----------------------------------------------------------
/** /**
* Function GetZoom * Function GetZoom

View File

@ -236,6 +236,14 @@ public:
*/ */
BOARD_ITEM* GetCurItem() const { return (BOARD_ITEM*) BASE_SCREEN::GetCurItem(); } BOARD_ITEM* GetCurItem() const { return (BOARD_ITEM*) BASE_SCREEN::GetCurItem(); }
/**
* Function SetCurItem
* sets the currently selected object, m_CurrentItem.
* @param aItem Any object derived from BOARD_ITEM
*/
void SetCurItem( BOARD_ITEM* aItem ) { BASE_SCREEN::SetCurItem( aItem ); }
/* Return true if a microvia can be put on board /* Return true if a microvia can be put on board
* A microvia ia a small via restricted to 2 near neighbour layers * A microvia ia a small via restricted to 2 near neighbour layers
* because its is hole is made by laser which can penetrate only one layer * because its is hole is made by laser which can penetrate only one layer

View File

@ -56,7 +56,7 @@ public:
/* fonction de placement */ /* fonction de placement */
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); virtual void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
/** /**
* Function Save * Function Save
@ -84,7 +84,7 @@ public:
public: public:
DrawPickedStruct( SCH_ITEM * pickedstruct = NULL ); DrawPickedStruct( SCH_ITEM * pickedstruct = NULL );
~DrawPickedStruct(); ~DrawPickedStruct();
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { }; void Place( WinEDA_SchematicFrame* frame, wxDC* DC ) { };
void DeleteWrapperList(); void DeleteWrapperList();
DrawPickedStruct* Next() { return (DrawPickedStruct*) Pnext; } DrawPickedStruct* Next() { return (DrawPickedStruct*) Pnext; }

View File

@ -28,6 +28,7 @@ enum fl_rot_cmp {
CMP_MIROIR_Y = 0x200 // miroir selon axe Y CMP_MIROIR_Y = 0x200 // miroir selon axe Y
}; };
class WinEDA_SchematicFrame : public WinEDA_DrawFrame class WinEDA_SchematicFrame : public WinEDA_DrawFrame
{ {
public: public:
@ -47,6 +48,9 @@ public:
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
void Save_Config( wxWindow* displayframe ); void Save_Config( wxWindow* displayframe );
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
@ -62,7 +66,11 @@ public:
EDA_BaseStruct* DrawStruct ); EDA_BaseStruct* DrawStruct );
DrawSheetPath* GetSheet(); DrawSheetPath* GetSheet();
virtual BASE_SCREEN* GetScreen();
SCH_SCREEN* GetScreen() const;
BASE_SCREEN* GetBaseScreen() const;
virtual void SetScreen( SCH_SCREEN* screen ); virtual void SetScreen( SCH_SCREEN* screen );
virtual wxString GetScreenDesc(); virtual wxString GetScreenDesc();
@ -161,7 +169,7 @@ private:
bool PutInUndoList = FALSE ); bool PutInUndoList = FALSE );
// Text ,label, glabel // Text ,label, glabel
EDA_BaseStruct* CreateNewText( wxDC* DC, int type ); SCH_TEXT* CreateNewText( wxDC* DC, int type );
void EditSchematicText( SCH_TEXT* TextStruct, wxDC* DC ); void EditSchematicText( SCH_TEXT* TextStruct, wxDC* DC );
void ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ); void ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC );
void StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ); void StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC );
@ -296,7 +304,7 @@ public:
void SetToolbars(); void SetToolbars();
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
virtual BASE_SCREEN* GetScreen() { return (BASE_SCREEN*) m_CurrentScreen; } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
private: private:
@ -406,7 +414,7 @@ public:
void ClickOnLibList( wxCommandEvent& event ); void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event ); void ClickOnCmpList( wxCommandEvent& event );
virtual BASE_SCREEN* GetScreen() { return (BASE_SCREEN*) m_CurrentScreen; } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
private: private:
void SelectCurrentLibrary(); void SelectCurrentLibrary();

View File

@ -82,6 +82,7 @@ public:
*/ */
void SetBOARD( BOARD* aBoard ); void SetBOARD( BOARD* aBoard );
// General // General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void Process_Special_Functions( wxCommandEvent& event ) = 0; virtual void Process_Special_Functions( wxCommandEvent& event ) = 0;
@ -93,7 +94,10 @@ public:
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ReCreateMenuBar(); virtual void ReCreateMenuBar();
virtual BASE_SCREEN* GetScreen() { return (BASE_SCREEN*) m_CurrentScreen; } PCB_SCREEN* GetScreen() const { return (PCB_SCREEN*) WinEDA_DrawFrame::GetBaseScreen(); }
BASE_SCREEN* GetBaseScreen() const;
int BestZoom(); int BestZoom();
void Show3D_Frame( wxCommandEvent& event ); void Show3D_Frame( wxCommandEvent& event );
@ -740,10 +744,9 @@ public:
int BestZoom(); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
PCB_SCREEN* GetPCBScreen(){ return (PCB_SCREEN*)GetScreen(); }
EDA_BaseStruct* GerberGeneralLocateAndDisplay(); BOARD_ITEM* GerberGeneralLocateAndDisplay();
EDA_BaseStruct* Locate( int typeloc ); BOARD_ITEM* Locate( int typeloc );
void SetToolbars(); void SetToolbars();

View File

@ -35,7 +35,6 @@
#define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER
#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS #define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS
#define EDA_DRAW_PANEL wxScrolledWindow
class wxMyDialogModalData; class wxMyDialogModalData;
@ -206,8 +205,6 @@ public:
WinEDAChoiceBox* m_SelZoomBox; // Dialog box to choose the Zoom value WinEDAChoiceBox* m_SelZoomBox; // Dialog box to choose the Zoom value
int m_ZoomMaxValue; // Max zoom value: Draw min scale is 1/m_ZoomMaxValue int m_ZoomMaxValue; // Max zoom value: Draw min scale is 1/m_ZoomMaxValue
BASE_SCREEN* m_CurrentScreen; // current used SCREEN
int m_CurrentCursorShape; // shape for cursor (0 = default cursor) int m_CurrentCursorShape; // shape for cursor (0 = default cursor)
int m_ID_current_state; // Id of active button on the vertical toolbar int m_ID_current_state; // Id of active button on the vertical toolbar
int m_HTOOL_current_state; // Id of active button on horizontal toolbar int m_HTOOL_current_state; // Id of active button on horizontal toolbar
@ -226,6 +223,12 @@ public:
* dans la generation les fichiers de positionnement * dans la generation les fichiers de positionnement
* des composants) */ * des composants) */
private:
BASE_SCREEN* m_CurrentScreen; ///< current used SCREEN
protected:
void SetBaseScreen( BASE_SCREEN* aScreen ) { m_CurrentScreen = aScreen; }
public: public:
// Constructor and destructor // Constructor and destructor
@ -236,9 +239,15 @@ public:
~WinEDA_DrawFrame(); ~WinEDA_DrawFrame();
virtual BASE_SCREEN* GetScreen() { return m_CurrentScreen; }
virtual wxString GetScreenDesc(); virtual wxString GetScreenDesc();
/**
* Function GetBaseScreen
* is virtual and returns a pointer to a BASE_SCREEN or one of its derivatives.
* It may be overloaded by derived classes.
*/
virtual BASE_SCREEN* GetBaseScreen() const { return m_CurrentScreen; }
void OnMenuOpen( wxMenuEvent& event ); void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event ); void OnMouseEvent( wxMouseEvent& event );
virtual void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); virtual void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
@ -261,7 +270,7 @@ public:
virtual void OnSelectGrid( wxCommandEvent& event ); virtual void OnSelectGrid( wxCommandEvent& event );
virtual void OnSelectZoom( wxCommandEvent& event ); virtual void OnSelectZoom( wxCommandEvent& event );
virtual void GeneralControle( wxDC* DC, wxPoint Mouse ); virtual void GeneralControle( wxDC* DC, wxPoint Mouse ){ /* dummy */ }
virtual void OnSize( wxSizeEvent& event ); virtual void OnSize( wxSizeEvent& event );
void OnEraseBackground( wxEraseEvent& SizeEvent ); void OnEraseBackground( wxEraseEvent& SizeEvent );

View File

@ -105,11 +105,11 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE: case ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE:
FixeModule( (MODULE*) m_CurrentScreen->GetCurItem(), TRUE ); FixeModule( (MODULE*) GetScreen()->GetCurItem(), TRUE );
break; break;
case ID_POPUP_PCB_AUTOPLACE_FREE_MODULE: case ID_POPUP_PCB_AUTOPLACE_FREE_MODULE:
FixeModule( (MODULE*) m_CurrentScreen->GetCurItem(), FALSE ); FixeModule( (MODULE*) GetScreen()->GetCurItem(), FALSE );
break; break;
case ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES: case ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES:
@ -121,7 +121,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE: case ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE:
AutoPlaceModule( (MODULE*) m_CurrentScreen->GetCurItem(), AutoPlaceModule( (MODULE*) GetScreen()->GetCurItem(),
PLACE_1_MODULE, &dc ); PLACE_1_MODULE, &dc );
break; break;
@ -199,7 +199,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb )
MODULE* Module; MODULE* Module;
wxPoint start, current; wxPoint start, current;
int Ymax_size, Xsize_allowed; int Ymax_size, Xsize_allowed;
int pas_grille = m_CurrentScreen->GetGrid().x; int pas_grille = GetScreen()->GetGrid().x;
bool EdgeExists; bool EdgeExists;
float surface; float surface;
@ -237,8 +237,8 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb )
*/ */
if( PlaceModulesHorsPcb && EdgeExists ) if( PlaceModulesHorsPcb && EdgeExists )
{ {
if( m_CurrentScreen->m_Curseur.y < (m_Pcb->m_BoundaryBox.GetBottom() + 2000) ) if( GetScreen()->m_Curseur.y < (m_Pcb->m_BoundaryBox.GetBottom() + 2000) )
m_CurrentScreen->m_Curseur.y = m_Pcb->m_BoundaryBox.GetBottom() + 2000; GetScreen()->m_Curseur.y = m_Pcb->m_BoundaryBox.GetBottom() + 2000;
} }
/* calcul de la surface occupee par les circuits */ /* calcul de la surface occupee par les circuits */
@ -257,7 +257,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb )
Xsize_allowed = (int) (sqrt( surface ) * 4.0 / 3.0); Xsize_allowed = (int) (sqrt( surface ) * 4.0 / 3.0);
/* Placement des modules */ /* Placement des modules */
start = current = m_CurrentScreen->m_Curseur; start = current = GetScreen()->m_Curseur;
Ymax_size = 0; Ymax_size = 0;
for( pt_Dmod = BaseListeModules; *pt_Dmod != NULL; pt_Dmod++ ) for( pt_Dmod = BaseListeModules; *pt_Dmod != NULL; pt_Dmod++ )
@ -279,13 +279,13 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb )
Ymax_size = 0; Ymax_size = 0;
} }
m_CurrentScreen->m_Curseur.x = GetScreen()->m_Curseur.x =
current.x + Module->m_Pos.x - Module->m_RealBoundaryBox.GetX(); current.x + Module->m_Pos.x - Module->m_RealBoundaryBox.GetX();
m_CurrentScreen->m_Curseur.y = GetScreen()->m_Curseur.y =
current.y + Module->m_Pos.y - Module->m_RealBoundaryBox.GetY(); current.y + Module->m_Pos.y - Module->m_RealBoundaryBox.GetY();
Ymax_size = MAX( Ymax_size, Module->m_RealBoundaryBox.GetHeight() ); Ymax_size = MAX( Ymax_size, Module->m_RealBoundaryBox.GetHeight() );
PutOnGrid( &m_CurrentScreen->m_Curseur ); PutOnGrid( &GetScreen()->m_Curseur );
Module->Draw( DrawPanel, DC, GR_XOR ); Module->Draw( DrawPanel, DC, GR_XOR );
Place_Module( Module, DC ); /* positionne Module et recalcule cadre */ Place_Module( Module, DC ); /* positionne Module et recalcule cadre */
@ -294,7 +294,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb )
} }
MyFree( BaseListeModules ); MyFree( BaseListeModules );
m_CurrentScreen->SetRefreshReq(); GetScreen()->SetRefreshReq();
} }
@ -353,7 +353,7 @@ void WinEDA_PcbFrame::ReOrientModules( const wxString& ModuleMask,
if( WildCompareString( ModuleMask, Module->m_Reference->m_Text, FALSE ) ) if( WildCompareString( ModuleMask, Module->m_Reference->m_Text, FALSE ) )
{ {
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
Module->Draw( DrawPanel, DC, GR_XOR ); Module->Draw( DrawPanel, DC, GR_XOR );
Rotate_Module( NULL, Module, Orient, FALSE ); Rotate_Module( NULL, Module, Orient, FALSE );
Module->Draw( DrawPanel, DC, GR_OR ); Module->Draw( DrawPanel, DC, GR_OR );

View File

@ -118,7 +118,7 @@ void WinEDA_PcbFrame::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC
lay_tmp_TOP = Route_Layer_TOP; lay_tmp_TOP = Route_Layer_TOP;
OldPasRoute = g_GridRoutingSize; OldPasRoute = g_GridRoutingSize;
g_GridRoutingSize = m_CurrentScreen->GetGrid().x; g_GridRoutingSize = GetScreen()->GetGrid().x;
// Ensure g_GridRoutingSize has a reasonnable value: // Ensure g_GridRoutingSize has a reasonnable value:
if( g_GridRoutingSize < 10 ) if( g_GridRoutingSize < 10 )
@ -282,10 +282,10 @@ end_of_tst:
break; break;
/* placement du module */ /* placement du module */
CurrPosition = m_CurrentScreen->m_Curseur; CurrPosition = GetScreen()->m_Curseur;
m_CurrentScreen->m_Curseur = PosOK; GetScreen()->m_Curseur = PosOK;
Place_Module( Module, DC ); Place_Module( Module, DC );
m_CurrentScreen->m_Curseur = CurrPosition; GetScreen()->m_Curseur = CurrPosition;
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
Module->SetRectangleExinscrit(); Module->SetRectangleExinscrit();

View File

@ -45,7 +45,6 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
WinEDA_DrawFrame( father, idtype, parent, title, pos, size, style ) WinEDA_DrawFrame( father, idtype, parent, title, pos, size, style )
{ {
m_InternalUnits = 10000; // Internal unit = 1/10000 inch m_InternalUnits = 10000; // Internal unit = 1/10000 inch
m_CurrentScreen = NULL;
m_Pcb = NULL; m_Pcb = NULL;
m_DisplayPadFill = TRUE; // How to draw pads m_DisplayPadFill = TRUE; // How to draw pads
@ -66,6 +65,12 @@ WinEDA_BasePcbFrame::~WinEDA_BasePcbFrame( void )
} }
BASE_SCREEN* WinEDA_BasePcbFrame::GetBaseScreen() const
{
return GetScreen();
}
void WinEDA_BasePcbFrame::SetBOARD( BOARD* aBoard ) void WinEDA_BasePcbFrame::SetBOARD( BOARD* aBoard )
{ {
if(m_Pcb != g_ModuleEditor_Pcb) if(m_Pcb != g_ModuleEditor_Pcb)
@ -98,7 +103,7 @@ int WinEDA_BasePcbFrame::BestZoom( void )
jj = ( dy + (size.y / 2) ) / size.y; jj = ( dy + (size.y / 2) ) / size.y;
bestzoom = MAX( ii, jj ) + 1; bestzoom = MAX( ii, jj ) + 1;
m_CurrentScreen->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre();
return bestzoom; return bestzoom;
} }
@ -284,7 +289,7 @@ void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event )
void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem ) void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem )
/*****************************************************************/ /*****************************************************************/
{ {
m_CurrentScreen->SetCurItem( aItem ); GetScreen()->SetCurItem( aItem );
if( aItem ) if( aItem )
{ {
@ -314,7 +319,7 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem )
BOARD_ITEM* WinEDA_BasePcbFrame::GetCurItem() BOARD_ITEM* WinEDA_BasePcbFrame::GetCurItem()
/*****************************************************************/ /*****************************************************************/
{ {
return (BOARD_ITEM*) m_CurrentScreen->GetCurItem(); return GetScreen()->GetCurItem();
} }

View File

@ -419,7 +419,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
} }
} }
if( panel->m_Parent->GetScreen()->BlockLocate.m_State != STATE_BLOCK_STOP ) if( screen->BlockLocate.m_State != STATE_BLOCK_STOP )
{ {
screen->BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->BlockLocate.GetRight(); screen->BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->BlockLocate.GetRight();
screen->BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom(); screen->BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom();

View File

@ -292,12 +292,12 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
*/ */
{ {
DrawBlockStruct* PtBlock; DrawBlockStruct* PtBlock;
BASE_SCREEN* screen = panel->m_Parent->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
BOARD_ITEM* item; BOARD_ITEM* item;
wxPoint move_offset; wxPoint move_offset;
MODULE* Currentmodule = g_EDA_Appl->m_ModuleEditFrame->m_Pcb->m_Modules; MODULE* Currentmodule = g_EDA_Appl->m_ModuleEditFrame->m_Pcb->m_Modules;
PtBlock = &panel->GetScreen()->BlockLocate; PtBlock = &screen->BlockLocate;
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
/* Effacement ancien cadre */ /* Effacement ancien cadre */

View File

@ -18,7 +18,7 @@ wxPoint BOARD_ITEM::ZeroOffset(0,0);
// this is an ugly workaround to a linking problem in debug mode // this is an ugly workaround to a linking problem in debug mode
// which needs to define SCH_ITEM::Place() when not really used. // which needs to define SCH_ITEM::Place() when not really used.
#include "sch_item_struct.h" #include "sch_item_struct.h"
void SCH_ITEM::Place( WinEDA_DrawFrame* frame, wxDC* DC ) void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
{ {
} }
@ -503,15 +503,15 @@ bool BOARD::ComputeBoundaryBox()
if( m_PcbFrame->m_Draw_Sheet_Ref ) if( m_PcbFrame->m_Draw_Sheet_Ref )
{ {
xmin = ymin = 0; xmin = ymin = 0;
xmax = m_PcbFrame->m_CurrentScreen->ReturnPageSize().x; xmax = m_PcbFrame->GetScreen()->ReturnPageSize().x;
ymax = m_PcbFrame->m_CurrentScreen->ReturnPageSize().y; ymax = m_PcbFrame->GetScreen()->ReturnPageSize().y;
} }
else else
{ {
xmin = -m_PcbFrame->m_CurrentScreen->ReturnPageSize().x / 2; xmin = -m_PcbFrame->GetScreen()->ReturnPageSize().x / 2;
ymin = -m_PcbFrame->m_CurrentScreen->ReturnPageSize().y / 2; ymin = -m_PcbFrame->GetScreen()->ReturnPageSize().y / 2;
xmax = m_PcbFrame->m_CurrentScreen->ReturnPageSize().x / 2; xmax = m_PcbFrame->GetScreen()->ReturnPageSize().x / 2;
ymax = m_PcbFrame->m_CurrentScreen->ReturnPageSize().y / 2; ymax = m_PcbFrame->GetScreen()->ReturnPageSize().y / 2;
} }
} }

View File

@ -154,13 +154,10 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( (color & ITEM_NOT_SHOW) != 0 ) if( (color & ITEM_NOT_SHOW) != 0 )
return; return;
if( panel )
screen = (PCB_SCREEN*) panel->m_Parent->m_CurrentScreen;
else
screen = (PCB_SCREEN*) ActiveScreen;
frame = (WinEDA_BasePcbFrame*) panel->m_Parent; frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
screen = frame->GetScreen();
zoom = screen->GetZoom(); zoom = screen->GetZoom();
type_trace = m_Shape; type_trace = m_Shape;

View File

@ -238,23 +238,18 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
wxPoint coord[4]; wxPoint coord[4];
int zoom; int zoom;
int fillpad = 0; int fillpad = 0;
WinEDA_BasePcbFrame* frame = NULL;
wxPoint shape_pos; wxPoint shape_pos;
PCB_SCREEN* screen = panel ? wxASSERT( panel );
(PCB_SCREEN*) panel->m_Parent->m_CurrentScreen :
(PCB_SCREEN*) ActiveScreen;
if ( panel ) // Use current frame setting WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
{
frame = (WinEDA_BasePcbFrame*) panel->m_Parent; PCB_SCREEN* screen = frame->GetScreen();
}
else if( DisplayOpt.DisplayPadFill == FILLED ) // Use board frame setting zoom = screen->GetZoom();
fillpad = 1;
if( frame->m_DisplayPadFill == FILLED ) if( frame->m_DisplayPadFill == FILLED )
fillpad = 1; fillpad = 1;
zoom = screen->GetZoom();
#ifdef PCBNEW #ifdef PCBNEW
if( m_Flags & IS_MOVED ) if( m_Flags & IS_MOVED )

View File

@ -151,7 +151,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC )
frame->Compile_Ratsnest( DC, AFFICHE ); frame->Compile_Ratsnest( DC, AFFICHE );
frame->m_CurrentScreen->SetModify(); frame->GetScreen()->SetModify();
} }

View File

@ -529,22 +529,22 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
{ {
case EDA_PANNING_UP_KEY: case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP ); OnZoom( ID_ZOOM_PANNING_UP );
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case EDA_PANNING_DOWN_KEY: case EDA_PANNING_DOWN_KEY:
OnZoom( ID_ZOOM_PANNING_DOWN ); OnZoom( ID_ZOOM_PANNING_DOWN );
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case EDA_PANNING_LEFT_KEY: case EDA_PANNING_LEFT_KEY:
OnZoom( ID_ZOOM_PANNING_LEFT ); OnZoom( ID_ZOOM_PANNING_LEFT );
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case EDA_PANNING_RIGHT_KEY: case EDA_PANNING_RIGHT_KEY:
OnZoom( ID_ZOOM_PANNING_RIGHT ); OnZoom( ID_ZOOM_PANNING_RIGHT );
curpos = m_CurrentScreen->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case EDA_ZOOM_IN_FROM_MOUSE: case EDA_ZOOM_IN_FROM_MOUSE:

View File

@ -186,7 +186,7 @@ void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event )
CurrentCotation->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); CurrentCotation->Draw( m_Parent->DrawPanel, m_DC, GR_OR );
} }
m_Parent->m_CurrentScreen->SetModify(); m_Parent->GetScreen()->SetModify();
EndModal( 1 ); EndModal( 1 );
} }
@ -226,7 +226,7 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC )
if( Cotation == NULL ) /* debut reel du trace */ if( Cotation == NULL ) /* debut reel du trace */
{ {
status_cotation = 1; status_cotation = 1;
pos = m_CurrentScreen->m_Curseur; pos = GetScreen()->m_Curseur;
Cotation = new COTATION( m_Pcb ); Cotation = new COTATION( m_Pcb );
Cotation->m_Flags = IS_NEW; Cotation->m_Flags = IS_NEW;
@ -286,7 +286,7 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC )
m_Pcb->m_Drawings->Pback = Cotation; m_Pcb->m_Drawings->Pback = Cotation;
m_Pcb->m_Drawings = Cotation; m_Pcb->m_Drawings = Cotation;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
@ -374,7 +374,7 @@ void WinEDA_PcbFrame::Delete_Cotation( COTATION* Cotation, wxDC* DC )
if( DC ) if( DC )
Cotation->Draw( DrawPanel, DC, GR_XOR ); Cotation->Draw( DrawPanel, DC, GR_XOR );
Cotation->DeleteStructure(); Cotation->DeleteStructure();
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
} }

View File

@ -765,7 +765,7 @@ void DrcDialog::OnButtonBrowseRptFileClick( wxCommandEvent& event )
wxString Mask(wxT("*")); wxString Mask(wxT("*"));
wxString Ext(wxT(".rpt")); wxString Ext(wxT(".rpt"));
FileName = m_Parent->m_CurrentScreen->m_FileName; FileName = m_Parent->GetScreen()->m_FileName;
ChangeFileNameExt(FileName, wxT("-drc") + Ext); ChangeFileNameExt(FileName, wxT("-drc") + Ext);
Mask += Ext; Mask += Ext;

View File

@ -141,11 +141,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
/* Should not be executed, just in case */ /* Should not be executed, just in case */
if( m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE ) if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE )
{ {
m_CurrentScreen->BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
m_CurrentScreen->BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
m_CurrentScreen->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
} }
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
@ -204,33 +204,33 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_COPY; GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE; GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_INVERT_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT; GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;

View File

@ -78,7 +78,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
/* Init nom fichier */ /* Init nom fichier */
NameLayerCmp = m_CurrentScreen->m_FileName; NameLayerCmp = GetScreen()->m_FileName;
ChangeFileNameExt( NameLayerCmp, wxT( "-cmp.pos" ) ); ChangeFileNameExt( NameLayerCmp, wxT( "-cmp.pos" ) );
LayerCmp = wxFopen( NameLayerCmp, wxT( "wt" ) ); LayerCmp = wxFopen( NameLayerCmp, wxT( "wt" ) );
@ -90,7 +90,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
if( GenCu ) if( GenCu )
{ {
NameLayerCu = m_CurrentScreen->m_FileName; NameLayerCu = GetScreen()->m_FileName;
ChangeFileNameExt( NameLayerCu, wxT( "-copper.pos" ) ); ChangeFileNameExt( NameLayerCu, wxT( "-copper.pos" ) );
LayerCu = wxFopen( NameLayerCu, wxT( "wt" ) ); LayerCu = wxFopen( NameLayerCu, wxT( "wt" ) );
if( LayerCu == 0 ) if( LayerCu == 0 )
@ -242,7 +242,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
File_Place_Offset = wxPoint( 0, 0 ); File_Place_Offset = wxPoint( 0, 0 );
/* Init nom fichier */ /* Init nom fichier */
FullFileName = m_CurrentScreen->m_FileName; FullFileName = GetScreen()->m_FileName;
ChangeFileNameExt( FullFileName, wxT( ".rpt" ) ); ChangeFileNameExt( FullFileName, wxT( ".rpt" ) );
rptfile = wxFopen( FullFileName, wxT( "wt" ) ); rptfile = wxFopen( FullFileName, wxT( "wt" ) );

View File

@ -187,7 +187,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
Self_On = 0; Self_On = 0;
Mself.m_End = m_CurrentScreen->m_Curseur; Mself.m_End = GetScreen()->m_Curseur;
/* Agencement des parametres pour simplifier le calcul : */ /* Agencement des parametres pour simplifier le calcul : */
/* le point de depart doit avoir la coord depart < celle du point de fin */ /* le point de depart doit avoir la coord depart < celle du point de fin */

View File

@ -288,7 +288,7 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
layer1, layer2, gen_through_holes ? false : true ); layer1, layer2, gen_through_holes ? false : true );
if( s_ToolListBuffer.size() > 0 ) //holes? if( s_ToolListBuffer.size() > 0 ) //holes?
{ {
FullFileName = m_Parent->m_CurrentScreen->m_FileName; FullFileName = m_Parent->GetScreen()->m_FileName;
layer_extend.Empty(); layer_extend.Empty();
if( !gen_through_holes ) if( !gen_through_holes )
{ {
@ -360,7 +360,7 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
if( m_Choice_Drill_Report->GetSelection() > 0 ) if( m_Choice_Drill_Report->GetSelection() > 0 )
{ {
FullFileName = m_Parent->m_CurrentScreen->m_FileName; FullFileName = m_Parent->GetScreen()->m_FileName;
GenDrillReport( FullFileName ); GenDrillReport( FullFileName );
} }
@ -748,7 +748,7 @@ void WinEDA_DrillFrame::GenDrillMap( const wxString aFileName,
GenDrillMapFile( m_Parent->m_Pcb, GenDrillMapFile( m_Parent->m_Pcb,
dest, dest,
FullFileName, FullFileName,
m_Parent->m_CurrentScreen->m_CurrentSheetDesc->m_Size, m_Parent->GetScreen()->m_CurrentSheetDesc->m_Size,
s_HoleListBuffer, s_HoleListBuffer,
s_ToolListBuffer, s_ToolListBuffer,
s_Unit_Drill_is_Inch, s_Unit_Drill_is_Inch,
@ -791,7 +791,7 @@ void WinEDA_DrillFrame::GenDrillReport( const wxString aFileName )
return; return;
} }
GenDrillReportFile( dest, m_Parent->m_Pcb, GenDrillReportFile( dest, m_Parent->m_Pcb,
m_Parent->m_CurrentScreen->m_FileName, m_Parent->GetScreen()->m_FileName,
s_Unit_Drill_is_Inch, s_Unit_Drill_is_Inch,
s_HoleListBuffer, s_HoleListBuffer,
s_ToolListBuffer ); s_ToolListBuffer );

View File

@ -834,7 +834,7 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
if( strnicmp( Line, "$SHEETDESCR", 11 ) == 0 ) if( strnicmp( Line, "$SHEETDESCR", 11 ) == 0 )
{ {
ReadSheetDescr( m_CurrentScreen, File, &LineNum ); ReadSheetDescr( GetScreen(), File, &LineNum );
continue; continue;
} }
@ -1060,7 +1060,7 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
DateAndTime( line ) ); DateAndTime( line ) );
WriteGeneralDescrPcb( aFile ); WriteGeneralDescrPcb( aFile );
WriteSheetDescr( m_CurrentScreen, aFile ); WriteSheetDescr( GetScreen(), aFile );
WriteSetup( aFile, this, m_Pcb ); WriteSetup( aFile, this, m_Pcb );
rc = m_Pcb->Save( aFile ); rc = m_Pcb->Save( aFile );

View File

@ -743,7 +743,7 @@ MODULE* WinEDA_BasePcbFrame::Create_1_Module( wxDC* DC, const wxString& module_n
* 2eme = type VALEUR: "VAL**" */ * 2eme = type VALEUR: "VAL**" */
/* Mise a jour des caract du nouveau module */ /* Mise a jour des caract du nouveau module */
newpos = m_CurrentScreen->m_Curseur; newpos = GetScreen()->m_Curseur;
Module->SetPosition( newpos ); Module->SetPosition( newpos );
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );

View File

@ -77,12 +77,12 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module )
build_liste_pads(); build_liste_pads();
m_CurrentScreen->m_Curseur.x = m_CurrentScreen->m_Curseur.y = 0; GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
Place_Module( Module, NULL ); Place_Module( Module, NULL );
if( Module->GetLayer() != CMP_N ) if( Module->GetLayer() != CMP_N )
m_Pcb->Change_Side_Module( Module, NULL ); m_Pcb->Change_Side_Module( Module, NULL );
Rotate_Module( NULL, Module, 0, FALSE ); Rotate_Module( NULL, Module, 0, FALSE );
m_CurrentScreen->ClrModify(); GetScreen()->ClrModify();
Zoom_Automatique( TRUE ); Zoom_Automatique( TRUE );
} }
@ -94,7 +94,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
/* Permet de charger un module directement a partir de la librairie */ /* Permet de charger un module directement a partir de la librairie */
{ {
MODULE* module; MODULE* module;
wxPoint curspos = m_CurrentScreen->m_Curseur; wxPoint curspos = GetScreen()->m_Curseur;
wxString ModuleName, keys; wxString ModuleName, keys;
static wxArrayString HistoryList; static wxArrayString HistoryList;
bool AllowWildSeach = TRUE; bool AllowWildSeach = TRUE;
@ -148,7 +148,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
module = Get_Librairie_Module( this, library, ModuleName, TRUE ); module = Get_Librairie_Module( this, library, ModuleName, TRUE );
} }
m_CurrentScreen->m_Curseur = curspos; GetScreen()->m_Curseur = curspos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( module ) if( module )

View File

@ -604,27 +604,27 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_COPY; GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE; GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
@ -632,7 +632,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_MIRROR_Y_BLOCK: case ID_POPUP_MIRROR_Y_BLOCK:
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_INVERT_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT; GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
m_CurrentScreen->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;

View File

@ -140,7 +140,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
SaveCopyInUndoList( m_Pcb->m_Modules ); SaveCopyInUndoList( m_Pcb->m_Modules );
Place_Ancre( m_Pcb->m_Modules, DC ); Place_Ancre( m_Pcb->m_Modules, DC );
m_Pcb->m_Modules->m_Flags = 0; m_Pcb->m_Modules->m_Flags = 0;
m_CurrentScreen->m_Curseur = wxPoint( 0, 0 ); GetScreen()->m_Curseur = wxPoint( 0, 0 );
Recadre_Trace( TRUE ); Recadre_Trace( TRUE );
Place_Module( m_Pcb->m_Modules, DC ); Place_Module( m_Pcb->m_Modules, DC );
RedrawActiveWindow( DC, TRUE ); RedrawActiveWindow( DC, TRUE );
@ -185,7 +185,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
wxString msg; wxString msg;
bool append_set_width = FALSE; bool append_set_width = FALSE;
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
// Simple localisation des elements si possible // Simple localisation des elements si possible
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )

View File

@ -132,11 +132,12 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* pa
if( g_ModuleEditor_Pcb == NULL ) if( g_ModuleEditor_Pcb == NULL )
g_ModuleEditor_Pcb = new BOARD( NULL, this ); g_ModuleEditor_Pcb = new BOARD( NULL, this );
m_Pcb = g_ModuleEditor_Pcb; m_Pcb = g_ModuleEditor_Pcb;
m_Pcb->m_PcbFrame = this; m_Pcb->m_PcbFrame = this;
m_CurrentScreen = ScreenModule; SetBaseScreen( ScreenModule );
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
GetSettings(); GetSettings();
wxSize GridSize( 500, 500 ); wxSize GridSize( 500, 500 );
@ -169,7 +170,7 @@ WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
/****************************************************/ /****************************************************/
{ {
m_Parent->m_ModuleEditFrame = NULL; m_Parent->m_ModuleEditFrame = NULL;
m_CurrentScreen = ScreenPcb; SetBaseScreen( ScreenPcb );
} }
@ -307,7 +308,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
int zoom; int zoom;
for( jj = 1, zoom = 1; zoom <= m_ZoomMaxValue; zoom <<= 1, jj++ ) for( jj = 1, zoom = 1; zoom <= m_ZoomMaxValue; zoom <<= 1, jj++ )
{ {
if( m_CurrentScreen && (m_CurrentScreen->GetZoom() == zoom) ) if( GetScreen() && (GetScreen()->GetZoom() == zoom) )
break; break;
new_choice++; new_choice++;
} }

View File

@ -149,7 +149,7 @@ void Exit_Module( WinEDA_DrawPanel* Panel, wxDC* DC )
MODULE* module; MODULE* module;
WinEDA_BasePcbFrame* pcbframe = (WinEDA_BasePcbFrame*) Panel->m_Parent; WinEDA_BasePcbFrame* pcbframe = (WinEDA_BasePcbFrame*) Panel->m_Parent;
module = (MODULE*) pcbframe->m_CurrentScreen->GetCurItem(); module = (MODULE*) pcbframe->GetScreen()->GetCurItem();
pcbframe->m_Pcb->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; pcbframe->m_Pcb->m_Status_Pcb &= ~CHEVELU_LOCAL_OK;
if( module ) if( module )
@ -219,7 +219,7 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
if( module == NULL ) if( module == NULL )
return NULL; return NULL;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
/* Duplication du module */ /* Duplication du module */
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
@ -244,7 +244,7 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* redessin du contour de l'empreinte lors des deplacements de la souris /* redessin du contour de l'empreinte lors des deplacements de la souris
*/ */
{ {
MODULE* module = (MODULE*) panel->m_Parent->m_CurrentScreen->GetCurItem(); MODULE* module = (MODULE*) panel->GetScreen()->GetCurItem();
if( module == NULL ) if( module == NULL )
return; return;
@ -256,7 +256,7 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
/* Redessine le module a la nouvelle place */ /* Redessine le module a la nouvelle place */
g_Offset_Module = module->m_Pos - panel->m_Parent->m_CurrentScreen->m_Curseur; g_Offset_Module = module->m_Pos - panel->GetScreen()->m_Curseur;
DrawModuleOutlines( panel, DC, module ); DrawModuleOutlines( panel, DC, module );
Dessine_Segments_Dragges( panel, DC ); Dessine_Segments_Dragges( panel, DC );
@ -297,7 +297,7 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
} }
} }
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
/* Erase rastnest if needed /* Erase rastnest if needed
* Dirty rectangle is not used here because usually using a XOR draw mode gives good results (very few artefacts) for ratsnest * Dirty rectangle is not used here because usually using a XOR draw mode gives good results (very few artefacts) for ratsnest
@ -661,13 +661,13 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC )
if( module == 0 ) if( module == 0 )
return; return;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
m_Pcb->m_Status_Pcb &= ~( LISTE_CHEVELU_OK | CONNEXION_OK); m_Pcb->m_Status_Pcb &= ~( LISTE_CHEVELU_OK | CONNEXION_OK);
if( g_Show_Module_Ratsnest && (m_Pcb->m_Status_Pcb & LISTE_PAD_OK) && DC ) if( g_Show_Module_Ratsnest && (m_Pcb->m_Status_Pcb & LISTE_PAD_OK) && DC )
trace_ratsnest_module( DC ); trace_ratsnest_module( DC );
newpos = m_CurrentScreen->m_Curseur; newpos = GetScreen()->m_Curseur;
module->SetPosition( newpos ); module->SetPosition( newpos );
if( DC ) if( DC )
@ -716,7 +716,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
if( module == NULL ) if( module == NULL )
return; return;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
/* efface ancienne position */ /* efface ancienne position */
if( !(module->m_Flags & IS_MOVED) ) /* Rotation simple */ if( !(module->m_Flags & IS_MOVED) ) /* Rotation simple */

View File

@ -96,7 +96,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( wxDC* DC,
static void Exit_Muonde( WinEDA_DrawFrame* frame, wxDC* DC ) static void Exit_Muonde( WinEDA_DrawFrame* frame, wxDC* DC )
/**********************************************************/ /**********************************************************/
{ {
MODULE* Module = (MODULE*) frame->m_CurrentScreen->GetCurItem(); MODULE* Module = (MODULE*) frame->GetScreen()->GetCurItem();
if( Module ) if( Module )
{ {
@ -276,7 +276,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type )
Module->Draw( DrawPanel, DC, GR_OR ); Module->Draw( DrawPanel, DC, GR_OR );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
return Module; return Module;
} }
@ -646,7 +646,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( wxDC* DC )
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
Module->Draw( DrawPanel, DC, GR_OR ); Module->Draw( DrawPanel, DC, GR_OR );
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
return Module; return Module;
} }

View File

@ -186,7 +186,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
if( aMessageWindow ) if( aMessageWindow )
aMessageWindow->AppendText( msg ); aMessageWindow->AppendText( msg );
aFrame->m_CurrentScreen->SetModify(); aFrame->GetScreen()->SetModify();
aFrame->m_Pcb->m_Status_Pcb = 0; State = 0; LineNum = 0; Comment = 0; aFrame->m_Pcb->m_Status_Pcb = 0; State = 0; LineNum = 0; Comment = 0;
s_NbNewModules = 0; s_NbNewModules = 0;
@ -1003,7 +1003,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
MODULEtoLOAD* ref, * cmp; MODULEtoLOAD* ref, * cmp;
int ii; int ii;
MODULE* Module = NULL; MODULE* Module = NULL;
wxPoint OldPos = aPcbFrame->m_CurrentScreen->m_Curseur; wxPoint OldPos = aPcbFrame->GetScreen()->m_Curseur;
if( s_NbNewModules == 0 ) if( s_NbNewModules == 0 )
return; return;
@ -1014,14 +1014,14 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
// Calculate the footprint "best" position: // Calculate the footprint "best" position:
if( aPcbFrame->SetBoardBoundaryBoxFromEdgesOnly() ) if( aPcbFrame->SetBoardBoundaryBoxFromEdgesOnly() )
{ {
aPcbFrame->m_CurrentScreen->m_Curseur.x = aPcbFrame->m_Pcb->m_BoundaryBox.GetRight() + aPcbFrame->GetScreen()->m_Curseur.x = aPcbFrame->m_Pcb->m_BoundaryBox.GetRight() +
5000; 5000;
aPcbFrame->m_CurrentScreen->m_Curseur.y = aPcbFrame->m_Pcb->m_BoundaryBox.GetBottom() + aPcbFrame->GetScreen()->m_Curseur.y = aPcbFrame->m_Pcb->m_BoundaryBox.GetBottom() +
10000; 10000;
} }
else else
{ {
aPcbFrame->m_CurrentScreen->m_Curseur = wxPoint( 0, 0 ); aPcbFrame->GetScreen()->m_Curseur = wxPoint( 0, 0 );
} }
for( ii = 0; ii < s_NbNewModules; ii++, cmp = cmp->Next() ) for( ii = 0; ii < s_NbNewModules; ii++, cmp = cmp->Next() )
@ -1061,7 +1061,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
} }
} }
aPcbFrame->m_CurrentScreen->m_Curseur = OldPos; aPcbFrame->GetScreen()->m_Curseur = OldPos;
} }

View File

@ -128,7 +128,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
wxString msg; wxString msg;
int flags = 0; int flags = 0;
bool locate_track = FALSE; bool locate_track = FALSE;
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );

View File

@ -215,7 +215,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
SetIcon( wxICON( a_icon_pcbnew ) ); SetIcon( wxICON( a_icon_pcbnew ) );
m_InternalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch m_InternalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch
m_CurrentScreen = ScreenPcb; SetBaseScreen( ScreenPcb );
GetSettings(); GetSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
@ -249,9 +249,12 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
WinEDA_PcbFrame::~WinEDA_PcbFrame() WinEDA_PcbFrame::~WinEDA_PcbFrame()
{ {
m_Parent->m_PcbFrame = NULL; m_Parent->m_PcbFrame = NULL;
m_CurrentScreen = ScreenPcb; SetBaseScreen( ScreenPcb );
delete m_drc; delete m_drc;
if(m_Pcb != g_ModuleEditor_Pcb) delete m_Pcb;
if( m_Pcb != g_ModuleEditor_Pcb )
delete m_Pcb;
} }
@ -304,7 +307,7 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
/* Reselection de l'ecran de base, /* Reselection de l'ecran de base,
* pour les evenements de refresh generes par wxWindows */ * pour les evenements de refresh generes par wxWindows */
m_CurrentScreen = ActiveScreen = ScreenPcb; SetBaseScreen( ActiveScreen = ScreenPcb );
SaveSettings(); SaveSettings();
if( m_Parent && m_Parent->m_EDA_Config ) if( m_Parent && m_Parent->m_EDA_Config )
@ -342,9 +345,9 @@ void WinEDA_PcbFrame::SetToolbars()
if( m_HToolBar == NULL ) if( m_HToolBar == NULL )
return; return;
m_HToolBar->EnableTool( ID_SAVE_BOARD, m_CurrentScreen->IsModify() ); m_HToolBar->EnableTool( ID_SAVE_BOARD, GetScreen()->IsModify() );
if( m_CurrentScreen->BlockLocate.m_Command == BLOCK_MOVE ) if( GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
{ {
m_HToolBar->EnableTool( wxID_CUT, TRUE ); m_HToolBar->EnableTool( wxID_CUT, TRUE );
m_HToolBar->EnableTool( wxID_COPY, TRUE ); m_HToolBar->EnableTool( wxID_COPY, TRUE );
@ -525,7 +528,7 @@ void WinEDA_PcbFrame::SetToolbars()
for( jj = 1, zoom = 1; zoom <= m_ZoomMaxValue; zoom <<= 1, jj++ ) for( jj = 1, zoom = 1; zoom <= m_ZoomMaxValue; zoom <<= 1, jj++ )
{ {
if( m_CurrentScreen && (m_CurrentScreen->GetZoom() == zoom) ) if( GetScreen() && (GetScreen()->GetZoom() == zoom) )
break; break;
new_choice++; new_choice++;
} }
@ -534,15 +537,15 @@ void WinEDA_PcbFrame::SetToolbars()
m_SelZoomBox->SetSelection( new_choice ); m_SelZoomBox->SetSelection( new_choice );
} }
if( m_SelGridBox && m_CurrentScreen ) if( m_SelGridBox && GetScreen() )
{ {
int kk = m_SelGridBox->GetChoice(); int kk = m_SelGridBox->GetChoice();
for( ii = 0; g_GridList[ii].x > 0; ii++ ) for( ii = 0; g_GridList[ii].x > 0; ii++ )
{ {
if( !m_CurrentScreen->m_UserGridIsON if( !GetScreen()->m_UserGridIsON
&& (m_CurrentScreen->GetGrid().x == g_GridList[ii].x) && (GetScreen()->GetGrid().x == g_GridList[ii].x)
&& (m_CurrentScreen->GetGrid().y == g_GridList[ii].y) ) && (GetScreen()->GetGrid().y == g_GridList[ii].y) )
{ {
if( kk != ii ) if( kk != ii )
m_SelGridBox->SetSelection( ii ); m_SelGridBox->SetSelection( ii );

View File

@ -240,7 +240,7 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event )
/* Redessin du Texte */ /* Redessin du Texte */
CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, GR_OR );
} }
m_Parent->m_CurrentScreen->SetModify(); m_Parent->GetScreen()->SetModify();
EndModal( 1 ); EndModal( 1 );
} }
@ -288,7 +288,7 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
TextePcb->m_Flags = 0; TextePcb->m_Flags = 0;
} }
@ -318,8 +318,7 @@ static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/*************************************************************************/ /*************************************************************************/
/* Routine deplacant le texte PCB suivant le curseur de la souris */ /* Routine deplacant le texte PCB suivant le curseur de la souris */
{ {
TEXTE_PCB* TextePcb = (TEXTE_PCB*) TEXTE_PCB* TextePcb = (TEXTE_PCB*) panel->GetScreen()->GetCurItem();
panel->m_Parent->m_CurrentScreen->GetCurItem();
if( TextePcb == NULL ) if( TextePcb == NULL )
return; return;
@ -329,7 +328,7 @@ static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( erase ) if( erase )
TextePcb->Draw( panel, DC, GR_XOR ); TextePcb->Draw( panel, DC, GR_XOR );
TextePcb->m_Pos = panel->m_Parent->m_CurrentScreen->m_Curseur; TextePcb->m_Pos = panel->GetScreen()->m_Curseur;
/* Redessin du Texte */ /* Redessin du Texte */
TextePcb->Draw( panel, DC, GR_XOR ); TextePcb->Draw( panel, DC, GR_XOR );
@ -376,7 +375,7 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
TextePcb->m_Miroir = 0; TextePcb->m_Miroir = 0;
TextePcb->m_Size = g_DesignSettings.m_PcbTextSize; TextePcb->m_Size = g_DesignSettings.m_PcbTextSize;
TextePcb->m_Pos = m_CurrentScreen->m_Curseur; TextePcb->m_Pos = GetScreen()->m_Curseur;
TextePcb->m_Width = g_DesignSettings.m_PcbTextWidth; TextePcb->m_Width = g_DesignSettings.m_PcbTextWidth;
InstallTextPCBOptionsFrame( TextePcb, DC, TextePcb->m_Pos ); InstallTextPCBOptionsFrame( TextePcb, DC, TextePcb->m_Pos );
@ -418,5 +417,5 @@ void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
TextePcb->Draw( DrawPanel, DC, drawmode ); TextePcb->Draw( DrawPanel, DC, drawmode );
TextePcb->Display_Infos( this ); TextePcb->Display_Infos( this );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
} }

View File

@ -39,8 +39,8 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
scale_y = Scale_Y * SCALE_HPGL; scale_y = Scale_Y * SCALE_HPGL;
// calcul en unites internes des dimensions de la feuille ( connues en 1/1000 pouce ) // calcul en unites internes des dimensions de la feuille ( connues en 1/1000 pouce )
SheetSize.x = m_CurrentScreen->m_CurrentSheetDesc->m_Size.x * U_PCB; SheetSize.x = GetScreen()->m_CurrentSheetDesc->m_Size.x * U_PCB;
SheetSize.y = m_CurrentScreen->m_CurrentSheetDesc->m_Size.y * U_PCB; SheetSize.y = GetScreen()->m_CurrentSheetDesc->m_Size.y * U_PCB;
g_PlotOffset.x = 0; g_PlotOffset.x = 0;
g_PlotOffset.y = (int) (SheetSize.y * scale_y); g_PlotOffset.y = (int) (SheetSize.y * scale_y);
@ -79,7 +79,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
{ {
int tmp = g_PlotOrient; g_PlotOrient = 0; int tmp = g_PlotOrient; g_PlotOrient = 0;
InitPlotParametresHPGL( g_PlotOffset, scale_x, scale_y, g_PlotOrient ); InitPlotParametresHPGL( g_PlotOffset, scale_x, scale_y, g_PlotOrient );
PlotWorkSheet( PLOT_FORMAT_HPGL, m_CurrentScreen ); PlotWorkSheet( PLOT_FORMAT_HPGL, GetScreen() );
g_PlotOrient = tmp; g_PlotOrient = tmp;
} }

View File

@ -38,7 +38,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer, bo
wxSize BoardSize; wxSize BoardSize;
wxPoint BoardCenter; wxPoint BoardCenter;
bool Center = FALSE; bool Center = FALSE;
Ki_PageDescr* currentsheet = m_CurrentScreen->m_CurrentSheetDesc; Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
double scale_format; // Facteur correctif pour conversion forlat Ax->A4 double scale_format; // Facteur correctif pour conversion forlat Ax->A4
double scale_x, scale_y; double scale_x, scale_y;
int PlotMarge_in_mils = 0; int PlotMarge_in_mils = 0;
@ -105,7 +105,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer, bo
int tmp = g_PlotOrient; int tmp = g_PlotOrient;
g_PlotOrient = 0; g_PlotOrient = 0;
SetPlotScale( 1.0, 1.0 ); SetPlotScale( 1.0, 1.0 );
PlotWorkSheet( PLOT_FORMAT_POST, m_CurrentScreen ); PlotWorkSheet( PLOT_FORMAT_POST, GetScreen() );
g_PlotOrient = tmp; g_PlotOrient = tmp;
} }

View File

@ -52,7 +52,7 @@ void WinEDA_PcbFrame::GlobalRoute( wxDC* DC )
} }
/* Calcule du nom du fichier intermediaire de communication */ /* Calcule du nom du fichier intermediaire de communication */
FullFileName = m_CurrentScreen->m_FileName; FullFileName = GetScreen()->m_FileName;
ChangeFileNameExt( FullFileName, wxT( ".ipt" ) ); ChangeFileNameExt( FullFileName, wxT( ".ipt" ) );
if( ( outfile = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL ) if( ( outfile = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
@ -558,7 +558,7 @@ void WinEDA_PcbFrame::ReadAutoroutedTracks( wxDC* DC )
int max_layer = m_Pcb->m_BoardSettings->m_CopperLayerCount; int max_layer = m_Pcb->m_BoardSettings->m_CopperLayerCount;
/* Calcule du nom du fichier intermediaire de communication */ /* Calcule du nom du fichier intermediaire de communication */
FullFileName = m_CurrentScreen->m_FileName; FullFileName = GetScreen()->m_FileName;
ChangeFileNameExt( FullFileName, wxT( ".trc" ) ); ChangeFileNameExt( FullFileName, wxT( ".trc" ) );
if( ( File = wxFopen( FullFileName, wxT( "rt" ) ) ) == NULL ) if( ( File = wxFopen( FullFileName, wxT( "rt" ) ) ) == NULL )
@ -661,10 +661,10 @@ void WinEDA_PcbFrame::ReadAutoroutedTracks( wxDC* DC )
else else
{ {
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
} }
Compile_Ratsnest( DC, TRUE ); Compile_Ratsnest( DC, TRUE );
if( NbTrack ) if( NbTrack )
m_CurrentScreen->SetRefreshReq(); GetScreen()->SetRefreshReq();
} }

View File

@ -274,7 +274,7 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent
m_Parent = parent; m_Parent = parent;
SetFont( *g_DialogFont ); SetFont( *g_DialogFont );
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->m_CurrentScreen; PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
/* Construction de la liste des couches autoris<69>s */ /* Construction de la liste des couches autoris<69>s */
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1]; int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
Masque_Layer += ALL_NO_CU_LAYERS; Masque_Layer += ALL_NO_CU_LAYERS;
@ -361,7 +361,7 @@ void WinEDA_SelLayerPairFrame::OnOkClick( wxCommandEvent& event )
return; return;
} }
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->m_CurrentScreen; PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
screen->m_Route_Layer_TOP = m_LayerId[m_LayerListTOP->GetSelection()]; screen->m_Route_Layer_TOP = m_LayerId[m_LayerListTOP->GetSelection()];
screen->m_Route_Layer_BOTTOM = m_LayerId[m_LayerListBOTTOM->GetSelection()]; screen->m_Route_Layer_BOTTOM = m_LayerId[m_LayerListBOTTOM->GetSelection()];

View File

@ -335,7 +335,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event )
pt_segm = (TRACK*) m_Pcb->m_Track; pt_segm = (TRACK*) m_Pcb->m_Track;
for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext ) for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
{ {
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
if( pt_segm->Type() == TYPEVIA ) if( pt_segm->Type() == TYPEVIA )
{ {
SEGVIA* Via = (SEGVIA*) pt_segm; SEGVIA* Via = (SEGVIA*) pt_segm;
@ -361,7 +361,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event )
pt_segm = (TRACK*) m_Pcb->m_Zone; pt_segm = (TRACK*) m_Pcb->m_Zone;
for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext ) for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
{ {
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
jj = pt_segm->GetLayer(); jj = pt_segm->GetLayer();
if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE ) if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE )
pt_segm->SetLayer( New_Layer[jj] ); pt_segm->SetLayer( New_Layer[jj] );
@ -373,7 +373,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event )
{ {
if( PtStruct->Type() == TYPEDRAWSEGMENT ) if( PtStruct->Type() == TYPEDRAWSEGMENT )
{ {
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
pt_drawsegm = (DRAWSEGMENT*) PtStruct; pt_drawsegm = (DRAWSEGMENT*) PtStruct;
jj = pt_drawsegm->GetLayer(); jj = pt_drawsegm->GetLayer();
if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE ) if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE )

View File

@ -186,6 +186,6 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
DrawGeneralRatsnest( DC ); DrawGeneralRatsnest( DC );
m_CurrentScreen->ClrRefreshReq(); GetScreen()->ClrRefreshReq();
} }

View File

@ -211,7 +211,7 @@ int WinEDA_ExchangeModuleFrame::Maj_ListeCmp(
return 0; /* pas de changement de nom */ return 0; /* pas de changement de nom */
/* Calcul nom fichier CMP par changement de l'extension du nom netliste */ /* Calcul nom fichier CMP par changement de l'extension du nom netliste */
FileNameCmp = m_Parent->m_CurrentScreen->m_FileName; FileNameCmp = m_Parent->GetScreen()->m_FileName;
ChangeFileNameExt( FileNameCmp, NetCmpExtBuffer ); ChangeFileNameExt( FileNameCmp, NetCmpExtBuffer );
// Modification du fichier .cmp correcpondant // Modification du fichier .cmp correcpondant
@ -527,10 +527,10 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff,
NewModule->m_Parent = m_Pcb; NewModule->m_Parent = m_Pcb;
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
oldpos = m_CurrentScreen->m_Curseur; oldpos = GetScreen()->m_Curseur;
m_CurrentScreen->m_Curseur = OldModule->m_Pos; GetScreen()->m_Curseur = OldModule->m_Pos;
Place_Module( NewModule, NULL ); Place_Module( NewModule, NULL );
m_CurrentScreen->m_Curseur = oldpos; GetScreen()->m_Curseur = oldpos;
/* Changement eventuel de couche */ /* Changement eventuel de couche */
if( OldModule->GetLayer() != NewModule->GetLayer() ) if( OldModule->GetLayer() != NewModule->GetLayer() )
@ -575,7 +575,7 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff,
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
NewModule->m_Flags = 0; NewModule->m_Flags = 0;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
return NewModule; return NewModule;
} }
@ -614,7 +614,7 @@ bool WinEDA_PcbFrame::RecreateCmpFileFromBoard()
} }
/* Calcul nom fichier CMP par changement de l'extension du nom netliste */ /* Calcul nom fichier CMP par changement de l'extension du nom netliste */
FullFileNameCmp = m_CurrentScreen->m_FileName; FullFileNameCmp = GetScreen()->m_FileName;
ChangeFileNameExt( FullFileNameCmp, NetCmpExtBuffer ); ChangeFileNameExt( FullFileNameCmp, NetCmpExtBuffer );
mask = wxT( "*" ) + NetCmpExtBuffer; mask = wxT( "*" ) + NetCmpExtBuffer;

View File

@ -266,35 +266,17 @@ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )
if( id < 0 ) if( id < 0 )
return; return;
GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); BASE_SCREEN* screen = GetBaseScreen();
wxSize grid = GetScreen()->GetGrid();
GetScreen()->SetGrid( g_GridList[id] ); screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
wxSize newgrid = GetScreen()->GetGrid(); wxSize grid = screen->GetGrid();
screen->SetGrid( g_GridList[id] );
wxSize newgrid = screen->GetGrid();
if( newgrid.x != grid.x || newgrid.y != grid.y ) if( newgrid.x != grid.x || newgrid.y != grid.y )
Recadre_Trace( FALSE ); Recadre_Trace( FALSE );
} }
#ifndef EESCHEMA
/**************************************************************/
void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/**************************************************************/
/* Fonction virtuelle
* traitement des touches de fonctions utilisees ds tous les menus
* Zoom
* Redessin d'ecran
* Cht Unites
* Cht couches
* Remise a 0 de l'origine des coordonnees relatives
*/
{
}
#endif
/********************************************************/ /********************************************************/
void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtuelle void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtuelle
/********************************************************/ /********************************************************/
@ -326,10 +308,10 @@ void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtue
int zoom = 1 << id; int zoom = 1 << id;
if( zoom > m_ZoomMaxValue ) if( zoom > m_ZoomMaxValue )
zoom = m_ZoomMaxValue; zoom = m_ZoomMaxValue;
if( GetScreen()->GetZoom() == zoom ) if( GetBaseScreen()->GetZoom() == zoom )
return; return;
GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
GetScreen()->SetZoom( zoom ); GetBaseScreen()->SetZoom( zoom );
Recadre_Trace( FALSE ); Recadre_Trace( FALSE );
} }
} }
@ -339,7 +321,7 @@ int WinEDA_DrawFrame::GetZoom(void)
/***********************************/ /***********************************/
/* Return the current zoom level */ /* Return the current zoom level */
{ {
return GetScreen()->GetZoom(); return GetBaseScreen()->GetZoom();
} }
@ -587,12 +569,13 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type )
if( DrawPanel == NULL ) if( DrawPanel == NULL )
return; return;
BASE_SCREEN* screen = GetBaseScreen();
bool move_mouse_cursor = FALSE; bool move_mouse_cursor = FALSE;
int x, y; int x, y;
wxPoint old_pos; wxPoint old_pos;
DrawPanel->GetViewStart( &x, &y ); DrawPanel->GetViewStart( &x, &y );
old_pos = GetScreen()->m_Curseur; old_pos = GetBaseScreen()->m_Curseur;
switch( zoom_type ) switch( zoom_type )
{ {
@ -603,9 +586,9 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type )
case ID_ZOOM_IN_BUTT: case ID_ZOOM_IN_BUTT:
if( zoom_type == ID_ZOOM_IN_BUTT ) if( zoom_type == ID_ZOOM_IN_BUTT )
GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
GetScreen()->SetPreviousZoom(); screen->SetPreviousZoom();
Recadre_Trace( move_mouse_cursor ); Recadre_Trace( move_mouse_cursor );
break; break;
@ -617,8 +600,8 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type )
case ID_ZOOM_OUT_BUTT: case ID_ZOOM_OUT_BUTT:
if( zoom_type == ID_ZOOM_OUT_BUTT ) if( zoom_type == ID_ZOOM_OUT_BUTT )
GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
GetScreen()->SetNextZoom(); screen->SetNextZoom();
Recadre_Trace( move_mouse_cursor ); Recadre_Trace( move_mouse_cursor );
break; break;
@ -736,7 +719,7 @@ int WinEDA_DrawFrame::ReturnBlockCommand( int key )
void WinEDA_DrawFrame::InitBlockPasteInfos() void WinEDA_DrawFrame::InitBlockPasteInfos()
{ {
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; GetBaseScreen()->BlockLocate.m_BlockDrawStruct = NULL;
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
} }
@ -759,15 +742,18 @@ void WinEDA_DrawFrame::AdjustScrollBars()
wxSize draw_size, panel_size; wxSize draw_size, panel_size;
wxSize scrollbar_number; wxSize scrollbar_number;
wxPoint scrollbar_pos; wxPoint scrollbar_pos;
int zoom = GetScreen()->GetZoom();
BASE_SCREEN* screen = GetBaseScreen();
int zoom = screen->GetZoom();
int xUnit, yUnit; int xUnit, yUnit;
if( GetScreen() == NULL ) if( screen == NULL )
return; return;
if( DrawPanel == NULL ) if( DrawPanel == NULL )
return; return;
draw_size = GetScreen()->ReturnPageSize(); draw_size = screen->ReturnPageSize();
// La zone d'affichage est reglee a une taille double de la feuille de travail: // La zone d'affichage est reglee a une taille double de la feuille de travail:
draw_size.x *= 2; draw_size.y *= 2; draw_size.x *= 2; draw_size.y *= 2;
@ -780,20 +766,20 @@ void WinEDA_DrawFrame::AdjustScrollBars()
draw_size.y += panel_size.y / 2; draw_size.y += panel_size.y / 2;
if( GetScreen()->m_Center ) if( screen->m_Center )
{ {
GetScreen()->m_DrawOrg.x = -draw_size.x / 2; screen->m_DrawOrg.x = -draw_size.x / 2;
GetScreen()->m_DrawOrg.y = -draw_size.y / 2; screen->m_DrawOrg.y = -draw_size.y / 2;
} }
else else
{ {
GetScreen()->m_DrawOrg.x = -panel_size.x / 2; screen->m_DrawOrg.x = -panel_size.x / 2;
GetScreen()->m_DrawOrg.y = -panel_size.y / 2; screen->m_DrawOrg.y = -panel_size.y / 2;
} }
// DrawOrg est rendu multiple du zoom min : // DrawOrg est rendu multiple du zoom min :
GetScreen()->m_DrawOrg.x -= GetScreen()->m_DrawOrg.x % 256; screen->m_DrawOrg.x -= screen->m_DrawOrg.x % 256;
GetScreen()->m_DrawOrg.y -= GetScreen()->m_DrawOrg.y % 256; screen->m_DrawOrg.y -= screen->m_DrawOrg.y % 256;
// Calcul du nombre de scrolls (en unites de scrool ) // Calcul du nombre de scrolls (en unites de scrool )
scrollbar_number.x = draw_size.x / (DrawPanel->m_Scroll_unit * zoom); scrollbar_number.x = draw_size.x / (DrawPanel->m_Scroll_unit * zoom);
@ -808,10 +794,10 @@ void WinEDA_DrawFrame::AdjustScrollBars()
xUnit *= zoom; yUnit *= zoom; xUnit *= zoom; yUnit *= zoom;
// Calcul de la position, curseur place au centre d'ecran // Calcul de la position, curseur place au centre d'ecran
scrollbar_pos = GetScreen()->m_Curseur; scrollbar_pos = screen->m_Curseur;
scrollbar_pos.x -= GetScreen()->m_DrawOrg.x; scrollbar_pos.x -= screen->m_DrawOrg.x;
scrollbar_pos.y -= GetScreen()->m_DrawOrg.y; scrollbar_pos.y -= screen->m_DrawOrg.y;
scrollbar_pos.x -= panel_size.x / 2; scrollbar_pos.x -= panel_size.x / 2;
scrollbar_pos.y -= panel_size.y / 2; scrollbar_pos.y -= panel_size.y / 2;
@ -823,15 +809,15 @@ void WinEDA_DrawFrame::AdjustScrollBars()
scrollbar_pos.x /= xUnit; scrollbar_pos.x /= xUnit;
scrollbar_pos.y /= yUnit; scrollbar_pos.y /= yUnit;
GetScreen()->m_ScrollbarPos = scrollbar_pos; screen->m_ScrollbarPos = scrollbar_pos;
GetScreen()->m_ScrollbarNumber = scrollbar_number; screen->m_ScrollbarNumber = scrollbar_number;
DrawPanel->SetScrollbars( DrawPanel->m_Scroll_unit, DrawPanel->SetScrollbars( DrawPanel->m_Scroll_unit,
DrawPanel->m_Scroll_unit, DrawPanel->m_Scroll_unit,
GetScreen()->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.x,
GetScreen()->m_ScrollbarNumber.y, screen->m_ScrollbarNumber.y,
GetScreen()->m_ScrollbarPos.x, screen->m_ScrollbarPos.x,
GetScreen()->m_ScrollbarPos.y, TRUE ); screen->m_ScrollbarPos.y, TRUE );
} }
@ -885,24 +871,25 @@ void WinEDA_DrawFrame::Affiche_Status_Box()
{ {
wxString Line; wxString Line;
int dx, dy; int dx, dy;
BASE_SCREEN* screen = GetBaseScreen();
if( GetScreen() == NULL ) if( !screen )
return; return;
/* affichage Zoom et coordonnees absolues */ /* affichage Zoom et coordonnees absolues */
Line.Printf( wxT( "Z %d" ), GetScreen()->GetZoom() ); Line.Printf( wxT( "Z %d" ), screen->GetZoom() );
SetStatusText( Line, 1 ); SetStatusText( Line, 1 );
Line.Printf( g_UnitMetric ? wxT( "X %.3f Y %.3f" ) : wxT( "X %.4f Y %.4f" ), Line.Printf( g_UnitMetric ? wxT( "X %.3f Y %.3f" ) : wxT( "X %.4f Y %.4f" ),
To_User_Unit( g_UnitMetric, GetScreen()->m_Curseur.x, To_User_Unit( g_UnitMetric, screen->m_Curseur.x,
m_InternalUnits ), m_InternalUnits ),
To_User_Unit( g_UnitMetric, GetScreen()->m_Curseur.y, To_User_Unit( g_UnitMetric, screen->m_Curseur.y,
m_InternalUnits ) ); m_InternalUnits ) );
SetStatusText( Line, 2 ); SetStatusText( Line, 2 );
/* affichage des coordonnees relatives */ /* affichage des coordonnees relatives */
dx = GetScreen()->m_Curseur.x - GetScreen()->m_O_Curseur.x; dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
dy = GetScreen()->m_Curseur.y - GetScreen()->m_O_Curseur.y; dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
Line.Printf( g_UnitMetric ? wxT( "x %.3f y %.3f" ) : wxT( "x %.4f y %.4f" ), Line.Printf( g_UnitMetric ? wxT( "x %.3f y %.3f" ) : wxT( "x %.4f y %.4f" ),
To_User_Unit( g_UnitMetric, dx, m_InternalUnits ), To_User_Unit( g_UnitMetric, dx, m_InternalUnits ),

View File

@ -13,11 +13,19 @@
#include "macros.h" #include "macros.h"
#include "id.h" #include "id.h"
#ifdef PCBNEW
#include "pcbstruct.h"
#endif
#ifdef EESCHEMA
#include "program.h"
#endif
// Local defines // Local defines
#define CURSOR_SIZE 12 // Cursor size in pixels #define CURSOR_SIZE 12 // Cursor size in pixels
// Events used by WinEDA_DrawPanel // Events used by WinEDA_DrawPanel
BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving ) EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent ) EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent )
EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent ) EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent )
@ -38,16 +46,18 @@ END_EVENT_TABLE()
WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
const wxPoint& pos, const wxSize& size ) : const wxPoint& pos, const wxSize& size ) :
EDA_DRAW_PANEL( parent, id, pos, size, wxScrolledWindow( parent, id, pos, size,
wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE ) wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE )
{ {
m_Parent = parent; m_Parent = parent;
m_Ident = m_Parent->m_Ident; m_Ident = m_Parent->m_Ident;
m_Scroll_unit = 1; m_Scroll_unit = 1;
m_ScrollButt_unit = 40; m_ScrollButt_unit = 40;
SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red, SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red,
ColorRefs[g_DrawBgColor].m_Green, ColorRefs[g_DrawBgColor].m_Green,
ColorRefs[g_DrawBgColor].m_Blue ) ); ColorRefs[g_DrawBgColor].m_Blue ) );
EnableScrolling( TRUE, TRUE ); EnableScrolling( TRUE, TRUE );
m_ClipBox.SetSize( size ); m_ClipBox.SetSize( size );
m_ClipBox.SetX( 0 ); m_ClipBox.SetX( 0 );
@ -62,6 +72,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
if( m_Parent->m_Parent->m_EDA_Config ) if( m_Parent->m_Parent->m_EDA_Config )
m_AutoPAN_Enable = m_Parent->m_Parent->m_EDA_Config->Read( wxT( "AutoPAN" ), TRUE ); m_AutoPAN_Enable = m_Parent->m_Parent->m_EDA_Config->Read( wxT( "AutoPAN" ), TRUE );
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = FALSE;
m_Block_Enable = FALSE; m_Block_Enable = FALSE;
m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW; m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW;
@ -69,6 +80,16 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
} }
BASE_SCREEN* WinEDA_DrawPanel::GetScreen()
{
WinEDA_DrawFrame* parentFrame = m_Parent;
wxASSERT( parentFrame );
return parentFrame->GetBaseScreen();
}
/*********************************************************************************/ /*********************************************************************************/
void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color ) void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
/*********************************************************************************/ /*********************************************************************************/

View File

@ -116,11 +116,12 @@ WinEDA_SetPageFrame::WinEDA_SetPageFrame( WinEDA_DrawFrame* parent, wxWindowID i
wxString msg; wxString msg;
m_ParentDrawFrame = parent; m_ParentDrawFrame = parent;
m_Screen = m_ParentDrawFrame->GetScreen(); m_Screen = m_ParentDrawFrame->GetBaseScreen();
m_Modified = FALSE; m_Modified = FALSE;
m_SelectedSheet = NULL; m_SelectedSheet = NULL;
m_CurrentSelection = 0; m_CurrentSelection = 0;
SearchPageSizeSelection(); SearchPageSizeSelection();
Create( parent, id, caption, pos, size, style); Create( parent, id, caption, pos, size, style);
// Init display value for sheet User size // Init display value for sheet User size
wxString format = m_TextSheetCount->GetLabel(); wxString format = m_TextSheetCount->GetLabel();
@ -129,6 +130,7 @@ WinEDA_SetPageFrame::WinEDA_SetPageFrame( WinEDA_DrawFrame* parent, wxWindowID i
format = m_TextSheetNumber->GetLabel(); format = m_TextSheetNumber->GetLabel();
msg.Printf(format, m_Screen->m_ScreenNumber); msg.Printf(format, m_Screen->m_ScreenNumber);
m_TextSheetNumber->SetLabel(msg); m_TextSheetNumber->SetLabel(msg);
if( g_UnitMetric ) if( g_UnitMetric )
{ {
UserSizeX = (double)g_Sheet_user.m_Size.x * 25.4 / 1000; UserSizeX = (double)g_Sheet_user.m_Size.x * 25.4 / 1000;
@ -638,7 +640,7 @@ void WinEDA_SetPageFrame::SearchPageSizeSelection()
for( ii = 0; ii < NB_ITEMS; ii++ ) for( ii = 0; ii < NB_ITEMS; ii++ )
{ {
sheet = SheetList[ii]; sheet = SheetList[ii];
if( m_ParentDrawFrame->GetScreen()->m_CurrentSheetDesc == sheet ) if( m_ParentDrawFrame->GetBaseScreen()->m_CurrentSheetDesc == sheet )
m_CurrentSelection = ii; m_CurrentSelection = ii;
} }
} }

View File

@ -350,7 +350,7 @@ wxString WinEDA_PrintSVGFrame::ReturnFullFileName()
{ {
wxString name, ext; wxString name, ext;
name = m_Parent->GetScreen()->m_FileName; name = m_Parent->GetBaseScreen()->m_FileName;
ChangeFileNameExt( name, wxT( ".svg" ) ); ChangeFileNameExt( name, wxT( ".svg" ) );
return name; return name;
} }
@ -396,7 +396,7 @@ void WinEDA_PrintSVGFrame::PrintSVGDoc( wxCommandEvent& event )
SetPenWidth(); SetPenWidth();
BASE_SCREEN* screen = m_Parent->GetScreen(); BASE_SCREEN* screen = m_Parent->GetBaseScreen();
BASE_SCREEN* oldscreen = screen; BASE_SCREEN* oldscreen = screen;
#ifndef EESCHEMA #ifndef EESCHEMA
if( Select_PrintAll ) if( Select_PrintAll )

View File

@ -305,7 +305,7 @@ wxString WinEDA_PrintFrame::BuildPrintTitle()
{ {
wxString name, ext; wxString name, ext;
wxFileName::SplitPath( m_Parent->GetScreen()->m_FileName, wxFileName::SplitPath( m_Parent->GetBaseScreen()->m_FileName,
(wxString*) NULL, &name, &ext ); (wxString*) NULL, &name, &ext );
name += wxT( "-" ) + ext; name += wxT( "-" ) + ext;
return name; return name;
@ -486,7 +486,7 @@ bool EDA_Printout::OnPrintPage( int page )
#ifdef EESCHEMA #ifdef EESCHEMA
BASE_SCREEN* screen = m_Parent->GetScreen(); BASE_SCREEN* screen = m_Parent->GetBaseScreen();
BASE_SCREEN* oldscreen = screen; BASE_SCREEN* oldscreen = screen;
if( s_OptionPrintPage == 1 ) if( s_OptionPrintPage == 1 )

View File

@ -46,7 +46,7 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse )
* Note: Mac OS ** does not ** allow moving mouse cursor by program. * Note: Mac OS ** does not ** allow moving mouse cursor by program.
*/ */
{ {
PutOnGrid( &(GetScreen()->m_Curseur) ); PutOnGrid( &(GetBaseScreen()->m_Curseur) );
AdjustScrollBars(); AdjustScrollBars();
@ -69,9 +69,9 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
{ {
double ftmp; double ftmp;
if( !GetScreen()->m_UserGridIsON ) if( !GetBaseScreen()->m_UserGridIsON )
{ {
wxSize grid_size = GetScreen()->GetGrid(); wxSize grid_size = GetBaseScreen()->GetGrid();
ftmp = (double) coord->x / grid_size.x; ftmp = (double) coord->x / grid_size.x;
coord->x = ( (int) round( ftmp ) ) * grid_size.x; coord->x = ( (int) round( ftmp ) ) * grid_size.x;
@ -81,10 +81,10 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
} }
else else
{ {
double pasx = GetScreen()->m_UserGrid.x * m_InternalUnits; double pasx = GetBaseScreen()->m_UserGrid.x * m_InternalUnits;
double pasy = GetScreen()->m_UserGrid.y * m_InternalUnits; double pasy = GetBaseScreen()->m_UserGrid.y * m_InternalUnits;
if( GetScreen()->m_UserGridUnit != INCHES ) if( GetBaseScreen()->m_UserGridUnit != INCHES )
{ {
pasx /= 25.4; pasx /= 25.4;
pasy /= 25.4; pasy /= 25.4;
@ -109,7 +109,7 @@ void WinEDA_DrawFrame::Zoom_Automatique( bool move_mouse_cursor )
int bestzoom; int bestzoom;
bestzoom = BestZoom(); bestzoom = BestZoom();
GetScreen()->SetZoom( bestzoom ); GetBaseScreen()->SetZoom( bestzoom );
Recadre_Trace( move_mouse_cursor ); Recadre_Trace( move_mouse_cursor );
} }
@ -137,9 +137,9 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect )
if( bestzoom <= 0 ) if( bestzoom <= 0 )
bestzoom = 1; bestzoom = 1;
GetScreen()->SetZoom( bestzoom ); GetBaseScreen()->SetZoom( bestzoom );
GetScreen()->m_Curseur = Rect.Centre(); GetBaseScreen()->m_Curseur = Rect.Centre();
Recadre_Trace( TRUE ); Recadre_Trace( TRUE );
} }
@ -171,127 +171,127 @@ void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent& event )
break; break;
case ID_POPUP_ZOOM_LEVEL_1: case ID_POPUP_ZOOM_LEVEL_1:
m_Parent->GetScreen()->SetZoom( 1 ); GetScreen()->SetZoom( 1 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_ZOOM_LEVEL_2: case ID_POPUP_ZOOM_LEVEL_2:
m_Parent->GetScreen()->SetZoom( 2 ); GetScreen()->SetZoom( 2 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_ZOOM_LEVEL_4: case ID_POPUP_ZOOM_LEVEL_4:
m_Parent->GetScreen()->SetZoom( 4 ); GetScreen()->SetZoom( 4 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_ZOOM_LEVEL_8: case ID_POPUP_ZOOM_LEVEL_8:
m_Parent->GetScreen()->SetZoom( 8 ); GetScreen()->SetZoom( 8 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_ZOOM_LEVEL_16: case ID_POPUP_ZOOM_LEVEL_16:
m_Parent->GetScreen()->SetZoom( 16 ); GetScreen()->SetZoom( 16 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_ZOOM_LEVEL_32: case ID_POPUP_ZOOM_LEVEL_32:
m_Parent->GetScreen()->SetZoom( 32 ); GetScreen()->SetZoom( 32 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_ZOOM_LEVEL_64: case ID_POPUP_ZOOM_LEVEL_64:
m_Parent->GetScreen()->SetZoom( 64 ); GetScreen()->SetZoom( 64 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_ZOOM_LEVEL_128: case ID_POPUP_ZOOM_LEVEL_128:
m_Parent->GetScreen()->SetZoom( 128 ); GetScreen()->SetZoom( 128 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_ZOOM_LEVEL_256: case ID_POPUP_ZOOM_LEVEL_256:
m_Parent->GetScreen()->SetZoom( 256 ); GetScreen()->SetZoom( 256 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_ZOOM_LEVEL_512: case ID_POPUP_ZOOM_LEVEL_512:
m_Parent->GetScreen()->SetZoom( 512 ); GetScreen()->SetZoom( 512 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_ZOOM_LEVEL_1024: case ID_POPUP_ZOOM_LEVEL_1024:
m_Parent->GetScreen()->SetZoom( 1024 ); GetScreen()->SetZoom( 1024 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_ZOOM_LEVEL_2048: case ID_POPUP_ZOOM_LEVEL_2048:
m_Parent->GetScreen()->SetZoom( 2048 ); GetScreen()->SetZoom( 2048 );
m_Parent->Recadre_Trace( TRUE ); m_Parent->Recadre_Trace( TRUE );
break; break;
case ID_POPUP_GRID_LEVEL_1: case ID_POPUP_GRID_LEVEL_1:
m_Parent->GetScreen()->SetGrid( wxSize( 1, 1 ) ); GetScreen()->SetGrid( wxSize( 1, 1 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_LEVEL_2: case ID_POPUP_GRID_LEVEL_2:
m_Parent->GetScreen()->SetGrid( wxSize( 2, 2 ) ); GetScreen()->SetGrid( wxSize( 2, 2 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_LEVEL_5: case ID_POPUP_GRID_LEVEL_5:
m_Parent->GetScreen()->SetGrid( wxSize( 5, 5 ) ); GetScreen()->SetGrid( wxSize( 5, 5 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_LEVEL_10: case ID_POPUP_GRID_LEVEL_10:
m_Parent->GetScreen()->SetGrid( wxSize( 10, 10 ) ); GetScreen()->SetGrid( wxSize( 10, 10 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_LEVEL_20: case ID_POPUP_GRID_LEVEL_20:
m_Parent->GetScreen()->SetGrid( wxSize( 20, 20 ) ); GetScreen()->SetGrid( wxSize( 20, 20 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_LEVEL_25: case ID_POPUP_GRID_LEVEL_25:
m_Parent->GetScreen()->SetGrid( wxSize( 25, 25 ) ); GetScreen()->SetGrid( wxSize( 25, 25 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_LEVEL_50: case ID_POPUP_GRID_LEVEL_50:
m_Parent->GetScreen()->SetGrid( wxSize( 50, 50 ) ); GetScreen()->SetGrid( wxSize( 50, 50 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_LEVEL_100: case ID_POPUP_GRID_LEVEL_100:
m_Parent->GetScreen()->SetGrid( wxSize( 100, 100 ) ); GetScreen()->SetGrid( wxSize( 100, 100 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_LEVEL_200: case ID_POPUP_GRID_LEVEL_200:
m_Parent->GetScreen()->SetGrid( wxSize( 200, 200 ) ); GetScreen()->SetGrid( wxSize( 200, 200 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_LEVEL_250: case ID_POPUP_GRID_LEVEL_250:
m_Parent->GetScreen()->SetGrid( wxSize( 250, 250 ) ); GetScreen()->SetGrid( wxSize( 250, 250 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_LEVEL_500: case ID_POPUP_GRID_LEVEL_500:
m_Parent->GetScreen()->SetGrid( wxSize( 500, 500 ) ); GetScreen()->SetGrid( wxSize( 500, 500 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_LEVEL_1000: case ID_POPUP_GRID_LEVEL_1000:
m_Parent->GetScreen()->SetGrid( wxSize( 1000, 1000 ) ); GetScreen()->SetGrid( wxSize( 1000, 1000 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
case ID_POPUP_GRID_USER: case ID_POPUP_GRID_USER:
m_Parent->GetScreen()->SetGrid( wxSize( -1, -1 ) ); GetScreen()->SetGrid( wxSize( -1, -1 ) );
m_Parent->ReDrawPanel(); m_Parent->ReDrawPanel();
break; break;
@ -369,7 +369,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_REDRAW, _( "Redraw" ), repaint_xpm ); ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_REDRAW, _( "Redraw" ), repaint_xpm );
/* Create the basic zoom list: */ /* Create the basic zoom list: */
zoom = m_Parent->GetScreen()->GetZoom(); zoom = GetScreen()->GetZoom();
zoom_value = 1; zoom_value = 1;
for( ii = 0; zoom_value <= m_Parent->m_ZoomMaxValue; zoom_value <<= 1, ii++ ) // Create zoom choice 1 .. zoom max for( ii = 0; zoom_value <= m_Parent->m_ZoomMaxValue; zoom_value <<= 1, ii++ ) // Create zoom choice 1 .. zoom max
{ {
@ -384,7 +384,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, grid_choice, ADD_MENUITEM_WITH_SUBMENU( MasterMenu, grid_choice,
ID_POPUP_GRID_SELECT, _( "Grid Select" ), grid_select_xpm ); ID_POPUP_GRID_SELECT, _( "Grid Select" ), grid_select_xpm );
grid = m_Parent->GetScreen()->GetGrid(); grid = GetScreen()->GetGrid();
// Create grid list // Create grid list
switch( m_Parent->m_Ident ) switch( m_Parent->m_Ident )
@ -409,7 +409,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
grid_choice->Append( grid_list_pcb[ii].m_Id, msg, wxEmptyString, TRUE ); grid_choice->Append( grid_list_pcb[ii].m_Id, msg, wxEmptyString, TRUE );
if( grid_list_pcb[ii].m_Value <= 0 ) if( grid_list_pcb[ii].m_Value <= 0 )
{ {
if( m_Parent->GetScreen()->m_UserGridIsON ) if( GetScreen()->m_UserGridIsON )
grid_choice->Check( grid_list_pcb[ii].m_Id, TRUE ); grid_choice->Check( grid_list_pcb[ii].m_Id, TRUE );
break; break;
} }