Commit fa470d5c authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Added: modview. This footprint viewer frame which has the same purpose...

Pcbnew: Added: modview. This footprint viewer frame which has the same purpose as Viewlib in Eeschema.
this viewer is built using the new  FOOTPRINT_VIEWER_FRAME class.
parent 54e221cf
...@@ -72,11 +72,11 @@ END_EVENT_TABLE() ...@@ -72,11 +72,11 @@ END_EVENT_TABLE()
/* DISPLAY_FOOTPRINTS_FRAME: the frame to display the current focused footprint */ /* DISPLAY_FOOTPRINTS_FRAME: the frame to display the current focused footprint */
/***************************************************************************/ /***************************************************************************/
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father, 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( father, CVPCB_DISPLAY_FRAME, title, pos, size, style ) PCB_BASE_FRAME( parent, CVPCB_DISPLAY_FRAME, title, pos, size, style )
{ {
m_FrameName = wxT( "CmpFrame" ); m_FrameName = wxT( "CmpFrame" );
m_showAxis = true; // true to draw axis. m_showAxis = true; // true to draw axis.
...@@ -146,7 +146,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father, ...@@ -146,7 +146,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME() DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
{ {
delete GetScreen(); delete GetScreen();
SetScreen( NULL ); SetScreen( NULL ); // Be sure there is no double deletion
( (CVPCB_MAINFRAME*) wxGetApp().GetTopWindow() )->m_DisplayFootprintFrame = NULL; ( (CVPCB_MAINFRAME*) wxGetApp().GetTopWindow() )->m_DisplayFootprintFrame = NULL;
} }
......
...@@ -434,7 +434,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer ) ...@@ -434,7 +434,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
// ( i.e. for labels that are not prefixed by a sheetpath) // ( i.e. for labels that are not prefixed by a sheetpath)
#define NET_PRIO_MAX 4 #define NET_PRIO_MAX 4
int priority_order[NET_PRIO_MAX+1] = { static int priority_order[NET_PRIO_MAX+1] = {
NET_ITEM_UNSPECIFIED, NET_ITEM_UNSPECIFIED,
NET_LABEL, NET_LABEL,
NET_HIERLABEL, NET_HIERLABEL,
...@@ -462,15 +462,14 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer ) ...@@ -462,15 +462,14 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
// Calculate candidate priority // Calculate candidate priority
int candidate_priority = 0; int candidate_priority = 0;
for( unsigned ii = 0; ii <= NET_PRIO_MAX; ii++ ) for( unsigned prio = 0; prio <= NET_PRIO_MAX; prio++ )
{ {
if ( candidate->m_Type == priority_order[ii] ) if ( candidate->m_Type == priority_order[prio] )
{ {
candidate_priority = ii; candidate_priority = prio;
break; break;
} }
} }
if( candidate_priority > item_priority ) if( candidate_priority > item_priority )
{ {
item = candidate; item = candidate;
...@@ -504,6 +503,11 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer ) ...@@ -504,6 +503,11 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
// alphabetic label name order: // alphabetic label name order:
if( candidate->m_Label.Cmp( item->m_Label ) < 0 ) if( candidate->m_Label.Cmp( item->m_Label ) < 0 )
item = candidate; item = candidate;
else if( candidate->m_Label.Cmp( item->m_Label ) == 0 )
{
if( candidate->m_SheetList.PathHumanReadable().Cmp( item->m_SheetList.PathHumanReadable() ) < 0 )
item = candidate;
}
} }
} }
} }
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
/* Forward declarations of classes. */ /* Forward declarations of classes. */
class FOOTPRINT_EDIT_FRAME; class FOOTPRINT_EDIT_FRAME;
class FOOTPRINT_VIEWER_FRAME;
class BOARD; class BOARD;
class BOARD_CONNECTED_ITEM; class BOARD_CONNECTED_ITEM;
class MODULE; class MODULE;
...@@ -81,6 +82,8 @@ public: ...@@ -81,6 +82,8 @@ public:
EDA_3D_FRAME* m_Draw3DFrame; EDA_3D_FRAME* m_Draw3DFrame;
FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame; FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame;
FOOTPRINT_VIEWER_FRAME * m_ModuleViewerFrame;
protected: protected:
BOARD* m_Pcb; BOARD* m_Pcb;
...@@ -393,7 +396,35 @@ public: ...@@ -393,7 +396,35 @@ public:
const wxString& aMask, const wxString& aMask,
const wxString& aKeyWord ); const wxString& aKeyWord );
MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC ); /**
* Function Load_Module_From_Library
* Open a dialog to select a footprint, and load in in current board
* @param aLibrary = the library name to use, or empty string to search
* in all loaded libraries
* @param aUseFootprintViewer = true to show the option
* allowing the footprint selection by the footprint viewer
* @param aDC (can be NULL ) = the current Device Context, to draw the new footprint
*/
MODULE* Load_Module_From_Library( const wxString& aLibrary,
bool aUseFootprintViewer = true,
wxDC* aDC = NULL );
/**
* SelectFootprintFromLibBrowser
* Launch the footprint viewer to select the name of a footprint to load.
* @return the selected footprint name
*/
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
/** /**
......
...@@ -94,6 +94,7 @@ enum id_drawframe { ...@@ -94,6 +94,7 @@ enum id_drawframe {
VIEWER_FRAME, VIEWER_FRAME,
PCB_FRAME, PCB_FRAME,
MODULE_EDITOR_FRAME, MODULE_EDITOR_FRAME,
MODULE_VIEWER_FRAME,
CVPCB_FRAME, CVPCB_FRAME,
CVPCB_DISPLAY_FRAME, CVPCB_DISPLAY_FRAME,
GERBER_FRAME, GERBER_FRAME,
......
...@@ -80,6 +80,9 @@ set(PCBNEW_DIALOGS ...@@ -80,6 +80,9 @@ set(PCBNEW_DIALOGS
) )
set(PCBNEW_SRCS set(PCBNEW_SRCS
tool_modview.cpp
modview.cpp
modview_frame.cpp
pcbframe.cpp pcbframe.cpp
attribut.cpp attribut.cpp
automove.cpp automove.cpp
......
...@@ -27,10 +27,6 @@ ...@@ -27,10 +27,6 @@
* @file basepcbframe.cpp * @file basepcbframe.cpp
*/ */
#ifdef __GNUG__
#pragma implementation
#endif
#include <fctsys.h> #include <fctsys.h>
#include <wxstruct.h> #include <wxstruct.h>
#include <pcbcommon.h> #include <pcbcommon.h>
...@@ -97,6 +93,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father, ...@@ -97,6 +93,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
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_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;
...@@ -752,3 +749,37 @@ void PCB_BASE_FRAME::updateZoomSelectBox() ...@@ -752,3 +749,37 @@ 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:
if( m_ModuleEditFrame )
return ((PCB_BASE_FRAME*)m_ModuleEditFrame)->m_ModuleViewerFrame;
break;
case MODULE_EDITOR_FRAME:
return ((PCB_BASE_FRAME*)GetParent())->m_ModuleViewerFrame;
break;
case MODULE_VIEWER_FRAME:
return (FOOTPRINT_VIEWER_FRAME *)this;
break;
default:
break;
}
return NULL;
}
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <pcbnew.h> #include <pcbnew.h>
#include <class_marker_pcb.h> #include <class_marker_pcb.h>
#include <layers_id_colors_and_visibility.h>
#define SCALING_FACTOR 30 // Adjust the actual size of markers, when using default shape #define SCALING_FACTOR 30 // Adjust the actual size of markers, when using default shape
...@@ -52,6 +53,17 @@ MARKER_PCB::~MARKER_PCB() ...@@ -52,6 +53,17 @@ MARKER_PCB::~MARKER_PCB()
{ {
} }
/* tests to see if this object is on the given layer.
* DRC markers are not really on a copper layer, but
* MARKER_PCB::IsOnCopperLayer return true if aLayer is a cooper layer,
* because this test is often used to locad a marker
* param aLayer The layer to test for.
* return bool - true if on given layer, else false.
*/
bool MARKER_PCB::IsOnLayer( int aLayer ) const
{
return IsValidCopperLayerIndex( aLayer );
}
void MARKER_PCB::DisplayInfo( EDA_DRAW_FRAME* frame ) void MARKER_PCB::DisplayInfo( EDA_DRAW_FRAME* frame )
{ {
......
...@@ -94,6 +94,16 @@ public: ...@@ -94,6 +94,16 @@ public:
return HitTestMarker( aPosRef ); return HitTestMarker( aPosRef );
} }
/**
* Function IsOnLayer
* tests to see if this object is on the given layer.
* DRC markers are not really on a copper layer, but
* IsOnCopperLayer return true if aLayer is a cooper layer
* @param aLayer The layer to test for.
* @return bool - true if on given layer, else false.
*/
virtual bool IsOnLayer( int aLayer ) const;
/** /**
* Function DisplayInfo * Function DisplayInfo
* has knowledge about the frame and how and where to put status information * has knowledge about the frame and how and where to put status information
......
...@@ -68,7 +68,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source ) ...@@ -68,7 +68,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
m_Orient = source->m_Orient; m_Orient = source->m_Orient;
m_Pos = source->m_Pos; m_Pos = source->m_Pos;
m_Layer = source->m_Layer; m_Layer = source->m_Layer;
m_Thickness = source->m_Thickness; m_Thickness = source->m_Thickness;
m_Attributs = source->m_Attributs; m_Attributs = source->m_Attributs;
m_Italic = source->m_Italic; m_Italic = source->m_Italic;
m_Bold = source->m_Bold; m_Bold = source->m_Bold;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <class_module.h> #include <class_module.h>
#include <class_pad.h> #include <class_pad.h>
#include <class_marker_pcb.h>
/* This module contains out of line member functions for classes given in /* This module contains out of line member functions for classes given in
...@@ -147,6 +148,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa ...@@ -147,6 +148,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
MODULE* module = NULL; MODULE* module = NULL;
D_PAD* pad = NULL; D_PAD* pad = NULL;
bool pad_through = false; bool pad_through = false;
MARKER_PCB* marker = NULL;
#if 0 // debugging #if 0 // debugging
static int breakhere = 0; static int breakhere = 0;
...@@ -210,6 +212,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa ...@@ -210,6 +212,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
} }
break; break;
case PCB_MARKER_T:
breakhere++;
break;
default: default:
breakhere++; breakhere++;
break; break;
...@@ -293,6 +299,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa ...@@ -293,6 +299,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
module = (MODULE*) item; module = (MODULE*) item;
break; break;
case PCB_MARKER_T:
marker = (MARKER_PCB*) item;
break;
default: default:
break; break;
} }
...@@ -326,6 +336,15 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa ...@@ -326,6 +336,15 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
} }
} }
if( marker )
{
// Markers are not sensitive to the layer
if( marker->HitTest( m_RefPos ) )
Append( item );
goto exit;
}
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() ) if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() )
{ {
int layer = item->GetLayer(); int layer = item->GetLayer();
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <class_module.h> #include <class_module.h>
#include <class_track.h> #include <class_track.h>
#include <class_zone.h> #include <class_zone.h>
#include <modview_frame.h>
#include <dialog_drc.h> #include <dialog_drc.h>
...@@ -207,6 +208,28 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -207,6 +208,28 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_OPEN_MODULE_VIEWER:
if( GetActiveViewerFrame() == NULL )
{
m_ModuleViewerFrame = new FOOTPRINT_VIEWER_FRAME( this, NULL );
m_ModuleViewerFrame->Show( true );
m_ModuleViewerFrame->Zoom_Automatique( false );
}
else
{
FOOTPRINT_VIEWER_FRAME * viewer = GetActiveViewerFrame();
if( viewer->IsIconized() )
viewer->Iconize( false );
viewer->Raise();
// Raising the window does not set the focus on Linux. This should work on
// any platform.
if( wxWindow::FindFocus() != viewer )
viewer->SetFocus();
}
break;
case ID_PCB_GLOBAL_DELETE: case ID_PCB_GLOBAL_DELETE:
InstallPcbGlobalDeleteFrame( pos ); InstallPcbGlobalDeleteFrame( pos );
break; break;
......
...@@ -258,3 +258,11 @@ struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[] = { ...@@ -258,3 +258,11 @@ struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[] = {
{ &g_ModuleEditSectionTag, module_edit_Hotkey_List, NULL }, { &g_ModuleEditSectionTag, module_edit_Hotkey_List, NULL },
{ NULL, NULL, NULL } { NULL, NULL, NULL }
}; };
// list of sections and corresponding hotkey list for the footprint viewer
// (used to list current hotkeys in the module viewer)
struct EDA_HOTKEY_CONFIG g_Module_Viewer_Hokeys_Descr[] = {
{ &g_CommonSectionTag, common_Hotkey_List, NULL },
{ NULL, NULL, NULL }
};
...@@ -88,6 +88,9 @@ extern struct EDA_HOTKEY_CONFIG g_Board_Editor_Hokeys_Descr[]; ...@@ -88,6 +88,9 @@ extern struct EDA_HOTKEY_CONFIG g_Board_Editor_Hokeys_Descr[];
// List of hotkey descriptors for the footprint editor only // List of hotkey descriptors for the footprint editor only
extern struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[];
// List of hotkey descriptors for the footprint editor only
extern struct EDA_HOTKEY_CONFIG g_Module_Viewer_Hokeys_Descr[];
// List of common hotkey descriptors // List of common hotkey descriptors
// used in hotkeys_board_editor.cpp and hotkeys_module_editor.cpp // used in hotkeys_board_editor.cpp and hotkeys_module_editor.cpp
extern EDA_HOTKEY* common_Hotkey_List[]; extern EDA_HOTKEY* common_Hotkey_List[];
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include <footprint_info.h> #include <footprint_info.h>
#include <class_footprint_library.h> #include <class_footprint_library.h>
#include <dialog_get_component.h> #include <dialog_get_component.h>
#include <modview_frame.h>
static void DisplayCmpDoc( wxString& Name ); static void DisplayCmpDoc( wxString& Name );
...@@ -105,8 +106,43 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) ...@@ -105,8 +106,43 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
return true; return true;
} }
/*
* Launch the footprint viewer to select the name of a footprint to load.
* return the selected footprint name
*/
wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser( void )
{
wxSemaphore semaphore( 0, 1 );
// Close the current Lib browser, if open, and open a new one, in "modal" mode:
FOOTPRINT_VIEWER_FRAME * viewer = GetActiveViewerFrame();
if( viewer )
{
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 );
// Show the library viewer frame until it is closed
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
{
wxYield();
wxMilliSleep( 50 );
}
wxString fpname = m_ModuleViewerFrame->GetSelectedFootprint();
m_ModuleViewerFrame->Destroy();
MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* DC ) return fpname;
}
MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
bool aUseFootprintViewer,
wxDC* aDC )
{ {
MODULE* module; MODULE* module;
wxPoint curspos = GetScreen()->GetCrossHairPosition(); wxPoint curspos = GetScreen()->GetCrossHairPosition();
...@@ -114,18 +150,25 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -114,18 +150,25 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
bool AllowWildSeach = true; bool AllowWildSeach = true;
static wxArrayString HistoryList; static wxArrayString HistoryList;
static wxString lastCommponentName; static wxString lastComponentName;
/* Ask for a component name or key words */ /* Ask for a component name or key words */
DIALOG_GET_COMPONENT dlg( this, GetComponentDialogPosition(), HistoryList, DIALOG_GET_COMPONENT dlg( this, GetComponentDialogPosition(), HistoryList,
_( "Place Module" ), false ); _( "Load Module" ), aUseFootprintViewer );
dlg.SetComponentName( lastCommponentName ); dlg.SetComponentName( lastComponentName );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return NULL; return NULL;
moduleName = dlg.GetComponentName(); if( dlg.m_GetExtraFunction )
{
moduleName = SelectFootprintFromLibBrowser();
}
else
{
moduleName = dlg.GetComponentName();
}
if( moduleName.IsEmpty() ) /* Cancel command */ if( moduleName.IsEmpty() ) /* Cancel command */
{ {
...@@ -139,7 +182,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -139,7 +182,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
{ {
AllowWildSeach = false; AllowWildSeach = false;
keys = moduleName.AfterFirst( '=' ); keys = moduleName.AfterFirst( '=' );
moduleName = Select_1_Module_From_List( this, library, wxEmptyString, keys ); moduleName = Select_1_Module_From_List( this, aLibrary, wxEmptyString, keys );
if( moduleName.IsEmpty() ) /* Cancel command */ if( moduleName.IsEmpty() ) /* Cancel command */
{ {
...@@ -151,7 +194,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -151,7 +194,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
|| ( moduleName.Contains( wxT( "*" ) ) ) ) // Selection wild card || ( moduleName.Contains( wxT( "*" ) ) ) ) // Selection wild card
{ {
AllowWildSeach = false; AllowWildSeach = false;
moduleName = Select_1_Module_From_List( this, library, moduleName, wxEmptyString ); moduleName = Select_1_Module_From_List( this, aLibrary, moduleName, wxEmptyString );
if( moduleName.IsEmpty() ) if( moduleName.IsEmpty() )
{ {
...@@ -160,14 +203,14 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -160,14 +203,14 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
} }
} }
module = GetModuleLibrary( library, moduleName, false ); module = GetModuleLibrary( aLibrary, moduleName, false );
if( ( module == NULL ) && AllowWildSeach ) /* Search with wild card */ if( ( module == NULL ) && AllowWildSeach ) /* Search with wild card */
{ {
AllowWildSeach = false; AllowWildSeach = false;
wxString wildname = wxChar( '*' ) + moduleName + wxChar( '*' ); wxString wildname = wxChar( '*' ) + moduleName + wxChar( '*' );
moduleName = wildname; moduleName = wildname;
moduleName = Select_1_Module_From_List( this, library, moduleName, wxEmptyString ); moduleName = Select_1_Module_From_List( this, aLibrary, moduleName, wxEmptyString );
if( moduleName.IsEmpty() ) if( moduleName.IsEmpty() )
{ {
...@@ -176,7 +219,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -176,7 +219,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
} }
else else
{ {
module = GetModuleLibrary( library, moduleName, true ); module = GetModuleLibrary( aLibrary, moduleName, true );
} }
} }
...@@ -185,7 +228,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -185,7 +228,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
if( module ) if( module )
{ {
lastCommponentName = moduleName; lastComponentName = moduleName;
AddHistoryComponentName( HistoryList, moduleName ); AddHistoryComponentName( HistoryList, moduleName );
module->SetFlags( IS_NEW ); module->SetFlags( IS_NEW );
...@@ -204,8 +247,8 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* ...@@ -204,8 +247,8 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
RecalculateAllTracksNetcode(); RecalculateAllTracksNetcode();
if( DC ) if( aDC )
module->Draw( m_canvas, DC, GR_OR ); module->Draw( m_canvas, aDC, GR_OR );
} }
return module; return module;
...@@ -220,6 +263,7 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename, ...@@ -220,6 +263,7 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename,
wxString msg, tmp; wxString msg, tmp;
MODULE* newModule; MODULE* newModule;
FILE* file = NULL; FILE* file = NULL;
bool error_set = false;
bool one_lib = aLibraryFullFilename.IsEmpty() ? false : true; bool one_lib = aLibraryFullFilename.IsEmpty() ? false : true;
...@@ -234,11 +278,12 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename, ...@@ -234,11 +278,12 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename,
if( !tmp ) if( !tmp )
{ {
if( aDisplayMessageError ) if( aDisplayMessageError && !error_set )
{ {
msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ), msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ),
GetChars( fn.GetFullName() ) ); GetChars( fn.GetFullName() ) );
wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, this ); wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, this );
error_set = true;
} }
continue; continue;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <protos.h> #include <protos.h>
#include <pcbnew_id.h> #include <pcbnew_id.h>
#include <module_editor_frame.h> #include <module_editor_frame.h>
#include <modview_frame.h>
#include <collectors.h> #include <collectors.h>
#include <dialog_edit_module_for_Modedit.h> #include <dialog_edit_module_for_Modedit.h>
...@@ -216,6 +217,28 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -216,6 +217,28 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Select_Active_Library(); Select_Active_Library();
break; break;
case ID_OPEN_MODULE_VIEWER:
if( GetActiveViewerFrame() == NULL )
{
m_ModuleViewerFrame = new FOOTPRINT_VIEWER_FRAME( this, NULL );
m_ModuleViewerFrame->Show( true );
m_ModuleViewerFrame->Zoom_Automatique( false );
}
else
{
FOOTPRINT_VIEWER_FRAME * viewer = GetActiveViewerFrame();
if( viewer->IsIconized() )
viewer->Iconize( false );
viewer->Raise();
// Raising the window does not set the focus on Linux. This should work on
// any platform.
if( wxWindow::FindFocus() != viewer )
viewer->SetFocus();
}
break;
case ID_MODEDIT_DELETE_PART: case ID_MODEDIT_DELETE_PART:
{ {
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension ); wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
......
This diff is collapsed.
...@@ -66,6 +66,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -66,6 +66,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_OPEN_MODULE_VIEWER, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_DELETE_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_NEW_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_NEW_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_LOAD_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
......
/**
* @file viewlibs.cpp
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <wxPcbStruct.h>
#include <dialog_helpers.h>
#include <3d_viewer.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_module.h>
#include <class_footprint_library.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <modview_frame.h>
#define NEXT_PART 1
#define NEW_PART 0
#define PREVIOUS_PART -1
void FOOTPRINT_VIEWER_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
wxString msg;
switch( event.GetId() )
{
case ID_MODVIEW_NEXT:
SelectAndViewFootprint( NEXT_PART );
break;
case ID_MODVIEW_PREVIOUS:
SelectAndViewFootprint( PREVIOUS_PART );
break;
default:
msg << wxT( "FOOTPRINT_VIEWER_FRAME::Process_Special_Functions error: id = " )
<< event.GetId();
wxMessageBox( msg );
break;
}
}
void FOOTPRINT_VIEWER_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
}
bool FOOTPRINT_VIEWER_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
{
return true;
}
/* Displays the name of the current opened library in the caption */
void FOOTPRINT_VIEWER_FRAME::DisplayLibInfos()
{
wxString msg;
msg = _( "Library Browser" );
msg << wxT( " [" );
if( ! m_libraryName.IsEmpty() )
msg << m_libraryName;
else
msg += _( "no library selected" );
msg << wxT( "]" );
SetTitle( msg );
}
void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event )
{
wxString msg;
if( g_LibraryNames.GetCount() == 0 )
return;
EDA_LIST_DIALOG dlg( this, _( "Select Current Library:" ),
g_LibraryNames, m_libraryName );
if( dlg.ShowModal() != wxID_OK )
return;
if( m_libraryName == dlg.GetTextSelection() )
return;
m_libraryName = dlg.GetTextSelection();
m_footprintName.Empty();
DisplayLibInfos();
ReCreateFootprintList();
int id = m_LibList->FindString( m_libraryName );
if( id >= 0 )
m_LibList->SetSelection( id );
}
/**
* Function SelectCurrentFootprint
* Selects the current footprint name and display it
*/
void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
{
wxString libname = m_libraryName + wxT(".") + ModuleFileExtension;
MODULE* oldmodule = GetBoard()->m_Modules;
MODULE * module = Load_Module_From_Library( libname, false );
if( module )
{
module->SetPosition( wxPoint( 0, 0 ) );
// Only one fotprint allowed: remove the previous footprint (if exists)
if( oldmodule )
{
GetBoard()->Remove( oldmodule );
delete oldmodule;
}
m_footprintName = module->GetLibRef();
module->ClearFlags();
SetCurItem( NULL );
}
Zoom_Automatique( false );
m_canvas->Refresh( );
}
/* Routine to view one selected library content. */
void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
{
if( m_libraryName.IsEmpty() )
return;
int selection = m_FootprintList->FindString( m_footprintName );
if( aMode == NEXT_PART )
{
if( selection != wxNOT_FOUND && selection < (int)m_FootprintList->GetCount()-1 )
selection++;
}
if( aMode == PREVIOUS_PART )
{
if( selection != wxNOT_FOUND && selection > 0)
selection--;
}
if( selection != wxNOT_FOUND )
{
m_footprintName = m_FootprintList->GetString( selection );
SetCurItem( NULL );
// Delete the current footprint
GetBoard()->m_Modules.DeleteAll();
GetModuleLibrary( m_libraryName + wxT(".") + ModuleFileExtension,
m_footprintName, true );
}
DisplayLibInfos();
Zoom_Automatique( false );
m_canvas->Refresh( );
}
/**
* Function RedrawActiveWindow
* Display the current selected component.
* If the component is an alias, the ROOT component is displayed
*/
void FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
if( !GetBoard() )
return;
m_canvas->DrawBackGround( DC );
GetBoard()->Draw( m_canvas, DC, GR_COPY );
MODULE* module = GetBoard()->m_Modules;
if ( module )
module->DisplayInfo( this );
m_canvas->DrawCrossHair( DC );
ClearMsgPanel();
if( module )
module->DisplayInfo( this );
}
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file modview_frame.h
*/
#ifndef MODVIEWFRM_H_
#define MODVIEWFRM_H_
#include <wx/gdicmn.h>
class wxSashLayoutWindow;
class wxListBox;
class wxSemaphore;
class FOOTPRINT_LIBRARY;
/**
* Component library viewer main window.
*/
class FOOTPRINT_VIEWER_FRAME : public PCB_BASE_FRAME
{
private:
// List of libraries (for selection )
wxSashLayoutWindow* m_LibListWindow;
wxListBox* m_LibList; // The list of libs names
wxSize m_LibListSize; // size of the window
// List of components in the selected library
wxSashLayoutWindow* m_FootprintListWindow;
wxListBox* m_FootprintList; // The list of footprint names
wxSize m_FootprintListSize; // size of the window
// Flags
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
wxString m_configPath; // subpath for configuration
protected:
static wxString m_libraryName; // Current selected libary
static wxString m_footprintName; // Current selected footprint
static wxString m_selectedFootprintName; // When the viewer is used to select a footprint
// the selected footprint is here
public:
FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* semaphore = NULL );
~FOOTPRINT_VIEWER_FRAME();
void OnSize( wxSizeEvent& event );
/**
* Function OnSashDrag
* resizes the child windows when dragging a sash window border.
*/
void OnSashDrag( wxSashEvent& event );
/**
* Function ReCreateLibraryList
*
* Creates or recreates the list of current loaded libraries.
* This list is sorted, with the library cache always at end of the list
*/
void ReCreateLibraryList();
void ReCreateFootprintList();
void Process_Special_Functions( wxCommandEvent& event );
void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar();
void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void ClickOnLibList( wxCommandEvent& event );
void ClickOnFootprintList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
/**
* Function LoadSettings
* loads the library viewer frame specific configuration settings.
*
* Don't forget to call this base method from any derived classes or the
* settings will not get loaded.
*/
void LoadSettings();
/**
* Function SaveSettings
* save library viewer frame specific configuration settings.
*
* Don't forget to call this base method from any derived classes or the
* settings will not get saved.
*/
void SaveSettings();
wxString& GetFootprintName( void ) const { return m_footprintName; }
wxString& GetSelectedFootprint( void ) const { return m_selectedFootprintName; }
private:
/**
* Function OnActivate
* is called when the frame frame is activate to reload the libraries and component lists
* that can be changed by the schematic editor or the library editor.
*/
virtual void OnActivate( wxActivateEvent& event );
void SelectCurrentLibrary( wxCommandEvent& event );
void SelectCurrentFootprint( wxCommandEvent& event );
/**
* Function ExportSelectedFootprint
* exports the current footprint name and close the library browser.
*/
void ExportSelectedFootprint( wxCommandEvent& event );
/**
* Function SelectAndViewFootprint
* Select and load the next or the previous footprint
* if no current footprint, Rebuild the list of footprints availlable in a given footprint library
* @param aMode = NEXT_PART or PREVIOUS_PART
*/
void SelectAndViewFootprint( int aMode );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
/*
* Virtual functions, not used here, but needed by PCB_BASE_FRAME
* (virtual pure functions )
*/
void OnLeftDClick(wxDC*, const wxPoint&) {}
void SaveCopyInUndoList(BOARD_ITEM*, UNDO_REDO_T, const wxPoint&) {}
void SaveCopyInUndoList(PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint&) {}
DECLARE_EVENT_TABLE()
};
#endif // MODVIEWFRM_H_
...@@ -81,6 +81,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -81,6 +81,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_NEW_BOARD, PCB_EDIT_FRAME::Files_io ) EVT_TOOL( ID_NEW_BOARD, PCB_EDIT_FRAME::Files_io )
EVT_TOOL( ID_SAVE_BOARD, PCB_EDIT_FRAME::Files_io ) EVT_TOOL( ID_SAVE_BOARD, PCB_EDIT_FRAME::Files_io )
EVT_TOOL( ID_OPEN_MODULE_EDITOR, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_OPEN_MODULE_EDITOR, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_OPEN_MODULE_VIEWER, PCB_EDIT_FRAME::Process_Special_Functions )
// Menu Files: // Menu Files:
EVT_MENU( ID_MAIN_MENUBAR, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MAIN_MENUBAR, PCB_EDIT_FRAME::Process_Special_Functions )
......
...@@ -16,7 +16,9 @@ enum pcbnew_ids ...@@ -16,7 +16,9 @@ enum pcbnew_ids
ID_MAIN_MENUBAR = ID_END_LIST, ID_MAIN_MENUBAR = ID_END_LIST,
ID_MICROWAVE_V_TOOLBAR, ID_MICROWAVE_V_TOOLBAR,
ID_OPEN_MODULE_EDITOR, ID_OPEN_MODULE_EDITOR,
ID_OPEN_MODULE_VIEWER,
ID_READ_NETLIST, ID_READ_NETLIST,
ID_SET_RELATIVE_OFFSET,
// Right vertical tool bar command IDs. // Right vertical tool bar command IDs.
ID_PCB_HIGHLIGHT_BUTT, ID_PCB_HIGHLIGHT_BUTT,
...@@ -309,7 +311,18 @@ enum pcbnew_ids ...@@ -309,7 +311,18 @@ enum pcbnew_ids
ID_MODEDIT_MODULE_MIRROR, ID_MODEDIT_MODULE_MIRROR,
ID_MODEDIT_IMPORT_PART, ID_MODEDIT_IMPORT_PART,
ID_MODEDIT_EXPORT_PART, ID_MODEDIT_EXPORT_PART,
ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
ID_MODVIEW_LIBWINDOW,
ID_MODVIEW_FOOTPRINT_WINDOW,
ID_MODVIEW_LIB_LIST,
ID_MODVIEW_FOOTPRINT_LIST,
ID_MODVIEW_SELECT_LIB,
ID_MODVIEW_SELECT_PART,
ID_MODVIEW_PREVIOUS,
ID_MODVIEW_NEXT,
ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD
}; };
#endif /* __PCBNEW_IDS_H__ */ #endif /* __PCBNEW_IDS_H__ */
...@@ -66,6 +66,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar() ...@@ -66,6 +66,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
KiBitmap( new_library_xpm ), KiBitmap( new_library_xpm ),
_( "Create new library and save current module" ) ); _( "Create new library and save current module" ) );
m_mainToolBar->AddTool( ID_OPEN_MODULE_VIEWER, wxEmptyString, KiBitmap( library_browse_xpm ),
_( "Open module viewer" ) );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ),
_( "Delete part from active library" ) ); _( "Delete part from active library" ) );
......
/*
* 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) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file tool_modview.cpp
* @brief Build the toolbars for the library browser.
*/
#include <fctsys.h>
#include <macros.h>
#include <pcbnew_id.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <hotkeys.h>
#include <dialog_helpers.h>
#include <modview_frame.h>
void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
{
wxString msg;
if( m_mainToolBar == NULL )
{
m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar
m_mainToolBar->AddTool( ID_MODVIEW_SELECT_LIB, wxEmptyString,
KiBitmap( library_xpm ),
_( "Select library to browse" ) );
m_mainToolBar->AddTool( ID_MODVIEW_SELECT_PART, wxEmptyString,
KiBitmap( add_component_xpm ),
_( "Select footprint to browse" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_MODVIEW_PREVIOUS, wxEmptyString,
KiBitmap( lib_previous_xpm ),
_( "Display previous footprint" ) );
m_mainToolBar->AddTool( ID_MODVIEW_NEXT, wxEmptyString,
KiBitmap( lib_next_xpm ),
_( "Display next footprint" ) );
m_mainToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr,
HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
KiBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hokeys_Descr,
HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
KiBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr,
HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hokeys_Descr,
HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiBitmap( zoom_fit_in_page_xpm ), msg );
if( m_Semaphore )
{
// The library browser is called from a "load component" command
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD,
wxEmptyString, KiBitmap( export_footprint_names_xpm ),
_( "Insert footprint in board" ) );
}
// after adding the buttons to the toolbar, must call Realize() to
// reflect the changes
m_mainToolBar->Realize();
}
m_mainToolBar->Refresh();
}
void FOOTPRINT_VIEWER_FRAME::ReCreateVToolbar()
{
}
...@@ -229,18 +229,8 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() ...@@ -229,18 +229,8 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, KiBitmap( modedit_xpm ), m_mainToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, KiBitmap( modedit_xpm ),
_( "Open module editor" ) ); _( "Open module editor" ) );
#if 0 m_mainToolBar->AddTool( ID_OPEN_MODULE_VIEWER, wxEmptyString, KiBitmap( library_browse_xpm ),
// Not yet existing commands _( "Open module viewer" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( wxID_CUT, wxEmptyString, KiBitmap( cut_button_xpm ),
_( "Cut selected item" ) );
m_mainToolBar->AddTool( wxID_COPY, wxEmptyString, KiBitmap( copy_button_xpm ),
_( "Copy selected item" ) );
m_mainToolBar->AddTool( wxID_PASTE, wxEmptyString, KiBitmap( paste_xpm ),
_( "Paste" ) );
#endif
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, HK_UNDO, IS_COMMENT ); msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, HK_UNDO, IS_COMMENT );
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <dialog_exchange_modules_base.h> #include <dialog_exchange_modules_base.h>
#include <ar_protos.h> #include <ar_protos.h>
static char* quiet_gcc_4_4_3; // GCC 4.4.3 and next ..
int s_SelectionMode = 0; // Remember the last exchange option, when exit dialog. int s_SelectionMode = 0; // Remember the last exchange option, when exit dialog.
...@@ -152,7 +153,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference, ...@@ -152,7 +153,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
FILE* FichCmp, * NewFile; FILE* FichCmp, * NewFile;
char line[1024]; char line[1024];
wxString msg; wxString msg;
char* quiet_gcc_4_4_3; // char* quiet_gcc_4_4_3;
if( old_name == new_name ) if( old_name == new_name )
return 0; return 0;
...@@ -588,7 +589,6 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent ) ...@@ -588,7 +589,6 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
MODULE* Module = GetBoard()->m_Modules; MODULE* Module = GetBoard()->m_Modules;
wxString msg; wxString msg;
wxString wildcard; wxString wildcard;
char* quiet_gcc_4_4_3;
if( Module == NULL ) if( Module == NULL )
{ {
......
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