diff --git a/change_log.txt b/change_log.txt index ba4caa1f36..fa3773cac5 100644 --- a/change_log.txt +++ b/change_log.txt @@ -5,16 +5,31 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2008-Apr-17 UPDATE Dick Hollenbeck +================================================================================ ++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 ::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) from + void ::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 ================================================================================ +eeschema - very small bug in display component info removed - + very small bug in display component info removed +pcbnew +cvpcb 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 diff --git a/common/block_commande.cpp b/common/block_commande.cpp index 16d9709677..48a66d8927 100644 --- a/common/block_commande.cpp +++ b/common/block_commande.cpp @@ -131,7 +131,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key, * 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) || ( 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 */ { DisplayError( this, wxT( "No Block to paste" ), 20 ); - GetScreen()->BlockLocate.m_Command = BLOCK_IDLE; + GetBaseScreen()->BlockLocate.m_Command = BLOCK_IDLE; DrawPanel->ManageCurseur = NULL; return TRUE; } diff --git a/common/copy_to_clipboard.cpp b/common/copy_to_clipboard.cpp index 7eee4a0066..64d6d38ca0 100644 --- a/common/copy_to_clipboard.cpp +++ b/common/copy_to_clipboard.cpp @@ -42,7 +42,7 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event ) 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->m_PanelDefaultCursor ) ); diff --git a/common/worksheet.cpp b/common/worksheet.cpp index bfcaa81918..99b53feca5 100644 --- a/common/worksheet.cpp +++ b/common/worksheet.cpp @@ -321,7 +321,7 @@ wxString WinEDA_DrawFrame::GetScreenDesc() { wxString msg; - msg << GetScreen()->m_ScreenNumber << wxT( "/" ) << - GetScreen()->m_NumberOfScreen; + msg << GetBaseScreen()->m_ScreenNumber << wxT( "/" ) + << GetBaseScreen()->m_NumberOfScreen; return msg; } diff --git a/cvpcb/cvstruct.h b/cvpcb/cvstruct.h index a011b5a47c..a36345341d 100644 --- a/cvpcb/cvstruct.h +++ b/cvpcb/cvstruct.h @@ -1,7 +1,7 @@ - /***********************************************************/ - /* wxstruct.h: */ - /* descriptions des principales classes derivees utilisees */ - /***********************************************************/ +/***********************************************************/ +/* wxstruct.h: */ +/* descriptions des principales classes derivees utilisees */ +/***********************************************************/ #ifndef CVSTRUCT_H #define CVSTRUCT_H @@ -21,191 +21,191 @@ class STORECMP; #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: - FootprintListBox * m_FootprintList; - ListBoxCmp * m_ListCmp; - WinEDA_DisplayFrame * DrawFrame; - WinEDA_Toolbar * m_HToolBar; // Toolbar horizontal haut d'ecran + FootprintListBox* m_FootprintList; + ListBoxCmp* m_ListCmp; + WinEDA_DisplayFrame* DrawFrame; + WinEDA_Toolbar* m_HToolBar; // Toolbar horizontal haut d'ecran private: - wxMenu * m_FilesMenu; + wxMenu* m_FilesMenu; - // Constructor and destructor + // Constructor and destructor public: - WinEDA_CvpcbFrame(WinEDA_App * parent, const wxString & title, - long style = KICAD_DEFAULT_DRAWFRAME_STYLE); - ~WinEDA_CvpcbFrame(); + WinEDA_CvpcbFrame( WinEDA_App * parent, const wxString &title, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); + ~WinEDA_CvpcbFrame(); - void OnLeftClick(wxListEvent & event); - void OnLeftDClick(wxListEvent & event); - void OnSelectComponent(wxListEvent & event); + void OnLeftClick( wxListEvent& event ); + void OnLeftDClick( wxListEvent& event ); + void OnSelectComponent( wxListEvent& event ); - void Update_Config(wxCommandEvent& event);/* enregistrement de la config */ - void OnQuit(wxCommandEvent& event); - void OnCloseWindow(wxCloseEvent & Event); - void OnSize(wxSizeEvent& SizeEvent); - void OnChar(wxKeyEvent& event); - void ReCreateHToolbar(); - virtual void ReCreateMenuBar(); - void SetLanguage(wxCommandEvent& event); - void AddFontSelectionMenu(wxMenu * main_menu); - void ProcessFontPreferences(wxCommandEvent& event); + void Update_Config( wxCommandEvent& event ); /* enregistrement de la config */ + void OnQuit( wxCommandEvent& event ); + void OnCloseWindow( wxCloseEvent& Event ); + void OnSize( wxSizeEvent& SizeEvent ); + void OnChar( wxKeyEvent& event ); + void ReCreateHToolbar(); + virtual void ReCreateMenuBar(); + void SetLanguage( wxCommandEvent& event ); + void AddFontSelectionMenu( wxMenu* main_menu ); + void ProcessFontPreferences( wxCommandEvent& event ); - void ToFirstNA(wxCommandEvent& event); - void ToPreviousNA(wxCommandEvent& event); - void DelAssociations(wxCommandEvent& event); - void SaveQuitCvpcb(wxCommandEvent& event); - void LoadNetList(wxCommandEvent& event); - void ConfigCvpcb(wxCommandEvent& event); - void DisplayModule(wxCommandEvent& event); - void AssocieModule(wxCommandEvent& event); - void WriteStuffList(wxCommandEvent & event); - void DisplayDocFile(wxCommandEvent & event); - void OnSelectFilteringFootprint(wxCommandEvent & event); - void SetNewPkg(const wxString & package); - void BuildCmpListBox(); - void BuildFootprintListBox(); - void CreateScreenCmp(); - void CreateConfigWindow(); - int SaveNetList(const wxString & FullFileName); - int SaveComponentList(const wxString & FullFileName); - bool ReadInputNetList(const wxString & FullFileName); - void ReadNetListe(); - int rdpcad(); - int ReadSchematicNetlist(); - int ReadFootprintFilterList( FILE * f); - int ReadViewlogicWirList(); - int ReadViewlogicNetList(); + void ToFirstNA( wxCommandEvent& event ); + void ToPreviousNA( wxCommandEvent& event ); + void DelAssociations( wxCommandEvent& event ); + void SaveQuitCvpcb( wxCommandEvent& event ); + void LoadNetList( wxCommandEvent& event ); + void ConfigCvpcb( wxCommandEvent& event ); + void DisplayModule( wxCommandEvent& event ); + void AssocieModule( wxCommandEvent& event ); + void WriteStuffList( wxCommandEvent& event ); + void DisplayDocFile( wxCommandEvent& event ); + void OnSelectFilteringFootprint( wxCommandEvent& event ); + void SetNewPkg( const wxString& package ); + void BuildCmpListBox(); + void BuildFootprintListBox(); + void CreateScreenCmp(); + void CreateConfigWindow(); + int SaveNetList( const wxString& FullFileName ); + int SaveComponentList( const wxString& FullFileName ); + bool ReadInputNetList( const wxString& FullFileName ); + void ReadNetListe(); + int rdpcad(); + int ReadSchematicNetlist(); + int ReadFootprintFilterList( FILE* f ); + int ReadViewlogicWirList(); + int ReadViewlogicNetList(); - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; /***********************************************/ /* ListBox derivee pour l'affichage des listes */ /***********************************************/ -class ListBoxBase: public LIST_BOX_TYPE +class ListBoxBase : public LIST_BOX_TYPE { public: - WinEDA_CvpcbFrame * m_Parent; + WinEDA_CvpcbFrame* m_Parent; public: - ListBoxBase(WinEDA_CvpcbFrame * parent, wxWindowID id, - const wxPoint& loc, const wxSize& size); + ListBoxBase( WinEDA_CvpcbFrame * parent, wxWindowID id, + const wxPoint &loc, const wxSize &size ); - ~ListBoxBase(); + ~ListBoxBase(); - int GetSelection(); - void OnSize(wxSizeEvent& event); + int GetSelection(); + void OnSize( wxSizeEvent& event ); }; /************************************************************/ /* ListBox derivee pour l'affichage de la liste des Modules */ /************************************************************/ -class FootprintListBox: public ListBoxBase +class FootprintListBox : public ListBoxBase { private: - wxArrayString m_FullFootprintList; - wxArrayString m_FilteredFootprintList; + wxArrayString m_FullFootprintList; + wxArrayString m_FilteredFootprintList; public: - wxArrayString * m_ActiveFootprintList; - bool m_UseFootprintFullList; + wxArrayString* m_ActiveFootprintList; + bool m_UseFootprintFullList; public: - FootprintListBox(WinEDA_CvpcbFrame * parent, - wxWindowID id, const wxPoint& loc, const wxSize& size, - int nbitems, wxString choice[]); - ~FootprintListBox(); + FootprintListBox( WinEDA_CvpcbFrame * parent, + wxWindowID id, const wxPoint &loc, const wxSize &size, + int nbitems, wxString choice[] ); + ~FootprintListBox(); - int GetCount(); - void SetSelection(unsigned index, bool State = TRUE); - void SetString(unsigned linecount, const wxString & text); - void AppendLine(const wxString & text); - void SetFootprintFullList(); - void SetFootprintFilteredList(STORECMP * Component); - void SetActiveFootprintList(bool FullList, bool Redraw = FALSE); + int GetCount(); + void SetSelection( unsigned index, bool State = TRUE ); + void SetString( unsigned linecount, const wxString& text ); + void AppendLine( const wxString& text ); + void SetFootprintFullList(); + void SetFootprintFilteredList( STORECMP* Component ); + void SetActiveFootprintList( bool FullList, bool Redraw = FALSE ); - wxString GetSelectedFootprint(); - wxString OnGetItemText(long item, long column) const; - void OnLeftClick(wxListEvent & event); - void OnLeftDClick(wxListEvent & event); - DECLARE_EVENT_TABLE() + wxString GetSelectedFootprint(); + wxString OnGetItemText( long item, long column ) const; + void OnLeftClick( wxListEvent& event ); + void OnLeftDClick( wxListEvent& event ); + + DECLARE_EVENT_TABLE() }; /***************************************************************/ /* ListBox derivee pour l'affichage de la liste des Composants */ /***************************************************************/ -class ListBoxCmp: public ListBoxBase +class ListBoxCmp : public ListBoxBase { public: - wxArrayString m_ComponentList; - WinEDA_CvpcbFrame * m_Parent; + wxArrayString m_ComponentList; + WinEDA_CvpcbFrame* m_Parent; public: - ListBoxCmp(WinEDA_CvpcbFrame * parent, wxWindowID id, - const wxPoint& loc, const wxSize& size, - int nbitems, wxString choice[]); + ListBoxCmp( WinEDA_CvpcbFrame * parent, wxWindowID id, + const wxPoint &loc, const wxSize &size, + int nbitems, wxString choice[] ); - ~ListBoxCmp(); + ~ListBoxCmp(); - void Clear(); - int GetCount(); - wxString OnGetItemText(long item, long column) const; - void SetSelection(unsigned index, bool State = TRUE); - void SetString(unsigned linecount, const wxString & text); - void AppendLine(const wxString & text); + void Clear(); + int GetCount(); + wxString OnGetItemText( long item, long column ) const; + void SetSelection( unsigned index, bool State = TRUE ); + void SetString( unsigned linecount, 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: - WinEDA_DisplayFrame( wxWindow * father, WinEDA_App *parent, - const wxString & title, - const wxPoint& pos, const wxSize& size, - long style = KICAD_DEFAULT_DRAWFRAME_STYLE); + WinEDA_DisplayFrame( wxWindow * father, WinEDA_App * parent, + const wxString &title, + const wxPoint &pos, const wxSize &size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); - ~WinEDA_DisplayFrame(); + ~WinEDA_DisplayFrame(); - void OnCloseWindow(wxCloseEvent & Event); - void Process_Special_Functions(wxCommandEvent& event); - void RedrawActiveWindow(wxDC * DC, bool EraseBg); - void ReCreateHToolbar(); - void ReCreateVToolbar(); - void RecreateMenuBar(); - void OnLeftClick(wxDC * DC, const wxPoint& MousePos); - void OnLeftDClick(wxDC * DC, const wxPoint& MousePos); - bool OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu); - void SetToolbars(); - void GeneralControle( wxDC* DC, wxPoint Mouse ); - void InstallOptionsDisplay(wxCommandEvent& event); - MODULE * Get_Module(const wxString & CmpName); + void OnCloseWindow( wxCloseEvent& Event ); + void Process_Special_Functions( wxCommandEvent& event ); + void RedrawActiveWindow( wxDC* DC, bool EraseBg ); + void ReCreateHToolbar(); + void ReCreateVToolbar(); + void RecreateMenuBar(); + void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); + void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); + bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); + void SetToolbars(); + void GeneralControle( wxDC* DC, wxPoint Mouse ); + void InstallOptionsDisplay( wxCommandEvent& event ); + MODULE* Get_Module( const wxString& CmpName ); - void Process_Settings(wxCommandEvent& event); - void Show3D_Frame(wxCommandEvent& event); + void Process_Settings( wxCommandEvent& event ); + void Show3D_Frame( wxCommandEvent& event ); - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; -#endif //#ifndef CVSTRUCT_H - +#endif //#ifndef CVSTRUCT_H diff --git a/cvpcb/displayframe.cpp b/cvpcb/displayframe.cpp index 596ea2223f..98a5ff47b4 100644 --- a/cvpcb/displayframe.cpp +++ b/cvpcb/displayframe.cpp @@ -53,7 +53,7 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent, m_Pcb = new BOARD( NULL, this ); - m_CurrentScreen = new PCB_SCREEN( CVPCB_DISPLAY_FRAME ); + SetBaseScreen( new PCB_SCREEN( CVPCB_DISPLAY_FRAME ) ); GetSettings(); 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() /******************************************/ - -// Destructor { - delete m_CurrentScreen; + delete GetBaseScreen(); + SetBaseScreen( 0 ); delete m_Pcb; @@ -177,14 +176,14 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) { wxSize delta; int flagcurseur = 0; - int zoom = m_CurrentScreen->GetZoom(); + int zoom = GetScreen()->GetZoom(); wxPoint curpos, oldpos; curpos = DrawPanel->CursorRealPosition( Mouse ); - oldpos = m_CurrentScreen->m_Curseur; + oldpos = GetScreen()->m_Curseur; - delta.x = m_CurrentScreen->GetGrid().x / zoom; - delta.y = m_CurrentScreen->GetGrid().y / zoom; + delta.x = GetScreen()->GetGrid().x / zoom; + delta.y = GetScreen()->GetGrid().y / zoom; if( delta.x <= 0 ) delta.x = 1; if( delta.y <= 0 ) @@ -197,13 +196,13 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) case WXK_F1: OnZoom( ID_ZOOM_IN_KEY ); flagcurseur = 2; - curpos = m_CurrentScreen->m_Curseur; + curpos = GetScreen()->m_Curseur; break; case WXK_F2: OnZoom( ID_ZOOM_OUT_KEY ); flagcurseur = 2; - curpos = m_CurrentScreen->m_Curseur; + curpos = GetScreen()->m_Curseur; break; case WXK_F3: @@ -214,11 +213,11 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) case WXK_F4: OnZoom( ID_ZOOM_CENTER_KEY ); flagcurseur = 2; - curpos = m_CurrentScreen->m_Curseur; + curpos = GetScreen()->m_Curseur; break; case ' ': - m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur; + GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; break; 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 */ - PutOnGrid( &m_CurrentScreen->m_Curseur ); + PutOnGrid( &GetScreen()->m_Curseur ); - if( m_CurrentScreen->IsRefreshReq() ) + if( GetScreen()->IsRefreshReq() ) { flagcurseur = 2; RedrawActiveWindow( DC, TRUE ); } - if( (oldpos.x != m_CurrentScreen->m_Curseur.x) - || (oldpos.y != m_CurrentScreen->m_Curseur.y) ) + if( (oldpos.x != GetScreen()->m_Curseur.x) + || (oldpos.y != GetScreen()->m_Curseur.y) ) { if( flagcurseur != 2 ) { - curpos = m_CurrentScreen->m_Curseur; - m_CurrentScreen->m_Curseur = oldpos; + curpos = GetScreen()->m_Curseur; + GetScreen()->m_Curseur = oldpos; DrawPanel->CursorOff( DC ); - m_CurrentScreen->m_Curseur = curpos; + GetScreen()->m_Curseur = curpos; DrawPanel->CursorOn( DC ); } diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 681e7e8758..44afb4c6b7 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -479,7 +479,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, { DrawBlockStruct* PtBlock; DrawPickedStruct* PickedList; - BASE_SCREEN* screen = panel->m_Parent->GetScreen(); + BASE_SCREEN* screen = panel->GetScreen(); PtBlock = &panel->GetScreen()->BlockLocate; GRSetDrawMode( DC, g_XorMode ); diff --git a/eeschema/block_libedit.cpp b/eeschema/block_libedit.cpp index 4ac9631d89..9b6e3d2c49 100644 --- a/eeschema/block_libedit.cpp +++ b/eeschema/block_libedit.cpp @@ -50,7 +50,7 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent, /* Mark items inside rect. * Items are inside rect when an end point is inside rect - * + * * Rules for convert drawings and other parts ( for multi part per package): * - Commons are always marked * - Specific graphic shapes must agree with the current displayed part and convert @@ -435,7 +435,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, */ { DrawBlockStruct* PtBlock; - BASE_SCREEN* screen = panel->m_Parent->GetScreen(); + BASE_SCREEN* screen = panel->GetScreen(); LibEDA_BaseStruct* item; wxPoint move_offset; @@ -594,7 +594,7 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) ( (LibDrawText*) item )->m_Pos.x += offset.x; ( (LibDrawText*) item )->m_Pos.y += offset.y; break; - + default: ; } @@ -704,7 +704,7 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: SETMIRROR( ( (LibDrawText*) item )->m_Pos.x ); break; - + default: ; } diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index f361553b98..2c02671c5e 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -370,7 +370,7 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) */ { EDA_DrawLineStruct* CurrentLine = - (EDA_DrawLineStruct*) panel->m_Parent->GetScreen()->GetCurItem(); + (EDA_DrawLineStruct*) panel->GetScreen()->GetCurItem(); EDA_DrawLineStruct* segment; 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: */ { ComputeBreakPoint( CurrentLine, endpos ); @@ -463,11 +463,11 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras */ { DrawPolylineStruct* NewPoly = - (DrawPolylineStruct*) panel->m_Parent->GetScreen()->GetCurItem(); + (DrawPolylineStruct*) panel->GetScreen()->GetCurItem(); int color; wxPoint endpos; - endpos = panel->m_Parent->GetScreen()->m_Curseur; + endpos = panel->GetScreen()->m_Curseur; color = ReturnLayerColor( NewPoly->GetLayer() ); GRSetDrawMode( DC, g_XorMode ); diff --git a/eeschema/busentry.cpp b/eeschema/busentry.cpp index a2a66af483..0622b3ec61 100644 --- a/eeschema/busentry.cpp +++ b/eeschema/busentry.cpp @@ -56,7 +56,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) /* 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(); if( BusEntry == NULL ) diff --git a/eeschema/class_drawsheet.cpp b/eeschema/class_drawsheet.cpp index 4bc7dda405..427d99082d 100644 --- a/eeschema/class_drawsheet.cpp +++ b/eeschema/class_drawsheet.cpp @@ -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:*/ if( m_Flags & IS_NEW ) { - if( !( (WinEDA_SchematicFrame*) frame )->EditSheet( this, DC ) ) + if( !frame->EditSheet( this, DC ) ) { frame->GetScreen()->SetCurItem( NULL ); frame->DrawPanel->ManageCurseur = NULL; diff --git a/eeschema/class_drawsheet.h b/eeschema/class_drawsheet.h index 1117bbf6c5..5006c7cda5 100644 --- a/eeschema/class_drawsheet.h +++ b/eeschema/class_drawsheet.h @@ -40,13 +40,13 @@ public: Hierarchical_PIN_Sheet_Struct* Next() { 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, int draw_mode, int Color = -1 ); /** * 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. * @return bool - true if success writing else false. */ @@ -99,7 +99,7 @@ public: */ bool Save( FILE* aFile ) const; - void Place( WinEDA_DrawFrame* frame, wxDC* DC ); + void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); DrawSheetStruct* GenCopy(); void Display_Infos( WinEDA_DrawFrame* frame ); void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC ); diff --git a/eeschema/class_screen.cpp b/eeschema/class_screen.cpp index 22b53fe622..c5ecf4200d 100644 --- a/eeschema/class_screen.cpp +++ b/eeschema/class_screen.cpp @@ -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. @@ -52,12 +52,12 @@ void SCH_ITEM::Place( WinEDA_DrawFrame* frame, wxDC* DC ) { 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! screen->AddToDrawList( this ); g_ItemToRepeat = this; if( frame->m_Ident == SCHEMATIC_FRAME ) - ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_NEW ); + frame->SaveCopyInUndoList( this, IS_NEW ); } m_Flags = 0; diff --git a/eeschema/class_text-label.cpp b/eeschema/class_text-label.cpp index c0b858cfbd..33fd4af40a 100644 --- a/eeschema/class_text-label.cpp +++ b/eeschema/class_text-label.cpp @@ -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 */ @@ -104,7 +104,7 @@ void SCH_TEXT::Place( WinEDA_DrawFrame* frame, wxDC* DC ) SwapData( (SCH_TEXT*) g_ItemToUndoCopy ); /* save in undo list */ - ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED ); + frame->SaveCopyInUndoList( this, IS_CHANGED ); /* restore new values */ SwapData( (SCH_TEXT*) g_ItemToUndoCopy ); diff --git a/eeschema/class_text-label.h b/eeschema/class_text-label.h index 1e3b835988..8b2d4a4a9f 100644 --- a/eeschema/class_text-label.h +++ b/eeschema/class_text-label.h @@ -101,7 +101,7 @@ public: void SwapData( SCH_TEXT* copyitem ); - virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); + void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); EDA_Rect GetBoundingBox(); /** diff --git a/eeschema/component_class.cpp b/eeschema/component_class.cpp index 57a35fcc99..7e31b84838 100644 --- a/eeschema/component_class.cpp +++ b/eeschema/component_class.cpp @@ -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 */ @@ -430,7 +430,7 @@ void SCH_COMPONENT::Place( WinEDA_DrawFrame* frame, wxDC* DC ) SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy ); /* save in undo list */ - ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED ); + frame->SaveCopyInUndoList( this, IS_CHANGED ); /* restore new values */ SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy ); diff --git a/eeschema/component_class.h b/eeschema/component_class.h index 095079c9a9..1000de9172 100644 --- a/eeschema/component_class.h +++ b/eeschema/component_class.h @@ -57,7 +57,7 @@ public: void PartTextCopy( PartTextStruct* target ); - void Place( WinEDA_DrawFrame* frame, wxDC* DC ); + void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); EDA_Rect GetBoundaryBox() const; bool IsVoid(); @@ -136,13 +136,13 @@ public: bool Save( FILE* aFile ) const; SCH_COMPONENT* GenCopy(); - void SetRotationMiroir( int type ); - int GetRotationMiroir(); - wxPoint GetScreenCoord( const wxPoint& coord ); - void Display_Infos( WinEDA_DrawFrame* frame ); - void ClearAnnotation(); - EDA_Rect GetBoundaryBox() const; - EDA_Rect GetBoundingBox(); + void SetRotationMiroir( int type ); + int GetRotationMiroir(); + wxPoint GetScreenCoord( const wxPoint& coord ); + void Display_Infos( WinEDA_DrawFrame* frame ); + void ClearAnnotation(); + EDA_Rect GetBoundaryBox() const; + EDA_Rect GetBoundingBox(); const wxString& ReturnFieldName( int aFieldNdx ) const; @@ -164,7 +164,7 @@ public: 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. diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 99f461e5d1..1579f31bc0 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -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; - SCH_SCREEN* screen = (SCH_SCREEN*)GetScreen(); - int zoom = screen->GetZoom(); - wxPoint curpos, oldpos; - int hotkey = 0; + wxSize delta; + SCH_SCREEN* screen = GetScreen(); + int zoom = screen->GetZoom(); + wxPoint curpos, oldpos; + int hotkey = 0; curpos = screen->m_MousePosition; oldpos = screen->m_Curseur; @@ -323,7 +323,7 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels curpos = screen->m_Curseur; screen->m_Curseur = oldpos; DrawPanel->CursorOff( DC ); - GetScreen()->m_Curseur = curpos; + screen->m_Curseur = curpos; DrawPanel->CursorOn( DC ); if( DrawPanel->ManageCurseur ) diff --git a/eeschema/dialog_options.cpp b/eeschema/dialog_options.cpp index c533aa008e..6312816aa6 100644 --- a/eeschema/dialog_options.cpp +++ b/eeschema/dialog_options.cpp @@ -1,17 +1,18 @@ ///////////////////////////////////////////////////////////////////////////// + // Name: dialog_options.cpp -// Purpose: +// Purpose: // Author: jean-pierre Charras -// Modified by: +// Modified by: // Created: 31/01/2006 13:27:33 -// RCS-ID: +// RCS-ID: // Copyright: GNU Licence // Licence: GNU ///////////////////////////////////////////////////////////////////////////// // 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" #endif @@ -47,14 +48,14 @@ ////@end XPM images - /**************************************************************************/ -void DisplayOptionFrame(WinEDA_DrawFrame * parent, const wxPoint & framepos) +void DisplayOptionFrame( WinEDA_DrawFrame* parent, const wxPoint& framepos ) /**************************************************************************/ { - WinEDA_SetOptionsFrame * frame = - new WinEDA_SetOptionsFrame(parent); - frame->ShowModal(); frame->Destroy(); + WinEDA_SetOptionsFrame* frame = + new WinEDA_SetOptionsFrame( parent ); + + frame->ShowModal(); frame->Destroy(); } @@ -71,9 +72,9 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_SetOptionsFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SetOptionsFrame, wxDialog ) ////@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 @@ -83,236 +84,336 @@ END_EVENT_TABLE() * 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; - Create(parent, id, caption, pos, size, style); - - /* Init options */ - if ( m_Parent->GetScreen() ) - { - switch( m_Parent->GetScreen()->GetGrid().x ) - { - case 50: - m_SelGridSize->SetSelection(0); - break; + m_Parent = parent; + Create( parent, id, caption, pos, size, style ); - case 25: - m_SelGridSize->SetSelection(1); - break; + BASE_SCREEN* screen = m_Parent->GetBaseScreen(); - case 10: - m_SelGridSize->SetSelection(2); - break; + /* Init options */ + if( screen ) + { + switch( screen->GetGrid().x ) + { + case 50: + m_SelGridSize->SetSelection( 0 ); + break; - case 5: - m_SelGridSize->SetSelection(3); - break; + case 25: + m_SelGridSize->SetSelection( 1 ); + break; - case 2: - m_SelGridSize->SetSelection(4); - break; + case 10: + m_SelGridSize->SetSelection( 2 ); + break; - case 1: - m_SelGridSize->SetSelection(5); - break; + case 5: + m_SelGridSize->SetSelection( 3 ); + break; - default: - DisplayError(this, wxT("WinEDA_SetOptionsFrame: Grid value not handle")); - break; - } - } - - /* Adjust the current selections and options: */ - m_ShowGridOpt->SetValue(m_Parent->m_Draw_Grid); - m_AutoPANOpt->SetValue(m_Parent->DrawPanel-> m_AutoPAN_Enable); - 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); -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); + case 2: + m_SelGridSize->SetSelection( 4 ); + break; + + case 1: + m_SelGridSize->SetSelection( 5 ); + break; + + default: + DisplayError( this, wxT( "WinEDA_SetOptionsFrame: Grid value not handle" ) ); + break; + } + } + + /* Adjust the current selections and options: */ + m_ShowGridOpt->SetValue( m_Parent->m_Draw_Grid ); + m_AutoPANOpt->SetValue( m_Parent->DrawPanel->m_AutoPAN_Enable ); + 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 ); + + 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 ); - msg = ReturnStringFromValue( g_UnitMetric,g_RepeatStep.y, m_Parent->m_InternalUnits); - m_DeltaStepCtrl_Y->SetValue( msg ); - title = _("Delta Step Y") + ReturnUnitSymbol(g_UnitMetric); + msg = ReturnStringFromValue( g_UnitMetric, g_RepeatStep.y, m_Parent->m_InternalUnits ); + m_DeltaStepCtrl_Y->SetValue( msg ); + title = _( "Delta Step Y" ) + ReturnUnitSymbol( g_UnitMetric ); m_DeltaStepYTitle->SetLabel( title ); - m_DeltaLabelCtrl->SetValue( g_RepeatDeltaLabel ); - + m_DeltaLabelCtrl->SetValue( g_RepeatDeltaLabel ); } + /*! * 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 m_DrawOptionsSizer = NULL; m_ShowGridOpt = NULL; m_SelGridSize = NULL; m_SelShowPins = NULL; - m_AutoPANOpt = NULL; - m_Selunits = NULL; + m_AutoPANOpt = NULL; + m_Selunits = NULL; m_LabelSizeCtrlSizer = NULL; - m_SelDirWires = NULL; + m_SelDirWires = NULL; m_Show_Page_Limits = NULL; - m_DeltaStepXTitle = NULL; - m_DeltaStepCtrl_X = NULL; - m_DeltaStepYTitle = NULL; - m_DeltaStepCtrl_Y = NULL; - m_DeltaIncTitle = NULL; - m_DeltaLabelCtrl = NULL; + m_DeltaStepXTitle = NULL; + m_DeltaStepCtrl_X = NULL; + m_DeltaStepYTitle = NULL; + m_DeltaStepCtrl_Y = NULL; + m_DeltaIncTitle = NULL; + m_DeltaLabelCtrl = NULL; + ////@end WinEDA_SetOptionsFrame member initialisation ////@begin WinEDA_SetOptionsFrame creation - SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); + SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS ); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); - if (GetSizer()) + if( GetSizer() ) { - GetSizer()->SetSizeHints(this); + GetSizer()->SetSizeHints( this ); } Centre(); + ////@end WinEDA_SetOptionsFrame creation return true; } + /*! * Control creation for WinEDA_SetOptionsFrame */ void WinEDA_SetOptionsFrame::CreateControls() -{ - SetFont(*g_DialogFont); +{ + SetFont( *g_DialogFont ); + ////@begin WinEDA_SetOptionsFrame content construction // Generated by DialogBlocks, 23/02/2007 10:59:46 (unregistered) WinEDA_SetOptionsFrame* itemDialog1 = this; - wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL); - itemDialog1->SetSizer(itemBoxSizer2); + wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxHORIZONTAL ); - wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemDialog1->SetSizer( itemBoxSizer2 ); - wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Draw Options:")); - m_DrawOptionsSizer = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL); - itemBoxSizer3->Add(m_DrawOptionsSizer, 0, wxGROW|wxALL, 5); + wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxVERTICAL ); - 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); + itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_VERTICAL | 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[] = { - _("Normal (50 mils)"), - _("Small (25 mils)"), - _("Very small (10 mils)"), - _("Special (5 mils)"), - _("Special (2 mils)"), - _("Special (1 mil)") + _( "Normal (50 mils)" ), + _( "Small (25 mils)" ), + _( "Very small (10 mils)" ), + _( "Special (5 mils)" ), + _( "Special (2 mils)" ), + _( "Special (1 mil)" ) }; - m_SelGridSize = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Grid Size"), wxDefaultPosition, wxDefaultSize, 6, m_SelGridSizeStrings, 1, wxRA_SPECIFY_COLS ); - m_SelGridSize->SetSelection(0); - itemBoxSizer3->Add(m_SelGridSize, 0, wxGROW|wxALL, 5); + m_SelGridSize = new wxRadioBox( itemDialog1, ID_RADIOBOX, _( + "Grid Size" ), wxDefaultPosition, wxDefaultSize, 6, + m_SelGridSizeStrings, 1, wxRA_SPECIFY_COLS ); + + m_SelGridSize->SetSelection( 0 ); + itemBoxSizer3->Add( m_SelGridSize, 0, wxGROW | wxALL, 5 ); wxString m_SelShowPinsStrings[] = { - _("Normal"), - _("Show alls") + _( "Normal" ), + _( "Show alls" ) }; - m_SelShowPins = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Show pins"), wxDefaultPosition, wxDefaultSize, 2, m_SelShowPinsStrings, 1, wxRA_SPECIFY_COLS ); - m_SelShowPins->SetSelection(0); - itemBoxSizer3->Add(m_SelShowPins, 0, wxGROW|wxALL, 5); + m_SelShowPins = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _( + "Show pins" ), wxDefaultPosition, + wxDefaultSize, 2, m_SelShowPinsStrings, 1, + wxRA_SPECIFY_COLS ); - wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_SelShowPins->SetSelection( 0 ); + itemBoxSizer3->Add( m_SelShowPins, 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); + wxBoxSizer* itemBoxSizer8 = new wxBoxSizer( wxVERTICAL ); + + itemBoxSizer2->Add( itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL | 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[] = { - _("millimeter"), - _("inches") + _( "millimeter" ), + _( "inches" ) }; - m_Selunits = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Units"), wxDefaultPosition, wxDefaultSize, 2, m_SelunitsStrings, 1, wxRA_SPECIFY_COLS ); - m_Selunits->SetSelection(0); - itemBoxSizer8->Add(m_Selunits, 0, wxGROW|wxALL, 5); + m_Selunits = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _( + "Units" ), wxDefaultPosition, wxDefaultSize, 2, + m_SelunitsStrings, 1, wxRA_SPECIFY_COLS ); - m_LabelSizeCtrlSizer = new wxBoxSizer(wxVERTICAL); - itemBoxSizer8->Add(m_LabelSizeCtrlSizer, 0, wxGROW|wxALL, 5); + m_Selunits->SetSelection( 0 ); + itemBoxSizer8->Add( m_Selunits, 0, wxGROW | wxALL, 5 ); + + m_LabelSizeCtrlSizer = new wxBoxSizer( wxVERTICAL ); + + itemBoxSizer8->Add( m_LabelSizeCtrlSizer, 0, wxGROW | wxALL, 5 ); wxString m_SelDirWiresStrings[] = { - _("Horiz/Vertical"), - _("Any") + _( "Horiz/Vertical" ), + _( "Any" ) }; - m_SelDirWires = new wxRadioBox( itemDialog1, ID_RADIOBOX3, _("Wires - Bus orient"), wxDefaultPosition, wxDefaultSize, 2, m_SelDirWiresStrings, 1, wxRA_SPECIFY_COLS ); - m_SelDirWires->SetSelection(0); - itemBoxSizer8->Add(m_SelDirWires, 0, wxGROW|wxALL, 5); + m_SelDirWires = new wxRadioBox( itemDialog1, ID_RADIOBOX3, _( + "Wires - Bus orient" ), wxDefaultPosition, wxDefaultSize, + 2, m_SelDirWiresStrings, 1, + wxRA_SPECIFY_COLS ); + + m_SelDirWires->SetSelection( 0 ); + itemBoxSizer8->Add( m_SelDirWires, 0, wxGROW | wxALL, 5 ); wxString m_Show_Page_LimitsStrings[] = { - _("Yes"), - _("No") + _( "Yes" ), + _( "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->SetSelection(0); - itemBoxSizer8->Add(m_Show_Page_Limits, 0, wxGROW|wxALL, 5); + m_Show_Page_Limits = new wxRadioBox( itemDialog1, ID_RADIOBOX4, _( + "Show page limits" ), wxDefaultPosition, + wxDefaultSize, 2, m_Show_Page_LimitsStrings, 1, + wxRA_SPECIFY_COLS ); - wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_Show_Page_Limits->SetSelection( 0 ); + itemBoxSizer8->Add( m_Show_Page_Limits, 0, wxGROW | wxALL, 5 ); - wxButton* itemButton15 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton15->SetForegroundColour(wxColour(202, 0, 0)); - itemBoxSizer14->Add(itemButton15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxBoxSizer* itemBoxSizer14 = new wxBoxSizer( wxVERTICAL ); - wxButton* itemButton16 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton16->SetForegroundColour(wxColour(0, 0, 255)); - itemBoxSizer14->Add(itemButton16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemBoxSizer2->Add( itemBoxSizer14, 0, wxALIGN_CENTER_VERTICAL | 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")); - wxStaticBoxSizer* itemStaticBoxSizer18 = new wxStaticBoxSizer(itemStaticBoxSizer18Static, wxVERTICAL); - itemBoxSizer14->Add(itemStaticBoxSizer18, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemButton15->SetForegroundColour( wxColour( 202, 0, 0 ) ); + itemBoxSizer14->Add( itemButton15, 0, wxALIGN_CENTER_HORIZONTAL | 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); + wxButton* itemButton16 = new wxButton( itemDialog1, wxID_CANCEL, _( + "&Cancel" ), wxDefaultPosition, + wxDefaultSize, 0 ); - m_DeltaStepCtrl_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer18->Add(m_DeltaStepCtrl_X, 0, wxGROW|wxALL, 5); + itemButton16->SetForegroundColour( wxColour( 0, 0, 255 ) ); + itemBoxSizer14->Add( itemButton16, 0, wxALIGN_CENTER_HORIZONTAL | 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); + itemBoxSizer14->Add( 5, 5, 0, wxGROW | wxALL, 5 ); - m_DeltaStepCtrl_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer18->Add(m_DeltaStepCtrl_Y, 0, wxGROW|wxALL, 5); + wxStaticBox* itemStaticBoxSizer18Static = new wxStaticBox( itemDialog1, wxID_ANY, _( + "Auto increment params" ) ); - 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); + wxStaticBoxSizer* itemStaticBoxSizer18 = new wxStaticBoxSizer( + itemStaticBoxSizer18Static, + wxVERTICAL ); - 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); + itemBoxSizer14->Add( itemStaticBoxSizer18, 0, wxALIGN_CENTER_HORIZONTAL | 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 - m_DefaultDrawLineWidthCtrl = new WinEDA_ValueCtrl(this, _("Default Line Width"),g_DrawMinimunLineWidth, - g_UnitMetric, m_DrawOptionsSizer, EESCHEMA_INTERNAL_UNIT); - - m_DefaultLabelSizeCtrl = new WinEDA_ValueCtrl(this, _("Default Label Size"),g_DefaultTextLabelSize, - g_UnitMetric, m_LabelSizeCtrlSizer, EESCHEMA_INTERNAL_UNIT); + m_DefaultDrawLineWidthCtrl = new WinEDA_ValueCtrl( this, _( + "Default Line Width" ), + g_DrawMinimunLineWidth, + g_UnitMetric, m_DrawOptionsSizer, + 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? */ @@ -322,6 +423,7 @@ bool WinEDA_SetOptionsFrame::ShowToolTips() return true; } + /*! * Get bitmap resources */ @@ -330,11 +432,13 @@ wxBitmap WinEDA_SetOptionsFrame::GetBitmapResource( const wxString& name ) { // Bitmap retrieval ////@begin WinEDA_SetOptionsFrame bitmap retrieval - wxUnusedVar(name); + wxUnusedVar( name ); return wxNullBitmap; + ////@end WinEDA_SetOptionsFrame bitmap retrieval } + /*! * Get icon resources */ @@ -343,21 +447,26 @@ wxIcon WinEDA_SetOptionsFrame::GetIconResource( const wxString& name ) { // Icon retrieval ////@begin WinEDA_SetOptionsFrame icon retrieval - wxUnusedVar(name); + wxUnusedVar( name ); return wxNullIcon; + ////@end WinEDA_SetOptionsFrame icon retrieval } + + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK */ void WinEDA_SetOptionsFrame::OnOkClick( wxCommandEvent& event ) { - Accept(event); + Accept( event ); + ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_SetOptionsFrame. // Before editing this code, remove the block markers. 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. // Before editing this code, remove the block markers. 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; -bool setgrid = TRUE; -wxString msg; - - g_DrawMinimunLineWidth = m_DefaultDrawLineWidthCtrl->GetValue(); - if ( g_DrawMinimunLineWidth < 0 ) g_DrawMinimunLineWidth = 0; - if ( g_DrawMinimunLineWidth > 100 ) g_DrawMinimunLineWidth = 100; - - g_DefaultTextLabelSize = m_DefaultLabelSizeCtrl->GetValue(); - if ( g_DefaultTextLabelSize < 0 ) g_DefaultTextLabelSize = 0; - if ( g_DefaultTextLabelSize > 1000 ) g_DefaultTextLabelSize = 1000; + wxSize grid; + bool setgrid = TRUE; + wxString msg; - msg = m_DeltaStepCtrl_X->GetValue(); - g_RepeatStep.x = - ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits); - msg = m_DeltaStepCtrl_Y->GetValue(); - g_RepeatStep.y = - ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits); + g_DrawMinimunLineWidth = m_DefaultDrawLineWidthCtrl->GetValue(); + if( g_DrawMinimunLineWidth < 0 ) + g_DrawMinimunLineWidth = 0; + if( g_DrawMinimunLineWidth > 100 ) + g_DrawMinimunLineWidth = 100; - g_RepeatDeltaLabel = m_DeltaLabelCtrl->GetValue(); + g_DefaultTextLabelSize = m_DefaultLabelSizeCtrl->GetValue(); + if( g_DefaultTextLabelSize < 0 ) + g_DefaultTextLabelSize = 0; + if( g_DefaultTextLabelSize > 1000 ) + g_DefaultTextLabelSize = 1000; - if ( m_Show_Page_Limits->GetSelection() == 0 ) g_ShowPageLimits = TRUE; - else g_ShowPageLimits = FALSE; + msg = m_DeltaStepCtrl_X->GetValue(); + g_RepeatStep.x = + ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); + msg = m_DeltaStepCtrl_Y->GetValue(); + g_RepeatStep.y = + ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); - if ( m_SelDirWires->GetSelection() == 0 ) g_HVLines = 1; - else g_HVLines = 0; + g_RepeatDeltaLabel = m_DeltaLabelCtrl->GetValue(); - if ( m_Selunits->GetSelection() == 0 ) g_UnitMetric = 1; - else g_UnitMetric = 0; + if( m_Show_Page_Limits->GetSelection() == 0 ) + g_ShowPageLimits = TRUE; + else + g_ShowPageLimits = FALSE; - if ( m_SelShowPins->GetSelection() == 0 ) g_ShowAllPins = FALSE; - else g_ShowAllPins = TRUE; + if( m_SelDirWires->GetSelection() == 0 ) + g_HVLines = 1; + else + g_HVLines = 0; - g_ShowGrid = m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue(); - m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue(); + if( m_Selunits->GetSelection() == 0 ) + g_UnitMetric = 1; + else + g_UnitMetric = 0; - m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue(); - switch( m_SelGridSize->GetSelection() ) - { - default: - setgrid = FALSE; - break; - - case 0: - grid = wxSize(50,50); - break; - case 1: - grid = wxSize(25,25); - break; + if( m_SelShowPins->GetSelection() == 0 ) + g_ShowAllPins = FALSE; + else + g_ShowAllPins = TRUE; - case 2: - grid = wxSize(10,10); - break; - } + g_ShowGrid = m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue(); + m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue(); - if ( m_Parent->GetScreen() ) - { - if ( setgrid ) m_Parent->GetScreen()->SetGrid(grid); - m_Parent->GetScreen()->SetRefreshReq(); - } + m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue(); + + switch( m_SelGridSize->GetSelection() ) + { + default: + setgrid = FALSE; + break; + + case 0: + grid = wxSize( 50, 50 ); + break; + + case 1: + grid = wxSize( 25, 25 ); + break; + + case 2: + grid = wxSize( 10, 10 ); + break; + } + + if( m_Parent->GetBaseScreen() ) + { + if( setgrid ) + m_Parent->GetBaseScreen()->SetGrid( grid ); + m_Parent->GetBaseScreen()->SetRefreshReq(); + } } - diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index 2660c1129e..c90401e822 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -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; diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 223b070b42..8ffb8cf9ac 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -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). @@ -278,8 +278,8 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) /*************************************************************/ /* Abort function for the command move text */ { - SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->GetScreen(); - SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem(); + BASE_SCREEN* screen = Panel->GetScreen(); + SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem(); g_ItemToRepeat = NULL; Panel->ManageCurseur = NULL; diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index cb63bf4de5..1bbb101678 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -142,7 +142,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask wxBeginBusyCursor(); - ActiveScreen = screen = m_Parent->GetScreen(); + ActiveScreen = screen = m_Parent->GetBaseScreen(); RedrawStructList( this, DC, screen->EEDrawList, GR_COPY ); if( Print_Sheet_Ref ) diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 2ef69de5f1..c77a66e584 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -255,8 +255,9 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) { wxPoint move_vector; - SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) - panel->m_Parent->GetScreen()->GetCurItem(); + SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen(); + + SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) screen->GetCurItem(); /* Effacement du composant */ if( erase ) @@ -264,8 +265,8 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 ); } - move_vector.x = panel->m_Parent->GetScreen()->m_Curseur.x - DrawLibItem->m_Pos.x; - move_vector.y = panel->m_Parent->GetScreen()->m_Curseur.y - DrawLibItem->m_Pos.y; + move_vector.x = screen->m_Curseur.x - DrawLibItem->m_Pos.x; + move_vector.y = screen->m_Curseur.y - DrawLibItem->m_Pos.y; MoveOneStruct( DrawLibItem, move_vector ); 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 */ { - SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) - Panel->m_Parent->GetScreen()->GetCurItem(); + SCH_SCREEN* screen = (SCH_SCREEN*) Panel->GetScreen(); + + SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) screen->GetCurItem(); 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; } - D(printf("refresh\n");) Panel->Refresh( TRUE ); Panel->ManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL; - Panel->m_Parent->GetScreen()->SetCurItem( NULL ); + screen->SetCurItem( NULL ); } diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index 0e419d8da4..620c463a4a 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -280,7 +280,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, if( DrawStruct == NULL ) break; if( DrawStruct->Type() == TYPE_SCH_COMPONENT ) - DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); + DrawStruct = LocateSmallestComponent( GetScreen() ); if( DrawStruct == NULL ) break; } @@ -332,7 +332,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, case HK_MIRROR_X_COMPONENT: // Mirror X (Component) if( DrawStruct == NULL ) - DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); + DrawStruct = LocateSmallestComponent( GetScreen() ); if( DrawStruct ) { 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) if( DrawStruct == NULL ) - DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); + DrawStruct = LocateSmallestComponent( GetScreen() ); if( DrawStruct ) { if( DrawStruct->m_Flags == 0 ) @@ -365,10 +365,10 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, if( ItemInEdit ) break; if( DrawStruct == NULL ) - DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); + DrawStruct = LocateSmallestComponent( GetScreen() ); 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 ); wxPostEvent( this, event ); @@ -378,7 +378,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, if( ItemInEdit ) break; if( DrawStruct == NULL ) - DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); + DrawStruct = LocateSmallestComponent( GetScreen() ); if(DrawStruct) { EditComponentValue( @@ -390,7 +390,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, if( ItemInEdit ) break; if( DrawStruct == NULL ) - DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); + DrawStruct = LocateSmallestComponent( GetScreen() ); if(DrawStruct) { EditComponentFootprint( diff --git a/eeschema/libfield.cpp b/eeschema/libfield.cpp index 4aaae497f5..e65b8d1617 100644 --- a/eeschema/libfield.cpp +++ b/eeschema/libfield.cpp @@ -2,7 +2,7 @@ /* EESchema - edition des librairies: Edition des champs ( Fields ) */ /*********************************************************************/ - /* Fichier libfield.cpp */ + /* Fichier libfield.cpp */ #include "fctsys.h" #include "gr_basic.h" @@ -30,18 +30,18 @@ static void ExitMoveField(WinEDA_DrawPanel * Panel, wxDC * DC) /***********************************************************/ { - Panel->ManageCurseur = NULL; - Panel->ForceCloseManageCurseur = NULL; - if(CurrentDrawItem == NULL) return; + Panel->ManageCurseur = NULL; + Panel->ForceCloseManageCurseur = NULL; + if(CurrentDrawItem == NULL) return; - wxPoint curpos; - curpos = Panel->m_Parent->GetScreen()->m_Curseur; - Panel->m_Parent->GetScreen()->m_Curseur = StartCursor; - ShowMoveField(Panel, DC, TRUE); - Panel->m_Parent->GetScreen()->m_Curseur = curpos; - CurrentDrawItem->m_Flags = 0; + wxPoint curpos; + curpos = Panel->GetScreen()->m_Curseur; + Panel->GetScreen()->m_Curseur = StartCursor; + ShowMoveField(Panel, DC, TRUE); + Panel->GetScreen()->m_Curseur = curpos; + CurrentDrawItem->m_Flags = 0; - CurrentDrawItem = NULL; + CurrentDrawItem = NULL; } @@ -53,23 +53,23 @@ void WinEDA_LibeditFrame::StartMoveField(wxDC * DC, LibDrawField *field) { wxPoint startPos; - if( (CurrentLibEntry == NULL) || ( field == NULL ) ) return; - CurrentDrawItem = field; - LastTextPosition = field->m_Pos; - CurrentDrawItem->m_Flags |= IS_MOVED; + if( (CurrentLibEntry == NULL) || ( field == NULL ) ) return; + CurrentDrawItem = field; + LastTextPosition = field->m_Pos; + CurrentDrawItem->m_Flags |= IS_MOVED; - startPos.x = LastTextPosition.x; - startPos.y = -LastTextPosition.y; - DrawPanel->CursorOff(DC); - GetScreen()->m_Curseur = startPos; - DrawPanel->MouseToCursorSchema(); + startPos.x = LastTextPosition.x; + startPos.y = -LastTextPosition.y; + DrawPanel->CursorOff(DC); + GetScreen()->m_Curseur = startPos; + DrawPanel->MouseToCursorSchema(); - DrawPanel->ManageCurseur = ShowMoveField; - DrawPanel->ForceCloseManageCurseur = ExitMoveField; - DrawPanel->ManageCurseur(DrawPanel, DC, TRUE); - StartCursor = GetScreen()->m_Curseur; + DrawPanel->ManageCurseur = ShowMoveField; + DrawPanel->ForceCloseManageCurseur = ExitMoveField; + DrawPanel->ManageCurseur(DrawPanel, DC, TRUE); + 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; 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) - { - case VALUE: - color = ReturnLayerColor(LAYER_VALUEPART); - break; + switch (Field->m_FieldId) + { + case VALUE: + color = ReturnLayerColor(LAYER_VALUEPART); + break; - case REFERENCE: - color = ReturnLayerColor(LAYER_REFERENCEPART); - break; + case REFERENCE: + color = ReturnLayerColor(LAYER_REFERENCEPART); + break; - default: - color = ReturnLayerColor(LAYER_FIELDS); - break; - } + default: + color = ReturnLayerColor(LAYER_FIELDS); + break; + } int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); - if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY; - if( erase ) - DrawGraphicText(panel, DC, - wxPoint(LastTextPosition.x, - LastTextPosition.y), - color, Field->m_Text, - Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - Field->m_Size, - Field->m_HJustify, Field->m_VJustify, LineWidth); + if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY; + if( erase ) + DrawGraphicText(panel, DC, + wxPoint(LastTextPosition.x, - LastTextPosition.y), + color, Field->m_Text, + Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, + Field->m_Size, + Field->m_HJustify, Field->m_VJustify, LineWidth); - LastTextPosition.x = panel->GetScreen()->m_Curseur.x; - LastTextPosition.y = - panel->GetScreen()->m_Curseur.y; + LastTextPosition.x = panel->GetScreen()->m_Curseur.x; + LastTextPosition.y = - panel->GetScreen()->m_Curseur.y; - Field->m_Pos = LastTextPosition; + Field->m_Pos = LastTextPosition; - DrawGraphicText(panel, DC, - wxPoint(LastTextPosition.x, - LastTextPosition.y), - color, Field->m_Text, - Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - Field->m_Size, - Field->m_HJustify, Field->m_VJustify, LineWidth); + DrawGraphicText(panel, DC, + wxPoint(LastTextPosition.x, - LastTextPosition.y), + color, Field->m_Text, + Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, + Field->m_Size, + Field->m_HJustify, Field->m_VJustify, LineWidth); } /*******************************************************************/ @@ -130,45 +130,45 @@ void WinEDA_LibeditFrame::PlaceField(wxDC * DC, LibDrawField *Field) { int color; - if(Field == NULL ) return; + if(Field == NULL ) return; - switch (Field->m_FieldId) - { - case REFERENCE: - color = ReturnLayerColor(LAYER_REFERENCEPART); - break; + switch (Field->m_FieldId) + { + case REFERENCE: + color = ReturnLayerColor(LAYER_REFERENCEPART); + break; - case VALUE: - color = ReturnLayerColor(LAYER_VALUEPART); - break; + case VALUE: + color = ReturnLayerColor(LAYER_VALUEPART); + break; - default: - color = ReturnLayerColor(LAYER_FIELDS); - break; - } + default: + color = ReturnLayerColor(LAYER_FIELDS); + break; + } - Field->m_Flags = 0; + Field->m_Flags = 0; - if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 ) color = DARKGRAY; - Field->m_Pos.x = GetScreen()->m_Curseur.x; - Field->m_Pos.y = - GetScreen()->m_Curseur.y; + if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 ) color = DARKGRAY; + Field->m_Pos.x = GetScreen()->m_Curseur.x; + Field->m_Pos.y = - GetScreen()->m_Curseur.y; int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); - DrawPanel->CursorOff(DC); + DrawPanel->CursorOff(DC); - GRSetDrawMode(DC, GR_DEFAULT_DRAWMODE); - DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), - color, Field->m_Text, - Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - Field->m_Size, - Field->m_HJustify, Field->m_VJustify, LineWidth); + GRSetDrawMode(DC, GR_DEFAULT_DRAWMODE); + DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), + color, Field->m_Text, + Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, + Field->m_Size, + Field->m_HJustify, Field->m_VJustify, LineWidth); - DrawPanel->CursorOn(DC); + DrawPanel->CursorOn(DC); - GetScreen()->SetModify(); - DrawPanel->ManageCurseur = NULL; - DrawPanel->ForceCloseManageCurseur = NULL; - CurrentDrawItem = NULL; + GetScreen()->SetModify(); + DrawPanel->ManageCurseur = NULL; + DrawPanel->ForceCloseManageCurseur = NULL; + CurrentDrawItem = NULL; } @@ -180,118 +180,118 @@ wxString Text; int color; wxString title = wxT("Text:"); - if( Field == NULL) return; + if( Field == NULL) return; - switch (Field->m_FieldId) - { - case REFERENCE: - title = wxT("Reference:"); - color = ReturnLayerColor(LAYER_REFERENCEPART); - break; + switch (Field->m_FieldId) + { + case REFERENCE: + title = wxT("Reference:"); + color = ReturnLayerColor(LAYER_REFERENCEPART); + break; - case VALUE: - title = wxT("Value:"); - color = ReturnLayerColor(LAYER_VALUEPART); - break; + case VALUE: + title = wxT("Value:"); + color = ReturnLayerColor(LAYER_VALUEPART); + break; - default: - color = ReturnLayerColor(LAYER_FIELDS); - break; - } + default: + color = ReturnLayerColor(LAYER_FIELDS); + break; + } - if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY; + if( Field->m_Attributs & TEXT_NO_VISIBLE ) color = DARKGRAY; - Text = Field->m_Text; - Get_Message(title,Text, this); - Text.Replace( wxT(" ") , wxT("_") ); + Text = Field->m_Text; + Get_Message(title,Text, this); + Text.Replace( wxT(" ") , wxT("_") ); - GRSetDrawMode(DC, g_XorMode); + GRSetDrawMode(DC, g_XorMode); int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth); - DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), - color, Field->m_Text, - Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - Field->m_Size, - Field->m_HJustify, Field->m_VJustify, LineWidth); + DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), + color, Field->m_Text, + Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, + Field->m_Size, + Field->m_HJustify, Field->m_VJustify, LineWidth); - if( ! Text.IsEmpty() ) - { - SaveCopyInUndoList(CurrentLibEntry); - Field->m_Text = Text; - } - else DisplayError(this, _("No new text: no change") ); + if( ! Text.IsEmpty() ) + { + SaveCopyInUndoList(CurrentLibEntry); + Field->m_Text = Text; + } + 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), - color, Field->m_Text, - Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - Field->m_Size, - Field->m_HJustify, Field->m_VJustify, LineWidth); + DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), + color, Field->m_Text, + Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, + Field->m_Size, + 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) /********************************************************************/ /* Routine de modification de l'orientation ( Horiz ou Vert. ) du champ. - si un champ est en cours d'edition, modif de celui ci. - sinon Modif du champ pointe par la souris + si un champ est en cours d'edition, modif de celui ci. + sinon Modif du champ pointe par la souris */ { int color; - if( Field == NULL) return; + if( Field == NULL) return; - GetScreen()->SetModify(); - switch (Field->m_FieldId) - { - case REFERENCE: - color = ReturnLayerColor(LAYER_REFERENCEPART); - break; + GetScreen()->SetModify(); + switch (Field->m_FieldId) + { + case REFERENCE: + color = ReturnLayerColor(LAYER_REFERENCEPART); + break; - case VALUE: - color = ReturnLayerColor(LAYER_VALUEPART); - break; + case VALUE: + color = ReturnLayerColor(LAYER_VALUEPART); + break; - default: - color = ReturnLayerColor(LAYER_FIELDS); - break; - } + default: + color = ReturnLayerColor(LAYER_FIELDS); + 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); - DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), - color, Field->m_Text, - Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - Field->m_Size, - Field->m_HJustify, Field->m_VJustify, LineWidth); + DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), + color, Field->m_Text, + Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, + Field->m_Size, + Field->m_HJustify, Field->m_VJustify, LineWidth); - if( Field->m_Orient) Field->m_Orient = 0; - else Field->m_Orient = 1; + if( Field->m_Orient) Field->m_Orient = 0; + 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), - color, Field->m_Text, - Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - Field->m_Size, - Field->m_HJustify, Field->m_VJustify, LineWidth); - DrawPanel->CursorOn(DC); + DrawGraphicText(DrawPanel, DC, wxPoint(Field->m_Pos.x, - Field->m_Pos.y), + color, Field->m_Text, + Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, + Field->m_Size, + Field->m_HJustify, Field->m_VJustify, LineWidth); + DrawPanel->CursorOn(DC); } /****************************************************************************/ LibDrawField * WinEDA_LibeditFrame::LocateField(EDA_LibComponentStruct *LibEntry) /****************************************************************************/ /* Localise le champ (ref ou name) pointe par la souris - retourne: - pointeur sur le champ (NULL= Pas de champ) + retourne: + pointeur sur le champ (NULL= Pas de champ) */ { int x0, y0, x1, y1; /* Rectangle d'encadrement des textes a localiser */ @@ -299,91 +299,91 @@ int dx, dy; /* Dimensions du texte */ LibDrawField *Field; int hjustify, vjustify; - /* Localisation du Nom */ - x0 = LibEntry->m_Name.m_Pos.x; - y0 = - LibEntry->m_Name.m_Pos.y; - dx = LibEntry->m_Name.m_Size.x * LibEntry->m_Name.m_Text.Len(), - dy = LibEntry->m_Name.m_Size.y; - hjustify = LibEntry->m_Name.m_HJustify; vjustify = LibEntry->m_Name.m_VJustify; - if (LibEntry->m_Name.m_Orient) EXCHG(dx, dy); - if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2; - else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx; - if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2; - else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 += dy; - x1 = x0 + dx; y1 = y0 + dy; + /* Localisation du Nom */ + x0 = LibEntry->m_Name.m_Pos.x; + y0 = - LibEntry->m_Name.m_Pos.y; + dx = LibEntry->m_Name.m_Size.x * LibEntry->m_Name.m_Text.Len(), + dy = LibEntry->m_Name.m_Size.y; + hjustify = LibEntry->m_Name.m_HJustify; vjustify = LibEntry->m_Name.m_VJustify; + if (LibEntry->m_Name.m_Orient) EXCHG(dx, dy); + if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2; + else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx; + if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2; + else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 += dy; + x1 = x0 + dx; y1 = y0 + dy; - if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) && - (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) ) - return &LibEntry->m_Name; + if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) && + (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) ) + return &LibEntry->m_Name; - /* Localisation du Prefix */ - x0 = LibEntry->m_Prefix.m_Pos.x; - y0 = - LibEntry->m_Prefix.m_Pos.y; - dx = LibEntry->m_Prefix.m_Size.x *LibEntry->m_Prefix.m_Text.Len(), - dy = LibEntry->m_Prefix.m_Size.y; - hjustify = LibEntry->m_Prefix.m_HJustify; vjustify = LibEntry->m_Prefix.m_VJustify; - if (LibEntry->m_Prefix.m_Orient) EXCHG(dx, dy); - if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2; - else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx; - if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2; - else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy; - x1 = x0 + dx; y1 = y0 + dy; + /* Localisation du Prefix */ + x0 = LibEntry->m_Prefix.m_Pos.x; + y0 = - LibEntry->m_Prefix.m_Pos.y; + dx = LibEntry->m_Prefix.m_Size.x *LibEntry->m_Prefix.m_Text.Len(), + dy = LibEntry->m_Prefix.m_Size.y; + hjustify = LibEntry->m_Prefix.m_HJustify; vjustify = LibEntry->m_Prefix.m_VJustify; + if (LibEntry->m_Prefix.m_Orient) EXCHG(dx, dy); + if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2; + else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx; + if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2; + else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy; + x1 = x0 + dx; y1 = y0 + dy; - if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) && - (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) ) - return &LibEntry->m_Prefix; + if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) && + (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) ) + return &LibEntry->m_Prefix; - /* Localisation des autres fields */ - for (Field = LibEntry->Fields; Field != NULL; - Field = (LibDrawField*)Field->Pnext) - { - if ( Field->m_Text.IsEmpty() ) continue; - x0 = Field->m_Pos.x; y0 = - Field->m_Pos.y; - dx = Field->m_Size.x * Field->m_Text.Len(), - dy = Field->m_Size.y; - hjustify = Field->m_HJustify; vjustify = Field->m_VJustify; - if (Field->m_Orient) EXCHG(dx, dy); - if (LibEntry->m_Prefix.m_Orient) EXCHG(dx, dy); - if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2; - else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx; - if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2; - else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy; - x1 = x0 + dx; y1 = y0 + dy; - if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) && - (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) ) - return(Field); - } + /* Localisation des autres fields */ + for (Field = LibEntry->Fields; Field != NULL; + Field = (LibDrawField*)Field->Pnext) + { + if ( Field->m_Text.IsEmpty() ) continue; + x0 = Field->m_Pos.x; y0 = - Field->m_Pos.y; + dx = Field->m_Size.x * Field->m_Text.Len(), + dy = Field->m_Size.y; + hjustify = Field->m_HJustify; vjustify = Field->m_VJustify; + if (Field->m_Orient) EXCHG(dx, dy); + if (LibEntry->m_Prefix.m_Orient) EXCHG(dx, dy); + if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2; + else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx; + if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2; + else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy; + x1 = x0 + dx; y1 = y0 + dy; + if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) && + (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) ) + return(Field); + } - return NULL; + return NULL; } /********************************************************************************/ 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) ) - { // Simple localisation des elements - DrawEntry = LocatePin(GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert); - if ( DrawEntry == NULL ) - { - DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)GetScreen(), - GetScreen()->m_MousePosition,CurrentLibEntry,CurrentUnit, - CurrentConvert,LOCATE_ALL_DRAW_ITEM); - } - if ( DrawEntry == NULL ) - { - DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)GetScreen(), GetScreen()->m_Curseur, CurrentLibEntry,CurrentUnit, - CurrentConvert,LOCATE_ALL_DRAW_ITEM); - } - if ( DrawEntry == NULL ) - { - DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*) - LocateField(CurrentLibEntry); - } - } - return DrawEntry; + if ( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) ) + { // Simple localisation des elements + DrawEntry = LocatePin(GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert); + if ( DrawEntry == NULL ) + { + DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)GetScreen(), + GetScreen()->m_MousePosition,CurrentLibEntry,CurrentUnit, + CurrentConvert,LOCATE_ALL_DRAW_ITEM); + } + if ( DrawEntry == NULL ) + { + DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)GetScreen(), GetScreen()->m_Curseur, CurrentLibEntry,CurrentUnit, + CurrentConvert,LOCATE_ALL_DRAW_ITEM); + } + if ( DrawEntry == NULL ) + { + DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*) + LocateField(CurrentLibEntry); + } + } + return DrawEntry; } diff --git a/eeschema/libframe.cpp b/eeschema/libframe.cpp index d97e01a43a..b9ba47ea24 100644 --- a/eeschema/libframe.cpp +++ b/eeschema/libframe.cpp @@ -64,7 +64,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, const wxString& title, const wxPoint& pos, const wxSize& size, - long style ) : + long style ) : WinEDA_DrawFrame( father, LIBEDITOR_FRAME, parent, title, pos, size, style ) { m_FrameName = wxT( "LibeditFrame" ); @@ -73,7 +73,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, // Give an icon SetIcon( wxIcon( libedit_xpm ) ); - m_CurrentScreen = ScreenLib; + SetBaseScreen( ScreenLib ); GetSettings(); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); if( DrawPanel ) @@ -90,7 +90,6 @@ WinEDA_LibeditFrame::~WinEDA_LibeditFrame() /**********************************************/ { m_Parent->m_LibeditFrame = NULL; - //m_CurrentScreen = ScreenSch; humm, is this needed? } @@ -100,14 +99,14 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event ) { LibraryStruct* Lib; - if( GetScreen()->IsModify() ) + if( GetScreen()->IsModify() ) { if( !IsOK( this, _( "Component was modified!\nDiscard changes?" ) ) ) { Event.Veto(); return; } else - GetScreen()->ClrModify(); + GetScreen()->ClrModify(); } 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() ); if( !IsOK( this, msg ) ) { - Event.Veto(); return; + Event.Veto(); + return; } } } @@ -261,8 +261,8 @@ int WinEDA_LibeditFrame::BestZoom() } else { - dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; - dy = GetScreen()->m_CurrentSheetDesc->m_Size.y; + dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; + dy = GetScreen()->m_CurrentSheetDesc->m_Size.y; } size = DrawPanel->GetClientSize(); @@ -275,12 +275,12 @@ int WinEDA_LibeditFrame::BestZoom() if( CurrentLibEntry ) { - GetScreen()->m_Curseur = BoundaryBox.Centre(); + GetScreen()->m_Curseur = BoundaryBox.Centre(); } else { - GetScreen()->m_Curseur.x = 0; - GetScreen()->m_Curseur.y = 0; + GetScreen()->m_Curseur.x = 0; + GetScreen()->m_Curseur.y = 0; } return bestzoom; @@ -339,7 +339,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) switch( id ) { case ID_LIBEDIT_SAVE_CURRENT_LIB: - if( GetScreen()->IsModify() ) + if( GetScreen()->IsModify() ) { if( IsOK( this, _( "Include last component changes?" ) ) ) SaveOnePartInMemory(); @@ -608,7 +608,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) } CurrentDrawItem = NULL; - GetScreen()->SetModify(); + GetScreen()->SetModify(); DrawPanel->CursorOn( &dc ); break; @@ -656,7 +656,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) { EditField( &dc, (LibDrawField*) CurrentDrawItem ); } - DrawPanel->MouseToCursorSchema(); + DrawPanel->MouseToCursorSchema(); DrawPanel->CursorOn( &dc ); break; diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index bd4bd25397..93dbe84ca1 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -157,7 +157,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, case DRAW_NOCONNECT_STRUCT_TYPE: // 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; case DRAW_JUNCTION_STRUCT_TYPE: @@ -167,17 +167,17 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, case DRAW_BUSENTRY_STRUCT_TYPE: if( !flags ) ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, - _( "Move bus entry" ), move_xpm ); + _( "Move Bus Entry" ), move_xpm ); 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 - 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, - _( "delete bus entry" ), delete_bus_xpm ); + _( "Delete Bus Entry" ), delete_bus_xpm ); break; 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; case TYPE_SCH_TEXT: @@ -230,9 +230,9 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, default: 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, - _( "Delete drawing" ), delete_xpm ); + _( "Delete Drawing" ), delete_xpm ); 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, _( "Change to Text" ), glabel2text_xpm ); 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, 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, _( "Change to Text" ), label2text_xpm ); 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, 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_DELETE, _( "delete junction" ), delete_xpm ); + ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Junction" ), delete_xpm ); if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(), 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, _( - "Delete connection" ), delete_connection_xpm ); + "Delete Connection" ), delete_connection_xpm ); } } @@ -525,9 +525,9 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire, if( is_new ) 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, _( - "Delete connection" ), delete_connection_xpm ); + "Delete Connection" ), delete_connection_xpm ); if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(), WIREITEM | BUSITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) ) @@ -535,13 +535,13 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire, PopMenu->AppendSeparator(); - 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_JUNCTION, _( "Add Junction" ), add_junction_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: 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 ) ) - 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 ); PopMenu->AppendSeparator(); - 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_JUNCTION, _( "Add Junction" ), add_junction_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: 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 ) ) - 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; 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, ID_POPUP_COPY_BLOCK, _( "Copy Block (shift + drag mouse)" ), copyblock_xpm ); ADD_MENUITEM( menu_other_block_commands, ID_POPUP_DRAG_BLOCK, _( "Drag Block (ctrl + drag mouse)" ), move_xpm ); 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, _( "Mirror Block ||" ), mirror_H_xpm ); #if 0 diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 205c769843..b1d9ddd9c7 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -1,8 +1,8 @@ - /***************************/ - /* EESchema - PinEdit.cpp */ - /***************************/ +/***************************/ +/* EESchema - PinEdit.cpp */ +/***************************/ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA) #pragma implementation "pinedit-dialog.h" #endif @@ -10,286 +10,314 @@ static int CodeOrient[4] = { - PIN_RIGHT, - PIN_LEFT, - PIN_UP, - PIN_DOWN + PIN_RIGHT, + PIN_LEFT, + PIN_UP, + PIN_DOWN }; #define NBSHAPES 7 static wxString shape_list[NBSHAPES] = { - _("line"), _("invert"), _("clock"), _("clock inv"), - _("low in"), _("low clock"), _("low out") + _( "line" ), _( "invert" ), _( "clock" ), _( "clock inv" ), + _( "low in" ), _( "low clock" ), _( "low out" ) }; -int CodeShape[NBSHAPES] = +int CodeShape[NBSHAPES] = { -NONE, INVERT, CLOCK, CLOCK|INVERT, LOWLEVEL_IN, LOWLEVEL_IN|CLOCK, LOWLEVEL_OUT + NONE, INVERT, CLOCK, CLOCK | INVERT, LOWLEVEL_IN, LOWLEVEL_IN | CLOCK, LOWLEVEL_OUT }; /* Routines locales */ -static void CreateImagePins(LibDrawPin * Pin); -static void AbortPinMove(WinEDA_DrawPanel * Panel, wxDC * DC); -static void DrawMovePin(WinEDA_DrawPanel * panel, wxDC * DC, bool erase); +static void CreateImagePins( LibDrawPin* Pin ); +static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC ); +static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); /* Variables importees */ /* Variables locales */ static wxPoint OldPos, PinPreviousPos; -static int LastPinType = PIN_INPUT, - LastPinOrient = PIN_RIGHT, - LastPinShape = NONE, - LastPinSize = 300, - LastPinNameSize = 50, - LastPinNumSize = 50, - LastPinCommonConvert = FALSE, - LastPinCommonUnit = FALSE, - LastPinNoDraw = FALSE; +static int LastPinType = PIN_INPUT, + LastPinOrient = PIN_RIGHT, + LastPinShape = NONE, + LastPinSize = 300, + LastPinNameSize = 50, + LastPinNumSize = 50, + LastPinCommonConvert = FALSE, + LastPinCommonUnit = FALSE, + LastPinNoDraw = FALSE; #include "pinedit-dialog.cpp" /*************************************************************************/ -void WinEDA_PinPropertiesFrame::PinPropertiesAccept(wxCommandEvent& event) +void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event ) /*************************************************************************/ + /* Met a jour les differents parametres pour le composant en cours d'�dition -*/ + */ { -wxString msg; + wxString msg; - LastPinType = m_PinElectricalType->GetSelection(); - LastPinShape = CodeShape[m_PinShape->GetSelection()]; - LastPinOrient = CodeOrient[m_PinOrient->GetSelection()]; - LastPinCommonConvert = m_CommonConvert->GetValue(); - LastPinCommonUnit = m_CommonUnit->GetValue(); - LastPinNoDraw = m_NoDraw->GetValue(); - LastPinSize = m_PinSize->GetValue(); - msg = m_PinNameSizeCtrl->GetValue(); - LastPinNameSize = ReturnValueFromString(g_UnitMetric, msg, m_Parent->m_InternalUnits); - msg = m_PinNumSizeCtrl->GetValue(); - LastPinNumSize = ReturnValueFromString(g_UnitMetric, msg, m_Parent->m_InternalUnits); + LastPinType = m_PinElectricalType->GetSelection(); + LastPinShape = CodeShape[m_PinShape->GetSelection()]; + LastPinOrient = CodeOrient[m_PinOrient->GetSelection()]; + LastPinCommonConvert = m_CommonConvert->GetValue(); + LastPinCommonUnit = m_CommonUnit->GetValue(); + LastPinNoDraw = m_NoDraw->GetValue(); + LastPinSize = m_PinSize->GetValue(); + msg = m_PinNameSizeCtrl->GetValue(); + LastPinNameSize = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); + msg = m_PinNumSizeCtrl->GetValue(); + LastPinNumSize = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); - if ( CurrentDrawItem ) // Set Pin Name & Num - { - if ( ! (CurrentDrawItem->m_Flags & IS_NEW) ) // if IS_NEW, copy for undo is done before place - m_Parent->SaveCopyInUndoList(CurrentLibEntry); - LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; - wxClientDC dc(m_Parent->DrawPanel); - m_Parent->DrawPanel->PrepareGraphicContext(&dc); - if ( m_Parent->DrawPanel->ManageCurseur ) // Pin is moving - m_Parent->DrawPanel->ManageCurseur(m_Parent->DrawPanel, &dc, FALSE); - else DrawLibraryDrawStruct(m_Parent->DrawPanel, &dc, CurrentLibEntry, - 0,0, CurrentPin,CurrentUnit, g_XorMode); + if( CurrentDrawItem ) // Set Pin Name & Num + { + if( !(CurrentDrawItem->m_Flags & IS_NEW) ) // if IS_NEW, copy for undo is done before place + m_Parent->SaveCopyInUndoList( CurrentLibEntry ); + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; + wxClientDC dc( m_Parent->DrawPanel ); - SetPinName(m_PinNameCtrl->GetValue(), LastPinNameSize); - msg = m_PinNumCtrl->GetValue(); if ( msg.IsEmpty() ) msg = wxT("~"); - SetPinNum(msg, LastPinNumSize); - NewSizePin(LastPinSize); - SetPinShape(LastPinShape); - SetPinType(LastPinType); - SetPinOrient(LastPinOrient); - SetAttributsPin(TRUE, TRUE, TRUE); - if ( m_Parent->DrawPanel->ManageCurseur ) - m_Parent->DrawPanel->ManageCurseur(m_Parent->DrawPanel, &dc, FALSE); - else DrawLibraryDrawStruct(m_Parent->DrawPanel, &dc, CurrentLibEntry, - 0,0, CurrentPin,CurrentUnit, g_XorMode); - } + m_Parent->DrawPanel->PrepareGraphicContext( &dc ); + if( m_Parent->DrawPanel->ManageCurseur ) // Pin is moving + m_Parent->DrawPanel->ManageCurseur( m_Parent->DrawPanel, &dc, FALSE ); + else + DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, + 0, 0, CurrentPin, CurrentUnit, g_XorMode ); - if ( CurrentDrawItem ) - CurrentDrawItem->Display_Infos_DrawEntry(m_Parent); + SetPinName( m_PinNameCtrl->GetValue(), LastPinNameSize ); + msg = m_PinNumCtrl->GetValue(); if( msg.IsEmpty() ) + msg = wxT( "~" ); + SetPinNum( msg, LastPinNumSize ); + NewSizePin( LastPinSize ); + SetPinShape( LastPinShape ); + SetPinType( LastPinType ); + SetPinOrient( LastPinOrient ); + SetAttributsPin( TRUE, TRUE, TRUE ); + if( m_Parent->DrawPanel->ManageCurseur ) + m_Parent->DrawPanel->ManageCurseur( m_Parent->DrawPanel, &dc, FALSE ); + else + DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, + 0, 0, CurrentPin, CurrentUnit, g_XorMode ); + } - Close(); + if( CurrentDrawItem ) + CurrentDrawItem->Display_Infos_DrawEntry( m_Parent ); + + Close(); } - - /*********************************************/ void WinEDA_LibeditFrame::InitEditOnePin() /*********************************************/ + /* Routine d'installation du menu d'edition d'une pin -*/ + */ { -LibDrawPin * Pin; -LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; + LibDrawPin* Pin; + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; - if(CurrentLibEntry == NULL) return; - if(CurrentPin == NULL) return; + if( CurrentLibEntry == NULL ) + return; + if( CurrentPin == NULL ) + return; - /* Marquage des pins a traiter,Si edition d'une pin non deja selectionnee */ - Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; - for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) - { - if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; - if ( Pin == CurrentPin ) continue; - if( (Pin->m_Pos == CurrentPin->m_Pos) && - (Pin->m_Orient == CurrentPin->m_Orient) && - (! (CurrentPin->m_Flags & IS_NEW)) && - (g_EditPinByPinIsOn == FALSE) ) - Pin->m_Flags |= IS_LINKED | IN_EDIT; - else Pin->m_Flags = 0; - } + /* Marquage des pins a traiter,Si edition d'une pin non deja selectionnee */ + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( Pin == CurrentPin ) + continue; + if( (Pin->m_Pos == CurrentPin->m_Pos) + && (Pin->m_Orient == CurrentPin->m_Orient) + && ( !(CurrentPin->m_Flags & IS_NEW) ) + && (g_EditPinByPinIsOn == FALSE) ) + Pin->m_Flags |= IS_LINKED | IN_EDIT; + else + Pin->m_Flags = 0; + } - CurrentPin->Display_Infos_DrawEntry(this); + CurrentPin->Display_Infos_DrawEntry( this ); } /*************************************************************/ -static void AbortPinMove(WinEDA_DrawPanel * Panel, wxDC * DC) +static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC ) /*************************************************************/ + /* Used to abort the move pin command. -*/ + */ { -LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; - if( CurrentPin && ( CurrentPin->m_Flags & IS_NEW ) ) - DeleteOneLibraryDrawStruct(Panel, DC, CurrentLibEntry, CurrentPin, TRUE); + if( CurrentPin && ( CurrentPin->m_Flags & IS_NEW ) ) + DeleteOneLibraryDrawStruct( Panel, DC, CurrentLibEntry, CurrentPin, TRUE ); - /* clear edit flags */ - LibEDA_BaseStruct * item = CurrentLibEntry->m_Drawings; - for ( ; item != NULL; item = item->Next() ) item->m_Flags = 0; + /* clear edit flags */ + LibEDA_BaseStruct* item = CurrentLibEntry->m_Drawings; + for( ; item != NULL; item = item->Next() ) + item->m_Flags = 0; - Panel->ManageCurseur = NULL; - Panel->ForceCloseManageCurseur = NULL; - CurrentDrawItem = NULL; - LibItemToRepeat = NULL; - Panel->Refresh(true); + Panel->ManageCurseur = NULL; + Panel->ForceCloseManageCurseur = NULL; + CurrentDrawItem = NULL; + LibItemToRepeat = NULL; + Panel->Refresh( true ); } /********************************************/ -void WinEDA_LibeditFrame::PlacePin(wxDC * DC) +void WinEDA_LibeditFrame::PlacePin( wxDC* DC ) /********************************************/ /* Routine de fin de deplacement de la pin selectionnee */ { -LibDrawPin * Pin; -LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; -bool ask_for_pin = TRUE; -wxPoint newpos; -bool status; + LibDrawPin* Pin; + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; + bool ask_for_pin = TRUE; + wxPoint newpos; + bool status; - if( CurrentPin == NULL ) return; + if( CurrentPin == NULL ) + return; - newpos.x = GetScreen()->m_Curseur.x; - newpos.y = - GetScreen()->m_Curseur.y; + newpos.x = GetScreen()->m_Curseur.x; + newpos.y = -GetScreen()->m_Curseur.y; - Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; - // Tst for an other pin in same new position: - for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) - { - if ( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; - if ( Pin == CurrentPin ) continue; - if( newpos != Pin->m_Pos ) continue; - if ( Pin->m_Flags ) continue; - if ( ask_for_pin ) - { - DrawPanel->m_IgnoreMouseEvents = TRUE; - status = IsOK(this, _("Occupied by other pin. Continue?")); - DrawPanel->MouseToCursorSchema(); - DrawPanel->m_IgnoreMouseEvents = FALSE; - if( ! status ) - return; - else ask_for_pin = FALSE; - } - } + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; - DrawPanel->ManageCurseur = NULL; - DrawPanel->ForceCloseManageCurseur = NULL; - GetScreen()->SetModify(); + // Tst for an other pin in same new position: + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( Pin == CurrentPin ) + continue; + if( newpos != Pin->m_Pos ) + continue; + if( Pin->m_Flags ) + continue; + if( ask_for_pin ) + { + DrawPanel->m_IgnoreMouseEvents = TRUE; + status = IsOK( this, _( "Occupied by other pin. Continue?" ) ); + DrawPanel->MouseToCursorSchema(); + DrawPanel->m_IgnoreMouseEvents = FALSE; + if( !status ) + return; + else + ask_for_pin = FALSE; + } + } - CurrentPin->m_Pos = newpos; - if( CurrentPin->m_Flags & IS_NEW ) - { - LastPinOrient = CurrentPin->m_Orient; - LastPinType = CurrentPin->m_PinType; - LastPinShape = CurrentPin->m_PinShape; - CreateImagePins(CurrentPin); - LibItemToRepeat = CurrentPin; - } + DrawPanel->ManageCurseur = NULL; + DrawPanel->ForceCloseManageCurseur = NULL; + GetScreen()->SetModify(); - /* Put linked pins in new position, and clear flags */ - Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; - for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext) - { - if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; - if( Pin->m_Flags == 0 ) continue; - Pin->m_Pos = CurrentPin->m_Pos; - Pin->m_Flags = 0; - } + CurrentPin->m_Pos = newpos; + if( CurrentPin->m_Flags & IS_NEW ) + { + LastPinOrient = CurrentPin->m_Orient; + LastPinType = CurrentPin->m_PinType; + LastPinShape = CurrentPin->m_PinShape; + CreateImagePins( CurrentPin ); + LibItemToRepeat = CurrentPin; + } - DrawPanel->CursorOff(DC); - DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry,0,0, CurrentPin,CurrentUnit, - GR_DEFAULT_DRAWMODE); - DrawPanel->CursorOn(DC); + /* Put linked pins in new position, and clear flags */ + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( Pin->m_Flags == 0 ) + continue; + Pin->m_Pos = CurrentPin->m_Pos; + Pin->m_Flags = 0; + } - CurrentDrawItem = NULL; + DrawPanel->CursorOff( DC ); + DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, CurrentPin, CurrentUnit, + GR_DEFAULT_DRAWMODE ); + DrawPanel->CursorOn( DC ); + + CurrentDrawItem = NULL; }; /***********************************************************/ -void WinEDA_PinPropertiesFrame::SetPinOrient(int neworient) +void WinEDA_PinPropertiesFrame::SetPinOrient( int neworient ) /***********************************************************/ /* Routine de Rotation de la pin courante*/ { -LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; -LibDrawPin * Pin, *RefPin = CurrentPin; + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; + LibDrawPin* Pin, * RefPin = CurrentPin; - if( CurrentLibEntry == NULL ) return; - if ( RefPin == NULL ) return; + if( CurrentLibEntry == NULL ) + return; + if( RefPin == NULL ) + return; - m_Parent->GetScreen()->SetModify(); + m_Parent->GetScreen()->SetModify(); - /* Rotation */ - RefPin->m_Orient = neworient; + /* Rotation */ + RefPin->m_Orient = neworient; - Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; - for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) - { - if( Pin->m_Flags == 0 ) continue; - Pin->m_Orient = RefPin->m_Orient; - if(CurrentPin == NULL ) Pin->m_Flags = 0; - } + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->m_Flags == 0 ) + continue; + Pin->m_Orient = RefPin->m_Orient; + if( CurrentPin == NULL ) + Pin->m_Flags = 0; + } } /*************************************************/ -void WinEDA_LibeditFrame::StartMovePin(wxDC * DC) +void WinEDA_LibeditFrame::StartMovePin( wxDC* DC ) /*************************************************/ + /* Prepare le deplacement d'une pin : - Localise la pin pointee par le curseur, et si elle existe active - la fonction de gestion curseur ( DrawMovePin() ). -*/ + * Localise la pin pointee par le curseur, et si elle existe active + * la fonction de gestion curseur ( DrawMovePin() ). + */ { -LibDrawPin * Pin; -LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; -wxPoint startPos; + LibDrawPin* Pin; + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; + wxPoint startPos; - /* Marquage des pins a traiter */ - Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; - for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext ) - { - Pin->m_Flags = 0; - if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; - if ( Pin == CurrentPin) continue; - if ( (Pin->m_Pos == CurrentPin->m_Pos) && (Pin->m_Orient == CurrentPin->m_Orient) && - (g_EditPinByPinIsOn == FALSE ) ) - Pin->m_Flags |= IS_LINKED | IS_MOVED; - } - CurrentPin->m_Flags |= IS_LINKED | IS_MOVED; - PinPreviousPos = OldPos = CurrentPin->m_Pos; + /* Marquage des pins a traiter */ + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + Pin->m_Flags = 0; + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( Pin == CurrentPin ) + continue; + if( (Pin->m_Pos == CurrentPin->m_Pos) && (Pin->m_Orient == CurrentPin->m_Orient) + && (g_EditPinByPinIsOn == FALSE ) ) + Pin->m_Flags |= IS_LINKED | IS_MOVED; + } - startPos.x = OldPos.x; - startPos.y = -OldPos.y; - DrawPanel->CursorOff(DC); - GetScreen()->m_Curseur = startPos; - DrawPanel->MouseToCursorSchema(); + CurrentPin->m_Flags |= IS_LINKED | IS_MOVED; + PinPreviousPos = OldPos = CurrentPin->m_Pos; - CurrentPin->Display_Infos_DrawEntry(this); - DrawPanel->ManageCurseur = DrawMovePin; - DrawPanel->ForceCloseManageCurseur = AbortPinMove; + startPos.x = OldPos.x; + startPos.y = -OldPos.y; + DrawPanel->CursorOff( DC ); + GetScreen()->m_Curseur = startPos; + DrawPanel->MouseToCursorSchema(); - DrawPanel->CursorOn(DC); + CurrentPin->Display_Infos_DrawEntry( this ); + DrawPanel->ManageCurseur = DrawMovePin; + DrawPanel->ForceCloseManageCurseur = AbortPinMove; + + DrawPanel->CursorOn( DC ); } @@ -297,597 +325,694 @@ wxPoint startPos; /* Routine de deplacement de la Pin courante selon position du curseur souris */ /* Routine normalement appelee par la routine de gestion du curseur */ /******************************************************************************/ -static void DrawMovePin(WinEDA_DrawPanel * panel, wxDC * DC, bool erase) +static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) { -LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; -wxPoint pinpos = CurrentPin->m_Pos; + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; + wxPoint pinpos = CurrentPin->m_Pos; - /* Erase pin in old position */ - if( erase || (CurrentPin->m_Flags & IS_NEW) ) - { - CurrentPin->m_Pos = PinPreviousPos; - DrawLibraryDrawStruct(panel, DC, CurrentLibEntry,0,0, - CurrentPin,CurrentUnit, g_XorMode); - } + /* Erase pin in old position */ + if( erase || (CurrentPin->m_Flags & IS_NEW) ) + { + CurrentPin->m_Pos = PinPreviousPos; + DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, + CurrentPin, CurrentUnit, g_XorMode ); + } - /* Redraw pin in new position */ - CurrentPin->m_Pos.x = panel->m_Parent->GetScreen()->m_Curseur.x; - CurrentPin->m_Pos.y = - panel->m_Parent->GetScreen()->m_Curseur.y; - DrawLibraryDrawStruct(panel, DC, CurrentLibEntry,0,0, CurrentPin,CurrentUnit, g_XorMode); + /* Redraw pin in new position */ + CurrentPin->m_Pos.x = panel->GetScreen()->m_Curseur.x; + CurrentPin->m_Pos.y = -panel->GetScreen()->m_Curseur.y; + DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, CurrentPin, CurrentUnit, g_XorMode ); - PinPreviousPos = CurrentPin->m_Pos; - /* Keep the original position for existing pin (for Undo command) - and the current position for a new pin */ - if ( (CurrentPin->m_Flags & IS_NEW) == 0 ) - CurrentPin->m_Pos = pinpos; + PinPreviousPos = CurrentPin->m_Pos; + + /* Keep the original position for existing pin (for Undo command) + * and the current position for a new pin */ + if( (CurrentPin->m_Flags & IS_NEW) == 0 ) + CurrentPin->m_Pos = pinpos; } - - /**********************************************************/ -void WinEDA_PinPropertiesFrame::SetPinShape( int newshape) +void WinEDA_PinPropertiesFrame::SetPinShape( int newshape ) /**********************************************************/ + /* Changement de la forme de la pin courante. - Le changement est egalement fait sur les autres pins correspondantes - des autres unites de la seule forme convert courante -*/ + * Le changement est egalement fait sur les autres pins correspondantes + * des autres unites de la seule forme convert courante + */ { -LibDrawPin* Pin; -LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; + LibDrawPin* Pin; + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; - if(CurrentPin) - { - CurrentPin->m_PinShape = newshape; - m_Parent->GetScreen()->SetModify(); - CurrentPin->Display_Infos_DrawEntry(m_Parent); + if( CurrentPin ) + { + CurrentPin->m_PinShape = newshape; + m_Parent->GetScreen()->SetModify(); + CurrentPin->Display_Infos_DrawEntry( m_Parent ); - Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; - for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) - { - if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; - if( Pin->m_Flags == 0 ) continue; - if( Pin->m_Convert != CurrentPin->m_Convert ) continue; - Pin->m_PinShape = newshape; - } - } + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( Pin->m_Flags == 0 ) + continue; + if( Pin->m_Convert != CurrentPin->m_Convert ) + continue; + Pin->m_PinShape = newshape; + } + } } /******************************************************/ -void WinEDA_PinPropertiesFrame::SetPinType(int newtype) +void WinEDA_PinPropertiesFrame::SetPinType( int newtype ) /******************************************************/ + /* Changement du type electrique de la pin courante. - Le changement est egalement fait sur les autres pins correspondantes - des autres unites du boitier -*/ + * Le changement est egalement fait sur les autres pins correspondantes + * des autres unites du boitier + */ { -LibDrawPin* Pin; -LibDrawPin * CurrentPin = (LibDrawPin*)CurrentDrawItem; + LibDrawPin* Pin; + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; - if(CurrentPin == NULL) return; + if( CurrentPin == NULL ) + return; - CurrentPin->m_PinType = newtype; - m_Parent->GetScreen()->SetModify(); + CurrentPin->m_PinType = newtype; + m_Parent->GetScreen()->SetModify(); - Pin = (LibDrawPin*)CurrentLibEntry->m_Drawings; - for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) - { - if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; - if( Pin->m_Flags == 0 ) continue; - Pin->m_PinType = newtype; - } + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( Pin->m_Flags == 0 ) + continue; + Pin->m_PinType = newtype; + } } + /********************************************************************************/ -void WinEDA_PinPropertiesFrame::SetPinName(const wxString & newname, int newsize) +void WinEDA_PinPropertiesFrame::SetPinName( const wxString& newname, int newsize ) /********************************************************************************/ + /* Met a jour le nom et la taille de ce nom de la pin courante - si newname == NULL, pas de changement de nom - si newsize < 0 : pas de changement de taille -*/ + * si newname == NULL, pas de changement de nom + * si newsize < 0 : pas de changement de taille + */ { -LibDrawPin * Pin; -LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; -wxString buf; + LibDrawPin* Pin; + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; + wxString buf; - buf = newname; - buf.Replace( wxT(" "), wxT("_")); + buf = newname; + buf.Replace( wxT( " " ), wxT( "_" ) ); - if ( newsize >= 0 ) CurrentPin->m_PinNameSize = newsize; + if( newsize >= 0 ) + CurrentPin->m_PinNameSize = newsize; - CurrentPin->m_PinName = buf; + CurrentPin->m_PinName = buf; - m_Parent->GetScreen()->SetModify(); + m_Parent->GetScreen()->SetModify(); - /* Traitement des autres pins */ - Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; - for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) - { - if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; - if( (Pin->m_Flags & IS_LINKED) == 0 ) continue; - if (newsize >= 0 ) Pin->m_PinNameSize = newsize; - Pin->m_PinName = buf; - } + /* Traitement des autres pins */ + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( (Pin->m_Flags & IS_LINKED) == 0 ) + continue; + if( newsize >= 0 ) + Pin->m_PinNameSize = newsize; + Pin->m_PinName = buf; + } } + /******************************************************************************/ -void WinEDA_PinPropertiesFrame::SetPinNum(const wxString & newnum, int newsize) +void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize ) /******************************************************************************/ + /* Changement du numero de la pin courante. - Le changement est egalement fait sur les autres pins correspondantes - a la forme convertie - Si newnum == NULL: pas de changement de numero - Si newsize < 0 ) pase de changement de taille -*/ + * Le changement est egalement fait sur les autres pins correspondantes + * a la forme convertie + * Si newnum == NULL: pas de changement de numero + * Si newsize < 0 ) pase de changement de taille + */ { -LibDrawPin * Pin; -LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; -wxString buf; + LibDrawPin* Pin; + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; + wxString buf; - buf = newnum; - buf.Replace( wxT(" "), wxT("_")); + buf = newnum; + buf.Replace( wxT( " " ), wxT( "_" ) ); - if(CurrentPin == NULL ) return; + if( CurrentPin == NULL ) + return; - CurrentPin->m_PinNum = 0; + CurrentPin->m_PinNum = 0; - if ( newsize >= 0) CurrentPin->m_PinNumSize = newsize; - CurrentPin->SetPinNumFromString(buf); - m_Parent->GetScreen()->SetModify(); + if( newsize >= 0 ) + CurrentPin->m_PinNumSize = newsize; + CurrentPin->SetPinNumFromString( buf ); + m_Parent->GetScreen()->SetModify(); - Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; - for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) - { - if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; - if( (Pin->m_Flags & IS_LINKED) == 0 ) continue; - if( Pin->m_Unit != CurrentPin->m_Unit ) continue; - if ( newsize >= 0) Pin->m_PinNumSize = newsize; - if ( newnum ) Pin->m_PinNum = CurrentPin->m_PinNum; - } + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( (Pin->m_Flags & IS_LINKED) == 0 ) + continue; + if( Pin->m_Unit != CurrentPin->m_Unit ) + continue; + if( newsize >= 0 ) + Pin->m_PinNumSize = newsize; + if( newnum ) + Pin->m_PinNum = CurrentPin->m_PinNum; + } } /*************************************************/ -void WinEDA_LibeditFrame::DeletePin(wxDC * DC, - EDA_LibComponentStruct* LibEntry, - LibDrawPin* Pin) +void WinEDA_LibeditFrame::DeletePin( wxDC* DC, + EDA_LibComponentStruct* LibEntry, + LibDrawPin* Pin ) /*************************************************/ + /* Routine d'effacement de la pin pointee par la souris - Si g_EditPinByPinIsOn == FALSE : - toutes les pins de meme coordonnee seront effacees. - Sinon seule la pin de l'unite en convert courante sera effacee -*/ + * Si g_EditPinByPinIsOn == FALSE : + * toutes les pins de meme coordonnee seront effacees. + * Sinon seule la pin de l'unite en convert courante sera effacee + */ { -LibEDA_BaseStruct * DrawItem; -wxPoint PinPos; + LibEDA_BaseStruct* DrawItem; + wxPoint PinPos; - if(LibEntry == NULL ) return; - if(Pin == NULL ) return; + if( LibEntry == NULL ) + return; + if( Pin == NULL ) + return; - PinPos = Pin->m_Pos; - DeleteOneLibraryDrawStruct(DrawPanel, DC, LibEntry, Pin, TRUE); + PinPos = Pin->m_Pos; + DeleteOneLibraryDrawStruct( DrawPanel, DC, LibEntry, Pin, TRUE ); - /* Effacement des autres pins de meme coordonnees */ - if( g_EditPinByPinIsOn == FALSE ) - { - DrawItem = LibEntry->m_Drawings; - for ( ; DrawItem != NULL; ) - { - if (DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) - { - DrawItem = DrawItem->Next(); continue; - } - Pin = (LibDrawPin*) DrawItem; - DrawItem = DrawItem->Next(); - if( Pin->m_Pos != PinPos ) continue; - DeleteOneLibraryDrawStruct(DrawPanel, DC, LibEntry, Pin, 0); - } - } - GetScreen()->SetModify(); + /* Effacement des autres pins de meme coordonnees */ + if( g_EditPinByPinIsOn == FALSE ) + { + DrawItem = LibEntry->m_Drawings; + for( ; DrawItem != NULL; ) + { + if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) + { + DrawItem = DrawItem->Next(); continue; + } + Pin = (LibDrawPin*) DrawItem; + DrawItem = DrawItem->Next(); + if( Pin->m_Pos != PinPos ) + continue; + DeleteOneLibraryDrawStruct( DrawPanel, DC, LibEntry, Pin, 0 ); + } + } + GetScreen()->SetModify(); } /*********************************************/ -void WinEDA_LibeditFrame::CreatePin(wxDC * DC) +void WinEDA_LibeditFrame::CreatePin( wxDC* DC ) /*********************************************/ /* Creation d'une nouvelle pin */ { -LibEDA_BaseStruct * DrawItem; -LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; + LibEDA_BaseStruct* DrawItem; + LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem; - if(CurrentLibEntry == NULL ) return; - if(CurrentPin != NULL ) return; + if( CurrentLibEntry == NULL ) + return; + if( CurrentPin != NULL ) + return; - /* Effacement des flags */ - DrawItem = CurrentLibEntry->m_Drawings; - for( ;DrawItem != NULL; DrawItem = DrawItem->Next()) - DrawItem->m_Flags = 0; + /* Effacement des flags */ + DrawItem = CurrentLibEntry->m_Drawings; + for( ; DrawItem != NULL; DrawItem = DrawItem->Next() ) + DrawItem->m_Flags = 0; - CurrentPin = new LibDrawPin(); - CurrentDrawItem = CurrentPin; - if(CurrentPin == NULL ) return; - CurrentPin->m_Flags = IS_NEW; - CurrentPin->m_Unit = CurrentUnit; - CurrentPin->m_Convert = CurrentConvert; + CurrentPin = new LibDrawPin(); - /* Marquage des pins a traiter */ - if( g_EditPinByPinIsOn == FALSE ) CurrentPin->m_Flags |= IS_LINKED; + CurrentDrawItem = CurrentPin; + if( CurrentPin == NULL ) + return; + CurrentPin->m_Flags = IS_NEW; + CurrentPin->m_Unit = CurrentUnit; + CurrentPin->m_Convert = CurrentConvert; - CurrentPin->m_Pos.x = GetScreen()->m_Curseur.x; - CurrentPin->m_Pos.y = - GetScreen()->m_Curseur.y; - CurrentPin->m_PinLen = LastPinSize; - CurrentPin->m_Orient = LastPinOrient; - CurrentPin->m_PinType = LastPinType; - CurrentPin->m_PinShape = LastPinShape; - CurrentPin->m_PinNameSize = LastPinNameSize; - CurrentPin->m_PinNumSize = LastPinNumSize; - if ( LastPinCommonConvert ) CurrentPin->m_Convert = 0; - else CurrentPin->m_Convert = CurrentConvert; - if ( LastPinCommonUnit ) CurrentPin->m_Unit = 0; - else CurrentPin->m_Unit = CurrentUnit; - if( LastPinNoDraw ) CurrentPin->m_Attributs |= PINNOTDRAW; - else CurrentPin->m_Attributs &= ~PINNOTDRAW; + /* Marquage des pins a traiter */ + if( g_EditPinByPinIsOn == FALSE ) + CurrentPin->m_Flags |= IS_LINKED; - CurrentPin->Pnext = CurrentLibEntry->m_Drawings; - CurrentLibEntry->m_Drawings = CurrentPin; - CurrentLibEntry->SortDrawItems(); + CurrentPin->m_Pos.x = GetScreen()->m_Curseur.x; + CurrentPin->m_Pos.y = -GetScreen()->m_Curseur.y; + CurrentPin->m_PinLen = LastPinSize; + CurrentPin->m_Orient = LastPinOrient; + CurrentPin->m_PinType = LastPinType; + CurrentPin->m_PinShape = LastPinShape; + CurrentPin->m_PinNameSize = LastPinNameSize; + CurrentPin->m_PinNumSize = LastPinNumSize; + if( LastPinCommonConvert ) + CurrentPin->m_Convert = 0; + else + CurrentPin->m_Convert = CurrentConvert; + if( LastPinCommonUnit ) + CurrentPin->m_Unit = 0; + else + CurrentPin->m_Unit = CurrentUnit; + if( LastPinNoDraw ) + CurrentPin->m_Attributs |= PINNOTDRAW; + else + CurrentPin->m_Attributs &= ~PINNOTDRAW; - if ( DC ) DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, - 0,0, CurrentPin,CurrentUnit, g_XorMode); + CurrentPin->Pnext = CurrentLibEntry->m_Drawings; + CurrentLibEntry->m_Drawings = CurrentPin; + CurrentLibEntry->SortDrawItems(); - DrawPanel->m_IgnoreMouseEvents = TRUE; - InstallPineditFrame(this, DC, wxPoint(-1,-1) ); - DrawPanel->MouseToCursorSchema(); - DrawPanel->m_IgnoreMouseEvents = FALSE; + if( DC ) + DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, + 0, 0, CurrentPin, CurrentUnit, g_XorMode ); - PinPreviousPos = CurrentPin->m_Pos; + DrawPanel->m_IgnoreMouseEvents = TRUE; + InstallPineditFrame( this, DC, wxPoint( -1, -1 ) ); + DrawPanel->MouseToCursorSchema(); + DrawPanel->m_IgnoreMouseEvents = FALSE; - DrawPanel->ManageCurseur = DrawMovePin; - DrawPanel->ForceCloseManageCurseur = AbortPinMove; + PinPreviousPos = CurrentPin->m_Pos; - CurrentPin->Display_Infos_DrawEntry(this); - GetScreen()->SetModify(); + DrawPanel->ManageCurseur = DrawMovePin; + DrawPanel->ForceCloseManageCurseur = AbortPinMove; + + CurrentPin->Display_Infos_DrawEntry( this ); + GetScreen()->SetModify(); } +/*********************************************************/ +void WinEDA_PinPropertiesFrame::SetAttributsPin( bool draw, + bool unit, bool convert ) +/*********************************************************/ -/*********************************************************/ -void WinEDA_PinPropertiesFrame::SetAttributsPin(bool draw, - bool unit, bool convert) -/*********************************************************/ /* si draw == TRUE - - Ajuste le flag visible / invisible (.U.Pin.Flags bit 0 ) de la pin - editee - - si unit == TRUE - - Modifie l'attribut Commun / Particulier U.Pin.Unit = 0 ou Num Unite - de la pin editee - - si convert == TRUE - - Modifie l'attribut Commun / Particulier U.Pin.Convert = 0 ou Num Unite - de la pin editee - -*/ + * - Ajuste le flag visible / invisible (.U.Pin.Flags bit 0 ) de la pin + * editee + * + * si unit == TRUE + * - Modifie l'attribut Commun / Particulier U.Pin.Unit = 0 ou Num Unite + * de la pin editee + * + * si convert == TRUE + * - Modifie l'attribut Commun / Particulier U.Pin.Convert = 0 ou Num Unite + * de la pin editee + * + */ { -LibEDA_BaseStruct* DrawItem; -LibDrawPin * Pin, * CurrentPin = (LibDrawPin * ) CurrentDrawItem; + LibEDA_BaseStruct* DrawItem; + LibDrawPin* Pin, * CurrentPin = (LibDrawPin*) CurrentDrawItem; - if(CurrentPin == NULL) return; + if( CurrentPin == NULL ) + return; - m_Parent->GetScreen()->SetModify(); + m_Parent->GetScreen()->SetModify(); - if( unit ) - { - if ( LastPinCommonUnit ) CurrentPin->m_Unit = 0; - else CurrentPin->m_Unit = CurrentUnit; + if( unit ) + { + if( LastPinCommonUnit ) + CurrentPin->m_Unit = 0; + else + CurrentPin->m_Unit = CurrentUnit; - Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; - if( CurrentPin->m_Unit == 0 ) - { - DrawItem = CurrentLibEntry->m_Drawings; - for ( ; DrawItem != NULL; ) - { - Pin = (LibDrawPin *)DrawItem; - DrawItem = DrawItem->Next(); - if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE) continue; - if( Pin->m_Flags == 0 ) continue; - if( Pin == CurrentPin) continue; - if(CurrentPin->m_Convert && (CurrentPin->m_Convert != Pin->m_Convert)) - continue; - if( CurrentPin->m_Pos != Pin->m_Pos ) continue; - if(Pin->m_Orient != CurrentPin->m_Orient) continue; - DeleteOneLibraryDrawStruct(m_Parent->DrawPanel, NULL, - CurrentLibEntry, Pin, 0); - } - } - } // end if unit + if( CurrentPin->m_Unit == 0 ) + { + DrawItem = CurrentLibEntry->m_Drawings; + for( ; DrawItem != NULL; ) + { + Pin = (LibDrawPin*) DrawItem; + DrawItem = DrawItem->Next(); + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( Pin->m_Flags == 0 ) + continue; + if( Pin == CurrentPin ) + continue; + if( CurrentPin->m_Convert && (CurrentPin->m_Convert != Pin->m_Convert) ) + continue; + if( CurrentPin->m_Pos != Pin->m_Pos ) + continue; + if( Pin->m_Orient != CurrentPin->m_Orient ) + continue; + DeleteOneLibraryDrawStruct( m_Parent->DrawPanel, NULL, + CurrentLibEntry, Pin, 0 ); + } + } + } // end if unit - if( convert ) - { - if ( LastPinCommonConvert ) CurrentPin->m_Convert = 0; - else CurrentPin->m_Convert = CurrentConvert; + if( convert ) + { + if( LastPinCommonConvert ) + CurrentPin->m_Convert = 0; + else + CurrentPin->m_Convert = CurrentConvert; - if( CurrentPin->m_Convert == 0 ) /* Effacement des pins redondantes */ - { - DrawItem = CurrentLibEntry->m_Drawings; - for ( ; DrawItem != NULL; ) - { - Pin = (LibDrawPin *)DrawItem; DrawItem = DrawItem->Next(); - if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE) continue; - if( Pin->m_Flags == 0 ) continue; - if( Pin == CurrentPin) continue; - if( CurrentPin->m_Unit && (CurrentPin->m_Unit != Pin->m_Unit) ) - continue; - if( CurrentPin->m_Pos != Pin->m_Pos ) continue; - if(Pin->m_Orient != CurrentPin->m_Orient) continue; - DeleteOneLibraryDrawStruct(m_Parent->DrawPanel, NULL, - CurrentLibEntry, Pin, 0); - } - } - } // end if convert + if( CurrentPin->m_Convert == 0 ) /* Effacement des pins redondantes */ + { + DrawItem = CurrentLibEntry->m_Drawings; + for( ; DrawItem != NULL; ) + { + Pin = (LibDrawPin*) DrawItem; DrawItem = DrawItem->Next(); + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( Pin->m_Flags == 0 ) + continue; + if( Pin == CurrentPin ) + continue; + if( CurrentPin->m_Unit && (CurrentPin->m_Unit != Pin->m_Unit) ) + continue; + if( CurrentPin->m_Pos != Pin->m_Pos ) + continue; + if( Pin->m_Orient != CurrentPin->m_Orient ) + continue; + DeleteOneLibraryDrawStruct( m_Parent->DrawPanel, NULL, + CurrentLibEntry, Pin, 0 ); + } + } + } // end if convert - if( draw ) - { - if( LastPinNoDraw ) CurrentPin->m_Attributs |= PINNOTDRAW; - else CurrentPin->m_Attributs &= ~PINNOTDRAW; + if( draw ) + { + if( LastPinNoDraw ) + CurrentPin->m_Attributs |= PINNOTDRAW; + else + CurrentPin->m_Attributs &= ~PINNOTDRAW; - Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; - for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext) - { - if( Pin->m_Flags == 0 ) continue; - Pin->m_Attributs &= ~PINNOTDRAW; - if(CurrentPin->m_Attributs & PINNOTDRAW) - Pin->m_Attributs |= PINNOTDRAW; - } - } + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->m_Flags == 0 ) + continue; + Pin->m_Attributs &= ~PINNOTDRAW; + if( CurrentPin->m_Attributs & PINNOTDRAW ) + Pin->m_Attributs |= PINNOTDRAW; + } + } } /******************************************************/ -void WinEDA_PinPropertiesFrame::NewSizePin(int newsize) +void WinEDA_PinPropertiesFrame::NewSizePin( int newsize ) /******************************************************/ + /* Fonction permettant la mise aux dimensions courantes: - - longueur, dimension des textes - de la pin courante - -*/ + * - longueur, dimension des textes + * de la pin courante + * + */ { -LibDrawPin * RefPin, * Pin = (LibDrawPin *) CurrentDrawItem; + LibDrawPin* RefPin, * Pin = (LibDrawPin*) CurrentDrawItem; - if(CurrentLibEntry == NULL ) return; - if(Pin == NULL ) return; + if( CurrentLibEntry == NULL ) + return; + if( Pin == NULL ) + return; - m_Parent->GetScreen()->SetModify(); + m_Parent->GetScreen()->SetModify(); - Pin->m_PinLen = newsize; + Pin->m_PinLen = newsize; - Pin->Display_Infos_DrawEntry(m_Parent); + Pin->Display_Infos_DrawEntry( m_Parent ); - RefPin = Pin; + RefPin = Pin; - if( g_EditPinByPinIsOn == FALSE ) - { - Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; - for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext ) - { - if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; - if( Pin->m_Pos != RefPin->m_Pos ) continue; - if(Pin->m_Orient != RefPin->m_Orient) continue; - if( Pin->m_Convert == RefPin->m_Convert ) Pin->m_PinLen = newsize; - } - } + if( g_EditPinByPinIsOn == FALSE ) + { + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( Pin->m_Pos != RefPin->m_Pos ) + continue; + if( Pin->m_Orient != RefPin->m_Orient ) + continue; + if( Pin->m_Convert == RefPin->m_Convert ) + Pin->m_PinLen = newsize; + } + } } + /********************************************/ -static void CreateImagePins(LibDrawPin* Pin) +static void CreateImagePins( LibDrawPin* Pin ) /********************************************/ + /* Creation des autres pins pour les autres unites et pour convert, apres - creation d'une pin -*/ + * creation d'une pin + */ { -int ii, CreateConv = FALSE; -LibDrawPin* NewPin; + int ii, CreateConv = FALSE; + LibDrawPin* NewPin; - if( g_EditPinByPinIsOn ) return; + if( g_EditPinByPinIsOn ) + return; - if( g_AsDeMorgan && (Pin->m_Convert != 0 ) ) CreateConv = TRUE; + if( g_AsDeMorgan && (Pin->m_Convert != 0 ) ) + CreateConv = TRUE; - /* Creation de la pin " convert " pour la part courante */ - if( CreateConv == TRUE) - { - NewPin = Pin->GenCopy(); - if( Pin->m_Convert > 1 ) NewPin->m_Convert = 1; - else NewPin->m_Convert = 2; - NewPin->Pnext = CurrentLibEntry->m_Drawings; - CurrentLibEntry->m_Drawings = NewPin; - } + /* Creation de la pin " convert " pour la part courante */ + if( CreateConv == TRUE ) + { + NewPin = Pin->GenCopy(); + if( Pin->m_Convert > 1 ) + NewPin->m_Convert = 1; + else + NewPin->m_Convert = 2; + NewPin->Pnext = CurrentLibEntry->m_Drawings; + CurrentLibEntry->m_Drawings = NewPin; + } - for ( ii = 1; ii <= CurrentLibEntry->m_UnitCount ; ii++ ) - { - if ( ii == CurrentUnit ) continue; /* Deja fait */ - if( Pin->m_Unit == 0 ) continue; /* Pin commune a toutes les unites */ + for( ii = 1; ii <= CurrentLibEntry->m_UnitCount; ii++ ) + { + if( ii == CurrentUnit ) + continue; /* Deja fait */ + if( Pin->m_Unit == 0 ) + continue; /* Pin commune a toutes les unites */ - /* Creation pour la representation "normale" */ - NewPin = Pin->GenCopy(); - if( CurrentConvert != 0 ) NewPin->m_Convert = 1; - NewPin->m_Unit = ii; - NewPin->Pnext = CurrentLibEntry->m_Drawings; - CurrentLibEntry->m_Drawings = NewPin; + /* Creation pour la representation "normale" */ + NewPin = Pin->GenCopy(); + if( CurrentConvert != 0 ) + NewPin->m_Convert = 1; + NewPin->m_Unit = ii; + NewPin->Pnext = CurrentLibEntry->m_Drawings; + CurrentLibEntry->m_Drawings = NewPin; - /* Creation pour la representation "Convert" */ - if( CreateConv == FALSE ) continue; + /* Creation pour la representation "Convert" */ + if( CreateConv == FALSE ) + continue; - NewPin = Pin->GenCopy(); - NewPin->m_Convert = 2; - if( Pin->m_Unit != 0 ) NewPin->m_Unit = ii; - NewPin->Pnext = CurrentLibEntry->m_Drawings; - CurrentLibEntry->m_Drawings = NewPin; - } + NewPin = Pin->GenCopy(); + NewPin->m_Convert = 2; + if( Pin->m_Unit != 0 ) + NewPin->m_Unit = ii; + NewPin->Pnext = CurrentLibEntry->m_Drawings; + CurrentLibEntry->m_Drawings = NewPin; + } } - - /*************************************************/ -void WinEDA_LibeditFrame::GlobalSetPins(wxDC * DC, - LibDrawPin * MasterPin, int id) +void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC, + LibDrawPin* MasterPin, int id ) /*************************************************/ + /* Depending on "id": - - Change pin text size (name or num) (range 10 .. 1000 mil) - - Change pin lenght. - - If Pin is selected ( .m_flag == IS_SELECTED ) only the other selected pis are modified -*/ + * - Change pin text size (name or num) (range 10 .. 1000 mil) + * - Change pin lenght. + * + * If Pin is selected ( .m_flag == IS_SELECTED ) only the other selected pis are modified + */ { -LibDrawPin * Pin; -bool selected = (MasterPin->m_Selected & IS_SELECTED) != 0; + LibDrawPin* Pin; + bool selected = (MasterPin->m_Selected & IS_SELECTED) != 0; - if( (CurrentLibEntry == NULL) || (MasterPin == NULL) ) return; - if(MasterPin->Type() != COMPONENT_PIN_DRAW_TYPE ) return; + if( (CurrentLibEntry == NULL) || (MasterPin == NULL) ) + return; + if( MasterPin->Type() != COMPONENT_PIN_DRAW_TYPE ) + return; - GetScreen()->SetModify(); + GetScreen()->SetModify(); - Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; - for( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) - { - if ( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; - if ( (Pin->m_Convert) && (Pin->m_Convert != CurrentConvert) ) continue; - // Is it the "selected mode" ? - if (selected && (Pin->m_Selected & IS_SELECTED) == 0 ) continue; + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) + continue; + if( (Pin->m_Convert) && (Pin->m_Convert != CurrentConvert) ) + continue; - DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry,0,0, Pin, CurrentUnit, g_XorMode); + // Is it the "selected mode" ? + if( selected && (Pin->m_Selected & IS_SELECTED) == 0 ) + continue; - switch ( id ) - { - case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: - Pin->m_PinNumSize = MasterPin->m_PinNumSize; - break; + DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, Pin, CurrentUnit, g_XorMode ); - case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM: - Pin->m_PinNameSize = MasterPin->m_PinNameSize; - break; + switch( id ) + { + case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: + Pin->m_PinNumSize = MasterPin->m_PinNumSize; + break; - case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM: - Pin->m_PinLen = MasterPin->m_PinLen; - break; - } + case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM: + Pin->m_PinNameSize = MasterPin->m_PinNameSize; + break; - DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry,0,0, Pin, CurrentUnit, - GR_DEFAULT_DRAWMODE); - } + case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM: + Pin->m_PinLen = MasterPin->m_PinLen; + break; + } + + DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, Pin, CurrentUnit, + GR_DEFAULT_DRAWMODE ); + } } - - /************************************************************************/ -void WinEDA_LibeditFrame::RepeatPinItem(wxDC * DC, LibDrawPin * SourcePin) +void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LibDrawPin* SourcePin ) /************************************************************************/ /* Creation d'une nouvelle pin par copie de la pr�c�dente ( fct REPEAT) */ { -LibDrawPin * Pin; -wxString msg; -int ox = 0, oy = 0; + LibDrawPin* Pin; + wxString msg; + int ox = 0, oy = 0; - if(CurrentLibEntry == NULL ) return; - if(SourcePin == NULL ) return; - if(SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE ) return; + if( CurrentLibEntry == NULL ) + return; + if( SourcePin == NULL ) + return; + if( SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE ) + return; - Pin = SourcePin->GenCopy(); - Pin->Pnext = CurrentLibEntry->m_Drawings; - CurrentLibEntry->m_Drawings = Pin; - Pin->m_Flags = IS_NEW; + Pin = SourcePin->GenCopy(); + Pin->Pnext = CurrentLibEntry->m_Drawings; + CurrentLibEntry->m_Drawings = Pin; + Pin->m_Flags = IS_NEW; - Pin->m_Pos.x += g_RepeatStep.x; ox = Pin->m_Pos.x; - Pin->m_Pos.y += - g_RepeatStep.y; oy = Pin->m_Pos.y; // ici axe Y comme en math - /*** Increment du numero de label ***/ - IncrementLabelMember(Pin->m_PinName); + Pin->m_Pos.x += g_RepeatStep.x; ox = Pin->m_Pos.x; + Pin->m_Pos.y += -g_RepeatStep.y; oy = Pin->m_Pos.y; // ici axe Y comme en math + /*** Increment du numero de label ***/ + IncrementLabelMember( Pin->m_PinName ); - Pin->ReturnPinStringNum(msg); - IncrementLabelMember(msg); - Pin->SetPinNumFromString(msg); + Pin->ReturnPinStringNum( msg ); + IncrementLabelMember( msg ); + Pin->SetPinNumFromString( msg ); - CurrentDrawItem = Pin; + CurrentDrawItem = Pin; - /* Marquage des pins a traiter */ - if( g_EditPinByPinIsOn == FALSE ) Pin->m_Flags |= IS_LINKED; + /* Marquage des pins a traiter */ + if( g_EditPinByPinIsOn == FALSE ) + Pin->m_Flags |= IS_LINKED; + + wxPoint savepos = GetScreen()->m_Curseur; + DrawPanel->CursorOff( DC ); + GetScreen()->m_Curseur.x = Pin->m_Pos.x; + GetScreen()->m_Curseur.y = -Pin->m_Pos.y; + PlacePin( DC ); + GetScreen()->m_Curseur = savepos; -wxPoint savepos = GetScreen()->m_Curseur; - DrawPanel->CursorOff(DC); - GetScreen()->m_Curseur.x = Pin->m_Pos.x; - GetScreen()->m_Curseur.y = -Pin->m_Pos.y; - PlacePin(DC); - GetScreen()->m_Curseur = savepos; // DrawPanel->MouseToCursorSchema(); - DrawPanel->CursorOn(DC); + DrawPanel->CursorOn( DC ); - Pin->Display_Infos_DrawEntry(this); - GetScreen()->SetModify(); + Pin->Display_Infos_DrawEntry( this ); + GetScreen()->SetModify(); } -int sort_by_pin_number(const void * ref, const void * tst ) + +int sort_by_pin_number( const void* ref, const void* tst ) { -const LibDrawPin * Ref = * (LibDrawPin **) ref; -const LibDrawPin * Tst = * (LibDrawPin **) tst; - return ( Ref->m_PinNum - Tst->m_PinNum); + const LibDrawPin* Ref = *(LibDrawPin**) ref; + const LibDrawPin* Tst = *(LibDrawPin**) tst; + + return Ref->m_PinNum - Tst->m_PinNum; } + + /***************************************************************/ -bool WinEDA_LibeditFrame::TestPins(EDA_LibComponentStruct* LibEntry) +bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry ) /***************************************************************/ + // Test des pins ( duplicates...) { -int nb_pins, ii, error; -LibDrawPin * Pin, **PinList; -wxString msg; + int nb_pins, ii, error; + LibDrawPin* Pin, ** PinList; + wxString msg; - if( CurrentLibEntry == NULL ) return FALSE; + if( CurrentLibEntry == NULL ) + return FALSE; - // Construction de la liste des pins: - Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; - for( nb_pins = 0; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) - { - if ( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) nb_pins++; - } - PinList = (LibDrawPin **) MyZMalloc( (nb_pins+1) * sizeof(LibDrawPin *) ); - Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; - for( ii = 0; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) - { - if ( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) PinList[ii++] = Pin; - } + // Construction de la liste des pins: + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( nb_pins = 0; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) + nb_pins++; + } - // Classement des pins par numero de pin - qsort(PinList, nb_pins, sizeof(LibDrawPin *), sort_by_pin_number); - // Controle des duplicates: - error = 0; - for( ii = 1; ii < nb_pins; ii++ ) - { - wxString aux_msg, StringPinNum; - LibDrawPin * curr_pin = PinList[ii]; - Pin = PinList[ii -1]; - if ( Pin->m_PinNum != curr_pin->m_PinNum ) continue; - if ( Pin->m_Convert != curr_pin->m_Convert ) continue; - if ( Pin->m_Unit != curr_pin->m_Unit ) continue; - error ++; - curr_pin->ReturnPinStringNum(StringPinNum); - msg.Printf(_("Duplicate Pin %4.4s (Pin %s loc %d, %d, and Pin %s loc %d, %d)"), - StringPinNum.GetData(), curr_pin->m_PinName.GetData(), curr_pin->m_Pos.x, -curr_pin->m_Pos.y, - Pin->m_PinName.GetData(), Pin->m_Pos.x, -Pin->m_Pos.y); - if ( CurrentLibEntry->m_UnitCount > 1 ) - { - aux_msg.Printf( _(" Part %d"), curr_pin->m_Unit); - msg += aux_msg; - } - if ( g_AsDeMorgan ) - { - if( curr_pin->m_Convert) msg += _(" Convert"); - else msg += _(" Normal"); - } - DisplayError(this, msg); - } + PinList = (LibDrawPin**) MyZMalloc( (nb_pins + 1) * sizeof(LibDrawPin*) ); + Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; + for( ii = 0; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) + { + if( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) + PinList[ii++] = Pin; + } - free (PinList); - return error ? TRUE : FALSE; + // Classement des pins par numero de pin + qsort( PinList, nb_pins, sizeof(LibDrawPin*), sort_by_pin_number ); + + // Controle des duplicates: + error = 0; + for( ii = 1; ii < nb_pins; ii++ ) + { + wxString aux_msg, StringPinNum; + LibDrawPin* curr_pin = PinList[ii]; + Pin = PinList[ii - 1]; + if( Pin->m_PinNum != curr_pin->m_PinNum ) + continue; + if( Pin->m_Convert != curr_pin->m_Convert ) + continue; + if( Pin->m_Unit != curr_pin->m_Unit ) + continue; + error++; + curr_pin->ReturnPinStringNum( StringPinNum ); + msg.Printf( _( "Duplicate Pin %4.4s (Pin %s loc %d, %d, and Pin %s loc %d, %d)" ), + StringPinNum.GetData(), + curr_pin->m_PinName.GetData(), curr_pin->m_Pos.x, -curr_pin->m_Pos.y, + Pin->m_PinName.GetData(), Pin->m_Pos.x, -Pin->m_Pos.y ); + if( CurrentLibEntry->m_UnitCount > 1 ) + { + aux_msg.Printf( _( " Part %d" ), curr_pin->m_Unit ); + msg += aux_msg; + } + if( g_AsDeMorgan ) + { + if( curr_pin->m_Convert ) + msg += _( " Convert" ); + else + msg += _( " Normal" ); + } + DisplayError( this, msg ); + } + + free( PinList ); + return error ? TRUE : FALSE; } - diff --git a/eeschema/plothpgl.cpp b/eeschema/plothpgl.cpp index 5701fc97b7..7751405c64 100644 --- a/eeschema/plothpgl.cpp +++ b/eeschema/plothpgl.cpp @@ -1,4 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// + // Name: plothpgl.cpp // Purpose: // Author: jean-pierre Charras @@ -11,7 +12,7 @@ // Generated by DialogBlocks (unregistered), 04/02/2006 16:54:19 -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA) #pragma implementation "plothpgl.h" #endif @@ -54,10 +55,10 @@ extern void Move_Plume( wxPoint pos, int plume ); extern void Plume( int plume ); /* Variables locales : */ -FILE * PlotOutput; /* exportee dans printps.cc */ +FILE* PlotOutput; /* exportee dans printps.cc */ static double Scale_X = 1; static double Scale_Y = 1; -int HPGL_SizeSelect; +int HPGL_SizeSelect; enum PageFormatReq { PAGE_DEFAULT = 0, @@ -73,7 +74,7 @@ enum PageFormatReq { PAGE_SIZE_E }; -static Ki_PageDescr * Plot_sheet_list[] = +static Ki_PageDescr* Plot_sheet_list[] = { NULL, &g_Sheet_A4, @@ -93,17 +94,17 @@ static Ki_PageDescr * Plot_sheet_list[] = /* Routines Locales */ - - /**************************************************************/ -void WinEDA_SchematicFrame::ToPlot_HPGL(wxCommandEvent& event) +void WinEDA_SchematicFrame::ToPlot_HPGL( wxCommandEvent& event ) /**************************************************************/ { - WinEDA_PlotHPGLFrame * HPGL_frame = new WinEDA_PlotHPGLFrame(this); + WinEDA_PlotHPGLFrame* HPGL_frame = new WinEDA_PlotHPGLFrame( this ); + HPGL_frame->ShowModal(); HPGL_frame->Destroy(); } + /*! * WinEDA_PlotHPGLFrame type definition */ @@ -117,21 +118,21 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PlotHPGLFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_PlotHPGLFrame, wxDialog ) ////@begin WinEDA_PlotHPGLFrame event table entries - EVT_RADIOBOX( ID_RADIOBOX, WinEDA_PlotHPGLFrame::OnRadioboxSelected ) +EVT_RADIOBOX( ID_RADIOBOX, WinEDA_PlotHPGLFrame::OnRadioboxSelected ) - EVT_SPINCTRL( ID_PEN_WIDTH_UPDATED, WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated ) +EVT_SPINCTRL( ID_PEN_WIDTH_UPDATED, WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated ) - EVT_SPINCTRL( ID_PEN_SPEED_UPDATED, WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated ) +EVT_SPINCTRL( ID_PEN_SPEED_UPDATED, WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated ) - EVT_SPINCTRL( ID_PEN_NUMBER_UPDATED, WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated ) +EVT_SPINCTRL( ID_PEN_NUMBER_UPDATED, WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated ) - EVT_BUTTON( ID_PLOT_HPGL_CURRENT_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick ) +EVT_BUTTON( ID_PLOT_HPGL_CURRENT_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick ) - EVT_BUTTON( ID_PLOT_HPGL_ALL_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick ) +EVT_BUTTON( ID_PLOT_HPGL_ALL_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick ) - EVT_BUTTON( wxID_CANCEL, WinEDA_PlotHPGLFrame::OnCancelClick ) +EVT_BUTTON( wxID_CANCEL, WinEDA_PlotHPGLFrame::OnCancelClick ) - EVT_BUTTON( ID_PLOT_ACCEPT_OFFSET, WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick ) +EVT_BUTTON( ID_PLOT_ACCEPT_OFFSET, WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick ) ////@end WinEDA_PlotHPGLFrame event table entries @@ -141,178 +142,294 @@ END_EVENT_TABLE() * WinEDA_PlotHPGLFrame constructors */ -WinEDA_PlotHPGLFrame::WinEDA_PlotHPGLFrame( ) +WinEDA_PlotHPGLFrame::WinEDA_PlotHPGLFrame() { } -WinEDA_PlotHPGLFrame::WinEDA_PlotHPGLFrame( WinEDA_DrawFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) + +WinEDA_PlotHPGLFrame::WinEDA_PlotHPGLFrame( WinEDA_DrawFrame* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style ) { m_Parent = parent; - Create(parent, id, caption, pos, size, style); + Create( parent, id, caption, pos, size, style ); SetPageOffsetValue(); } + /*! * WinEDA_PlotHPGLFrame creator */ -bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style ) { ////@begin WinEDA_PlotHPGLFrame member initialisation - m_SizeOption = NULL; - m_ButtPenWidth = NULL; - m_ButtPenSpeed = NULL; - m_ButtPenNum = NULL; + m_SizeOption = NULL; + m_ButtPenWidth = NULL; + m_ButtPenSpeed = NULL; + m_ButtPenNum = NULL; m_PlotOrgPosition_X = NULL; m_PlotOrgPosition_Y = NULL; m_MsgBox = NULL; + ////@end WinEDA_PlotHPGLFrame member initialisation ////@begin WinEDA_PlotHPGLFrame creation - SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); + SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS ); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); - GetSizer()->Fit(this); - GetSizer()->SetSizeHints(this); + GetSizer()->Fit( this ); + GetSizer()->SetSizeHints( this ); Centre(); + ////@end WinEDA_PlotHPGLFrame creation return true; } + /*! * Control creation for WinEDA_PlotHPGLFrame */ void WinEDA_PlotHPGLFrame::CreateControls() { - SetFont(*g_DialogFont); + SetFont( *g_DialogFont ); + ////@begin WinEDA_PlotHPGLFrame content construction // Generated by DialogBlocks, 04/02/2006 16:54:19 (unregistered) WinEDA_PlotHPGLFrame* itemDialog1 = this; - wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); - itemDialog1->SetSizer(itemBoxSizer2); + wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemDialog1->SetSizer( itemBoxSizer2 ); - wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5); + wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL ); + + itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); + + wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL ); + + itemBoxSizer3->Add( itemBoxSizer4, 0, wxGROW | wxALL, 5 ); wxString m_SizeOptionStrings[] = { - _("Sheet Size"), - _("Page Size A4"), - _("Page Size A3"), - _("Page Size A2"), - _("Page Size A1"), - _("Page Size A0"), - _("Page Size A"), - _("Page Size B"), - _("Page Size C"), - _("Page Size D"), - _("Page Size E") + _( "Sheet Size" ), + _( "Page Size A4" ), + _( "Page Size A3" ), + _( "Page Size A2" ), + _( "Page Size A1" ), + _( "Page Size A0" ), + _( "Page Size A" ), + _( "Page Size B" ), + _( "Page Size C" ), + _( "Page Size D" ), + _( "Page Size E" ) }; - m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot page size:"), wxDefaultPosition, wxDefaultSize, 11, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS ); - itemBoxSizer4->Add(m_SizeOption, 0, wxALIGN_LEFT|wxALL, 5); + m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _( + "Plot page size:" ), + wxDefaultPosition, + wxDefaultSize, 11, m_SizeOptionStrings, 1, + wxRA_SPECIFY_COLS ); - wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer3->Add(itemBoxSizer6, 0, wxALIGN_TOP|wxALL, 5); + itemBoxSizer4->Add( m_SizeOption, 0, wxALIGN_LEFT | wxALL, 5 ); - wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Pen control:")); - wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL); - itemBoxSizer6->Add(itemStaticBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxVERTICAL ); - wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Width ( mils )"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer7->Add(itemStaticText8, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + itemBoxSizer3->Add( itemBoxSizer6, 0, wxALIGN_TOP | wxALL, 5 ); - m_ButtPenWidth = new wxSpinCtrl( itemDialog1, ID_PEN_WIDTH_UPDATED, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 1, 100, 0 ); - itemStaticBoxSizer7->Add(m_ButtPenWidth, 0, wxALIGN_LEFT|wxALL, 5); + wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox( itemDialog1, wxID_ANY, _( + "Pen control:" ) ); - wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Speed ( cm/s )"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer7->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer( + itemStaticBoxSizer7Static, + wxVERTICAL ); - m_ButtPenSpeed = new wxSpinCtrl( itemDialog1, ID_PEN_SPEED_UPDATED, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 ); - itemStaticBoxSizer7->Add(m_ButtPenSpeed, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemBoxSizer6->Add( itemStaticBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); - wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Number"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer7->Add(itemStaticText12, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _( + "Pen Width ( mils )" ), + wxDefaultPosition, wxDefaultSize, 0 ); - m_ButtPenNum = new wxSpinCtrl( itemDialog1, ID_PEN_NUMBER_UPDATED, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 8, 0 ); - itemStaticBoxSizer7->Add(m_ButtPenNum, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemStaticBoxSizer7->Add( itemStaticText8, + 0, + wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, + 5 ); - wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Page offset:")); - wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer(itemStaticBoxSizer14Static, wxVERTICAL); - itemBoxSizer6->Add(itemStaticBoxSizer14, 0, wxALIGN_LEFT|wxALL, 5); + m_ButtPenWidth = new wxSpinCtrl( itemDialog1, + ID_PEN_WIDTH_UPDATED, + _T( "0" ), + wxDefaultPosition, + wxDefaultSize, + wxSP_ARROW_KEYS | wxSP_WRAP, + 1, + 100, + 0 ); - wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset X"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + itemStaticBoxSizer7->Add( m_ButtPenWidth, 0, wxALIGN_LEFT | wxALL, 5 ); - m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer14->Add(m_PlotOrgPosition_X, 0, wxALIGN_LEFT|wxALL, 5); + wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _( + "Pen Speed ( cm/s )" ), + wxDefaultPosition, wxDefaultSize, 0 ); - wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset Y"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer14->Add(itemStaticText17, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + itemStaticBoxSizer7->Add( itemStaticText10, + 0, + wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, + 5 ); - m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer14->Add(m_PlotOrgPosition_Y, 0, wxALIGN_LEFT|wxALL, 5); + m_ButtPenSpeed = new wxSpinCtrl( itemDialog1, + ID_PEN_SPEED_UPDATED, + _T( "0" ), + wxDefaultPosition, + wxDefaultSize, + wxSP_ARROW_KEYS, + 1, + 100, + 0 ); - itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemStaticBoxSizer7->Add( m_ButtPenSpeed, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); - wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer3->Add(itemBoxSizer20, 0, wxALIGN_TOP|wxLEFT|wxTOP|wxBOTTOM, 5); + wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _( + "Pen Number" ), + wxDefaultPosition, wxDefaultSize, 0 ); - wxButton* itemButton21 = new wxButton( itemDialog1, ID_PLOT_HPGL_CURRENT_EXECUTE, _("&Plot CURRENT"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton21->SetForegroundColour(wxColour(0, 128, 0)); - itemBoxSizer20->Add(itemButton21, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer7->Add( itemStaticText12, + 0, + wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, + 5 ); - wxButton* itemButton22 = new wxButton( itemDialog1, ID_PLOT_HPGL_ALL_EXECUTE, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton22->SetForegroundColour(wxColour(0, 0, 255)); - itemBoxSizer20->Add(itemButton22, 0, wxGROW|wxALL, 5); + m_ButtPenNum = new wxSpinCtrl( itemDialog1, + ID_PEN_NUMBER_UPDATED, + _T( "0" ), + wxDefaultPosition, + wxDefaultSize, + wxSP_ARROW_KEYS, + 1, + 8, + 0 ); - wxButton* itemButton23 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton23->SetForegroundColour(wxColour(128, 0, 0)); - itemBoxSizer20->Add(itemButton23, 0, wxGROW|wxALL, 5); + itemStaticBoxSizer7->Add( m_ButtPenNum, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); - itemBoxSizer20->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox( itemDialog1, wxID_ANY, _( + "Page offset:" ) ); - wxButton* itemButton25 = new wxButton( itemDialog1, ID_PLOT_ACCEPT_OFFSET, _("&Accept Offset"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton25->SetForegroundColour(wxColour(101, 123, 68)); - itemBoxSizer20->Add(itemButton25, 0, wxGROW|wxALL, 5); + wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer( + itemStaticBoxSizer14Static, + wxVERTICAL ); - m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 110), wxTE_MULTILINE ); - itemBoxSizer2->Add(m_MsgBox, 0, wxGROW|wxALL, 5); + itemBoxSizer6->Add( itemStaticBoxSizer14, 0, wxALIGN_LEFT | wxALL, 5 ); + + wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _( + "Plot Offset X" ), + wxDefaultPosition, wxDefaultSize, 0 ); + + itemStaticBoxSizer14->Add( itemStaticText15, + 0, + wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, + 5 ); + + m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( + "" ), wxDefaultPosition, + wxDefaultSize, 0 ); + + itemStaticBoxSizer14->Add( m_PlotOrgPosition_X, 0, wxALIGN_LEFT | wxALL, 5 ); + + wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _( + "Plot Offset Y" ), + wxDefaultPosition, wxDefaultSize, 0 ); + + itemStaticBoxSizer14->Add( itemStaticText17, + 0, + wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, + 5 ); + + m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T( + "" ), wxDefaultPosition, + wxDefaultSize, 0 ); + + itemStaticBoxSizer14->Add( m_PlotOrgPosition_Y, 0, wxALIGN_LEFT | wxALL, 5 ); + + itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); + + wxBoxSizer* itemBoxSizer20 = new wxBoxSizer( wxVERTICAL ); + + itemBoxSizer3->Add( itemBoxSizer20, 0, wxALIGN_TOP | wxLEFT | wxTOP | wxBOTTOM, 5 ); + + wxButton* itemButton21 = new wxButton( itemDialog1, ID_PLOT_HPGL_CURRENT_EXECUTE, _( + "&Plot CURRENT" ), wxDefaultPosition, + wxDefaultSize, 0 ); + + itemButton21->SetForegroundColour( wxColour( 0, 128, 0 ) ); + itemBoxSizer20->Add( itemButton21, 0, wxGROW | wxALL, 5 ); + + wxButton* itemButton22 = new wxButton( itemDialog1, ID_PLOT_HPGL_ALL_EXECUTE, _( + "Plot A&LL" ), wxDefaultPosition, + wxDefaultSize, 0 ); + + itemButton22->SetForegroundColour( wxColour( 0, 0, 255 ) ); + itemBoxSizer20->Add( itemButton22, 0, wxGROW | wxALL, 5 ); + + wxButton* itemButton23 = new wxButton( itemDialog1, wxID_CANCEL, _( + "&Cancel" ), wxDefaultPosition, + wxDefaultSize, 0 ); + + itemButton23->SetForegroundColour( wxColour( 128, 0, 0 ) ); + itemBoxSizer20->Add( itemButton23, 0, wxGROW | wxALL, 5 ); + + itemBoxSizer20->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); + + wxButton* itemButton25 = new wxButton( itemDialog1, ID_PLOT_ACCEPT_OFFSET, _( + "&Accept Offset" ), wxDefaultPosition, + wxDefaultSize, 0 ); + + itemButton25->SetForegroundColour( wxColour( 101, 123, 68 ) ); + itemBoxSizer20->Add( itemButton25, 0, wxGROW | wxALL, 5 ); + + m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( + "" ), wxDefaultPosition, wxSize( -1, + 110 ), wxTE_MULTILINE ); + + itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL, 5 ); // Set validators - m_SizeOption->SetValidator( wxGenericValidator(& HPGL_SizeSelect) ); - m_ButtPenWidth->SetValidator( wxGenericValidator(& g_HPGL_Pen_Descr.m_Pen_Diam) ); - m_ButtPenSpeed->SetValidator( wxGenericValidator(& g_HPGL_Pen_Descr.m_Pen_Speed) ); - m_ButtPenNum->SetValidator( wxGenericValidator(& g_HPGL_Pen_Descr.m_Pen_Num) ); + m_SizeOption->SetValidator( wxGenericValidator( &HPGL_SizeSelect ) ); + m_ButtPenWidth->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Diam ) ); + m_ButtPenSpeed->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Speed ) ); + m_ButtPenNum->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Num ) ); + ////@end WinEDA_PlotHPGLFrame content construction } - /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_HPGL_CURRENT_EXECUTE */ void WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick( wxCommandEvent& event ) { - HPGL_Plot(event); + HPGL_Plot( event ); } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_HPGL_ALL_EXECUTE */ void WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick( wxCommandEvent& event ) { - HPGL_Plot(event); + HPGL_Plot( event ); } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */ @@ -322,18 +439,21 @@ void WinEDA_PlotHPGLFrame::OnCancelClick( wxCommandEvent& event ) ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame. // Before editing this code, remove the block markers. event.Skip(); + ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame. } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_ACCEPT_OFFSET */ void WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick( wxCommandEvent& event ) { - AcceptPlotOffset(event); + AcceptPlotOffset( event ); } + /*! * Should we show tooltips? */ @@ -343,6 +463,7 @@ bool WinEDA_PlotHPGLFrame::ShowToolTips() return true; } + /*! * Get bitmap resources */ @@ -351,11 +472,13 @@ wxBitmap WinEDA_PlotHPGLFrame::GetBitmapResource( const wxString& name ) { // Bitmap retrieval ////@begin WinEDA_PlotHPGLFrame bitmap retrieval - wxUnusedVar(name); + wxUnusedVar( name ); return wxNullBitmap; + ////@end WinEDA_PlotHPGLFrame bitmap retrieval } + /*! * Get icon resources */ @@ -364,316 +487,349 @@ wxIcon WinEDA_PlotHPGLFrame::GetIconResource( const wxString& name ) { // Icon retrieval ////@begin WinEDA_PlotHPGLFrame icon retrieval - wxUnusedVar(name); + wxUnusedVar( name ); return wxNullIcon; + ////@end WinEDA_PlotHPGLFrame icon retrieval } - /***************************************************/ void WinEDA_PlotHPGLFrame::SetPageOffsetValue() /***************************************************/ { -wxString msg; - if ( HPGL_SizeSelect != PAGE_DEFAULT ) + wxString msg; + + if( HPGL_SizeSelect != PAGE_DEFAULT ) { - msg = ReturnStringFromValue(g_UnitMetric, - Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x, EESCHEMA_INTERNAL_UNIT); - m_PlotOrgPosition_X->SetValue(msg); - msg = ReturnStringFromValue(g_UnitMetric, - Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y, EESCHEMA_INTERNAL_UNIT); - m_PlotOrgPosition_Y->SetValue(msg); - - m_PlotOrgPosition_X->Enable(TRUE); - m_PlotOrgPosition_Y->Enable(TRUE); + msg = ReturnStringFromValue( g_UnitMetric, + Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x, EESCHEMA_INTERNAL_UNIT ); + m_PlotOrgPosition_X->SetValue( msg ); + msg = ReturnStringFromValue( g_UnitMetric, + Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y, EESCHEMA_INTERNAL_UNIT ); + m_PlotOrgPosition_Y->SetValue( msg ); + m_PlotOrgPosition_X->Enable( TRUE ); + m_PlotOrgPosition_Y->Enable( TRUE ); } else { - m_PlotOrgPosition_X->Enable(FALSE); - m_PlotOrgPosition_Y->Enable(FALSE); + m_PlotOrgPosition_X->Enable( FALSE ); + m_PlotOrgPosition_Y->Enable( FALSE ); } } + /*****************************************************************/ -void WinEDA_PlotHPGLFrame::AcceptPlotOffset(wxCommandEvent& event) +void WinEDA_PlotHPGLFrame::AcceptPlotOffset( wxCommandEvent& event ) /*****************************************************************/ { -int ii = m_SizeOption->GetSelection(); + int ii = m_SizeOption->GetSelection(); - if ( ii <= 0 ) HPGL_SizeSelect = 0; - else HPGL_SizeSelect = ii; + if( ii <= 0 ) + HPGL_SizeSelect = 0; + else + HPGL_SizeSelect = ii; - if ( HPGL_SizeSelect != PAGE_DEFAULT) + if( HPGL_SizeSelect != PAGE_DEFAULT ) { wxString msg = m_PlotOrgPosition_X->GetValue(); Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x = - ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT); + ReturnValueFromString( g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT ); msg = m_PlotOrgPosition_Y->GetValue(); Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y = - ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT); + ReturnValueFromString( g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT ); } } /************************************************************/ -void WinEDA_PlotHPGLFrame::SetPenWidth(wxSpinEvent & event) +void WinEDA_PlotHPGLFrame::SetPenWidth( wxSpinEvent& event ) /************************************************************/ { g_HPGL_Pen_Descr.m_Pen_Diam = m_ButtPenWidth->GetValue(); - if ( g_HPGL_Pen_Descr.m_Pen_Diam > 100 ) g_HPGL_Pen_Descr.m_Pen_Diam = 100; - if ( g_HPGL_Pen_Descr.m_Pen_Diam < 1 ) g_HPGL_Pen_Descr.m_Pen_Diam = 1; + if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 ) + g_HPGL_Pen_Descr.m_Pen_Diam = 100; + if( g_HPGL_Pen_Descr.m_Pen_Diam < 1 ) + g_HPGL_Pen_Descr.m_Pen_Diam = 1; } /*********************************************************/ -void WinEDA_PlotHPGLFrame::SetPenSpeed(wxSpinEvent& event) +void WinEDA_PlotHPGLFrame::SetPenSpeed( wxSpinEvent& event ) /*********************************************************/ { g_HPGL_Pen_Descr.m_Pen_Speed = m_ButtPenSpeed->GetValue(); - if ( g_HPGL_Pen_Descr.m_Pen_Speed > 40 ) g_HPGL_Pen_Descr.m_Pen_Speed = 40; - if ( g_HPGL_Pen_Descr.m_Pen_Speed < 1 ) g_HPGL_Pen_Descr.m_Pen_Speed = 1; + if( g_HPGL_Pen_Descr.m_Pen_Speed > 40 ) + g_HPGL_Pen_Descr.m_Pen_Speed = 40; + if( g_HPGL_Pen_Descr.m_Pen_Speed < 1 ) + g_HPGL_Pen_Descr.m_Pen_Speed = 1; } + /*******************************************************/ -void WinEDA_PlotHPGLFrame::SetPenNum(wxSpinEvent& event) +void WinEDA_PlotHPGLFrame::SetPenNum( wxSpinEvent& event ) /*******************************************************/ { g_HPGL_Pen_Descr.m_Pen_Num = m_ButtPenNum->GetValue(); - if ( g_HPGL_Pen_Descr.m_Pen_Num > 8 ) g_HPGL_Pen_Descr.m_Pen_Num = 8; - if ( g_HPGL_Pen_Descr.m_Pen_Num < 1 ) g_HPGL_Pen_Descr.m_Pen_Num = 1; + if( g_HPGL_Pen_Descr.m_Pen_Num > 8 ) + g_HPGL_Pen_Descr.m_Pen_Num = 8; + if( g_HPGL_Pen_Descr.m_Pen_Num < 1 ) + g_HPGL_Pen_Descr.m_Pen_Num = 1; } /***********************************************************/ -void WinEDA_PlotHPGLFrame::HPGL_Plot(wxCommandEvent& event) +void WinEDA_PlotHPGLFrame::HPGL_Plot( wxCommandEvent& event ) /***********************************************************/ { -int Select_PlotAll = FALSE; + int Select_PlotAll = FALSE; - if( event.GetId() == ID_PLOT_HPGL_ALL_EXECUTE ) Select_PlotAll = TRUE; + if( event.GetId() == ID_PLOT_HPGL_ALL_EXECUTE ) + Select_PlotAll = TRUE; - if ( HPGL_SizeSelect ) + if( HPGL_SizeSelect ) { wxString msg = m_PlotOrgPosition_X->GetValue(); Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x = - ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT); + ReturnValueFromString( g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT ); msg = m_PlotOrgPosition_Y->GetValue(); Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y = - ReturnValueFromString(g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT); + ReturnValueFromString( g_UnitMetric, msg, EESCHEMA_INTERNAL_UNIT ); } - Plot_Schematic_HPGL(Select_PlotAll, HPGL_SizeSelect); + Plot_Schematic_HPGL( Select_PlotAll, HPGL_SizeSelect ); } -/*******************************************************************/ -void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN * screen, - wxSize & SheetSize, wxPoint & SheetOffset) -/*******************************************************************/ -/* Fonction calculant les dims et offsets de trace de la feuille selectionnee - retourne: -*/ -{ -Ki_PageDescr * PlotSheet; - if( screen == NULL ) screen = m_Parent->GetScreen(); +/*******************************************************************/ +void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN* screen, + wxSize& SheetSize, wxPoint& SheetOffset ) +/*******************************************************************/ + +/* Fonction calculant les dims et offsets de trace de la feuille selectionnee + * retourne: + */ +{ + Ki_PageDescr* PlotSheet; + + if( screen == NULL ) + screen = m_Parent->GetBaseScreen(); PlotSheet = screen->m_CurrentSheetDesc; - SheetSize = PlotSheet->m_Size; + SheetSize = PlotSheet->m_Size; SheetOffset = PlotSheet->m_Offset; } + /***********************************************************************************/ -void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL(int Select_PlotAll, int HPGL_SheetSize) +void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_SheetSize ) /***********************************************************************************/ { -wxString PlotFileName, ShortFileName; -BASE_SCREEN *screen; -Ki_PageDescr * PlotSheet; -wxSize SheetSize; -wxPoint SheetOffset, PlotOffset; -int margin; + wxString PlotFileName, ShortFileName; + BASE_SCREEN* screen; + Ki_PageDescr* PlotSheet; + wxSize SheetSize; + wxPoint SheetOffset, PlotOffset; + int margin; g_PlotFormat = PLOT_FORMAT_HPGL; /* Build the screen list */ EDA_ScreenList ScreenList; - if ( Select_PlotAll == TRUE ) screen = ScreenList.GetFirst(); - else screen = m_Parent->GetScreen(); - for ( ; screen != NULL; screen = ScreenList.GetNext() ) + if( Select_PlotAll == TRUE ) + screen = ScreenList.GetFirst(); + else + screen = m_Parent->GetBaseScreen(); + for( ; screen != NULL; screen = ScreenList.GetNext() ) { - ReturnSheetDims(screen, SheetSize, SheetOffset); + ReturnSheetDims( screen, SheetSize, SheetOffset ); /* Calcul des echelles de conversion */ - g_PlotScaleX = Scale_X * SCALE_HPGL ; - g_PlotScaleY = Scale_Y * SCALE_HPGL ; + g_PlotScaleX = Scale_X * SCALE_HPGL; + g_PlotScaleY = Scale_Y * SCALE_HPGL; - margin = 400; // Margin in mils - PlotSheet = screen->m_CurrentSheetDesc; - g_PlotScaleX = g_PlotScaleX * (SheetSize.x - 2 * margin)/ PlotSheet->m_Size.x; + margin = 400; // Margin in mils + PlotSheet = screen->m_CurrentSheetDesc; + g_PlotScaleX = g_PlotScaleX * (SheetSize.x - 2 * margin) / PlotSheet->m_Size.x; g_PlotScaleY = g_PlotScaleY * (SheetSize.y - 2 * margin) / PlotSheet->m_Size.y; /* calcul des offsets */ - PlotOffset.x = - (int)(SheetOffset.x * SCALE_HPGL); - PlotOffset.y = (int)( (SheetOffset.y + SheetSize.y) * SCALE_HPGL); - PlotOffset.x -= (int)(margin * SCALE_HPGL); - PlotOffset.y += (int)(margin * SCALE_HPGL); + PlotOffset.x = -(int) (SheetOffset.x * SCALE_HPGL); + PlotOffset.y = (int) ( (SheetOffset.y + SheetSize.y) * SCALE_HPGL ); + PlotOffset.x -= (int) (margin * SCALE_HPGL); + PlotOffset.y += (int) (margin * SCALE_HPGL); - wxSplitPath(screen->m_FileName.GetData(), (wxString*) NULL, - &ShortFileName, (wxString*) NULL); + wxSplitPath( screen->m_FileName.GetData(), (wxString*) NULL, + &ShortFileName, (wxString*) NULL ); wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; - if( ! ShortFileName.IsEmpty() ) - PlotFileName = MakeFileName(dirbuf, ShortFileName, wxT(".plt")); - else PlotFileName = MakeFileName(dirbuf, g_DefaultSchematicFileName, wxT(".plt")); + if( !ShortFileName.IsEmpty() ) + PlotFileName = MakeFileName( dirbuf, ShortFileName, wxT( ".plt" ) ); + else + PlotFileName = MakeFileName( dirbuf, g_DefaultSchematicFileName, wxT( ".plt" ) ); - setlocale(LC_NUMERIC, "C"); - InitPlotParametresHPGL(PlotOffset, g_PlotScaleX, g_PlotScaleY); - Plot_1_Page_HPGL(PlotFileName,screen); - setlocale(LC_NUMERIC, ""); - screen = (BASE_SCREEN*)screen->Pnext; - if ( Select_PlotAll == FALSE ) break; + setlocale( LC_NUMERIC, "C" ); + InitPlotParametresHPGL( PlotOffset, g_PlotScaleX, g_PlotScaleY ); + Plot_1_Page_HPGL( PlotFileName, screen ); + setlocale( LC_NUMERIC, "" ); + screen = (BASE_SCREEN*) screen->Pnext; + if( Select_PlotAll == FALSE ) + break; } - m_MsgBox->AppendText(_("** Plot End **\n")); + m_MsgBox->AppendText( _( "** Plot End **\n" ) ); } /**************************************************************************/ -void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL(const wxString & FullFileName, - BASE_SCREEN * screen) +void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FullFileName, + BASE_SCREEN* screen ) /**************************************************************************/ /* Trace en format HPGL. d'une feuille de dessin - 1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) . -*/ + * 1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) . + */ { -EDA_BaseStruct *DrawList; -SCH_COMPONENT *DrawLibItem; -int x1=0, y1=0, x2=0, y2=0, layer; -wxString msg; + EDA_BaseStruct* DrawList; + SCH_COMPONENT* DrawLibItem; + int x1 = 0, y1 = 0, x2 = 0, y2 = 0, layer; + wxString msg; - PlotOutput = wxFopen(FullFileName, wxT("wt")); - if (PlotOutput == 0) - { - msg = _("Unable to create ") + FullFileName; - DisplayError(this, msg); return ; - } + PlotOutput = wxFopen( FullFileName, wxT( "wt" ) ); + if( PlotOutput == 0 ) + { + msg = _( "Unable to create " ) + FullFileName; + DisplayError( this, msg ); return; + } - msg = _("Plot ") + FullFileName + wxT("\n"); - m_MsgBox->AppendText(msg); + msg = _( "Plot " ) + FullFileName + wxT( "\n" ); + m_MsgBox->AppendText( msg ); /* Init : */ - PrintHeaderHPGL(PlotOutput, g_HPGL_Pen_Descr.m_Pen_Speed, g_HPGL_Pen_Descr.m_Pen_Num); + PrintHeaderHPGL( PlotOutput, g_HPGL_Pen_Descr.m_Pen_Speed, g_HPGL_Pen_Descr.m_Pen_Num ); - PlotWorkSheet(PLOT_FORMAT_HPGL, screen); + PlotWorkSheet( PLOT_FORMAT_HPGL, screen ); DrawList = screen->EEDrawList; - while ( DrawList ) /* tracage */ - { - Plume('U'); + while( DrawList ) /* tracage */ + { + Plume( 'U' ); layer = LAYER_NOTES; + switch( DrawList->Type() ) + { + case DRAW_BUSENTRY_STRUCT_TYPE: + #undef STRUCT + #define STRUCT ( (DrawBusEntryStruct*) DrawList ) + x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y; + x2 = STRUCT->m_End().x; y2 = STRUCT->m_End().y; + layer = STRUCT->GetLayer(); + + case DRAW_SEGMENT_STRUCT_TYPE: + #undef STRUCT + #define STRUCT ( (EDA_DrawLineStruct*) DrawList ) + if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) { - case DRAW_BUSENTRY_STRUCT_TYPE : - #undef STRUCT - #define STRUCT ((DrawBusEntryStruct*)DrawList) - x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y; - x2 = STRUCT->m_End().x; y2 = STRUCT->m_End().y; + x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y; + x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y; layer = STRUCT->GetLayer(); - case DRAW_SEGMENT_STRUCT_TYPE : - #undef STRUCT - #define STRUCT ((EDA_DrawLineStruct*)DrawList) - if ( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE) - { - x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y; - x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y; - layer = STRUCT->GetLayer(); - } - switch (layer) - { - case LAYER_NOTES: /* Trace en pointilles */ - Move_Plume( wxPoint(x1,y1),'U'); - fprintf(PlotOutput,"LT 2;\n"); - Move_Plume( wxPoint(x2,y2),'D'); - fprintf(PlotOutput,"LT;\n"); - break; + } - case LAYER_BUS: /* Trait large */ - { - int deltaX = 0, deltaY = 0; double angle; - if( (x2 - x1) == 0 ) deltaX = 8; - else if( (y2 - y1) == 0 ) deltaY = 8; - else - { - angle = atan2( (double)(x2-x1), (double)(y1-y2) ); - deltaX = (int)( 8 * sin(angle) ); - deltaY = (int)( 8 * cos(angle) ); - } - Move_Plume( wxPoint(x1 + deltaX, y1 - deltaY), 'U'); - Move_Plume( wxPoint(x1 - deltaX,y1 + deltaY), 'D'); - Move_Plume( wxPoint(x2 - deltaX,y2 + deltaY), 'D'); - Move_Plume( wxPoint(x2 + deltaX,y2 - deltaY), 'D'); - Move_Plume( wxPoint(x1 + deltaX,y1 - deltaY), 'D'); - } - break; - - default: - Move_Plume( wxPoint(x1,y1), 'U'); - Move_Plume( wxPoint(x2,y2), 'D'); - break; - } + switch( layer ) + { + case LAYER_NOTES: /* Trace en pointilles */ + Move_Plume( wxPoint( x1, y1 ), 'U' ); + fprintf( PlotOutput, "LT 2;\n" ); + Move_Plume( wxPoint( x2, y2 ), 'D' ); + fprintf( PlotOutput, "LT;\n" ); break; - case DRAW_JUNCTION_STRUCT_TYPE : - #undef STRUCT - #define STRUCT ((DrawJunctionStruct*)DrawList) - x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y; - PlotCercle( wxPoint(x1,y1), DRAWJUNCTION_SIZE * 2); + case LAYER_BUS: /* Trait large */ + { + int deltaX = 0, deltaY = 0; double angle; + if( (x2 - x1) == 0 ) + deltaX = 8; + else if( (y2 - y1) == 0 ) + deltaY = 8; + else + { + angle = atan2( (double) (x2 - x1), (double) (y1 - y2) ); + deltaX = (int) ( 8 * sin( angle ) ); + deltaY = (int) ( 8 * cos( angle ) ); + } + Move_Plume( wxPoint( x1 + deltaX, y1 - deltaY ), 'U' ); + Move_Plume( wxPoint( x1 - deltaX, y1 + deltaY ), 'D' ); + Move_Plume( wxPoint( x2 - deltaX, y2 + deltaY ), 'D' ); + Move_Plume( wxPoint( x2 + deltaX, y2 - deltaY ), 'D' ); + Move_Plume( wxPoint( x1 + deltaX, y1 - deltaY ), 'D' ); + } break; - case TYPE_SCH_TEXT : - case TYPE_SCH_LABEL : - case TYPE_SCH_GLOBALLABEL : - case TYPE_SCH_HIERLABEL : - PlotTextStruct(DrawList); - break; - - case TYPE_SCH_COMPONENT : - DrawLibItem = (SCH_COMPONENT *) DrawList; - PlotLibPart( DrawLibItem ); - break; - - case DRAW_PICK_ITEM_STRUCT_TYPE : break; - case DRAW_POLYLINE_STRUCT_TYPE : break; - case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE : break; - case DRAW_MARKER_STRUCT_TYPE : break; - - case DRAW_SHEET_STRUCT_TYPE : - #undef STRUCT - #define STRUCT ((DrawSheetStruct*)DrawList) - PlotSheetStruct(STRUCT); - break; - - case DRAW_NOCONNECT_STRUCT_TYPE: - #undef STRUCT - #define STRUCT ((DrawNoConnectStruct*)DrawList) - PlotNoConnectStruct(STRUCT); - break; - - default : + default: + Move_Plume( wxPoint( x1, y1 ), 'U' ); + Move_Plume( wxPoint( x2, y2 ), 'D' ); break; } - Plume('U'); - DrawList = DrawList->Pnext; + break; + + case DRAW_JUNCTION_STRUCT_TYPE: + #undef STRUCT + #define STRUCT ( (DrawJunctionStruct*) DrawList ) + x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y; + PlotCercle( wxPoint( x1, y1 ), DRAWJUNCTION_SIZE * 2 ); + break; + + case TYPE_SCH_TEXT: + case TYPE_SCH_LABEL: + case TYPE_SCH_GLOBALLABEL: + case TYPE_SCH_HIERLABEL: + PlotTextStruct( DrawList ); + break; + + case TYPE_SCH_COMPONENT: + DrawLibItem = (SCH_COMPONENT*) DrawList; + PlotLibPart( DrawLibItem ); + break; + + case DRAW_PICK_ITEM_STRUCT_TYPE: + break; + + case DRAW_POLYLINE_STRUCT_TYPE: + break; + + case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: + break; + + case DRAW_MARKER_STRUCT_TYPE: + break; + + case DRAW_SHEET_STRUCT_TYPE: + #undef STRUCT + #define STRUCT ( (DrawSheetStruct*) DrawList ) + PlotSheetStruct( STRUCT ); + break; + + case DRAW_NOCONNECT_STRUCT_TYPE: + #undef STRUCT + #define STRUCT ( (DrawNoConnectStruct*) DrawList ) + PlotNoConnectStruct( STRUCT ); + break; + + default: + break; } + Plume( 'U' ); + DrawList = DrawList->Pnext; + } + /* fin */ - CloseFileHPGL(PlotOutput); + CloseFileHPGL( PlotOutput ); } + /*! * wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX */ @@ -685,32 +841,31 @@ void WinEDA_PlotHPGLFrame::OnRadioboxSelected( wxCommandEvent& event ) } - - /*! * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_PEN_WIDTH_UPDATED */ void WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated( wxSpinEvent& event ) { - SetPenWidth(event); + SetPenWidth( event ); } + /*! * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_PEN_SPEED_UPDATED */ void WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated( wxSpinEvent& event ) { - SetPenSpeed(event); + SetPenSpeed( event ); } + /*! * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_PEN_NUMBER_UPDATED */ void WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated( wxSpinEvent& event ) { - SetPenNum(event); + SetPenNum( event ); } - diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 8302c39a83..897737008a 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -23,9 +23,10 @@ *****************************************************************************/ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) { - int id = event.GetId(); - wxPoint pos; - wxClientDC dc( DrawPanel ); + int id = event.GetId(); + wxPoint pos; + wxClientDC dc( DrawPanel ); + SCH_SCREEN* screen = GetScreen(); DrawPanel->PrepareGraphicContext( &dc ); @@ -119,7 +120,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) break; 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-> m_PanelDefaultCursor ) ); @@ -129,11 +130,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); } /* 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; - GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK; - GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; + screen->BlockLocate.m_Command = BLOCK_IDLE; + screen->BlockLocate.m_State = STATE_NO_BLOCK; + screen->BlockLocate.m_BlockDrawStruct = NULL; } break; @@ -166,14 +167,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) break; case wxID_CUT: - if( GetScreen()->BlockLocate.m_Command != BLOCK_MOVE ) + if( screen->BlockLocate.m_Command != BLOCK_MOVE ) break; HandleBlockEndByPopUp( BLOCK_DELETE, &dc ); g_ItemToRepeat = NULL; break; case wxID_PASTE: - HandleBlockBegin( &dc, BLOCK_PASTE, GetScreen()->m_Curseur ); + HandleBlockBegin( &dc, BLOCK_PASTE, screen->m_Curseur ); break; 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: DrawPanel->MouseToCursorSchema(); SetBusEntryShape( &dc, - (DrawBusEntryStruct*) GetScreen()->GetCurItem(), '/' ); + (DrawBusEntryStruct*) screen->GetCurItem(), '/' ); break; case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH: DrawPanel->MouseToCursorSchema(); SetBusEntryShape( &dc, - (DrawBusEntryStruct*) GetScreen()->GetCurItem(), '\\' ); + (DrawBusEntryStruct*) screen->GetCurItem(), '\\' ); break; case ID_NO_SELECT_BUTT: @@ -271,35 +272,35 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_SCH_EDIT_TEXT: - EditSchematicText( (SCH_TEXT*) GetScreen()->GetCurItem(), &dc ); + EditSchematicText( (SCH_TEXT*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_ROTATE_TEXT: DrawPanel->MouseToCursorSchema(); - ChangeTextOrient( (SCH_TEXT*) GetScreen()->GetCurItem(), &dc ); + ChangeTextOrient( (SCH_TEXT*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL: DrawPanel->MouseToCursorSchema(); - ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(), + ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_LABEL ); break; case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL: DrawPanel->MouseToCursorSchema(); - ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(), + ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_GLOBALLABEL ); break; case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL: DrawPanel->MouseToCursorSchema(); - ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(), + ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_HIERLABEL ); break; case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT: DrawPanel->MouseToCursorSchema(); - ConvertTextType( (SCH_TEXT*) GetScreen()->GetCurItem(), + ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_TEXT ); break; @@ -310,11 +311,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_ROTATE_FIELD: DrawPanel->MouseToCursorSchema(); - RotateCmpField( (PartTextStruct*) GetScreen()->GetCurItem(), &dc ); + RotateCmpField( (PartTextStruct*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_EDIT_FIELD: - EditCmpFieldText( (PartTextStruct*) GetScreen()->GetCurItem(), &dc ); + EditCmpFieldText( (PartTextStruct*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_DELETE_NODE: @@ -322,41 +323,43 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->MouseToCursorSchema(); DeleteConnection( &dc, id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE ); - GetScreen()->SetCurItem( NULL ); + screen->SetCurItem( NULL ); g_ItemToRepeat = NULL; - TestDanglingEnds( GetScreen()->EEDrawList, &dc ); + TestDanglingEnds( screen->EEDrawList, &dc ); break; case ID_POPUP_SCH_BREAK_WIRE: { DrawPickedStruct* ListForUndo; DrawPanel->MouseToCursorSchema(); - ListForUndo = BreakSegment( (SCH_SCREEN*) GetScreen(), - GetScreen()->m_Curseur, TRUE ); + ListForUndo = BreakSegment( screen, screen->m_Curseur, TRUE ); if( ListForUndo ) SaveCopyInUndoList( ListForUndo, IS_NEW | IS_CHANGED ); - TestDanglingEnds( GetScreen()->EEDrawList, &dc ); + TestDanglingEnds( screen->EEDrawList, &dc ); } break; case ID_POPUP_SCH_DELETE_CMP: - if( GetScreen()->GetCurItem() == NULL ) + if( screen->GetCurItem() == NULL ) break; // Ensure the struct is a component (could be a struct of a // component, like Field, text..) - if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) - GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) - GetScreen() ) ); + if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) + screen->SetCurItem( LocateSmallestComponent( screen ) ); case ID_POPUP_SCH_DELETE: - if( GetScreen()->GetCurItem() == NULL ) - break; - DeleteStruct( DrawPanel, &dc, (SCH_ITEM*)GetScreen()->GetCurItem() ); - GetScreen()->SetCurItem( NULL ); - g_ItemToRepeat = NULL; - TestDanglingEnds( GetScreen()->EEDrawList, &dc ); - GetScreen()->SetModify(); + { + SCH_ITEM* item = screen->GetCurItem(); + if( item == NULL ) + break; + + DeleteStruct( DrawPanel, &dc, item ); + screen->SetCurItem( NULL ); + g_ItemToRepeat = NULL; + TestDanglingEnds( screen->EEDrawList, &dc ); + screen->SetModify(); + } break; case ID_SCHEMATIC_DELETE_ITEM_BUTT: @@ -365,33 +368,33 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_END_SHEET: DrawPanel->MouseToCursorSchema(); - ((SCH_ITEM*)GetScreen()->GetCurItem())->Place( this, &dc ); + screen->GetCurItem()->Place( this, &dc ); break; case ID_POPUP_SCH_RESIZE_SHEET: DrawPanel->MouseToCursorSchema(); - ReSizeSheet( (DrawSheetStruct*) GetScreen()->GetCurItem(), &dc ); - TestDanglingEnds( GetScreen()->EEDrawList, &dc ); + ReSizeSheet( (DrawSheetStruct*) screen->GetCurItem(), &dc ); + TestDanglingEnds( screen->EEDrawList, &dc ); break; case ID_POPUP_SCH_EDIT_SHEET: - EditSheet( (DrawSheetStruct*) GetScreen()->GetCurItem(), &dc ); + EditSheet( (DrawSheetStruct*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_CLEANUP_SHEET: ( (DrawSheetStruct*) - GetScreen()->GetCurItem() )->CleanupSheet( this, &dc ); + screen->GetCurItem() )->CleanupSheet( this, &dc ); break; case ID_POPUP_SCH_EDIT_PINSHEET: Edit_PinSheet( (Hierarchical_PIN_Sheet_Struct*) - GetScreen()->GetCurItem(), &dc ); + screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_MOVE_PINSHEET: DrawPanel->MouseToCursorSchema(); StartMove_PinSheet( (Hierarchical_PIN_Sheet_Struct*) - GetScreen()->GetCurItem(), &dc ); + screen->GetCurItem(), &dc ); break; 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 // component, like Field, text..) - if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) - GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) - GetScreen() ) ); - if( GetScreen()->GetCurItem() == NULL ) + if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) + screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; 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 // block drag command - if( GetScreen()->BlockLocate.m_State == STATE_NO_BLOCK ) + if( screen->BlockLocate.m_State == STATE_NO_BLOCK ) { if( !HandleBlockBegin( &dc, BLOCK_DRAG, - GetScreen()->m_Curseur ) ) + screen->m_Curseur ) ) break; HandleBlockEnd( &dc ); } } else - Process_Move_Item( (SCH_ITEM*) GetScreen()->GetCurItem(), &dc ); + Process_Move_Item( (SCH_ITEM*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_EDIT_CMP: // Ensure the struct is a component (could be a struct of a // component, like Field, text..) - if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) - GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) - GetScreen() ) ); - if( GetScreen()->GetCurItem() == NULL ) + if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) + screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; InstallCmpeditFrame( this, pos, - (SCH_COMPONENT*) GetScreen()->GetCurItem() ); + (SCH_COMPONENT*) screen->GetCurItem() ); break; 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 // component, like Field, text..) - if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) - GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) - GetScreen() ) ); - if( GetScreen()->GetCurItem() == NULL ) + if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) + screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; { int option; @@ -472,11 +472,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) } DrawPanel->MouseToCursorSchema(); - if( GetScreen()->GetCurItem()->m_Flags == 0 ) - SaveCopyInUndoList( (SCH_ITEM*) GetScreen()->GetCurItem(), IS_CHANGED ); + if( screen->GetCurItem()->m_Flags == 0 ) + SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(), IS_CHANGED ); CmpRotationMiroir( - (SCH_COMPONENT*) GetScreen()->GetCurItem(), + (SCH_COMPONENT*) screen->GetCurItem(), &dc, option ); 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 // component, like Field, text..) - if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) - GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) - GetScreen() ) ); - if( GetScreen()->GetCurItem() == NULL ) + if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) + screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; EditComponentValue( - (SCH_COMPONENT*) GetScreen()->GetCurItem(), &dc ); + (SCH_COMPONENT*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_EDIT_REF_CMP: // Ensure the struct is a component (could be a struct of a // component, like Field, text..) - if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) - GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) - GetScreen() ) ); - if( GetScreen()->GetCurItem() == NULL ) + if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) + screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; EditComponentReference( - (SCH_COMPONENT*) GetScreen()->GetCurItem(), &dc ); + (SCH_COMPONENT*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP: // Ensure the struct is a component (could be a struct of a // component, like Field, text..) - if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) - GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) - GetScreen() ) ); - if( GetScreen()->GetCurItem() == NULL ) + if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) + screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; EditComponentFootprint( - (SCH_COMPONENT*) GetScreen()->GetCurItem(), &dc ); + (SCH_COMPONENT*) screen->GetCurItem(), &dc ); 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 // component, like Field, text..) - if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) - GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) - GetScreen() ) ); - if( GetScreen()->GetCurItem() == NULL ) + if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) + screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; DrawPanel->MouseToCursorSchema(); ConvertPart( - (SCH_COMPONENT*) GetScreen()->GetCurItem(), + (SCH_COMPONENT*) screen->GetCurItem(), &dc ); break; @@ -546,10 +542,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->MouseToCursorSchema(); { SCH_COMPONENT* olditem, * newitem; - if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) - GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) - GetScreen() ) ); - olditem = (SCH_COMPONENT*) GetScreen()->GetCurItem(); + if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) + screen->SetCurItem( LocateSmallestComponent( screen ) ); + olditem = (SCH_COMPONENT*) screen->GetCurItem(); if( olditem == NULL ) break; 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 // component, like Field, text..) - if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) - GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) - GetScreen() ) ); - if( GetScreen()->GetCurItem() == NULL ) + if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) + screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; DrawPanel->MouseToCursorSchema(); SelPartUnit( - (SCH_COMPONENT*) GetScreen()->GetCurItem(), + (SCH_COMPONENT*) screen->GetCurItem(), id + 1 - ID_POPUP_SCH_SELECT_UNIT1, &dc ); 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 // component, like Field, text..) - if( GetScreen()->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) - GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*) - GetScreen() ) ); - if( GetScreen()->GetCurItem() == NULL ) + if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) + screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; { EDA_LibComponentStruct* LibEntry; LibEntry = FindLibPart( - ( (SCH_COMPONENT*) GetScreen()->GetCurItem() )->m_ChipName, + ( (SCH_COMPONENT*) screen->GetCurItem() )->m_ChipName, wxEmptyString, FIND_ALIAS ); if( LibEntry && LibEntry->m_DocFile != wxEmptyString ) @@ -629,7 +622,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_ENTER_SHEET: { - EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); + EDA_BaseStruct* DrawStruct = screen->GetCurItem(); if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) ) { InstallNextScreen( (DrawSheetStruct*) DrawStruct ); @@ -687,30 +680,30 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_ADD_JUNCTION: DrawPanel->MouseToCursorSchema(); - GetScreen()->SetCurItem( - CreateNewJunctionStruct( &dc, GetScreen()->m_Curseur, TRUE ) ); - TestDanglingEnds( GetScreen()->EEDrawList, &dc ); - GetScreen()->SetCurItem( NULL ); + screen->SetCurItem( + CreateNewJunctionStruct( &dc, screen->m_Curseur, TRUE ) ); + TestDanglingEnds( screen->EEDrawList, &dc ); + screen->SetCurItem( NULL ); break; case ID_POPUP_SCH_ADD_LABEL: case ID_POPUP_SCH_ADD_GLABEL: - GetScreen()->SetCurItem( + screen->SetCurItem( CreateNewText( &dc, id == ID_POPUP_SCH_ADD_LABEL ? LAYER_LOCLABEL : LAYER_GLOBLABEL ) ); - if( GetScreen()->GetCurItem() ) + if( screen->GetCurItem() ) { - ((SCH_ITEM*)GetScreen()->GetCurItem())->Place( this, &dc ); - TestDanglingEnds( GetScreen()->EEDrawList, &dc ); - GetScreen()->SetCurItem( NULL ); + ((SCH_ITEM*)screen->GetCurItem())->Place( this, &dc ); + TestDanglingEnds( screen->EEDrawList, &dc ); + screen->SetCurItem( NULL ); } break; case ID_SCHEMATIC_UNDO: if( GetSchematicFromUndoList() ) { - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( screen->EEDrawList, NULL ); DrawPanel->Refresh( TRUE ); } break; @@ -718,7 +711,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_SCHEMATIC_REDO: if( GetSchematicFromRedoList() ) { - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( screen->EEDrawList, NULL ); DrawPanel->Refresh( TRUE ); } break; diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index f5cc9224b0..148b379417 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -151,10 +151,13 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, #endif g_ItemToRepeat = NULL; + /* Get config */ GetSettings(); + g_DrawMinimunLineWidth = m_Parent->m_EDA_Config->Read( MINI_DRAW_LINE_WIDTH_KEY, (long) 0 ); + g_PlotPSMinimunLineWidth = 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 */ /***************/ @@ -192,7 +201,7 @@ DrawSheetPath* WinEDA_SchematicFrame::GetSheet() } -BASE_SCREEN* WinEDA_SchematicFrame::GetScreen() +SCH_SCREEN* WinEDA_SchematicFrame::GetScreen() const { return m_CurrentSheet->LastScreen(); } @@ -399,17 +408,17 @@ int WinEDA_SchematicFrame::BestZoom() int bestzoom; wxSize size; - dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; - dy = GetScreen()->m_CurrentSheetDesc->m_Size.y; + dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; + dy = GetScreen()->m_CurrentSheetDesc->m_Size.y; - size = DrawPanel->GetClientSize(); - ii = dx / size.x; - jj = dy / size.y; - bestzoom = MAX( ii, jj ) + 1; + size = DrawPanel->GetClientSize(); + ii = dx / size.x; + jj = dy / size.y; + bestzoom = MAX( ii, jj ) + 1; - GetScreen()->SetZoom( ii ); - GetScreen()->m_Curseur.x = dx / 2; - GetScreen()->m_Curseur.y = dy / 2; + GetScreen()->SetZoom( ii ); + GetScreen()->m_Curseur.x = dx / 2; + GetScreen()->m_Curseur.y = dy / 2; return bestzoom; } diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 44a5017802..9209d93de0 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -468,7 +468,7 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) { wxPoint move_vector; Hierarchical_PIN_Sheet_Struct* SheetLabel; - BASE_SCREEN* screen = panel->m_Parent->GetScreen(); + BASE_SCREEN* screen = panel->GetScreen(); DrawSheetStruct* Sheet = (DrawSheetStruct*) screen->GetCurItem(); @@ -479,10 +479,8 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) if( Sheet->m_Flags & IS_RESIZED ) { - Sheet->m_Size.x = MAX( s_SheetMindx, - 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.x = MAX( s_SheetMindx, screen->m_Curseur.x - Sheet->m_Pos.x ); + Sheet->m_Size.y = MAX( s_SheetMindy, screen->m_Curseur.y - Sheet->m_Pos.y ); SheetLabel = Sheet->m_Label; while( SheetLabel ) { @@ -507,7 +505,7 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) /****************************************/ 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(); 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 */ { wxPoint curspos = Screen->m_Curseur; - Panel->m_Parent->GetScreen()->m_Curseur = s_OldPos; + Panel->GetScreen()->m_Curseur = s_OldPos; DeplaceSheet( Panel, DC, TRUE ); RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE ); Sheet->m_Flags = 0; diff --git a/eeschema/sheetlab.cpp b/eeschema/sheetlab.cpp index 4bc795071c..e83d97d08a 100644 --- a/eeschema/sheetlab.cpp +++ b/eeschema/sheetlab.cpp @@ -169,7 +169,7 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC ) * de deplacement * 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; @@ -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 ) { Hierarchical_PIN_Sheet_Struct* SheetLabel = (Hierarchical_PIN_Sheet_Struct*) - panel->m_Parent->GetScreen()->GetCurItem(); + panel->GetScreen()->GetCurItem(); if( SheetLabel == NULL ) return; @@ -251,13 +251,13 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) SheetLabel->m_Edge = 0; 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_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 ) SheetLabel->m_Pos.y = Sheet->m_Pos.y; if( SheetLabel->m_Pos.y > (Sheet->m_Pos.y + Sheet->m_Size.y) ) diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index 2bf49e67e5..de81ccb964 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -100,7 +100,7 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event ) } CurrentLibEntry->SortDrawItems(); - m_Parent->GetScreen()->SetModify(); + m_Parent->GetScreen()->SetModify(); DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, 0, 0, CurrentDrawItem, CurrentUnit, g_XorMode ); @@ -150,7 +150,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC ) else DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, 0, 0, CurrentDrawItem, CurrentUnit, g_XorMode ); - SAFE_DELETE( CurrentDrawItem ); + SAFE_DELETE( CurrentDrawItem ); } else { @@ -224,8 +224,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) LibDrawArc* Arc = new LibDrawArc(); CurrentDrawItem = Arc; - ArcStartX = ArcEndX = GetScreen()->m_Curseur.x; - ArcStartY = ArcEndY = -( GetScreen()->m_Curseur.y ); + ArcStartX = ArcEndX = GetScreen()->m_Curseur.x; + ArcStartY = ArcEndY = -( GetScreen()->m_Curseur.y ); StateDrawArc = 1; Arc->m_Fill = FlSymbol_Fill; Arc->m_Width = g_LibSymbolDefaultLineWidth; @@ -237,8 +237,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) LibDrawCircle* Circle = new LibDrawCircle(); CurrentDrawItem = Circle; - Circle->m_Pos.x = GetScreen()->m_Curseur.x; - Circle->m_Pos.y = -( GetScreen()->m_Curseur.y ); + Circle->m_Pos.x = GetScreen()->m_Curseur.x; + Circle->m_Pos.y = -( GetScreen()->m_Curseur.y ); Circle->m_Fill = FlSymbol_Fill; Circle->m_Width = g_LibSymbolDefaultLineWidth; } @@ -249,8 +249,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) LibDrawSquare* Square = new LibDrawSquare(); CurrentDrawItem = Square; - Square->m_Pos.x = GetScreen()->m_Curseur.x; - Square->m_Pos.y = -( GetScreen()->m_Curseur.y ); + Square->m_Pos.x = GetScreen()->m_Curseur.x; + Square->m_Pos.y = -( GetScreen()->m_Curseur.y ); Square->m_End = Square->m_Pos; Square->m_Fill = FlSymbol_Fill; Square->m_Width = g_LibSymbolDefaultLineWidth; @@ -265,8 +265,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) polyline->n = 2; ptpoly = (int*) MyZMalloc( 4 * sizeof(int) ); polyline->PolyList = ptpoly; - ptpoly[0] = ptpoly[2] = GetScreen()->m_Curseur.x; - ptpoly[1] = ptpoly[3] = -( GetScreen()->m_Curseur.y ); + ptpoly[0] = ptpoly[2] = GetScreen()->m_Curseur.x; + ptpoly[1] = ptpoly[3] = -( GetScreen()->m_Curseur.y ); polyline->m_Fill = FlSymbol_Fill; polyline->m_Width = g_LibSymbolDefaultLineWidth; } @@ -277,8 +277,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) LibDrawSegment* Segment = new LibDrawSegment(); CurrentDrawItem = Segment; - Segment->m_Pos.x = GetScreen()->m_Curseur.x; - Segment->m_Pos.y = -( GetScreen()->m_Curseur.y ); + Segment->m_Pos.x = GetScreen()->m_Curseur.x; + Segment->m_Pos.y = -( GetScreen()->m_Curseur.y ); Segment->m_End = Segment->m_Pos; Segment->m_Width = g_LibSymbolDefaultLineWidth; } @@ -291,12 +291,12 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) CurrentDrawItem = Text; Text->m_Size.x = Text->m_Size.y = g_LastTextSize; Text->m_Horiz = g_LastTextOrient; - Text->m_Pos.x = GetScreen()->m_Curseur.x; - Text->m_Pos.y = -( GetScreen()->m_Curseur.y ); + Text->m_Pos.x = GetScreen()->m_Curseur.x; + Text->m_Pos.y = -( GetScreen()->m_Curseur.y ); EditSymbolText( NULL, Text ); if( Text->m_Text.IsEmpty() ) { - SAFE_DELETE( Text ); + SAFE_DELETE( Text ); CurrentDrawItem = NULL; DrawPanel->ManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL; @@ -362,7 +362,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC ) case COMPONENT_POLYLINE_DRAW_TYPE: { - wxPoint pos = GetScreen()->m_Curseur; + wxPoint pos = GetScreen()->m_Curseur; ( (LibDrawPolyline*) CurrentDrawItem )->AddPoint( pos ); } break; @@ -383,7 +383,7 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool era /* Redraw the graphoc shape while moving */ { - BASE_SCREEN* Screen = panel->m_Parent->GetScreen(); + BASE_SCREEN* Screen = panel->GetScreen(); int mx, my; /* Erase shape in the old positon*/ @@ -481,7 +481,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC ) SetCursor( wxCURSOR_HAND ); CurrentDrawItem->m_Flags |= IS_MOVED; - StartCursor = GetScreen()->m_Curseur; + StartCursor = GetScreen()->m_Curseur; 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->ForceCloseManageCurseur = AbortSymbolTraceOn; DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); @@ -529,7 +529,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) int DrawMode = g_XorMode; int* ptpoly; int dx, dy; - BASE_SCREEN* Screen = panel->m_Parent->GetScreen(); + BASE_SCREEN* Screen = panel->GetScreen(); int mx = Screen->m_Curseur.x, my = Screen->m_Curseur.y; @@ -720,7 +720,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC ) CurrentDrawItem->m_Flags = 0; CurrentDrawItem = NULL; - GetScreen()->SetModify(); + GetScreen()->SetModify(); DrawPanel->ManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL; @@ -832,11 +832,11 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC ) { Poly->n--; ptpoly = Poly->PolyList + ( 2 * (Poly->n - 1) ); - if( (ptpoly[0] != GetScreen()->m_Curseur.x) - || (ptpoly[1] != -GetScreen()->m_Curseur.y) ) + if( (ptpoly[0] != GetScreen()->m_Curseur.x) + || (ptpoly[1] != -GetScreen()->m_Curseur.y) ) { - ptpoly[0] = GetScreen()->m_Curseur.x; - ptpoly[1] = -( GetScreen()->m_Curseur.y); + ptpoly[0] = GetScreen()->m_Curseur.x; + ptpoly[1] = -( GetScreen()->m_Curseur.y); break; } } diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index ba0cbc72c2..06ae1bc3fb 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -69,7 +69,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent, if( m_Semaphore ) SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP ); - m_CurrentScreen = new SCH_SCREEN( VIEWER_FRAME ); + SetBaseScreen( new SCH_SCREEN( VIEWER_FRAME ) ); GetScreen()->SetZoom( 16 ); if( Library == NULL ) @@ -110,7 +110,9 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent, WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame() { - SAFE_DELETE( m_CurrentScreen ); + delete GetScreen(); + SetBaseScreen( 0 ); + m_Parent->m_ViewlibFrame = NULL; } diff --git a/gerbview/block.cpp b/gerbview/block.cpp index 0cd83495d6..6bca20cbd7 100644 --- a/gerbview/block.cpp +++ b/gerbview/block.cpp @@ -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.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom(); @@ -277,7 +277,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC ) { NextS = pt_segm->Next(); if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) ) - { + { /* la piste est ici bonne a etre efface */ pt_segm->Draw( DrawPanel, DC, GR_XOR ); pt_segm->DeleteStructure(); @@ -289,7 +289,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC ) { NextS = pt_segm->Next(); if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) ) - { + { /* la piste est ici bonne a etre efface */ pt_segm->Draw( DrawPanel, DC, GR_XOR ); pt_segm->DeleteStructure(); @@ -324,7 +324,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC ) deltaX = GetScreen()->BlockLocate.m_MoveVector.x; deltaY = GetScreen()->BlockLocate.m_MoveVector.y; - /* Move the Track segments in block */ + /* Move the Track segments in block */ TRACK* track = m_Pcb->m_Track; while( track ) { @@ -388,15 +388,15 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC ) { TRACK* next_track = track->Next(); if( IsSegmentInBox( GetScreen()->BlockLocate, track ) ) - { + { /* this track segment must be duplicated */ m_Pcb->m_Status_Pcb = 0; TRACK* new_track = track->Copy(); new_track->Insert( m_Pcb, NULL ); - - new_track->m_Start += delta; - new_track->m_End += delta; - + + new_track->m_Start += delta; + new_track->m_End += delta; + new_track->Draw( DrawPanel, DC, GR_OR ); // draw the new created segment } track = next_track; @@ -408,14 +408,14 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC ) { SEGZONE * next_zsegment = zsegment->Next(); if( IsSegmentInBox( GetScreen()->BlockLocate, track ) ) - { + { /* this zone segment must be duplicated */ SEGZONE * new_zsegment = (SEGZONE*) zsegment->Copy(); new_zsegment->Insert( m_Pcb, NULL ); - - new_zsegment->m_Start += delta; - new_zsegment->m_End += delta; - + + new_zsegment->m_Start += delta; + new_zsegment->m_End += delta; + new_zsegment->Draw( DrawPanel, DC, GR_OR ); // draw the new created segment } zsegment = next_zsegment; diff --git a/gerbview/controle.cpp b/gerbview/controle.cpp index 0783998f84..340886ff0c 100644 --- a/gerbview/controle.cpp +++ b/gerbview/controle.cpp @@ -22,8 +22,9 @@ /**********************************************************************/ -EDA_BaseStruct* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay() { +BOARD_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay() /**********************************************************************/ +{ return Locate( CURSEUR_OFF_GRILLE ); } @@ -72,22 +73,22 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) { case EDA_PANNING_UP_KEY: OnZoom( ID_ZOOM_PANNING_UP ); - curpos = m_CurrentScreen->m_Curseur; + curpos = GetScreen()->m_Curseur; break; case EDA_PANNING_DOWN_KEY: OnZoom( ID_ZOOM_PANNING_DOWN ); - curpos = m_CurrentScreen->m_Curseur; + curpos = GetScreen()->m_Curseur; break; case EDA_PANNING_LEFT_KEY: OnZoom( ID_ZOOM_PANNING_LEFT ); - curpos = m_CurrentScreen->m_Curseur; + curpos = GetScreen()->m_Curseur; break; case EDA_PANNING_RIGHT_KEY: OnZoom( ID_ZOOM_PANNING_RIGHT ); - curpos = m_CurrentScreen->m_Curseur; + curpos = GetScreen()->m_Curseur; break; case EDA_ZOOM_IN_FROM_MOUSE: @@ -136,7 +137,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) /* Recalcul de la position du curseur schema */ GetScreen()->m_Curseur = curpos; - + /* Placement sur la grille generale */ PutOnGrid( &GetScreen()->m_Curseur ); diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index df21b3bca4..0a3660bbca 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -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" @@ -12,470 +12,504 @@ #define DEFAULT_SIZE 100 -/* Format Gerber : NOTES : -Fonctions preparatoires: - Gn = - G01 interpolation lineaire ( trace de droites ) - G02,G20,G21 Interpolation circulaire , sens trigo < 0 - G03,G30,G31 Interpolation circulaire , sens trigo > 0 - G04 commentaire - G06 Interpolation parabolique - G07 Interpolation cubique - G10 interpolation lineaire ( echelle 10x ) - G11 interpolation lineaire ( echelle 0.1x ) - G12 interpolation lineaire ( echelle 0.01x ) - G52 plot symbole reference par Dnn code - G53 plot symbole reference par Dnn ; symbole tourne de -90 degres - G54 Selection d'outil - G55 Mode exposition photo - G56 plot symbole reference par Dnn A code - G57 affiche le symbole reference sur la console - G58 plot et affiche le symbole reference sur la console - G60 interpolation lineaire ( echelle 100x ) - G70 Unites = Inches - G71 Unites = Millimetres - G74 supprime interpolation circulaire sur 360 degre, revient a G01 - G75 Active interpolation circulaire sur 360 degre - G90 Mode Coordonnees absolues - G91 Mode Coordonnees Relatives +/* Format Gerber : NOTES : + Fonctions preparatoires: + Gn = + G01 interpolation lineaire ( trace de droites ) + G02,G20,G21 Interpolation circulaire , sens trigo < 0 + G03,G30,G31 Interpolation circulaire , sens trigo > 0 + G04 commentaire + G06 Interpolation parabolique + G07 Interpolation cubique + G10 interpolation lineaire ( echelle 10x ) + G11 interpolation lineaire ( echelle 0.1x ) + G12 interpolation lineaire ( echelle 0.01x ) + G52 plot symbole reference par Dnn code + G53 plot symbole reference par Dnn ; symbole tourne de -90 degres + G54 Selection d'outil + G55 Mode exposition photo + G56 plot symbole reference par Dnn A code + G57 affiche le symbole reference sur la console + G58 plot et affiche le symbole reference sur la console + G60 interpolation lineaire ( echelle 100x ) + G70 Unites = Inches + G71 Unites = Millimetres + G74 supprime interpolation circulaire sur 360 degre, revient a G01 + G75 Active interpolation circulaire sur 360 degre + G90 Mode Coordonnees absolues + G91 Mode Coordonnees Relatives -Coordonnees X,Y - X,Y sont suivies de + ou - et de m+n chiffres (non separes) - m = partie entiere - n = partie apres la virgule - formats classiques : m = 2, n = 3 (format 2.3) - m = 3, n = 4 (format 3.4) - ex: - G__ X00345Y-06123 D__* + Coordonnees X,Y + X,Y sont suivies de + ou - et de m+n chiffres (non separes) + m = partie entiere + n = partie apres la virgule + formats classiques : m = 2, n = 3 (format 2.3) + m = 3, n = 4 (format 3.4) + ex: + G__ X00345Y-06123 D__* -Outils et D_CODES - numero d'outil ( identification des formes ) - 1 a 99 (classique) - 1 a 999 - D_CODES: + Outils et D_CODES + numero d'outil ( identification des formes ) + 1 a 99 (classique) + 1 a 999 + D_CODES: - D01 ... D9 = codes d'action: - D01 = activation de lumiere (baisser de plume) lors du d�placement - D02 = extinction de lumiere (lever de plume) lors du d�placement - D03 = Flash - D09 = VAPE Flash + D01 ... D9 = codes d'action: + D01 = activation de lumiere (baisser de plume) lors du d�placement + D02 = extinction de lumiere (lever de plume) lors du d�placement + D03 = 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; - m_Layer = layer; // Layer Number - m_Selected_Tool = FIRST_DCODE; - ResetDefaultValues(); - for ( ii = 0; ii <= MAX_TOOLS; ii++ ) - m_Aperture_List[ii] = new D_CODE(ii + FIRST_DCODE); + int ii; + + m_Layer = layer; // Layer Number + m_Selected_Tool = FIRST_DCODE; + ResetDefaultValues(); + for( ii = 0; ii <= MAX_TOOLS; ii++ ) + m_Aperture_List[ii] = new D_CODE( ii + FIRST_DCODE ); } - - GERBER_Descr::~GERBER_Descr() { -int ii; + int ii; - if (m_Aperture_List ) - { - for ( ii = 0; ii < MAX_TOOLS; ii++) - { - delete m_Aperture_List[ii]; - m_Aperture_List[ii] = NULL; - } - } + if( m_Aperture_List ) + { + for( ii = 0; ii < MAX_TOOLS; ii++ ) + { + delete m_Aperture_List[ii]; + m_Aperture_List[ii] = NULL; + } + } } + /******************************************/ void GERBER_Descr::ResetDefaultValues() /******************************************/ { - m_Parent = NULL; - m_Pback = NULL; - m_Pnext = NULL; - m_FileName.Empty(); - m_Name = wxT("no name"); // Layer name - m_LayerNegative = FALSE; // TRUE = Negative Layer - m_ImageNegative = FALSE; // TRUE = Negative image - m_GerbMetric = FALSE; // FALSE = Inches, TRUE = metric - m_Relative = FALSE; // FALSE = absolute Coord, RUE = relative Coord - m_NoTrailingZeros = FALSE; // True: zeros a droite supprim�s - m_MirorA = FALSE; // True: miror / axe A (X) - m_MirorB = FALSE; // True: miror / axe B (Y) - m_As_DCode = FALSE; // TRUE = DCodes in file (FALSE = no DCode-> - // separate DCode file - m_Offset.x = m_Offset.y = 0; // Coord Offset + m_Parent = NULL; + m_Pback = NULL; + m_Pnext = NULL; + m_FileName.Empty(); + m_Name = wxT( "no name" ); // Layer name + m_LayerNegative = FALSE; // TRUE = Negative Layer + m_ImageNegative = FALSE; // TRUE = Negative image + m_GerbMetric = FALSE; // FALSE = Inches, TRUE = metric + m_Relative = FALSE; // FALSE = absolute Coord, RUE = relative Coord + m_NoTrailingZeros = FALSE; // True: zeros a droite supprim�s + m_MirorA = FALSE; // True: miror / axe A (X) + m_MirorB = FALSE; // True: miror / axe B (Y) + m_As_DCode = FALSE; // TRUE = DCodes in file (FALSE = no DCode-> + // separate DCode file + m_Offset.x = m_Offset.y = 0; // Coord Offset - 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_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_LayerScale.x = m_LayerScale.y = 1.0; // scale (X et Y) pour cette layer - m_Rotation = 0; - m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Linear, 90 arc, Circ. - m_360Arc_enbl = FALSE; // 360 deg circular interpolation disable - m_Current_Tool = 0; // Current Tool (Dcode) number selected - 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_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_Current_File = NULL; // File to read - m_FilesPtr = 0; - m_Transform[0][0] = m_Transform[1][1] = 1; - m_Transform[0][1] = m_Transform[1][0] = 0; // Rotation/mirror = Normal - m_PolygonFillMode = FALSE; - m_PolygonFillModeState = 0; + m_LayerScale.x = m_LayerScale.y = 1.0; // scale (X et Y) pour cette layer + m_Rotation = 0; + m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Linear, 90 arc, Circ. + m_360Arc_enbl = FALSE; // 360 deg circular interpolation disable + m_Current_Tool = 0; // Current Tool (Dcode) number selected + 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_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_Current_File = NULL; // File to read + m_FilesPtr = 0; + m_Transform[0][0] = m_Transform[1][1] = 1; + m_Transform[0][1] = m_Transform[1][0] = 0; // Rotation/mirror = Normal + m_PolygonFillMode = FALSE; + m_PolygonFillModeState = 0; } + /********************************************/ int GERBER_Descr::ReturnUsedDcodeNumber() /********************************************/ { -int ii, jj; + int ii, jj; - jj = 0; - if (m_Aperture_List ) - { - for ( ii = 0; ii < MAX_TOOLS; ii++) - { - if( m_Aperture_List[ii]->m_InUse || m_Aperture_List[ii]->m_Defined ) - jj++; - } - } - return jj; + jj = 0; + if( m_Aperture_List ) + { + for( ii = 0; ii < MAX_TOOLS; ii++ ) + { + if( m_Aperture_List[ii]->m_InUse || m_Aperture_List[ii]->m_Defined ) + jj++; + } + } + return jj; } - /******************************/ void GERBER_Descr::InitToolTable() /******************************/ -/* Creation du tableau des MAX_TOOLS DCodes utilisables, si il n'existe pas, -et Init des DCodes � une valeur raisonnable -*/ -{ -int count; - /* 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(); - } +/* Creation du tableau des MAX_TOOLS DCodes utilisables, si il n'existe pas, + * et Init des DCodes � une valeur raisonnable + */ +{ + int count; + + /* 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 : */ /* Routines Locales */ -D_CODE::D_CODE(int num_dcode) +D_CODE::D_CODE( int num_dcode ) { - m_Num_Dcode = num_dcode; - Clear_D_CODE_Data(); + m_Num_Dcode = num_dcode; + Clear_D_CODE_Data(); } + D_CODE::~D_CODE() { } + void D_CODE::Clear_D_CODE_Data() { - m_Size.x = DEFAULT_SIZE; - m_Size.y = DEFAULT_SIZE; - m_Shape= GERB_CIRCLE; - m_Drill.x = m_Drill.y = 0; - m_DrillShape = 0; - m_InUse = FALSE; - m_Defined = FALSE; + m_Size.x = DEFAULT_SIZE; + m_Size.y = DEFAULT_SIZE; + m_Shape = GERB_CIRCLE; + m_Drill.x = m_Drill.y = 0; + m_DrillShape = 0; + m_InUse = 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. - Accepte format standard ou ALSPCB - un ';' demarre un commentaire. - - Format Standard: - tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)] -ex: 1, 12, 12, 0, 0, 0, 3 ; D10 - - Format: - Ver , Hor , Type , Tool [,Drill] -ex: 0.012, 0.012, L , D10 - - Classe les caract en buf_tmp sous forme de tableau de structures D_CODE. - Retourne: - < 0 si erreur: - -1 = Fichier non trouve - -2 = Erreur lecture fichier - 0 si pas de nom de fichier (inits seules) - 1 si OK -*/ + * Accepte format standard ou ALSPCB + * un ';' demarre un commentaire. + * + * Format Standard: + * tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)] + * ex: 1, 12, 12, 0, 0, 0, 3 ; D10 + * + * Format: + * Ver , Hor , Type , Tool [,Drill] + * ex: 0.012, 0.012, L , D10 + * + * Classe les caract en buf_tmp sous forme de tableau de structures D_CODE. + * Retourne: + * < 0 si erreur: + * -1 = Fichier non trouve + * -2 = Erreur lecture fichier + * 0 si pas de nom de fichier (inits seules) + * 1 si OK + */ { -int current_Dcode, ii, dcode_scale; -char* ptcar; -int dimH, dimV, drill, type_outil, dummy; -float fdimH, fdimV, fdrill; -char c_type_outil[256]; -char Line[2000]; -wxString msg; -D_CODE * pt_Dcode; -FILE * dest; -int layer = GetPCBScreen()->m_Active_Layer; -D_CODE ** ListeDCode; + int current_Dcode, ii, dcode_scale; + char* ptcar; + int dimH, dimV, drill, type_outil, dummy; + float fdimH, fdimV, fdrill; + char c_type_outil[256]; + char Line[2000]; + wxString msg; + D_CODE* pt_Dcode; + FILE* dest; + int layer = GetScreen()->m_Active_Layer; + D_CODE** ListeDCode; - if ( g_GERBER_Descr_List[layer] == NULL ) - { - g_GERBER_Descr_List[layer] = new GERBER_Descr(layer); - } + if( g_GERBER_Descr_List[layer] == NULL ) + { + g_GERBER_Descr_List[layer] = new GERBER_Descr( layer ); + } - /* Mise a jour de l'echelle gerber : */ - dcode_scale = 10; /* ici unit dcode = mil, unit interne = 0.1 mil - -> 1 unite dcode = 10 unit PCB */ - current_Dcode = 0; + /* Mise a jour de l'echelle gerber : */ + dcode_scale = 10; /* ici unit dcode = mil, unit interne = 0.1 mil + * -> 1 unite dcode = 10 unit PCB */ + 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) - { - msg = _("File ") + D_Code_FullFileName + _(" not found"); - DisplayError(this, msg, 10); - return -1; - } + if( dest == 0 ) + { + msg = _( "File " ) + D_Code_FullFileName + _( " not found" ); + DisplayError( this, msg, 10 ); + 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) - { - if (*Line == ';') continue; /* Commentaire */ - if (strlen(Line) < 10 ) continue ; /* Probablemant ligne vide */ + while( fgets( Line, sizeof(Line) - 1, dest ) != NULL ) + { + if( *Line == ';' ) + continue; /* Commentaire */ + if( strlen( Line ) < 10 ) + continue; /* Probablemant ligne vide */ - pt_Dcode = NULL; current_Dcode = 0; - /* Determination du type de fichier D_Code */ - ptcar = Line ; ii = 0 ; - while( *ptcar ) if (*(ptcar++) == ',') ii++ ; + pt_Dcode = NULL; current_Dcode = 0; + /* Determination du type de fichier D_Code */ + ptcar = Line; ii = 0; + while( *ptcar ) + if( *(ptcar++) == ',' ) + ii++; - if (ii >= 6 ) /* valeurs en mils */ - { - sscanf(Line,"%d,%d,%d,%d,%d,%d,%d",&ii, - &dimH, &dimV, &drill, - &dummy,&dummy, - &type_outil); - dimH = (int)( (dimH * dcode_scale) + 0.5) ; - dimV = (int)( (dimV * dcode_scale) + 0.5) ; - drill = (int)( (drill * dcode_scale) + 0.5); - if ( ii < 1 ) ii = 1; - current_Dcode = ii-1 + FIRST_DCODE; - } - 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); - ptcar = Line ; - while( *ptcar ) - { - if (*ptcar == 'D') - { - sscanf(ptcar+1,"%d,%f", ¤t_Dcode,&fdrill); break ; - } - else ptcar++ ; - } - dimH = (int)( (fdimH * dcode_scale * 1000) + 0.5); - 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);} + if( ii >= 6 ) /* valeurs en mils */ + { + sscanf( Line, "%d,%d,%d,%d,%d,%d,%d", &ii, + &dimH, &dimV, &drill, + &dummy, &dummy, + &type_outil ); + dimH = (int) ( (dimH * dcode_scale) + 0.5 ); + dimV = (int) ( (dimV * dcode_scale) + 0.5 ); + drill = (int) ( (drill * dcode_scale) + 0.5 ); + if( ii < 1 ) + ii = 1; + current_Dcode = ii - 1 + FIRST_DCODE; + } + 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 ); + ptcar = Line; + while( *ptcar ) + { + if( *ptcar == 'D' ) + { + sscanf( ptcar + 1, "%d,%f", ¤t_Dcode, &fdrill ); break; + } + else + ptcar++; + } - } - /* 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; - } - fclose(dest) ; + dimH = (int) ( (fdimH * dcode_scale * 1000) + 0.5 ); + 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; + } + } + /* 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() /***************************************************/ + /* Set Size Items (Lines, Flashes) from DCodes List -*/ + */ { -TRACK * track; -D_CODE * pt_Dcode; /* Pointeur sur le D code*/ + TRACK* track; + D_CODE* pt_Dcode; /* Pointeur sur le D code*/ - track = m_Pcb->m_Track; - for ( ; track != NULL ; track = (TRACK*) track->Pnext ) - { - pt_Dcode = ReturnToolDescr(track->GetLayer(), track->GetNet()); - pt_Dcode->m_InUse = TRUE; + track = m_Pcb->m_Track; + for( ; track != NULL; track = (TRACK*) track->Pnext ) + { + pt_Dcode = ReturnToolDescr( track->GetLayer(), track->GetNet() ); + pt_Dcode->m_InUse = TRUE; - if ( // Line Item - (track->m_Shape == S_SEGMENT ) || /* segment rectiligne */ - (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_CIRCLE ) || /* segment en cercle (anneau)*/ - (track->m_Shape == S_ARC_RECT ) /* segment en arc de cercle (bouts droits) (GERBER)*/ - ) - { - track->m_Width = pt_Dcode->m_Size.x; - } + if( // Line Item + (track->m_Shape == S_SEGMENT ) /* segment rectiligne */ + || (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_CIRCLE ) /* segment en cercle (anneau)*/ + || (track->m_Shape == S_ARC_RECT ) /* segment en arc de cercle (bouts droits) (GERBER)*/ + ) + { + 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 ) - { - int width, len; - wxSize size = pt_Dcode->m_Size; + width = MIN( size.x, size.y ); + len = MAX( size.x, size.y ) - width; - width = MIN( size.x, size.y ); - len = MAX( size.x, size.y ) - width; + track->m_Width = 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; - 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 - switch (pt_Dcode->m_Shape) - { - case GERB_LINE : // ne devrait pas etre utilis� ici - case GERB_CIRCLE : /* spot rond (for GERBER)*/ - track->m_Shape = S_SPOT_CIRCLE; - break ; + switch( pt_Dcode->m_Shape ) + { + case GERB_LINE: // ne devrait pas etre utilis� ici + case GERB_CIRCLE: /* spot rond (for GERBER)*/ + track->m_Shape = S_SPOT_CIRCLE; + break; - case GERB_OVALE : /* spot ovale (for GERBER)*/ - track->m_Shape = S_SPOT_OVALE; - break ; + case GERB_OVALE: /* spot ovale (for GERBER)*/ + track->m_Shape = S_SPOT_OVALE; + break; - default: /* spot rect (for GERBER)*/ - track->m_Shape = S_SPOT_RECT; - break ; - } + default: /* spot rect (for GERBER)*/ + track->m_Shape = S_SPOT_RECT; + break; + } - len >>= 1; - if ( size.x > size.y ) - { - track->m_Start.x -= len; - track->m_End.x += len; - } - - else - { - track->m_Start.y -= len; - track->m_End.y += len; - } - } - } + len >>= 1; + if( size.x > size.y ) + { + track->m_Start.x -= len; + track->m_End.x += len; + } + else + { + track->m_Start.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 - (rappel : Dcode >= 10) -*/ + * (rappel : Dcode >= 10) + */ { -GERBER_Descr * DcodeList = g_GERBER_Descr_List[layer]; -D_CODE * pt_dcode = NULL; + GERBER_Descr* DcodeList = g_GERBER_Descr_List[layer]; + D_CODE* pt_dcode = NULL; - if (index) *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; - } - return pt_dcode; + if( index ) + *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; + } + return pt_dcode; } /************************************************/ -void WinEDA_GerberFrame::Liste_D_Codes(wxDC * DC) +void WinEDA_GerberFrame::Liste_D_Codes( wxDC* DC ) /************************************************/ { -int ii, jj; -D_CODE * pt_D_code ; -wxString Line; -WinEDA_TextFrame * List; -int scale = 10000; -int curr_layer = GetPCBScreen()->m_Active_Layer; -int layer; -GERBER_Descr * DcodeList; + int ii, jj; + D_CODE* pt_D_code; + wxString Line; + WinEDA_TextFrame* List; + int scale = 10000; + int curr_layer = GetScreen()->m_Active_Layer; + int layer; + GERBER_Descr* DcodeList; - /* Construction de la liste des messages */ - List = new WinEDA_TextFrame(this, _("List D codes")); + /* Construction de la liste des messages */ + List = new WinEDA_TextFrame( this, _( "List D codes" ) ); - for (layer = 0; layer < 32; layer++ ) - { - DcodeList = g_GERBER_Descr_List[layer]; - if ( DcodeList == NULL ) continue; - if ( DcodeList->ReturnUsedDcodeNumber() == 0 ) - continue; - if (layer == curr_layer ) - Line.Printf( wxT("*** Active layer (%2.2d) ***"), layer+1); - else Line.Printf( wxT("*** layer %2.2d ***"), layer+1); - List->Append(Line); + for( layer = 0; layer < 32; layer++ ) + { + DcodeList = g_GERBER_Descr_List[layer]; + if( DcodeList == NULL ) + continue; + if( DcodeList->ReturnUsedDcodeNumber() == 0 ) + continue; + if( layer == curr_layer ) + Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 ); + else + Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 ); + List->Append( Line ); - for ( ii = 0, jj = 1 ; ii < MAX_TOOLS ; ii++ ) - { - pt_D_code = DcodeList->m_Aperture_List[ii] ; - if ( pt_D_code == NULL ) continue; - if ( !pt_D_code->m_InUse && !pt_D_code->m_Defined ) continue; - Line.Printf( wxT( - "tool %2.2d: D%2.2d V %2.4f H %2.4f %s"), - jj, - pt_D_code->m_Num_Dcode, - (float)pt_D_code->m_Size.y /scale, - (float)pt_D_code->m_Size.x /scale, - g_GERBER_Tool_Type[pt_D_code->m_Shape] ); - if ( ! pt_D_code->m_Defined ) Line += wxT(" ?"); - if ( ! pt_D_code->m_InUse ) Line += wxT(" *"); + for( ii = 0, jj = 1; ii < MAX_TOOLS; ii++ ) + { + pt_D_code = DcodeList->m_Aperture_List[ii]; + if( pt_D_code == NULL ) + continue; + if( !pt_D_code->m_InUse && !pt_D_code->m_Defined ) + continue; + Line.Printf( wxT( + "tool %2.2d: D%2.2d V %2.4f H %2.4f %s" ), + jj, + pt_D_code->m_Num_Dcode, + (float) pt_D_code->m_Size.y / scale, + (float) pt_D_code->m_Size.x / scale, + g_GERBER_Tool_Type[pt_D_code->m_Shape] ); - List->Append(Line); - jj++; - } - } - ii = List->ShowModal(); List->Destroy(); - if (ii < 0) return; + if( !pt_D_code->m_Defined ) + Line += wxT( " ?" ); + + if( !pt_D_code->m_InUse ) + Line += wxT( " *" ); + + List->Append( Line ); + jj++; + } + } + + ii = List->ShowModal(); List->Destroy(); + if( ii < 0 ) + return; #if 0 - // Mise en surbrillance des �l�ments correspondant au DCode s�lectionn� - if(Etat_Surbrillance) Hight_Light(DrawPanel, DC); - net_code_Surbrillance = (GetScreen()->m_Active_Layer<< 16) + ii; - Hight_Light(DrawPanel, DC); + + // Mise en surbrillance des �l�ments correspondant au DCode s�lectionn� + if( Etat_Surbrillance ) + Hight_Light( DrawPanel, DC ); + net_code_Surbrillance = (GetScreen()->m_Active_Layer << 16) + ii; + Hight_Light( DrawPanel, DC ); #endif } - - diff --git a/gerbview/edit.cpp b/gerbview/edit.cpp index 4578222e32..cd3a8bb98e 100644 --- a/gerbview/edit.cpp +++ b/gerbview/edit.cpp @@ -23,7 +23,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) * quand un outil est deja selectionn� */ { - EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); + BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); wxString msg; if( m_ID_current_state == 0 ) @@ -84,7 +84,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) */ { 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]; wxPoint pos; wxClientDC dc( DrawPanel ); @@ -114,11 +114,11 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); } /* 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; - m_CurrentScreen->BlockLocate.m_State = STATE_NO_BLOCK; - m_CurrentScreen->BlockLocate.m_BlockDrawStruct = NULL; + GetScreen()->BlockLocate.m_Command = BLOCK_IDLE; + GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK; + GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; } if( m_ID_current_state == 0 ) SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); @@ -267,21 +267,21 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_COPY_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_COPY; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); DrawPanel->m_AutoPAN_Request = FALSE; HandleBlockEnd( &dc ); break; case ID_POPUP_ZOOM_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; case ID_POPUP_DELETE_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; diff --git a/gerbview/files.cpp b/gerbview/files.cpp index f766dabeff..018c8c9d08 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -40,13 +40,16 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event ) case ID_MENU_INC_LAYER_AND_APPEND_FILE: case ID_INC_LAYER_AND_APPEND_FILE: - { - int layer = GetPCBScreen()->m_Active_Layer; - ((PCB_SCREEN*)GetScreen())->m_Active_Layer++; - if( !LoadOneGerberFile( wxEmptyString, &dc, 0 ) ) - ((PCB_SCREEN*)GetScreen())->m_Active_Layer = layer; - SetToolbars(); - } + { + int origLayer = GetScreen()->m_Active_Layer; + + GetScreen()->m_Active_Layer++; + + if( !LoadOneGerberFile( wxEmptyString, &dc, 0 ) ) + GetScreen()->m_Active_Layer = origLayer; + + SetToolbars(); + } break; case ID_MENU_APPEND_FILE: diff --git a/gerbview/gerberframe.cpp b/gerbview/gerberframe.cpp index ef7dacf424..9faabbc5fe 100644 --- a/gerbview/gerberframe.cpp +++ b/gerbview/gerberframe.cpp @@ -1,6 +1,6 @@ - /******************************************************************/ - /* gerberframe.cpp - fonctions des classes du type WinEDA_GerberFrame */ - /******************************************************************/ +/******************************************************************/ +/* gerberframe.cpp - fonctions des classes du type WinEDA_GerberFrame */ +/******************************************************************/ #ifdef __GNUG__ #pragma implementation @@ -17,300 +17,309 @@ #include "id.h" - /****************************************/ - /* class WinEDA_GerberFrame for GerbView*/ - /****************************************/ +/****************************************/ +/* class WinEDA_GerberFrame for GerbView*/ +/****************************************/ -BEGIN_EVENT_TABLE(WinEDA_GerberFrame, wxFrame) - COMMON_EVENTS_DRAWFRAME +BEGIN_EVENT_TABLE( WinEDA_GerberFrame, wxFrame ) +COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow ) +EVT_SIZE( WinEDA_GerberFrame::OnSize ) - EVT_CLOSE(WinEDA_GerberFrame::OnCloseWindow) - EVT_SIZE(WinEDA_GerberFrame::OnSize) +EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, + WinEDA_GerberFrame::Process_Zoom ) - EVT_TOOL_RANGE(ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, - WinEDA_GerberFrame::Process_Zoom) +EVT_TOOL( ID_LOAD_FILE, WinEDA_GerberFrame::Files_io ) +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_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_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END, + WinEDA_DrawFrame::ProcessFontPreferences ) - EVT_MENU_RANGE(ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END, - WinEDA_DrawFrame::ProcessFontPreferences) +// Menu Files: +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(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) +EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10, + WinEDA_GerberFrame::Files_io ) - EVT_MENU_RANGE(ID_LOAD_FILE_1,ID_LOAD_FILE_10, - WinEDA_GerberFrame::Files_io) +EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions ) - 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_RANGE(ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END, - WinEDA_GerberFrame::Process_Config) +EVT_MENU( ID_COLORS_SETUP, WinEDA_GerberFrame::Process_Config ) +EVT_MENU( ID_OPTIONS_SETUP, 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(ID_OPTIONS_SETUP, WinEDA_GerberFrame::Process_Config) - EVT_MENU(ID_PCB_LOOK_SETUP, WinEDA_GerberFrame::Process_Config) +EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, + WinEDA_DrawFrame::SetLanguage ) - EVT_MENU_RANGE(ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, - WinEDA_DrawFrame::SetLanguage) - - // menu Postprocess - 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) - EVT_MENU(ID_GERBVIEW_SHOW_SOURCE, - WinEDA_GerberFrame::Process_Special_Functions ) +// menu Postprocess +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 ) +EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, + WinEDA_GerberFrame::Process_Special_Functions ) - // menu Miscellaneous - 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) +// menu Miscellaneous +EVT_MENU( ID_PCB_GLOBAL_DELETE, WinEDA_GerberFrame::Process_Special_Functions ) - EVT_TOOL(ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings) - 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) +// Menu Help +EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp ) +EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout ) - EVT_KICAD_CHOICEBOX(ID_TOOLBARH_GERBER_SELECT_TOOL, - WinEDA_GerberFrame::Process_Special_Functions) +EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings ) +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: - EVT_TOOL(ID_NO_SELECT_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_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions) +// Vertical toolbar: +EVT_TOOL( ID_NO_SELECT_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_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions ) - // Annulation de commande en cours - EVT_MENU_RANGE(ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, - WinEDA_PcbFrame::Process_Special_Functions ) +// Annulation de commande en cours +EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, + WinEDA_PcbFrame::Process_Special_Functions ) - // Pop up menu - EVT_MENU(ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, - WinEDA_GerberFrame::Process_Special_Functions ) +// Pop up menu +EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, + WinEDA_GerberFrame::Process_Special_Functions ) - // Option toolbar - EVT_TOOL_RANGE(ID_TB_OPTIONS_START,ID_TB_OPTIONS_END, - WinEDA_GerberFrame::OnSelectOptionToolbar) +// Option toolbar +EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, + WinEDA_GerberFrame::OnSelectOptionToolbar ) - // PopUp Menu trait�s dans drawpanel.cpp +// PopUp Menu trait�s dans drawpanel.cpp END_EVENT_TABLE() - /****************/ - /* Constructeur */ - /****************/ +/****************/ +/* Constructeur */ +/****************/ -WinEDA_GerberFrame::WinEDA_GerberFrame(wxWindow * father, WinEDA_App *parent, - const wxString & title, const wxPoint& pos, const wxSize& size, long style) : - WinEDA_BasePcbFrame(father, parent, GERBER_FRAME, title, pos, size, style) +WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, + WinEDA_App* parent, + 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_AboutTitle = g_GerbviewAboutTitle; - m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines - m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee - m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin� - m_Ident = GERBER_FRAME; - m_ZoomMaxValue = 1024; - if ( DrawPanel ) DrawPanel->m_Block_Enable = TRUE; - // Give an icon - #ifdef __WINDOWS__ - SetIcon( wxICON(a_icon_gerbview)); - #else - SetIcon( wxICON(icon_gerbview)); - #endif + m_FrameName = wxT( "GerberFrame" ); + m_AboutTitle = g_GerbviewAboutTitle; + m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines + m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee + m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin� + m_Ident = GERBER_FRAME; + m_ZoomMaxValue = 1024; + if( DrawPanel ) + DrawPanel->m_Block_Enable = TRUE; - m_CurrentScreen = ActiveScreen = ScreenPcb; + // Give an icon + #ifdef __WINDOWS__ + SetIcon( wxICON( a_icon_gerbview ) ); + #else + SetIcon( wxICON( icon_gerbview ) ); + #endif - GetSettings(); - SetSize(m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y); - ReCreateMenuBar(); - ReCreateHToolbar(); - ReCreateVToolbar(); - ReCreateOptToolbar(); + SetBaseScreen( ActiveScreen = ScreenPcb ); + + GetSettings(); + SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); + ReCreateMenuBar(); + ReCreateHToolbar(); + ReCreateVToolbar(); + ReCreateOptToolbar(); } WinEDA_GerberFrame::~WinEDA_GerberFrame() { - m_Parent->m_GerberFrame = NULL; - m_CurrentScreen = ScreenPcb; + m_Parent->m_GerberFrame = NULL; + 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 ) - { - if(screen->IsModify()) break; - screen = screen->Next(); - } + while( screen ) + { + if( screen->IsModify() ) + break; + screen = screen->Next(); + } - if ( screen ) - { - if( ! IsOK(this, _("Layer modified, Continue ?")) ) - { - Event.Veto(); - return; - } - } + if( screen ) + { + if( !IsOK( this, _( "Layer modified, Continue ?" ) ) ) + { + Event.Veto(); + return; + } + } - while( screen ) // suppression flag modify pour eviter d'autres message - { - screen->ClrModify(); - screen = screen->Next(); - } + while( screen ) // suppression flag modify pour eviter d'autres message + { + screen->ClrModify(); + screen = screen->Next(); + } - /* Reselection de l'ecran de base, - pour les evenements de refresh g�n�r�s par wxWindows */ - m_CurrentScreen = ActiveScreen = ScreenPcb; + SetBaseScreen( ActiveScreen = ScreenPcb ); - SaveSettings(); - Destroy(); + SaveSettings(); + Destroy(); } + /*******************************************/ void WinEDA_GerberFrame::SetToolbars() /*******************************************/ + /** Function SetToolbars() * Set the tools state for the toolbars, accordint to display options */ { -int layer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer; -GERBER_Descr * Gerber_layer_descr = g_GERBER_Descr_List[layer]; + int layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_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 ) - { - m_HToolBar->EnableTool(wxID_CUT,TRUE); - m_HToolBar->EnableTool(wxID_COPY,TRUE); - } - else - { - m_HToolBar->EnableTool(wxID_CUT,FALSE); - m_HToolBar->EnableTool(wxID_COPY,FALSE); - } + if( GetScreen()->BlockLocate.m_Command == BLOCK_MOVE ) + { + m_HToolBar->EnableTool( wxID_CUT, TRUE ); + m_HToolBar->EnableTool( wxID_COPY, TRUE ); + } + else + { + m_HToolBar->EnableTool( wxID_CUT, FALSE ); + m_HToolBar->EnableTool( wxID_COPY, FALSE ); + } - if ( g_UnDeleteStackPtr ) - { - m_HToolBar->EnableTool(wxID_PASTE,TRUE); - m_HToolBar->EnableTool(ID_UNDO_BUTT,TRUE); - } - else - { - m_HToolBar->EnableTool(wxID_PASTE,FALSE); - m_HToolBar->EnableTool(ID_UNDO_BUTT,FALSE); - } + if( g_UnDeleteStackPtr ) + { + m_HToolBar->EnableTool( wxID_PASTE, TRUE ); + m_HToolBar->EnableTool( ID_UNDO_BUTT, TRUE ); + } + else + { + m_HToolBar->EnableTool( wxID_PASTE, FALSE ); + m_HToolBar->EnableTool( ID_UNDO_BUTT, FALSE ); + } - if ( m_SelLayerBox->GetSelection() != ((PCB_SCREEN*)GetScreen())->m_Active_Layer ) - { - m_SelLayerBox->SetSelection( ((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 ); + } - if ( Gerber_layer_descr ) - { - int sel_index; - m_SelLayerTool->Enable(TRUE); - if ( Gerber_layer_descr->m_Selected_Tool < FIRST_DCODE ) // No tool selected - sel_index = 0; - else - sel_index = Gerber_layer_descr->m_Selected_Tool - FIRST_DCODE + 1; + if( Gerber_layer_descr ) + { + int sel_index; + m_SelLayerTool->Enable( TRUE ); + if( Gerber_layer_descr->m_Selected_Tool < FIRST_DCODE ) // No tool selected + sel_index = 0; + else + sel_index = Gerber_layer_descr->m_Selected_Tool - FIRST_DCODE + 1; - if ( sel_index != m_SelLayerTool->GetSelection() ) - { - m_SelLayerTool->SetSelection(sel_index); - } - } - else - { - m_SelLayerTool->SetSelection(0); - m_SelLayerTool->Enable(FALSE); - } + if( sel_index != m_SelLayerTool->GetSelection() ) + { + m_SelLayerTool->SetSelection( sel_index ); + } + } + else + { + m_SelLayerTool->SetSelection( 0 ); + m_SelLayerTool->Enable( FALSE ); + } - if ( m_OptionsToolBar ) - { - m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SELECT_UNIT_MM, - g_UnitMetric == MILLIMETRE ? TRUE : FALSE); - m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SELECT_UNIT_INCH, - g_UnitMetric == INCHES ? TRUE : FALSE); + if( m_OptionsToolBar ) + { + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, + g_UnitMetric == MILLIMETRE ? TRUE : FALSE ); + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, + g_UnitMetric == INCHES ? TRUE : FALSE ); - m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_POLAR_COORD, - DisplayOpt.DisplayPolarCood); + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, + DisplayOpt.DisplayPolarCood ); - m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_GRID, - m_Draw_Grid); + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, + m_Draw_Grid ); - m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SELECT_CURSOR, - g_CursorShape); + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, + g_CursorShape ); - m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_PADS_SKETCH, - ! m_DisplayPadFill); + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, + !m_DisplayPadFill ); - m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, - ! m_DisplayPcbTrackFill); + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, + !m_DisplayPcbTrackFill ); - m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, - g_DisplayPolygonsModeSketch == 0 ? 0 : 1); + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, + g_DisplayPolygonsModeSketch == 0 ? 0 : 1 ); - m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_DCODES, - DisplayOpt.DisplayPadNum); - } + m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_DCODES, + DisplayOpt.DisplayPadNum ); + } - DisplayUnitsMsg(); + DisplayUnitsMsg(); } + /*************************************/ int WinEDA_GerberFrame::BestZoom() /*************************************/ { -int ii,jj ; -int bestzoom; -wxSize size; + int ii, jj; + int bestzoom; + wxSize size; - /* calcul du zoom montrant tout le dessim */ - m_Pcb->ComputeBoundaryBox(); - size = DrawPanel->GetClientSize(); - ii = m_Pcb->m_BoundaryBox.GetWidth() / size.x; - jj = m_Pcb->m_BoundaryBox.GetHeight() / size.y; - bestzoom = MAX(ii, jj) + 1; + /* calcul du zoom montrant tout le dessim */ + m_Pcb->ComputeBoundaryBox(); + size = DrawPanel->GetClientSize(); + ii = m_Pcb->m_BoundaryBox.GetWidth() / size.x; + jj = m_Pcb->m_BoundaryBox.GetHeight() / size.y; + bestzoom = MAX( ii, jj ) + 1; - /* determination du zoom existant le plus proche */ - for (ii = 1 ; ii < 2048 ; ii <<= 1 ) - { - if(ii >= bestzoom) break; - } - bestzoom = ii; + /* determination du zoom existant le plus proche */ + for( ii = 1; ii < 2048; ii <<= 1 ) + { + if( ii >= bestzoom ) + break; + } - GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); + bestzoom = ii; - return(bestzoom); + GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); + + return bestzoom; } diff --git a/gerbview/initpcb.cpp b/gerbview/initpcb.cpp index be963d0e8e..2b38d93a77 100644 --- a/gerbview/initpcb.cpp +++ b/gerbview/initpcb.cpp @@ -74,8 +74,8 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query ) m_Pcb->m_NbSegmZone = 0; /* Init parametres de gestion des ecrans PAD et PCB */ - m_CurrentScreen = ActiveScreen = ScreenPcb; - GetPCBScreen()->Init(); + SetBaseScreen( ActiveScreen = ScreenPcb ); + GetScreen()->Init(); return TRUE; } @@ -104,7 +104,7 @@ void WinEDA_GerberFrame::Erase_Segments_Pcb( bool all_layers, bool query ) { BOARD_ITEM* PtStruct; BOARD_ITEM* PtNext; - int layer = GetPCBScreen()->m_Active_Layer; + int layer = GetScreen()->m_Active_Layer; if( all_layers ) layer = -1; @@ -189,7 +189,7 @@ void WinEDA_GerberFrame::Erase_Textes_Pcb( bool query ) void WinEDA_GerberFrame::Erase_Current_Layer( bool query ) /*********************************************************/ { - int layer = GetPCBScreen()->m_Active_Layer; + int layer = GetScreen()->m_Active_Layer; wxString msg; msg.Printf( _( "Delete Layer %d" ), layer + 1 ); diff --git a/gerbview/locate.cpp b/gerbview/locate.cpp index 22f6f572ce..903099600f 100644 --- a/gerbview/locate.cpp +++ b/gerbview/locate.cpp @@ -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 @@ -48,7 +48,7 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc ) int layer; /* 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 ); if( Track != NULL ) { @@ -80,9 +80,9 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc ) } 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; } @@ -166,7 +166,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc ) * 1 - routine de localisation du segment de piste pointe par la souris. * 2 - routine de localisation du segment de piste pointe par le point * ref_pX , ref_pY.r - * + * * La recherche commence a l'adresse start_adresse */ @@ -228,9 +228,9 @@ TRACK* Locate_Pistes( TRACK* start_adresse, wxPoint ref, int Layer ) * 1 - routine de localisation du segment de zone pointe par la souris. * 2 - routine de localisation du segment de zone pointe par le point * ref_pX , ref_pY.r - * + * * Si layer == -1 , le tst de la couche n'est pas fait - * + * * La recherche commence a l'adresse start_adresse */ diff --git a/gerbview/onrightclick.cpp b/gerbview/onrightclick.cpp index 5fcb5ba269..9504f766c4 100644 --- a/gerbview/onrightclick.cpp +++ b/gerbview/onrightclick.cpp @@ -20,9 +20,9 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu * The menu already has a list of zoom commands. */ { - EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); + BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); 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 @@ -89,5 +89,5 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu } PopMenu->AppendSeparator(); - return true; + return true; } diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index 068e850e5d..846c717421 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -126,7 +126,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, wxPoint pos; int error = 0; - layer = GetPCBScreen()->m_Active_Layer; + layer = GetScreen()->m_Active_Layer; if( g_GERBER_Descr_List[layer] == NULL ) { diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index 729d22c80b..574afac083 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -39,7 +39,7 @@ * G75 Active interpolation circulaire sur 360 degre * G90 Mode Coordonnees absolues * G91 Mode Coordonnees Relatives - * + * * Coordonnees X,Y * X,Y sont suivies de + ou - et de m+n chiffres (non separes) * m = partie entiere @@ -48,20 +48,20 @@ * m = 3, n = 4 (format 3.4) * ex: * G__ X00345Y-06123 D__* - * + * * Outils et D_CODES * numero d'outil ( identification des formes ) * 1 a 99 (classique) * 1 a 999 * D_CODES: - * + * * D01 ... D9 = codes d'action: * D01 = activation de lumiere (baisser de plume) lors du d�placement * D02 = extinction de lumiere (lever de plume) lors du d�placement * D03 = Flash * D09 = VAPE Flash * D51 = precede par G54 -> Select VAPE - * + * * D10 ... D255 = Indentification d'outils ( d'ouvertures ) * Ne sont pas tj dans l'ordre ( voir tableau dans PCBPLOT.H) */ @@ -106,8 +106,8 @@ static void Append_1_Flash_ROND_GERBER( int Dcode_tool, track = new TRACK( frame->m_Pcb ); 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_Start = track->m_End = pos; 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->SetLayer( frame->GetPCBScreen()->m_Active_Layer ); + track->SetLayer( frame->GetScreen()->m_Active_Layer ); track->m_Width = width; track->m_Start = track->m_End = pos; 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->SetLayer( frame->GetPCBScreen()->m_Active_Layer ); + track->SetLayer( frame->GetScreen()->m_Active_Layer ); track->m_Width = largeur; track->m_Start = startpoint; NEGATE( track->m_Start.y ); @@ -204,12 +204,12 @@ static void Append_1_SEG_ARC_GERBER( int Dcode_index, /* creation d'un arc: * si multiquadrant == TRUE arc de 0 a 360 degres * et rel_center est la coordonn�e du centre relativement au startpoint - * + * * si multiquadrant == FALSE arc de 0 � 90 entierement contenu dans le meme quadrant * et rel_center est la coordonn�e du centre relativement au startpoint, * mais en VALEUR ABSOLUE et le signe des valeurs x et y de rel_center doit * etre deduit de cette limite de 90 degres - * + * */ { TRACK* track; @@ -220,7 +220,7 @@ static void Append_1_SEG_ARC_GERBER( int Dcode_index, track->Insert( frame->m_Pcb, NULL ); track->m_Shape = S_ARC; - track->SetLayer( frame->GetPCBScreen()->m_Active_Layer ); + track->SetLayer( frame->GetScreen()->m_Active_Layer ); track->m_Width = largeur; if( multiquadrant ) @@ -285,7 +285,7 @@ static void Append_1_SEG_ARC_GERBER( int Dcode_index, NEGATE( track->m_Start.y ); NEGATE( track->m_End.y ); - + //NEGATE( track->GetSubNet() ); track->SetSubNet( -track->GetSubNet() ); @@ -741,7 +741,7 @@ bool GERBER_Descr::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, 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_Start = m_PreviousPos; NEGATE( edge_poly->m_Start.y ); diff --git a/gerbview/tool_gerber.cpp b/gerbview/tool_gerber.cpp index 839f38d88f..f3591e1907 100644 --- a/gerbview/tool_gerber.cpp +++ b/gerbview/tool_gerber.cpp @@ -123,7 +123,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) _( "Save application preferences" ), save_setup_xpm ); configmenu->AppendSeparator(); - AddHotkeyConfigMenu( configmenu ); + AddHotkeyConfigMenu( configmenu ); // Menu drill ( generation fichiers percage) @@ -200,7 +200,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) if( GetScreen() ) { - layer = GetPCBScreen()->m_Active_Layer; + layer = GetScreen()->m_Active_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, 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->AddSeparator(); diff --git a/eeschema/class_screen.h b/include/class_screen.h similarity index 81% rename from eeschema/class_screen.h rename to include/class_screen.h index f9608a4657..98f3c84a66 100644 --- a/eeschema/class_screen.h +++ b/include/class_screen.h @@ -26,6 +26,21 @@ public: SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE ); ~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 { return wxT( "SCH_SCREEN" ); @@ -34,7 +49,8 @@ public: 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. */ bool CheckIfOnDrawList( SCH_ITEM* st ); void AddToDrawList( SCH_ITEM* DrawStruct ); diff --git a/include/drawpanel_wxstruct.h b/include/drawpanel_wxstruct.h index d8cafcb972..5ff27ef484 100644 --- a/include/drawpanel_wxstruct.h +++ b/include/drawpanel_wxstruct.h @@ -23,7 +23,7 @@ class SCH_ITEM; /* classe representant un ecran graphique de dessin */ /****************************************************/ -class WinEDA_DrawPanel : public EDA_DRAW_PANEL +class WinEDA_DrawPanel : public wxScrolledWindow { public: int m_Ident; @@ -59,8 +59,10 @@ public: // Constructor and destructor WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size ); ~WinEDA_DrawPanel() { } + /****************************/ - virtual BASE_SCREEN* GetScreen() { return m_Parent->GetScreen(); } + BASE_SCREEN* GetScreen(); + void PrepareGraphicContext( wxDC* DC ); wxPoint CalcAbsolutePosition( const wxPoint& rel_pos ); @@ -140,6 +142,7 @@ public: DECLARE_EVENT_TABLE() }; + /**************************/ /* class DrawBlockStruct */ /**************************/ @@ -264,6 +267,14 @@ public: BASE_SCREEN( int idscreen, KICAD_T aType = SCREEN_STRUCT_TYPE ); ~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 */ wxSize ReturnPageSize(); int GetInternalUnits(); @@ -289,15 +300,6 @@ public: 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; } - - //-------------------------------------------------------------- /** * Function GetZoom diff --git a/include/pcbstruct.h b/include/pcbstruct.h index 5a65e995ee..7e8f53f17d 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -236,6 +236,14 @@ public: */ 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 * 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 diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index ddf7c0986e..8c14cba217 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -56,7 +56,7 @@ public: /* fonction de placement */ - virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); + virtual void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); /** * Function Save @@ -84,7 +84,7 @@ public: public: DrawPickedStruct( SCH_ITEM * pickedstruct = NULL ); ~DrawPickedStruct(); - void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { }; + void Place( WinEDA_SchematicFrame* frame, wxDC* DC ) { }; void DeleteWrapperList(); DrawPickedStruct* Next() { return (DrawPickedStruct*) Pnext; } diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index da8bbcf2a3..162d991af2 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -28,6 +28,7 @@ enum fl_rot_cmp { CMP_MIROIR_Y = 0x200 // miroir selon axe Y }; + class WinEDA_SchematicFrame : public WinEDA_DrawFrame { public: @@ -47,6 +48,9 @@ public: void OnCloseWindow( wxCloseEvent& Event ); void Process_Special_Functions( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event ); + + void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ); + void Save_Config( wxWindow* displayframe ); void RedrawActiveWindow( wxDC* DC, bool EraseBg ); @@ -62,7 +66,11 @@ public: EDA_BaseStruct* DrawStruct ); DrawSheetPath* GetSheet(); - virtual BASE_SCREEN* GetScreen(); + + SCH_SCREEN* GetScreen() const; + + BASE_SCREEN* GetBaseScreen() const; + virtual void SetScreen( SCH_SCREEN* screen ); virtual wxString GetScreenDesc(); @@ -161,7 +169,7 @@ private: bool PutInUndoList = FALSE ); // 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 ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ); void StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ); @@ -296,7 +304,7 @@ public: void SetToolbars(); 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 ); private: @@ -406,7 +414,7 @@ public: void ClickOnLibList( wxCommandEvent& event ); void ClickOnCmpList( wxCommandEvent& event ); - virtual BASE_SCREEN* GetScreen() { return (BASE_SCREEN*) m_CurrentScreen; } + SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); } private: void SelectCurrentLibrary(); diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index ccc01e4e87..74875166d4 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -82,6 +82,7 @@ public: */ void SetBOARD( BOARD* aBoard ); + // General virtual void OnCloseWindow( wxCloseEvent& 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 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(); void Show3D_Frame( wxCommandEvent& event ); @@ -740,10 +744,9 @@ public: int BestZoom(); // Retourne le meilleur zoom void OnSelectOptionToolbar( wxCommandEvent& event ); void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); - PCB_SCREEN* GetPCBScreen(){ return (PCB_SCREEN*)GetScreen(); } - EDA_BaseStruct* GerberGeneralLocateAndDisplay(); - EDA_BaseStruct* Locate( int typeloc ); + BOARD_ITEM* GerberGeneralLocateAndDisplay(); + BOARD_ITEM* Locate( int typeloc ); void SetToolbars(); diff --git a/include/wxstruct.h b/include/wxstruct.h index 8da0e1544b..4caeca2b4e 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -35,7 +35,6 @@ #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER #define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS -#define EDA_DRAW_PANEL wxScrolledWindow class wxMyDialogModalData; @@ -206,8 +205,6 @@ public: WinEDAChoiceBox* m_SelZoomBox; // Dialog box to choose the Zoom value 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_ID_current_state; // Id of active button on the vertical 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 * des composants) */ +private: + BASE_SCREEN* m_CurrentScreen; ///< current used SCREEN + +protected: + void SetBaseScreen( BASE_SCREEN* aScreen ) { m_CurrentScreen = aScreen; } + public: // Constructor and destructor @@ -236,9 +239,15 @@ public: ~WinEDA_DrawFrame(); - virtual BASE_SCREEN* GetScreen() { return m_CurrentScreen; } 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 OnMouseEvent( wxMouseEvent& event ); virtual void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); @@ -261,7 +270,7 @@ public: virtual void OnSelectGrid( 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 ); void OnEraseBackground( wxEraseEvent& SizeEvent ); diff --git a/pcbnew/automove.cpp b/pcbnew/automove.cpp index 62a8049196..a33dfaa0cb 100644 --- a/pcbnew/automove.cpp +++ b/pcbnew/automove.cpp @@ -105,11 +105,11 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) break; case ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE: - FixeModule( (MODULE*) m_CurrentScreen->GetCurItem(), TRUE ); + FixeModule( (MODULE*) GetScreen()->GetCurItem(), TRUE ); break; case ID_POPUP_PCB_AUTOPLACE_FREE_MODULE: - FixeModule( (MODULE*) m_CurrentScreen->GetCurItem(), FALSE ); + FixeModule( (MODULE*) GetScreen()->GetCurItem(), FALSE ); break; case ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES: @@ -121,7 +121,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) break; case ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE: - AutoPlaceModule( (MODULE*) m_CurrentScreen->GetCurItem(), + AutoPlaceModule( (MODULE*) GetScreen()->GetCurItem(), PLACE_1_MODULE, &dc ); break; @@ -199,7 +199,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ) MODULE* Module; wxPoint start, current; int Ymax_size, Xsize_allowed; - int pas_grille = m_CurrentScreen->GetGrid().x; + int pas_grille = GetScreen()->GetGrid().x; bool EdgeExists; float surface; @@ -237,8 +237,8 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ) */ if( PlaceModulesHorsPcb && EdgeExists ) { - if( m_CurrentScreen->m_Curseur.y < (m_Pcb->m_BoundaryBox.GetBottom() + 2000) ) - m_CurrentScreen->m_Curseur.y = m_Pcb->m_BoundaryBox.GetBottom() + 2000; + if( GetScreen()->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 */ @@ -257,7 +257,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ) Xsize_allowed = (int) (sqrt( surface ) * 4.0 / 3.0); /* Placement des modules */ - start = current = m_CurrentScreen->m_Curseur; + start = current = GetScreen()->m_Curseur; Ymax_size = 0; for( pt_Dmod = BaseListeModules; *pt_Dmod != NULL; pt_Dmod++ ) @@ -279,13 +279,13 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ) Ymax_size = 0; } - m_CurrentScreen->m_Curseur.x = + GetScreen()->m_Curseur.x = 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(); Ymax_size = MAX( Ymax_size, Module->m_RealBoundaryBox.GetHeight() ); - PutOnGrid( &m_CurrentScreen->m_Curseur ); + PutOnGrid( &GetScreen()->m_Curseur ); Module->Draw( DrawPanel, DC, GR_XOR ); Place_Module( Module, DC ); /* positionne Module et recalcule cadre */ @@ -294,7 +294,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ) } 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 ) ) { - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); Module->Draw( DrawPanel, DC, GR_XOR ); Rotate_Module( NULL, Module, Orient, FALSE ); Module->Draw( DrawPanel, DC, GR_OR ); diff --git a/pcbnew/autoplac.cpp b/pcbnew/autoplac.cpp index f5b7defe6e..927607ac89 100644 --- a/pcbnew/autoplac.cpp +++ b/pcbnew/autoplac.cpp @@ -118,7 +118,7 @@ void WinEDA_PcbFrame::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC lay_tmp_TOP = Route_Layer_TOP; OldPasRoute = g_GridRoutingSize; - g_GridRoutingSize = m_CurrentScreen->GetGrid().x; + g_GridRoutingSize = GetScreen()->GetGrid().x; // Ensure g_GridRoutingSize has a reasonnable value: if( g_GridRoutingSize < 10 ) @@ -282,10 +282,10 @@ end_of_tst: break; /* placement du module */ - CurrPosition = m_CurrentScreen->m_Curseur; - m_CurrentScreen->m_Curseur = PosOK; + CurrPosition = GetScreen()->m_Curseur; + GetScreen()->m_Curseur = PosOK; Place_Module( Module, DC ); - m_CurrentScreen->m_Curseur = CurrPosition; + GetScreen()->m_Curseur = CurrPosition; Module->Set_Rectangle_Encadrement(); Module->SetRectangleExinscrit(); diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 990217b04a..0ef9213656 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -45,7 +45,6 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father, WinEDA_DrawFrame( father, idtype, parent, title, pos, size, style ) { m_InternalUnits = 10000; // Internal unit = 1/10000 inch - m_CurrentScreen = NULL; m_Pcb = NULL; 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 ) { - if(m_Pcb != g_ModuleEditor_Pcb) - delete m_Pcb; + if(m_Pcb != g_ModuleEditor_Pcb) + delete m_Pcb; m_Pcb = aBoard; } @@ -98,7 +103,7 @@ int WinEDA_BasePcbFrame::BestZoom( void ) jj = ( dy + (size.y / 2) ) / size.y; bestzoom = MAX( ii, jj ) + 1; - m_CurrentScreen->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); + GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); return bestzoom; } @@ -284,7 +289,7 @@ void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event ) void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem ) /*****************************************************************/ { - m_CurrentScreen->SetCurItem( aItem ); + GetScreen()->SetCurItem( aItem ); if( aItem ) { @@ -314,7 +319,7 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem ) BOARD_ITEM* WinEDA_BasePcbFrame::GetCurItem() /*****************************************************************/ { - return (BOARD_ITEM*) m_CurrentScreen->GetCurItem(); + return GetScreen()->GetCurItem(); } diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index d78f060bf4..2ad111a637 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -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.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom(); diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index c51623a33e..827fdd6a87 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -292,12 +292,12 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, */ { DrawBlockStruct* PtBlock; - BASE_SCREEN* screen = panel->m_Parent->GetScreen(); + BASE_SCREEN* screen = panel->GetScreen(); BOARD_ITEM* item; wxPoint move_offset; MODULE* Currentmodule = g_EDA_Appl->m_ModuleEditFrame->m_Pcb->m_Modules; - PtBlock = &panel->GetScreen()->BlockLocate; + PtBlock = &screen->BlockLocate; GRSetDrawMode( DC, g_XorMode ); /* Effacement ancien cadre */ diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 1cb68a5de5..91c6d246ee 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -18,7 +18,7 @@ wxPoint BOARD_ITEM::ZeroOffset(0,0); // this is an ugly workaround to a linking problem in debug mode // which needs to define SCH_ITEM::Place() when not really used. #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 ) { xmin = ymin = 0; - xmax = m_PcbFrame->m_CurrentScreen->ReturnPageSize().x; - ymax = m_PcbFrame->m_CurrentScreen->ReturnPageSize().y; + xmax = m_PcbFrame->GetScreen()->ReturnPageSize().x; + ymax = m_PcbFrame->GetScreen()->ReturnPageSize().y; } else { - xmin = -m_PcbFrame->m_CurrentScreen->ReturnPageSize().x / 2; - ymin = -m_PcbFrame->m_CurrentScreen->ReturnPageSize().y / 2; - xmax = m_PcbFrame->m_CurrentScreen->ReturnPageSize().x / 2; - ymax = m_PcbFrame->m_CurrentScreen->ReturnPageSize().y / 2; + xmin = -m_PcbFrame->GetScreen()->ReturnPageSize().x / 2; + ymin = -m_PcbFrame->GetScreen()->ReturnPageSize().y / 2; + xmax = m_PcbFrame->GetScreen()->ReturnPageSize().x / 2; + ymax = m_PcbFrame->GetScreen()->ReturnPageSize().y / 2; } } diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index d46450c41c..ad5709b61e 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -154,13 +154,10 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, if( (color & ITEM_NOT_SHOW) != 0 ) return; - if( panel ) - screen = (PCB_SCREEN*) panel->m_Parent->m_CurrentScreen; - else - screen = (PCB_SCREEN*) ActiveScreen; - frame = (WinEDA_BasePcbFrame*) panel->m_Parent; + screen = frame->GetScreen(); + zoom = screen->GetZoom(); type_trace = m_Shape; diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 6fec263899..5760b22dc1 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -238,23 +238,18 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin wxPoint coord[4]; int zoom; int fillpad = 0; - WinEDA_BasePcbFrame* frame = NULL; wxPoint shape_pos; - PCB_SCREEN* screen = panel ? - (PCB_SCREEN*) panel->m_Parent->m_CurrentScreen : - (PCB_SCREEN*) ActiveScreen; + wxASSERT( panel ); - if ( panel ) // Use current frame setting - { - frame = (WinEDA_BasePcbFrame*) panel->m_Parent; - } - else if( DisplayOpt.DisplayPadFill == FILLED ) // Use board frame setting - fillpad = 1; + WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; + + PCB_SCREEN* screen = frame->GetScreen(); + + zoom = screen->GetZoom(); if( frame->m_DisplayPadFill == FILLED ) fillpad = 1; - zoom = screen->GetZoom(); #ifdef PCBNEW if( m_Flags & IS_MOVED ) diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index 11347b1c84..508c43e4b2 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -151,7 +151,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC ) frame->Compile_Ratsnest( DC, AFFICHE ); - frame->m_CurrentScreen->SetModify(); + frame->GetScreen()->SetModify(); } diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index 1061ebeb0a..df3c87cb7a 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -529,22 +529,22 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) { case EDA_PANNING_UP_KEY: OnZoom( ID_ZOOM_PANNING_UP ); - curpos = m_CurrentScreen->m_Curseur; + curpos = GetScreen()->m_Curseur; break; case EDA_PANNING_DOWN_KEY: OnZoom( ID_ZOOM_PANNING_DOWN ); - curpos = m_CurrentScreen->m_Curseur; + curpos = GetScreen()->m_Curseur; break; case EDA_PANNING_LEFT_KEY: OnZoom( ID_ZOOM_PANNING_LEFT ); - curpos = m_CurrentScreen->m_Curseur; + curpos = GetScreen()->m_Curseur; break; case EDA_PANNING_RIGHT_KEY: OnZoom( ID_ZOOM_PANNING_RIGHT ); - curpos = m_CurrentScreen->m_Curseur; + curpos = GetScreen()->m_Curseur; break; case EDA_ZOOM_IN_FROM_MOUSE: diff --git a/pcbnew/cotation.cpp b/pcbnew/cotation.cpp index 99dcba2e51..effebc7db6 100644 --- a/pcbnew/cotation.cpp +++ b/pcbnew/cotation.cpp @@ -186,7 +186,7 @@ void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event ) CurrentCotation->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); } - m_Parent->m_CurrentScreen->SetModify(); + m_Parent->GetScreen()->SetModify(); EndModal( 1 ); } @@ -226,7 +226,7 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC ) if( Cotation == NULL ) /* debut reel du trace */ { status_cotation = 1; - pos = m_CurrentScreen->m_Curseur; + pos = GetScreen()->m_Curseur; Cotation = new COTATION( m_Pcb ); 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 = Cotation; - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); DrawPanel->ManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL; @@ -374,7 +374,7 @@ void WinEDA_PcbFrame::Delete_Cotation( COTATION* Cotation, wxDC* DC ) if( DC ) Cotation->Draw( DrawPanel, DC, GR_XOR ); Cotation->DeleteStructure(); - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); } diff --git a/pcbnew/dialog_drc.cpp b/pcbnew/dialog_drc.cpp index e0600bb5d0..2ffa05ef2d 100644 --- a/pcbnew/dialog_drc.cpp +++ b/pcbnew/dialog_drc.cpp @@ -765,7 +765,7 @@ void DrcDialog::OnButtonBrowseRptFileClick( wxCommandEvent& event ) wxString Mask(wxT("*")); wxString Ext(wxT(".rpt")); - FileName = m_Parent->m_CurrentScreen->m_FileName; + FileName = m_Parent->GetScreen()->m_FileName; ChangeFileNameExt(FileName, wxT("-drc") + Ext); Mask += Ext; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index de7a2eff3f..f937af1639 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -141,11 +141,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); } /* 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; - m_CurrentScreen->BlockLocate.m_State = STATE_NO_BLOCK; - m_CurrentScreen->BlockLocate.m_BlockDrawStruct = NULL; + GetScreen()->BlockLocate.m_Command = BLOCK_IDLE; + GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK; + GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; } if( m_ID_current_state == 0 ) SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); @@ -204,33 +204,33 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_COPY_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_COPY; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); DrawPanel->m_AutoPAN_Request = FALSE; HandleBlockPlace( &dc ); break; case ID_POPUP_ZOOM_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; case ID_POPUP_DELETE_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; case ID_POPUP_ROTATE_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; case ID_POPUP_INVERT_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_INVERT; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index ec0811762c..11050017ba 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -78,7 +78,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event ) /* Init nom fichier */ - NameLayerCmp = m_CurrentScreen->m_FileName; + NameLayerCmp = GetScreen()->m_FileName; ChangeFileNameExt( NameLayerCmp, wxT( "-cmp.pos" ) ); LayerCmp = wxFopen( NameLayerCmp, wxT( "wt" ) ); @@ -90,7 +90,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event ) if( GenCu ) { - NameLayerCu = m_CurrentScreen->m_FileName; + NameLayerCu = GetScreen()->m_FileName; ChangeFileNameExt( NameLayerCu, wxT( "-copper.pos" ) ); LayerCu = wxFopen( NameLayerCu, wxT( "wt" ) ); if( LayerCu == 0 ) @@ -242,7 +242,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event ) File_Place_Offset = wxPoint( 0, 0 ); /* Init nom fichier */ - FullFileName = m_CurrentScreen->m_FileName; + FullFileName = GetScreen()->m_FileName; ChangeFileNameExt( FullFileName, wxT( ".rpt" ) ); 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 ); fputs( Line, rptfile ); 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] ); fputs( Line, rptfile ); diff --git a/pcbnew/gen_self.h b/pcbnew/gen_self.h index 2b6b0d7c5d..54b1547ab2 100644 --- a/pcbnew/gen_self.h +++ b/pcbnew/gen_self.h @@ -187,7 +187,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC ) Self_On = 0; - Mself.m_End = m_CurrentScreen->m_Curseur; + Mself.m_End = GetScreen()->m_Curseur; /* Agencement des parametres pour simplifier le calcul : */ /* le point de depart doit avoir la coord depart < celle du point de fin */ diff --git a/pcbnew/gendrill.cpp b/pcbnew/gendrill.cpp index e7a4e4821c..f253a33bf8 100644 --- a/pcbnew/gendrill.cpp +++ b/pcbnew/gendrill.cpp @@ -288,7 +288,7 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event ) layer1, layer2, gen_through_holes ? false : true ); if( s_ToolListBuffer.size() > 0 ) //holes? { - FullFileName = m_Parent->m_CurrentScreen->m_FileName; + FullFileName = m_Parent->GetScreen()->m_FileName; layer_extend.Empty(); if( !gen_through_holes ) { @@ -360,7 +360,7 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event ) if( m_Choice_Drill_Report->GetSelection() > 0 ) { - FullFileName = m_Parent->m_CurrentScreen->m_FileName; + FullFileName = m_Parent->GetScreen()->m_FileName; GenDrillReport( FullFileName ); } @@ -748,7 +748,7 @@ void WinEDA_DrillFrame::GenDrillMap( const wxString aFileName, GenDrillMapFile( m_Parent->m_Pcb, dest, FullFileName, - m_Parent->m_CurrentScreen->m_CurrentSheetDesc->m_Size, + m_Parent->GetScreen()->m_CurrentSheetDesc->m_Size, s_HoleListBuffer, s_ToolListBuffer, s_Unit_Drill_is_Inch, @@ -791,7 +791,7 @@ void WinEDA_DrillFrame::GenDrillReport( const wxString aFileName ) return; } GenDrillReportFile( dest, m_Parent->m_Pcb, - m_Parent->m_CurrentScreen->m_FileName, + m_Parent->GetScreen()->m_FileName, s_Unit_Drill_is_Inch, s_HoleListBuffer, s_ToolListBuffer ); diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 5c068ce66f..c4a1c5c46d 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -834,7 +834,7 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append ) if( strnicmp( Line, "$SHEETDESCR", 11 ) == 0 ) { - ReadSheetDescr( m_CurrentScreen, File, &LineNum ); + ReadSheetDescr( GetScreen(), File, &LineNum ); continue; } @@ -1060,7 +1060,7 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile ) DateAndTime( line ) ); WriteGeneralDescrPcb( aFile ); - WriteSheetDescr( m_CurrentScreen, aFile ); + WriteSheetDescr( GetScreen(), aFile ); WriteSetup( aFile, this, m_Pcb ); rc = m_Pcb->Save( aFile ); diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 96490a9fd7..f80d28bdd9 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -49,14 +49,14 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) wxString CmpFullFileName; FILE* dest; MODULE* module = NULL; - bool Footprint_Is_GPCB_Format = false; - wxString mask = wxT("*.*;"); mask += EXT_CMP_MASK; - wxString LastOpenedPathForLoading; + bool Footprint_Is_GPCB_Format = false; + wxString mask = wxT("*.*;"); mask += EXT_CMP_MASK; + wxString LastOpenedPathForLoading; wxConfig* Config = m_Parent->m_EDA_Config; if( Config ) Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &LastOpenedPathForLoading ); - + /* Lecture Fichier module */ CmpFullFileName = EDA_FileSelector( _( "Import Module:" ), LastOpenedPathForLoading, /* Chemin par defaut */ @@ -78,49 +78,49 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) DisplayError( this, msg ); return NULL; } - - if( Config ) // Save file path - { - LastOpenedPathForLoading = wxPathOnly( CmpFullFileName ); + + if( Config ) // Save file path + { + LastOpenedPathForLoading = wxPathOnly( CmpFullFileName ); Config->Write( EXPORT_IMPORT_LASTPATH_KEY, LastOpenedPathForLoading ); - } - + } + /* Read header and test file type */ GetLine( dest, Line, &NbLine ); if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 ) { - if( strnicmp( Line, "Element", 7 ) == 0 ) - Footprint_Is_GPCB_Format = true; - else - { - fclose( dest ); - DisplayError( this, _( "Not a module file" ) ); - return NULL; - } + if( strnicmp( Line, "Element", 7 ) == 0 ) + Footprint_Is_GPCB_Format = true; + else + { + fclose( dest ); + DisplayError( this, _( "Not a module file" ) ); + return NULL; + } } /* Read file: Search the description starting line (skip lib header)*/ - if ( ! Footprint_Is_GPCB_Format ) - { - while( GetLine( dest, Line, &NbLine ) != NULL ) - { - if( strnicmp( Line, "$MODULE", 7 ) == 0 ) - break; - } - } + if ( ! Footprint_Is_GPCB_Format ) + { + while( GetLine( dest, Line, &NbLine ) != NULL ) + { + if( strnicmp( Line, "$MODULE", 7 ) == 0 ) + break; + } + } module = new MODULE( m_Pcb ); - if ( Footprint_Is_GPCB_Format ) - { - fclose( dest ); - module->Read_GPCB_Descr(CmpFullFileName); - } - else - { - module->ReadDescr( dest, &NbLine ); - fclose( dest ); - } + if ( Footprint_Is_GPCB_Format ) + { + fclose( dest ); + module->Read_GPCB_Descr(CmpFullFileName); + } + else + { + module->ReadDescr( dest, &NbLine ); + fclose( dest ); + } /* Insert footprint in list*/ if( m_Pcb->m_Modules ) @@ -173,7 +173,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) if( createlib ) path = g_RealLibDirBuffer; - else if( Config ) + else if( Config ) Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &path ); FullFileName = EDA_FileSelector( createlib ? _( "Create lib" ) : _( "Export Module:" ), @@ -205,11 +205,11 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) return; } - if( ! createlib && Config ) // Save file path - { - path = wxPathOnly( FullFileName ); + if( ! createlib && Config ) // Save file path + { + path = wxPathOnly( FullFileName ); Config->Write( EXPORT_IMPORT_LASTPATH_KEY, path ); - } + } fprintf( dest, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) ); fputs( "$INDEX\n", dest ); @@ -495,7 +495,7 @@ int WinEDA_BasePcbFrame::Save_1_Module( const wxString& LibName, /* * sauve en Librairie le module Module: * si no_replace == TRUE, s'il est nouveau. - * + * * retourne * 1 si OK * 0 si abort ou probleme @@ -743,7 +743,7 @@ MODULE* WinEDA_BasePcbFrame::Create_1_Module( wxDC* DC, const wxString& module_n * 2eme = type VALEUR: "VAL**" */ /* Mise a jour des caract du nouveau module */ - newpos = m_CurrentScreen->m_Curseur; + newpos = GetScreen()->m_Curseur; Module->SetPosition( newpos ); Module->m_LastEdit_Time = time( NULL ); diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 37bbbee69a..281ee9af67 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -77,12 +77,12 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module ) 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 ); if( Module->GetLayer() != CMP_N ) m_Pcb->Change_Side_Module( Module, NULL ); Rotate_Module( NULL, Module, 0, FALSE ); - m_CurrentScreen->ClrModify(); + GetScreen()->ClrModify(); 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 */ { MODULE* module; - wxPoint curspos = m_CurrentScreen->m_Curseur; + wxPoint curspos = GetScreen()->m_Curseur; wxString ModuleName, keys; static wxArrayString HistoryList; 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 ); } - m_CurrentScreen->m_Curseur = curspos; + GetScreen()->m_Curseur = curspos; DrawPanel->MouseToCursorSchema(); if( module ) diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 86188d1b23..b750dc37a4 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -359,7 +359,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ref->m_Type = TEXT_is_REFERENCE; // just in case ... if( ref->m_Text.Length() == 0 ) 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 ) val->m_Text = L"Val**"; } @@ -604,27 +604,27 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_COPY_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_COPY; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); DrawPanel->m_AutoPAN_Request = FALSE; HandleBlockPlace( &dc ); break; case ID_POPUP_ZOOM_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; case ID_POPUP_DELETE_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; case ID_POPUP_ROTATE_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; @@ -632,7 +632,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_MIRROR_Y_BLOCK: case ID_POPUP_INVERT_BLOCK: GetScreen()->BlockLocate.m_Command = BLOCK_INVERT; - m_CurrentScreen->BlockLocate.SetMessageBlock( this ); + GetScreen()->BlockLocate.SetMessageBlock( this ); HandleBlockEnd( &dc ); break; diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index 92d436245c..4528d67daa 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -98,7 +98,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) if( m_ID_current_state == ID_PCB_ARC_BUTT ) shape = S_ARC; - SetCurItem( + SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) ); } else if( (DrawStruct->m_Flags & IS_NEW) ) @@ -140,7 +140,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) SaveCopyInUndoList( m_Pcb->m_Modules ); Place_Ancre( m_Pcb->m_Modules, DC ); m_Pcb->m_Modules->m_Flags = 0; - m_CurrentScreen->m_Curseur = wxPoint( 0, 0 ); + GetScreen()->m_Curseur = wxPoint( 0, 0 ); Recadre_Trace( TRUE ); Place_Module( m_Pcb->m_Modules, DC ); RedrawActiveWindow( DC, TRUE ); @@ -185,7 +185,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, BOARD_ITEM* DrawStruct = GetCurItem(); wxString msg; 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 if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) @@ -367,8 +367,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, _( "Set Width" ), width_segment_xpm ); PopMenu->AppendSeparator(); } - - return true; + + return true; } diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 3c41a5ef2a..30c3460bdf 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -109,7 +109,7 @@ END_EVENT_TABLE() WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, const wxPoint& pos, const wxSize& size, - long style ) : + long style ) : WinEDA_BasePcbFrame( father, parent, MODULE_EDITOR_FRAME, wxEmptyString, pos, size, style ) { m_FrameName = wxT( "ModEditFrame" ); @@ -132,11 +132,12 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* pa if( g_ModuleEditor_Pcb == NULL ) g_ModuleEditor_Pcb = new BOARD( NULL, this ); + m_Pcb = g_ModuleEditor_Pcb; m_Pcb->m_PcbFrame = this; - m_CurrentScreen = ScreenModule; - m_CurrentScreen->SetCurItem( NULL ); + SetBaseScreen( ScreenModule ); + GetScreen()->SetCurItem( NULL ); GetSettings(); wxSize GridSize( 500, 500 ); @@ -169,7 +170,7 @@ WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame() /****************************************************/ { m_Parent->m_ModuleEditFrame = NULL; - m_CurrentScreen = ScreenPcb; + SetBaseScreen( ScreenPcb ); } @@ -307,7 +308,7 @@ void WinEDA_ModuleEditFrame::SetToolbars() int zoom; for( jj = 1, zoom = 1; zoom <= m_ZoomMaxValue; zoom <<= 1, jj++ ) { - if( m_CurrentScreen && (m_CurrentScreen->GetZoom() == zoom) ) + if( GetScreen() && (GetScreen()->GetZoom() == zoom) ) break; new_choice++; } diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 3a0a26453e..f03da6cdeb 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -149,7 +149,7 @@ void Exit_Module( WinEDA_DrawPanel* Panel, wxDC* DC ) MODULE* module; 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; if( module ) @@ -219,7 +219,7 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module ) if( module == NULL ) return NULL; - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); /* Duplication du module */ 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 */ { - MODULE* module = (MODULE*) panel->m_Parent->m_CurrentScreen->GetCurItem(); + MODULE* module = (MODULE*) panel->GetScreen()->GetCurItem(); if( module == NULL ) return; @@ -256,7 +256,7 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) } /* 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 ); 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 * 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 ) return; - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); m_Pcb->m_Status_Pcb &= ~( LISTE_CHEVELU_OK | CONNEXION_OK); if( g_Show_Module_Ratsnest && (m_Pcb->m_Status_Pcb & LISTE_PAD_OK) && DC ) trace_ratsnest_module( DC ); - newpos = m_CurrentScreen->m_Curseur; + newpos = GetScreen()->m_Curseur; module->SetPosition( newpos ); if( DC ) @@ -716,7 +716,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module, if( module == NULL ) return; - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); /* efface ancienne position */ if( !(module->m_Flags & IS_MOVED) ) /* Rotation simple */ diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index b0f609e2cd..89ad91d52d 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -96,7 +96,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( 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 ) { @@ -276,7 +276,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type ) Module->Draw( DrawPanel, DC, GR_OR ); DrawPanel->MouseToCursorSchema(); m_Pcb->m_Status_Pcb = 0; - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); return Module; } @@ -646,7 +646,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( wxDC* DC ) Module->Set_Rectangle_Encadrement(); Module->Draw( DrawPanel, DC, GR_OR ); m_Pcb->m_Status_Pcb = 0; - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); return Module; } diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 247a75d14a..d05b0502fe 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -186,7 +186,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, if( aMessageWindow ) aMessageWindow->AppendText( msg ); - aFrame->m_CurrentScreen->SetModify(); + aFrame->GetScreen()->SetModify(); aFrame->m_Pcb->m_Status_Pcb = 0; State = 0; LineNum = 0; Comment = 0; s_NbNewModules = 0; @@ -1003,7 +1003,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ) MODULEtoLOAD* ref, * cmp; int ii; MODULE* Module = NULL; - wxPoint OldPos = aPcbFrame->m_CurrentScreen->m_Curseur; + wxPoint OldPos = aPcbFrame->GetScreen()->m_Curseur; if( s_NbNewModules == 0 ) return; @@ -1014,14 +1014,14 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ) // Calculate the footprint "best" position: 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; - aPcbFrame->m_CurrentScreen->m_Curseur.y = aPcbFrame->m_Pcb->m_BoundaryBox.GetBottom() + + aPcbFrame->GetScreen()->m_Curseur.y = aPcbFrame->m_Pcb->m_BoundaryBox.GetBottom() + 10000; } 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() ) @@ -1061,7 +1061,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ) } } - aPcbFrame->m_CurrentScreen->m_Curseur = OldPos; + aPcbFrame->GetScreen()->m_Curseur = OldPos; } diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index e64a958b6b..b6156365f9 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -72,14 +72,14 @@ static wxMenu* Append_Track_Width_List() trackwidth_menu = new wxMenu; - trackwidth_menu->Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, - _( "Auto Width" ), - _( - "Use the track width when starting on a track, otherwise the current track width" ), - TRUE ); + trackwidth_menu->Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, + _( "Auto Width" ), + _( + "Use the track width when starting on a track, otherwise the current track width" ), + TRUE ); - if( g_DesignSettings.m_UseConnectedTrackWidth ) - trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, TRUE ); + if( g_DesignSettings.m_UseConnectedTrackWidth ) + trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, TRUE ); for( ii = 0; (ii < HISTORY_NUMBER) && (ii < TRACK_HISTORY_NUMBER_MAX); ii++ ) { @@ -94,8 +94,8 @@ static wxMenu* Append_Track_Width_List() msg.Printf( _( "Track %.3f" ), value ); 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 ) 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; int flags = 0; bool locate_track = FALSE; - bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); + bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE); 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, _( "Close Zone Outline" ), apply_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER, - _( "Delete Last Corner" ), delete_xpm ); + ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER, + _( "Delete Last Corner" ), delete_xpm ); } - else + else createPopUpMenuForZones( (ZONE_CONTAINER*) item, aPopMenu ); break; case TYPETEXTE: - createPopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu ); + createPopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu ); break; case TYPETRACK: @@ -520,13 +520,13 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) ID_POPUP_PCB_VIA_EDITING, _( "Edit Via" ), edit_xpm ); ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT, _( "Set via hole to Default" ), apply_xpm ); - 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 = _( "Set via hole to a specific value. This specfic value is currently" ); + msg << wxT(" ") << ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_ViaDrillCustomValue, m_InternalUnits ); ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_VALUE, - _( "Set via hole to alt value" ), msg, - options_new_pad_xpm ); - msg = _( "Set alt via hole value. This value is currently" ); - msg << wxT(" ") << ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_ViaDrillCustomValue, m_InternalUnits ); + _( "Set via hole to alt value" ), msg, + options_new_pad_xpm ); + msg = _( "Set alt via hole value. This value is currently" ); + msg << wxT(" ") << ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_ViaDrillCustomValue, m_InternalUnits ); ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE, _( "Set the via hole alt value" ), msg, edit_xpm ); ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_EXPORT, _( @@ -594,12 +594,12 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) wxMenu* track_mnu; if( !flags ) // track Width control : { - track_mnu = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu, - ID_POPUP_PCB_EDIT_TRACK_MNU, _( "Change Width" ), width_track_xpm ); - ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG, + track_mnu = new wxMenu; + ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu, + ID_POPUP_PCB_EDIT_TRACK_MNU, _( "Change Width" ), width_track_xpm ); + ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG, Track->Type()==TYPEVIA ? _( "Edit Via" ) : _( "Edit Segment" ), width_segment_xpm ); - + ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACK, _( "Edit Track" ), width_track_xpm ); ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_NET, diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 4b41eca1f7..b537da2f17 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -215,7 +215,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, SetIcon( wxICON( a_icon_pcbnew ) ); m_InternalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch - m_CurrentScreen = ScreenPcb; + SetBaseScreen( ScreenPcb ); GetSettings(); 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; } 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 ); @@ -249,9 +249,12 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, WinEDA_PcbFrame::~WinEDA_PcbFrame() { m_Parent->m_PcbFrame = NULL; - m_CurrentScreen = ScreenPcb; + SetBaseScreen( ScreenPcb ); + 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, * pour les evenements de refresh generes par wxWindows */ - m_CurrentScreen = ActiveScreen = ScreenPcb; + SetBaseScreen( ActiveScreen = ScreenPcb ); SaveSettings(); 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_Y" ), (long) GridSize.y ); 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(); } @@ -342,9 +345,9 @@ void WinEDA_PcbFrame::SetToolbars() if( m_HToolBar == NULL ) 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_COPY, TRUE ); @@ -525,7 +528,7 @@ void WinEDA_PcbFrame::SetToolbars() for( jj = 1, zoom = 1; zoom <= m_ZoomMaxValue; zoom <<= 1, jj++ ) { - if( m_CurrentScreen && (m_CurrentScreen->GetZoom() == zoom) ) + if( GetScreen() && (GetScreen()->GetZoom() == zoom) ) break; new_choice++; } @@ -534,15 +537,15 @@ void WinEDA_PcbFrame::SetToolbars() m_SelZoomBox->SetSelection( new_choice ); } - if( m_SelGridBox && m_CurrentScreen ) + if( m_SelGridBox && GetScreen() ) { int kk = m_SelGridBox->GetChoice(); for( ii = 0; g_GridList[ii].x > 0; ii++ ) { - if( !m_CurrentScreen->m_UserGridIsON - && (m_CurrentScreen->GetGrid().x == g_GridList[ii].x) - && (m_CurrentScreen->GetGrid().y == g_GridList[ii].y) ) + if( !GetScreen()->m_UserGridIsON + && (GetScreen()->GetGrid().x == g_GridList[ii].x) + && (GetScreen()->GetGrid().y == g_GridList[ii].y) ) { if( kk != ii ) m_SelGridBox->SetSelection( ii ); diff --git a/pcbnew/pcbtexte.cpp b/pcbnew/pcbtexte.cpp index a8ecec44c0..1a19078b55 100644 --- a/pcbnew/pcbtexte.cpp +++ b/pcbnew/pcbtexte.cpp @@ -240,7 +240,7 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event ) /* Redessin du Texte */ CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); } - m_Parent->m_CurrentScreen->SetModify(); + m_Parent->GetScreen()->SetModify(); EndModal( 1 ); } @@ -288,7 +288,7 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) DrawPanel->ManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL; SetCurItem( NULL ); - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); 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 */ { - TEXTE_PCB* TextePcb = (TEXTE_PCB*) - panel->m_Parent->m_CurrentScreen->GetCurItem(); + TEXTE_PCB* TextePcb = (TEXTE_PCB*) panel->GetScreen()->GetCurItem(); if( TextePcb == NULL ) return; @@ -329,7 +328,7 @@ static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) if( erase ) 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 */ 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_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; 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->Display_Infos( this ); - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); } diff --git a/pcbnew/plothpgl.cpp b/pcbnew/plothpgl.cpp index 0d8268322e..3b5619cffe 100644 --- a/pcbnew/plothpgl.cpp +++ b/pcbnew/plothpgl.cpp @@ -39,8 +39,8 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer ) scale_y = Scale_Y * SCALE_HPGL; // 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.y = m_CurrentScreen->m_CurrentSheetDesc->m_Size.y * U_PCB; + SheetSize.x = GetScreen()->m_CurrentSheetDesc->m_Size.x * U_PCB; + SheetSize.y = GetScreen()->m_CurrentSheetDesc->m_Size.y * U_PCB; g_PlotOffset.x = 0; 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; InitPlotParametresHPGL( g_PlotOffset, scale_x, scale_y, g_PlotOrient ); - PlotWorkSheet( PLOT_FORMAT_HPGL, m_CurrentScreen ); + PlotWorkSheet( PLOT_FORMAT_HPGL, GetScreen() ); 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 ); - // Specify that the contents of the "Edges Pcb" layer are to be plotted - // in addition to the contents of the currently specified layer. - int layer_mask = g_TabOneLayerMask[Layer] | EDGE_LAYER; + // Specify that the contents of the "Edges Pcb" layer are to be plotted + // in addition to the contents of the currently specified layer. + int layer_mask = g_TabOneLayerMask[Layer] | EDGE_LAYER; switch( Layer ) { @@ -660,7 +660,7 @@ void trace_1_pad_TRAPEZE_HPGL( wxPoint padpos, wxSize size, wxSize delta, * le mode de trace (FILLED, SKETCH, FILAIRE) * Le trace n'est fait que pour un trapeze, c.a.d que deltaX ou deltaY * = 0. - * + * * les notation des sommets sont ( vis a vis de la table tracante ) * 0 ------------- 3 * . . @@ -851,7 +851,7 @@ void trace_1_segment_HPGL( int pos_X0, int pos_Y0, int pos_X1, int pos_Y1, * de trace par 2 rotations inverses * coord : xrot = x*cos + y*sin * yrot = y*cos - x*sin - * + * * avec ici yrot = 0 puisque le segment est horizontal dans le nouveau repere * Transformee inverse : * coord : x = xrot*cos - yrot*sin diff --git a/pcbnew/plotps.cpp b/pcbnew/plotps.cpp index 6539a48832..f957b372e1 100644 --- a/pcbnew/plotps.cpp +++ b/pcbnew/plotps.cpp @@ -38,7 +38,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer, bo wxSize BoardSize; wxPoint BoardCenter; 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_x, scale_y; int PlotMarge_in_mils = 0; @@ -105,7 +105,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer, bo int tmp = g_PlotOrient; g_PlotOrient = 0; SetPlotScale( 1.0, 1.0 ); - PlotWorkSheet( PLOT_FORMAT_POST, m_CurrentScreen ); + PlotWorkSheet( PLOT_FORMAT_POST, GetScreen() ); g_PlotOrient = tmp; } diff --git a/pcbnew/router.cpp b/pcbnew/router.cpp index 4f26a68e91..22ebacc505 100644 --- a/pcbnew/router.cpp +++ b/pcbnew/router.cpp @@ -52,7 +52,7 @@ void WinEDA_PcbFrame::GlobalRoute( wxDC* DC ) } /* Calcule du nom du fichier intermediaire de communication */ - FullFileName = m_CurrentScreen->m_FileName; + FullFileName = GetScreen()->m_FileName; ChangeFileNameExt( FullFileName, wxT( ".ipt" ) ); 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; /* Calcule du nom du fichier intermediaire de communication */ - FullFileName = m_CurrentScreen->m_FileName; + FullFileName = GetScreen()->m_FileName; ChangeFileNameExt( FullFileName, wxT( ".trc" ) ); if( ( File = wxFopen( FullFileName, wxT( "rt" ) ) ) == NULL ) @@ -607,7 +607,7 @@ void WinEDA_PcbFrame::ReadAutoroutedTracks( wxDC* DC ) NewVia->m_Shape = VIA_THROUGH; else NewVia->m_Shape = VIA_BLIND_BURIED; - + NewVia->Insert( m_Pcb, NULL ); NbTrack++; break; @@ -661,10 +661,10 @@ void WinEDA_PcbFrame::ReadAutoroutedTracks( wxDC* DC ) else { m_Pcb->m_Status_Pcb = 0; - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); } Compile_Ratsnest( DC, TRUE ); if( NbTrack ) - m_CurrentScreen->SetRefreshReq(); + GetScreen()->SetRefreshReq(); } diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 2993ef40fe..e61632a6d6 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -274,7 +274,7 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent m_Parent = parent; 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�s */ int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1]; Masque_Layer += ALL_NO_CU_LAYERS; @@ -361,7 +361,7 @@ void WinEDA_SelLayerPairFrame::OnOkClick( wxCommandEvent& event ) 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_BOTTOM = m_LayerId[m_LayerListBOTTOM->GetSelection()]; diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp index cc75facf31..81dfaead29 100644 --- a/pcbnew/swap_layers.cpp +++ b/pcbnew/swap_layers.cpp @@ -335,7 +335,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event ) pt_segm = (TRACK*) m_Pcb->m_Track; for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext ) { - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); if( pt_segm->Type() == TYPEVIA ) { SEGVIA* Via = (SEGVIA*) pt_segm; @@ -361,7 +361,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event ) pt_segm = (TRACK*) m_Pcb->m_Zone; for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext ) { - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); jj = pt_segm->GetLayer(); if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE ) pt_segm->SetLayer( New_Layer[jj] ); @@ -373,7 +373,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event ) { if( PtStruct->Type() == TYPEDRAWSEGMENT ) { - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); pt_drawsegm = (DRAWSEGMENT*) PtStruct; jj = pt_drawsegm->GetLayer(); if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE ) diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index 9e3f933fef..7aee53e262 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -186,6 +186,6 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode ) DrawGeneralRatsnest( DC ); - m_CurrentScreen->ClrRefreshReq(); + GetScreen()->ClrRefreshReq(); } diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index 759866e79c..66c730138e 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -211,7 +211,7 @@ int WinEDA_ExchangeModuleFrame::Maj_ListeCmp( return 0; /* pas de changement de nom */ /* 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 ); // Modification du fichier .cmp correcpondant @@ -527,10 +527,10 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff, NewModule->m_Parent = m_Pcb; m_Pcb->m_Status_Pcb = 0; - oldpos = m_CurrentScreen->m_Curseur; - m_CurrentScreen->m_Curseur = OldModule->m_Pos; + oldpos = GetScreen()->m_Curseur; + GetScreen()->m_Curseur = OldModule->m_Pos; Place_Module( NewModule, NULL ); - m_CurrentScreen->m_Curseur = oldpos; + GetScreen()->m_Curseur = oldpos; /* Changement eventuel de couche */ if( OldModule->GetLayer() != NewModule->GetLayer() ) @@ -575,7 +575,7 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff, m_Pcb->m_Status_Pcb = 0; NewModule->m_Flags = 0; - m_CurrentScreen->SetModify(); + GetScreen()->SetModify(); return NewModule; } @@ -614,7 +614,7 @@ bool WinEDA_PcbFrame::RecreateCmpFileFromBoard() } /* Calcul nom fichier CMP par changement de l'extension du nom netliste */ - FullFileNameCmp = m_CurrentScreen->m_FileName; + FullFileNameCmp = GetScreen()->m_FileName; ChangeFileNameExt( FullFileNameCmp, NetCmpExtBuffer ); mask = wxT( "*" ) + NetCmpExtBuffer; diff --git a/share/drawframe.cpp b/share/drawframe.cpp index 33b2213a10..b0c857c7b3 100644 --- a/share/drawframe.cpp +++ b/share/drawframe.cpp @@ -84,13 +84,13 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, SetSize( 0, 0, minsize.x, minsize.y ); // Creation de la ligne de status - #define ZOOM_DISPLAY_SIZE 60 - #define COORD_DISPLAY_SIZE 140 - #define UNITS_DISPLAY_SIZE 50 - #define FUNCTION_DISPLAY_SIZE 100 + #define ZOOM_DISPLAY_SIZE 60 + #define COORD_DISPLAY_SIZE 140 + #define UNITS_DISPLAY_SIZE 50 + #define FUNCTION_DISPLAY_SIZE 100 static const int dims[6] = { -1, ZOOM_DISPLAY_SIZE, - COORD_DISPLAY_SIZE, COORD_DISPLAY_SIZE, - UNITS_DISPLAY_SIZE, FUNCTION_DISPLAY_SIZE }; + COORD_DISPLAY_SIZE, COORD_DISPLAY_SIZE, + UNITS_DISPLAY_SIZE, FUNCTION_DISPLAY_SIZE }; CreateStatusBar( 6 ); SetStatusWidths( 6, dims ); @@ -137,10 +137,10 @@ void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu ) fonts_xpm ); ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_STATUS, _( "font for Status Line" ), fonts_xpm ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu, fontmenu, - ID_PREFERENCES_FONT, _("&Font selection"), - _("Choose font type and size for dialogs, infos and status box"), - fonts_xpm ); + ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu, fontmenu, + ID_PREFERENCES_FONT, _("&Font selection"), + _("Choose font type and size for dialogs, infos and status box"), + fonts_xpm ); } @@ -247,7 +247,7 @@ void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey, /**************************************************************/ -void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event ) +void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event ) /**************************************************************/ // Virtual function { @@ -266,35 +266,17 @@ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event ) if( id < 0 ) return; - GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); - wxSize grid = GetScreen()->GetGrid(); - GetScreen()->SetGrid( g_GridList[id] ); - wxSize newgrid = GetScreen()->GetGrid(); + BASE_SCREEN* screen = GetBaseScreen(); + + screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); + wxSize grid = screen->GetGrid(); + screen->SetGrid( g_GridList[id] ); + wxSize newgrid = screen->GetGrid(); if( newgrid.x != grid.x || newgrid.y != grid.y ) 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 /********************************************************/ @@ -326,10 +308,10 @@ void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtue int zoom = 1 << id; if( zoom > m_ZoomMaxValue ) zoom = m_ZoomMaxValue; - if( GetScreen()->GetZoom() == zoom ) + if( GetBaseScreen()->GetZoom() == zoom ) return; - GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); - GetScreen()->SetZoom( zoom ); + GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); + GetBaseScreen()->SetZoom( zoom ); Recadre_Trace( FALSE ); } } @@ -339,7 +321,7 @@ int WinEDA_DrawFrame::GetZoom(void) /***********************************/ /* Return the current zoom level */ { - return GetScreen()->GetZoom(); + return GetBaseScreen()->GetZoom(); } @@ -507,7 +489,7 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, */ { bool redraw = false; - + // Change Cursor if( DrawPanel ) { @@ -529,13 +511,13 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, redraw = true; } #endif - + // Old Tool Inactif ou ID_NO_SELECT_BUTT actif si pas de nouveau Tool if( m_ID_current_state ) { if( m_VToolBar ) m_VToolBar->ToggleTool( m_ID_current_state, FALSE ); - + if( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE ); } @@ -545,7 +527,7 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, { if( m_VToolBar ) m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, FALSE ); - + if( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE ); } @@ -558,7 +540,7 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, { if( m_VToolBar ) m_VToolBar->ToggleTool( id, TRUE ); - + if( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool( id, TRUE ); } @@ -569,7 +551,7 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, // must do this after the tool has been set, otherwise pad::Draw() does // not show proper color when DisplayOpt.ContrastModeDisplay is true. - if( redraw ) + if( redraw ) ReDrawPanel(); } @@ -584,15 +566,16 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type ) * replac� au centre de l'ecran */ { - if( DrawPanel == NULL ) - return; + if( DrawPanel == NULL ) + return; + BASE_SCREEN* screen = GetBaseScreen(); bool move_mouse_cursor = FALSE; int x, y; wxPoint old_pos; DrawPanel->GetViewStart( &x, &y ); - old_pos = GetScreen()->m_Curseur; + old_pos = GetBaseScreen()->m_Curseur; switch( zoom_type ) { @@ -603,10 +586,10 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type ) case ID_ZOOM_IN_BUTT: if( zoom_type == ID_ZOOM_IN_BUTT ) - GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); + GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); + + screen->SetPreviousZoom(); - GetScreen()->SetPreviousZoom(); - Recadre_Trace( move_mouse_cursor ); break; @@ -617,8 +600,8 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type ) case ID_ZOOM_OUT_BUTT: if( zoom_type == ID_ZOOM_OUT_BUTT ) - GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); - GetScreen()->SetNextZoom(); + screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); + screen->SetNextZoom(); Recadre_Trace( move_mouse_cursor ); break; @@ -736,7 +719,7 @@ int WinEDA_DrawFrame::ReturnBlockCommand( int key ) void WinEDA_DrawFrame::InitBlockPasteInfos() { - GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; + GetBaseScreen()->BlockLocate.m_BlockDrawStruct = NULL; DrawPanel->ManageCurseur = NULL; } @@ -759,15 +742,18 @@ void WinEDA_DrawFrame::AdjustScrollBars() wxSize draw_size, panel_size; wxSize scrollbar_number; wxPoint scrollbar_pos; - int zoom = GetScreen()->GetZoom(); + + BASE_SCREEN* screen = GetBaseScreen(); + + int zoom = screen->GetZoom(); int xUnit, yUnit; - if( GetScreen() == NULL ) + if( screen == NULL ) return; if( DrawPanel == NULL ) return; - draw_size = GetScreen()->ReturnPageSize(); + draw_size = screen->ReturnPageSize(); // La zone d'affichage est reglee a une taille double de la feuille de travail: draw_size.x *= 2; draw_size.y *= 2; @@ -780,20 +766,20 @@ void WinEDA_DrawFrame::AdjustScrollBars() draw_size.y += panel_size.y / 2; - if( GetScreen()->m_Center ) + if( screen->m_Center ) { - GetScreen()->m_DrawOrg.x = -draw_size.x / 2; - GetScreen()->m_DrawOrg.y = -draw_size.y / 2; + screen->m_DrawOrg.x = -draw_size.x / 2; + screen->m_DrawOrg.y = -draw_size.y / 2; } else { - GetScreen()->m_DrawOrg.x = -panel_size.x / 2; - GetScreen()->m_DrawOrg.y = -panel_size.y / 2; + screen->m_DrawOrg.x = -panel_size.x / 2; + screen->m_DrawOrg.y = -panel_size.y / 2; } // DrawOrg est rendu multiple du zoom min : - GetScreen()->m_DrawOrg.x -= GetScreen()->m_DrawOrg.x % 256; - GetScreen()->m_DrawOrg.y -= GetScreen()->m_DrawOrg.y % 256; + screen->m_DrawOrg.x -= screen->m_DrawOrg.x % 256; + screen->m_DrawOrg.y -= screen->m_DrawOrg.y % 256; // Calcul du nombre de scrolls (en unites de scrool ) scrollbar_number.x = draw_size.x / (DrawPanel->m_Scroll_unit * zoom); @@ -808,10 +794,10 @@ void WinEDA_DrawFrame::AdjustScrollBars() xUnit *= zoom; yUnit *= zoom; // 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.y -= GetScreen()->m_DrawOrg.y; + scrollbar_pos.x -= screen->m_DrawOrg.x; + scrollbar_pos.y -= screen->m_DrawOrg.y; scrollbar_pos.x -= panel_size.x / 2; scrollbar_pos.y -= panel_size.y / 2; @@ -823,15 +809,15 @@ void WinEDA_DrawFrame::AdjustScrollBars() scrollbar_pos.x /= xUnit; scrollbar_pos.y /= yUnit; - GetScreen()->m_ScrollbarPos = scrollbar_pos; - GetScreen()->m_ScrollbarNumber = scrollbar_number; + screen->m_ScrollbarPos = scrollbar_pos; + screen->m_ScrollbarNumber = scrollbar_number; DrawPanel->SetScrollbars( DrawPanel->m_Scroll_unit, DrawPanel->m_Scroll_unit, - GetScreen()->m_ScrollbarNumber.x, - GetScreen()->m_ScrollbarNumber.y, - GetScreen()->m_ScrollbarPos.x, - GetScreen()->m_ScrollbarPos.y, TRUE ); + screen->m_ScrollbarNumber.x, + screen->m_ScrollbarNumber.y, + screen->m_ScrollbarPos.x, + screen->m_ScrollbarPos.y, TRUE ); } @@ -883,26 +869,27 @@ void WinEDA_DrawFrame::Affiche_Status_Box() /* Routine d'affichage du zoom et des coord curseur. */ { - wxString Line; - int dx, dy; + wxString Line; + int dx, dy; + BASE_SCREEN* screen = GetBaseScreen(); - if( GetScreen() == NULL ) + if( !screen ) return; /* affichage Zoom et coordonnees absolues */ - Line.Printf( wxT( "Z %d" ), GetScreen()->GetZoom() ); + Line.Printf( wxT( "Z %d" ), screen->GetZoom() ); SetStatusText( Line, 1 ); 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 ), - To_User_Unit( g_UnitMetric, GetScreen()->m_Curseur.y, + To_User_Unit( g_UnitMetric, screen->m_Curseur.y, m_InternalUnits ) ); SetStatusText( Line, 2 ); /* affichage des coordonnees relatives */ - dx = GetScreen()->m_Curseur.x - GetScreen()->m_O_Curseur.x; - dy = GetScreen()->m_Curseur.y - GetScreen()->m_O_Curseur.y; + dx = screen->m_Curseur.x - screen->m_O_Curseur.x; + dy = screen->m_Curseur.y - screen->m_O_Curseur.y; Line.Printf( g_UnitMetric ? wxT( "x %.3f y %.3f" ) : wxT( "x %.4f y %.4f" ), To_User_Unit( g_UnitMetric, dx, m_InternalUnits ), diff --git a/share/drawpanel.cpp b/share/drawpanel.cpp index 1d386c0721..59f45ee31b 100644 --- a/share/drawpanel.cpp +++ b/share/drawpanel.cpp @@ -13,11 +13,19 @@ #include "macros.h" #include "id.h" +#ifdef PCBNEW +#include "pcbstruct.h" +#endif + +#ifdef EESCHEMA +#include "program.h" +#endif + // Local defines #define CURSOR_SIZE 12 // Cursor size in pixels // 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_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent ) EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent ) @@ -38,16 +46,18 @@ END_EVENT_TABLE() WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size ) : - EDA_DRAW_PANEL( parent, id, pos, size, + wxScrolledWindow( parent, id, pos, size, wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE ) { m_Parent = parent; m_Ident = m_Parent->m_Ident; m_Scroll_unit = 1; m_ScrollButt_unit = 40; + SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red, ColorRefs[g_DrawBgColor].m_Green, ColorRefs[g_DrawBgColor].m_Blue ) ); + EnableScrolling( TRUE, TRUE ); m_ClipBox.SetSize( size ); 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 ) m_AutoPAN_Enable = m_Parent->m_Parent->m_EDA_Config->Read( wxT( "AutoPAN" ), TRUE ); + m_AutoPAN_Request = FALSE; m_Block_Enable = FALSE; 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 ) /*********************************************************************************/ diff --git a/share/setpage.cpp b/share/setpage.cpp index a1f3d769a4..1412a2ad53 100644 --- a/share/setpage.cpp +++ b/share/setpage.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// // Name: setpage.cpp -// Purpose: +// Purpose: // Author: jean-pierre Charras -// Modified by: +// Modified by: // Created: 13/11/2007 09:11:27 -// RCS-ID: +// RCS-ID: // Copyright: License GNU -// Licence: +// Licence: ///////////////////////////////////////////////////////////////////////////// /* The "Page Settings" dialog box created by this file (and setpage.h) @@ -116,12 +116,13 @@ WinEDA_SetPageFrame::WinEDA_SetPageFrame( WinEDA_DrawFrame* parent, wxWindowID i wxString msg; m_ParentDrawFrame = parent; - m_Screen = m_ParentDrawFrame->GetScreen(); + m_Screen = m_ParentDrawFrame->GetBaseScreen(); m_Modified = FALSE; m_SelectedSheet = NULL; m_CurrentSelection = 0; SearchPageSizeSelection(); - Create(parent, id, caption, pos, size, style); + + Create( parent, id, caption, pos, size, style); // Init display value for sheet User size wxString format = m_TextSheetCount->GetLabel(); msg.Printf(format, m_Screen->m_NumberOfScreen); @@ -129,6 +130,7 @@ WinEDA_SetPageFrame::WinEDA_SetPageFrame( WinEDA_DrawFrame* parent, wxWindowID i format = m_TextSheetNumber->GetLabel(); msg.Printf(format, m_Screen->m_ScreenNumber); m_TextSheetNumber->SetLabel(msg); + if( g_UnitMetric ) { 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++ ) { sheet = SheetList[ii]; - if( m_ParentDrawFrame->GetScreen()->m_CurrentSheetDesc == sheet ) + if( m_ParentDrawFrame->GetBaseScreen()->m_CurrentSheetDesc == sheet ) m_CurrentSelection = ii; } } diff --git a/share/svg_print.cpp b/share/svg_print.cpp index d68da04fb6..88b4852764 100644 --- a/share/svg_print.cpp +++ b/share/svg_print.cpp @@ -350,7 +350,7 @@ wxString WinEDA_PrintSVGFrame::ReturnFullFileName() { wxString name, ext; - name = m_Parent->GetScreen()->m_FileName; + name = m_Parent->GetBaseScreen()->m_FileName; ChangeFileNameExt( name, wxT( ".svg" ) ); return name; } @@ -396,7 +396,7 @@ void WinEDA_PrintSVGFrame::PrintSVGDoc( wxCommandEvent& event ) SetPenWidth(); - BASE_SCREEN* screen = m_Parent->GetScreen(); + BASE_SCREEN* screen = m_Parent->GetBaseScreen(); BASE_SCREEN* oldscreen = screen; #ifndef EESCHEMA if( Select_PrintAll ) diff --git a/share/wxprint.cpp b/share/wxprint.cpp index 52ceeb863f..199c58090c 100644 --- a/share/wxprint.cpp +++ b/share/wxprint.cpp @@ -305,7 +305,7 @@ wxString WinEDA_PrintFrame::BuildPrintTitle() { wxString name, ext; - wxFileName::SplitPath( m_Parent->GetScreen()->m_FileName, + wxFileName::SplitPath( m_Parent->GetBaseScreen()->m_FileName, (wxString*) NULL, &name, &ext ); name += wxT( "-" ) + ext; return name; @@ -486,7 +486,7 @@ bool EDA_Printout::OnPrintPage( int page ) #ifdef EESCHEMA - BASE_SCREEN* screen = m_Parent->GetScreen(); + BASE_SCREEN* screen = m_Parent->GetBaseScreen(); BASE_SCREEN* oldscreen = screen; if( s_OptionPrintPage == 1 ) diff --git a/share/zoom.cpp b/share/zoom.cpp index 4d29a1ed5e..498df3db4b 100644 --- a/share/zoom.cpp +++ b/share/zoom.cpp @@ -42,16 +42,16 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse ) * in order to have the current graphic cursor position at the screen center * @param ToMouse if TRUE, the mouse cursor is moved * to the graphic cursor position (which is usually on grid) - * + * * Note: Mac OS ** does not ** allow moving mouse cursor by program. */ { - PutOnGrid( &(GetScreen()->m_Curseur) ); - + PutOnGrid( &(GetBaseScreen()->m_Curseur) ); + AdjustScrollBars(); ReDrawPanel(); - + /* Move the mouse cursor to the on grid graphic cursor position */ if( ToMouse == TRUE ) { @@ -69,10 +69,10 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) { 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; coord->x = ( (int) round( ftmp ) ) * grid_size.x; @@ -81,18 +81,18 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) } else { - double pasx = GetScreen()->m_UserGrid.x * m_InternalUnits; - double pasy = GetScreen()->m_UserGrid.y * m_InternalUnits; - - if( GetScreen()->m_UserGridUnit != INCHES ) + double pasx = GetBaseScreen()->m_UserGrid.x * m_InternalUnits; + double pasy = GetBaseScreen()->m_UserGrid.y * m_InternalUnits; + + if( GetBaseScreen()->m_UserGridUnit != INCHES ) { - pasx /= 25.4; + pasx /= 25.4; pasy /= 25.4; } - + int nn = (int) round( coord->x / pasx ); coord->x = (int) round( pasx * nn ); - + nn = (int) round( coord->y / pasy ); coord->y = (int) round( pasy * nn ); } @@ -109,7 +109,7 @@ void WinEDA_DrawFrame::Zoom_Automatique( bool move_mouse_cursor ) int bestzoom; bestzoom = BestZoom(); - GetScreen()->SetZoom( bestzoom ); + GetBaseScreen()->SetZoom( bestzoom ); Recadre_Trace( move_mouse_cursor ); } @@ -137,9 +137,9 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect ) if( bestzoom <= 0 ) bestzoom = 1; - GetScreen()->SetZoom( bestzoom ); + GetBaseScreen()->SetZoom( bestzoom ); - GetScreen()->m_Curseur = Rect.Centre(); + GetBaseScreen()->m_Curseur = Rect.Centre(); Recadre_Trace( TRUE ); } @@ -171,127 +171,127 @@ void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent& event ) break; case ID_POPUP_ZOOM_LEVEL_1: - m_Parent->GetScreen()->SetZoom( 1 ); + GetScreen()->SetZoom( 1 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_ZOOM_LEVEL_2: - m_Parent->GetScreen()->SetZoom( 2 ); + GetScreen()->SetZoom( 2 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_ZOOM_LEVEL_4: - m_Parent->GetScreen()->SetZoom( 4 ); + GetScreen()->SetZoom( 4 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_ZOOM_LEVEL_8: - m_Parent->GetScreen()->SetZoom( 8 ); + GetScreen()->SetZoom( 8 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_ZOOM_LEVEL_16: - m_Parent->GetScreen()->SetZoom( 16 ); + GetScreen()->SetZoom( 16 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_ZOOM_LEVEL_32: - m_Parent->GetScreen()->SetZoom( 32 ); + GetScreen()->SetZoom( 32 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_ZOOM_LEVEL_64: - m_Parent->GetScreen()->SetZoom( 64 ); + GetScreen()->SetZoom( 64 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_ZOOM_LEVEL_128: - m_Parent->GetScreen()->SetZoom( 128 ); + GetScreen()->SetZoom( 128 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_ZOOM_LEVEL_256: - m_Parent->GetScreen()->SetZoom( 256 ); + GetScreen()->SetZoom( 256 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_ZOOM_LEVEL_512: - m_Parent->GetScreen()->SetZoom( 512 ); + GetScreen()->SetZoom( 512 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_ZOOM_LEVEL_1024: - m_Parent->GetScreen()->SetZoom( 1024 ); + GetScreen()->SetZoom( 1024 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_ZOOM_LEVEL_2048: - m_Parent->GetScreen()->SetZoom( 2048 ); + GetScreen()->SetZoom( 2048 ); m_Parent->Recadre_Trace( TRUE ); break; case ID_POPUP_GRID_LEVEL_1: - m_Parent->GetScreen()->SetGrid( wxSize( 1, 1 ) ); + GetScreen()->SetGrid( wxSize( 1, 1 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_LEVEL_2: - m_Parent->GetScreen()->SetGrid( wxSize( 2, 2 ) ); + GetScreen()->SetGrid( wxSize( 2, 2 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_LEVEL_5: - m_Parent->GetScreen()->SetGrid( wxSize( 5, 5 ) ); + GetScreen()->SetGrid( wxSize( 5, 5 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_LEVEL_10: - m_Parent->GetScreen()->SetGrid( wxSize( 10, 10 ) ); + GetScreen()->SetGrid( wxSize( 10, 10 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_LEVEL_20: - m_Parent->GetScreen()->SetGrid( wxSize( 20, 20 ) ); + GetScreen()->SetGrid( wxSize( 20, 20 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_LEVEL_25: - m_Parent->GetScreen()->SetGrid( wxSize( 25, 25 ) ); + GetScreen()->SetGrid( wxSize( 25, 25 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_LEVEL_50: - m_Parent->GetScreen()->SetGrid( wxSize( 50, 50 ) ); + GetScreen()->SetGrid( wxSize( 50, 50 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_LEVEL_100: - m_Parent->GetScreen()->SetGrid( wxSize( 100, 100 ) ); + GetScreen()->SetGrid( wxSize( 100, 100 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_LEVEL_200: - m_Parent->GetScreen()->SetGrid( wxSize( 200, 200 ) ); + GetScreen()->SetGrid( wxSize( 200, 200 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_LEVEL_250: - m_Parent->GetScreen()->SetGrid( wxSize( 250, 250 ) ); + GetScreen()->SetGrid( wxSize( 250, 250 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_LEVEL_500: - m_Parent->GetScreen()->SetGrid( wxSize( 500, 500 ) ); + GetScreen()->SetGrid( wxSize( 500, 500 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_LEVEL_1000: - m_Parent->GetScreen()->SetGrid( wxSize( 1000, 1000 ) ); + GetScreen()->SetGrid( wxSize( 1000, 1000 ) ); m_Parent->ReDrawPanel(); break; case ID_POPUP_GRID_USER: - m_Parent->GetScreen()->SetGrid( wxSize( -1, -1 ) ); + GetScreen()->SetGrid( wxSize( -1, -1 ) ); m_Parent->ReDrawPanel(); break; @@ -369,7 +369,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_REDRAW, _( "Redraw" ), repaint_xpm ); /* Create the basic zoom list: */ - zoom = m_Parent->GetScreen()->GetZoom(); + zoom = GetScreen()->GetZoom(); zoom_value = 1; 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, 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 ) { case MODULE_EDITOR_FRAME: @@ -395,21 +395,21 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) case CVPCB_DISPLAY_FRAME: for( ii = 0; ; ii++ ) { - if ( 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); - if ( g_UnitMetric == 0) // inches - line.Printf(wxT("%g mils"), grid_value*1000); - else - line.Printf(wxT("%g mm"), grid_value); - } - else line = _("grid user"); + if ( 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); + if ( g_UnitMetric == 0) // inches + line.Printf(wxT("%g mils"), grid_value*1000); + else + line.Printf(wxT("%g mm"), grid_value); + } + else line = _("grid user"); msg = grid_msg + line; grid_choice->Append( grid_list_pcb[ii].m_Id, msg, wxEmptyString, TRUE ); 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 ); break; } @@ -425,12 +425,12 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) { if( grid_list_schematic[ii].m_Value <= 0 ) break; - double grid_value = To_User_Unit(g_UnitMetric, grid_list_schematic[ii].m_Value, - ((WinEDA_DrawFrame*)m_Parent)->m_InternalUnits); - if ( g_UnitMetric == 0) // inches - line.Printf(wxT("%g mils"), grid_value*1000); - else - line.Printf(wxT("%g mm"), grid_value); + double grid_value = To_User_Unit(g_UnitMetric, grid_list_schematic[ii].m_Value, + ((WinEDA_DrawFrame*)m_Parent)->m_InternalUnits); + if ( g_UnitMetric == 0) // inches + line.Printf(wxT("%g mils"), grid_value*1000); + else + line.Printf(wxT("%g mm"), grid_value); msg = grid_msg + line; grid_choice->Append( grid_list_schematic[ii].m_Id,