GetScreen() work, menu capitalization, beautifying

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

View File

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

View File

@ -131,7 +131,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
* Init the Block infos: command type, initial position, and other variables..
*/
{
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;
}

View File

@ -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 ) );

View File

@ -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;
}

View File

@ -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

View File

@ -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 );
}

View File

@ -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 );

View File

@ -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;

View File

@ -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 );

View File

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

View File

@ -218,13 +218,13 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
/****************************************************************/
void DrawSheetStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/****************************************************************/
{
/* Placement en liste des structures si nouveau composant:*/
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;

View File

@ -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 );

View File

@ -42,7 +42,7 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
/***************************************************************/
void SCH_ITEM::Place( WinEDA_DrawFrame* frame, wxDC* DC )
void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/***************************************************************/
/* place the struct in EEDrawList.
@ -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;

View File

@ -94,7 +94,7 @@ void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
/***************************************************************/
void SCH_TEXT::Place( WinEDA_DrawFrame* frame, wxDC* DC )
void SCH_TEXT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/***************************************************************/
{
/* save old text in undo list */
@ -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 );

View File

@ -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();
/**

View File

@ -418,7 +418,7 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
/***********************************************************************/
void SCH_COMPONENT::Place( WinEDA_DrawFrame* frame, wxDC* DC )
void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/***********************************************************************/
{
/* save old text in undo list */
@ -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 );

View File

@ -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.

View File

@ -217,14 +217,14 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
/***********************************************************************/
void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
/***********************************************************************/
{
wxSize delta;
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 )

View File

@ -1,4 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_options.cpp
// Purpose:
// Author: jean-pierre Charras
@ -11,7 +12,7 @@
// 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);
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;
BASE_SCREEN* screen = m_Parent->GetBaseScreen();
case 25:
m_SelGridSize->SetSelection(1);
break;
/* Init options */
if( screen )
{
switch( screen->GetGrid().x )
{
case 50:
m_SelGridSize->SetSelection( 0 );
break;
case 10:
m_SelGridSize->SetSelection(2);
break;
case 25:
m_SelGridSize->SetSelection( 1 );
break;
case 5:
m_SelGridSize->SetSelection(3);
break;
case 10:
m_SelGridSize->SetSelection( 2 );
break;
case 2:
m_SelGridSize->SetSelection(4);
break;
case 5:
m_SelGridSize->SetSelection( 3 );
break;
case 1:
m_SelGridSize->SetSelection(5);
break;
case 2:
m_SelGridSize->SetSelection( 4 );
break;
default:
DisplayError(this, wxT("WinEDA_SetOptionsFrame: Grid value not handle"));
break;
}
}
case 1:
m_SelGridSize->SetSelection( 5 );
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);
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,20 +447,25 @@ 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.
}
@ -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.
}
/**************************************************************************/
void WinEDA_SetOptionsFrame::Accept(wxCommandEvent& event)
void WinEDA_SetOptionsFrame::Accept( wxCommandEvent& event )
/**************************************************************************/
{
wxSize grid;
bool setgrid = TRUE;
wxString msg;
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_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;
g_DefaultTextLabelSize = m_DefaultLabelSizeCtrl->GetValue();
if( g_DefaultTextLabelSize < 0 )
g_DefaultTextLabelSize = 0;
if( g_DefaultTextLabelSize > 1000 )
g_DefaultTextLabelSize = 1000;
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);
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_RepeatDeltaLabel = m_DeltaLabelCtrl->GetValue();
g_RepeatDeltaLabel = m_DeltaLabelCtrl->GetValue();
if ( m_Show_Page_Limits->GetSelection() == 0 ) g_ShowPageLimits = TRUE;
else g_ShowPageLimits = FALSE;
if( m_Show_Page_Limits->GetSelection() == 0 )
g_ShowPageLimits = TRUE;
else
g_ShowPageLimits = FALSE;
if ( m_SelDirWires->GetSelection() == 0 ) g_HVLines = 1;
else g_HVLines = 0;
if( m_SelDirWires->GetSelection() == 0 )
g_HVLines = 1;
else
g_HVLines = 0;
if ( m_Selunits->GetSelection() == 0 ) g_UnitMetric = 1;
else g_UnitMetric = 0;
if( m_Selunits->GetSelection() == 0 )
g_UnitMetric = 1;
else
g_UnitMetric = 0;
if ( m_SelShowPins->GetSelection() == 0 ) g_ShowAllPins = FALSE;
else g_ShowAllPins = TRUE;
if( m_SelShowPins->GetSelection() == 0 )
g_ShowAllPins = FALSE;
else
g_ShowAllPins = TRUE;
g_ShowGrid = m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue();
m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue();
g_ShowGrid = m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue();
m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue();
m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue();
switch( m_SelGridSize->GetSelection() )
{
default:
setgrid = FALSE;
break;
m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue();
case 0:
grid = wxSize(50,50);
break;
case 1:
grid = wxSize(25,25);
break;
switch( m_SelGridSize->GetSelection() )
{
default:
setgrid = FALSE;
break;
case 2:
grid = wxSize(10,10);
break;
}
case 0:
grid = wxSize( 50, 50 );
break;
if ( m_Parent->GetScreen() )
{
if ( setgrid ) m_Parent->GetScreen()->SetGrid(grid);
m_Parent->GetScreen()->SetRefreshReq();
}
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();
}
}

View File

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

View File

@ -179,7 +179,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
/*************************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
/*************************************************************************/
/* Routine to create new text struct (GraphicText, label or Glabel).
@ -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;

View File

@ -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 )

View File

@ -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 );
}

View File

@ -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(

View File

@ -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;
}

View File

@ -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;

View File

@ -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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -23,9 +23,10 @@
*****************************************************************************/
void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
{
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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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) )

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -239,7 +239,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
}
}
if( panel->m_Parent->GetScreen()->BlockLocate.m_State != STATE_BLOCK_STOP )
if( panel->GetScreen()->BlockLocate.m_State != STATE_BLOCK_STOP )
{
screen->BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->BlockLocate.GetRight();
screen->BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom();
@ -324,7 +324,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
deltaX = GetScreen()->BlockLocate.m_MoveVector.x;
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 )
{

View File

@ -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:

View File

@ -1,6 +1,6 @@
/********************************************************/
/**** Routine de lecture et visu d'un fichier GERBER ****/
/********************************************************/
/********************************************************/
/**** Routine de lecture et visu d'un fichier GERBER ****/
/********************************************************/
#include "fctsys.h"
@ -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<EFBFBD>placement
D02 = extinction de lumiere (lever de plume) lors du d<EFBFBD>placement
D03 = Flash
D09 = VAPE Flash
D01 ... D9 = codes d'action:
D01 = activation de lumiere (baisser de plume) lors du d<EFBFBD>placement
D02 = extinction de lumiere (lever de plume) lors du d<EFBFBD>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<69>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<69>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 <EFBFBD> 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 <EFBFBD> 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", &current_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", &current_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<69> 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<69> 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 <20>l<EFBFBD>ments correspondant au DCode s<>lectionn<6E>
if(Etat_Surbrillance) Hight_Light(DrawPanel, DC);
net_code_Surbrillance = (GetScreen()->m_Active_Layer<< 16) + ii;
Hight_Light(DrawPanel, DC);
// Mise en surbrillance des <20>l<EFBFBD>ments correspondant au DCode s<>lectionn<6E>
if( Etat_Surbrillance )
Hight_Light( DrawPanel, DC );
net_code_Surbrillance = (GetScreen()->m_Active_Layer << 16) + ii;
Hight_Light( DrawPanel, DC );
#endif
}

View File

@ -23,7 +23,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
* quand un outil est deja selectionn<EFBFBD>
*/
{
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;

View File

@ -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:

View File

@ -1,6 +1,6 @@
/******************************************************************/
/* gerberframe.cpp - fonctions des classes du type WinEDA_GerberFrame */
/******************************************************************/
/******************************************************************/
/* gerberframe.cpp - fonctions des classes du type WinEDA_GerberFrame */
/******************************************************************/
#ifdef __GNUG__
#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<69>s dans drawpanel.cpp
// PopUp Menu trait<69>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<69>
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<69>
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<EFBFBD>n<EFBFBD>r<EFBFBD>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;
}

View File

@ -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 );

View File

@ -34,7 +34,7 @@ static int distance( int seuil );
/*************************************************************/
EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
BOARD_ITEM* WinEDA_GerberFrame::Locate( int typeloc )
/*************************************************************/
/* Fonction de localisation generale
@ -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,7 +80,7 @@ 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 );
return TrackLocate;

View File

@ -20,9 +20,9 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
* The menu already has a list of zoom commands.
*/
{
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;
}

View File

@ -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 )
{

View File

@ -107,7 +107,7 @@ static void Append_1_Flash_ROND_GERBER( int Dcode_tool,
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 );
@ -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 )
@ -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 );

View File

@ -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();

View File

@ -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 );

View File

@ -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; }
//----<zoom stuff>----------------------------------------------------------
/**
* Function GetZoom

View File

@ -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

View File

@ -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; }

View File

@ -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();

View File

@ -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();

View File

@ -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 );

View File

@ -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 );

View File

@ -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();

View File

@ -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;
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();
}

View File

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

View File

@ -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 */

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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 )

View File

@ -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();
}

View File

@ -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:

View File

@ -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();
}

View File

@ -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;

View File

@ -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;

View File

@ -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 );

View File

@ -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 */

View File

@ -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 );

View File

@ -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 );

View File

@ -49,9 +49,9 @@ 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 )
@ -79,48 +79,48 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
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 );
@ -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 );

View File

@ -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 )

View File

@ -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;

View File

@ -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) )
@ -368,7 +368,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
PopMenu->AppendSeparator();
}
return true;
return true;
}

View File

@ -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++;
}

View File

@ -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 */

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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++ )
{
@ -95,7 +95,7 @@ static wxMenu* Append_Track_Width_List()
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,10 +594,10 @@ 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,

View File

@ -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 );

View File

@ -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();
}

View File

@ -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 )
{

View File

@ -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;
}

View File

@ -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 )
@ -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();
}

View File

@ -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<69>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()];

View File

@ -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 )

View File

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

View File

@ -211,7 +211,7 @@ int WinEDA_ExchangeModuleFrame::Maj_ListeCmp(
return 0; /* pas de changement de nom */
/* 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;

View File

@ -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 );
}
@ -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();
}
@ -584,15 +566,16 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type )
* replac<EFBFBD> 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,9 +586,9 @@ 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();
GetScreen()->SetPreviousZoom();
screen->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 ),

View File

@ -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 )
/*********************************************************************************/

View File

@ -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;
}
}

View File

@ -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 )

View File

@ -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 )

View File

@ -46,7 +46,7 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse )
* Note: Mac OS ** does not ** allow moving mouse cursor by program.
*/
{
PutOnGrid( &(GetScreen()->m_Curseur) );
PutOnGrid( &(GetBaseScreen()->m_Curseur) );
AdjustScrollBars();
@ -69,9 +69,9 @@ 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,10 +81,10 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
}
else
{
double pasx = GetScreen()->m_UserGrid.x * m_InternalUnits;
double pasy = GetScreen()->m_UserGrid.y * m_InternalUnits;
double pasx = GetBaseScreen()->m_UserGrid.x * m_InternalUnits;
double pasy = GetBaseScreen()->m_UserGrid.y * m_InternalUnits;
if( GetScreen()->m_UserGridUnit != INCHES )
if( GetBaseScreen()->m_UserGridUnit != INCHES )
{
pasx /= 25.4;
pasy /= 25.4;
@ -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,