Gerbview: code cleanup and a minoe enhancement. Kicad: minor code cleanup

This commit is contained in:
jean-pierre charras 2011-03-13 19:03:43 +01:00
commit 81509a1160
24 changed files with 252 additions and 354 deletions

View File

@ -278,6 +278,37 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
#endif
}
/*
* Function OnSelectPreferredEditor
* Open a dialog to select the preferred editor that will be used in Kicad
* to edit or display files (reports ... )
* The full filename editor is saved in configuration (global params)
*/
void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
{
wxFileName fn = wxGetApp().m_EditorName;
wxString wildcard( wxT( "*" ) );
#ifdef __WINDOWS__
wildcard += wxT( ".exe" );
#endif
wildcard = _( "Executable file (" ) + wildcard + wxT( ")|" ) + wildcard;
wxFileDialog dlg( this, _( "Select Prefered Editor" ), fn.GetPath(),
fn.GetFullName(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return;
wxASSERT( wxGetApp().m_EDA_CommonConfig );
wxConfig* cfg = wxGetApp().m_EDA_CommonConfig;
wxGetApp().m_EditorName = dlg.GetPath();
cfg->Write( wxT( "Editor" ), wxGetApp().m_EditorName );
}
/*
*

View File

@ -6,7 +6,7 @@
#endif
#ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2011-03-11 BZR 2884)"
#define KICAD_BUILD_VERSION "(2011-03-12)"
#endif
//#define VERSION_STABILITY "stable"

View File

@ -1,6 +1,6 @@
update=01/04/2010 16:21:47
update=12/03/2011 18:54:54
version=1
last_client=eeschema
last_client=pcbnew
[cvpcb]
version=1
NetITyp=0
@ -11,72 +11,6 @@ LibDir=
NetType=0
[cvpcb/libraries]
EquName1=devcms
[pcbnew]
version=1
PadDrlX=320
PadDimH=600
PadDimV=600
PadForm=1
PadMask=14745599
ViaDiam=450
ViaDril=250
Isol=60
Countlayer=2
Lpiste=170
RouteTo=15
RouteBo=0
TypeVia=3
Segm45=1
Racc45=1
Unite=0
SegFill=1
SegAffG=0
NewAffG=1
PadFill=1
PadAffG=1
PadSNum=1
ModAffC=0
ModAffT=0
PcbAffT=0
SgPcb45=1
TxtPcbV=800
TxtPcbH=600
TxtModV=600
TxtModH=600
TxtModW=120
HPGLnum=1
HPGdiam=15
HPGLSpd=20
HPGLrec=2
HPGLorg=0
GERBmin=15
VEgarde=100
DrawLar=150
EdgeLar=150
TxtLar=120
MSegLar=150
ForPlot=1
WpenSer=10
UserGrX=0,01
UserGrY=0,01
UserGrU=1
DivGrPc=1
TimeOut=600
MaxLnkS=3
ShowRat=0
ShowMRa=1
[pcbnew/libraries]
LibDir=
LibName1=sockets
LibName2=connect
LibName3=discret
LibName4=pin_array
LibName5=divers
LibName6=libcms
LibName7=display
LibName8=valves
LibName9=led
LibName10=dip_sockets
[general]
version=1
[eeschema]
@ -123,3 +57,32 @@ LibName5=linear
LibName6=regul
LibName7=interface
LibName8=special
[pcbnew]
version=1
PadDrlX=320
PadDimH=600
PadDimV=600
BoardThickness=630
TxtPcbV=800
TxtPcbH=600
TxtModV=600
TxtModH=600
TxtModW=120
VEgarde=100
DrawLar=150
EdgeLar=150
TxtLar=120
MSegLar=150
LastNetListRead=
[pcbnew/libraries]
LibDir=
LibName1=sockets
LibName2=connect
LibName3=discret
LibName4=pin_array
LibName5=divers
LibName6=libcms
LibName7=display
LibName8=valves
LibName9=led
LibName10=dip_sockets

View File

@ -13,6 +13,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
###
# Sources
###
set(DIALOGS_SRCS
dialogs/gerbview_dialog_display_options_frame_base.cpp
dialogs/gerbview_dialog_display_options_frame.cpp
@ -35,9 +36,9 @@ set(GERBVIEW_SRCS
edit.cpp
export_to_pcbnew.cpp
files.cpp
gerberframe.cpp
gerbview_config.cpp
gerbview.cpp
gerbview_config.cpp
gerbview_frame.cpp
hotkeys.cpp
initpcb.cpp
locate.cpp
@ -50,7 +51,8 @@ set(GERBVIEW_SRCS
rs274d.cpp
rs274x.cpp
select_layers_to_pcb.cpp
toolbars_gerber.cpp )
toolbars_gerber.cpp
)
###
# We need some extra sources from pcbnew

View File

@ -1,6 +1,6 @@
/**********************************************************/
/* Block operations: displacement, rotation, deletion ... */
/**********************************************************/
/**********************************/
/* Block operations: displacement */
/**********************************/
/*
* This program source code file is part of KICAD, a free EDA CAD application.
@ -28,15 +28,14 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "trigo.h"
#include "confirm.h"
#include "gerbview.h"
#include "class_gerber_draw_item.h"
#include "wx/debug.h"
#define BLOCK_COLOR BROWN
@ -46,6 +45,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
* the key (ALT, SHIFT ALT ..)
* Currently, only block move and block zoom is supported
*/
int GERBVIEW_FRAME::ReturnBlockCommand( int key )
{
@ -62,17 +62,9 @@ int GERBVIEW_FRAME::ReturnBlockCommand( int key )
break;
case GR_KB_SHIFT:
break;
case GR_KB_CTRL:
break;
case GR_KB_SHIFTCTRL:
cmd = BLOCK_DELETE;
break;
case GR_KB_ALT:
cmd = BLOCK_COPY;
break;
case MOUSE_MIDDLE:
@ -87,25 +79,13 @@ int GERBVIEW_FRAME::ReturnBlockCommand( int key )
/* Routine to handle the BLOCK PLACE command */
void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC )
{
bool err = false;
wxASSERT( DrawPanel->IsMouseCaptured() );
if( !DrawPanel->IsMouseCaptured() )
{
err = true;
DisplayError( this,
wxT( "Error in HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
switch( GetScreen()->m_BlockLocate.m_Command )
{
case BLOCK_IDLE:
err = true;
break;
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
@ -122,9 +102,9 @@ void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC )
break;
case BLOCK_PASTE:
break;
case BLOCK_ZOOM: // Handle by HandleBlockEnd()
case BLOCK_DRAG:
case BLOCK_PRESELECT_MOVE:
case BLOCK_ZOOM:
case BLOCK_ROTATE:
case BLOCK_FLIP:
case BLOCK_DELETE:
@ -133,6 +113,8 @@ void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_SELECT_ITEMS_ONLY:
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y:
case BLOCK_IDLE:
wxFAIL_MSG( wxT("HandleBlockPlace: Unexpected block command") );
break;
}
@ -142,11 +124,7 @@ void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC )
GetScreen()->SetModify();
GetScreen()->ClearBlockCommand();
if( GetScreen()->m_BlockLocate.GetCount() )
{
DisplayError( this, wxT( "HandleBlockPLace error: some items left" ) );
GetScreen()->m_BlockLocate.ClearItemsList();
}
wxASSERT( GetScreen()->m_BlockLocate.GetCount() == 0 );
DisplayToolMsg( wxEmptyString );
}
@ -171,15 +149,8 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC )
switch( GetScreen()->m_BlockLocate.m_Command )
{
case BLOCK_IDLE:
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
break;
case BLOCK_DRAG: /* Drag (not used, for future
* enhancements) */
case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list */
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
nextcmd = true;
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
@ -193,20 +164,22 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC )
Block_Delete( DC );
break;
case BLOCK_ZOOM: /* Window Zoom */
zoom_command = true;
break;
case BLOCK_PRESELECT_MOVE: /* Move with preselection list */
case BLOCK_DRAG:
case BLOCK_IDLE:
case BLOCK_MIRROR_X: /* Mirror, unused*/
case BLOCK_ROTATE: /* Unused */
case BLOCK_FLIP: /* Flip, unused */
case BLOCK_SAVE: /* Save (not used)*/
case BLOCK_PASTE:
break;
case BLOCK_ZOOM: /* Window Zoom */
zoom_command = true;
break;
case BLOCK_ABORT:
case BLOCK_SELECT_ITEMS_ONLY:
case BLOCK_MIRROR_Y:
wxFAIL_MSG( wxT("HandleBlockEnd: Unexpected block command") );
break;
}

View File

@ -33,7 +33,6 @@
#include "class_drawpanel.h"
#include "pcbstruct.h"
#include "gerbview.h"
#include "wxGerberFrame.h"
#include "layer_widget.h"
#include "class_gerbview_layer_widget.h"

View File

@ -137,17 +137,17 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
/*
* Function Read_D_Code_File
* Function ReadDCodeDefinitionFile
* Can be useful only with old RS274D Gerber file format.
* Is not needed with RS274X files format.
* These files need an auxiliary DCode file description. There is no defined file format for this.
* This function read a file format I needed a long time ago.
* reads in a dcode file assuming ALSPCB file format with ';' indicating comments.
* Format is like CSV but with optional ';' delineated comments:
* tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)]
* tool, Horiz, Vert, drill, speed, accel. ,Type ; [DCODE (commentaire)]
* ex: 1, 12, 12, 0, 0, 0, 3 ; D10
*/
int GERBVIEW_FRAME::Read_D_Code_File( const wxString& D_Code_FullFileName )
int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName )
{
int current_Dcode, ii, dcode_scale;
char* ptcar;

View File

@ -15,7 +15,6 @@
#include "printout_controler.h"
#include "gerbview.h"
#include "wxGerberFrame.h"
#include "pcbplot.h"
#include "class_board_design_settings.h"

View File

@ -118,11 +118,11 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
switch( id )
{
case ID_EXIT:
Close( TRUE );
Close( true );
break;
case ID_GERBVIEW_GLOBAL_DELETE:
Erase_Current_Layer( TRUE );
Erase_Current_Layer( true );
ClearMsgPanel();
break;
@ -171,6 +171,10 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
wxFileName fn( gerber_layer->m_FileName );
ExecuteFile( this, editorname, QuoteFullPath( fn ) );
}
else
{
wxMessageBox(_("No editor defined. Please select one") );
}
}
break;

View File

@ -10,9 +10,6 @@
#include "gerbview.h"
static void LoadDCodeFile( GERBVIEW_FRAME* frame,
const wxString& FullFileName );
/* Load a Gerber file selected from history list on current layer
* Previous data is deleted
@ -79,11 +76,12 @@ clear an existing layer to load any new layers." ), NB_LAYERS );
break;
case ID_GERBVIEW_LOAD_DCODE_FILE:
LoadDCodeFile( this, wxEmptyString );
LoadDCodeFile( wxEmptyString );
DrawPanel->Refresh();
break;
default:
DisplayError( this, wxT( "File_io Internal Error" ) );
wxFAIL_MSG( wxT( "File_io: unexpected command id" ) );
break;
}
}
@ -199,33 +197,33 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
/*
* Read a DCode file (not used with RX274X files , just with RS274D old files).
* Note: there is no standard for DCode file.
* Note: there is no standard for DCode files.
* Just read a file format created by early versions of Pcbnew.
* Returns:
* 0 if file not read (cancellation of order ...)
* 1 if OK
* false if file not read (cancellation of order ...)
* true if OK
*/
static void LoadDCodeFile( GERBVIEW_FRAME* frame, const wxString& FullFileName )
bool GERBVIEW_FRAME::LoadDCodeFile( const wxString& aFullFileName )
{
wxString wildcard;
wxFileName fn = FullFileName;
wxFileName fn = aFullFileName;
if( !fn.IsOk() )
{
wildcard = _( "Gerber DCODE files" );
wildcard += AllFilesWildcard;
fn = frame->GetScreen()->GetFileName();
wxFileDialog dlg( (wxWindow*) frame, _( "Load GERBER DCODE File" ),
wildcard += wxT(" ") + AllFilesWildcard;
fn = GetScreen()->GetFileName();
wxFileDialog dlg( this, _( "Load GERBER DCODE File" ),
fn.GetPath(), fn.GetFullName(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return;
return false;
fn = dlg.GetPath();
}
frame->Read_D_Code_File( fn.GetFullPath() );
frame->CopyDCodesSizeToItems();
frame->Refresh();
ReadDCodeDefinitionFile( fn.GetFullPath() );
CopyDCodesSizeToItems();
return true;
}

View File

@ -11,7 +11,6 @@
#include "gerbview.h"
#include "gerbview_id.h"
#include "wxGerberFrame.h"
#include "pcbplot.h"
#include "bitmaps.h"
#include "zones.h"

View File

@ -108,6 +108,6 @@ bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file );
extern GERBER_IMAGE* g_GERBER_List[32];
#include "pcbcommon.h"
#include "wxGerberFrame.h"
#include "gerbview_frame.h"
#endif // ifndef GERBVIEW_H

View File

@ -64,6 +64,8 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, GERBVIEW_FRAME::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, GERBVIEW_FRAME::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, GERBVIEW_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR,
EDA_BASE_FRAME::OnSelectPreferredEditor )
// menu Miscellaneous
EVT_MENU( ID_GERBVIEW_GLOBAL_DELETE, GERBVIEW_FRAME::Process_Special_Functions )

View File

@ -406,7 +406,18 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
/**
* Function Read_D_Code_File
* Read a DCode file (not used with RX274X files , just with RS274D old files).
* Note: there is no standard for DCode file.
* Just read a file format created by early versions of Pcbnew.
* @return false if file not read (cancellation)
* true if OK
* @ aparm aFullFileName = name of file to load.
* if empty, or if the file does not exist, a file dialog is opened
*/
bool LoadDCodeFile( const wxString& aFullFileName );
/**
* Function ReadDCodeDefinitionFile
* reads in a dcode file assuming ALSPCB file format with ';' indicating
* comments.
* <p>
@ -418,7 +429,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* Ver, Hor, Type, Tool [,Drill]<br>
* example: 0.012, 0.012, L , D10<br>
*
* Categorize all found dcodes into a table of D_CODE instantiations.
* Load all found dcodes into a table of D_CODE instantiations.
* @param D_Code_FullFileName The name of the file to read from.
* @return int - <br>
* -1 = file not found<br>
@ -428,7 +439,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* g_GERBER_List[]<br>
* 1 = read OK<br>
*/
int Read_D_Code_File( const wxString& D_Code_FullFileName );
int ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName );
void CopyDCodesSizeToItems();
void Liste_D_Codes();

View File

@ -16,6 +16,7 @@ enum gerbview_ids
ID_MAIN_MENUBAR = ID_END_LIST,
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
ID_GERBVIEW_GLOBAL_DELETE,

View File

@ -6,7 +6,7 @@
#include "appl_wxstruct.h"
#include "common.h"
#include "macros.h"
//#include "macros.h"
#include "gerbview.h"
#include "bitmaps.h"
#include "gerbview_id.h"
@ -91,6 +91,13 @@ void GERBVIEW_FRAME::ReCreateMenuBar( void )
_( "&Clear Layer" ),
_( "Clear current layer" ), general_deletions_xpm );
miscellaneous_menu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR,
_( "&Text Editor" ),
_( "Select your preferred text editor" ),
editor_xpm );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
AddHelpVersionInfoMenuEntry( helpMenu );

View File

@ -88,3 +88,4 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break;
}
}

View File

@ -165,31 +165,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
*/
if( !gerber->m_Has_DCode )
{
wxFileName fn;
if( D_Code_FullFileName.IsEmpty() )
{
wxString wildcard;
fn = GERBER_FullFileName;
fn.SetExt( wxEmptyString );
wildcard = _( "Gerber DCODE files" );
wildcard += AllFilesWildcard;
wxFileDialog dlg( this, _( "Load GERBER DCODE File" ),
wxEmptyString, fn.GetFullName(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
}
else
fn = D_Code_FullFileName;
if( fn.IsOk() )
{
Read_D_Code_File( fn.GetFullPath() );
CopyDCodesSizeToItems();
}
else
return false;
return LoadDCodeFile( D_Code_FullFileName );
}
return true;

View File

@ -127,6 +127,14 @@ public:
virtual void LoadSettings();
virtual void SaveSettings();
/**
* Function OnSelectPreferredEditor
* Open a dialog to select the editor that will used in Kicad
* to edit or display files (reports ... )
* The full filename editor is saved in configuration (global params)
*/
virtual void OnSelectPreferredEditor( wxCommandEvent& event );
// Read/Save and Import/export hotkeys config
/**

View File

@ -109,7 +109,6 @@ public:
void OnRefresh( wxCommandEvent& event );
void OnSelectDefaultPdfBrowser( wxCommandEvent& event );
void OnSelectPreferredPdfBrowser( wxCommandEvent& event );
void OnSelectPreferredEditor( wxCommandEvent& event );
void OnUpdateDefaultPdfBrowser( wxUpdateUIEvent& event );
void OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event );

View File

@ -11,56 +11,56 @@
/* Menubar and toolbar event table */
BEGIN_EVENT_TABLE( WinEDA_MainFrame, EDA_BASE_FRAME )
/* Window events */
EVT_SIZE( WinEDA_MainFrame::OnSize )
EVT_CLOSE( WinEDA_MainFrame::OnCloseWindow )
/* Window events */
EVT_SIZE( WinEDA_MainFrame::OnSize )
EVT_CLOSE( WinEDA_MainFrame::OnCloseWindow )
/* Sash drag events */
EVT_SASH_DRAGGED( ID_LEFT_FRAME, WinEDA_MainFrame::OnSashDrag )
/* Sash drag events */
EVT_SASH_DRAGGED( ID_LEFT_FRAME, WinEDA_MainFrame::OnSashDrag )
/* Toolbar events */
EVT_TOOL( ID_NEW_PROJECT, WinEDA_MainFrame::OnLoadProject )
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_MainFrame::OnLoadProject )
EVT_TOOL( ID_SAVE_PROJECT, WinEDA_MainFrame::OnSaveProject )
EVT_TOOL( ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::OnArchiveFiles )
/* Toolbar events */
EVT_TOOL( ID_NEW_PROJECT, WinEDA_MainFrame::OnLoadProject )
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_MainFrame::OnLoadProject )
EVT_TOOL( ID_SAVE_PROJECT, WinEDA_MainFrame::OnSaveProject )
EVT_TOOL( ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::OnArchiveFiles )
/* Menu events */
EVT_MENU( ID_SAVE_PROJECT, WinEDA_MainFrame::OnSaveProject )
EVT_MENU( wxID_EXIT, WinEDA_MainFrame::OnExit )
EVT_MENU( ID_TO_EDITOR, WinEDA_MainFrame::OnOpenTextEditor )
EVT_MENU( ID_BROWSE_AN_SELECT_FILE,
WinEDA_MainFrame::OnOpenFileInTextEditor )
EVT_MENU( ID_SELECT_PREFERED_EDITOR,
WinEDA_MainFrame::OnSelectPreferredEditor )
EVT_MENU( ID_SELECT_DEFAULT_PDF_BROWSER,
WinEDA_MainFrame::OnSelectDefaultPdfBrowser )
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER,
WinEDA_MainFrame::OnSelectPreferredPdfBrowser )
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER_NAME,
WinEDA_MainFrame::OnSelectPreferredPdfBrowser )
EVT_MENU( ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::OnArchiveFiles )
EVT_MENU( ID_READ_ZIP_ARCHIVE, WinEDA_MainFrame::OnUnarchiveFiles )
EVT_MENU( ID_PROJECT_TREE_REFRESH, WinEDA_MainFrame::OnRefresh )
EVT_MENU( ID_GENERAL_HELP, WinEDA_MainFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_MainFrame::GetKicadAbout )
/* Menu events */
EVT_MENU( ID_SAVE_PROJECT, WinEDA_MainFrame::OnSaveProject )
EVT_MENU( wxID_EXIT, WinEDA_MainFrame::OnExit )
EVT_MENU( ID_TO_EDITOR, WinEDA_MainFrame::OnOpenTextEditor )
EVT_MENU( ID_BROWSE_AN_SELECT_FILE,
WinEDA_MainFrame::OnOpenFileInTextEditor )
EVT_MENU( ID_SELECT_PREFERED_EDITOR,
EDA_BASE_FRAME::OnSelectPreferredEditor )
EVT_MENU( ID_SELECT_DEFAULT_PDF_BROWSER,
WinEDA_MainFrame::OnSelectDefaultPdfBrowser )
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER,
WinEDA_MainFrame::OnSelectPreferredPdfBrowser )
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER_NAME,
WinEDA_MainFrame::OnSelectPreferredPdfBrowser )
EVT_MENU( ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::OnArchiveFiles )
EVT_MENU( ID_READ_ZIP_ARCHIVE, WinEDA_MainFrame::OnUnarchiveFiles )
EVT_MENU( ID_PROJECT_TREE_REFRESH, WinEDA_MainFrame::OnRefresh )
EVT_MENU( ID_GENERAL_HELP, WinEDA_MainFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_MainFrame::GetKicadAbout )
/* Range menu events */
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_MainFrame::SetLanguage )
/* Range menu events */
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_MainFrame::SetLanguage )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_MainFrame::OnFileHistory )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_MainFrame::OnFileHistory )
/* Button events */
EVT_BUTTON( ID_TO_PCB, WinEDA_MainFrame::OnRunPcbNew )
EVT_BUTTON( ID_TO_CVPCB, WinEDA_MainFrame::OnRunCvpcb )
EVT_BUTTON( ID_TO_EESCHEMA, WinEDA_MainFrame::OnRunEeschema )
EVT_BUTTON( ID_TO_GERBVIEW, WinEDA_MainFrame::OnRunGerbview )
EVT_BUTTON( ID_TO_BITMAP_CONVERTER, WinEDA_MainFrame::OnRunBitmapConverter )
/* Button events */
EVT_BUTTON( ID_TO_PCB, WinEDA_MainFrame::OnRunPcbNew )
EVT_BUTTON( ID_TO_CVPCB, WinEDA_MainFrame::OnRunCvpcb )
EVT_BUTTON( ID_TO_EESCHEMA, WinEDA_MainFrame::OnRunEeschema )
EVT_BUTTON( ID_TO_GERBVIEW, WinEDA_MainFrame::OnRunGerbview )
EVT_BUTTON( ID_TO_BITMAP_CONVERTER, WinEDA_MainFrame::OnRunBitmapConverter )
EVT_UPDATE_UI( ID_SELECT_DEFAULT_PDF_BROWSER,
WinEDA_MainFrame::OnUpdateDefaultPdfBrowser )
EVT_UPDATE_UI( ID_SELECT_PREFERED_PDF_BROWSER,
WinEDA_MainFrame::OnUpdatePreferredPdfBrowser )
EVT_UPDATE_UI( ID_SELECT_DEFAULT_PDF_BROWSER,
WinEDA_MainFrame::OnUpdateDefaultPdfBrowser )
EVT_UPDATE_UI( ID_SELECT_PREFERED_PDF_BROWSER,
WinEDA_MainFrame::OnUpdatePreferredPdfBrowser )
END_EVENT_TABLE()
@ -70,17 +70,17 @@ END_EVENT_TABLE()
*/
void WinEDA_MainFrame::ReCreateMenuBar()
{
wxMenuItem *item;
wxMenuBar *menuBar = GetMenuBar();
wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar();
if( ! menuBar )
if( !menuBar )
menuBar = new wxMenuBar();
// Delete all existing menus so they can be rebuilt.
// This allows language changes of the menu text on the fly.
menuBar->Freeze();
while( menuBar->GetMenuCount() )
delete menuBar->Remove(0);
delete menuBar->Remove( 0 );
// Recreate all menus:
@ -88,113 +88,75 @@ void WinEDA_MainFrame::ReCreateMenuBar()
wxMenu* filesMenu = new wxMenu;
// Open
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open\tCtrl+O" ),
_( "Open an existing project" ) );
#if !defined( __WXMAC__ )
item->SetBitmap( open_project_xpm );
#endif /* !defined( __WXMAC__ ) */
filesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( filesMenu, ID_LOAD_PROJECT, _( "&Open\tCtrl+O" ),
_( "Open an existing project" ),
open_project_xpm );
// Open Recent submenu
wxMenu* openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu,
-1, _( "Open &Recent" ),
_("Open a recent opened schematic project" ),
wxID_ANY, _( "Open &Recent" ),
_( "Open a recent opened schematic project" ),
open_project_xpm );
// New
item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New\tCtrl+N" ),
_( "Start a new project" ) );
#if !defined( __WXMAC__ )
item->SetBitmap( new_project_xpm );
#endif /* !defined( __WXMAC__ ) */
filesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( filesMenu, ID_NEW_PROJECT,
_( "&New\tCtrl+N" ),
_( "Start a new project" ),
new_project_xpm );
/* Save */
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, _( "&Save\tCtrl+S" ),
_( "Save current project" ) );
#if !defined( __WXMAC__ )
item->SetBitmap( save_project_xpm );
#endif /* !defined( __WXMAC__ ) */
filesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( filesMenu, ID_SAVE_PROJECT, _( "&Save\tCtrl+S" ),
_( "Save current project" ),
save_project_xpm );
// Archive
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_SAVE_AND_ZIP_FILES, _( "&Archive" ),
_( "Archive project files in zip archive" ) );
#if !defined( __WXMAC__ )
item->SetBitmap( zip_xpm );
#endif /* !defined( __WXMAC__ ) */
filesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( filesMenu, ID_SAVE_AND_ZIP_FILES, _( "&Archive" ),
_( "Archive project files in zip archive" ),
zip_xpm );
// Unarchive
item = new wxMenuItem( filesMenu, ID_READ_ZIP_ARCHIVE, _( "&Unarchive" ),
_( "Unarchive project files from zip file" ) );
#if !defined( __WXMAC__ )
item->SetBitmap( unzip_xpm );
#endif /* !defined( __WXMAC__ ) */
filesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( filesMenu, ID_READ_ZIP_ARCHIVE, _( "&Unarchive" ),
_( "Unarchive project files from zip file" ),
unzip_xpm );
/* Quit on all platforms except WXMAC */
#if !defined( __WXMAC__ )
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ),
_( "Quit KiCad" ) );
item->SetBitmap( exit_xpm );
filesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( filesMenu, wxID_EXIT, _( "&Quit" ),
_( "Quit KiCad" ),
exit_xpm );
#endif /* !defined( __WXMAC__ ) */
// Browse menu
wxMenu* browseMenu = new wxMenu();
// Text editor
item = new wxMenuItem( browseMenu, ID_TO_EDITOR, _( "Text E&ditor" ),
_( "Open preferred text editor" ) );
#if !defined( __WXMAC__ )
item->SetBitmap( editor_xpm );
#endif /* !defined( __WXMAC__ ) */
browseMenu->Append( item );
ADD_MENUITEM_WITH_HELP( browseMenu, ID_TO_EDITOR,
_( "Text E&ditor" ),
_( "Launch preferred text editor" ),
editor_xpm );
/* Browse files */
item = new wxMenuItem( browseMenu, ID_BROWSE_AN_SELECT_FILE,
_( "&View File" ),
_( "View, read or edit file with a text editor" ) );
#if !defined( __WXMAC__ )
item->SetBitmap( browse_files_xpm );
#endif /* !defined( __WXMAC__ ) */
browseMenu->Append( item );
ADD_MENUITEM_WITH_HELP( browseMenu, ID_BROWSE_AN_SELECT_FILE,
_( "&View File" ),
_( "View, read or edit file with a text editor" ),
browse_files_xpm );
// Preferences menu
wxMenu* PreferencesMenu = new wxMenu;
// Text editor
item = new wxMenuItem( PreferencesMenu, ID_SELECT_PREFERED_EDITOR,
_( "&Text Editor" ),
_( "Select your preferred text editor" ) );
#if !defined( __WXMAC__ )
item->SetBitmap( editor_xpm );
#endif /* !defined( __WXMAC__ ) */
PreferencesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( PreferencesMenu, ID_SELECT_PREFERED_EDITOR,
_( "&Text Editor" ),
_( "Select your preferred text editor" ),
editor_xpm );
// PDF Viewer submenu:System browser or user defined checkbox
wxMenu* SubMenuPdfBrowserChoice = new wxMenu;
@ -230,15 +192,11 @@ void WinEDA_MainFrame::ReCreateMenuBar()
!wxGetApp().m_PdfBrowserIsDefault );
// Append PDF Viewer submenu to preferences
item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER_NAME,
_( "PDF Viewer" ),
_( "Select your favourite PDF viewer used to browse datasheets" ) );
#if !defined( __WXMAC__ )
item->SetBitmap( datasheet_xpm );
#endif /* !defined( __WXMAC__ ) */
SubMenuPdfBrowserChoice->Append( item );
ADD_MENUITEM_WITH_HELP( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER_NAME,
_( "PDF Viewer" ),
_( "Select your favourite PDF viewer used to browse datasheets" ),
datasheet_xpm );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( PreferencesMenu,
SubMenuPdfBrowserChoice,
@ -256,21 +214,15 @@ void WinEDA_MainFrame::ReCreateMenuBar()
AddHelpVersionInfoMenuEntry( helpMenu );
/* Contents */
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the kicad manual" ) );
#if !defined( __WXMAC__ )
item->SetBitmap( online_help_xpm );
#endif /* !defined( __WXMAC__ ) */
helpMenu->Append( item );
ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the kicad manual" ),
online_help_xpm );
// About
helpMenu->AppendSeparator();
item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT, _( "&About" ),
_( "About kicad project manager" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
ADD_MENUITEM_WITH_HELP( helpMenu, ID_KICAD_ABOUT, _( "&About" ),
_( "About kicad project manager" ),
info_xpm );
// Create the menubar and append all submenus
menuBar->Append( filesMenu, _( "&File" ) );
@ -302,34 +254,34 @@ void WinEDA_MainFrame::RecreateBaseHToolbar()
/* New */
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString,
wxBitmap( new_project_xpm ),
_( "Start a new project" ) );
wxBitmap( new_project_xpm ),
_( "Start a new project" ) );
/* Load */
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString,
wxBitmap( open_project_xpm ),
_( "Load existing project" ) );
wxBitmap( open_project_xpm ),
_( "Load existing project" ) );
/* Save */
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString,
wxBitmap( save_project_xpm ),
_( "Save current project" ) );
wxBitmap( save_project_xpm ),
_( "Save current project" ) );
/* Separator */
m_HToolBar->AddSeparator();
/* Archive */
m_HToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString,
wxBitmap( zip_xpm ),
_( "Archive all project files" ) );
wxBitmap( zip_xpm ),
_( "Archive all project files" ) );
/* Separator */
m_HToolBar->AddSeparator();
/* Refresh project tree */
m_HToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString,
wxBitmap( reload_xpm ),
_( "Refresh project tree" ) );
wxBitmap( reload_xpm ),
_( "Refresh project tree" ) );
/* Create m_HToolBar */
m_HToolBar->Realize();

View File

@ -69,33 +69,6 @@ void WinEDA_MainFrame::OnSelectPreferredPdfBrowser( wxCommandEvent& event )
wxGetApp().WritePdfBrowserInfos();
}
void WinEDA_MainFrame::OnSelectPreferredEditor( wxCommandEvent& event )
{
wxFileName fn = wxGetApp().m_EditorName;
wxString wildcard( wxT( "*" ) );
#ifdef __WINDOWS__
wildcard += wxT( ".exe" );
#endif
wildcard = _( "Executable file (" ) + wildcard + wxT( ")|" ) + wildcard;
wxFileDialog dlg( this, _( "Select Prefered Editor" ), fn.GetPath(),
fn.GetFullName(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return;
wxASSERT( wxGetApp().m_EDA_CommonConfig );
wxConfig* cfg = wxGetApp().m_EDA_CommonConfig;
wxGetApp().m_EditorName = dlg.GetPath();
cfg->Write( wxT( "Editor" ), wxGetApp().m_EditorName );
}
void WinEDA_MainFrame::SetLanguage( wxCommandEvent& event )
{
EDA_BASE_FRAME::SetLanguage( event );

View File

@ -17,7 +17,7 @@
; General Product Description Definitions
!define PRODUCT_NAME "KiCad"
!define PRODUCT_VERSION "2011.03.11"
!define PRODUCT_VERSION "2011.03.12"
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
!define COMPANY_NAME ""

View File

@ -1,4 +1,4 @@
release version:
2011 mar 11
2011 mar 12
files (.zip,.tgz):
kicad-2011-03-11
kicad-2011-03-12