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.
This commit is contained in:
parent
54e221cfad
commit
fa470d5c4a
|
@ -72,11 +72,11 @@ END_EVENT_TABLE()
|
|||
/* 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 wxPoint& pos,
|
||||
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_showAxis = true; // true to draw axis.
|
||||
|
@ -146,7 +146,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
|
|||
DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
|
||||
{
|
||||
delete GetScreen();
|
||||
SetScreen( NULL );
|
||||
SetScreen( NULL ); // Be sure there is no double deletion
|
||||
|
||||
( (CVPCB_MAINFRAME*) wxGetApp().GetTopWindow() )->m_DisplayFootprintFrame = NULL;
|
||||
}
|
||||
|
|
|
@ -434,7 +434,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
|
|||
// ( i.e. for labels that are not prefixed by a sheetpath)
|
||||
#define NET_PRIO_MAX 4
|
||||
|
||||
int priority_order[NET_PRIO_MAX+1] = {
|
||||
static int priority_order[NET_PRIO_MAX+1] = {
|
||||
NET_ITEM_UNSPECIFIED,
|
||||
NET_LABEL,
|
||||
NET_HIERLABEL,
|
||||
|
@ -462,15 +462,14 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
|
|||
// Calculate candidate priority
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if( candidate_priority > item_priority )
|
||||
{
|
||||
item = candidate;
|
||||
|
@ -504,6 +503,11 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
|
|||
// alphabetic label name order:
|
||||
if( candidate->m_Label.Cmp( item->m_Label ) < 0 )
|
||||
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 @@
|
|||
|
||||
/* Forward declarations of classes. */
|
||||
class FOOTPRINT_EDIT_FRAME;
|
||||
class FOOTPRINT_VIEWER_FRAME;
|
||||
class BOARD;
|
||||
class BOARD_CONNECTED_ITEM;
|
||||
class MODULE;
|
||||
|
@ -81,6 +82,8 @@ public:
|
|||
|
||||
EDA_3D_FRAME* m_Draw3DFrame;
|
||||
FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame;
|
||||
FOOTPRINT_VIEWER_FRAME * m_ModuleViewerFrame;
|
||||
|
||||
|
||||
protected:
|
||||
BOARD* m_Pcb;
|
||||
|
@ -393,7 +396,35 @@ public:
|
|||
const wxString& aMask,
|
||||
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
|
||||
/**
|
||||
|
|
|
@ -94,6 +94,7 @@ enum id_drawframe {
|
|||
VIEWER_FRAME,
|
||||
PCB_FRAME,
|
||||
MODULE_EDITOR_FRAME,
|
||||
MODULE_VIEWER_FRAME,
|
||||
CVPCB_FRAME,
|
||||
CVPCB_DISPLAY_FRAME,
|
||||
GERBER_FRAME,
|
||||
|
|
|
@ -80,6 +80,9 @@ set(PCBNEW_DIALOGS
|
|||
)
|
||||
|
||||
set(PCBNEW_SRCS
|
||||
tool_modview.cpp
|
||||
modview.cpp
|
||||
modview_frame.cpp
|
||||
pcbframe.cpp
|
||||
attribut.cpp
|
||||
automove.cpp
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
* @file basepcbframe.cpp
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <wxstruct.h>
|
||||
#include <pcbcommon.h>
|
||||
|
@ -97,6 +93,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
|
|||
m_DisplayPcbTrackFill = true; // false = sketch , true = filled
|
||||
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_UserGridUnit = INCHES;
|
||||
|
@ -752,3 +749,37 @@ void PCB_BASE_FRAME::updateZoomSelectBox()
|
|||
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 @@
|
|||
|
||||
#include <pcbnew.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
|
||||
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -94,6 +94,16 @@ public:
|
|||
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
|
||||
* has knowledge about the frame and how and where to put status information
|
||||
|
|
|
@ -68,7 +68,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
|
|||
m_Orient = source->m_Orient;
|
||||
m_Pos = source->m_Pos;
|
||||
m_Layer = source->m_Layer;
|
||||
m_Thickness = source->m_Thickness;
|
||||
m_Thickness = source->m_Thickness;
|
||||
m_Attributs = source->m_Attributs;
|
||||
m_Italic = source->m_Italic;
|
||||
m_Bold = source->m_Bold;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <class_module.h>
|
||||
#include <class_pad.h>
|
||||
#include <class_marker_pcb.h>
|
||||
|
||||
|
||||
/* 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
|
|||
MODULE* module = NULL;
|
||||
D_PAD* pad = NULL;
|
||||
bool pad_through = false;
|
||||
MARKER_PCB* marker = NULL;
|
||||
|
||||
#if 0 // debugging
|
||||
static int breakhere = 0;
|
||||
|
@ -210,6 +212,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_MARKER_T:
|
||||
breakhere++;
|
||||
break;
|
||||
|
||||
default:
|
||||
breakhere++;
|
||||
break;
|
||||
|
@ -293,6 +299,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
|||
module = (MODULE*) item;
|
||||
break;
|
||||
|
||||
case PCB_MARKER_T:
|
||||
marker = (MARKER_PCB*) item;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -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() )
|
||||
{
|
||||
int layer = item->GetLayer();
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <class_module.h>
|
||||
#include <class_track.h>
|
||||
#include <class_zone.h>
|
||||
#include <modview_frame.h>
|
||||
|
||||
#include <dialog_drc.h>
|
||||
|
||||
|
@ -207,6 +208,28 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
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:
|
||||
InstallPcbGlobalDeleteFrame( pos );
|
||||
break;
|
||||
|
|
|
@ -258,3 +258,11 @@ struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[] = {
|
|||
{ &g_ModuleEditSectionTag, module_edit_Hotkey_List, 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[];
|
|||
// List of hotkey descriptors for the footprint editor only
|
||||
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
|
||||
// used in hotkeys_board_editor.cpp and hotkeys_module_editor.cpp
|
||||
extern EDA_HOTKEY* common_Hotkey_List[];
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include <footprint_info.h>
|
||||
#include <class_footprint_library.h>
|
||||
#include <dialog_get_component.h>
|
||||
#include <modview_frame.h>
|
||||
|
||||
|
||||
static void DisplayCmpDoc( wxString& Name );
|
||||
|
@ -105,8 +106,43 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
|
|||
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 );
|
||||
|
||||
MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC* DC )
|
||||
// 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();
|
||||
|
||||
return fpname;
|
||||
}
|
||||
|
||||
MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
|
||||
bool aUseFootprintViewer,
|
||||
wxDC* aDC )
|
||||
{
|
||||
MODULE* module;
|
||||
wxPoint curspos = GetScreen()->GetCrossHairPosition();
|
||||
|
@ -114,18 +150,25 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
|
|||
bool AllowWildSeach = true;
|
||||
|
||||
static wxArrayString HistoryList;
|
||||
static wxString lastCommponentName;
|
||||
static wxString lastComponentName;
|
||||
|
||||
/* Ask for a component name or key words */
|
||||
DIALOG_GET_COMPONENT dlg( this, GetComponentDialogPosition(), HistoryList,
|
||||
_( "Place Module" ), false );
|
||||
_( "Load Module" ), aUseFootprintViewer );
|
||||
|
||||
dlg.SetComponentName( lastCommponentName );
|
||||
dlg.SetComponentName( lastComponentName );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return NULL;
|
||||
|
||||
moduleName = dlg.GetComponentName();
|
||||
if( dlg.m_GetExtraFunction )
|
||||
{
|
||||
moduleName = SelectFootprintFromLibBrowser();
|
||||
}
|
||||
else
|
||||
{
|
||||
moduleName = dlg.GetComponentName();
|
||||
}
|
||||
|
||||
if( moduleName.IsEmpty() ) /* Cancel command */
|
||||
{
|
||||
|
@ -139,7 +182,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
|
|||
{
|
||||
AllowWildSeach = false;
|
||||
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 */
|
||||
{
|
||||
|
@ -151,7 +194,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
|
|||
|| ( moduleName.Contains( wxT( "*" ) ) ) ) // Selection wild card
|
||||
{
|
||||
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() )
|
||||
{
|
||||
|
@ -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 */
|
||||
{
|
||||
AllowWildSeach = false;
|
||||
wxString wildname = wxChar( '*' ) + moduleName + wxChar( '*' );
|
||||
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() )
|
||||
{
|
||||
|
@ -176,7 +219,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
|
|||
}
|
||||
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*
|
|||
|
||||
if( module )
|
||||
{
|
||||
lastCommponentName = moduleName;
|
||||
lastComponentName = moduleName;
|
||||
AddHistoryComponentName( HistoryList, moduleName );
|
||||
|
||||
module->SetFlags( IS_NEW );
|
||||
|
@ -204,8 +247,8 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
|
|||
|
||||
RecalculateAllTracksNetcode();
|
||||
|
||||
if( DC )
|
||||
module->Draw( m_canvas, DC, GR_OR );
|
||||
if( aDC )
|
||||
module->Draw( m_canvas, aDC, GR_OR );
|
||||
}
|
||||
|
||||
return module;
|
||||
|
@ -220,6 +263,7 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename,
|
|||
wxString msg, tmp;
|
||||
MODULE* newModule;
|
||||
FILE* file = NULL;
|
||||
bool error_set = false;
|
||||
|
||||
bool one_lib = aLibraryFullFilename.IsEmpty() ? false : true;
|
||||
|
||||
|
@ -234,11 +278,12 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename,
|
|||
|
||||
if( !tmp )
|
||||
{
|
||||
if( aDisplayMessageError )
|
||||
if( aDisplayMessageError && !error_set )
|
||||
{
|
||||
msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ),
|
||||
GetChars( fn.GetFullName() ) );
|
||||
wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, this );
|
||||
error_set = true;
|
||||
}
|
||||
|
||||
continue;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <protos.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <module_editor_frame.h>
|
||||
#include <modview_frame.h>
|
||||
#include <collectors.h>
|
||||
|
||||
#include <dialog_edit_module_for_Modedit.h>
|
||||
|
@ -216,6 +217,28 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
Select_Active_Library();
|
||||
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:
|
||||
{
|
||||
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
|
||||
|
|
|
@ -187,7 +187,6 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
|
|||
{
|
||||
BOARD_ITEM* item = GetCurItem();
|
||||
wxString msg;
|
||||
bool append_set_width = false;
|
||||
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
|
||||
|
||||
// Simple location of elements where possible.
|
||||
|
@ -245,148 +244,147 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
|
|||
}
|
||||
}
|
||||
|
||||
if( (item == NULL) || blockActive )
|
||||
if( blockActive )
|
||||
return true;
|
||||
|
||||
int flags = item->GetFlags();
|
||||
|
||||
switch( item->Type() )
|
||||
if( item )
|
||||
{
|
||||
case PCB_MODULE_T:
|
||||
{
|
||||
wxMenu* transform_choice = new wxMenu;
|
||||
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_ROTATE, _( "Rotate" ),
|
||||
KiBitmap( rotate_module_pos_xpm ) );
|
||||
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_MIRROR, _( "Mirror" ),
|
||||
KiBitmap( mirror_h_xpm ) );
|
||||
msg = AddHotkeyName( _( "Edit Module" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_MODULE, msg, KiBitmap( edit_module_xpm ) );
|
||||
AddMenuItem( PopMenu, transform_choice, ID_MODEDIT_TRANSFORM_MODULE,
|
||||
_( "Transform Module" ), KiBitmap( edit_xpm ) );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_PAD_T:
|
||||
if( !flags )
|
||||
int flags = item->GetFlags();
|
||||
switch( item->Type() )
|
||||
{
|
||||
msg = AddHotkeyName( _("Move Pad" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST, msg, KiBitmap( move_pad_xpm ) );
|
||||
}
|
||||
|
||||
msg = AddHotkeyName( _("Edit Pad" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_PAD, msg, KiBitmap( options_pad_xpm ) );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
|
||||
_( "New Pad Settings" ), KiBitmap( options_new_pad_xpm ) );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
|
||||
_( "Export Pad Settings" ), KiBitmap( export_options_pad_xpm ) );
|
||||
msg = AddHotkeyName( _("Delete Pad" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_PAD, msg, KiBitmap( delete_pad_xpm ) );
|
||||
|
||||
if( !flags )
|
||||
{
|
||||
PopMenu->AppendSeparator();
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
|
||||
_( "Global Pad Settings" ), KiBitmap( global_options_pad_xpm ) );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PCB_MODULE_TEXT_T:
|
||||
if( !flags )
|
||||
{
|
||||
msg = AddHotkeyName( _("Move Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_MOVE_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, msg,
|
||||
KiBitmap( move_field_xpm ) );
|
||||
}
|
||||
|
||||
msg = AddHotkeyName( _("Rotate Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_ROTATE_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE, msg, KiBitmap( rotate_field_xpm ) );
|
||||
|
||||
if( !flags )
|
||||
{
|
||||
msg = AddHotkeyName( _("Edit Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_EDIT_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, KiBitmap( edit_text_xpm ) );
|
||||
|
||||
if( ( (TEXTE_MODULE*) item )->GetType() == TEXT_is_DIVERS )
|
||||
case PCB_MODULE_T:
|
||||
{
|
||||
msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_DELETE );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE, msg,
|
||||
KiBitmap( delete_text_xpm ) );
|
||||
wxMenu* transform_choice = new wxMenu;
|
||||
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_ROTATE, _( "Rotate" ),
|
||||
KiBitmap( rotate_module_pos_xpm ) );
|
||||
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_MIRROR, _( "Mirror" ),
|
||||
KiBitmap( mirror_h_xpm ) );
|
||||
msg = AddHotkeyName( _( "Edit Module" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_MODULE, msg, KiBitmap( edit_module_xpm ) );
|
||||
AddMenuItem( PopMenu, transform_choice, ID_MODEDIT_TRANSFORM_MODULE,
|
||||
_( "Transform Module" ), KiBitmap( edit_xpm ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_MODULE_EDGE_T:
|
||||
{
|
||||
if( (flags & IS_NEW) )
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, _( "End edge" ),
|
||||
KiBitmap( apply_xpm ) );
|
||||
case PCB_PAD_T:
|
||||
if( !flags )
|
||||
{
|
||||
msg = AddHotkeyName( _("Move Pad" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST, msg, KiBitmap( move_pad_xpm ) );
|
||||
}
|
||||
|
||||
if( !flags )
|
||||
msg = AddHotkeyName( _("Edit Pad" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_PAD, msg, KiBitmap( options_pad_xpm ) );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
|
||||
_( "New Pad Settings" ), KiBitmap( options_new_pad_xpm ) );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
|
||||
_( "Export Pad Settings" ), KiBitmap( export_options_pad_xpm ) );
|
||||
msg = AddHotkeyName( _("Delete Pad" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_PAD, msg, KiBitmap( delete_pad_xpm ) );
|
||||
|
||||
if( !flags )
|
||||
{
|
||||
PopMenu->AppendSeparator();
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
|
||||
_( "Global Pad Settings" ), KiBitmap( global_options_pad_xpm ) );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PCB_MODULE_TEXT_T:
|
||||
if( !flags )
|
||||
{
|
||||
msg = AddHotkeyName( _("Move Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_MOVE_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, msg,
|
||||
KiBitmap( move_field_xpm ) );
|
||||
}
|
||||
|
||||
msg = AddHotkeyName( _("Rotate Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_ROTATE_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE, msg, KiBitmap( rotate_field_xpm ) );
|
||||
|
||||
if( !flags )
|
||||
{
|
||||
msg = AddHotkeyName( _("Edit Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_EDIT_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, KiBitmap( edit_text_xpm ) );
|
||||
|
||||
if( ( (TEXTE_MODULE*) item )->GetType() == TEXT_is_DIVERS )
|
||||
{
|
||||
msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||
HK_DELETE );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE, msg,
|
||||
KiBitmap( delete_text_xpm ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_MODULE_EDGE_T:
|
||||
{
|
||||
msg = AddHotkeyName( _("Move edge" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_EDGE, msg, KiBitmap( move_line_xpm ) );
|
||||
if( (flags & IS_NEW) )
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, _( "End edge" ),
|
||||
KiBitmap( apply_xpm ) );
|
||||
|
||||
if( !flags )
|
||||
{
|
||||
msg = AddHotkeyName( _("Move edge" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_EDGE, msg, KiBitmap( move_line_xpm ) );
|
||||
}
|
||||
|
||||
if( ( flags & (IS_NEW | IS_MOVED) ) == IS_MOVED )
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_EDGE, _( "Place edge" ),
|
||||
KiBitmap( apply_xpm ) );
|
||||
|
||||
wxMenu* edit_mnu = new wxMenu;
|
||||
AddMenuItem( PopMenu, edit_mnu, ID_POPUP_PCB_EDIT_EDGE, _( "Edit" ), KiBitmap( edit_xpm ) );
|
||||
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE,
|
||||
_( "Edit Width (Current)" ), KiBitmap( width_segment_xpm ) );
|
||||
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE,
|
||||
_( "Edit Width (All)" ), KiBitmap( width_segment_xpm ) );
|
||||
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE,
|
||||
_( "Edit Layer (Current)" ), KiBitmap( select_layer_pair_xpm ) );
|
||||
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE,
|
||||
_( "Edit Layer (All)" ), KiBitmap( select_layer_pair_xpm ) );
|
||||
msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
|
||||
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, KiBitmap( delete_xpm ) );
|
||||
}
|
||||
|
||||
if( ( flags & (IS_NEW | IS_MOVED) ) == IS_MOVED )
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_EDGE, _( "Place edge" ),
|
||||
KiBitmap( apply_xpm ) );
|
||||
|
||||
wxMenu* edit_mnu = new wxMenu;
|
||||
AddMenuItem( PopMenu, edit_mnu, ID_POPUP_PCB_EDIT_EDGE, _( "Edit" ), KiBitmap( edit_xpm ) );
|
||||
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE,
|
||||
_( "Edit Width (Current)" ), KiBitmap( width_segment_xpm ) );
|
||||
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE,
|
||||
_( "Edit Width (All)" ), KiBitmap( width_segment_xpm ) );
|
||||
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE,
|
||||
_( "Edit Layer (Current)" ), KiBitmap( select_layer_pair_xpm ) );
|
||||
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE,
|
||||
_( "Edit Layer (All)" ), KiBitmap( select_layer_pair_xpm ) );
|
||||
msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
|
||||
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, KiBitmap( delete_xpm ) );
|
||||
append_set_width = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_LINE_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_VIA_T:
|
||||
case PCB_TRACE_T:
|
||||
case PCB_ZONE_T:
|
||||
case PCB_MARKER_T:
|
||||
case PCB_DIMENSION_T:
|
||||
case PCB_TARGET_T:
|
||||
break;
|
||||
|
||||
case SCREEN_T:
|
||||
case TYPE_NOT_INIT:
|
||||
case PCB_T:
|
||||
msg.Printf( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: illegal DrawType %d" ),
|
||||
item->Type() );
|
||||
DisplayError( this, msg );
|
||||
break;
|
||||
case PCB_LINE_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_VIA_T:
|
||||
case PCB_TRACE_T:
|
||||
case PCB_ZONE_T:
|
||||
case PCB_MARKER_T:
|
||||
case PCB_DIMENSION_T:
|
||||
case PCB_TARGET_T:
|
||||
break;
|
||||
|
||||
default:
|
||||
msg.Printf( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: unknown DrawType %d" ),
|
||||
item->Type() );
|
||||
DisplayError( this, msg );
|
||||
break;
|
||||
case SCREEN_T:
|
||||
case TYPE_NOT_INIT:
|
||||
case PCB_T:
|
||||
msg.Printf( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: illegal DrawType %d" ),
|
||||
item->Type() );
|
||||
DisplayError( this, msg );
|
||||
break;
|
||||
|
||||
default:
|
||||
msg.Printf( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: unknown DrawType %d" ),
|
||||
item->Type() );
|
||||
DisplayError( this, msg );
|
||||
break;
|
||||
}
|
||||
PopMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
PopMenu->AppendSeparator();
|
||||
|
||||
if( append_set_width
|
||||
|| ( ( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||
&& ( ( GetToolId() == ID_PCB_ADD_LINE_BUTT )
|
||||
|| ( GetToolId() == ID_PCB_CIRCLE_BUTT )
|
||||
|| ( GetToolId() == ID_PCB_ARC_BUTT ) ) ) )
|
||||
if( ( GetToolId() == ID_MODEDIT_LINE_TOOL ) ||
|
||||
( GetToolId() == ID_MODEDIT_CIRCLE_TOOL ) ||
|
||||
( GetToolId() == ID_MODEDIT_ARC_TOOL ) )
|
||||
{
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH, _("Set Width" ), KiBitmap( width_segment_xpm ) );
|
||||
AddMenuItem( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH, _("Set Line Width" ),
|
||||
KiBitmap( width_segment_xpm ) );
|
||||
PopMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
|
|
|
@ -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_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_NEW_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||
|
|
|
@ -0,0 +1,195 @@
|
|||
/**
|
||||
* @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 );
|
||||
}
|
|
@ -0,0 +1,607 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras
|
||||
* 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 modview_frame.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <3d_viewer.h>
|
||||
#include <pcbcommon.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <modview_frame.h>
|
||||
#include <footprint_info.h>
|
||||
|
||||
#include <hotkeys.h>
|
||||
|
||||
|
||||
/**
|
||||
* Save previous component library viewer state.
|
||||
*/
|
||||
wxString FOOTPRINT_VIEWER_FRAME::m_libraryName;
|
||||
wxString FOOTPRINT_VIEWER_FRAME::m_footprintName;
|
||||
|
||||
|
||||
/// When the viewer is used to select a component in schematic, the selected component is here.
|
||||
wxString FOOTPRINT_VIEWER_FRAME::m_selectedFootprintName;
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
|
||||
/* Window events */
|
||||
EVT_CLOSE( FOOTPRINT_VIEWER_FRAME::OnCloseWindow )
|
||||
EVT_SIZE( FOOTPRINT_VIEWER_FRAME::OnSize )
|
||||
EVT_ACTIVATE( FOOTPRINT_VIEWER_FRAME::OnActivate )
|
||||
|
||||
/* Sash drag events */
|
||||
EVT_SASH_DRAGGED( ID_MODVIEW_LIBWINDOW, FOOTPRINT_VIEWER_FRAME::OnSashDrag )
|
||||
EVT_SASH_DRAGGED( ID_MODVIEW_FOOTPRINT_WINDOW, FOOTPRINT_VIEWER_FRAME::OnSashDrag )
|
||||
|
||||
/* Toolbar events */
|
||||
EVT_TOOL( ID_MODVIEW_SELECT_LIB,
|
||||
FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary )
|
||||
EVT_TOOL( ID_MODVIEW_SELECT_PART,
|
||||
FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint )
|
||||
EVT_TOOL( ID_MODVIEW_NEXT,
|
||||
FOOTPRINT_VIEWER_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODVIEW_PREVIOUS,
|
||||
FOOTPRINT_VIEWER_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD,
|
||||
FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint )
|
||||
|
||||
/* listbox events */
|
||||
EVT_LISTBOX( ID_MODVIEW_LIB_LIST, FOOTPRINT_VIEWER_FRAME::ClickOnLibList )
|
||||
EVT_LISTBOX( ID_MODVIEW_FOOTPRINT_LIST, FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList )
|
||||
|
||||
EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/*
|
||||
* This emulates the zoom menu entries found in the other KiCad applications.
|
||||
* The library viewer does not have any menus so add an accelerator table to
|
||||
* the main frame.
|
||||
*/
|
||||
static wxAcceleratorEntry accels[] =
|
||||
{
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F1, ID_ZOOM_IN ),
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ),
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ),
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_POPUP_ZOOM_CENTER ),
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_HOME, ID_ZOOM_PAGE ),
|
||||
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_SPACE, ID_SET_RELATIVE_OFFSET )
|
||||
};
|
||||
|
||||
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )
|
||||
|
||||
#define EXTRA_BORDER_SIZE 2
|
||||
|
||||
|
||||
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* semaphore ) :
|
||||
PCB_BASE_FRAME( parent, MODULE_VIEWER_FRAME, _( "Footprint Library Browser" ),
|
||||
wxDefaultPosition, wxDefaultSize )
|
||||
{
|
||||
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
|
||||
|
||||
m_FrameName = wxT( "ModViewFrame" );
|
||||
m_configPath = wxT( "FootprintViewer" );
|
||||
m_showAxis = true; // true to draw axis.
|
||||
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) );
|
||||
|
||||
SetIcon( icon );
|
||||
|
||||
m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr;
|
||||
m_FootprintList = NULL;
|
||||
m_LibList = NULL;
|
||||
m_LibListWindow = NULL;
|
||||
m_FootprintListWindow = NULL;
|
||||
m_Semaphore = semaphore;
|
||||
m_selectedFootprintName.Empty();
|
||||
|
||||
if( m_Semaphore )
|
||||
MakeModal(true);
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
SetScreen( new PCB_SCREEN(GetPageSizeIU()) );
|
||||
GetScreen()->m_Center = true; // Center coordinate origins on screen.
|
||||
LoadSettings();
|
||||
|
||||
// Initialize grid id to a default value if not found in config or bad:
|
||||
if( ( m_LastGridSizeId <= 0 ) ||
|
||||
( m_LastGridSizeId < ( ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000 ) ) )
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
||||
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||
|
||||
ReCreateHToolbar();
|
||||
ReCreateVToolbar();
|
||||
|
||||
wxSize size = GetClientSize();
|
||||
size.y -= m_MsgFrameHeight + 2;
|
||||
|
||||
m_LibListSize.y = -1;
|
||||
|
||||
wxPoint win_pos( 0, 0 );
|
||||
|
||||
// Creates the libraries window display
|
||||
m_LibListWindow =
|
||||
new wxSashLayoutWindow( this, ID_MODVIEW_LIBWINDOW, win_pos,
|
||||
wxDefaultSize, wxCLIP_CHILDREN | wxSW_3D,
|
||||
wxT( "LibWindow" ) );
|
||||
m_LibListWindow->SetOrientation( wxLAYOUT_VERTICAL );
|
||||
m_LibListWindow->SetAlignment( wxLAYOUT_LEFT );
|
||||
m_LibListWindow->SetSashVisible( wxSASH_RIGHT, true );
|
||||
m_LibListWindow->SetExtraBorderSize( EXTRA_BORDER_SIZE );
|
||||
m_LibList = new wxListBox( m_LibListWindow, ID_MODVIEW_LIB_LIST,
|
||||
wxPoint( 0, 0 ), wxDefaultSize,
|
||||
0, NULL, wxLB_HSCROLL );
|
||||
|
||||
// Creates the component window display
|
||||
m_FootprintListSize.y = size.y;
|
||||
win_pos.x = m_LibListSize.x;
|
||||
m_FootprintListWindow = new wxSashLayoutWindow( this, ID_MODVIEW_FOOTPRINT_WINDOW,
|
||||
win_pos, wxDefaultSize,
|
||||
wxCLIP_CHILDREN | wxSW_3D,
|
||||
wxT( "CmpWindow" ) );
|
||||
m_FootprintListWindow->SetOrientation( wxLAYOUT_VERTICAL );
|
||||
|
||||
m_FootprintListWindow->SetSashVisible( wxSASH_RIGHT, true );
|
||||
m_FootprintListWindow->SetExtraBorderSize( EXTRA_BORDER_SIZE );
|
||||
m_FootprintList = new wxListBox( m_FootprintListWindow, ID_MODVIEW_FOOTPRINT_LIST,
|
||||
wxPoint( 0, 0 ), wxDefaultSize,
|
||||
0, NULL, wxLB_HSCROLL );
|
||||
|
||||
ReCreateLibraryList();
|
||||
|
||||
DisplayLibInfos();
|
||||
|
||||
// If a footprint was previsiously loaded, reload it
|
||||
if( !m_libraryName.IsEmpty() && !m_footprintName.IsEmpty() )
|
||||
GetModuleLibrary( m_libraryName + wxT(".") + ModuleFileExtension,
|
||||
m_footprintName, false );
|
||||
|
||||
|
||||
if( m_canvas )
|
||||
m_canvas->SetAcceleratorTable( table );
|
||||
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
|
||||
|
||||
EDA_PANEINFO horiz;
|
||||
horiz.HorizontalToolbarPane();
|
||||
|
||||
EDA_PANEINFO vert;
|
||||
vert.VerticalToolbarPane();
|
||||
|
||||
EDA_PANEINFO info;
|
||||
info.InfoToolbarPane();
|
||||
|
||||
EDA_PANEINFO mesg;
|
||||
mesg.MessageToolbarPane();
|
||||
|
||||
|
||||
// Manage main toolbal
|
||||
m_auimgr.AddPane( m_mainToolBar,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) );
|
||||
|
||||
wxSize minsize( 60, -1 );
|
||||
|
||||
// Manage the left window (list of libraries)
|
||||
if( m_LibListWindow )
|
||||
m_auimgr.AddPane( m_LibListWindow, wxAuiPaneInfo( info ).Name( wxT( "m_LibList" ) ).
|
||||
Left().Row( 0 ));
|
||||
|
||||
// Manage the list of components)
|
||||
m_auimgr.AddPane( m_FootprintListWindow,
|
||||
wxAuiPaneInfo( info ).Name( wxT( "m_FootprintList" ) ).
|
||||
Left().Row( 1 ) );
|
||||
|
||||
// Manage the draw panel
|
||||
m_auimgr.AddPane( m_canvas,
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).Centre() );
|
||||
|
||||
// Manage the message panel
|
||||
m_auimgr.AddPane( m_messagePanel,
|
||||
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
|
||||
|
||||
/* Now the minimum windows are fixed, set library list
|
||||
* and component list of the previous values from last viewlib use
|
||||
*/
|
||||
if( m_LibListWindow )
|
||||
{
|
||||
wxAuiPaneInfo& pane = m_auimgr.GetPane(m_LibListWindow);
|
||||
pane.MinSize( wxSize(m_LibListSize.x, -1));
|
||||
}
|
||||
wxAuiPaneInfo& pane = m_auimgr.GetPane(m_FootprintListWindow);
|
||||
pane.MinSize(wxSize(m_FootprintListSize.x, -1));
|
||||
|
||||
m_auimgr.Update();
|
||||
|
||||
// Now Drawpanel is sized, we can use BestZoom to show the component (if any)
|
||||
#ifdef USE_WX_GRAPHICS_CONTEXT
|
||||
GetScreen()->SetZoom( BestZoom() );
|
||||
#else
|
||||
Zoom_Automatique( false );
|
||||
#endif
|
||||
|
||||
Show( true );
|
||||
}
|
||||
|
||||
|
||||
FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME()
|
||||
{
|
||||
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) GetParent();
|
||||
frame->m_ModuleViewerFrame = NULL;
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||
{
|
||||
SaveSettings();
|
||||
|
||||
if( m_Semaphore )
|
||||
{
|
||||
m_Semaphore->Post();
|
||||
MakeModal(false);
|
||||
// This window will be destroyed by the calling function,
|
||||
// to avoid side effects
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::OnSashDrag( wxSashEvent& event )
|
||||
{
|
||||
if( event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE )
|
||||
return;
|
||||
|
||||
m_LibListSize.y = GetClientSize().y - m_MsgFrameHeight;
|
||||
m_FootprintListSize.y = m_LibListSize.y;
|
||||
|
||||
switch( event.GetId() )
|
||||
{
|
||||
case ID_MODVIEW_LIBWINDOW:
|
||||
if( m_LibListWindow )
|
||||
{
|
||||
wxAuiPaneInfo& pane = m_auimgr.GetPane( m_LibListWindow );
|
||||
m_LibListSize.x = event.GetDragRect().width;
|
||||
pane.MinSize( m_LibListSize );
|
||||
m_auimgr.Update();
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_MODVIEW_FOOTPRINT_WINDOW:
|
||||
{
|
||||
wxAuiPaneInfo& pane = m_auimgr.GetPane( m_FootprintListWindow );
|
||||
m_FootprintListSize.x = event.GetDragRect().width;
|
||||
pane.MinSize( m_FootprintListSize );
|
||||
m_auimgr.Update();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv )
|
||||
{
|
||||
if( m_auimgr.GetManagedWindow() )
|
||||
m_auimgr.Update();
|
||||
|
||||
SizeEv.Skip();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
|
||||
{
|
||||
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList()
|
||||
{
|
||||
if( m_LibList == NULL )
|
||||
return;
|
||||
|
||||
m_LibList->Clear();
|
||||
for( unsigned ii = 0; ii < g_LibraryNames.GetCount(); ii++ )
|
||||
{
|
||||
m_LibList->Append( g_LibraryNames[ii] );
|
||||
}
|
||||
|
||||
// Search for a previous selection:
|
||||
int index = m_LibList->FindString( m_libraryName );
|
||||
|
||||
if( index != wxNOT_FOUND )
|
||||
{
|
||||
m_LibList->SetSelection( index, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If not found, clear current library selection because it can be
|
||||
* deleted after a config change. */
|
||||
m_libraryName = wxEmptyString;
|
||||
m_footprintName = wxEmptyString;
|
||||
}
|
||||
|
||||
ReCreateFootprintList();
|
||||
ReCreateHToolbar();
|
||||
DisplayLibInfos();
|
||||
m_canvas->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
|
||||
{
|
||||
if( m_FootprintList == NULL )
|
||||
return;
|
||||
|
||||
m_FootprintList->Clear();
|
||||
|
||||
if( m_libraryName.IsEmpty() )
|
||||
{
|
||||
m_footprintName = wxEmptyString;
|
||||
return;
|
||||
}
|
||||
|
||||
wxArrayString libsList;
|
||||
libsList.Add( m_libraryName );
|
||||
FOOTPRINT_LIST fp_info_list;
|
||||
fp_info_list.ReadFootprintFiles( libsList );
|
||||
|
||||
wxArrayString fpList;
|
||||
BOOST_FOREACH( FOOTPRINT_INFO& footprint, fp_info_list.m_List )
|
||||
{
|
||||
fpList.Add(( footprint.m_Module ) );
|
||||
}
|
||||
m_FootprintList->Append( fpList );
|
||||
|
||||
int index = m_FootprintList->FindString( m_footprintName );
|
||||
|
||||
if( index == wxNOT_FOUND )
|
||||
m_footprintName = wxEmptyString;
|
||||
else
|
||||
m_FootprintList->SetSelection( index, true );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event )
|
||||
{
|
||||
int ii = m_LibList->GetSelection();
|
||||
|
||||
if( ii < 0 )
|
||||
return;
|
||||
|
||||
wxString name = m_LibList->GetString( ii );
|
||||
|
||||
if( m_libraryName == name )
|
||||
return;
|
||||
|
||||
m_libraryName = name;
|
||||
ReCreateFootprintList();
|
||||
m_canvas->Refresh();
|
||||
DisplayLibInfos();
|
||||
ReCreateHToolbar();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
|
||||
{
|
||||
int ii = m_FootprintList->GetSelection();
|
||||
|
||||
if( ii < 0 )
|
||||
return;
|
||||
|
||||
wxString name = m_FootprintList->GetString( ii );
|
||||
|
||||
if( m_footprintName.CmpNoCase( name ) != 0 )
|
||||
{
|
||||
m_footprintName = name;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event )
|
||||
{
|
||||
int ii = m_FootprintList->GetSelection();
|
||||
|
||||
if( ii >= 0 )
|
||||
m_selectedFootprintName = m_FootprintList->GetString( ii );
|
||||
else
|
||||
m_selectedFootprintName.Empty();
|
||||
|
||||
Close( true );
|
||||
}
|
||||
|
||||
|
||||
#define LIBLIST_WIDTH_KEY wxT( "Liblist_width" )
|
||||
#define CMPLIST_WIDTH_KEY wxT( "Cmplist_width" )
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::LoadSettings( )
|
||||
{
|
||||
wxConfig* cfg ;
|
||||
|
||||
EDA_DRAW_FRAME::LoadSettings();
|
||||
|
||||
wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
|
||||
cfg = wxGetApp().GetSettings();
|
||||
|
||||
m_LibListSize.x = 150; // default width of libs list
|
||||
m_FootprintListSize.x = 150; // default width of component list
|
||||
|
||||
cfg->Read( LIBLIST_WIDTH_KEY, &m_LibListSize.x );
|
||||
cfg->Read( CMPLIST_WIDTH_KEY, &m_FootprintListSize.x );
|
||||
|
||||
// Set parameters to a reasonable value.
|
||||
if ( m_LibListSize.x > m_FrameSize.x/2 )
|
||||
m_LibListSize.x = m_FrameSize.x/2;
|
||||
|
||||
if ( m_FootprintListSize.x > m_FrameSize.x/2 )
|
||||
m_FootprintListSize.x = m_FrameSize.x/2;
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::SaveSettings()
|
||||
{
|
||||
wxConfig* cfg;
|
||||
|
||||
EDA_DRAW_FRAME::SaveSettings();
|
||||
|
||||
wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
|
||||
cfg = wxGetApp().GetSettings();
|
||||
|
||||
if ( m_LibListSize.x )
|
||||
cfg->Write( LIBLIST_WIDTH_KEY, m_LibListSize.x );
|
||||
|
||||
cfg->Write( CMPLIST_WIDTH_KEY, m_FootprintListSize.x );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
|
||||
{
|
||||
EDA_DRAW_FRAME::OnActivate( event );
|
||||
|
||||
// Ensure we do not have old selection:
|
||||
if( m_FrameIsActive )
|
||||
m_selectedFootprintName.Empty();
|
||||
|
||||
if( m_LibList )
|
||||
ReCreateLibraryList();
|
||||
|
||||
DisplayLibInfos();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
|
||||
{
|
||||
wxRealPoint gridSize;
|
||||
wxPoint oldpos;
|
||||
PCB_SCREEN* screen = GetScreen();
|
||||
wxPoint pos = aPosition;
|
||||
|
||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||
cmd.SetEventObject( this );
|
||||
|
||||
pos = screen->GetNearestGridPosition( pos );
|
||||
oldpos = screen->GetCrossHairPosition();
|
||||
gridSize = screen->GetGridSize();
|
||||
|
||||
switch( aHotKey )
|
||||
{
|
||||
case WXK_F1:
|
||||
cmd.SetId( ID_POPUP_ZOOM_IN );
|
||||
GetEventHandler()->ProcessEvent( cmd );
|
||||
break;
|
||||
|
||||
case WXK_F2:
|
||||
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
||||
GetEventHandler()->ProcessEvent( cmd );
|
||||
break;
|
||||
|
||||
case WXK_F3:
|
||||
cmd.SetId( ID_ZOOM_REDRAW );
|
||||
GetEventHandler()->ProcessEvent( cmd );
|
||||
break;
|
||||
|
||||
case WXK_F4:
|
||||
cmd.SetId( ID_POPUP_ZOOM_CENTER );
|
||||
GetEventHandler()->ProcessEvent( cmd );
|
||||
break;
|
||||
|
||||
case WXK_HOME:
|
||||
cmd.SetId( ID_ZOOM_PAGE );
|
||||
GetEventHandler()->ProcessEvent( cmd );
|
||||
break;
|
||||
|
||||
case ' ':
|
||||
screen->m_O_Curseur = screen->GetCrossHairPosition();
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD8: /* cursor moved up */
|
||||
case WXK_UP:
|
||||
pos.y -= wxRound( gridSize.y );
|
||||
m_canvas->MoveCursor( pos );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD2: /* cursor moved down */
|
||||
case WXK_DOWN:
|
||||
pos.y += wxRound( gridSize.y );
|
||||
m_canvas->MoveCursor( pos );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD4: /* cursor moved left */
|
||||
case WXK_LEFT:
|
||||
pos.x -= wxRound( gridSize.x );
|
||||
m_canvas->MoveCursor( pos );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD6: /* cursor moved right */
|
||||
case WXK_RIGHT:
|
||||
pos.x += wxRound( gridSize.x );
|
||||
m_canvas->MoveCursor( pos );
|
||||
break;
|
||||
}
|
||||
|
||||
screen->SetCrossHairPosition( pos );
|
||||
|
||||
if( oldpos != screen->GetCrossHairPosition() )
|
||||
{
|
||||
pos = screen->GetCrossHairPosition();
|
||||
screen->SetCrossHairPosition( oldpos );
|
||||
m_canvas->CrossHairOff( aDC );
|
||||
screen->SetCrossHairPosition( pos );
|
||||
m_canvas->CrossHairOn( aDC );
|
||||
|
||||
if( m_canvas->IsMouseCaptured() )
|
||||
{
|
||||
m_canvas->CallMouseCapture( aDC, aPosition, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
UpdateStatusBar(); /* Display new cursor coordinates */
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* 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 )
|
|||
EVT_TOOL( ID_NEW_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_VIEWER, PCB_EDIT_FRAME::Process_Special_Functions )
|
||||
|
||||
// Menu Files:
|
||||
EVT_MENU( ID_MAIN_MENUBAR, PCB_EDIT_FRAME::Process_Special_Functions )
|
||||
|
|
|
@ -16,7 +16,9 @@ enum pcbnew_ids
|
|||
ID_MAIN_MENUBAR = ID_END_LIST,
|
||||
ID_MICROWAVE_V_TOOLBAR,
|
||||
ID_OPEN_MODULE_EDITOR,
|
||||
ID_OPEN_MODULE_VIEWER,
|
||||
ID_READ_NETLIST,
|
||||
ID_SET_RELATIVE_OFFSET,
|
||||
|
||||
// Right vertical tool bar command IDs.
|
||||
ID_PCB_HIGHLIGHT_BUTT,
|
||||
|
@ -309,7 +311,18 @@ enum pcbnew_ids
|
|||
ID_MODEDIT_MODULE_MIRROR,
|
||||
ID_MODEDIT_IMPORT_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__ */
|
||||
|
|
|
@ -66,6 +66,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
|
|||
KiBitmap( new_library_xpm ),
|
||||
_( "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->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ),
|
||||
_( "Delete part from active library" ) );
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* 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()
|
|||
m_mainToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, KiBitmap( modedit_xpm ),
|
||||
_( "Open module editor" ) );
|
||||
|
||||
#if 0
|
||||
// Not yet existing commands
|
||||
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->AddTool( ID_OPEN_MODULE_VIEWER, wxEmptyString, KiBitmap( library_browse_xpm ),
|
||||
_( "Open module viewer" ) );
|
||||
|
||||
m_mainToolBar->AddSeparator();
|
||||
msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, HK_UNDO, IS_COMMENT );
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <dialog_exchange_modules_base.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.
|
||||
|
||||
|
@ -152,7 +153,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
|
|||
FILE* FichCmp, * NewFile;
|
||||
char line[1024];
|
||||
wxString msg;
|
||||
char* quiet_gcc_4_4_3;
|
||||
// char* quiet_gcc_4_4_3;
|
||||
|
||||
if( old_name == new_name )
|
||||
return 0;
|
||||
|
@ -588,7 +589,6 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
|
|||
MODULE* Module = GetBoard()->m_Modules;
|
||||
wxString msg;
|
||||
wxString wildcard;
|
||||
char* quiet_gcc_4_4_3;
|
||||
|
||||
if( Module == NULL )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue