Commit db6630b8 authored by jerryjacobs's avatar jerryjacobs

Added hauptmech big patch, Updated documentation to match this patch. See CHANGELOG.txt

parent 831517fb
......@@ -110,8 +110,9 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
g_Parm_3D_Visu.m_BoardSize.y );
// @TODO: epoxy_width (board thickness) must be set by user,
// because all boards thickness no not match with this setup:
double epoxy_width = 1.6; // epoxy width in mm
g_Parm_3D_Visu.m_Epoxy_Width = epoxy_width / 2.54 * 1000
//double epoxy_width = 1.6; // epoxy width in mm
g_Parm_3D_Visu.m_Epoxy_Width = pcb->m_BoardSettings->m_LayerThickness
* g_Parm_3D_Visu.m_BoardScale;
/* calculate z position for each layer */
......
......@@ -4,6 +4,20 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.
2009-june-19 UPDATE Jerry Jacobs <jerkejacobs@gmail.com>
================================================================================
Added Hauptmech patch.
I Updated doc to match this patch.
++Pcbnew:
> * Board thickness in the 3D view can be set in *.pcb files (hand edit)
> * Hotkey files bug: incorrect file extension as default in some open/save dialogs.
> * Hotkeys made available for pcbnew [add track] and [add module] tools.
> * Drag and Move hotkeys extended to drag tracks and move nodes/vias when the [add track] tool is active.
> * Show/Hide Invisible Text button added to lefthand menu
> * Dropdown list of clearance history available next to trackwidth history.
2009-june-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Pcbnew:
......
......@@ -114,11 +114,14 @@ If linux, use your package manager to install zlib pre-built binaries.
Note (JP Charras):
Under Linux, zlib is usually installed.
if not found by wxWidget installation, wxWidgets creates an alternate zlib
Under Windows, zlib is not installed, so my cmake buld try to use the
If it is not found by the wxWidget installation, wxWidgets creates an alternate zlib library.
Under Windows, if zlib is not installed, my cmake build will try to use the
wxWidgets zlib build. So, under windows kicad build should work without
zlib install.
If you are using the wxWidget zlib, make sure that the wxWidgets/src/zlib directory is copied
to ${wxWidgets_ROOT_DIR}/src/zlib
-----------------------------------------------------------------------------
......
......@@ -164,6 +164,7 @@ set(BITMAP_SRCS
Info.xpm
Insert_Module_Board.xpm
Invert_Module.xpm
invisible_text.xpm
jigsaw.xpm
kicad_icon_small.xpm
Label2GLabel.xpm
......
/* XPM */
#ifndef XPMMAIN
extern const char *invisible_text_xpm[];
#else
const char *invisible_text_xpm[] = {
"16 16 4 1",
" c None",
". c #00009B",
"+ c #000098",
"@ c #00005D",
" .............. ",
" ",
" .+ .... .. ",
" .@ .... . ",
" ",
" ",
" .... ",
" .... ",
" ",
" .... ",
" ",
" .... ",
" ",
" .....+ ",
" ........ ",
" "};
#endif
......@@ -58,6 +58,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
MsgPanel = NULL;
m_CurrentScreen = NULL;
m_ID_current_state = 0;
m_ID_last_state = 0;
m_HTOOL_current_state = 0;
m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines
m_Draw_Grid = FALSE; // TRUE pour avoir la axes dessinee
......
......@@ -245,6 +245,7 @@ wxString EDA_FileSelector( const wxString& Title, /* Dialog ti
wxString curr_cwd = wxGetCwd();
wxString defaultname = FileName;
wxString defaultpath = Path;
wxString dotted_Ext = wxT(".") + Ext;
defaultname.Replace( wxT( "/" ), STRING_DIR_SEP );
defaultpath.Replace( wxT( "/" ), STRING_DIR_SEP );
......@@ -268,7 +269,7 @@ wxString EDA_FileSelector( const wxString& Title, /* Dialog ti
fullfilename = wxFileSelector( wxString( Title ),
defaultpath,
defaultname,
Ext,
dotted_Ext,
Mask,
flag, /* open mode wxFD_OPEN, wxFD_SAVE .. */
Frame,
......
......@@ -381,7 +381,7 @@ int WinEDA_BasicFrame::WriteHotkeyConfigFile( const wxString&
{
wxString Mask, Path, Ext;
Ext = DEFAULT_HOTKEY_FILENAME_EXT;
Mask = wxT( "*" ) + Ext;
Mask = wxT( "*." ) + Ext;
Path = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFilename = EDA_FileSelector( _( "Save Hotkey Configuration File:" ),
Path, /* Chemin par defaut */
......@@ -499,7 +499,7 @@ int WinEDA_BasicFrame::ReadHotkeyConfigFile( const wxString&
{
wxString Mask, Path, Ext;
Ext = DEFAULT_HOTKEY_FILENAME_EXT;
Mask = wxT( "*" ) + Ext;
Mask = wxT( "*." ) + Ext;
Path = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFilename = EDA_FileSelector( _( "Open Hotkey Configuration File:" ),
Path, /* Chemin par defaut */
......
......@@ -116,6 +116,7 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += wxT(".");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile( FullFileName,
s_Eeschema_Hokeys_Descr,
......
......@@ -63,6 +63,7 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += wxT(".");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile( FullFileName, s_Gerbview_Hokeys_Descr, true );
break;
......@@ -75,6 +76,7 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
{
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += wxT(".");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
AddDelimiterString( FullFileName );
wxString editorname = wxGetApp().GetEditorName();
......@@ -161,6 +163,7 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += wxT(".");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile( FullFileName,
s_Gerbview_Hokeys_Descr,
......
......@@ -33,6 +33,7 @@ enum KICAD_T {
TYPE_TEXTE_MODULE,
TYPE_EDGE_MODULE,
TYPE_TRACK,
TYPE_CLR,
TYPE_ZONE,
TYPE_VIA,
TYPE_MARKER,
......
......@@ -156,6 +156,7 @@ extern const char* import3d_xpm[];
extern const char* info_xpm[];
extern const char* insert_module_board_xpm[];
extern const char* invert_module_xpm[];
extern const char* invisible_text_xpm[];
extern const char* jigsaw_xpm[];
extern const char* kicad_icon_small_xpm[];
extern const char* kicad_icon_xpm[];
......
......@@ -8,7 +8,7 @@
#ifndef HOTKEYS_BASIC_H
#define HOTKEYS_BASIC_H
#define DEFAULT_HOTKEY_FILENAME_EXT wxT( ".key" )
#define DEFAULT_HOTKEY_FILENAME_EXT wxT( "key" )
/* keyword idetifier in kicad config use ti store/retrieve path option */
#define HOTKEY_CFG_PATH_OPT wxT( "HotkeyPathOption" )
......
......@@ -702,6 +702,7 @@ enum main_id {
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
ID_AUX_TOOLBAR_PCB_CLR_WIDTH,
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
ID_AUX_TOOLBAR_PCB_UNUSED3,
......@@ -804,10 +805,10 @@ enum main_id {
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
ID_TB_OPTIONS_SHOW_DCODES,
ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
ID_TB_OPTIONS_UNUSED6,
ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
ID_TB_OPTIONS_UNUSED7,
ID_TB_OPTIONS_UNUSED8,
......@@ -866,6 +867,9 @@ enum main_id {
ID_PCB_MUWAVE_UNUSED2,
ID_PCB_MUWAVE_END_CMD,
ID_TOGGLE_PRESENT_COMMAND,
ID_END_LIST
};
......
......@@ -159,10 +159,12 @@ public:
int m_PcbTextWidth; // current Pcb (not module) Text width
wxSize m_PcbTextSize; // current Pcb (not module) Text size
int m_TrackClearence; // track to track and track to pads clearance
int m_TrackClearenceHistory[HISTORY_NUMBER]; // Last HISTORY_NUMBER used track widths
int m_TrackMinWidth; // track min value for width ((min copper size value
int m_ViasMinSize; // vias (not micro vias) min diameter
int m_MicroViasMinSize; // micro vias (not vias) min diameter
int m_MaskMargin; // Solder mask margin
int m_LayerThickness; // Layer Thickness for 3D viewer
// Color options for screen display of the Printed Board:
int m_PcbGridColor; // Grid color
......
......@@ -372,10 +372,12 @@ class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
public:
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelTrackWidthBox;
WinEDAChoiceBox* m_SelClrWidthBox;
WinEDAChoiceBox* m_SelViaSizeBox;
private:
bool m_SelTrackWidthBox_Changed;
bool m_SelClrWidthBox_Changed;
bool m_SelViaSizeBox_Changed;
DRC* m_drc; ///< the DRC controller, see drc.cpp
......
......@@ -156,6 +156,7 @@ public:
int m_CursorShape; // shape for cursor (0 = default cursor)
int m_ID_current_state; // Id of active button on the vertical toolbar
int m_ID_last_state; // Id of previous active button on the vertical toolbar
int m_HTOOL_current_state; // Id of active button on horizontal toolbar
int m_InternalUnits; // Internal units count in 1 inch
......
......@@ -8,7 +8,7 @@ else(ZLIB_FOUND)
# include files are in ${wxWidgets_ROOT_DIR}/src/zlib
# and the corresponding library is libwxzlib-<version>.a (like libwxzlib-2.8.a)
# and we try to use it
set(ZLIB_INCLUDE_DIR ${wxWidgets_ROOT_DIR}/src/zlib)
find_path(ZLIB_INCLUDE_DIR zlib.h PATHS ${wxWidgets_ROOT_DIR}/src/zlib/ DOC "location of zlib include files")
set(ZLIB_LIBRARIES ${wxWidgets_ROOT_DIR}/lib/libwxzlib-2.8.a)
endif(ZLIB_FOUND)
......
......@@ -205,6 +205,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
m_TrackWidthHistory[ii] = 0; // Last HISTORY_NUMBER used track widths
m_TrackClearenceHistory[ii] = 0;
m_ViaSizeHistory[ii] = 0; // Last HISTORY_NUMBER used via sizes
}
......
......@@ -221,6 +221,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
g_UnitMetric = INCHES;
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox_Changed = TRUE;
UpdateStatusBar(); /* Reaffichage des coord curseur */
ReCreateAuxiliaryToolbar();
DisplayUnitsMsg();
......@@ -273,11 +274,18 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE:
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
DisplayOpt.ContrastModeDisplay =
m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE:
if(!m_OptionsToolBar->GetToolState( id ))
g_ModuleTextNOVColor &= (~ITEM_NOT_SHOW);
else
g_ModuleTextNOVColor |= ( ITEM_NOT_SHOW);
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1:
if( m_OptionsToolBar->GetToolState( id ) ) // show aux V toolbar (Microwave tool)
......
......@@ -118,6 +118,7 @@ void DIALOG_TRACKS_OPTIONS::OnButtonOkClick( wxCommandEvent& event )
m_Parent->AddHistory( g_DesignSettings.m_CurrentViaSize, TYPE_VIA );
m_Parent->AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPE_TRACK );
m_Parent->AddHistory( g_DesignSettings.m_TrackClearence, TYPE_CLR );
EndModal( 1 );
}
......@@ -169,7 +170,42 @@ void WinEDA_BasePcbFrame::AddHistory( int value, KICAD_T type )
}
break;
case TYPE_CLR:
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackClearenceHistory[ii] == value )
{
addhistory = FALSE;
break;
}
}
if( !addhistory )
break;
for( ii = HISTORY_NUMBER - 1; ii > 0; ii-- )
{
g_DesignSettings.m_TrackClearenceHistory[ii] =
g_DesignSettings.m_TrackClearenceHistory[ii - 1];
}
g_DesignSettings.m_TrackClearenceHistory[0] = value;
// Reclassement par valeur croissante
for( ii = 0; ii < HISTORY_NUMBER - 1; ii++ )
{
if( g_DesignSettings.m_TrackClearenceHistory[ii + 1] == 0 )
break; // Fin de liste
if( g_DesignSettings.m_TrackClearenceHistory[ii] >
g_DesignSettings.m_TrackClearenceHistory[ii + 1] )
{
EXCHG( g_DesignSettings.m_TrackClearenceHistory[ii],
g_DesignSettings.m_TrackClearenceHistory[ii + 1] );
}
}
break;
case TYPE_VIA:
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
......
......@@ -30,8 +30,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{
int id = event.GetId();
wxPoint pos;
int itmp;
wxClientDC dc( DrawPanel );
BOARD_ITEM* DrawStruct = GetCurItem();
int toggle = 0;
DrawPanel->CursorOff( &dc );
DrawPanel->PrepareGraphicContext( &dc );
......@@ -45,6 +49,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case wxID_CUT:
case wxID_COPY:
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
case ID_AUX_TOOLBAR_PCB_CLR_WIDTH:
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
case ID_ON_GRID_SELECT:
case ID_ON_ZOOM_SELECT:
......@@ -156,7 +161,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
else
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
break;
case ID_TOGGLE_PRESENT_COMMAND:
/* if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
*/
break;
default: // Finish (abort ) the command
if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur )
......@@ -164,17 +177,160 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
if( m_ID_current_state != id )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
if( m_ID_current_state != id ){
if (m_ID_last_state != m_ID_current_state)
m_ID_last_state = m_ID_current_state;
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
}
break;
}
switch( id ) // Execute command
{
case 0: break;
case ID_EXIT:
Close( true );
break;
case ID_TOGGLE_PRESENT_COMMAND:
switch( m_ID_current_state )
{
case 0:
/* if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = PcbGeneralLocateAndDisplay();
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
break;
SendMessageToEESCHEMA( DrawStruct );
// An item is found
SetCurItem( DrawStruct );
switch( DrawStruct->Type() )
{
case TYPE_TRACK:
case TYPE_VIA:
if( DrawStruct->m_Flags & IS_NEW )
{
End_Route( (TRACK*) DrawStruct, DC );
DrawPanel->m_AutoPAN_Request = false;
}
else if( DrawStruct->m_Flags == 0 )
{
Edit_TrackSegm_Width( DC, (TRACK*) DrawStruct );
}
break;
case TYPE_TEXTE:
InstallTextPCBOptionsFrame( (TEXTE_PCB*) DrawStruct, DC );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_PAD:
InstallPadOptionsFrame( (D_PAD*) DrawStruct, &dc, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_MODULE:
InstallModuleOptionsFrame( (MODULE*) DrawStruct, &dc );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_MIRE:
InstallMireOptionsFrame( (MIREPCB*) DrawStruct, &dc, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_COTATION:
Install_Edit_Cotation( (COTATION*) DrawStruct, &dc, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_TEXTE_MODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, &dc, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_DRAWSEGMENT:
InstallGraphicItemPropertiesDialog((DRAWSEGMENT*)DrawStruct, &dc);
break;
case TYPE_ZONE_CONTAINER:
if( DrawStruct->m_Flags )
break;
Edit_Zone_Params( &dc, (ZONE_CONTAINER*) DrawStruct );
break;
default:
break;
}
break; // end case 0
*/
toggle = 1;
break;
case ID_TRACK_BUTT:
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
{
End_Route( (TRACK*) DrawStruct, &dc );
DrawPanel->m_AutoPAN_Request = false;
}
else
toggle = 1;
break;
case ID_PCB_ZONES_BUTT:
if ( End_Zone( &dc ) )
{
DrawPanel->m_AutoPAN_Request = false;
SetCurItem( NULL );
}
else
toggle = 1;
break;
case ID_LINE_COMMENT_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT:
if( DrawStruct == NULL )
{}
else if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
{
DisplayError( this, wxT( "DrawStruct Type error" ) );
DrawPanel->m_AutoPAN_Request = false;
}
else if( (DrawStruct->m_Flags & IS_NEW) )
{
End_Edge( (DRAWSEGMENT*) DrawStruct, &dc );
DrawPanel->m_AutoPAN_Request = false;
SetCurItem( NULL );
}
else
toggle = 1;
break;
default:
toggle = 1;
break;
}
if (toggle){
int swap = m_ID_last_state;
m_ID_last_state = m_ID_current_state;
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
m_ID_current_state = swap;
}
//SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
event.SetId(m_ID_current_state);
Process_Special_Functions(event);
break;
case ID_OPEN_MODULE_EDITOR:
if( m_ModuleEditFrame == NULL )
{
......@@ -921,6 +1077,18 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
g_DesignSettings.m_UseConnectedTrackWidth = false;
}
break;
case ID_AUX_TOOLBAR_PCB_CLR_WIDTH:
{
int ii = m_SelClrWidthBox->GetChoice();
g_DesignSettings.m_TrackClearence =
g_DesignSettings.m_TrackClearenceHistory[ii];
DisplayTrackSettings();
m_SelTrackWidthBox_Changed = false;
m_SelClrWidthBox_Changed = false;
m_SelViaSizeBox_Changed = false;
g_DesignSettings.m_UseConnectedTrackWidth = false;
}
break;
case ID_POPUP_PCB_SELECT_WIDTH1:
case ID_POPUP_PCB_SELECT_WIDTH2:
......@@ -1050,8 +1218,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
default:
DisplayError( this,
wxT( "WinEDA_PcbFrame::Process_Special_Functions() id error" ) );
wxString msg;
msg.Printf(
wxT( "WinEDA_PcbFrame::Process_Special_Functions() id %d error" ),
DrawStruct->Type() );
DisplayError( this, msg );
break;
}
......
......@@ -33,6 +33,7 @@ void WinEDA_PcbFrame::DisplayTrackSettings()
buftrc.GetData(), bufvia.GetData() );
Affiche_Message( msg );
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox_Changed = TRUE;
m_SelViaSizeBox_Changed = TRUE;
}
......
......@@ -154,6 +154,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
}
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox_Changed = TRUE;
m_SelViaSizeBox_Changed = TRUE;
if( Append )
......@@ -263,7 +264,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
/* Rebuild the new pad list (for drc and ratsnet control ...) */
GetBoard()->m_Status_Pcb = 0;
DrawPanel->Refresh( true);
Compile_Ratsnest( NULL, true );
......
......@@ -32,135 +32,111 @@
/* local variables */
/* Hotkey list: */
static Ki_HotkeyInfo HkSwitch2CopperLayer( wxT(
"Switch to Copper layer" ),
HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEUP );
static Ki_HotkeyInfo HkSwitch2ComponentLayer( wxT(
"Switch to Component layer" ),
HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEDOWN );
static Ki_HotkeyInfo HkSwitch2InnerLayer1( wxT(
"Switch to Inner layer 1" ),
HK_SWITCH_LAYER_TO_INNER1, WXK_F5 );
static Ki_HotkeyInfo HkSwitch2InnerLayer2( wxT(
"Switch to Inner layer 2" ),
HK_SWITCH_LAYER_TO_INNER2, WXK_F6 );
static Ki_HotkeyInfo HkSwitch2InnerLayer3( wxT(
"Switch to Inner layer 3" ),
HK_SWITCH_LAYER_TO_INNER3, WXK_F7 );
static Ki_HotkeyInfo HkSwitch2InnerLayer4( wxT(
"Switch to Inner layer 4" ),
HK_SWITCH_LAYER_TO_INNER4, WXK_F8 );
static Ki_HotkeyInfo HkSwitch2InnerLayer5( wxT(
"Switch to Inner layer 5" ),
HK_SWITCH_LAYER_TO_INNER5, WXK_F9 );
static Ki_HotkeyInfo HkSwitch2InnerLayer6( wxT(
"Switch to Inner layer 6" ),
HK_SWITCH_LAYER_TO_INNER6, WXK_F10 );
static Ki_HotkeyInfo HkSwitch2NextCopperLayer( wxT(
"Switch to Next Layer" ),
HK_SWITCH_LAYER_TO_NEXT, '+' );
static Ki_HotkeyInfo HkSwitch2PreviousCopperLayer( wxT(
"Switch to Previous Layer" ),
HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
static Ki_HotkeyInfo HkSavefile( wxT( "Save board" ), HK_SAVE_BOARD, 'S' + GR_KB_CTRL );
static Ki_HotkeyInfo HkLoadfile( wxT( "Load board" ), HK_LOAD_BOARD, 'L' + GR_KB_CTRL );
static Ki_HotkeyInfo HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
static Ki_HotkeyInfo HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK );
static Ki_HotkeyInfo HkAddMicroVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' );
static Ki_HotkeyInfo HkAddVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL );
static Ki_HotkeyInfo HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
static Ki_HotkeyInfo HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT, 'F' );
static Ki_HotkeyInfo HkRotateFootprint( wxT( "Rotate Footprint" ), HK_ROTATE_FOOTPRINT, 'R' );
static Ki_HotkeyInfo HkMoveFootprint( wxT( "Move Footprint" ), HK_MOVE_FOOTPRINT, 'M' );
static Ki_HotkeyInfo HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_FOOTPRINT, 'G' );
static Ki_HotkeyInfo HkGetAndMoveFootprint( wxT(
"Get and Move Footprint" ),
HK_GET_AND_MOVE_FOOTPRINT, 'T' );
static Ki_HotkeyInfo HkLock_Unlock_Footprint( wxT(
"Lock/Unlock Footprint" ),
HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
static Ki_HotkeyInfo HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE );
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ), HK_RESET_LOCAL_COORD, ' ' );
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static Ki_HotkeyInfo HkHelp( wxT( "Help: this message" ), HK_HELP, '?' );
static Ki_HotkeyInfo HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' + GR_KB_CTRL );
static Ki_HotkeyInfo HkTrackDisplayMode( wxT(
"Track Display Mode" ),
HK_SWITCH_TRACK_DISPLAY_MODE, 'K' );
static Ki_HotkeyInfo HkSwitch2CopperLayer(wxT("Switch to Copper layer"),
HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEUP);
static Ki_HotkeyInfo HkSwitch2ComponentLayer(wxT("Switch to Component layer"),
HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEDOWN);
static Ki_HotkeyInfo HkSwitch2InnerLayer1(wxT("Switch to Inner layer 1"),
HK_SWITCH_LAYER_TO_INNER1, WXK_F5);
static Ki_HotkeyInfo HkSwitch2InnerLayer2(wxT("Switch to Inner layer 2"),
HK_SWITCH_LAYER_TO_INNER2, WXK_F6);
static Ki_HotkeyInfo HkSwitch2InnerLayer3(wxT("Switch to Inner layer 3"),
HK_SWITCH_LAYER_TO_INNER3, WXK_F7);
static Ki_HotkeyInfo HkSwitch2InnerLayer4(wxT("Switch to Inner layer 4"),
HK_SWITCH_LAYER_TO_INNER4, WXK_F8);
static Ki_HotkeyInfo HkSwitch2InnerLayer5(wxT("Switch to Inner layer 5"),
HK_SWITCH_LAYER_TO_INNER5, WXK_F9);
static Ki_HotkeyInfo HkSwitch2InnerLayer6(wxT("Switch to Inner layer 6"),
HK_SWITCH_LAYER_TO_INNER6, WXK_F10);
static Ki_HotkeyInfo HkSwitch2NextCopperLayer(wxT("Switch to Next Layer"),
HK_SWITCH_LAYER_TO_NEXT, '+');
static Ki_HotkeyInfo HkSwitch2PreviousCopperLayer(wxT(
"Switch to Previous Layer"), HK_SWITCH_LAYER_TO_PREVIOUS, '-');
static Ki_HotkeyInfo HkSavefile(wxT("Save board"), HK_SAVE_BOARD, 'S'
+ GR_KB_CTRL);
static Ki_HotkeyInfo HkLoadfile(wxT("Load board"), HK_LOAD_BOARD, 'L'
+ GR_KB_CTRL);
static Ki_HotkeyInfo HkFindItem(wxT("Find Item"), HK_FIND_ITEM, 'F'
+ GR_KB_CTRL);
static Ki_HotkeyInfo HkBackspace(wxT("Delete track segment"), HK_BACK_SPACE,
WXK_BACK);
static Ki_HotkeyInfo HkAddVia(wxT("Add Via"), HK_ADD_VIA, 'V');
static Ki_HotkeyInfo HkAddMicroVia(wxT("Add MicroVia"), HK_ADD_MICROVIA, 'V'
+ GR_KB_CTRL);
static Ki_HotkeyInfo HkEndTrack(wxT("End Track"), HK_END_TRACK, WXK_END);
static Ki_HotkeyInfo HkFlipFootprint(wxT("Flip Footprint"), HK_FLIP_FOOTPRINT,
'F');
static Ki_HotkeyInfo HkRotateFootprint(wxT("Rotate Footprint"),
HK_ROTATE_FOOTPRINT, 'R');
static Ki_HotkeyInfo HkMoveFootprint(wxT("Move Footprint"), HK_MOVE_FOOTPRINT,
'M');
static Ki_HotkeyInfo HkDragFootprint(wxT("Drag Footprint"), HK_DRAG_FOOTPRINT,
'G');
static Ki_HotkeyInfo HkGetAndMoveFootprint(wxT("Get and Move Footprint"),
HK_GET_AND_MOVE_FOOTPRINT, 'T');
static Ki_HotkeyInfo HkLock_Unlock_Footprint(wxT("Lock/Unlock Footprint"),
HK_LOCK_UNLOCK_FOOTPRINT, 'L');
static Ki_HotkeyInfo HkDelete(wxT("Delete Track or Footprint"), HK_DELETE,
WXK_DELETE);
static Ki_HotkeyInfo HkResetLocalCoord(wxT("Reset local coord."),
HK_RESET_LOCAL_COORD, ' ');
static Ki_HotkeyInfo HkZoomCenter(wxT("Zoom Center"), HK_ZOOM_CENTER, WXK_F4);
static Ki_HotkeyInfo HkZoomRedraw(wxT("Zoom Redraw"), HK_ZOOM_REDRAW, WXK_F3);
static Ki_HotkeyInfo HkZoomOut(wxT("Zoom Out"), HK_ZOOM_OUT, WXK_F2);
static Ki_HotkeyInfo HkZoomIn(wxT("Zoom In"), HK_ZOOM_IN, WXK_F1);
static Ki_HotkeyInfo HkHelp(wxT("Help: this message"), HK_HELP, '?');
static Ki_HotkeyInfo HkSwitchUnits(wxT("Switch Units"), HK_SWITCH_UNITS, 'U'
+ GR_KB_CTRL);
static Ki_HotkeyInfo HkTrackDisplayMode(wxT("Track Display Mode"),
HK_SWITCH_TRACK_DISPLAY_MODE, 'K');
static Ki_HotkeyInfo HkAddModule(wxT("Add Module"), HK_ADD_MODULE, 'O');
static Ki_HotkeyInfo HkAddTrack(wxT("Add Track or Via"), HK_ADD_TRACK, 'J');
static Ki_HotkeyInfo HkToggle(wxT("Toggle Present Command"), HK_TOGGLE, 'E');
// List of common hotkey descriptors
Ki_HotkeyInfo* s_Common_Hotkey_List[] = {
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkSwitchUnits, &HkResetLocalCoord,
NULL
};
Ki_HotkeyInfo
* s_Common_Hotkey_List[] = { &HkHelp, &HkZoomIn, &HkZoomOut,
&HkZoomRedraw, &HkZoomCenter, &HkSwitchUnits,
&HkResetLocalCoord, NULL };
// List of hotkey descriptors for pcbnew
Ki_HotkeyInfo* s_board_edit_Hotkey_List[] = {
&HkTrackDisplayMode,
&HkDelete, &HkBackspace,
&HkAddVia,
&HkAddMicroVia,
&HkEndTrack,
&HkMoveFootprint, &HkFlipFootprint,
&HkRotateFootprint, &HkDragFootprint,
&HkGetAndMoveFootprint,
&HkLock_Unlock_Footprint,
&HkSavefile, &HkLoadfile, &HkFindItem,
&HkSwitch2CopperLayer,
&HkSwitch2InnerLayer1,
&HkSwitch2InnerLayer2,
&HkSwitch2InnerLayer3,
&HkSwitch2InnerLayer4,
&HkSwitch2InnerLayer5,
&HkSwitch2InnerLayer6,
&HkSwitch2ComponentLayer,
&HkSwitch2NextCopperLayer,
&HkSwitch2PreviousCopperLayer,
NULL
};
Ki_HotkeyInfo* s_board_edit_Hotkey_List[] = { &HkTrackDisplayMode, &HkDelete,
&HkBackspace, &HkAddVia, &HkAddMicroVia, &HkEndTrack, &HkMoveFootprint,
&HkFlipFootprint, &HkRotateFootprint, &HkDragFootprint,
&HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile,
&HkLoadfile, &HkFindItem, &HkSwitch2CopperLayer, &HkSwitch2InnerLayer1,
&HkSwitch2InnerLayer2, &HkSwitch2InnerLayer3, &HkSwitch2InnerLayer4,
&HkSwitch2InnerLayer5, &HkSwitch2InnerLayer6, &HkSwitch2ComponentLayer,
&HkSwitch2NextCopperLayer, &HkSwitch2PreviousCopperLayer, &HkAddModule,
&HkAddTrack, &HkToggle, NULL };
// List of hotkey descriptors for the module editor
Ki_HotkeyInfo* s_module_edit_Hotkey_List[] = {
NULL
};
Ki_HotkeyInfo* s_module_edit_Hotkey_List[] = { NULL };
// list of sections and corresponding hotkey list for pcbnew (used to create an hotkey config file)
struct Ki_HotkeyInfoSectionDescriptor s_Pcbnew_Editor_Hokeys_Descr[] =
{
{ &g_CommonSectionTag, s_Common_Hotkey_List, "Common keys" },
{ &g_BoardEditorSectionTag, s_board_edit_Hotkey_List, "Board editor keys" },
{ &g_ModuleEditSectionTag, s_module_edit_Hotkey_List, "Footprint editor keys" },
{ NULL, NULL, NULL }
};
struct Ki_HotkeyInfoSectionDescriptor s_Pcbnew_Editor_Hokeys_Descr[] = { {
&g_CommonSectionTag, s_Common_Hotkey_List, "Common keys" },
{ &g_BoardEditorSectionTag, s_board_edit_Hotkey_List,
"Board editor keys" }, { &g_ModuleEditSectionTag,
s_module_edit_Hotkey_List, "Footprint editor keys" }, { NULL,
NULL, NULL } };
// list of sections and corresponding hotkey list for the board editor (used to list current hotkeys)
struct Ki_HotkeyInfoSectionDescriptor s_Board_Editor_Hokeys_Descr[] =
{
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL },
{ &g_BoardEditorSectionTag, s_board_edit_Hotkey_List, NULL },
{ NULL, NULL, NULL }
};
struct Ki_HotkeyInfoSectionDescriptor s_Board_Editor_Hokeys_Descr[] = { {
&g_CommonSectionTag, s_Common_Hotkey_List, NULL }, {
&g_BoardEditorSectionTag, s_board_edit_Hotkey_List, NULL }, { NULL,
NULL, NULL } };
// list of sections and corresponding hotkey list for the footprint editor (used to list current hotkeys)
struct Ki_HotkeyInfoSectionDescriptor s_Module_Editor_Hokeys_Descr[] =
{
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL },
{ &g_ModuleEditSectionTag, s_module_edit_Hotkey_List, NULL },
{ NULL, NULL, NULL }
};
struct Ki_HotkeyInfoSectionDescriptor s_Module_Editor_Hokeys_Descr[] = { {
&g_CommonSectionTag, s_Common_Hotkey_List, NULL }, {
&g_ModuleEditSectionTag, s_module_edit_Hotkey_List, NULL }, { NULL,
NULL, NULL } };
/***********************************************************/
void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
EDA_BaseStruct* DrawStruct )
void WinEDA_PcbFrame::OnHotKey(wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct)
/***********************************************************/
/* Hot keys. Some commands are relatives to the item under the mouse cursor
......@@ -171,432 +147,457 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
*/
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
bool PopupOn = (GetCurItem() && GetCurItem()->m_Flags);
bool ItemFree = (GetCurItem()==0 || GetCurItem()->m_Flags==0);
if( hotkey == 0 )
return;
MODULE* module = NULL;
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (just easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 )
hotkey += 'A' - 1;
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( hotkey, s_board_edit_Hotkey_List );
if( HK_Descr == NULL )
return;
int ll;
switch( HK_Descr->m_Idcommand )
{
default:
case HK_NOT_FOUND:
return;
break;
case HK_SWITCH_LAYER_TO_PREVIOUS:
ll = GetScreen()->m_Active_Layer;
if( (ll <= COPPER_LAYER_N) || (ll > CMP_N) )
break;
if( GetBoard()->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer
ll = COPPER_LAYER_N;
else if( ll == CMP_N )
ll = MAX( COPPER_LAYER_N, GetBoard()->m_BoardSettings->m_CopperLayerCount - 2 );
else
ll--;
SwitchLayer( DC, ll );
break;
case HK_SWITCH_LAYER_TO_NEXT:
ll = GetScreen()->m_Active_Layer;
if( (ll < COPPER_LAYER_N) || (ll >= CMP_N) )
break;
if( GetBoard()->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer
ll = COPPER_LAYER_N;
else if( ll >= GetBoard()->m_BoardSettings->m_CopperLayerCount - 2 )
ll = CMP_N;
else
ll++;
SwitchLayer( DC, ll );
break;
case HK_SWITCH_LAYER_TO_COMPONENT:
SwitchLayer( DC, CMP_N );
break;
case HK_SWITCH_LAYER_TO_COPPER:
SwitchLayer( DC, COPPER_LAYER_N );
break;
case HK_SWITCH_LAYER_TO_INNER1:
SwitchLayer( DC, LAYER_N_2 );
break;
case HK_SWITCH_LAYER_TO_INNER2:
SwitchLayer( DC, LAYER_N_3 );
break;
case HK_SWITCH_LAYER_TO_INNER3:
SwitchLayer( DC, LAYER_N_4 );
break;
case HK_SWITCH_LAYER_TO_INNER4:
SwitchLayer( DC, LAYER_N_5 );
break;
case HK_SWITCH_LAYER_TO_INNER5:
SwitchLayer( DC, LAYER_N_6 );
break;
case HK_SWITCH_LAYER_TO_INNER6:
SwitchLayer( DC, LAYER_N_7 );
break;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_Board_Editor_Hokeys_Descr );
break;
case HK_ZOOM_IN:
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break;
case HK_SWITCH_UNITS:
g_UnitMetric = (g_UnitMetric == INCHES ) ? MILLIMETRE : INCHES;
break;
case HK_SWITCH_TRACK_DISPLAY_MODE:
DisplayOpt.DisplayPcbTrackFill ^= 1; DisplayOpt.DisplayPcbTrackFill &= 1;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
GetScreen()->SetRefreshReq();
break;
case HK_DELETE:
OnHotkeyDeleteItem( DC, DrawStruct );
break;
case HK_BACK_SPACE:
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= CMP_N )
{
if( ItemFree )
{
// no track is currently being edited - select a segment and remove it.
// @todo: possibly? pass the HK command code to PcbGeneralLocateAndDisplay() so it can restrict its search to specific item types.
// @todo: use PcbGeneralLocateAndDisplay() everywhere in this source file.
DrawStruct = PcbGeneralLocateAndDisplay();
// don't let backspace delete modules!!
if( DrawStruct && (DrawStruct->Type() == TYPE_TRACK
|| DrawStruct->Type() == TYPE_VIA) )
{
Delete_Segment( DC, (TRACK*) DrawStruct );
SetCurItem(NULL);
}
GetScreen()->SetModify();
}
else if( GetCurItem()->Type() == TYPE_TRACK )
{
// then an element is being edited - remove the last segment.
// simple lines for debugger:
TRACK* track = (TRACK*) GetCurItem() ;
track = Delete_Segment( DC, track );
SetCurItem( track );
GetScreen()->SetModify();
}
}
break;
case HK_END_TRACK:
if( ! ItemFree && (GetCurItem()->Type() == TYPE_TRACK) && ((GetCurItem()->m_Flags & IS_NEW) != 0) )
{
// A new track is in progress: call to End_Route()
DrawPanel->MouseToCursorSchema();
End_Route( (TRACK*) GetCurItem(), DC );
}
break;
case HK_GET_AND_MOVE_FOOTPRINT:
if( ItemFree )
{
wxCommandEvent evt;
evt.SetId( ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST );
Process_Special_Functions( evt );
}
break;
case HK_FIND_ITEM:
if( ItemFree )
{
wxCommandEvent evt;
evt.SetId( ID_FIND_ITEMS );
Process_Special_Functions( evt );
}
break;
case HK_LOAD_BOARD:
if( ItemFree )
{
// try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId( ID_LOAD_FILE );
Files_io( evt );
}
break;
case HK_SAVE_BOARD:
if( ItemFree )
{
// try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId( ID_SAVE_BOARD );
Files_io( evt );
}
break;
case HK_ADD_MICROVIA: // Place a micro via if a track is in progress
if( m_ID_current_state != ID_TRACK_BUTT )
return;
if( ItemFree ) // no track in progress: nothing to do
break;
if( GetCurItem()->Type() != TYPE_TRACK ) // Should not occur
return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
return;
// place micro via and switch layer
if ( GetScreen()->IsMicroViaAcceptable() )
{
int v_type = g_DesignSettings.m_CurrentViaType;
g_DesignSettings.m_CurrentViaType = VIA_MICROVIA;
Other_Layer_Route( (TRACK*) GetCurItem(), DC );
g_DesignSettings.m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
}
break;
case HK_ADD_VIA: // Switch to alternate layer and Place a via if a track is in progress
if( m_ID_current_state != ID_TRACK_BUTT )
return;
if( ItemFree ) // no track in progress: switch layer only
{
Other_Layer_Route( NULL, DC );
break;
}
if( GetCurItem()->Type() != TYPE_TRACK )
return;
if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
return;
Other_Layer_Route( (TRACK*) GetCurItem(), DC ); // place via and switch layer
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
break;
// Footprint edition:
case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status:
// get any module, locked or not locked and toggle its locked status
if( ItemFree )
module = Locate_Prefered_Module( GetBoard(), CURSEUR_OFF_GRILLE | VISIBLE_ONLY );
else if( GetCurItem()->Type() == TYPE_MODULE )
module = (MODULE*) GetCurItem();
if( module )
{
SetCurItem( module );
module->SetLocked( !module->IsLocked() );
module->DisplayInfo( this );
}
break;
case HK_DRAG_FOOTPRINT: // Start move (and drag) module
case HK_MOVE_FOOTPRINT: // Start move module
if( PopupOn )
break;
case HK_ROTATE_FOOTPRINT: // Rotation
case HK_FLIP_FOOTPRINT: // move to other side
if( ItemFree )
{
module = Locate_Prefered_Module( GetBoard(),
CURSEUR_OFF_GRILLE | IGNORE_LOCKED | VISIBLE_ONLY
#if defined (USE_MATCH_LAYER)
| MATCH_LAYER
#endif
);
if( module == NULL ) // no footprint found
{
module = Locate_Prefered_Module( GetBoard(), CURSEUR_OFF_GRILLE | VISIBLE_ONLY );
if( module )
{
// a footprint is found, but locked or on an other layer
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
}
module = NULL;
}
}
}
else if( GetCurItem()->Type() == TYPE_MODULE )
{
module = (MODULE*) GetCurItem();
// @todo: might need to add a layer check in if() below
if( (GetCurItem()->m_Flags == 0)
&& module->IsLocked() )
module = NULL; // do not move, rotate ... it.
}
if( module == NULL )
break;
/* I'd like to make sending to EESCHEMA edge triggered, but the
* simple mouse click on a module when the arrow icon is in play
* does not set GetCurItem() at this time, nor does a mouse click
* when the local ratsnest icon is in play set GetCurItem(), and these
* actions also call SendMessageToEESCHEMA().
* if( GetCurItem() != module )
*/
{
// Send the module via socket to EESCHEMA's search facility.
SendMessageToEESCHEMA( module );
SetCurItem( module );
}
switch( HK_Descr->m_Idcommand )
{
case HK_ROTATE_FOOTPRINT: // Rotation
Rotate_Module( DC, module, 900, TRUE );
break;
case HK_FLIP_FOOTPRINT: // move to other side
GetBoard()->Change_Side_Module( module, DC );
break;
case HK_DRAG_FOOTPRINT: // Start move (and drag) module
g_Drag_Pistes_On = TRUE;
// fall through
case HK_MOVE_FOOTPRINT: // Start move module
StartMove_Module( module, DC );
break;
}
module->DisplayInfo( this );
break;
}
wxCommandEvent cmd(wxEVT_COMMAND_MENU_SELECTED);
cmd.SetEventObject(this);
bool PopupOn = (GetCurItem() && GetCurItem()->m_Flags);
bool ItemFree = (GetCurItem() == 0 || GetCurItem()->m_Flags == 0);
if (hotkey == 0)
return;
MODULE* module = NULL;
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (just easier to handle...)
if ((hotkey & GR_KB_CTRL) != 0)
hotkey += 'A' - 1;
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
if ((hotkey >= 'a') && (hotkey <= 'z'))
hotkey += 'A' - 'a';
Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey(hotkey,
s_Common_Hotkey_List);
if (HK_Descr == NULL)
HK_Descr = GetDescriptorFromHotkey(hotkey, s_board_edit_Hotkey_List);
if (HK_Descr == NULL)
return;
int ll;
switch (HK_Descr->m_Idcommand) {
default:
case HK_NOT_FOUND:
return;
break;
case HK_SWITCH_LAYER_TO_PREVIOUS:
ll = GetScreen()->m_Active_Layer;
if ((ll <= COPPER_LAYER_N) || (ll > CMP_N))
break;
if (GetBoard()->m_BoardSettings->m_CopperLayerCount < 2) // Single layer
ll = COPPER_LAYER_N;
else if (ll == CMP_N)
ll = MAX(COPPER_LAYER_N,
GetBoard()->m_BoardSettings->m_CopperLayerCount - 2);
else
ll--;
SwitchLayer(DC, ll);
break;
case HK_SWITCH_LAYER_TO_NEXT:
ll = GetScreen()->m_Active_Layer;
if ((ll < COPPER_LAYER_N) || (ll >= CMP_N))
break;
if (GetBoard()->m_BoardSettings->m_CopperLayerCount < 2) // Single layer
ll = COPPER_LAYER_N;
else if (ll >= GetBoard()->m_BoardSettings->m_CopperLayerCount - 2)
ll = CMP_N;
else
ll++;
SwitchLayer(DC, ll);
break;
case HK_SWITCH_LAYER_TO_COMPONENT:
SwitchLayer(DC, CMP_N);
break;
case HK_SWITCH_LAYER_TO_COPPER:
SwitchLayer(DC, COPPER_LAYER_N);
break;
case HK_SWITCH_LAYER_TO_INNER1:
SwitchLayer(DC, LAYER_N_2);
break;
case HK_SWITCH_LAYER_TO_INNER2:
SwitchLayer(DC, LAYER_N_3);
break;
case HK_SWITCH_LAYER_TO_INNER3:
SwitchLayer(DC, LAYER_N_4);
break;
case HK_SWITCH_LAYER_TO_INNER4:
SwitchLayer(DC, LAYER_N_5);
break;
case HK_SWITCH_LAYER_TO_INNER5:
SwitchLayer(DC, LAYER_N_6);
break;
case HK_SWITCH_LAYER_TO_INNER6:
SwitchLayer(DC, LAYER_N_7);
break;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList(this, s_Board_Editor_Hokeys_Descr);
break;
case HK_ZOOM_IN:
cmd.SetId(ID_POPUP_ZOOM_IN);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_ZOOM_OUT:
cmd.SetId(ID_POPUP_ZOOM_OUT);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_ZOOM_REDRAW:
cmd.SetId(ID_ZOOM_REDRAW);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_ZOOM_CENTER:
cmd.SetId(ID_POPUP_ZOOM_CENTER);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_ADD_MODULE:
cmd.SetId(ID_COMPONENT_BUTT);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_ADD_TRACK:
cmd.SetId(ID_TRACK_BUTT);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_TOGGLE:
cmd.SetId(ID_TOGGLE_PRESENT_COMMAND);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break;
case HK_SWITCH_UNITS:
g_UnitMetric = (g_UnitMetric == INCHES) ? MILLIMETRE : INCHES;
break;
case HK_SWITCH_TRACK_DISPLAY_MODE:
DisplayOpt.DisplayPcbTrackFill ^= 1;
DisplayOpt.DisplayPcbTrackFill &= 1;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
GetScreen()->SetRefreshReq();
break;
case HK_DELETE:
OnHotkeyDeleteItem(DC, DrawStruct);
break;
case HK_BACK_SPACE:
if (m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer
<= CMP_N) {
if (ItemFree) {
// no track is currently being edited - select a segment and remove it.
// @todo: possibly? pass the HK command code to PcbGeneralLocateAndDisplay() so it can restrict its search to specific item types.
// @todo: use PcbGeneralLocateAndDisplay() everywhere in this source file.
DrawStruct = PcbGeneralLocateAndDisplay();
// don't let backspace delete modules!!
if (DrawStruct && (DrawStruct->Type() == TYPE_TRACK
|| DrawStruct->Type() == TYPE_VIA)) {
Delete_Segment(DC, (TRACK*) DrawStruct);
SetCurItem(NULL);
}
GetScreen()->SetModify();
} else if (GetCurItem()->Type() == TYPE_TRACK) {
// then an element is being edited - remove the last segment.
// simple lines for debugger:
TRACK* track = (TRACK*) GetCurItem();
track = Delete_Segment(DC, track);
SetCurItem(track);
GetScreen()->SetModify();
}
}
break;
case HK_END_TRACK:
if (!ItemFree && (GetCurItem()->Type() == TYPE_TRACK)
&& ((GetCurItem()->m_Flags & IS_NEW) != 0)) {
// A new track is in progress: call to End_Route()
DrawPanel->MouseToCursorSchema();
End_Route((TRACK*) GetCurItem(), DC);
}
break;
case HK_GET_AND_MOVE_FOOTPRINT:
if (ItemFree) {
wxCommandEvent evt;
evt.SetId(ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST);
Process_Special_Functions(evt);
}
break;
case HK_FIND_ITEM:
if (ItemFree) {
wxCommandEvent evt;
evt.SetId(ID_FIND_ITEMS);
Process_Special_Functions(evt);
}
break;
case HK_LOAD_BOARD:
if (ItemFree) {
// try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId(ID_LOAD_FILE);
Files_io(evt);
}
break;
case HK_SAVE_BOARD:
if (ItemFree) {
// try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId(ID_SAVE_BOARD);
Files_io(evt);
}
break;
case HK_ADD_MICROVIA: // Place a micro via if a track is in progress
if (m_ID_current_state != ID_TRACK_BUTT)
return;
if (ItemFree) // no track in progress: nothing to do
break;
if (GetCurItem()->Type() != TYPE_TRACK) // Should not occur
return;
if ((GetCurItem()->m_Flags & IS_NEW) == 0)
return;
// place micro via and switch layer
if (GetScreen()->IsMicroViaAcceptable()) {
int v_type = g_DesignSettings.m_CurrentViaType;
g_DesignSettings.m_CurrentViaType = VIA_MICROVIA;
Other_Layer_Route((TRACK*) GetCurItem(), DC);
g_DesignSettings.m_CurrentViaType = v_type;
if (DisplayOpt.ContrastModeDisplay)
GetScreen()->SetRefreshReq();
}
break;
case HK_ADD_VIA: // Switch to alternate layer and Place a via if a track is in progress
if (m_ID_current_state != ID_TRACK_BUTT)
return;
if (ItemFree) // no track in progress: switch layer only
{
Other_Layer_Route(NULL, DC);
break;
}
if (GetCurItem()->Type() != TYPE_TRACK)
return;
if ((GetCurItem()->m_Flags & IS_NEW) == 0)
return;
Other_Layer_Route((TRACK*) GetCurItem(), DC); // place via and switch layer
if (DisplayOpt.ContrastModeDisplay)
GetScreen()->SetRefreshReq();
break;
// Footprint edition:
case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status:
// get any module, locked or not locked and toggle its locked status
if (ItemFree)
module = Locate_Prefered_Module(GetBoard(), CURSEUR_OFF_GRILLE
| VISIBLE_ONLY);
else if (GetCurItem()->Type() == TYPE_MODULE)
module = (MODULE*) GetCurItem();
if (module) {
SetCurItem(module);
module->SetLocked(!module->IsLocked());
module->DisplayInfo(this);
}
break;
case HK_DRAG_FOOTPRINT: // Start move (and drag) module
case HK_MOVE_FOOTPRINT: // Start move module
if (PopupOn)
break;
case HK_ROTATE_FOOTPRINT: // Rotation
case HK_FLIP_FOOTPRINT: // move to other side
int exit = 0;
if (m_ID_current_state == ID_TRACK_BUTT) {
if (ItemFree)
DrawStruct = PcbGeneralLocateAndDisplay();
else
DrawStruct = GetCurItem();
if (DrawStruct && (DrawStruct->Type() == TYPE_TRACK
|| DrawStruct->Type() == TYPE_VIA))
switch (HK_Descr->m_Idcommand) {
case HK_DRAG_FOOTPRINT: // Start move (and drag) module
DrawPanel->MouseToCursorSchema();
//Start_DragTrackSegmentAndKeepSlope( (TRACK*) DrawStruct,DC );
Start_MoveOneNodeOrSegment((TRACK*) DrawStruct, DC,
ID_POPUP_PCB_DRAG_TRACK_SEGMENT);
break;
// fall through
case HK_MOVE_FOOTPRINT: // Start move module
DrawPanel->MouseToCursorSchema();
Start_MoveOneNodeOrSegment((TRACK*) DrawStruct, DC,
ID_POPUP_PCB_MOVE_TRACK_NODE);
break;
}
else
exit = 1;
} else if (!exit) {
if (ItemFree) {
module = Locate_Prefered_Module(GetBoard(), CURSEUR_OFF_GRILLE
| IGNORE_LOCKED | VISIBLE_ONLY
#if defined (USE_MATCH_LAYER)
| MATCH_LAYER
#endif
);
if (module == NULL) // no footprint found
{
module = Locate_Prefered_Module(GetBoard(),
CURSEUR_OFF_GRILLE | VISIBLE_ONLY);
if (module) {
// a footprint is found, but locked or on an other layer
if (module->IsLocked()) {
wxString msg;
msg.Printf(_("Footprint %s found, but locked"),
module->m_Reference->m_Text.GetData());
DisplayInfoMessage(this, msg);
}
module = NULL;
}
}
} else if (GetCurItem()->Type() == TYPE_MODULE) {
module = (MODULE*) GetCurItem();
// @todo: might need to add a layer check in if() below
if ((GetCurItem()->m_Flags == 0) && module->IsLocked())
module = NULL; // do not move, rotate ... it.
}
if (module == NULL)
break;
/* I'd like to make sending to EESCHEMA edge triggered, but the
* simple mouse click on a module when the arrow icon is in play
* does not set GetCurItem() at this time, nor does a mouse click
* when the local ratsnest icon is in play set GetCurItem(), and these
* actions also call SendMessageToEESCHEMA().
* if( GetCurItem() != module )
*/
{
// Send the module via socket to EESCHEMA's search facility.
SendMessageToEESCHEMA(module);
SetCurItem(module);
}
switch (HK_Descr->m_Idcommand) {
case HK_ROTATE_FOOTPRINT: // Rotation
Rotate_Module(DC, module, 900, TRUE);
break;
case HK_FLIP_FOOTPRINT: // move to other side
GetBoard()->Change_Side_Module(module, DC);
break;
case HK_DRAG_FOOTPRINT: // Start move (and drag) module
g_Drag_Pistes_On = TRUE;
// fall through
case HK_MOVE_FOOTPRINT: // Start move module
StartMove_Module(module, DC);
break;
}
module->DisplayInfo(this);
break;
}
}
}
/***********************************************************/
void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
EDA_BaseStruct* DrawStruct )
void WinEDA_ModuleEditFrame::OnHotKey(wxDC* DC, int hotkey,
EDA_BaseStruct* DrawStruct)
/***********************************************************/
/* Hot keys. Some commands are relative to the item under the mouse cursor
* Commands are case insensitive
*/
{
if( hotkey == 0 )
return;
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( hotkey, s_module_edit_Hotkey_List );
if( HK_Descr == NULL ) return;
switch( HK_Descr->m_Idcommand )
{
default:
case HK_NOT_FOUND:
return;
break;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_Module_Editor_Hokeys_Descr );
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break;
case HK_SWITCH_UNITS:
g_UnitMetric = (g_UnitMetric == INCHES ) ? MILLIMETRE : INCHES;
break;
case HK_ZOOM_IN:
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
}
if (hotkey == 0)
return;
wxCommandEvent cmd(wxEVT_COMMAND_MENU_SELECTED);
cmd.SetEventObject(this);
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
if ((hotkey >= 'a') && (hotkey <= 'z'))
hotkey += 'A' - 'a';
Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey(hotkey,
s_Common_Hotkey_List);
if (HK_Descr == NULL)
HK_Descr = GetDescriptorFromHotkey(hotkey, s_module_edit_Hotkey_List);
if (HK_Descr == NULL)
return;
switch (HK_Descr->m_Idcommand) {
default:
case HK_NOT_FOUND:
return;
break;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList(this, s_Module_Editor_Hokeys_Descr);
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break;
case HK_SWITCH_UNITS:
g_UnitMetric = (g_UnitMetric == INCHES) ? MILLIMETRE : INCHES;
break;
case HK_ZOOM_IN:
cmd.SetId(ID_POPUP_ZOOM_IN);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_ZOOM_OUT:
cmd.SetId(ID_POPUP_ZOOM_OUT);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_ZOOM_REDRAW:
cmd.SetId(ID_ZOOM_REDRAW);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_ZOOM_CENTER:
cmd.SetId(ID_POPUP_ZOOM_CENTER);
GetEventHandler()->ProcessEvent(cmd);
break;
}
}
/******************************************************************************/
bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
bool WinEDA_PcbFrame::OnHotkeyDeleteItem(wxDC* DC, EDA_BaseStruct* DrawStruct)
/******************************************************************************/
/* Delete the item foun under the mouse cursor
......@@ -608,52 +609,46 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
* Delete the module.
*/
{
bool ItemFree = (GetCurItem() == NULL )
|| (GetCurItem()->m_Flags == 0);
switch( m_ID_current_state )
{
case ID_TRACK_BUTT:
if( GetScreen()->m_Active_Layer > CMP_N )
return FALSE;
if( ItemFree )
{
DrawStruct = PcbGeneralLocateAndDisplay();
if( DrawStruct && DrawStruct->Type() != TYPE_TRACK )
return FALSE;
Delete_Track( DC, (TRACK*) DrawStruct );
}
else if( GetCurItem()->Type() == TYPE_TRACK )
{
// simple lines for debugger:
TRACK* track = (TRACK*) GetCurItem();
track = Delete_Segment( DC, track );
SetCurItem( track );
GetScreen()->SetModify();
return TRUE;
}
break;
case ID_COMPONENT_BUTT:
if( ItemFree )
{
MODULE* module = Locate_Prefered_Module( GetBoard(), CURSEUR_ON_GRILLE );
if( module == NULL )
return FALSE;
if( !IsOK( this, _( "Delete module?" ) ) )
return FALSE;
RemoveStruct( module, DC );
}
else
return FALSE;
break;
default:
return FALSE;
}
GetScreen()->SetModify();
SetCurItem( NULL );
return TRUE;
bool ItemFree = (GetCurItem() == NULL) || (GetCurItem()->m_Flags == 0);
switch (m_ID_current_state) {
case ID_TRACK_BUTT:
if (GetScreen()->m_Active_Layer > CMP_N)
return FALSE;
if (ItemFree) {
DrawStruct = PcbGeneralLocateAndDisplay();
if (DrawStruct && DrawStruct->Type() != TYPE_TRACK)
return FALSE;
Delete_Track(DC, (TRACK*) DrawStruct);
} else if (GetCurItem()->Type() == TYPE_TRACK) {
// simple lines for debugger:
TRACK* track = (TRACK*) GetCurItem();
track = Delete_Segment(DC, track);
SetCurItem(track);
GetScreen()->SetModify();
return TRUE;
}
break;
case ID_COMPONENT_BUTT:
if (ItemFree) {
MODULE* module = Locate_Prefered_Module(GetBoard(),
CURSEUR_ON_GRILLE);
if (module == NULL)
return FALSE;
if (!IsOK(this, _("Delete module?")))
return FALSE;
RemoveStruct(module, DC);
} else
return FALSE;
break;
default:
return FALSE;
}
GetScreen()->SetModify();
SetCurItem(NULL);
return TRUE;
}
......@@ -20,14 +20,14 @@ enum hotkey_id_commnand {
HK_MOVE_FOOTPRINT,
HK_DRAG_FOOTPRINT,
HK_FLIP_FOOTPRINT,
HK_GET_AND_MOVE_FOOTPRINT,
HK_GET_AND_MOVE_FOOTPRINT,
HK_LOCK_UNLOCK_FOOTPRINT,
HK_ADD_VIA,
HK_ADD_MICROVIA,
HK_END_TRACK,
HK_ADD_MICROVIA,
HK_END_TRACK,
HK_SAVE_BOARD, HK_LOAD_BOARD,
HK_SWITCH_UNITS,
HK_SWITCH_TRACK_DISPLAY_MODE,
HK_SWITCH_TRACK_DISPLAY_MODE,
HK_FIND_ITEM,
HK_SWITCH_LAYER_TO_COPPER,
HK_SWITCH_LAYER_TO_COMPONENT,
......@@ -39,14 +39,19 @@ enum hotkey_id_commnand {
HK_SWITCH_LAYER_TO_INNER4,
HK_SWITCH_LAYER_TO_INNER5,
HK_SWITCH_LAYER_TO_INNER6,
HK_SWITCH_LAYER_TO_INNER7,
HK_SWITCH_LAYER_TO_INNER8,
HK_SWITCH_LAYER_TO_INNER9,
HK_SWITCH_LAYER_TO_INNER10,
HK_SWITCH_LAYER_TO_INNER11,
HK_SWITCH_LAYER_TO_INNER12,
HK_SWITCH_LAYER_TO_INNER13,
HK_SWITCH_LAYER_TO_INNER14
HK_SWITCH_LAYER_TO_INNER7,
HK_SWITCH_LAYER_TO_INNER8,
HK_SWITCH_LAYER_TO_INNER9,
HK_SWITCH_LAYER_TO_INNER10,
HK_SWITCH_LAYER_TO_INNER11,
HK_SWITCH_LAYER_TO_INNER12,
HK_SWITCH_LAYER_TO_INNER13,
HK_SWITCH_LAYER_TO_INNER14,
HK_ADD_MODULE,
HK_ADD_TRACK,
HK_TOGGLE,
HK_MOVE_TRACK,
HK_SLIDE_TRACK
};
// List of hotkey descriptors for pcbnew
......
......@@ -162,10 +162,12 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query )
{
g_DesignSettings.m_ViaSizeHistory[ii] =
g_DesignSettings.m_TrackWidthHistory[ii] = 0;
g_DesignSettings.m_TrackClearenceHistory[ii] = 0;
}
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
g_DesignSettings.m_TrackClearenceHistory[0] = g_DesignSettings.m_TrackClearence;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
/* NO, this is a global setting, and changing it here changes a loaded board's layer count when loading a module in the module editor since
the module editor calls this when loading an existing module.
......
......@@ -205,6 +205,12 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum )
continue;
}
if( stricmp( data, "LayerThickness" ) == 0 )
{
data = strtok( NULL, " =\n\r" );
GetBoard()->m_BoardSettings->m_LayerThickness = atoi( data );;
continue;
}
if( strnicmp( data, "Links", 5 ) == 0 )
{
......@@ -360,6 +366,12 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
g_DesignSettings.m_TrackMinWidth = atoi( data );
continue;
}
if( stricmp( Line, "TrackClearenceHistory" ) == 0 )
{
int tmp = atoi( data );
AddHistory( tmp, TYPE_CLR );
continue;
}
if( stricmp( Line, "ZoneClearence" ) == 0 )
{
......@@ -534,7 +546,15 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
g_DesignSettings.m_TrackWidthHistory[ii] );
}
fprintf( aFile, "TrackClearence %d\n", g_DesignSettings.m_TrackClearence );
for( int ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackClearenceHistory[ii] == 0 )
break;
fprintf( aFile, "TrackClearenceHistory %d\n",
g_DesignSettings.m_TrackClearenceHistory[ii] );
}
fprintf( aFile, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance );
fprintf( aFile, "TrackMinWidth %d\n" , g_DesignSettings.m_TrackMinWidth );
......@@ -613,6 +633,7 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File )
fprintf( File, "Ndraw %d\n", NbDrawItem );
fprintf( File, "Ntrack %d\n", GetBoard()->GetNumSegmTrack() );
fprintf( File, "Nzone %d\n", GetBoard()->GetNumSegmZone() );
fprintf( File, "LayerThickness %d\n", GetBoard()->m_BoardSettings->m_LayerThickness );
fprintf( File, "Nmodule %d\n", NbModules );
fprintf( File, "Nnets %d\n", GetBoard()->m_NetInfo->GetNetsCount() );
......
......@@ -344,7 +344,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List(
WinEDAListBox* ListBox = new WinEDAListBox( active_window, wxEmptyString,
NULL, OldName, DisplayCmpDoc,
wxColour( 200, 200, 255 ) );
wxColour( 200, 200, 255 ),GetScreen()->m_Curseur );
wxBeginBusyCursor();
......
......@@ -140,6 +140,7 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += wxT(".");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile( FullFileName,
s_Pcbnew_Editor_Hokeys_Descr,
......@@ -178,11 +179,13 @@ bool Read_Config( const wxString& projectFileName )
/* Some parameters must be reinitialize after loading a new board or config: */
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_TrackClearenceHistory[0] = g_DesignSettings.m_TrackClearence;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
for( ii = 1; ii < HISTORY_NUMBER; ii++ )
{
g_DesignSettings.m_TrackWidthHistory[ii] = 0;
g_DesignSettings.m_TrackClearenceHistory[ii] = 0;
g_DesignSettings.m_ViaSizeHistory[ii] = 0;
}
......
......@@ -79,6 +79,13 @@ static PARAM_CFG_INT ViaAltDrillCfg
250, /* Default value */
0, 0xFFFF /* Min and max values*/
);
static PARAM_CFG_INT LayerThicknessCfg
(
wxT( "LayerThickness" ), /* Keyword */
&g_DesignSettings.m_LayerThickness, /* Parameter address */
630, /* Default value */
0, 0xFFFF /* Min and max values*/
);
static PARAM_CFG_INT MicroViaDiametreCfg
(
......@@ -800,6 +807,7 @@ PARAM_CFG_BASE* ParamCfgList[] =
&ViaShowHoleCfg,
&ShowNetNamesModeCfg,
&TrackClearenceCfg,
&LayerThicknessCfg,
&LayerCountCfg,
&TrackWidthCfg,
&RouteLayTopCfg,
......
......@@ -137,6 +137,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_CLR_WIDTH,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TOOLBARH_PCB_AUTOPLACE, WinEDA_PcbFrame::AutoPlace )
......@@ -153,6 +155,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_TOOL( ID_PCB_HIGHLIGHT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_COMPONENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TRACK_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TOGGLE_PRESENT_COMMAND, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ZONES_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_MIRE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
......@@ -210,9 +213,11 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_Draw_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche dessine
m_Draw_Auxiliary_Axis = TRUE;
m_SelTrackWidthBox = NULL;
m_SelClrWidthBox = NULL;
m_SelViaSizeBox = NULL;
m_SelLayerBox = NULL;
m_SelTrackWidthBox_Changed = FALSE;
m_SelClrWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE;
SetBoard( new BOARD( NULL, this ) );
......@@ -467,12 +472,18 @@ void WinEDA_PcbFrame::SetToolbars()
_( "Show Tracks Sketch mode" ) :
_( "Show Tracks filled mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay ?
_( "Normal Contrast Mode Display" ) :
_( "Hight Contrast Mode Display" ) );
_( "High Contrast Mode Display" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & ITEM_NOT_SHOW );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & (ITEM_NOT_SHOW) ?
_( "Show Invisible Text" ) :
_( "Hide Invisible Text" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_AuxVToolBar ? true : false );
}
......@@ -513,6 +524,38 @@ void WinEDA_PcbFrame::SetToolbars()
}
}
if( m_SelClrWidthBox && m_SelClrWidthBox_Changed )
{
m_SelClrWidthBox_Changed = FALSE;
m_SelClrWidthBox->Clear();
wxString format = _( "Clearance" );
if( g_UnitMetric == INCHES )
format += wxT( " %.1f" );
else
format += wxT( " %.3f" );
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{
if( g_DesignSettings.m_TrackClearenceHistory[ii] == 0 )
break; // Fin de liste
double value = To_User_Unit( g_UnitMetric,
g_DesignSettings.m_TrackClearenceHistory[ii],
PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES )
msg.Printf( format.GetData(), value * 1000 );
else
msg.Printf( format.GetData(), value );
m_SelClrWidthBox->Append( msg );
if( g_DesignSettings.m_TrackClearenceHistory[ii] ==
g_DesignSettings.m_TrackClearence )
m_SelClrWidthBox->SetSelection( ii );
}
}
if( m_SelViaSizeBox && m_SelViaSizeBox_Changed )
{
m_SelViaSizeBox_Changed = FALSE;
......
......@@ -111,6 +111,7 @@ void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event )
SetLocaleTo_Default( ); // revert to the current locale
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox_Changed = TRUE;
m_SelViaSizeBox_Changed = TRUE;
GetScreen()->SetModify();
......
......@@ -368,13 +368,21 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
wxBitmap( showtrack_xpm ),
_( "Show Tracks Sketch" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
wxEmptyString,
wxBitmap( palette_xpm ),
_( "Hight Contrast Mode Display" ),
_( "High Contrast Mode Display" ),
wxITEM_CHECK );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
wxEmptyString,
wxBitmap( invisible_text_xpm ),
_( "Show Invisible Text" ),
wxITEM_CHECK );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_INVISIBLE_TEXT_MODE,
g_ModuleTextNOVColor & ITEM_NOT_SHOW );
#ifdef MUWAVE_ENBL
m_OptionsToolBar->AddSeparator();
......@@ -548,6 +556,12 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
wxSize( LISTBOX_WIDTH + 20, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_CLR_WIDTH,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 20, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelClrWidthBox );
m_SelClrWidthBox_Changed = TRUE;
m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
wxEmptyString,
......@@ -626,6 +640,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
m_SelViaSizeBox_Changed = TRUE;
m_SelTrackWidthBox_Changed = TRUE;
m_SelClrWidthBox_Changed = TRUE;
ReCreateLayerBox( 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