Commit 93ebdb2c authored by jean-pierre charras's avatar jean-pierre charras

All: better code to handle opened frames libview, libedit, modview, modedit.

Other minor fixes.
parent b810135e
...@@ -55,16 +55,16 @@ const wxChar* traceAutoSave = wxT( "KicadAutoSave" ); ...@@ -55,16 +55,16 @@ const wxChar* traceAutoSave = wxT( "KicadAutoSave" );
static const wxChar* entryAutoSaveInterval = wxT( "AutoSaveInterval" ); static const wxChar* entryAutoSaveInterval = wxT( "AutoSaveInterval" );
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father, EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent,
ID_DRAWFRAME_TYPE idtype, ID_DRAWFRAME_TYPE aFrameType,
const wxString& title, const wxString& aTitle,
const wxPoint& pos, const wxSize& size, const wxPoint& aPos, const wxSize& aSize,
long style ) : long aStyle, const wxString & aFrameName ) :
wxFrame( father, wxID_ANY, title, pos, size, style ) wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName )
{ {
wxSize minsize; wxSize minsize;
m_Ident = idtype; m_Ident = aFrameType;
m_mainToolBar = NULL; m_mainToolBar = NULL;
m_FrameIsActive = true; m_FrameIsActive = true;
m_hasAutoSave = false; m_hasAutoSave = false;
...@@ -79,7 +79,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father, ...@@ -79,7 +79,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father,
SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 ); SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );
if( ( size.x < minsize.x ) || ( size.y < minsize.y ) ) if( ( aSize.x < minsize.x ) || ( aSize.y < minsize.y ) )
SetSize( 0, 0, minsize.x, minsize.y ); SetSize( 0, 0, minsize.x, minsize.y );
// Create child subwindows. // Create child subwindows.
......
...@@ -84,10 +84,12 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME ) ...@@ -84,10 +84,12 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
END_EVENT_TABLE() END_EVENT_TABLE()
EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype, EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
const wxString& title, ID_DRAWFRAME_TYPE aFrameType,
const wxPoint& pos, const wxSize& size, long style ) : const wxString& aTitle,
EDA_BASE_FRAME( father, idtype, title, pos, size, style ) const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString & aFrameName ) :
EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
{ {
m_drawToolBar = NULL; m_drawToolBar = NULL;
m_optionsToolBar = NULL; m_optionsToolBar = NULL;
......
...@@ -67,6 +67,7 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME ) ...@@ -67,6 +67,7 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode ) DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode )
END_EVENT_TABLE() END_EVENT_TABLE()
#define DISPLAY_FOOTPRINTS_FRAME_NAME wxT( "CmpFrame" )
/***************************************************************************/ /***************************************************************************/
/* DISPLAY_FOOTPRINTS_FRAME: the frame to display the current focused footprint */ /* DISPLAY_FOOTPRINTS_FRAME: the frame to display the current focused footprint */
...@@ -76,9 +77,10 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* parent, ...@@ -76,9 +77,10 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, long style ) : const wxSize& size, long style ) :
PCB_BASE_FRAME( parent, CVPCB_DISPLAY_FRAME_TYPE, title, pos, size, style ) PCB_BASE_FRAME( parent, CVPCB_DISPLAY_FRAME_TYPE, title, pos, size,
style, DISPLAY_FOOTPRINTS_FRAME_NAME )
{ {
m_FrameName = wxT( "CmpFrame" ); m_FrameName = DISPLAY_FOOTPRINTS_FRAME_NAME;
m_showAxis = true; // true to draw axis. m_showAxis = true; // true to draw axis.
// Give an icon // Give an icon
......
...@@ -103,10 +103,13 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME ) ...@@ -103,10 +103,13 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
END_EVENT_TABLE() END_EVENT_TABLE()
#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) : CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
EDA_BASE_FRAME( NULL, CVPCB_FRAME_TYPE, title, wxDefaultPosition, wxDefaultSize, style ) EDA_BASE_FRAME( NULL, CVPCB_FRAME_TYPE, title, wxDefaultPosition,
wxDefaultSize, style, CVPCB_MAINFRAME_NAME )
{ {
m_FrameName = wxT( "CvpcbFrame" ); m_FrameName = CVPCB_MAINFRAME_NAME;
m_ListCmp = NULL; m_ListCmp = NULL;
m_FootprintList = NULL; m_FootprintList = NULL;
......
...@@ -54,14 +54,12 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void ) ...@@ -54,14 +54,12 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void )
wxSemaphore semaphore( 0, 1 ); wxSemaphore semaphore( 0, 1 );
wxString cmpname; wxString cmpname;
/* Close the current Lib browser, if open, and open a new one, in "modal" mode */ // Close the current Lib browser, if open, and open a new one, in "modal" mode:
if( m_ViewlibFrame ) LIB_VIEW_FRAME * viewlibFrame = LIB_VIEW_FRAME::GetActiveLibraryViewer();;
{ if( viewlibFrame )
delete m_ViewlibFrame; viewlibFrame->Destroy();
m_ViewlibFrame = NULL;
}
m_ViewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore, viewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore,
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT ); KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
// Show the library viewer frame until it is closed // Show the library viewer frame until it is closed
// Wait for viewer closing event: // Wait for viewer closing event:
...@@ -71,8 +69,8 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void ) ...@@ -71,8 +69,8 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void )
wxMilliSleep( 50 ); wxMilliSleep( 50 );
} }
cmpname = m_ViewlibFrame->GetSelectedComponent(); cmpname = viewlibFrame->GetSelectedComponent();
delete m_ViewlibFrame; viewlibFrame->Destroy();
return cmpname; return cmpname;
} }
...@@ -133,9 +131,9 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname, ...@@ -133,9 +131,9 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname,
{ {
cmpName = SelectComponentFromLibBrowser(); cmpName = SelectComponentFromLibBrowser();
if( aUnit ) if( aUnit )
*aUnit = m_ViewlibFrame->GetUnit(); *aUnit = LIB_VIEW_FRAME::GetUnit();
if( aConvert ) if( aConvert )
*aConvert = m_ViewlibFrame->GetConvert(); *aConvert = LIB_VIEW_FRAME::GetConvert();
if( !cmpName.IsEmpty() ) if( !cmpName.IsEmpty() )
AddHistoryComponentName( aHistoryList, cmpName ); AddHistoryComponentName( aHistoryList, cmpName );
return cmpName; return cmpName;
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -194,6 +194,10 @@ static EDA_HOTKEY HkCreatePin( wxT( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' ) ...@@ -194,6 +194,10 @@ static EDA_HOTKEY HkCreatePin( wxT( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' )
static EDA_HOTKEY HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT ); static EDA_HOTKEY HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
static EDA_HOTKEY HkMoveLibItem( wxT( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' ); static EDA_HOTKEY HkMoveLibItem( wxT( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' );
// Load/save files
static EDA_HOTKEY HkSaveLib( wxT( "Save Lib" ), HK_SAVE_LIB, 'S' + GR_KB_CTRL );
static EDA_HOTKEY HkSaveSchematic( wxT( "Save Schematic" ), HK_SAVE_SCH, 'S' + GR_KB_CTRL );
static EDA_HOTKEY HkLoadSchematic( wxT( "Load Schematic" ), HK_LOAD_SCH, 'L' + GR_KB_CTRL );
// List of common hotkey descriptors // List of common hotkey descriptors
EDA_HOTKEY* s_Common_Hotkey_List[] = EDA_HOTKEY* s_Common_Hotkey_List[] =
...@@ -213,6 +217,8 @@ EDA_HOTKEY* s_Common_Hotkey_List[] = ...@@ -213,6 +217,8 @@ EDA_HOTKEY* s_Common_Hotkey_List[] =
// List of hotkey descriptors for schematic // List of hotkey descriptors for schematic
EDA_HOTKEY* s_Schematic_Hotkey_List[] = EDA_HOTKEY* s_Schematic_Hotkey_List[] =
{ {
&HkSaveSchematic,
&HkLoadSchematic,
&HkFindItem, &HkFindItem,
&HkFindNextItem, &HkFindNextItem,
&HkFindNextDrcMarker, &HkFindNextDrcMarker,
...@@ -250,6 +256,7 @@ EDA_HOTKEY* s_Schematic_Hotkey_List[] = ...@@ -250,6 +256,7 @@ EDA_HOTKEY* s_Schematic_Hotkey_List[] =
// List of hotkey descriptors for library editor // List of hotkey descriptors for library editor
EDA_HOTKEY* s_LibEdit_Hotkey_List[] = EDA_HOTKEY* s_LibEdit_Hotkey_List[] =
{ {
&HkSaveLib,
&HkCreatePin, &HkCreatePin,
&HkInsertPin, &HkInsertPin,
&HkEdit, &HkEdit,
......
...@@ -43,7 +43,10 @@ enum hotkey_id_commnand { ...@@ -43,7 +43,10 @@ enum hotkey_id_commnand {
HK_ADD_HIER_SHEET, HK_ADD_HIER_SHEET,
HK_ADD_GRAPHIC_TEXT, HK_ADD_GRAPHIC_TEXT,
HK_ADD_GRAPHIC_POLYLINE, HK_ADD_GRAPHIC_POLYLINE,
HK_ADD_NOCONN_FLAG HK_ADD_NOCONN_FLAG,
HK_SAVE_LIB,
HK_SAVE_SCH,
HK_LOAD_SCH
}; };
// List of hotkey descriptors for Eeschema // List of hotkey descriptors for Eeschema
......
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
#include <dialogs/dialog_edit_component_in_lib.h> #include <dialogs/dialog_edit_component_in_lib.h>
#include <dialogs/dialog_libedit_dimensions.h> #include <dialogs/dialog_libedit_dimensions.h>
//#include <dialog_helpers.h>
#include <menus_helpers.h> #include <menus_helpers.h>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
...@@ -185,17 +184,19 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -185,17 +184,19 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
LIB_EDIT_FRAME::OnUpdateEditingPart ) LIB_EDIT_FRAME::OnUpdateEditingPart )
END_EVENT_TABLE() END_EVENT_TABLE()
#define LIB_EDIT_FRAME_NAME wxT( "LibeditFrame" )
LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
SCH_BASE_FRAME( aParent, LIBEDITOR_FRAME_TYPE, title, pos, size, style ) SCH_BASE_FRAME( aParent, LIBEDITOR_FRAME_TYPE, title, pos, size,
style, GetLibEditFrameName() )
{ {
wxASSERT( aParent ); wxASSERT( aParent );
m_FrameName = wxT( "LibeditFrame" ); m_FrameName = GetLibEditFrameName();
m_showAxis = true; // true to draw axis m_showAxis = true; // true to draw axis
m_configPath = wxT( "LibraryEditor" ); m_configPath = wxT( "LibraryEditor" );
SetShowDeMorgan( false ); SetShowDeMorgan( false );
...@@ -276,9 +277,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, ...@@ -276,9 +277,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
LIB_EDIT_FRAME::~LIB_EDIT_FRAME() LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
{ {
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow();
frame->SetLibraryEditorWindow( NULL );
m_drawItem = m_lastDrawItem = NULL; m_drawItem = m_lastDrawItem = NULL;
if ( m_tempCopyComponent ) if ( m_tempCopyComponent )
...@@ -287,6 +285,23 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME() ...@@ -287,6 +285,23 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
m_tempCopyComponent = NULL; m_tempCopyComponent = NULL;
} }
/**
* Function GetLibEditFrameName (static)
* @return the frame name used when creating the frame
* used to get a reference to this frame, if exists
*/
const wxChar* LIB_EDIT_FRAME::GetLibEditFrameName()
{
return LIB_EDIT_FRAME_NAME;
}
/* return a reference to the current opened Library editor
* or NULL if no Library editor currently opened
*/
LIB_EDIT_FRAME* LIB_EDIT_FRAME::GetActiveLibraryEditor()
{
return (LIB_EDIT_FRAME*) wxWindow::FindWindowByName(GetLibEditFrameName());
}
void LIB_EDIT_FRAME::LoadSettings() void LIB_EDIT_FRAME::LoadSettings()
{ {
......
...@@ -128,6 +128,20 @@ public: ...@@ -128,6 +128,20 @@ public:
~LIB_EDIT_FRAME(); ~LIB_EDIT_FRAME();
/**
* Function GetLibEditFrameName (static)
* @return the frame name used when creating the frame
* used to get a reference to this frame, if exists
*/
static const wxChar* GetLibEditFrameName();
/**
* Function GetActiveLibraryEditor (static)
* @return a reference to the current opened Library editor
* or NULL if no Library editor currently opened
*/
static LIB_EDIT_FRAME* GetActiveLibraryEditor();
void ReCreateMenuBar(); void ReCreateMenuBar();
/** /**
......
...@@ -70,14 +70,14 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() ...@@ -70,14 +70,14 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// New // New
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
ID_NEW_PROJECT, ID_NEW_PROJECT,
_( "&New\tCtrl+N" ), _( "&New" ),
_( "New schematic project" ), _( "New schematic project" ),
KiBitmap( new_xpm ) ); KiBitmap( new_xpm ) );
// Open // Open
text = AddHotkeyName( _( "&Open" ), s_Schematic_Hokeys_Descr, HK_LOAD_SCH );
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
ID_LOAD_PROJECT, ID_LOAD_PROJECT, text,
_( "&Open\tCtrl+O" ),
_( "Open an existing schematic project" ), _( "Open an existing schematic project" ),
KiBitmap( open_document_xpm ) ); KiBitmap( open_document_xpm ) );
...@@ -101,9 +101,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() ...@@ -101,9 +101,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
// Save schematic project // Save schematic project
text = AddHotkeyName( _( "&Save Whole Schematic Project" ),
s_Schematic_Hokeys_Descr, HK_SAVE_SCH );
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
ID_SAVE_PROJECT, ID_SAVE_PROJECT, text,
_( "&Save Whole Schematic Project\tCtrl+S" ),
_( "Save all sheets in the schematic project" ), _( "Save all sheets in the schematic project" ),
KiBitmap( save_project_xpm ) ); KiBitmap( save_project_xpm ) );
......
...@@ -62,6 +62,14 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() ...@@ -62,6 +62,14 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
// Menu File: // Menu File:
wxMenu* fileMenu = new wxMenu; wxMenu* fileMenu = new wxMenu;
// Select current library
AddMenuItem( fileMenu,
ID_LIBEDIT_SELECT_CURRENT_LIB,
_( "&Current Library" ),
_( "Select working library" ),
KiBitmap( library_xpm ) );
fileMenu->AppendSeparator();
// Save current library // Save current library
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
ID_LIBEDIT_SAVE_CURRENT_LIB, ID_LIBEDIT_SAVE_CURRENT_LIB,
...@@ -82,7 +90,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() ...@@ -82,7 +90,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
// Export as png file // Export as png file
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
ID_LIBEDIT_GEN_PNG_FILE, ID_LIBEDIT_GEN_PNG_FILE,
_( "&Create PNG File from Screen" ), _( "Create &PNG File from Screen" ),
_( "Create a PNG file from the component displayed on screen" ), _( "Create a PNG file from the component displayed on screen" ),
KiBitmap( plot_xpm ) ); KiBitmap( plot_xpm ) );
......
...@@ -31,29 +31,20 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( wxWindow* aParent, ...@@ -31,29 +31,20 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( wxWindow* aParent,
ID_DRAWFRAME_TYPE aWindowType, ID_DRAWFRAME_TYPE aWindowType,
const wxString& aTitle, const wxString& aTitle,
const wxPoint& aPosition, const wxSize& aSize, const wxPoint& aPosition, const wxSize& aSize,
long aStyle ) : long aStyle, const wxString & aFrameName ) :
EDA_DRAW_FRAME( aParent, aWindowType, aTitle, aPosition, aSize, aStyle ) EDA_DRAW_FRAME( aParent, aWindowType, aTitle, aPosition, aSize, aStyle, aFrameName )
{ {
m_ViewlibFrame = NULL;
m_LibeditFrame = NULL;
} }
void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event ) void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
{ {
if( m_ViewlibFrame ) LIB_VIEW_FRAME * viewlibFrame = LIB_VIEW_FRAME::GetActiveLibraryViewer();;
{
m_ViewlibFrame->Show( true );
return;
}
if( m_LibeditFrame && m_LibeditFrame->m_ViewlibFrame )
{
m_LibeditFrame->m_ViewlibFrame->Show( true );
return;
}
m_ViewlibFrame = new LIB_VIEW_FRAME( this ); if( viewlibFrame )
viewlibFrame->Show( true );
else
new LIB_VIEW_FRAME( this );
} }
......
...@@ -178,15 +178,15 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -178,15 +178,15 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
END_EVENT_TABLE() END_EVENT_TABLE()
#define SCH_EDIT_FRAME_NAME wxT( "SchematicFrame" )
SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father, SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle,
const wxString& title, const wxPoint& aPosition, const wxSize& aSize,
const wxPoint& pos, long aStyle ) :
const wxSize& size, SCH_BASE_FRAME( aParent, SCHEMATIC_FRAME_TYPE, aTitle, aPosition, aSize,
long style ) : aStyle, SCH_EDIT_FRAME_NAME )
SCH_BASE_FRAME( father, SCHEMATIC_FRAME_TYPE, title, pos, size, style )
{ {
m_FrameName = wxT( "SchematicFrame" ); m_FrameName = SCH_EDIT_FRAME_NAME;
m_showAxis = false; // true to show axis m_showAxis = false; // true to show axis
m_showBorderAndTitleBlock = true; // true to show sheet references m_showBorderAndTitleBlock = true; // true to show sheet references
m_CurrentSheet = new SCH_SHEET_PATH(); m_CurrentSheet = new SCH_SHEET_PATH();
...@@ -414,10 +414,12 @@ void SCH_EDIT_FRAME::SaveUndoItemInUndoList( SCH_ITEM* aItem ) ...@@ -414,10 +414,12 @@ void SCH_EDIT_FRAME::SaveUndoItemInUndoList( SCH_ITEM* aItem )
void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent ) void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
{ {
if( m_LibeditFrame && !m_LibeditFrame->Close() ) // Can close component editor? LIB_EDIT_FRAME * libeditFrame = LIB_EDIT_FRAME::GetActiveLibraryEditor();;
if( libeditFrame && !libeditFrame->Close() ) // Can close component editor?
return; return;
if( m_ViewlibFrame && !m_ViewlibFrame->Close() ) // Can close component viewer? LIB_VIEW_FRAME * viewlibFrame = LIB_VIEW_FRAME::GetActiveLibraryViewer();;
if( viewlibFrame && !viewlibFrame->Close() ) // Can close component viewer?
return; return;
SCH_SHEET_LIST SheetList; SCH_SHEET_LIST SheetList;
...@@ -787,19 +789,20 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event ) ...@@ -787,19 +789,20 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
component = (SCH_COMPONENT*) item; component = (SCH_COMPONENT*) item;
} }
if( m_LibeditFrame ) LIB_EDIT_FRAME * libeditFrame = LIB_EDIT_FRAME::GetActiveLibraryEditor();;
if( libeditFrame )
{ {
if( m_LibeditFrame->IsIconized() ) if( libeditFrame->IsIconized() )
m_LibeditFrame->Iconize( false ); libeditFrame->Iconize( false );
m_LibeditFrame->Raise(); libeditFrame->Raise();
} }
else else
{ {
m_LibeditFrame = new LIB_EDIT_FRAME( this, libeditFrame = new LIB_EDIT_FRAME( this,
wxT( "Library Editor" ), wxT( "Library Editor" ),
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );
} }
if( component ) if( component )
...@@ -810,7 +813,7 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event ) ...@@ -810,7 +813,7 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
return; return;
CMP_LIBRARY* library = entry->GetLibrary(); CMP_LIBRARY* library = entry->GetLibrary();
m_LibeditFrame->LoadComponentAndSelectLib( entry, library ); libeditFrame->LoadComponentAndSelectLib( entry, library );
} }
} }
...@@ -825,8 +828,9 @@ void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& event ) ...@@ -825,8 +828,9 @@ void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
{ {
EDA_BASE_FRAME::SetLanguage( event ); EDA_BASE_FRAME::SetLanguage( event );
if( m_LibeditFrame ) LIB_EDIT_FRAME * libeditFrame = LIB_EDIT_FRAME::GetActiveLibraryEditor();;
m_LibeditFrame->EDA_BASE_FRAME::SetLanguage( event ); if( libeditFrame )
libeditFrame->EDA_BASE_FRAME::SetLanguage( event );
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <general.h> #include <general.h>
#include <protos.h> //#include <protos.h>
#include <viewlib_frame.h> #include <viewlib_frame.h>
#include <class_library.h> #include <class_library.h>
#include <hotkeys.h> #include <hotkeys.h>
...@@ -97,16 +97,16 @@ static wxAcceleratorEntry accels[] = ...@@ -97,16 +97,16 @@ static wxAcceleratorEntry accels[] =
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) ) #define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )
#define EXTRA_BORDER_SIZE 2 #define EXTRA_BORDER_SIZE 2
#define LIB_VIEW_FRAME_NAME wxT( "ViewlibFrame" )
LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library,
wxSemaphore* semaphore, long style ) : wxSemaphore* semaphore, long style ) :
SCH_BASE_FRAME( father, VIEWER_FRAME_TYPE, _( "Library Browser" ), SCH_BASE_FRAME( father, VIEWER_FRAME_TYPE, _( "Library Browser" ),
wxDefaultPosition, wxDefaultSize, style ) wxDefaultPosition, wxDefaultSize, style, GetLibViewerFrameName() )
{ {
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
m_FrameName = wxT( "ViewlibFrame" ); m_FrameName = GetLibViewerFrameName();
m_configPath = wxT( "LibraryViewer" ); m_configPath = wxT( "LibraryViewer" );
// Give an icon // Give an icon
...@@ -258,10 +258,20 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, ...@@ -258,10 +258,20 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library,
LIB_VIEW_FRAME::~LIB_VIEW_FRAME() LIB_VIEW_FRAME::~LIB_VIEW_FRAME()
{ {
SCH_BASE_FRAME* frame = (SCH_BASE_FRAME*) GetParent();
frame->SetLibraryViewerWindow( NULL );
} }
const wxChar* LIB_VIEW_FRAME::GetLibViewerFrameName()
{
return LIB_VIEW_FRAME_NAME;
}
/* return a reference to the current opened Library viewer
* or NULL if no Library viewer currently opened
*/
LIB_VIEW_FRAME* LIB_VIEW_FRAME::GetActiveLibraryViewer()
{
return (LIB_VIEW_FRAME*) wxWindow::FindWindowByName(GetLibViewerFrameName());
}
void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event ) void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
......
...@@ -79,13 +79,26 @@ public: ...@@ -79,13 +79,26 @@ public:
~LIB_VIEW_FRAME(); ~LIB_VIEW_FRAME();
/**
* Function GetLibViewerFrameName (static)
* @return the frame name used when creating the frame
* used to get a reference to this frame, if exists
*/
static const wxChar* GetLibViewerFrameName();
/**
* Function GetActiveLibraryViewer (static)
* @return a reference to the current opened Library viewer
* or NULL if no Library viewer currently opened
*/
static LIB_VIEW_FRAME* GetActiveLibraryViewer();
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
/** /**
* Function OnSashDrag * Function OnSashDrag
* resizes the child windows when dragging a sash window border. * resizes the child windows when dragging a sash window border.
*/ */
void OnSashDrag( wxSashEvent& event ); void OnSashDrag( wxSashEvent& event );
/** /**
...@@ -132,8 +145,8 @@ public: ...@@ -132,8 +145,8 @@ public:
wxString& GetEntryName( void ) const { return m_entryName; } wxString& GetEntryName( void ) const { return m_entryName; }
wxString& GetSelectedComponent( void ) const { return m_exportToEeschemaCmpName; } wxString& GetSelectedComponent( void ) const { return m_exportToEeschemaCmpName; }
int GetUnit( void ) { return m_unit; } static int GetUnit( void ) { return m_unit; }
int GetConvert( void ) { return m_convert; } static int GetConvert( void ) { return m_convert; }
private: private:
/** /**
......
...@@ -58,17 +58,18 @@ static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBloc ...@@ -58,17 +58,18 @@ static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBloc
/* class GERBVIEW_FRAME for GerbView */ /* class GERBVIEW_FRAME for GerbView */
/*************************************/ /*************************************/
GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, #define GERBVIEW_FRAME_NAME wxT( "GerberFrame" )
const wxString& title,
const wxPoint& pos, GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* aParent, const wxString& aTitle,
const wxSize& size, const wxPoint& aPosition, const wxSize& aSize,
long style ) : long aStyle ) :
EDA_DRAW_FRAME( father, GERBER_FRAME_TYPE, title, pos, size, style ) EDA_DRAW_FRAME( aParent, GERBER_FRAME_TYPE, aTitle, aPosition, aSize,
aStyle, GERBVIEW_FRAME_NAME )
{ {
m_colorsSettings = &g_ColorsSettings; m_colorsSettings = &g_ColorsSettings;
m_Layout = NULL; m_Layout = NULL;
m_FrameName = wxT( "GerberFrame" ); m_FrameName = GERBVIEW_FRAME_NAME;
m_show_layer_manager_tools = true; m_show_layer_manager_tools = true;
m_showAxis = true; // true to show X and Y axis on screen m_showAxis = true; // true to show X and Y axis on screen
......
...@@ -190,9 +190,9 @@ private: ...@@ -190,9 +190,9 @@ private:
// An array sting to store warning messages when reaging a gerber file. // An array sting to store warning messages when reaging a gerber file.
wxArrayString m_Messages; wxArrayString m_Messages;
public: public:
GERBVIEW_FRAME( wxWindow* father, const wxString& title, GERBVIEW_FRAME( wxWindow* aParent, const wxString& aTitle,
const wxPoint& pos, const wxSize& size, const wxPoint& aPosition, const wxSize& aSize,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long aStyle = KICAD_DEFAULT_DRAWFRAME_STYLE );
~GERBVIEW_FRAME(); ~GERBVIEW_FRAME();
......
...@@ -45,27 +45,15 @@ class LIB_EDIT_FRAME; ...@@ -45,27 +45,15 @@ class LIB_EDIT_FRAME;
*/ */
class SCH_BASE_FRAME : public EDA_DRAW_FRAME class SCH_BASE_FRAME : public EDA_DRAW_FRAME
{ {
protected:
LIB_VIEW_FRAME* m_ViewlibFrame; // A library viewer, common to SCH_EDIT_FRAME
// and LIB_EDIT_FRAME.
// has no meaning to LIB_VIEW_FRAME
LIB_EDIT_FRAME* m_LibeditFrame; // the library editor.
// Is used mainly in SCH_EDIT_FRAME
// but is defined here because some functions
// need to know if a library editor or a libray
// viewer is currently opened
public: public:
SCH_BASE_FRAME( wxWindow* aParent, SCH_BASE_FRAME( wxWindow* aParent,
ID_DRAWFRAME_TYPE aWindowType, ID_DRAWFRAME_TYPE aWindowType,
const wxString& aTitle, const wxString& aTitle,
const wxPoint& aPosition, const wxSize& aSize, const wxPoint& aPosition, const wxSize& aSize,
long aStyle = KICAD_DEFAULT_DRAWFRAME_STYLE ); long aStyle, const wxString & aFrameName );
SCH_SCREEN* GetScreen() const; // overload EDA_DRAW_FRAME SCH_SCREEN* GetScreen() const; // overload EDA_DRAW_FRAME
void SetLibraryViewerWindow( LIB_VIEW_FRAME* aFrame ) { m_ViewlibFrame = aFrame; }
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
......
...@@ -42,8 +42,6 @@ ...@@ -42,8 +42,6 @@
/* Forward declarations of classes. */ /* Forward declarations of classes. */
class FOOTPRINT_EDIT_FRAME;
class FOOTPRINT_VIEWER_FRAME;
class BOARD; class BOARD;
class BOARD_CONNECTED_ITEM; class BOARD_CONNECTED_ITEM;
class MODULE; class MODULE;
...@@ -79,8 +77,6 @@ public: ...@@ -79,8 +77,6 @@ public:
int m_FastGrid2; int m_FastGrid2;
EDA_3D_FRAME* m_Draw3DFrame; EDA_3D_FRAME* m_Draw3DFrame;
FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame;
FOOTPRINT_VIEWER_FRAME * m_ModuleViewerFrame;
protected: protected:
...@@ -96,10 +92,10 @@ protected: ...@@ -96,10 +92,10 @@ protected:
virtual void unitsChangeRefresh(); virtual void unitsChangeRefresh();
public: public:
PCB_BASE_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype, PCB_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
const wxString& title, const wxString& aTitle,
const wxPoint& pos, const wxSize& size, const wxPoint& aPos, const wxSize& aSize,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long aStyle, const wxString & aFrameName );
~PCB_BASE_FRAME(); ~PCB_BASE_FRAME();
...@@ -458,16 +454,6 @@ public: ...@@ -458,16 +454,6 @@ public:
*/ */
wxString SelectFootprintFromLibBrowser( void ); wxString SelectFootprintFromLibBrowser( void );
/**
* Function GetActiveViewerFrame
* @return a reference to the current Module Viewer Frame if exists
* if called from the PCB editor, this is the m_ModuleViewerFrame
* or m_ModuleEditFrame->m_ModuleViewerFrame
* if called from the module editor, this is the m_ModuleViewerFrame
* or parent->m_ModuleViewerFrame
*/
FOOTPRINT_VIEWER_FRAME * GetActiveViewerFrame();
// ratsnest functions // ratsnest functions
/** /**
* Function Compile_Ratsnest * Function Compile_Ratsnest
......
...@@ -189,10 +189,9 @@ protected: ...@@ -189,10 +189,9 @@ protected:
void addCurrentItemToList( wxDC* aDC ); void addCurrentItemToList( wxDC* aDC );
public: public:
SCH_EDIT_FRAME( wxWindow* father, SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle,
const wxString& title, const wxPoint& aPosition, const wxSize& aSize,
const wxPoint& pos, const wxSize& size, long aStyle = KICAD_DEFAULT_DRAWFRAME_STYLE );
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~SCH_EDIT_FRAME(); ~SCH_EDIT_FRAME();
...@@ -200,8 +199,6 @@ public: ...@@ -200,8 +199,6 @@ public:
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void SetLibraryEditorWindow( LIB_EDIT_FRAME* aFrame ) { m_LibeditFrame = aFrame; }
bool GetShowAllPins() const { return m_showAllPins; } bool GetShowAllPins() const { return m_showAllPins; }
void SetShowAllPins( bool aEnable ) { m_showAllPins = aEnable; } void SetShowAllPins( bool aEnable ) { m_showAllPins = aEnable; }
......
...@@ -160,10 +160,11 @@ protected: ...@@ -160,10 +160,11 @@ protected:
virtual bool doAutoSave(); virtual bool doAutoSave();
public: public:
EDA_BASE_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype, EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
const wxString& title, const wxString& aTitle,
const wxPoint& pos, const wxSize& size, const wxPoint& aPos, const wxSize& aSize,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long aStyle,
const wxString & aFrameName );
~EDA_BASE_FRAME(); ~EDA_BASE_FRAME();
...@@ -450,10 +451,12 @@ protected: ...@@ -450,10 +451,12 @@ protected:
virtual void unitsChangeRefresh(); virtual void unitsChangeRefresh();
public: public:
EDA_DRAW_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype, EDA_DRAW_FRAME( wxWindow* aParent,
const wxString& title, ID_DRAWFRAME_TYPE aFrameType,
const wxPoint& pos, const wxSize& size, const wxString& aTitle,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); const wxPoint& aPos, const wxSize& aSize,
long aStyle,
const wxString & aFrameName );
~EDA_DRAW_FRAME(); ~EDA_DRAW_FRAME();
......
...@@ -41,18 +41,20 @@ ...@@ -41,18 +41,20 @@
static const wxString TreeFrameWidthEntry( wxT( "LeftWinWidth" ) ); static const wxString TreeFrameWidthEntry( wxT( "LeftWinWidth" ) );
#define KICAD_MANAGER_FRAME_NAME wxT( "KicadFrame" )
KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size ) : const wxSize& size ) :
EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_TYPE, title, pos, size ) EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_TYPE, title, pos, size,
KICAD_DEFAULT_DRAWFRAME_STYLE, KICAD_MANAGER_FRAME_NAME )
{ {
wxString msg; wxString msg;
wxString line; wxString line;
wxSize clientsize; wxSize clientsize;
m_FrameName = wxT( "KicadFrame" ); m_FrameName = KICAD_MANAGER_FRAME_NAME;
m_VToolBar = NULL; // No Vertical tooolbar used here m_VToolBar = NULL; // No Vertical tooolbar used here
m_LeftWin = NULL; // A shashwindow that contains the project tree m_LeftWin = NULL; // A shashwindow that contains the project tree
m_RightWin = NULL; /* A shashwindow that contains the buttons m_RightWin = NULL; /* A shashwindow that contains the buttons
......
...@@ -76,11 +76,11 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME ) ...@@ -76,11 +76,11 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
END_EVENT_TABLE() END_EVENT_TABLE()
PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype, PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
const wxString& title, const wxString& aTitle,
const wxPoint& pos, const wxSize& size, const wxPoint& aPos, const wxSize& aSize,
long style) : long aStyle, const wxString & aFrameName) :
EDA_DRAW_FRAME( father, idtype, title, pos, size, style ) EDA_DRAW_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
{ {
m_Pcb = NULL; m_Pcb = NULL;
...@@ -92,8 +92,6 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype, ...@@ -92,8 +92,6 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype,
m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch) m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch)
m_DisplayPcbTrackFill = true; // false = sketch , true = filled m_DisplayPcbTrackFill = true; // false = sketch , true = filled
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL) m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
m_ModuleEditFrame = NULL; // Frame for footprint edition
m_ModuleViewerFrame = NULL; // Frame for footprint viewer
m_UserGridSize = wxRealPoint( 100.0, 100.0 ); m_UserGridSize = wxRealPoint( 100.0, 100.0 );
m_UserGridUnit = INCHES; m_UserGridUnit = INCHES;
...@@ -805,7 +803,6 @@ void PCB_BASE_FRAME::updateGridSelectBox() ...@@ -805,7 +803,6 @@ void PCB_BASE_FRAME::updateGridSelectBox()
} }
} }
void PCB_BASE_FRAME::updateZoomSelectBox() void PCB_BASE_FRAME::updateZoomSelectBox()
{ {
if( m_zoomSelectBox == NULL ) if( m_zoomSelectBox == NULL )
...@@ -835,38 +832,3 @@ void PCB_BASE_FRAME::updateZoomSelectBox() ...@@ -835,38 +832,3 @@ void PCB_BASE_FRAME::updateZoomSelectBox()
m_zoomSelectBox->SetSelection( i + 1 ); m_zoomSelectBox->SetSelection( i + 1 );
} }
} }
/* Function GetActiveViewerFrame
* return a reference to the current Module Viewer Frame if exists
* if called from the PCB editor, this is the m_ModuleViewerFrame
* or m_ModuleEditFrame->m_ModuleViewerFrame
* if called from the module editor, this is the m_ModuleViewerFrame
* or parent->m_ModuleViewerFrame
*/
FOOTPRINT_VIEWER_FRAME * PCB_BASE_FRAME::GetActiveViewerFrame()
{
if( m_ModuleViewerFrame )
return m_ModuleViewerFrame;
switch( m_Ident )
{
case PCB_FRAME_TYPE:
if( m_ModuleEditFrame )
return ((PCB_BASE_FRAME*)m_ModuleEditFrame)->m_ModuleViewerFrame;
break;
case MODULE_EDITOR_FRAME_TYPE:
return ((PCB_BASE_FRAME*)GetParent())->m_ModuleViewerFrame;
break;
case MODULE_VIEWER_FRAME_TYPE:
return (FOOTPRINT_VIEWER_FRAME *)this;
break;
default:
break;
}
return NULL;
}
...@@ -304,14 +304,13 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -304,14 +304,13 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
BLOCK_SELECTOR* block;
BASE_SCREEN* screen = aPanel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
BOARD_ITEM* item; FOOTPRINT_EDIT_FRAME * moduleEditFrame = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor();
wxPoint move_offset;
MODULE* currentModule =
( (PCB_BASE_FRAME*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules;
block = &screen->m_BlockLocate; wxASSERT( moduleEditFrame );
MODULE* currentModule = moduleEditFrame->GetBoard()->m_Modules;
BLOCK_SELECTOR* block = &screen->m_BlockLocate;
GRSetDrawMode( aDC, g_XorMode ); GRSetDrawMode( aDC, g_XorMode );
if( aErase ) if( aErase )
...@@ -320,9 +319,8 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -320,9 +319,8 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( currentModule ) if( currentModule )
{ {
move_offset.x = -block->GetMoveVector().x; wxPoint move_offset = -block->GetMoveVector();
move_offset.y = -block->GetMoveVector().y; BOARD_ITEM* item = currentModule->m_Drawings;
item = currentModule->m_Drawings;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
...@@ -360,8 +358,8 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -360,8 +358,8 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( currentModule ) if( currentModule )
{ {
item = currentModule->m_Drawings; BOARD_ITEM* item = currentModule->m_Drawings;
move_offset = - block->GetMoveVector(); wxPoint move_offset = - block->GetMoveVector();
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
......
...@@ -189,40 +189,42 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -189,40 +189,42 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_OPEN_MODULE_EDITOR: case ID_OPEN_MODULE_EDITOR:
if( m_ModuleEditFrame == NULL )
{ {
m_ModuleEditFrame = new FOOTPRINT_EDIT_FRAME( this, FOOTPRINT_EDIT_FRAME * editorFrame =
_( "Module Editor" ), FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor();
wxPoint( -1, -1 ), if( editorFrame == NULL )
wxSize( 600, 400 ) ); {
m_ModuleEditFrame->Show( true ); editorFrame = new FOOTPRINT_EDIT_FRAME( this );
m_ModuleEditFrame->Zoom_Automatique( false ); editorFrame->Show( true );
editorFrame->Zoom_Automatique( false );
} }
else else
{ {
if( m_ModuleEditFrame->IsIconized() ) if( editorFrame->IsIconized() )
m_ModuleEditFrame->Iconize( false ); editorFrame->Iconize( false );
m_ModuleEditFrame->Raise(); editorFrame->Raise();
// Raising the window does not set the focus on Linux. This should work on // Raising the window does not set the focus on Linux. This should work on
// any platform. // any platform.
if( wxWindow::FindFocus() != m_ModuleEditFrame ) if( wxWindow::FindFocus() != editorFrame )
m_ModuleEditFrame->SetFocus(); editorFrame->SetFocus();
}
} }
break; break;
case ID_OPEN_MODULE_VIEWER: case ID_OPEN_MODULE_VIEWER:
if( GetActiveViewerFrame() == NULL )
{ {
m_ModuleViewerFrame = new FOOTPRINT_VIEWER_FRAME( this, NULL ); FOOTPRINT_VIEWER_FRAME * viewer =
m_ModuleViewerFrame->Show( true ); FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer();
m_ModuleViewerFrame->Zoom_Automatique( false ); if( viewer == NULL )
{
viewer = new FOOTPRINT_VIEWER_FRAME( this, NULL );
viewer->Show( true );
viewer->Zoom_Automatique( false );
} }
else else
{ {
FOOTPRINT_VIEWER_FRAME * viewer = GetActiveViewerFrame();
if( viewer->IsIconized() ) if( viewer->IsIconized() )
viewer->Iconize( false ); viewer->Iconize( false );
...@@ -233,6 +235,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -233,6 +235,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( wxWindow::FindFocus() != viewer ) if( wxWindow::FindFocus() != viewer )
viewer->SetFocus(); viewer->SetFocus();
} }
}
break; break;
case ID_PCB_GLOBAL_DELETE: case ID_PCB_GLOBAL_DELETE:
......
...@@ -39,19 +39,16 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) ...@@ -39,19 +39,16 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
if( retvalue == 2 ) if( retvalue == 2 )
{ {
if( m_ModuleEditFrame == NULL ) FOOTPRINT_EDIT_FRAME * editorFrame =
{ FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor();
m_ModuleEditFrame = new FOOTPRINT_EDIT_FRAME( this, if( editorFrame == NULL )
_( "Module Editor" ), editorFrame = new FOOTPRINT_EDIT_FRAME( this );
wxPoint( -1, -1 ),
wxSize( 600, 400 ) );
}
m_ModuleEditFrame->Load_Module_From_BOARD( Module ); editorFrame->Load_Module_From_BOARD( Module );
SetCurItem( NULL ); SetCurItem( NULL );
m_ModuleEditFrame->Show( true ); editorFrame->Show( true );
m_ModuleEditFrame->Iconize( false ); editorFrame->Iconize( false );
} }
} }
......
...@@ -105,17 +105,19 @@ static wxAcceleratorEntry accels[] = ...@@ -105,17 +105,19 @@ static wxAcceleratorEntry accels[] =
/* Function FOOTPRINT_WIZARD_FRAME /* Function FOOTPRINT_WIZARD_FRAME
* it's the constructor for the footprint wizard frame, it creates everything inside * it's the constructor for the footprint wizard frame, it creates everything inside
*
*/ */
#define FOOTPRINT_WIZARD_FRAME_NAME wxT( "FootprintWizard" )
FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent, FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( FOOTPRINT_EDIT_FRAME* parent,
wxSemaphore* semaphore, long style ) : wxSemaphore* semaphore, long style ) :
PCB_BASE_FRAME( parent, FOOTPRINT_WIZARD_FRAME_TYPE, PCB_BASE_FRAME( parent, FOOTPRINT_WIZARD_FRAME_TYPE,
_( "Footprint Wizard" ), _( "Footprint Wizard" ),
wxDefaultPosition, wxDefaultSize, style ) wxDefaultPosition, wxDefaultSize, style, FOOTPRINT_WIZARD_FRAME_NAME )
{ {
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
m_FrameName = wxT( "FootprintWizard" ); m_FrameName = FOOTPRINT_WIZARD_FRAME_NAME;
m_configPath = wxT( "FootprintWizard" ); m_configPath = wxT( "FootprintWizard" );
m_showAxis = true; // true to draw axis. m_showAxis = true; // true to draw axis.
......
...@@ -38,6 +38,7 @@ class wxListBox; ...@@ -38,6 +38,7 @@ class wxListBox;
class wxSemaphore; class wxSemaphore;
class wxGrid; class wxGrid;
class wxGridEvent; class wxGridEvent;
class FOOTPRINT_EDIT_FRAME;
/** /**
......
...@@ -117,18 +117,13 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void ) ...@@ -117,18 +117,13 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void )
wxSemaphore semaphore( 0, 1 ); wxSemaphore semaphore( 0, 1 );
// Close the current Lib browser, if opened, and open a new one, in "modal" mode: // Close the current Lib browser, if opened, and open a new one, in "modal" mode:
FOOTPRINT_VIEWER_FRAME * viewer = GetActiveViewerFrame(); FOOTPRINT_VIEWER_FRAME * viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer();
if( viewer ) if( viewer )
{
viewer->Destroy(); viewer->Destroy();
// Clear the 2 existing references
m_ModuleViewerFrame = NULL;
if( m_ModuleEditFrame )
m_ModuleEditFrame->m_ModuleViewerFrame = NULL;
}
m_ModuleViewerFrame = new FOOTPRINT_VIEWER_FRAME( this, &semaphore, viewer = new FOOTPRINT_VIEWER_FRAME( this, &semaphore,
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT ); KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
// Show the library viewer frame until it is closed // Show the library viewer frame until it is closed
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
...@@ -137,8 +132,8 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void ) ...@@ -137,8 +132,8 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void )
wxMilliSleep( 50 ); wxMilliSleep( 50 );
} }
wxString fpname = m_ModuleViewerFrame->GetSelectedFootprint(); wxString fpname = viewer->GetSelectedFootprint();
m_ModuleViewerFrame->Destroy(); viewer->Destroy();
return fpname; return fpname;
} }
......
...@@ -55,6 +55,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() ...@@ -55,6 +55,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
delete menuBar->Remove( 0 ); delete menuBar->Remove( 0 );
// Recreate all menus: // Recreate all menus:
wxString text;
// Menu File: // Menu File:
wxMenu* fileMenu = new wxMenu; wxMenu* fileMenu = new wxMenu;
...@@ -99,8 +100,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() ...@@ -99,8 +100,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
// Save module // Save module
AddMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBMODULE, text = AddHotkeyName( _( "&Save Module in Active Library" ),
_( "&Save Module in Active Library" ), s_Libedit_Hokeys_Descr, HK_SAVE_LIB );
AddMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBMODULE, text,
_( "Save module in active library" ), _( "Save module in active library" ),
KiBitmap( save_library_xpm ) ); KiBitmap( save_library_xpm ) );
...@@ -136,13 +138,15 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() ...@@ -136,13 +138,15 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
wxMenu* editMenu = new wxMenu; wxMenu* editMenu = new wxMenu;
// Undo // Undo
text = AddHotkeyName( _( "&Undo" ), s_Libedit_Hokeys_Descr, HK_UNDO );
AddMenuItem( editMenu, wxID_UNDO, AddMenuItem( editMenu, wxID_UNDO,
_( "&Undo" ), _( "Undo last edit" ), text, _( "Undo last edit" ),
KiBitmap( undo_xpm ) ); KiBitmap( undo_xpm ) );
// Redo // Redo
text = AddHotkeyName( _( "&Redo" ), s_Libedit_Hokeys_Descr, HK_REDO );
AddMenuItem( editMenu, wxID_REDO, AddMenuItem( editMenu, wxID_REDO,
_( "&Redo" ), _( "Redo the last undo action" ), text, _( "Redo the last undo action" ),
KiBitmap( redo_xpm ) ); KiBitmap( redo_xpm ) );
// Delete items // Delete items
......
...@@ -231,15 +231,16 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -231,15 +231,16 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_OPEN_MODULE_VIEWER: case ID_OPEN_MODULE_VIEWER:
if( GetActiveViewerFrame() == NULL )
{ {
m_ModuleViewerFrame = new FOOTPRINT_VIEWER_FRAME( this, NULL ); FOOTPRINT_VIEWER_FRAME * viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer();
m_ModuleViewerFrame->Show( true ); if( viewer == NULL )
m_ModuleViewerFrame->Zoom_Automatique( false ); {
viewer = new FOOTPRINT_VIEWER_FRAME( this, NULL );
viewer->Show( true );
viewer->Zoom_Automatique( false );
} }
else else
{ {
FOOTPRINT_VIEWER_FRAME * viewer = GetActiveViewerFrame();
if( viewer->IsIconized() ) if( viewer->IsIconized() )
viewer->Iconize( false ); viewer->Iconize( false );
...@@ -250,6 +251,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -250,6 +251,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( wxWindow::FindFocus() != viewer ) if( wxWindow::FindFocus() != viewer )
viewer->SetFocus(); viewer->SetFocus();
} }
}
break; break;
case ID_MODEDIT_DELETE_PART: case ID_MODEDIT_DELETE_PART:
......
...@@ -14,13 +14,24 @@ public: ...@@ -14,13 +14,24 @@ public:
MODULE* CurrentModule; MODULE* CurrentModule;
public: public:
FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent, FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent );
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~FOOTPRINT_EDIT_FRAME(); ~FOOTPRINT_EDIT_FRAME();
/**
* Function GetFootprintEditorFrameName (static)
* @return the frame name used when creating the frame
* used to get a reference to this frame, if exists
*/
static const wxChar* GetFootprintEditorFrameName();
/**
* Function GetActiveFootprintEditor (static)
* @return a reference to the current opened Footprint editor
* or NULL if no Footprint editor currently opened
*/
static FOOTPRINT_EDIT_FRAME* GetActiveFootprintEditor();
BOARD_DESIGN_SETTINGS& GetDesignSettings() const; // overload PCB_BASE_FRAME, get parent's BOARD_DESIGN_SETTINGS& GetDesignSettings() const; // overload PCB_BASE_FRAME, get parent's
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings ); // overload void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings ); // overload
......
...@@ -142,15 +142,14 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -142,15 +142,14 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
END_EVENT_TABLE() END_EVENT_TABLE()
#define FOOTPRINT_EDIT_FRAME_NAME wxT( "ModEditFrame" )
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent, FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent ) :
const wxString& title, PCB_BASE_FRAME( aParent, MODULE_EDITOR_FRAME_TYPE, wxEmptyString,
const wxPoint& pos, wxDefaultPosition, wxDefaultSize,
const wxSize& size, KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() )
long style ) :
PCB_BASE_FRAME( aParent, MODULE_EDITOR_FRAME_TYPE, wxEmptyString, pos, size, style )
{ {
m_FrameName = wxT( "ModEditFrame" ); m_FrameName = GetFootprintEditorFrameName();
m_showBorderAndTitleBlock = false; // true to show the frame references m_showBorderAndTitleBlock = false; // true to show the frame references
m_showAxis = true; // true to show X and Y axis on screen m_showAxis = true; // true to show X and Y axis on screen
m_showGridAxis = true; // show the grid origin axis m_showGridAxis = true; // show the grid origin axis
...@@ -161,6 +160,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent, ...@@ -161,6 +160,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent,
icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) ); icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
SetIcon( icon ); SetIcon( icon );
// Show a title (frame title + footprint name):
UpdateTitle(); UpdateTitle();
if( !s_Pcb ) if( !s_Pcb )
...@@ -234,9 +234,6 @@ FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME() ...@@ -234,9 +234,6 @@ FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME()
// Do not delete PCB_SCREEN (by the destructor of EDA_DRAW_FRAME) // Do not delete PCB_SCREEN (by the destructor of EDA_DRAW_FRAME)
SetScreen( NULL ); SetScreen( NULL );
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) GetParent();
frame->m_ModuleEditFrame = NULL;
// Do not allow PCB_BASE_FRAME::~PCB_BASE_FRAME() // Do not allow PCB_BASE_FRAME::~PCB_BASE_FRAME()
// to delete our precious BOARD, which is also in static FOOTPRINT_EDIT_FRAME::s_Pcb. // to delete our precious BOARD, which is also in static FOOTPRINT_EDIT_FRAME::s_Pcb.
// That function, PCB_BASE_FRAME::~PCB_BASE_FRAME(), runs immediately next // That function, PCB_BASE_FRAME::~PCB_BASE_FRAME(), runs immediately next
...@@ -244,6 +241,19 @@ FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME() ...@@ -244,6 +241,19 @@ FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME()
m_Pcb = 0; m_Pcb = 0;
} }
const wxChar* FOOTPRINT_EDIT_FRAME::GetFootprintEditorFrameName()
{
return FOOTPRINT_EDIT_FRAME_NAME;
}
/* return a reference to the current opened Footprint editor
* or NULL if no Footprint editor currently opened
*/
FOOTPRINT_EDIT_FRAME* FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor()
{
return (FOOTPRINT_EDIT_FRAME*)
wxWindow::FindWindowByName(GetFootprintEditorFrameName());
}
BOARD_DESIGN_SETTINGS& FOOTPRINT_EDIT_FRAME::GetDesignSettings() const BOARD_DESIGN_SETTINGS& FOOTPRINT_EDIT_FRAME::GetDesignSettings() const
{ {
......
...@@ -107,15 +107,16 @@ static wxAcceleratorEntry accels[] = ...@@ -107,15 +107,16 @@ static wxAcceleratorEntry accels[] =
#define EXTRA_BORDER_SIZE 2 #define EXTRA_BORDER_SIZE 2
#define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" )
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* parent, FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* parent,
wxSemaphore* semaphore, long style ) : wxSemaphore* semaphore, long style ) :
PCB_BASE_FRAME( parent, MODULE_VIEWER_FRAME_TYPE, _( "Footprint Library Browser" ), PCB_BASE_FRAME( parent, MODULE_VIEWER_FRAME_TYPE, _( "Footprint Library Browser" ),
wxDefaultPosition, wxDefaultSize, style ) wxDefaultPosition, wxDefaultSize, style, GetFootprintViewerFrameName() )
{ {
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
m_FrameName = wxT( "ModViewFrame" ); m_FrameName = GetFootprintViewerFrameName();
m_configPath = wxT( "FootprintViewer" ); m_configPath = wxT( "FootprintViewer" );
m_showAxis = true; // true to draw axis. m_showAxis = true; // true to draw axis.
...@@ -264,8 +265,23 @@ FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME() ...@@ -264,8 +265,23 @@ FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME()
{ {
if( m_Draw3DFrame ) if( m_Draw3DFrame )
m_Draw3DFrame->Destroy(); m_Draw3DFrame->Destroy();
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) GetParent(); }
frame->m_ModuleViewerFrame = NULL;
/* return the frame name used when creating the frame
* used to get a reference to this frame, if exists
*/
const wxChar* FOOTPRINT_VIEWER_FRAME::GetFootprintViewerFrameName()
{
return FOOTPRINT_VIEWER_FRAME_NAME;
}
/* return a reference to the current opened Footprint viewer
* or NULL if no Footprint viewer currently opened
*/
FOOTPRINT_VIEWER_FRAME* FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer()
{
return (FOOTPRINT_VIEWER_FRAME*)
wxWindow::FindWindowByName(GetFootprintViewerFrameName());
} }
...@@ -281,9 +297,7 @@ void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -281,9 +297,7 @@ void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event )
// to avoid side effects // to avoid side effects
} }
else else
{
Destroy(); Destroy();
}
} }
......
...@@ -69,6 +69,20 @@ public: ...@@ -69,6 +69,20 @@ public:
~FOOTPRINT_VIEWER_FRAME(); ~FOOTPRINT_VIEWER_FRAME();
/**
* Function GetFootprintViewerFrameName (static)
* @return the frame name used when creating the frame
* used to get a reference to this frame, if exists
*/
static const wxChar* GetFootprintViewerFrameName();
/**
* Function GetActiveFootprintViewer (static)
* @return a reference to the current opened Footprint viewer
* or NULL if no Footprint viewer currently opened
*/
static FOOTPRINT_VIEWER_FRAME* GetActiveFootprintViewer();
wxString& GetSelectedFootprint( void ) const { return m_selectedFootprintName; } wxString& GetSelectedFootprint( void ) const { return m_selectedFootprintName; }
private: private:
......
...@@ -264,13 +264,15 @@ END_EVENT_TABLE() ...@@ -264,13 +264,15 @@ END_EVENT_TABLE()
///////****************************///////////: ///////****************************///////////:
#define PCB_EDIT_FRAME_NAME wxT( "PcbFrame" )
PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style ) : long style ) :
PCB_BASE_FRAME( parent, PCB_FRAME_TYPE, title, pos, size, style ) PCB_BASE_FRAME( parent, PCB_FRAME_TYPE, title, pos, size,
style, PCB_EDIT_FRAME_NAME )
{ {
m_FrameName = wxT( "PcbFrame" ); m_FrameName = PCB_EDIT_FRAME_NAME;
m_showBorderAndTitleBlock = true; // true to display sheet references m_showBorderAndTitleBlock = true; // true to display sheet references
m_showAxis = false; // true to display X and Y axis m_showAxis = false; // true to display X and Y axis
m_showOriginAxis = true; m_showOriginAxis = true;
...@@ -719,8 +721,9 @@ void PCB_EDIT_FRAME::SetLanguage( wxCommandEvent& event ) ...@@ -719,8 +721,9 @@ void PCB_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
m_auimgr.Update(); m_auimgr.Update();
ReFillLayerWidget(); ReFillLayerWidget();
if( m_ModuleEditFrame ) FOOTPRINT_EDIT_FRAME * moduleEditFrame = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor();
m_ModuleEditFrame->EDA_DRAW_FRAME::SetLanguage( event ); if( moduleEditFrame )
moduleEditFrame->EDA_DRAW_FRAME::SetLanguage( event );
} }
......
...@@ -73,12 +73,12 @@ void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int Layer, ...@@ -73,12 +73,12 @@ void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int Layer,
* @param aLayerMask = the mask to define the layers to plot * @param aLayerMask = the mask to define the layers to plot
* @param aPlotVia = true to plot vias, false to skip vias (has meaning * @param aPlotVia = true to plot vias, false to skip vias (has meaning
* only for solder mask layers). * only for solder mask layers).
* @param aPlotMode = the plot mode (files, sketch). Has meaning for some formats only * @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only
* @param aSkipNPTH_Pads = true to skip NPTH Pads, when the pad size and the pad hole * @param aSkipNPTH_Pads = true to skip NPTH Pads, when the pad size and the pad hole
* have the same size. Used in GERBER format only. * have the same size. Used in GERBER format only.
*/ */
void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
const PCB_PLOT_PARAMS& plot_opts, const PCB_PLOT_PARAMS& aPlotOpt,
bool aPlotVia, bool aSkipNPTH_Pads ); bool aPlotVia, bool aSkipNPTH_Pads );
void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
......
...@@ -103,7 +103,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, ...@@ -103,7 +103,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
break; break;
case PAD_OVAL: case PAD_OVAL:
aPlotter->FlashPadOval( shape_pos, pad->GetSize(), aPlotter->FlashPadOval( shape_pos, pad->GetSize(),
pad->GetOrientation(), LINE ); pad->GetOrientation(), LINE );
break; break;
...@@ -111,14 +111,14 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, ...@@ -111,14 +111,14 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
{ {
wxPoint coord[4]; wxPoint coord[4];
pad->BuildPadPolygon( coord, wxSize(0,0), 0 ); pad->BuildPadPolygon( coord, wxSize(0,0), 0 );
aPlotter->FlashPadTrapez( shape_pos, coord, aPlotter->FlashPadTrapez( shape_pos, coord,
pad->GetOrientation(), LINE ); pad->GetOrientation(), LINE );
} }
break; break;
case PAD_RECT: case PAD_RECT:
default: default:
aPlotter->FlashPadRect( shape_pos, pad->GetSize(), aPlotter->FlashPadRect( shape_pos, pad->GetSize(),
pad->GetOrientation(), LINE ); pad->GetOrientation(), LINE );
break; break;
} }
...@@ -745,14 +745,14 @@ void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int Layer, ...@@ -745,14 +745,14 @@ void PlotBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int Layer,
* Silk screen layers are not plotted here. * Silk screen layers are not plotted here.
*/ */
void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
long aLayerMask, const PCB_PLOT_PARAMS& plot_opts, long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt,
bool aPlotVia, bool aSkipNPTH_Pads ) bool aPlotVia, bool aSkipNPTH_Pads )
{ {
wxPoint pos; wxPoint pos;
wxSize size; wxSize size;
wxString msg; wxString msg;
EDA_DRAW_MODE_T aPlotMode = plot_opts.GetMode(); EDA_DRAW_MODE_T aPlotMode = aPlotOpt.GetMode();
// Plot pcb draw items. // Plot pcb draw items.
for( BOARD_ITEM* item = aBoard->m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = aBoard->m_Drawings; item; item = item->Next() )
...@@ -760,19 +760,19 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -760,19 +760,19 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_LINE_T: case PCB_LINE_T:
PlotDrawSegment( aPlotter, plot_opts, (DRAWSEGMENT*) item, aLayerMask, aPlotMode ); PlotDrawSegment( aPlotter, aPlotOpt, (DRAWSEGMENT*) item, aLayerMask, aPlotMode );
break; break;
case PCB_TEXT_T: case PCB_TEXT_T:
PlotTextePcb( aPlotter, plot_opts, (TEXTE_PCB*) item, aLayerMask, aPlotMode ); PlotTextePcb( aPlotter, aPlotOpt, (TEXTE_PCB*) item, aLayerMask, aPlotMode );
break; break;
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
PlotDimension( aPlotter, plot_opts, (DIMENSION*) item, aLayerMask, aPlotMode ); PlotDimension( aPlotter, aPlotOpt, (DIMENSION*) item, aLayerMask, aPlotMode );
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:
PlotPcbTarget( aPlotter, plot_opts, (PCB_TARGET*) item, aLayerMask, aPlotMode ); PlotPcbTarget( aPlotter, aPlotOpt, (PCB_TARGET*) item, aLayerMask, aPlotMode );
break; break;
case PCB_MARKER_T: case PCB_MARKER_T:
...@@ -793,7 +793,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -793,7 +793,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
{ {
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
if( aLayerMask & GetLayerMask( item->GetLayer() ) ) if( aLayerMask & GetLayerMask( item->GetLayer() ) )
Plot_1_EdgeModule( aPlotter, plot_opts, (EDGE_MODULE*) item, aPlotMode, aLayerMask ); Plot_1_EdgeModule( aPlotter, aPlotOpt, (EDGE_MODULE*) item, aPlotMode, aLayerMask );
break; break;
...@@ -973,7 +973,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -973,7 +973,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 ) if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
continue; continue;
PlotFilledAreas( aPlotter, plot_opts, edge_zone, aPlotMode ); PlotFilledAreas( aPlotter, aPlotOpt, edge_zone, aPlotMode );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment