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,16 +5,31 @@ 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>

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

@ -1,7 +1,7 @@
/***********************************************************/ /***********************************************************/
/* wxstruct.h: */ /* wxstruct.h: */
/* descriptions des principales classes derivees utilisees */ /* descriptions des principales classes derivees utilisees */
/***********************************************************/ /***********************************************************/
#ifndef CVSTRUCT_H #ifndef CVSTRUCT_H
#define CVSTRUCT_H #define CVSTRUCT_H
@ -21,191 +21,191 @@ class STORECMP;
#define LIST_BOX_TYPE wxListView #define LIST_BOX_TYPE wxListView
/******************************************************/ /******************************************************/
/* classe derivee pour la Fenetre principale de cvpcb */ /* classe derivee pour la Fenetre principale de cvpcb */
/******************************************************/ /******************************************************/
class WinEDA_CvpcbFrame: public WinEDA_BasicFrame class WinEDA_CvpcbFrame : public WinEDA_BasicFrame
{ {
public: public:
FootprintListBox * m_FootprintList; FootprintListBox* m_FootprintList;
ListBoxCmp * m_ListCmp; ListBoxCmp* m_ListCmp;
WinEDA_DisplayFrame * DrawFrame; WinEDA_DisplayFrame* DrawFrame;
WinEDA_Toolbar * m_HToolBar; // Toolbar horizontal haut d'ecran WinEDA_Toolbar* m_HToolBar; // Toolbar horizontal haut d'ecran
private: private:
wxMenu * m_FilesMenu; wxMenu* m_FilesMenu;
// Constructor and destructor // Constructor and destructor
public: public:
WinEDA_CvpcbFrame(WinEDA_App * parent, const wxString & title, WinEDA_CvpcbFrame( WinEDA_App * parent, const wxString &title,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_CvpcbFrame(); ~WinEDA_CvpcbFrame();
void OnLeftClick(wxListEvent & event); void OnLeftClick( wxListEvent& event );
void OnLeftDClick(wxListEvent & event); void OnLeftDClick( wxListEvent& event );
void OnSelectComponent(wxListEvent & event); void OnSelectComponent( wxListEvent& event );
void Update_Config(wxCommandEvent& event);/* enregistrement de la config */ void Update_Config( wxCommandEvent& event ); /* enregistrement de la config */
void OnQuit(wxCommandEvent& event); void OnQuit( wxCommandEvent& event );
void OnCloseWindow(wxCloseEvent & Event); void OnCloseWindow( wxCloseEvent& Event );
void OnSize(wxSizeEvent& SizeEvent); void OnSize( wxSizeEvent& SizeEvent );
void OnChar(wxKeyEvent& event); void OnChar( wxKeyEvent& event );
void ReCreateHToolbar(); void ReCreateHToolbar();
virtual void ReCreateMenuBar(); virtual void ReCreateMenuBar();
void SetLanguage(wxCommandEvent& event); void SetLanguage( wxCommandEvent& event );
void AddFontSelectionMenu(wxMenu * main_menu); void AddFontSelectionMenu( wxMenu* main_menu );
void ProcessFontPreferences(wxCommandEvent& event); void ProcessFontPreferences( wxCommandEvent& event );
void ToFirstNA(wxCommandEvent& event); void ToFirstNA( wxCommandEvent& event );
void ToPreviousNA(wxCommandEvent& event); void ToPreviousNA( wxCommandEvent& event );
void DelAssociations(wxCommandEvent& event); void DelAssociations( wxCommandEvent& event );
void SaveQuitCvpcb(wxCommandEvent& event); void SaveQuitCvpcb( wxCommandEvent& event );
void LoadNetList(wxCommandEvent& event); void LoadNetList( wxCommandEvent& event );
void ConfigCvpcb(wxCommandEvent& event); void ConfigCvpcb( wxCommandEvent& event );
void DisplayModule(wxCommandEvent& event); void DisplayModule( wxCommandEvent& event );
void AssocieModule(wxCommandEvent& event); void AssocieModule( wxCommandEvent& event );
void WriteStuffList(wxCommandEvent & event); void WriteStuffList( wxCommandEvent& event );
void DisplayDocFile(wxCommandEvent & event); void DisplayDocFile( wxCommandEvent& event );
void OnSelectFilteringFootprint(wxCommandEvent & event); void OnSelectFilteringFootprint( wxCommandEvent& event );
void SetNewPkg(const wxString & package); void SetNewPkg( const wxString& package );
void BuildCmpListBox(); void BuildCmpListBox();
void BuildFootprintListBox(); void BuildFootprintListBox();
void CreateScreenCmp(); void CreateScreenCmp();
void CreateConfigWindow(); void CreateConfigWindow();
int SaveNetList(const wxString & FullFileName); int SaveNetList( const wxString& FullFileName );
int SaveComponentList(const wxString & FullFileName); int SaveComponentList( const wxString& FullFileName );
bool ReadInputNetList(const wxString & FullFileName); bool ReadInputNetList( const wxString& FullFileName );
void ReadNetListe(); void ReadNetListe();
int rdpcad(); int rdpcad();
int ReadSchematicNetlist(); int ReadSchematicNetlist();
int ReadFootprintFilterList( FILE * f); int ReadFootprintFilterList( FILE* f );
int ReadViewlogicWirList(); int ReadViewlogicWirList();
int ReadViewlogicNetList(); int ReadViewlogicNetList();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
/***********************************************/ /***********************************************/
/* ListBox derivee pour l'affichage des listes */ /* ListBox derivee pour l'affichage des listes */
/***********************************************/ /***********************************************/
class ListBoxBase: public LIST_BOX_TYPE class ListBoxBase : public LIST_BOX_TYPE
{ {
public: public:
WinEDA_CvpcbFrame * m_Parent; WinEDA_CvpcbFrame* m_Parent;
public: public:
ListBoxBase(WinEDA_CvpcbFrame * parent, wxWindowID id, ListBoxBase( WinEDA_CvpcbFrame * parent, wxWindowID id,
const wxPoint& loc, const wxSize& size); const wxPoint &loc, const wxSize &size );
~ListBoxBase(); ~ListBoxBase();
int GetSelection(); int GetSelection();
void OnSize(wxSizeEvent& event); void OnSize( wxSizeEvent& event );
}; };
/************************************************************/ /************************************************************/
/* ListBox derivee pour l'affichage de la liste des Modules */ /* ListBox derivee pour l'affichage de la liste des Modules */
/************************************************************/ /************************************************************/
class FootprintListBox: public ListBoxBase class FootprintListBox : public ListBoxBase
{ {
private: private:
wxArrayString m_FullFootprintList; wxArrayString m_FullFootprintList;
wxArrayString m_FilteredFootprintList; wxArrayString m_FilteredFootprintList;
public: public:
wxArrayString * m_ActiveFootprintList; wxArrayString* m_ActiveFootprintList;
bool m_UseFootprintFullList; bool m_UseFootprintFullList;
public: public:
FootprintListBox(WinEDA_CvpcbFrame * parent, FootprintListBox( WinEDA_CvpcbFrame * parent,
wxWindowID id, const wxPoint& loc, const wxSize& size, wxWindowID id, const wxPoint &loc, const wxSize &size,
int nbitems, wxString choice[]); int nbitems, wxString choice[] );
~FootprintListBox(); ~FootprintListBox();
int GetCount(); int GetCount();
void SetSelection(unsigned index, bool State = TRUE); void SetSelection( unsigned index, bool State = TRUE );
void SetString(unsigned linecount, const wxString & text); void SetString( unsigned linecount, const wxString& text );
void AppendLine(const wxString & text); void AppendLine( const wxString& text );
void SetFootprintFullList(); void SetFootprintFullList();
void SetFootprintFilteredList(STORECMP * Component); void SetFootprintFilteredList( STORECMP* Component );
void SetActiveFootprintList(bool FullList, bool Redraw = FALSE); void SetActiveFootprintList( bool FullList, bool Redraw = FALSE );
wxString GetSelectedFootprint(); wxString GetSelectedFootprint();
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()
}; };
/***************************************************************/ /***************************************************************/
/* ListBox derivee pour l'affichage de la liste des Composants */ /* ListBox derivee pour l'affichage de la liste des Composants */
/***************************************************************/ /***************************************************************/
class ListBoxCmp: public ListBoxBase class ListBoxCmp : public ListBoxBase
{ {
public: public:
wxArrayString m_ComponentList; wxArrayString m_ComponentList;
WinEDA_CvpcbFrame * m_Parent; WinEDA_CvpcbFrame* m_Parent;
public: public:
ListBoxCmp(WinEDA_CvpcbFrame * parent, wxWindowID id, ListBoxCmp( WinEDA_CvpcbFrame * parent, wxWindowID id,
const wxPoint& loc, const wxSize& size, const wxPoint &loc, const wxSize &size,
int nbitems, wxString choice[]); int nbitems, wxString choice[] );
~ListBoxCmp(); ~ListBoxCmp();
void Clear(); void Clear();
int GetCount(); int GetCount();
wxString OnGetItemText(long item, long column) const; wxString OnGetItemText( long item, long column ) const;
void SetSelection(unsigned index, bool State = TRUE); void SetSelection( unsigned index, bool State = TRUE );
void SetString(unsigned linecount, const wxString & text); void SetString( unsigned linecount, const wxString& text );
void AppendLine(const wxString & text); void AppendLine( const wxString& text );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
/*******************************************************/ /*******************************************************/
/* class WWinEDA_DisplayFrame: public WinEDA_DrawFrame */ /* class WWinEDA_DisplayFrame: public WinEDA_DrawFrame */
/*******************************************************/ /*******************************************************/
class WinEDA_DisplayFrame: public WinEDA_BasePcbFrame class WinEDA_DisplayFrame : public WinEDA_BasePcbFrame
{ {
public: public:
public: public:
WinEDA_DisplayFrame( wxWindow * father, WinEDA_App *parent, WinEDA_DisplayFrame( wxWindow * father, WinEDA_App * parent,
const wxString & title, const wxString &title,
const wxPoint& pos, const wxSize& size, const wxPoint &pos, const wxSize &size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_DisplayFrame(); ~WinEDA_DisplayFrame();
void OnCloseWindow(wxCloseEvent & Event); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions(wxCommandEvent& event); void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow(wxDC * DC, bool EraseBg); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
void RecreateMenuBar(); void RecreateMenuBar();
void OnLeftClick(wxDC * DC, const wxPoint& MousePos); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick(wxDC * DC, const wxPoint& MousePos); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars(); void SetToolbars();
void GeneralControle( wxDC* DC, wxPoint Mouse ); void GeneralControle( wxDC* DC, wxPoint Mouse );
void InstallOptionsDisplay(wxCommandEvent& event); void InstallOptionsDisplay( wxCommandEvent& event );
MODULE * Get_Module(const wxString & CmpName); MODULE* Get_Module( const wxString& CmpName );
void Process_Settings(wxCommandEvent& event); void Process_Settings( wxCommandEvent& event );
void Show3D_Frame(wxCommandEvent& event); void Show3D_Frame( wxCommandEvent& event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#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();
@ -136,13 +136,13 @@ public:
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
SCH_COMPONENT* GenCopy(); SCH_COMPONENT* GenCopy();
void SetRotationMiroir( int type ); void SetRotationMiroir( int type );
int GetRotationMiroir(); int GetRotationMiroir();
wxPoint GetScreenCoord( const wxPoint& coord ); wxPoint GetScreenCoord( const wxPoint& coord );
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame );
void ClearAnnotation(); void ClearAnnotation();
EDA_Rect GetBoundaryBox() const; EDA_Rect GetBoundaryBox() const;
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
const wxString& ReturnFieldName( int aFieldNdx ) const; const wxString& ReturnFieldName( int aFieldNdx ) const;
@ -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,14 +217,14 @@ 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;
curpos = screen->m_MousePosition; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur; oldpos = screen->m_Curseur;
@ -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
@ -11,7 +12,7 @@
// Generated by DialogBlocks (unregistered), 31/01/2006 13:27:33 // Generated by DialogBlocks (unregistered), 31/01/2006 13:27:33
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
#pragma implementation "dialog_options.h" #pragma implementation "dialog_options.h"
#endif #endif
@ -47,14 +48,14 @@
////@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();
} }
@ -71,9 +72,9 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_SetOptionsFrame, wxDialog )
BEGIN_EVENT_TABLE( WinEDA_SetOptionsFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SetOptionsFrame, wxDialog )
////@begin WinEDA_SetOptionsFrame event table entries ////@begin WinEDA_SetOptionsFrame event table entries
EVT_BUTTON( wxID_OK, WinEDA_SetOptionsFrame::OnOkClick ) EVT_BUTTON( wxID_OK, WinEDA_SetOptionsFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_SetOptionsFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_SetOptionsFrame::OnCancelClick )
////@end WinEDA_SetOptionsFrame event table entries ////@end WinEDA_SetOptionsFrame event table entries
@ -83,236 +84,336 @@ END_EVENT_TABLE()
* WinEDA_SetOptionsFrame constructors * WinEDA_SetOptionsFrame constructors
*/ */
WinEDA_SetOptionsFrame::WinEDA_SetOptionsFrame( ) 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 );
/* Init options */ BASE_SCREEN* screen = m_Parent->GetBaseScreen();
if ( m_Parent->GetScreen() )
{
switch( m_Parent->GetScreen()->GetGrid().x )
{
case 50:
m_SelGridSize->SetSelection(0);
break;
case 25: /* Init options */
m_SelGridSize->SetSelection(1); if( screen )
break; {
switch( screen->GetGrid().x )
{
case 50:
m_SelGridSize->SetSelection( 0 );
break;
case 10: case 25:
m_SelGridSize->SetSelection(2); m_SelGridSize->SetSelection( 1 );
break; break;
case 5: case 10:
m_SelGridSize->SetSelection(3); m_SelGridSize->SetSelection( 2 );
break; break;
case 2: case 5:
m_SelGridSize->SetSelection(4); m_SelGridSize->SetSelection( 3 );
break; break;
case 1: case 2:
m_SelGridSize->SetSelection(5); m_SelGridSize->SetSelection( 4 );
break; break;
default: case 1:
DisplayError(this, wxT("WinEDA_SetOptionsFrame: Grid value not handle")); m_SelGridSize->SetSelection( 5 );
break; break;
}
}
/* Adjust the current selections and options: */ default:
m_ShowGridOpt->SetValue(m_Parent->m_Draw_Grid); DisplayError( this, wxT( "WinEDA_SetOptionsFrame: Grid value not handle" ) );
m_AutoPANOpt->SetValue(m_Parent->DrawPanel-> m_AutoPAN_Enable); break;
m_SelShowPins->SetSelection( g_ShowAllPins ? TRUE : FALSE); }
m_Selunits->SetSelection( g_UnitMetric ? 0 : 1); }
m_SelDirWires->SetSelection( g_HVLines ? 0 : 1);
m_Show_Page_Limits->SetSelection( g_ShowPageLimits ? 0 : 1); /* Adjust the current selections and options: */
wxString msg; m_ShowGridOpt->SetValue( m_Parent->m_Draw_Grid );
msg = ReturnStringFromValue( g_UnitMetric,g_RepeatStep.x, m_Parent->m_InternalUnits); m_AutoPANOpt->SetValue( m_Parent->DrawPanel->m_AutoPAN_Enable );
m_DeltaStepCtrl_X->SetValue( msg ); m_SelShowPins->SetSelection( g_ShowAllPins ? TRUE : FALSE );
wxString title = _("Delta Step X") + ReturnUnitSymbol(g_UnitMetric); m_Selunits->SetSelection( g_UnitMetric ? 0 : 1 );
m_SelDirWires->SetSelection( g_HVLines ? 0 : 1 );
m_Show_Page_Limits->SetSelection( g_ShowPageLimits ? 0 : 1 );
wxString msg;
msg = ReturnStringFromValue( g_UnitMetric, g_RepeatStep.x, m_Parent->m_InternalUnits );
m_DeltaStepCtrl_X->SetValue( msg );
wxString title = _( "Delta Step X" ) + ReturnUnitSymbol( g_UnitMetric );
m_DeltaStepXTitle->SetLabel( title ); m_DeltaStepXTitle->SetLabel( title );
msg = ReturnStringFromValue( g_UnitMetric,g_RepeatStep.y, m_Parent->m_InternalUnits); msg = ReturnStringFromValue( g_UnitMetric, g_RepeatStep.y, m_Parent->m_InternalUnits );
m_DeltaStepCtrl_Y->SetValue( msg ); m_DeltaStepCtrl_Y->SetValue( msg );
title = _("Delta Step Y") + ReturnUnitSymbol(g_UnitMetric); title = _( "Delta Step Y" ) + 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;
m_ShowGridOpt = NULL; m_ShowGridOpt = NULL;
m_SelGridSize = NULL; m_SelGridSize = NULL;
m_SelShowPins = NULL; m_SelShowPins = NULL;
m_AutoPANOpt = NULL; m_AutoPANOpt = NULL;
m_Selunits = NULL; m_Selunits = NULL;
m_LabelSizeCtrlSizer = NULL; m_LabelSizeCtrlSizer = NULL;
m_SelDirWires = NULL; m_SelDirWires = NULL;
m_Show_Page_Limits = NULL; m_Show_Page_Limits = NULL;
m_DeltaStepXTitle = NULL; m_DeltaStepXTitle = NULL;
m_DeltaStepCtrl_X = NULL; m_DeltaStepCtrl_X = NULL;
m_DeltaStepYTitle = NULL; m_DeltaStepYTitle = NULL;
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
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style ); wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls(); CreateControls();
if (GetSizer()) if( GetSizer() )
{ {
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
*/ */
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);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); itemDialog1->SetSizer( itemBoxSizer2 );
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Draw Options:")); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxVERTICAL );
m_DrawOptionsSizer = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL);
itemBoxSizer3->Add(m_DrawOptionsSizer, 0, wxGROW|wxALL, 5);
m_ShowGridOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Show grid"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
m_ShowGridOpt->SetValue(false);
m_DrawOptionsSizer->Add(m_ShowGridOpt, 0, wxALIGN_LEFT|wxALL, 5); wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox( itemDialog1, wxID_ANY, _(
"Draw Options:" ) );
m_DrawOptionsSizer = new wxStaticBoxSizer( itemStaticBoxSizer4Static,
wxVERTICAL );
itemBoxSizer3->Add( m_DrawOptionsSizer, 0, wxGROW | wxALL, 5 );
m_ShowGridOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _(
"Show grid" ),
wxDefaultPosition, wxDefaultSize,
wxCHK_2STATE );
m_ShowGridOpt->SetValue( false );
m_DrawOptionsSizer->Add( m_ShowGridOpt, 0, wxALIGN_LEFT | wxALL, 5 );
wxString m_SelGridSizeStrings[] = { wxString m_SelGridSizeStrings[] = {
_("Normal (50 mils)"), _( "Normal (50 mils)" ),
_("Small (25 mils)"), _( "Small (25 mils)" ),
_("Very small (10 mils)"), _( "Very small (10 mils)" ),
_("Special (5 mils)"), _( "Special (5 mils)" ),
_("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, _(
m_SelGridSize->SetSelection(0); "Grid Size" ), wxDefaultPosition, wxDefaultSize, 6,
itemBoxSizer3->Add(m_SelGridSize, 0, wxGROW|wxALL, 5); m_SelGridSizeStrings, 1, wxRA_SPECIFY_COLS );
m_SelGridSize->SetSelection( 0 );
itemBoxSizer3->Add( m_SelGridSize, 0, wxGROW | wxALL, 5 );
wxString m_SelShowPinsStrings[] = { wxString m_SelShowPinsStrings[] = {
_("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, _(
m_SelShowPins->SetSelection(0); "Show pins" ), wxDefaultPosition,
itemBoxSizer3->Add(m_SelShowPins, 0, wxGROW|wxALL, 5); wxDefaultSize, 2, m_SelShowPinsStrings, 1,
wxRA_SPECIFY_COLS );
wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL); m_SelShowPins->SetSelection( 0 );
itemBoxSizer2->Add(itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer3->Add( m_SelShowPins, 0, wxGROW | wxALL, 5 );
m_AutoPANOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Auto PAN"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); wxBoxSizer* itemBoxSizer8 = new wxBoxSizer( wxVERTICAL );
m_AutoPANOpt->SetValue(false);
m_AutoPANOpt->SetForegroundColour(wxColour(0, 0, 255)); itemBoxSizer2->Add( itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
itemBoxSizer8->Add(m_AutoPANOpt, 0, wxGROW|wxALL, 5);
m_AutoPANOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX, _(
"Auto PAN" ), wxDefaultPosition, wxDefaultSize,
wxCHK_2STATE );
m_AutoPANOpt->SetValue( false );
m_AutoPANOpt->SetForegroundColour( wxColour( 0, 0, 255 ) );
itemBoxSizer8->Add( m_AutoPANOpt, 0, wxGROW | wxALL, 5 );
wxString m_SelunitsStrings[] = { wxString m_SelunitsStrings[] = {
_("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, _(
m_Selunits->SetSelection(0); "Units" ), wxDefaultPosition, wxDefaultSize, 2,
itemBoxSizer8->Add(m_Selunits, 0, wxGROW|wxALL, 5); m_SelunitsStrings, 1, wxRA_SPECIFY_COLS );
m_LabelSizeCtrlSizer = new wxBoxSizer(wxVERTICAL); m_Selunits->SetSelection( 0 );
itemBoxSizer8->Add(m_LabelSizeCtrlSizer, 0, wxGROW|wxALL, 5); itemBoxSizer8->Add( m_Selunits, 0, wxGROW | wxALL, 5 );
m_LabelSizeCtrlSizer = new wxBoxSizer( wxVERTICAL );
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, _(
m_SelDirWires->SetSelection(0); "Wires - Bus orient" ), wxDefaultPosition, wxDefaultSize,
itemBoxSizer8->Add(m_SelDirWires, 0, wxGROW|wxALL, 5); 2, m_SelDirWiresStrings, 1,
wxRA_SPECIFY_COLS );
m_SelDirWires->SetSelection( 0 );
itemBoxSizer8->Add( m_SelDirWires, 0, wxGROW | wxALL, 5 );
wxString m_Show_Page_LimitsStrings[] = { wxString m_Show_Page_LimitsStrings[] = {
_("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, _(
m_Show_Page_Limits->SetSelection(0); "Show page limits" ), wxDefaultPosition,
itemBoxSizer8->Add(m_Show_Page_Limits, 0, wxGROW|wxALL, 5); wxDefaultSize, 2, m_Show_Page_LimitsStrings, 1,
wxRA_SPECIFY_COLS );
wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxVERTICAL); m_Show_Page_Limits->SetSelection( 0 );
itemBoxSizer2->Add(itemBoxSizer14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer8->Add( m_Show_Page_Limits, 0, wxGROW | wxALL, 5 );
wxButton* itemButton15 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); wxBoxSizer* itemBoxSizer14 = new wxBoxSizer( wxVERTICAL );
itemButton15->SetForegroundColour(wxColour(202, 0, 0));
itemBoxSizer14->Add(itemButton15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxButton* itemButton16 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer2->Add( itemBoxSizer14, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
itemButton16->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer14->Add(itemButton16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemBoxSizer14->Add(5, 5, 0, wxGROW|wxALL, 5); wxButton* itemButton15 = new wxButton( itemDialog1, wxID_OK, _(
"&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
wxStaticBox* itemStaticBoxSizer18Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Auto increment params")); itemButton15->SetForegroundColour( wxColour( 202, 0, 0 ) );
wxStaticBoxSizer* itemStaticBoxSizer18 = new wxStaticBoxSizer(itemStaticBoxSizer18Static, wxVERTICAL); itemBoxSizer14->Add( itemButton15, 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 ); wxButton* itemButton16 = new wxButton( itemDialog1, wxID_CANCEL, _(
itemStaticBoxSizer18->Add(m_DeltaStepXTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); "&Cancel" ), wxDefaultPosition,
wxDefaultSize, 0 );
m_DeltaStepCtrl_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemButton16->SetForegroundColour( wxColour( 0, 0, 255 ) );
itemStaticBoxSizer18->Add(m_DeltaStepCtrl_X, 0, wxGROW|wxALL, 5); itemBoxSizer14->Add( itemButton16, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
m_DeltaStepYTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta Step Y"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer14->Add( 5, 5, 0, wxGROW | wxALL, 5 );
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 ); wxStaticBox* itemStaticBoxSizer18Static = new wxStaticBox( itemDialog1, wxID_ANY, _(
itemStaticBoxSizer18->Add(m_DeltaStepCtrl_Y, 0, wxGROW|wxALL, 5); "Auto increment params" ) );
m_DeltaIncTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta Label:"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticBoxSizer* itemStaticBoxSizer18 = new wxStaticBoxSizer(
itemStaticBoxSizer18->Add(m_DeltaIncTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); itemStaticBoxSizer18Static,
wxVERTICAL );
m_DeltaLabelCtrl = new wxSpinCtrl( itemDialog1, ID_SPINCTRL, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -16, 16, 0 ); itemBoxSizer14->Add( itemStaticBoxSizer18, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
itemStaticBoxSizer18->Add(m_DeltaLabelCtrl, 0, wxGROW|wxALL, 5);
m_DeltaStepXTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
"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 );
itemStaticBoxSizer18->Add( m_DeltaStepCtrl_X, 0, wxGROW | wxALL, 5 );
m_DeltaStepYTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
"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 );
itemStaticBoxSizer18->Add( m_DeltaStepCtrl_Y, 0, wxGROW | wxALL, 5 );
m_DeltaIncTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
"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 );
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
*/ */
@ -330,11 +432,13 @@ wxBitmap WinEDA_SetOptionsFrame::GetBitmapResource( const wxString& name )
{ {
// Bitmap retrieval // Bitmap retrieval
////@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
*/ */
@ -343,20 +447,25 @@ wxIcon WinEDA_SetOptionsFrame::GetIconResource( const wxString& name )
{ {
// Icon retrieval // Icon retrieval
////@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
*/ */
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,73 +479,88 @@ 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.
} }
/**************************************************************************/ /**************************************************************************/
void WinEDA_SetOptionsFrame::Accept(wxCommandEvent& event) void WinEDA_SetOptionsFrame::Accept( wxCommandEvent& event )
/**************************************************************************/ /**************************************************************************/
{ {
wxSize grid; wxSize grid;
bool setgrid = TRUE; 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 =
ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits); ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
msg = m_DeltaStepCtrl_Y->GetValue(); msg = m_DeltaStepCtrl_Y->GetValue();
g_RepeatStep.y = g_RepeatStep.y =
ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits); ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
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() )
{
default:
setgrid = FALSE;
break;
case 0: switch( m_SelGridSize->GetSelection() )
grid = wxSize(50,50); {
break; default:
case 1: setgrid = FALSE;
grid = wxSize(25,25); break;
break;
case 2: case 0:
grid = wxSize(10,10); grid = wxSize( 50, 50 );
break; break;
}
if ( m_Parent->GetScreen() ) case 1:
{ grid = wxSize( 25, 25 );
if ( setgrid ) m_Parent->GetScreen()->SetGrid(grid); break;
m_Parent->GetScreen()->SetRefreshReq();
} case 2:
grid = wxSize( 10, 10 );
break;
}
if( m_Parent->GetBaseScreen() )
{
if( setgrid )
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,8 +278,8 @@ 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;
Panel->ManageCurseur = NULL; Panel->ManageCurseur = 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

@ -2,7 +2,7 @@
/* EESchema - edition des librairies: Edition des champs ( Fields ) */ /* EESchema - edition des librairies: Edition des champs ( Fields ) */
/*********************************************************************/ /*********************************************************************/
/* Fichier libfield.cpp */ /* Fichier libfield.cpp */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -30,18 +30,18 @@ static void ExitMoveField(WinEDA_DrawPanel * Panel, wxDC * DC)
/***********************************************************/ /***********************************************************/
{ {
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
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;
} }
@ -53,23 +53,23 @@ void WinEDA_LibeditFrame::StartMoveField(wxDC * DC, LibDrawField *field)
{ {
wxPoint startPos; wxPoint startPos;
if( (CurrentLibEntry == NULL) || ( field == NULL ) ) return; if( (CurrentLibEntry == NULL) || ( field == NULL ) ) return;
CurrentDrawItem = field; CurrentDrawItem = field;
LastTextPosition = field->m_Pos; LastTextPosition = field->m_Pos;
CurrentDrawItem->m_Flags |= IS_MOVED; CurrentDrawItem->m_Flags |= IS_MOVED;
startPos.x = LastTextPosition.x; startPos.x = LastTextPosition.x;
startPos.y = -LastTextPosition.y; startPos.y = -LastTextPosition.y;
DrawPanel->CursorOff(DC); DrawPanel->CursorOff(DC);
GetScreen()->m_Curseur = startPos; GetScreen()->m_Curseur = startPos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->ManageCurseur = ShowMoveField; DrawPanel->ManageCurseur = ShowMoveField;
DrawPanel->ForceCloseManageCurseur = ExitMoveField; DrawPanel->ForceCloseManageCurseur = ExitMoveField;
DrawPanel->ManageCurseur(DrawPanel, DC, TRUE); DrawPanel->ManageCurseur(DrawPanel, DC, TRUE);
StartCursor = GetScreen()->m_Curseur; StartCursor = GetScreen()->m_Curseur;
DrawPanel->CursorOn(DC); DrawPanel->CursorOn(DC);
} }
/*****************************************************************/ /*****************************************************************/
@ -81,47 +81,47 @@ static void ShowMoveField(WinEDA_DrawPanel * panel, wxDC *DC, bool erase)
int color; int color;
LibDrawField *Field = (LibDrawField *)CurrentDrawItem; LibDrawField *Field = (LibDrawField *)CurrentDrawItem;
if( (CurrentLibEntry == NULL) || (Field == NULL) ) return; if( (CurrentLibEntry == NULL) || (Field == NULL) ) return;
GRSetDrawMode(DC, g_XorMode); GRSetDrawMode(DC, g_XorMode);
switch (Field->m_FieldId) switch (Field->m_FieldId)
{ {
case VALUE: case VALUE:
color = ReturnLayerColor(LAYER_VALUEPART); color = ReturnLayerColor(LAYER_VALUEPART);
break; break;
case REFERENCE: case REFERENCE:
color = ReturnLayerColor(LAYER_REFERENCEPART); color = ReturnLayerColor(LAYER_REFERENCEPART);
break; break;
default: default:
color = ReturnLayerColor(LAYER_FIELDS); color = ReturnLayerColor(LAYER_FIELDS);
break; break;
} }
int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth);
if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY; if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY;
if( erase ) if( erase )
DrawGraphicText(panel, DC, DrawGraphicText(panel, DC,
wxPoint(LastTextPosition.x, - LastTextPosition.y), wxPoint(LastTextPosition.x, - LastTextPosition.y),
color, Field->m_Text, color, Field->m_Text,
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth); Field->m_HJustify, Field->m_VJustify, LineWidth);
LastTextPosition.x = panel->GetScreen()->m_Curseur.x; LastTextPosition.x = panel->GetScreen()->m_Curseur.x;
LastTextPosition.y = - panel->GetScreen()->m_Curseur.y; LastTextPosition.y = - panel->GetScreen()->m_Curseur.y;
Field->m_Pos = LastTextPosition; Field->m_Pos = LastTextPosition;
DrawGraphicText(panel, DC, DrawGraphicText(panel, DC,
wxPoint(LastTextPosition.x, - LastTextPosition.y), wxPoint(LastTextPosition.x, - LastTextPosition.y),
color, Field->m_Text, color, Field->m_Text,
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth); Field->m_HJustify, Field->m_VJustify, LineWidth);
} }
/*******************************************************************/ /*******************************************************************/
@ -130,45 +130,45 @@ void WinEDA_LibeditFrame::PlaceField(wxDC * DC, LibDrawField *Field)
{ {
int color; int color;
if(Field == NULL ) return; if(Field == NULL ) return;
switch (Field->m_FieldId) switch (Field->m_FieldId)
{ {
case REFERENCE: case REFERENCE:
color = ReturnLayerColor(LAYER_REFERENCEPART); color = ReturnLayerColor(LAYER_REFERENCEPART);
break; break;
case VALUE: case VALUE:
color = ReturnLayerColor(LAYER_VALUEPART); color = ReturnLayerColor(LAYER_VALUEPART);
break; break;
default: default:
color = ReturnLayerColor(LAYER_FIELDS); color = ReturnLayerColor(LAYER_FIELDS);
break; break;
} }
Field->m_Flags = 0; Field->m_Flags = 0;
if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 ) color = DARKGRAY; if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 ) color = DARKGRAY;
Field->m_Pos.x = GetScreen()->m_Curseur.x; Field->m_Pos.x = GetScreen()->m_Curseur.x;
Field->m_Pos.y = - GetScreen()->m_Curseur.y; Field->m_Pos.y = - GetScreen()->m_Curseur.y;
int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth);
DrawPanel->CursorOff(DC); DrawPanel->CursorOff(DC);
GRSetDrawMode(DC, GR_DEFAULT_DRAWMODE); GRSetDrawMode(DC, GR_DEFAULT_DRAWMODE);
DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y),
color, Field->m_Text, color, Field->m_Text,
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth); Field->m_HJustify, Field->m_VJustify, LineWidth);
DrawPanel->CursorOn(DC); DrawPanel->CursorOn(DC);
GetScreen()->SetModify(); GetScreen()->SetModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
} }
@ -180,118 +180,118 @@ wxString Text;
int color; int color;
wxString title = wxT("Text:"); wxString title = wxT("Text:");
if( Field == NULL) return; if( Field == NULL) return;
switch (Field->m_FieldId) switch (Field->m_FieldId)
{ {
case REFERENCE: case REFERENCE:
title = wxT("Reference:"); title = wxT("Reference:");
color = ReturnLayerColor(LAYER_REFERENCEPART); color = ReturnLayerColor(LAYER_REFERENCEPART);
break; break;
case VALUE: case VALUE:
title = wxT("Value:"); title = wxT("Value:");
color = ReturnLayerColor(LAYER_VALUEPART); color = ReturnLayerColor(LAYER_VALUEPART);
break; break;
default: default:
color = ReturnLayerColor(LAYER_FIELDS); color = ReturnLayerColor(LAYER_FIELDS);
break; break;
} }
if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY; if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY;
Text = Field->m_Text; Text = Field->m_Text;
Get_Message(title,Text, this); Get_Message(title,Text, this);
Text.Replace( wxT(" ") , wxT("_") ); Text.Replace( wxT(" ") , wxT("_") );
GRSetDrawMode(DC, g_XorMode); GRSetDrawMode(DC, g_XorMode);
int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth);
DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y),
color, Field->m_Text, color, Field->m_Text,
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth); Field->m_HJustify, Field->m_VJustify, LineWidth);
if( ! Text.IsEmpty() ) if( ! Text.IsEmpty() )
{ {
SaveCopyInUndoList(CurrentLibEntry); SaveCopyInUndoList(CurrentLibEntry);
Field->m_Text = Text; Field->m_Text = Text;
} }
else DisplayError(this, _("No new text: no change") ); else DisplayError(this, _("No new text: no change") );
if( Field->m_Flags == 0 ) GRSetDrawMode(DC, GR_DEFAULT_DRAWMODE); if( Field->m_Flags == 0 ) GRSetDrawMode(DC, GR_DEFAULT_DRAWMODE);
DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y),
color, Field->m_Text, color, Field->m_Text,
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth); Field->m_HJustify, Field->m_VJustify, LineWidth);
GetScreen()->SetModify(); GetScreen()->SetModify();
if ( Field->m_FieldId == VALUE ) ReCreateHToolbar(); if ( Field->m_FieldId == VALUE ) ReCreateHToolbar();
} }
/********************************************************************/ /********************************************************************/
void WinEDA_LibeditFrame::RotateField(wxDC * DC, LibDrawField *Field) void WinEDA_LibeditFrame::RotateField(wxDC * DC, LibDrawField *Field)
/********************************************************************/ /********************************************************************/
/* Routine de modification de l'orientation ( Horiz ou Vert. ) du champ. /* Routine de modification de l'orientation ( Horiz ou Vert. ) du champ.
si un champ est en cours d'edition, modif de celui ci. si un champ est en cours d'edition, modif de celui ci.
sinon Modif du champ pointe par la souris sinon Modif du champ pointe par la souris
*/ */
{ {
int color; int color;
if( Field == NULL) return; if( Field == NULL) return;
GetScreen()->SetModify(); GetScreen()->SetModify();
switch (Field->m_FieldId) switch (Field->m_FieldId)
{ {
case REFERENCE: case REFERENCE:
color = ReturnLayerColor(LAYER_REFERENCEPART); color = ReturnLayerColor(LAYER_REFERENCEPART);
break; break;
case VALUE: case VALUE:
color = ReturnLayerColor(LAYER_VALUEPART); color = ReturnLayerColor(LAYER_VALUEPART);
break; break;
default: default:
color = ReturnLayerColor(LAYER_FIELDS); color = ReturnLayerColor(LAYER_FIELDS);
break; break;
} }
if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 ) color = DARKGRAY; if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 ) color = DARKGRAY;
DrawPanel->CursorOff(DC); DrawPanel->CursorOff(DC);
GRSetDrawMode(DC, g_XorMode); GRSetDrawMode(DC, g_XorMode);
int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth);
DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y),
color, Field->m_Text, color, Field->m_Text,
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth); Field->m_HJustify, Field->m_VJustify, LineWidth);
if( Field->m_Orient) Field->m_Orient = 0; if( Field->m_Orient) Field->m_Orient = 0;
else Field->m_Orient = 1; else Field->m_Orient = 1;
if( Field->m_Flags == 0 ) GRSetDrawMode(DC, GR_DEFAULT_DRAWMODE); if( Field->m_Flags == 0 ) GRSetDrawMode(DC, GR_DEFAULT_DRAWMODE);
DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y),
color, Field->m_Text, color, Field->m_Text,
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth); Field->m_HJustify, Field->m_VJustify, LineWidth);
DrawPanel->CursorOn(DC); DrawPanel->CursorOn(DC);
} }
/****************************************************************************/ /****************************************************************************/
LibDrawField * WinEDA_LibeditFrame::LocateField(EDA_LibComponentStruct *LibEntry) LibDrawField * WinEDA_LibeditFrame::LocateField(EDA_LibComponentStruct *LibEntry)
/****************************************************************************/ /****************************************************************************/
/* Localise le champ (ref ou name) pointe par la souris /* Localise le champ (ref ou name) pointe par la souris
retourne: retourne:
pointeur sur le champ (NULL= Pas de champ) pointeur sur le champ (NULL= Pas de champ)
*/ */
{ {
int x0, y0, x1, y1; /* Rectangle d'encadrement des textes a localiser */ int x0, y0, x1, y1; /* Rectangle d'encadrement des textes a localiser */
@ -299,91 +299,91 @@ int dx, dy; /* Dimensions du texte */
LibDrawField *Field; LibDrawField *Field;
int hjustify, vjustify; int hjustify, vjustify;
/* Localisation du Nom */ /* Localisation du Nom */
x0 = LibEntry->m_Name.m_Pos.x; x0 = LibEntry->m_Name.m_Pos.x;
y0 = - LibEntry->m_Name.m_Pos.y; y0 = - LibEntry->m_Name.m_Pos.y;
dx = LibEntry->m_Name.m_Size.x * LibEntry->m_Name.m_Text.Len(), dx = LibEntry->m_Name.m_Size.x * LibEntry->m_Name.m_Text.Len(),
dy = LibEntry->m_Name.m_Size.y; dy = LibEntry->m_Name.m_Size.y;
hjustify = LibEntry->m_Name.m_HJustify; vjustify = LibEntry->m_Name.m_VJustify; hjustify = LibEntry->m_Name.m_HJustify; vjustify = LibEntry->m_Name.m_VJustify;
if (LibEntry->m_Name.m_Orient) EXCHG(dx, dy); if (LibEntry->m_Name.m_Orient) EXCHG(dx, dy);
if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2; if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2;
else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx; else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx;
if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2; if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2;
else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 += dy; else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 += dy;
x1 = x0 + dx; y1 = y0 + dy; x1 = x0 + dx; y1 = y0 + dy;
if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) && if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) &&
(GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) ) (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) )
return &LibEntry->m_Name; return &LibEntry->m_Name;
/* Localisation du Prefix */ /* Localisation du Prefix */
x0 = LibEntry->m_Prefix.m_Pos.x; x0 = LibEntry->m_Prefix.m_Pos.x;
y0 = - LibEntry->m_Prefix.m_Pos.y; y0 = - LibEntry->m_Prefix.m_Pos.y;
dx = LibEntry->m_Prefix.m_Size.x *LibEntry->m_Prefix.m_Text.Len(), dx = LibEntry->m_Prefix.m_Size.x *LibEntry->m_Prefix.m_Text.Len(),
dy = LibEntry->m_Prefix.m_Size.y; dy = LibEntry->m_Prefix.m_Size.y;
hjustify = LibEntry->m_Prefix.m_HJustify; vjustify = LibEntry->m_Prefix.m_VJustify; hjustify = LibEntry->m_Prefix.m_HJustify; vjustify = LibEntry->m_Prefix.m_VJustify;
if (LibEntry->m_Prefix.m_Orient) EXCHG(dx, dy); if (LibEntry->m_Prefix.m_Orient) EXCHG(dx, dy);
if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2; if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2;
else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx; else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx;
if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2; if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2;
else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy; else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy;
x1 = x0 + dx; y1 = y0 + dy; x1 = x0 + dx; y1 = y0 + dy;
if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) && if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) &&
(GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) ) (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) )
return &LibEntry->m_Prefix; return &LibEntry->m_Prefix;
/* Localisation des autres fields */ /* Localisation des autres fields */
for (Field = LibEntry->Fields; Field != NULL; for (Field = LibEntry->Fields; Field != NULL;
Field = (LibDrawField*)Field->Pnext) Field = (LibDrawField*)Field->Pnext)
{ {
if ( Field->m_Text.IsEmpty() ) continue; if ( Field->m_Text.IsEmpty() ) continue;
x0 = Field->m_Pos.x; y0 = - Field->m_Pos.y; x0 = Field->m_Pos.x; y0 = - Field->m_Pos.y;
dx = Field->m_Size.x * Field->m_Text.Len(), dx = Field->m_Size.x * Field->m_Text.Len(),
dy = Field->m_Size.y; dy = Field->m_Size.y;
hjustify = Field->m_HJustify; vjustify = Field->m_VJustify; hjustify = Field->m_HJustify; vjustify = Field->m_VJustify;
if (Field->m_Orient) EXCHG(dx, dy); if (Field->m_Orient) EXCHG(dx, dy);
if (LibEntry->m_Prefix.m_Orient) EXCHG(dx, dy); if (LibEntry->m_Prefix.m_Orient) EXCHG(dx, dy);
if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2; if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2;
else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx; else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx;
if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2; if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2;
else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy; else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy;
x1 = x0 + dx; y1 = y0 + dy; x1 = x0 + dx; y1 = y0 + dy;
if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) && if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) &&
(GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) ) (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) )
return(Field); return(Field);
} }
return NULL; return NULL;
} }
/********************************************************************************/ /********************************************************************************/
LibEDA_BaseStruct* WinEDA_LibeditFrame::LocateItemUsingCursor() LibEDA_BaseStruct* WinEDA_LibeditFrame::LocateItemUsingCursor()
/********************************************************************************/ /********************************************************************************/
{ {
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
if ( CurrentLibEntry == NULL ) return NULL; if ( CurrentLibEntry == NULL ) return NULL;
if ( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) ) if ( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
{ // Simple localisation des elements { // Simple localisation des elements
DrawEntry = LocatePin(GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert); DrawEntry = LocatePin(GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert);
if ( DrawEntry == NULL ) if ( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)GetScreen(), DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)GetScreen(),
GetScreen()->m_MousePosition,CurrentLibEntry,CurrentUnit, GetScreen()->m_MousePosition,CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM); CurrentConvert,LOCATE_ALL_DRAW_ITEM);
} }
if ( DrawEntry == NULL ) if ( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)GetScreen(), GetScreen()->m_Curseur, CurrentLibEntry,CurrentUnit, DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)GetScreen(), GetScreen()->m_Curseur, CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM); CurrentConvert,LOCATE_ALL_DRAW_ITEM);
} }
if ( DrawEntry == NULL ) if ( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*) DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*)
LocateField(CurrentLibEntry); LocateField(CurrentLibEntry);
} }
} }
return DrawEntry; return DrawEntry;
} }

View File

@ -64,7 +64,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
WinEDA_DrawFrame( father, LIBEDITOR_FRAME, parent, title, pos, size, style ) WinEDA_DrawFrame( father, LIBEDITOR_FRAME, parent, title, pos, size, style )
{ {
m_FrameName = wxT( "LibeditFrame" ); m_FrameName = wxT( "LibeditFrame" );
@ -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?
} }
@ -100,14 +99,14 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
{ {
LibraryStruct* Lib; LibraryStruct* Lib;
if( GetScreen()->IsModify() ) if( GetScreen()->IsModify() )
{ {
if( !IsOK( this, _( "Component was modified!\nDiscard changes?" ) ) ) if( !IsOK( this, _( "Component was modified!\nDiscard changes?" ) ) )
{ {
Event.Veto(); return; Event.Veto(); return;
} }
else else
GetScreen()->ClrModify(); GetScreen()->ClrModify();
} }
for( Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext ) for( Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
@ -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;
} }
} }
} }
@ -261,8 +261,8 @@ int WinEDA_LibeditFrame::BestZoom()
} }
else else
{ {
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y; dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
} }
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
@ -275,12 +275,12 @@ int WinEDA_LibeditFrame::BestZoom()
if( CurrentLibEntry ) if( CurrentLibEntry )
{ {
GetScreen()->m_Curseur = BoundaryBox.Centre(); GetScreen()->m_Curseur = BoundaryBox.Centre();
} }
else else
{ {
GetScreen()->m_Curseur.x = 0; GetScreen()->m_Curseur.x = 0;
GetScreen()->m_Curseur.y = 0; GetScreen()->m_Curseur.y = 0;
} }
return bestzoom; return bestzoom;
@ -339,7 +339,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_LIBEDIT_SAVE_CURRENT_LIB: case ID_LIBEDIT_SAVE_CURRENT_LIB:
if( GetScreen()->IsModify() ) if( GetScreen()->IsModify() )
{ {
if( IsOK( this, _( "Include last component changes?" ) ) ) if( IsOK( this, _( "Include last component changes?" ) ) )
SaveOnePartInMemory(); SaveOnePartInMemory();
@ -608,7 +608,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
} }
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
GetScreen()->SetModify(); GetScreen()->SetModify();
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
break; break;
@ -656,7 +656,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
EditField( &dc, (LibDrawField*) CurrentDrawItem ); EditField( &dc, (LibDrawField*) CurrentDrawItem );
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
break; break;

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -23,9 +23,10 @@
*****************************************************************************/ *****************************************************************************/
void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) 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 ) {
break; SCH_ITEM* item = screen->GetCurItem();
DeleteStruct( DrawPanel, &dc, (SCH_ITEM*)GetScreen()->GetCurItem() ); if( item == NULL )
GetScreen()->SetCurItem( NULL ); break;
g_ItemToRepeat = NULL;
TestDanglingEnds( GetScreen()->EEDrawList, &dc ); DeleteStruct( DrawPanel, &dc, item );
GetScreen()->SetModify(); screen->SetCurItem( NULL );
g_ItemToRepeat = NULL;
TestDanglingEnds( screen->EEDrawList, &dc );
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();
} }
@ -399,17 +408,17 @@ int WinEDA_SchematicFrame::BestZoom()
int bestzoom; int bestzoom;
wxSize size; wxSize size;
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y; dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
ii = dx / size.x; ii = dx / size.x;
jj = dy / size.y; jj = dy / size.y;
bestzoom = MAX( ii, jj ) + 1; bestzoom = MAX( ii, jj ) + 1;
GetScreen()->SetZoom( ii ); GetScreen()->SetZoom( ii );
GetScreen()->m_Curseur.x = dx / 2; GetScreen()->m_Curseur.x = dx / 2;
GetScreen()->m_Curseur.y = dy / 2; GetScreen()->m_Curseur.y = dy / 2;
return bestzoom; return bestzoom;
} }

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

@ -100,7 +100,7 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
} }
CurrentLibEntry->SortDrawItems(); CurrentLibEntry->SortDrawItems();
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, 0, 0,
CurrentDrawItem, CurrentUnit, g_XorMode ); CurrentDrawItem, CurrentUnit, g_XorMode );
@ -150,7 +150,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
else else
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, 0, 0,
CurrentDrawItem, CurrentUnit, g_XorMode ); CurrentDrawItem, CurrentUnit, g_XorMode );
SAFE_DELETE( CurrentDrawItem ); SAFE_DELETE( CurrentDrawItem );
} }
else else
{ {
@ -224,8 +224,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
LibDrawArc* Arc = new LibDrawArc(); LibDrawArc* Arc = new LibDrawArc();
CurrentDrawItem = Arc; CurrentDrawItem = Arc;
ArcStartX = ArcEndX = GetScreen()->m_Curseur.x; ArcStartX = ArcEndX = GetScreen()->m_Curseur.x;
ArcStartY = ArcEndY = -( GetScreen()->m_Curseur.y ); ArcStartY = ArcEndY = -( GetScreen()->m_Curseur.y );
StateDrawArc = 1; StateDrawArc = 1;
Arc->m_Fill = FlSymbol_Fill; Arc->m_Fill = FlSymbol_Fill;
Arc->m_Width = g_LibSymbolDefaultLineWidth; Arc->m_Width = g_LibSymbolDefaultLineWidth;
@ -237,8 +237,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
LibDrawCircle* Circle = new LibDrawCircle(); LibDrawCircle* Circle = new LibDrawCircle();
CurrentDrawItem = Circle; CurrentDrawItem = Circle;
Circle->m_Pos.x = GetScreen()->m_Curseur.x; Circle->m_Pos.x = GetScreen()->m_Curseur.x;
Circle->m_Pos.y = -( GetScreen()->m_Curseur.y ); Circle->m_Pos.y = -( GetScreen()->m_Curseur.y );
Circle->m_Fill = FlSymbol_Fill; Circle->m_Fill = FlSymbol_Fill;
Circle->m_Width = g_LibSymbolDefaultLineWidth; Circle->m_Width = g_LibSymbolDefaultLineWidth;
} }
@ -249,8 +249,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
LibDrawSquare* Square = new LibDrawSquare(); LibDrawSquare* Square = new LibDrawSquare();
CurrentDrawItem = Square; CurrentDrawItem = Square;
Square->m_Pos.x = GetScreen()->m_Curseur.x; Square->m_Pos.x = GetScreen()->m_Curseur.x;
Square->m_Pos.y = -( GetScreen()->m_Curseur.y ); Square->m_Pos.y = -( GetScreen()->m_Curseur.y );
Square->m_End = Square->m_Pos; Square->m_End = Square->m_Pos;
Square->m_Fill = FlSymbol_Fill; Square->m_Fill = FlSymbol_Fill;
Square->m_Width = g_LibSymbolDefaultLineWidth; Square->m_Width = g_LibSymbolDefaultLineWidth;
@ -265,8 +265,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
polyline->n = 2; polyline->n = 2;
ptpoly = (int*) MyZMalloc( 4 * sizeof(int) ); ptpoly = (int*) MyZMalloc( 4 * sizeof(int) );
polyline->PolyList = ptpoly; polyline->PolyList = ptpoly;
ptpoly[0] = ptpoly[2] = GetScreen()->m_Curseur.x; ptpoly[0] = ptpoly[2] = GetScreen()->m_Curseur.x;
ptpoly[1] = ptpoly[3] = -( GetScreen()->m_Curseur.y ); ptpoly[1] = ptpoly[3] = -( GetScreen()->m_Curseur.y );
polyline->m_Fill = FlSymbol_Fill; polyline->m_Fill = FlSymbol_Fill;
polyline->m_Width = g_LibSymbolDefaultLineWidth; polyline->m_Width = g_LibSymbolDefaultLineWidth;
} }
@ -277,8 +277,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
LibDrawSegment* Segment = new LibDrawSegment(); LibDrawSegment* Segment = new LibDrawSegment();
CurrentDrawItem = Segment; CurrentDrawItem = Segment;
Segment->m_Pos.x = GetScreen()->m_Curseur.x; Segment->m_Pos.x = GetScreen()->m_Curseur.x;
Segment->m_Pos.y = -( GetScreen()->m_Curseur.y ); Segment->m_Pos.y = -( GetScreen()->m_Curseur.y );
Segment->m_End = Segment->m_Pos; Segment->m_End = Segment->m_Pos;
Segment->m_Width = g_LibSymbolDefaultLineWidth; Segment->m_Width = g_LibSymbolDefaultLineWidth;
} }
@ -291,12 +291,12 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
CurrentDrawItem = Text; CurrentDrawItem = Text;
Text->m_Size.x = Text->m_Size.y = g_LastTextSize; Text->m_Size.x = Text->m_Size.y = g_LastTextSize;
Text->m_Horiz = g_LastTextOrient; Text->m_Horiz = g_LastTextOrient;
Text->m_Pos.x = GetScreen()->m_Curseur.x; Text->m_Pos.x = GetScreen()->m_Curseur.x;
Text->m_Pos.y = -( GetScreen()->m_Curseur.y ); Text->m_Pos.y = -( GetScreen()->m_Curseur.y );
EditSymbolText( NULL, Text ); EditSymbolText( NULL, Text );
if( Text->m_Text.IsEmpty() ) if( Text->m_Text.IsEmpty() )
{ {
SAFE_DELETE( Text ); SAFE_DELETE( Text );
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
@ -362,7 +362,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->m_Curseur;
( (LibDrawPolyline*) CurrentDrawItem )->AddPoint( pos ); ( (LibDrawPolyline*) CurrentDrawItem )->AddPoint( pos );
} }
break; break;
@ -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*/
@ -481,7 +481,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
SetCursor( wxCURSOR_HAND ); SetCursor( wxCURSOR_HAND );
CurrentDrawItem->m_Flags |= IS_MOVED; CurrentDrawItem->m_Flags |= IS_MOVED;
StartCursor = GetScreen()->m_Curseur; StartCursor = GetScreen()->m_Curseur;
switch( CurrentDrawItem->Type() ) switch( CurrentDrawItem->Type() )
{ {
@ -513,7 +513,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
; ;
} }
ItemPreviousPos = GetScreen()->m_Curseur; ItemPreviousPos = GetScreen()->m_Curseur;
DrawPanel->ManageCurseur = RedrawWhileMovingCursor; DrawPanel->ManageCurseur = RedrawWhileMovingCursor;
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn; DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn;
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
@ -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;
@ -720,7 +720,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
CurrentDrawItem->m_Flags = 0; CurrentDrawItem->m_Flags = 0;
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
GetScreen()->SetModify(); GetScreen()->SetModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
@ -832,11 +832,11 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
{ {
Poly->n--; Poly->n--;
ptpoly = Poly->PolyList + ( 2 * (Poly->n - 1) ); ptpoly = Poly->PolyList + ( 2 * (Poly->n - 1) );
if( (ptpoly[0] != GetScreen()->m_Curseur.x) if( (ptpoly[0] != GetScreen()->m_Curseur.x)
|| (ptpoly[1] != -GetScreen()->m_Curseur.y) ) || (ptpoly[1] != -GetScreen()->m_Curseur.y) )
{ {
ptpoly[0] = GetScreen()->m_Curseur.x; ptpoly[0] = GetScreen()->m_Curseur.x;
ptpoly[1] = -( GetScreen()->m_Curseur.y); ptpoly[1] = -( GetScreen()->m_Curseur.y);
break; break;
} }
} }

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();
@ -324,7 +324,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
deltaX = GetScreen()->BlockLocate.m_MoveVector.x; deltaX = GetScreen()->BlockLocate.m_MoveVector.x;
deltaY = GetScreen()->BlockLocate.m_MoveVector.y; deltaY = GetScreen()->BlockLocate.m_MoveVector.y;
/* Move the Track segments in block */ /* Move the Track segments in block */
TRACK* track = m_Pcb->m_Track; TRACK* track = m_Pcb->m_Track;
while( track ) while( track )
{ {

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

@ -1,6 +1,6 @@
/********************************************************/ /********************************************************/
/**** Routine de lecture et visu d'un fichier GERBER ****/ /**** Routine de lecture et visu d'un fichier GERBER ****/
/********************************************************/ /********************************************************/
#include "fctsys.h" #include "fctsys.h"
@ -12,470 +12,504 @@
#define DEFAULT_SIZE 100 #define DEFAULT_SIZE 100
/* Format Gerber : NOTES : /* Format Gerber : NOTES :
Fonctions preparatoires: Fonctions preparatoires:
Gn = Gn =
G01 interpolation lineaire ( trace de droites ) G01 interpolation lineaire ( trace de droites )
G02,G20,G21 Interpolation circulaire , sens trigo < 0 G02,G20,G21 Interpolation circulaire , sens trigo < 0
G03,G30,G31 Interpolation circulaire , sens trigo > 0 G03,G30,G31 Interpolation circulaire , sens trigo > 0
G04 commentaire G04 commentaire
G06 Interpolation parabolique G06 Interpolation parabolique
G07 Interpolation cubique G07 Interpolation cubique
G10 interpolation lineaire ( echelle 10x ) G10 interpolation lineaire ( echelle 10x )
G11 interpolation lineaire ( echelle 0.1x ) G11 interpolation lineaire ( echelle 0.1x )
G12 interpolation lineaire ( echelle 0.01x ) G12 interpolation lineaire ( echelle 0.01x )
G52 plot symbole reference par Dnn code G52 plot symbole reference par Dnn code
G53 plot symbole reference par Dnn ; symbole tourne de -90 degres G53 plot symbole reference par Dnn ; symbole tourne de -90 degres
G54 Selection d'outil G54 Selection d'outil
G55 Mode exposition photo G55 Mode exposition photo
G56 plot symbole reference par Dnn A code G56 plot symbole reference par Dnn A code
G57 affiche le symbole reference sur la console G57 affiche le symbole reference sur la console
G58 plot et affiche le symbole reference sur la console G58 plot et affiche le symbole reference sur la console
G60 interpolation lineaire ( echelle 100x ) G60 interpolation lineaire ( echelle 100x )
G70 Unites = Inches G70 Unites = Inches
G71 Unites = Millimetres G71 Unites = Millimetres
G74 supprime interpolation circulaire sur 360 degre, revient a G01 G74 supprime interpolation circulaire sur 360 degre, revient a G01
G75 Active interpolation circulaire sur 360 degre G75 Active interpolation circulaire sur 360 degre
G90 Mode Coordonnees absolues G90 Mode Coordonnees absolues
G91 Mode Coordonnees Relatives G91 Mode Coordonnees Relatives
Coordonnees X,Y Coordonnees X,Y
X,Y sont suivies de + ou - et de m+n chiffres (non separes) X,Y sont suivies de + ou - et de m+n chiffres (non separes)
m = partie entiere m = partie entiere
n = partie apres la virgule n = partie apres la virgule
formats classiques : m = 2, n = 3 (format 2.3) formats classiques : m = 2, n = 3 (format 2.3)
m = 3, n = 4 (format 3.4) m = 3, n = 4 (format 3.4)
ex: ex:
G__ X00345Y-06123 D__* G__ X00345Y-06123 D__*
Outils et D_CODES Outils et D_CODES
numero d'outil ( identification des formes ) numero d'outil ( identification des formes )
1 a 99 (classique) 1 a 99 (classique)
1 a 999 1 a 999
D_CODES: D_CODES:
D01 ... D9 = codes d'action: D01 ... D9 = codes d'action:
D01 = activation de lumiere (baisser de plume) lors du d<EFBFBD>placement D01 = activation de lumiere (baisser de plume) lors du d<EFBFBD>placement
D02 = extinction de lumiere (lever de plume) lors du d<EFBFBD>placement D02 = extinction de lumiere (lever de plume) lors du d<EFBFBD>placement
D03 = Flash D03 = Flash
D09 = VAPE Flash D09 = VAPE Flash
D10 ... = Indentification d'outils ( d'ouvertures ) D10 ... = Indentification d'outils ( d'ouvertures )
*/ */
/*********************************/ /*********************************/
/* class GERBER_Descr : Methodes */ /* class GERBER_Descr : Methodes */
/*********************************/ /*********************************/
GERBER_Descr::GERBER_Descr(int layer) GERBER_Descr::GERBER_Descr( int layer )
{ {
int ii; int ii;
m_Layer = layer; // Layer Number
m_Selected_Tool = FIRST_DCODE; m_Layer = layer; // Layer Number
ResetDefaultValues(); m_Selected_Tool = FIRST_DCODE;
for ( ii = 0; ii <= MAX_TOOLS; ii++ ) ResetDefaultValues();
m_Aperture_List[ii] = new D_CODE(ii + FIRST_DCODE); for( ii = 0; ii <= MAX_TOOLS; ii++ )
m_Aperture_List[ii] = new D_CODE( ii + FIRST_DCODE );
} }
GERBER_Descr::~GERBER_Descr() GERBER_Descr::~GERBER_Descr()
{ {
int ii; int ii;
if (m_Aperture_List ) if( m_Aperture_List )
{ {
for ( ii = 0; ii < MAX_TOOLS; ii++) for( ii = 0; ii < MAX_TOOLS; ii++ )
{ {
delete m_Aperture_List[ii]; delete m_Aperture_List[ii];
m_Aperture_List[ii] = NULL; m_Aperture_List[ii] = NULL;
} }
} }
} }
/******************************************/ /******************************************/
void GERBER_Descr::ResetDefaultValues() void GERBER_Descr::ResetDefaultValues()
/******************************************/ /******************************************/
{ {
m_Parent = NULL; m_Parent = NULL;
m_Pback = NULL; m_Pback = NULL;
m_Pnext = NULL; m_Pnext = NULL;
m_FileName.Empty(); m_FileName.Empty();
m_Name = wxT("no name"); // Layer name m_Name = wxT( "no name" ); // Layer name
m_LayerNegative = FALSE; // TRUE = Negative Layer m_LayerNegative = FALSE; // TRUE = Negative Layer
m_ImageNegative = FALSE; // TRUE = Negative image m_ImageNegative = FALSE; // TRUE = Negative image
m_GerbMetric = FALSE; // FALSE = Inches, TRUE = metric m_GerbMetric = FALSE; // FALSE = Inches, TRUE = metric
m_Relative = FALSE; // FALSE = absolute Coord, RUE = relative Coord m_Relative = FALSE; // FALSE = absolute Coord, RUE = relative Coord
m_NoTrailingZeros = FALSE; // True: zeros a droite supprim<69>s m_NoTrailingZeros = FALSE; // True: zeros a droite supprim<69>s
m_MirorA = FALSE; // True: miror / axe A (X) m_MirorA = FALSE; // True: miror / axe A (X)
m_MirorB = FALSE; // True: miror / axe B (Y) m_MirorB = FALSE; // True: miror / axe B (Y)
m_As_DCode = FALSE; // TRUE = DCodes in file (FALSE = no DCode-> m_As_DCode = FALSE; // TRUE = DCodes in file (FALSE = no DCode->
// separate DCode file // separate DCode file
m_Offset.x = m_Offset.y = 0; // Coord Offset m_Offset.x = m_Offset.y = 0; // Coord Offset
m_FmtScale.x = m_FmtScale.y = g_Default_GERBER_Format % 10; m_FmtScale.x = m_FmtScale.y = g_Default_GERBER_Format % 10;
m_FmtLen.x = m_FmtLen.y = m_FmtScale.x + (g_Default_GERBER_Format / 10); m_FmtLen.x = m_FmtLen.y = m_FmtScale.x + (g_Default_GERBER_Format / 10);
m_LayerScale.x = m_LayerScale.y = 1.0; // scale (X et Y) pour cette layer m_LayerScale.x = m_LayerScale.y = 1.0; // scale (X et Y) pour cette layer
m_Rotation = 0; m_Rotation = 0;
m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Linear, 90 arc, Circ. m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Linear, 90 arc, Circ.
m_360Arc_enbl = FALSE; // 360 deg circular interpolation disable m_360Arc_enbl = FALSE; // 360 deg circular interpolation disable
m_Current_Tool = 0; // Current Tool (Dcode) number selected m_Current_Tool = 0; // Current Tool (Dcode) number selected
m_CommandState = 0; // donne l'etat de l'analyse des commandes gerber m_CommandState = 0; // donne l'etat de l'analyse des commandes gerber
m_CurrentPos.x = m_CurrentPos.y = 0; // current specified coord for plot m_CurrentPos.x = m_CurrentPos.y = 0; // current specified coord for plot
m_PreviousPos.x = m_PreviousPos.y = 0; // old current specified coord for plot m_PreviousPos.x = m_PreviousPos.y = 0; // old current specified coord for plot
m_IJPos.x = m_IJPos.y = 0; // current centre coord for plot arcs & circles m_IJPos.x = m_IJPos.y = 0; // current centre coord for plot arcs & circles
m_Current_File = NULL; // File to read m_Current_File = NULL; // File to read
m_FilesPtr = 0; m_FilesPtr = 0;
m_Transform[0][0] = m_Transform[1][1] = 1; m_Transform[0][0] = m_Transform[1][1] = 1;
m_Transform[0][1] = m_Transform[1][0] = 0; // Rotation/mirror = Normal m_Transform[0][1] = m_Transform[1][0] = 0; // Rotation/mirror = Normal
m_PolygonFillMode = FALSE; m_PolygonFillMode = FALSE;
m_PolygonFillModeState = 0; m_PolygonFillModeState = 0;
} }
/********************************************/ /********************************************/
int GERBER_Descr::ReturnUsedDcodeNumber() int GERBER_Descr::ReturnUsedDcodeNumber()
/********************************************/ /********************************************/
{ {
int ii, jj; int ii, jj;
jj = 0; jj = 0;
if (m_Aperture_List ) if( m_Aperture_List )
{ {
for ( ii = 0; ii < MAX_TOOLS; ii++) for( ii = 0; ii < MAX_TOOLS; ii++ )
{ {
if( m_Aperture_List[ii]->m_InUse || m_Aperture_List[ii]->m_Defined ) if( m_Aperture_List[ii]->m_InUse || m_Aperture_List[ii]->m_Defined )
jj++; jj++;
} }
} }
return jj; return jj;
} }
/******************************/ /******************************/
void GERBER_Descr::InitToolTable() void GERBER_Descr::InitToolTable()
/******************************/ /******************************/
/* Creation du tableau des MAX_TOOLS DCodes utilisables, si il n'existe pas,
et Init des DCodes <EFBFBD> une valeur raisonnable
*/
{
int count;
/* Init du buffer des D_CODES a des valeurs raisonnables */ /* Creation du tableau des MAX_TOOLS DCodes utilisables, si il n'existe pas,
for (count = 0 ; count < MAX_TOOLS ; count++) * et Init des DCodes <EFBFBD> une valeur raisonnable
{ */
if (m_Aperture_List[count] == NULL ) continue; {
m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE; int count;
m_Aperture_List[count]->Clear_D_CODE_Data();
} /* Init du buffer des D_CODES a des valeurs raisonnables */
for( count = 0; count < MAX_TOOLS; count++ )
{
if( m_Aperture_List[count] == NULL )
continue;
m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE;
m_Aperture_List[count]->Clear_D_CODE_Data();
}
} }
/*************************/ /*************************/
/* Class DCODE: methodes */ /* Class DCODE: methodes */
/*************************/ /*************************/
/* Variables locales : */ /* Variables locales : */
/* Routines Locales */ /* Routines Locales */
D_CODE::D_CODE(int num_dcode) D_CODE::D_CODE( int num_dcode )
{ {
m_Num_Dcode = num_dcode; m_Num_Dcode = 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;
m_Size.y = DEFAULT_SIZE; m_Size.y = DEFAULT_SIZE;
m_Shape= GERB_CIRCLE; m_Shape = GERB_CIRCLE;
m_Drill.x = m_Drill.y = 0; m_Drill.x = m_Drill.y = 0;
m_DrillShape = 0; m_DrillShape = 0;
m_InUse = FALSE; m_InUse = FALSE;
m_Defined = FALSE; m_Defined = FALSE;
} }
/******************************************************************************/ /******************************************************************************/
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;
char* ptcar; char* ptcar;
int dimH, dimV, drill, type_outil, dummy; int dimH, dimV, drill, type_outil, dummy;
float fdimH, fdimV, fdrill; float fdimH, fdimV, fdrill;
char c_type_outil[256]; char c_type_outil[256];
char Line[2000]; 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;
if ( g_GERBER_Descr_List[layer] == NULL ) if( g_GERBER_Descr_List[layer] == NULL )
{ {
g_GERBER_Descr_List[layer] = new GERBER_Descr(layer); g_GERBER_Descr_List[layer] = new GERBER_Descr( layer );
} }
/* 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" ) );
if (dest == 0) if( dest == 0 )
{ {
msg = _("File ") + D_Code_FullFileName + _(" not found"); msg = _( "File " ) + D_Code_FullFileName + _( " not found" );
DisplayError(this, msg, 10); DisplayError( this, msg, 10 );
return -1; return -1;
} }
g_GERBER_Descr_List[layer]->InitToolTable(); g_GERBER_Descr_List[layer]->InitToolTable();
ListeDCode = g_GERBER_Descr_List[layer]->m_Aperture_List; ListeDCode = g_GERBER_Descr_List[layer]->m_Aperture_List;
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 */
{ {
sscanf(Line,"%d,%d,%d,%d,%d,%d,%d",&ii, sscanf( Line, "%d,%d,%d,%d,%d,%d,%d", &ii,
&dimH, &dimV, &drill, &dimH, &dimV, &drill,
&dummy,&dummy, &dummy, &dummy,
&type_outil); &type_outil );
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 )
current_Dcode = ii-1 + FIRST_DCODE; ii = 1;
} current_Dcode = ii - 1 + FIRST_DCODE;
else /* valeurs en inches a convertir en mils */ }
{ else /* valeurs en inches a convertir en mils */
fdrill = 0 ; current_Dcode = 0 ; fdrill = 0 ; {
sscanf(Line,"%f,%f,%1s",&fdimV, &fdimH, c_type_outil); fdrill = 0; current_Dcode = 0; fdrill = 0;
ptcar = Line ; sscanf( Line, "%f,%f,%1s", &fdimV, &fdimH, c_type_outil );
while( *ptcar ) ptcar = Line;
{ while( *ptcar )
if (*ptcar == 'D') {
{ if( *ptcar == 'D' )
sscanf(ptcar+1,"%d,%f", &current_Dcode,&fdrill); break ; {
} sscanf( ptcar + 1, "%d,%f", &current_Dcode, &fdrill ); break;
else ptcar++ ; }
} else
dimH = (int)( (fdimH * dcode_scale * 1000) + 0.5); ptcar++;
dimV = (int)( (fdimV * dcode_scale * 1000) + 0.5); }
drill = (int)( (fdrill * dcode_scale * 1000) + 0.5);
type_outil = -1 ;
if(c_type_outil[0] == 'L') type_outil = GERB_LINE;
if(c_type_outil[0] == 'R') type_outil = GERB_RECT;
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);}
} dimH = (int) ( (fdimH * dcode_scale * 1000) + 0.5 );
/* Mise a jour de la liste des d_codes si valeurs lues coherentes*/ dimV = (int) ( (fdimV * dcode_scale * 1000) + 0.5 );
if (current_Dcode < FIRST_DCODE ) continue; drill = (int) ( (fdrill * dcode_scale * 1000) + 0.5 );
if (current_Dcode >= MAX_TOOLS ) continue; type_outil = -1;
pt_Dcode = ReturnToolDescr(layer, current_Dcode); if( c_type_outil[0] == 'L' )
pt_Dcode->m_Size.x = dimH; type_outil = GERB_LINE;
pt_Dcode->m_Size.y = dimV; if( c_type_outil[0] == 'R' )
pt_Dcode->m_Shape = type_outil; type_outil = GERB_RECT;
pt_Dcode->m_Drill.x = pt_Dcode->m_Drill.y = drill; if( c_type_outil[0] == 'C' )
pt_Dcode->m_Defined = TRUE; type_outil = GERB_CIRCLE;
} if( c_type_outil[0] == 'O' )
fclose(dest) ; 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*/
if( current_Dcode < FIRST_DCODE )
continue;
if( current_Dcode >= MAX_TOOLS )
continue;
pt_Dcode = ReturnToolDescr( layer, current_Dcode );
pt_Dcode->m_Size.x = dimH;
pt_Dcode->m_Size.y = dimV;
pt_Dcode->m_Shape = type_outil;
pt_Dcode->m_Drill.x = pt_Dcode->m_Drill.y = drill;
pt_Dcode->m_Defined = TRUE;
}
return(1); fclose( dest );
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
*/ */
{ {
TRACK * track; TRACK* track;
D_CODE * pt_Dcode; /* Pointeur sur le D code*/ D_CODE* pt_Dcode; /* Pointeur sur le D code*/
track = m_Pcb->m_Track; track = m_Pcb->m_Track;
for ( ; track != NULL ; track = (TRACK*) track->Pnext ) for( ; track != NULL; track = (TRACK*) track->Pnext )
{ {
pt_Dcode = ReturnToolDescr(track->GetLayer(), track->GetNet()); pt_Dcode = ReturnToolDescr( track->GetLayer(), track->GetNet() );
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 )
{
int width, len;
wxSize size = pt_Dcode->m_Size;
else // Spots ( Flashed Items ) width = MIN( size.x, size.y );
{ len = MAX( size.x, size.y ) - width;
int width, len;
wxSize size = pt_Dcode->m_Size;
width = MIN( size.x, size.y ); track->m_Width = width;
len = MAX( size.x, size.y ) - width;
track->m_Width = width; 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_End = track->m_Start; // m_Start = m_End = Spot center
track->m_Start.x = (track->m_Start.x + track->m_End.x) / 2; switch( pt_Dcode->m_Shape )
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 case GERB_LINE: // ne devrait pas etre utilis<69> ici
switch (pt_Dcode->m_Shape) case GERB_CIRCLE: /* spot rond (for GERBER)*/
{ track->m_Shape = S_SPOT_CIRCLE;
case GERB_LINE : // ne devrait pas etre utilis<69> ici break;
case GERB_CIRCLE : /* spot rond (for GERBER)*/
track->m_Shape = S_SPOT_CIRCLE;
break ;
case GERB_OVALE : /* spot ovale (for GERBER)*/ case GERB_OVALE: /* spot ovale (for GERBER)*/
track->m_Shape = S_SPOT_OVALE; track->m_Shape = S_SPOT_OVALE;
break ; break;
default: /* spot rect (for GERBER)*/ default: /* spot rect (for GERBER)*/
track->m_Shape = S_SPOT_RECT; track->m_Shape = S_SPOT_RECT;
break ; break;
} }
len >>= 1; len >>= 1;
if ( size.x > size.y ) if( size.x > size.y )
{ {
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; track->m_End.y += len;
track->m_End.y += len; }
} }
} }
}
} }
/*********************************************************/ /*********************************************************/
D_CODE * ReturnToolDescr(int layer, int Dcode, int * index) 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 )
if ( DcodeList && Dcode >= FIRST_DCODE && Dcode < MAX_TOOLS) *index = 0;
{ if( DcodeList && Dcode >= FIRST_DCODE && Dcode < MAX_TOOLS )
pt_dcode = DcodeList->m_Aperture_List[Dcode - FIRST_DCODE]; {
if ( index ) *index = Dcode - FIRST_DCODE + 1; pt_dcode = DcodeList->m_Aperture_List[Dcode - FIRST_DCODE];
} if( index )
return pt_dcode; *index = Dcode - FIRST_DCODE + 1;
}
return pt_dcode;
} }
/************************************************/ /************************************************/
void WinEDA_GerberFrame::Liste_D_Codes(wxDC * DC) void WinEDA_GerberFrame::Liste_D_Codes( wxDC* DC )
/************************************************/ /************************************************/
{ {
int ii, jj; int ii, jj;
D_CODE * pt_D_code ; 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;
/* Construction de la liste des messages */ /* Construction de la liste des messages */
List = new WinEDA_TextFrame(this, _("List D codes")); List = new WinEDA_TextFrame( this, _( "List D codes" ) );
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 )
if ( DcodeList->ReturnUsedDcodeNumber() == 0 ) continue;
continue; if( DcodeList->ReturnUsedDcodeNumber() == 0 )
if (layer == curr_layer ) continue;
Line.Printf( wxT("*** Active layer (%2.2d) ***"), layer+1); if( layer == curr_layer )
else Line.Printf( wxT("*** layer %2.2d ***"), layer+1); Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 );
List->Append(Line); else
Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
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;
Line.Printf( wxT( if( !pt_D_code->m_InUse && !pt_D_code->m_Defined )
"tool %2.2d: D%2.2d V %2.4f H %2.4f %s"), continue;
jj, Line.Printf( wxT(
pt_D_code->m_Num_Dcode, "tool %2.2d: D%2.2d V %2.4f H %2.4f %s" ),
(float)pt_D_code->m_Size.y /scale, jj,
(float)pt_D_code->m_Size.x /scale, pt_D_code->m_Num_Dcode,
g_GERBER_Tool_Type[pt_D_code->m_Shape] ); (float) pt_D_code->m_Size.y / scale,
if ( ! pt_D_code->m_Defined ) Line += wxT(" ?"); (float) pt_D_code->m_Size.x / scale,
if ( ! pt_D_code->m_InUse ) Line += wxT(" *"); g_GERBER_Tool_Type[pt_D_code->m_Shape] );
List->Append(Line); if( !pt_D_code->m_Defined )
jj++; Line += wxT( " ?" );
}
} if( !pt_D_code->m_InUse )
ii = List->ShowModal(); List->Destroy(); Line += wxT( " *" );
if (ii < 0) return;
List->Append( Line );
jj++;
}
}
ii = List->ShowModal(); List->Destroy();
if( ii < 0 )
return;
#if 0 #if 0
// Mise en surbrillance des <20>l<EFBFBD>ments correspondant au DCode s<>lectionn<6E>
if(Etat_Surbrillance) Hight_Light(DrawPanel, DC); // Mise en surbrillance des <20>l<EFBFBD>ments correspondant au DCode s<>lectionn<6E>
net_code_Surbrillance = (GetScreen()->m_Active_Layer<< 16) + ii; if( Etat_Surbrillance )
Hight_Light(DrawPanel, DC); Hight_Light( DrawPanel, DC );
net_code_Surbrillance = (GetScreen()->m_Active_Layer << 16) + ii;
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

@ -40,13 +40,16 @@ 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++;
if( !LoadOneGerberFile( wxEmptyString, &dc, 0 ) ) GetScreen()->m_Active_Layer++;
((PCB_SCREEN*)GetScreen())->m_Active_Layer = layer;
SetToolbars(); if( !LoadOneGerberFile( wxEmptyString, &dc, 0 ) )
} GetScreen()->m_Active_Layer = origLayer;
SetToolbars();
}
break; break;
case ID_MENU_APPEND_FILE: case ID_MENU_APPEND_FILE:

View File

@ -1,6 +1,6 @@
/******************************************************************/ /******************************************************************/
/* gerberframe.cpp - fonctions des classes du type WinEDA_GerberFrame */ /* gerberframe.cpp - fonctions des classes du type WinEDA_GerberFrame */
/******************************************************************/ /******************************************************************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
@ -17,300 +17,309 @@
#include "id.h" #include "id.h"
/****************************************/ /****************************************/
/* class WinEDA_GerberFrame for GerbView*/ /* class WinEDA_GerberFrame for GerbView*/
/****************************************/ /****************************************/
BEGIN_EVENT_TABLE(WinEDA_GerberFrame, wxFrame) BEGIN_EVENT_TABLE( WinEDA_GerberFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_SIZE( WinEDA_GerberFrame::OnSize )
EVT_CLOSE(WinEDA_GerberFrame::OnCloseWindow) EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
EVT_SIZE(WinEDA_GerberFrame::OnSize) WinEDA_GerberFrame::Process_Zoom )
EVT_TOOL_RANGE(ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL( ID_LOAD_FILE, WinEDA_GerberFrame::Files_io )
WinEDA_GerberFrame::Process_Zoom) EVT_TOOL( ID_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DCODE_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_SAVE_BOARD, WinEDA_GerberFrame::Files_io )
EVT_TOOL(ID_LOAD_FILE, WinEDA_GerberFrame::Files_io) EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END,
EVT_TOOL(ID_APPEND_FILE, WinEDA_GerberFrame::Files_io) WinEDA_DrawFrame::ProcessFontPreferences )
EVT_TOOL(ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io)
EVT_TOOL(ID_GERBVIEW_LOAD_DRILL_FILE, WinEDA_GerberFrame::Files_io)
EVT_TOOL(ID_GERBVIEW_LOAD_DCODE_FILE, WinEDA_GerberFrame::Files_io)
EVT_TOOL(ID_NEW_BOARD, WinEDA_GerberFrame::Files_io)
EVT_TOOL(ID_SAVE_BOARD, WinEDA_GerberFrame::Files_io)
EVT_MENU_RANGE(ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END, // Menu Files:
WinEDA_DrawFrame::ProcessFontPreferences) EVT_MENU( ID_MENU_LOAD_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_NEW_BOARD, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_SAVE_BOARD, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_SAVE_BOARD_AS, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_GEN_PLOT, WinEDA_GerberFrame::ToPlotter )
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, WinEDA_GerberFrame::ExportDataInPcbnewFormat )
// Menu Files: EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
EVT_MENU(ID_MENU_LOAD_FILE, WinEDA_GerberFrame::Files_io) WinEDA_GerberFrame::Files_io )
EVT_MENU(ID_MENU_APPEND_FILE, WinEDA_GerberFrame::Files_io)
EVT_MENU(ID_MENU_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io)
EVT_MENU(ID_MENU_NEW_BOARD, WinEDA_GerberFrame::Files_io)
EVT_MENU(ID_MENU_SAVE_BOARD, WinEDA_GerberFrame::Files_io)
EVT_MENU(ID_MENU_SAVE_BOARD_AS, WinEDA_GerberFrame::Files_io)
EVT_MENU(ID_GEN_PLOT, WinEDA_GerberFrame::ToPlotter)
EVT_MENU(ID_GERBVIEW_EXPORT_TO_PCBNEW, WinEDA_GerberFrame::ExportDataInPcbnewFormat)
EVT_MENU_RANGE(ID_LOAD_FILE_1,ID_LOAD_FILE_10, EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions )
WinEDA_GerberFrame::Files_io)
EVT_MENU(ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions) // menu Config
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END,
WinEDA_GerberFrame::Process_Config )
// menu Config EVT_MENU( ID_COLORS_SETUP, WinEDA_GerberFrame::Process_Config )
EVT_MENU_RANGE(ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END, EVT_MENU( ID_OPTIONS_SETUP, WinEDA_GerberFrame::Process_Config )
WinEDA_GerberFrame::Process_Config) EVT_MENU( ID_PCB_LOOK_SETUP, WinEDA_GerberFrame::Process_Config )
EVT_MENU(ID_COLORS_SETUP, WinEDA_GerberFrame::Process_Config) EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
EVT_MENU(ID_OPTIONS_SETUP, WinEDA_GerberFrame::Process_Config) WinEDA_DrawFrame::SetLanguage )
EVT_MENU(ID_PCB_LOOK_SETUP, WinEDA_GerberFrame::Process_Config)
EVT_MENU_RANGE(ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, // menu Postprocess
WinEDA_DrawFrame::SetLanguage) EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
// menu Postprocess EVT_MENU( ID_GERBVIEW_SHOW_SOURCE,
EVT_MENU(ID_GERBVIEW_SHOW_LIST_DCODES, WinEDA_GerberFrame::Process_Special_Functions) WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU(ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, WinEDA_GerberFrame::Process_Special_Functions)
EVT_MENU(ID_GERBVIEW_SHOW_SOURCE,
WinEDA_GerberFrame::Process_Special_Functions )
// 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
EVT_MENU(ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp)
EVT_MENU(ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout)
EVT_TOOL(ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings) // Menu Help
EVT_TOOL(wxID_CUT, WinEDA_GerberFrame::Process_Special_Functions) EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_TOOL(wxID_COPY, WinEDA_GerberFrame::Process_Special_Functions) EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
EVT_TOOL(wxID_PASTE, WinEDA_GerberFrame::Process_Special_Functions)
EVT_TOOL(ID_UNDO_BUTT, WinEDA_GerberFrame::Process_Special_Functions)
EVT_TOOL(ID_GEN_PRINT, WinEDA_GerberFrame::ToPrinter)
EVT_TOOL(ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions)
EVT_TOOL(ID_DRC_CONTROL, WinEDA_GerberFrame::Process_Special_Functions)
EVT_KICAD_CHOICEBOX(ID_TOOLBARH_PCB_SELECT_LAYER,
WinEDA_GerberFrame::Process_Special_Functions)
EVT_KICAD_CHOICEBOX(ID_TOOLBARH_GERBER_SELECT_TOOL, EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
WinEDA_GerberFrame::Process_Special_Functions) EVT_TOOL( wxID_CUT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_COPY, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_UNDO_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_GerberFrame::ToPrinter )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_DRC_CONTROL, WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBER_SELECT_TOOL,
WinEDA_GerberFrame::Process_Special_Functions )
// Vertical toolbar: // Vertical toolbar:
EVT_TOOL(ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions) EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL(ID_TRACK_BUTT, WinEDA_GerberFrame::Process_Special_Functions) EVT_TOOL( ID_TRACK_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL(ID_PCB_ZONES_BUTT, WinEDA_GerberFrame::Process_Special_Functions) EVT_TOOL( ID_PCB_ZONES_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL(ID_PCB_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions) EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
// Annulation de commande en cours // Annulation de commande en cours
EVT_MENU_RANGE(ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
// Pop up menu // Pop up menu
EVT_MENU(ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
// Option toolbar // Option toolbar
EVT_TOOL_RANGE(ID_TB_OPTIONS_START,ID_TB_OPTIONS_END, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_GerberFrame::OnSelectOptionToolbar) WinEDA_GerberFrame::OnSelectOptionToolbar )
// PopUp Menu trait<69>s dans drawpanel.cpp // PopUp Menu trait<69>s dans drawpanel.cpp
END_EVENT_TABLE() 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,
WinEDA_BasePcbFrame(father, parent, GERBER_FRAME, title, pos, size, style) const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style ) :
WinEDA_BasePcbFrame( father, parent, GERBER_FRAME, title, pos, size, style )
{ {
m_FrameName = wxT("GerberFrame"); m_FrameName = wxT( "GerberFrame" );
m_AboutTitle = g_GerbviewAboutTitle; m_AboutTitle = g_GerbviewAboutTitle;
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
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 )
// Give an icon DrawPanel->m_Block_Enable = TRUE;
#ifdef __WINDOWS__
SetIcon( wxICON(a_icon_gerbview));
#else
SetIcon( wxICON(icon_gerbview));
#endif
m_CurrentScreen = ActiveScreen = ScreenPcb; // Give an icon
#ifdef __WINDOWS__
SetIcon( wxICON( a_icon_gerbview ) );
#else
SetIcon( wxICON( icon_gerbview ) );
#endif
GetSettings(); SetBaseScreen( ActiveScreen = ScreenPcb );
SetSize(m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y);
ReCreateMenuBar(); GetSettings();
ReCreateHToolbar(); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
ReCreateVToolbar(); ReCreateMenuBar();
ReCreateOptToolbar(); ReCreateHToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
} }
WinEDA_GerberFrame::~WinEDA_GerberFrame() WinEDA_GerberFrame::~WinEDA_GerberFrame()
{ {
m_Parent->m_GerberFrame = NULL; m_Parent->m_GerberFrame = NULL;
m_CurrentScreen = ScreenPcb; SetBaseScreen( ScreenPcb );
} }
/***********************************************************/ /***********************************************************/
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() )
if(screen->IsModify()) break; break;
screen = screen->Next(); screen = screen->Next();
} }
if ( screen ) if( screen )
{ {
if( ! IsOK(this, _("Layer modified, Continue ?")) ) if( !IsOK( this, _( "Layer modified, Continue ?" ) ) )
{ {
Event.Veto(); Event.Veto();
return; return;
} }
} }
while( screen ) // suppression flag modify pour eviter d'autres message while( screen ) // suppression flag modify pour eviter d'autres message
{ {
screen->ClrModify(); screen->ClrModify();
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
*/ */
{ {
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 )
{ {
m_HToolBar->EnableTool(wxID_CUT,TRUE); m_HToolBar->EnableTool( wxID_CUT, TRUE );
m_HToolBar->EnableTool(wxID_COPY,TRUE); m_HToolBar->EnableTool( wxID_COPY, TRUE );
} }
else else
{ {
m_HToolBar->EnableTool(wxID_CUT,FALSE); m_HToolBar->EnableTool( wxID_CUT, FALSE );
m_HToolBar->EnableTool(wxID_COPY,FALSE); m_HToolBar->EnableTool( wxID_COPY, FALSE );
} }
if ( g_UnDeleteStackPtr ) if( g_UnDeleteStackPtr )
{ {
m_HToolBar->EnableTool(wxID_PASTE,TRUE); m_HToolBar->EnableTool( wxID_PASTE, TRUE );
m_HToolBar->EnableTool(ID_UNDO_BUTT,TRUE); m_HToolBar->EnableTool( ID_UNDO_BUTT, TRUE );
} }
else else
{ {
m_HToolBar->EnableTool(wxID_PASTE,FALSE); m_HToolBar->EnableTool( wxID_PASTE, FALSE );
m_HToolBar->EnableTool(ID_UNDO_BUTT,FALSE); m_HToolBar->EnableTool( ID_UNDO_BUTT, FALSE );
} }
if ( m_SelLayerBox->GetSelection() != ((PCB_SCREEN*)GetScreen())->m_Active_Layer ) if( m_SelLayerBox->GetSelection() != ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer )
{ {
m_SelLayerBox->SetSelection( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); m_SelLayerBox->SetSelection( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
} }
if ( Gerber_layer_descr ) if( Gerber_layer_descr )
{ {
int sel_index; int sel_index;
m_SelLayerTool->Enable(TRUE); m_SelLayerTool->Enable( TRUE );
if ( Gerber_layer_descr->m_Selected_Tool < FIRST_DCODE ) // No tool selected if( Gerber_layer_descr->m_Selected_Tool < FIRST_DCODE ) // No tool selected
sel_index = 0; sel_index = 0;
else else
sel_index = Gerber_layer_descr->m_Selected_Tool - FIRST_DCODE + 1; sel_index = Gerber_layer_descr->m_Selected_Tool - FIRST_DCODE + 1;
if ( sel_index != m_SelLayerTool->GetSelection() ) if( sel_index != m_SelLayerTool->GetSelection() )
{ {
m_SelLayerTool->SetSelection(sel_index); m_SelLayerTool->SetSelection( sel_index );
} }
} }
else else
{ {
m_SelLayerTool->SetSelection(0); m_SelLayerTool->SetSelection( 0 );
m_SelLayerTool->Enable(FALSE); m_SelLayerTool->Enable( FALSE );
} }
if ( m_OptionsToolBar ) if( m_OptionsToolBar )
{ {
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SELECT_UNIT_MM, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == MILLIMETRE ? TRUE : FALSE); g_UnitMetric == MILLIMETRE ? TRUE : FALSE );
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SELECT_UNIT_INCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UnitMetric == INCHES ? TRUE : FALSE); g_UnitMetric == INCHES ? TRUE : FALSE );
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_POLAR_COORD, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood); DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid); m_Draw_Grid );
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SELECT_CURSOR, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
g_CursorShape); g_CursorShape );
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_PADS_SKETCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
! m_DisplayPadFill); !m_DisplayPadFill );
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
! m_DisplayPcbTrackFill); !m_DisplayPcbTrackFill );
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
g_DisplayPolygonsModeSketch == 0 ? 0 : 1); g_DisplayPolygonsModeSketch == 0 ? 0 : 1 );
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_DCODES, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_DCODES,
DisplayOpt.DisplayPadNum); DisplayOpt.DisplayPadNum );
} }
DisplayUnitsMsg(); DisplayUnitsMsg();
} }
/*************************************/ /*************************************/
int WinEDA_GerberFrame::BestZoom() int WinEDA_GerberFrame::BestZoom()
/*************************************/ /*************************************/
{ {
int ii,jj ; int ii, jj;
int bestzoom; int bestzoom;
wxSize size; wxSize size;
/* calcul du zoom montrant tout le dessim */ /* calcul du zoom montrant tout le dessim */
m_Pcb->ComputeBoundaryBox(); m_Pcb->ComputeBoundaryBox();
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
ii = m_Pcb->m_BoundaryBox.GetWidth() / size.x; ii = m_Pcb->m_BoundaryBox.GetWidth() / size.x;
jj = m_Pcb->m_BoundaryBox.GetHeight() / size.y; jj = m_Pcb->m_BoundaryBox.GetHeight() / size.y;
bestzoom = MAX(ii, jj) + 1; bestzoom = MAX( ii, jj ) + 1;
/* 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; }
GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); bestzoom = ii;
return(bestzoom); GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre();
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
@ -89,5 +89,5 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
} }
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
return true; return true;
} }

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

@ -123,7 +123,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
_( "Save application preferences" ), save_setup_xpm ); _( "Save application preferences" ), save_setup_xpm );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu ); AddHotkeyConfigMenu( configmenu );
// Menu drill ( generation fichiers percage) // Menu drill ( generation fichiers percage)
@ -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,10 +65,16 @@ 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)
delete m_Pcb; delete m_Pcb;
m_Pcb = aBoard; m_Pcb = aBoard;
} }
@ -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" ) );
@ -347,7 +347,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
sprintf( Line, "orientation %.2f\n", (float) (pad->m_Orient - Module->m_Orient) / 10 ); sprintf( Line, "orientation %.2f\n", (float) (pad->m_Orient - Module->m_Orient) / 10 );
fputs( Line, rptfile ); fputs( Line, rptfile );
const char* shape_name[6] = const char* shape_name[6] =
{ "??? ", "Circ", "Rect", "Oval", "trap", "spec" }; { "??? ", "Circ", "Rect", "Oval", "trap", "spec" };
sprintf( Line, "Shape %s\n", shape_name[pad->m_PadShape] ); sprintf( Line, "Shape %s\n", shape_name[pad->m_PadShape] );
fputs( Line, rptfile ); fputs( Line, rptfile );

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

@ -49,9 +49,9 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
wxString CmpFullFileName; wxString CmpFullFileName;
FILE* dest; FILE* dest;
MODULE* module = NULL; MODULE* module = NULL;
bool Footprint_Is_GPCB_Format = false; bool Footprint_Is_GPCB_Format = false;
wxString mask = wxT("*.*;"); mask += EXT_CMP_MASK; wxString mask = wxT("*.*;"); mask += EXT_CMP_MASK;
wxString LastOpenedPathForLoading; wxString LastOpenedPathForLoading;
wxConfig* Config = m_Parent->m_EDA_Config; wxConfig* Config = m_Parent->m_EDA_Config;
if( Config ) if( Config )
@ -79,48 +79,48 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
return NULL; return NULL;
} }
if( Config ) // Save file path if( Config ) // Save file path
{ {
LastOpenedPathForLoading = wxPathOnly( CmpFullFileName ); LastOpenedPathForLoading = wxPathOnly( CmpFullFileName );
Config->Write( EXPORT_IMPORT_LASTPATH_KEY, LastOpenedPathForLoading ); Config->Write( EXPORT_IMPORT_LASTPATH_KEY, LastOpenedPathForLoading );
} }
/* Read header and test file type */ /* Read header and test file type */
GetLine( dest, Line, &NbLine ); GetLine( dest, Line, &NbLine );
if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 ) if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
{ {
if( strnicmp( Line, "Element", 7 ) == 0 ) if( strnicmp( Line, "Element", 7 ) == 0 )
Footprint_Is_GPCB_Format = true; Footprint_Is_GPCB_Format = true;
else else
{ {
fclose( dest ); fclose( dest );
DisplayError( this, _( "Not a module file" ) ); DisplayError( this, _( "Not a module file" ) );
return NULL; return NULL;
} }
} }
/* Read file: Search the description starting line (skip lib header)*/ /* Read file: Search the description starting line (skip lib header)*/
if ( ! Footprint_Is_GPCB_Format ) if ( ! Footprint_Is_GPCB_Format )
{ {
while( GetLine( dest, Line, &NbLine ) != NULL ) while( GetLine( dest, Line, &NbLine ) != NULL )
{ {
if( strnicmp( Line, "$MODULE", 7 ) == 0 ) if( strnicmp( Line, "$MODULE", 7 ) == 0 )
break; break;
} }
} }
module = new MODULE( m_Pcb ); module = new MODULE( m_Pcb );
if ( Footprint_Is_GPCB_Format ) if ( Footprint_Is_GPCB_Format )
{ {
fclose( dest ); fclose( dest );
module->Read_GPCB_Descr(CmpFullFileName); module->Read_GPCB_Descr(CmpFullFileName);
} }
else else
{ {
module->ReadDescr( dest, &NbLine ); module->ReadDescr( dest, &NbLine );
fclose( dest ); fclose( dest );
} }
/* Insert footprint in list*/ /* Insert footprint in list*/
if( m_Pcb->m_Modules ) if( m_Pcb->m_Modules )
@ -173,7 +173,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
if( createlib ) if( createlib )
path = g_RealLibDirBuffer; path = g_RealLibDirBuffer;
else if( Config ) else if( Config )
Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &path ); Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &path );
FullFileName = EDA_FileSelector( createlib ? _( "Create lib" ) : _( "Export Module:" ), FullFileName = EDA_FileSelector( createlib ? _( "Create lib" ) : _( "Export Module:" ),
@ -205,11 +205,11 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
return; return;
} }
if( ! createlib && Config ) // Save file path if( ! createlib && Config ) // Save file path
{ {
path = wxPathOnly( FullFileName ); path = wxPathOnly( FullFileName );
Config->Write( EXPORT_IMPORT_LASTPATH_KEY, path ); Config->Write( EXPORT_IMPORT_LASTPATH_KEY, path );
} }
fprintf( dest, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) ); fprintf( dest, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) );
fputs( "$INDEX\n", dest ); fputs( "$INDEX\n", dest );
@ -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

@ -359,7 +359,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
ref->m_Type = TEXT_is_REFERENCE; // just in case ... ref->m_Type = TEXT_is_REFERENCE; // just in case ...
if( ref->m_Text.Length() == 0 ) if( ref->m_Text.Length() == 0 )
ref->m_Text = L"Ref**"; ref->m_Text = L"Ref**";
val->m_Type = TEXT_is_VALUE; // just in case ... val->m_Type = TEXT_is_VALUE; // just in case ...
if( val->m_Text.Length() == 0 ) if( val->m_Text.Length() == 0 )
val->m_Text = L"Val**"; val->m_Text = L"Val**";
} }
@ -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) )
@ -368,7 +368,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
} }
return true; return true;
} }

View File

@ -109,7 +109,7 @@ END_EVENT_TABLE()
WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* parent, WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style ) : long style ) :
WinEDA_BasePcbFrame( father, parent, MODULE_EDITOR_FRAME, wxEmptyString, pos, size, style ) WinEDA_BasePcbFrame( father, parent, MODULE_EDITOR_FRAME, wxEmptyString, pos, size, style )
{ {
m_FrameName = wxT( "ModEditFrame" ); m_FrameName = wxT( "ModEditFrame" );
@ -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

@ -72,14 +72,14 @@ static wxMenu* Append_Track_Width_List()
trackwidth_menu = new wxMenu; trackwidth_menu = new wxMenu;
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, trackwidth_menu->Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH,
_( "Auto Width" ), _( "Auto Width" ),
_( _(
"Use the track width when starting on a track, otherwise the current track width" ), "Use the track width when starting on a track, otherwise the current track width" ),
TRUE ); TRUE );
if( g_DesignSettings.m_UseConnectedTrackWidth ) if( g_DesignSettings.m_UseConnectedTrackWidth )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, TRUE ); trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, TRUE );
for( ii = 0; (ii < HISTORY_NUMBER) && (ii < TRACK_HISTORY_NUMBER_MAX); ii++ ) for( ii = 0; (ii < HISTORY_NUMBER) && (ii < TRACK_HISTORY_NUMBER_MAX); ii++ )
{ {
@ -95,7 +95,7 @@ static wxMenu* Append_Track_Width_List()
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, TRUE ); trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, TRUE );
if( (g_DesignSettings.m_TrackWidthHistory[ii] == g_DesignSettings.m_CurrentTrackWidth) if( (g_DesignSettings.m_TrackWidthHistory[ii] == g_DesignSettings.m_CurrentTrackWidth)
&& ! g_DesignSettings.m_UseConnectedTrackWidth ) && ! g_DesignSettings.m_UseConnectedTrackWidth )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_WIDTH1 + ii, TRUE ); trackwidth_menu->Check( ID_POPUP_PCB_SELECT_WIDTH1 + ii, TRUE );
} }
@ -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 );
@ -286,15 +286,15 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
{ {
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE,
_( "Close Zone Outline" ), apply_xpm ); _( "Close Zone Outline" ), apply_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER,
_( "Delete Last Corner" ), delete_xpm ); _( "Delete Last Corner" ), delete_xpm );
} }
else else
createPopUpMenuForZones( (ZONE_CONTAINER*) item, aPopMenu ); createPopUpMenuForZones( (ZONE_CONTAINER*) item, aPopMenu );
break; break;
case TYPETEXTE: case TYPETEXTE:
createPopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu ); createPopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu );
break; break;
case TYPETRACK: case TYPETRACK:
@ -520,13 +520,13 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
ID_POPUP_PCB_VIA_EDITING, _( "Edit Via" ), edit_xpm ); ID_POPUP_PCB_VIA_EDITING, _( "Edit Via" ), edit_xpm );
ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT, ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT,
_( "Set via hole to Default" ), apply_xpm ); _( "Set via hole to Default" ), apply_xpm );
msg = _( "Set via hole to a specific value. This specfic value is currently" ); msg = _( "Set via hole to a specific value. This specfic value is currently" );
msg << wxT(" ") << ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_ViaDrillCustomValue, m_InternalUnits ); msg << wxT(" ") << ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_ViaDrillCustomValue, m_InternalUnits );
ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_VALUE, ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_VALUE,
_( "Set via hole to alt value" ), msg, _( "Set via hole to alt value" ), msg,
options_new_pad_xpm ); options_new_pad_xpm );
msg = _( "Set alt via hole value. This value is currently" ); msg = _( "Set alt via hole value. This value is currently" );
msg << wxT(" ") << ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_ViaDrillCustomValue, m_InternalUnits ); msg << wxT(" ") << ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_ViaDrillCustomValue, m_InternalUnits );
ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE, ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE,
_( "Set the via hole alt value" ), msg, edit_xpm ); _( "Set the via hole alt value" ), msg, edit_xpm );
ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_EXPORT, _( ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_EXPORT, _(
@ -594,10 +594,10 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
wxMenu* track_mnu; wxMenu* track_mnu;
if( !flags ) // track Width control : if( !flags ) // track Width control :
{ {
track_mnu = new wxMenu; track_mnu = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu, ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu,
ID_POPUP_PCB_EDIT_TRACK_MNU, _( "Change Width" ), width_track_xpm ); ID_POPUP_PCB_EDIT_TRACK_MNU, _( "Change Width" ), width_track_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG, ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG,
Track->Type()==TYPEVIA ? _( "Edit Via" ) : _( "Edit Segment" ), width_segment_xpm ); Track->Type()==TYPEVIA ? _( "Edit Via" ) : _( "Edit Segment" ), width_segment_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACK, ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACK,

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 );
@ -232,7 +232,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
GridSize.y = SizeY; GridSize.y = SizeY;
} }
m_Parent->m_EDA_Config->Read( wxT( "PcbMagPadOpt" ), &g_MagneticPadOption ); m_Parent->m_EDA_Config->Read( wxT( "PcbMagPadOpt" ), &g_MagneticPadOption );
m_Parent->m_EDA_Config->Read( wxT( "PcbMagTrackOpt" ), &g_MagneticTrackOption ); m_Parent->m_EDA_Config->Read( wxT( "PcbMagTrackOpt" ), &g_MagneticTrackOption );
} }
GetScreen()->SetGrid( GridSize ); GetScreen()->SetGrid( GridSize );
@ -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 )
@ -313,7 +316,7 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
m_Parent->m_EDA_Config->Write( wxT( "PcbEditGrid_X" ), (long) GridSize.x ); m_Parent->m_EDA_Config->Write( wxT( "PcbEditGrid_X" ), (long) GridSize.x );
m_Parent->m_EDA_Config->Write( wxT( "PcbEditGrid_Y" ), (long) GridSize.y ); m_Parent->m_EDA_Config->Write( wxT( "PcbEditGrid_Y" ), (long) GridSize.y );
m_Parent->m_EDA_Config->Write( wxT( "PcbMagPadOpt" ), (long) g_MagneticPadOption ); m_Parent->m_EDA_Config->Write( wxT( "PcbMagPadOpt" ), (long) g_MagneticPadOption );
m_Parent->m_EDA_Config->Write( wxT( "PcbMagTrackOpt" ), (long) g_MagneticTrackOption ); m_Parent->m_EDA_Config->Write( wxT( "PcbMagTrackOpt" ), (long) g_MagneticTrackOption );
} }
Destroy(); Destroy();
} }
@ -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;
} }
@ -130,9 +130,9 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
InitPlotParametresHPGL( g_PlotOffset, scale_x, scale_y, g_PlotOrient ); InitPlotParametresHPGL( g_PlotOffset, scale_x, scale_y, g_PlotOrient );
// Specify that the contents of the "Edges Pcb" layer are to be plotted // Specify that the contents of the "Edges Pcb" layer are to be plotted
// in addition to the contents of the currently specified layer. // in addition to the contents of the currently specified layer.
int layer_mask = g_TabOneLayerMask[Layer] | EDGE_LAYER; int layer_mask = g_TabOneLayerMask[Layer] | EDGE_LAYER;
switch( Layer ) switch( Layer )
{ {

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

@ -84,13 +84,13 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
SetSize( 0, 0, minsize.x, minsize.y ); SetSize( 0, 0, minsize.x, minsize.y );
// Creation de la ligne de status // Creation de la ligne de status
#define ZOOM_DISPLAY_SIZE 60 #define ZOOM_DISPLAY_SIZE 60
#define COORD_DISPLAY_SIZE 140 #define COORD_DISPLAY_SIZE 140
#define UNITS_DISPLAY_SIZE 50 #define UNITS_DISPLAY_SIZE 50
#define FUNCTION_DISPLAY_SIZE 100 #define FUNCTION_DISPLAY_SIZE 100
static const int dims[6] = { -1, ZOOM_DISPLAY_SIZE, static const int dims[6] = { -1, ZOOM_DISPLAY_SIZE,
COORD_DISPLAY_SIZE, COORD_DISPLAY_SIZE, COORD_DISPLAY_SIZE, COORD_DISPLAY_SIZE,
UNITS_DISPLAY_SIZE, FUNCTION_DISPLAY_SIZE }; UNITS_DISPLAY_SIZE, FUNCTION_DISPLAY_SIZE };
CreateStatusBar( 6 ); CreateStatusBar( 6 );
SetStatusWidths( 6, dims ); SetStatusWidths( 6, dims );
@ -137,10 +137,10 @@ void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu )
fonts_xpm ); fonts_xpm );
ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_STATUS, _( "font for Status Line" ), ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_STATUS, _( "font for Status Line" ),
fonts_xpm ); fonts_xpm );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu, fontmenu, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu, fontmenu,
ID_PREFERENCES_FONT, _("&Font selection"), ID_PREFERENCES_FONT, _("&Font selection"),
_("Choose font type and size for dialogs, infos and status box"), _("Choose font type and size for dialogs, infos and status box"),
fonts_xpm ); fonts_xpm );
} }
@ -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();
} }
@ -584,15 +566,16 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type )
* replac<EFBFBD> au centre de l'ecran * replac<EFBFBD> au centre de l'ecran
*/ */
{ {
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 );
} }
@ -883,26 +869,27 @@ void WinEDA_DrawFrame::Affiche_Status_Box()
/* Routine d'affichage du zoom et des coord curseur. /* Routine d'affichage du zoom et des coord curseur.
*/ */
{ {
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,12 +116,13 @@ 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();
msg.Printf(format, m_Screen->m_NumberOfScreen); msg.Printf(format, m_Screen->m_NumberOfScreen);
@ -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,9 +384,9 @@ 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 )
{ {
case MODULE_EDITOR_FRAME: case MODULE_EDITOR_FRAME:
@ -395,21 +395,21 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
case CVPCB_DISPLAY_FRAME: case CVPCB_DISPLAY_FRAME:
for( ii = 0; ; ii++ ) for( ii = 0; ; ii++ )
{ {
if ( grid_list_pcb[ii].m_Value ) if ( grid_list_pcb[ii].m_Value )
{ {
double grid_value = To_User_Unit(g_UnitMetric, grid_list_pcb[ii].m_Value, double grid_value = To_User_Unit(g_UnitMetric, grid_list_pcb[ii].m_Value,
((WinEDA_DrawFrame*)m_Parent)->m_InternalUnits); ((WinEDA_DrawFrame*)m_Parent)->m_InternalUnits);
if ( g_UnitMetric == 0) // inches if ( g_UnitMetric == 0) // inches
line.Printf(wxT("%g mils"), grid_value*1000); line.Printf(wxT("%g mils"), grid_value*1000);
else else
line.Printf(wxT("%g mm"), grid_value); line.Printf(wxT("%g mm"), grid_value);
} }
else line = _("grid user"); else line = _("grid user");
msg = grid_msg + line; msg = grid_msg + line;
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;
} }
@ -425,12 +425,12 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
{ {
if( grid_list_schematic[ii].m_Value <= 0 ) if( grid_list_schematic[ii].m_Value <= 0 )
break; break;
double grid_value = To_User_Unit(g_UnitMetric, grid_list_schematic[ii].m_Value, double grid_value = To_User_Unit(g_UnitMetric, grid_list_schematic[ii].m_Value,
((WinEDA_DrawFrame*)m_Parent)->m_InternalUnits); ((WinEDA_DrawFrame*)m_Parent)->m_InternalUnits);
if ( g_UnitMetric == 0) // inches if ( g_UnitMetric == 0) // inches
line.Printf(wxT("%g mils"), grid_value*1000); line.Printf(wxT("%g mils"), grid_value*1000);
else else
line.Printf(wxT("%g mm"), grid_value); line.Printf(wxT("%g mm"), grid_value);
msg = grid_msg + line; msg = grid_msg + line;
grid_choice->Append( grid_list_schematic[ii].m_Id, grid_choice->Append( grid_list_schematic[ii].m_Id,