All: added a standard exit dialog called by int DisplayExitDialog( wxWindow* aParent, const wxString& aMessage )

Called when closing pcbnew, cvpcb and eeschema.
Minor code cleaning: remove duplicate or not used strings (mainly file extensions and wildcards)
This commit is contained in:
jean-pierre charras 2012-03-08 18:47:23 +01:00
parent 5e5ec6f1a9
commit e90cc8adf5
31 changed files with 1084 additions and 74 deletions

View File

@ -15,6 +15,7 @@ set(COMMON_ABOUT_DLG_SRCS
dialog_about/dialog_about.cpp dialog_about/dialog_about.cpp
dialog_about/dialog_about_base.cpp dialog_about/dialog_about_base.cpp
dialogs/dialog_display_info_HTML_base.cpp dialogs/dialog_display_info_HTML_base.cpp
dialogs/dialog_exit_base.cpp
dialogs/dialog_image_editor.cpp dialogs/dialog_image_editor.cpp
dialogs/dialog_image_editor_base.cpp dialogs/dialog_image_editor_base.cpp
dialogs/dialog_get_component.cpp dialogs/dialog_get_component.cpp

View File

@ -8,7 +8,35 @@
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/html/htmlwin.h> #include <wx/html/htmlwin.h>
#include <html_messagebox.h> #include <html_messagebox.h>
#include <dialog_exit_base.h>
#include <bitmaps.h>
class DIALOG_EXIT: public DIALOG_EXIT_BASE
{
public:
DIALOG_EXIT( wxWindow * parent, const wxString& aMessage ) :
DIALOG_EXIT_BASE( parent )
{
m_bitmap->SetBitmap( KiBitmap( cancel_xpm ) );
if( ! aMessage.IsEmpty() )
m_TextInfo->SetLabel( aMessage );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
};
private:
void OnSaveAndExit( wxCommandEvent& event ) { EndModal( wxID_OK ); }
void OnCancel( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); }
void OnExitNoSave( wxCommandEvent& event ) { EndModal( wxID_NO ); }
};
int DisplayExitDialog( wxWindow* parent, const wxString& aMessage )
{
DIALOG_EXIT dlg( parent, aMessage );
int ret = dlg.ShowModal();
return ret;
}
void DisplayError( wxWindow* parent, const wxString& text, int displaytime ) void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
{ {

View File

@ -0,0 +1,96 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 9 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_exit_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_EXIT_BASE::DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerBitmap;
bSizerBitmap = new wxBoxSizer( wxVERTICAL );
m_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
bSizerBitmap->Add( m_bitmap, 0, wxALL, 5 );
bSizerUpper->Add( bSizerBitmap, 0, 0, 5 );
wxBoxSizer* bSizerMessages;
bSizerMessages = new wxBoxSizer( wxVERTICAL );
m_TextInfo = new wxStaticText( this, wxID_ANY, _("Save the changes before closing?"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextInfo->Wrap( -1 );
m_TextInfo->SetFont( wxFont( 8, 74, 90, 92, false, wxT("MS Shell Dlg 2") ) );
bSizerMessages->Add( m_TextInfo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bSizerMessages->Add( 10, 10, 0, 0, 5 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("If you don't save, all your changes will be permanently lost."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bSizerMessages->Add( m_staticText2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bSizerUpper->Add( bSizerMessages, 1, wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerLower;
bSizerLower = new wxBoxSizer( wxVERTICAL );
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerLower->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerButtons;
bSizerButtons = new wxBoxSizer( wxHORIZONTAL );
m_buttonSaveAndExit = new wxButton( this, wxID_ANY, _("Save and Exit"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonSaveAndExit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_buttonExitNoSave = new wxButton( this, wxID_ANY, _("Exit without Save"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonExitNoSave, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizerLower->Add( bSizerButtons, 0, wxALIGN_RIGHT, 5 );
bSizerMain->Add( bSizerLower, 0, wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_buttonSaveAndExit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSaveAndExit ), NULL, this );
m_buttonExitNoSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnExitNoSave ), NULL, this );
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnCancel ), NULL, this );
}
DIALOG_EXIT_BASE::~DIALOG_EXIT_BASE()
{
// Disconnect Events
m_buttonSaveAndExit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSaveAndExit ), NULL, this );
m_buttonExitNoSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnExitNoSave ), NULL, this );
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnCancel ), NULL, this );
}

View File

@ -0,0 +1,804 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_exit_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_exit_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_managed">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center">wxBOTH</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">DIALOG_EXIT_BASE</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">345,155</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerUpper</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerBitmap</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_bitmap</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMessages</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font">MS Shell Dlg 2,90,92,8,74,0</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Save the changes before closing?</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_TextInfo</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">10</property>
<property name="permission">protected</property>
<property name="width">10</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">If you don&apos;t save, all your changes will be permanently lost.</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText2</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerLower</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerButtons</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Save and Exit</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonSaveAndExit</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnSaveAndExit</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Exit without Save</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonExitNoSave</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnExitNoSave</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Cancel</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonCancel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnCancel</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,61 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 9 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EXIT_BASE_H__
#define __DIALOG_EXIT_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/string.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EXIT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EXIT_BASE : public wxDialog
{
private:
protected:
wxStaticBitmap* m_bitmap;
wxStaticText* m_TextInfo;
wxStaticText* m_staticText2;
wxStaticLine* m_staticline;
wxButton* m_buttonSaveAndExit;
wxButton* m_buttonExitNoSave;
wxButton* m_buttonCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnSaveAndExit( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExitNoSave( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 345,155 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EXIT_BASE();
};
#endif //__DIALOG_EXIT_BASE_H__

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2007-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2007-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *

View File

@ -22,6 +22,7 @@
#include <class_pad.h> #include <class_pad.h>
#include <class_module.h> #include <class_module.h>
#include <wildcards_and_files_ext.h>
/* Read the list of libraries (*.mod files) /* Read the list of libraries (*.mod files)
@ -53,7 +54,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames )
for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ ) for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ )
{ {
filename = aFootprintsLibNames[ii]; filename = aFootprintsLibNames[ii];
filename.SetExt( ModuleFileExtension ); filename.SetExt( FootprintLibFileExtension );
libname = wxGetApp().FindLibraryPath( filename ); libname = wxGetApp().FindLibraryPath( filename );

View File

@ -81,15 +81,6 @@ int g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
DISPLAY_OPTIONS DisplayOpt; /* Display options for board items */ DISPLAY_OPTIONS DisplayOpt; /* Display options for board items */
/* PCB file name extension definitions. */
wxString NetExtBuffer( wxT( "net" ) );
wxString NetCmpExtBuffer( wxT( "cmp" ) );
wxString g_Shapes3DExtBuffer( wxT( "wrl" ) );
const wxString ModuleFileExtension( wxT( "mod" ) );
/* PCB file name wild card definitions. */
const wxString ModuleFileWildcard( _( "KiCad footprint library files (*.mod)|*.mod" ) );
int g_RotationAngle; int g_RotationAngle;
int g_AnchorColor = BLUE; int g_AnchorColor = BLUE;

View File

@ -32,9 +32,12 @@
* file extensions and wildcards used in kicad. * file extensions and wildcards used in kicad.
*/ */
const wxString VrmlFileExtension( wxT( "wrl" ) );
const wxString ProjectFileExtension( wxT( "pro" ) ); const wxString ProjectFileExtension( wxT( "pro" ) );
const wxString SchematicFileExtension( wxT( "sch" ) ); const wxString SchematicFileExtension( wxT( "sch" ) );
const wxString NetlistFileExtension( wxT( "net" ) ); const wxString NetlistFileExtension( wxT( "net" ) );
const wxString FootprintLibFileExtension( wxT( "mod" ) );
const wxString ComponentFileExtension( wxT( "cmp" ) ); const wxString ComponentFileExtension( wxT( "cmp" ) );
const wxString GerberFileExtension( wxT( "pho" ) ); const wxString GerberFileExtension( wxT( "pho" ) );
const wxString PcbFileExtension( wxT( "brd" ) ); const wxString PcbFileExtension( wxT( "brd" ) );
@ -44,11 +47,15 @@ const wxString DrillFileExtension( wxT( "drl" ) );
const wxString ReportFileExtension( wxT( "rpt" ) ); const wxString ReportFileExtension( wxT( "rpt" ) );
const wxString FootprintPlaceFileExtension( wxT( "pos" ) ); const wxString FootprintPlaceFileExtension( wxT( "pos" ) );
// These strings are wildcards for file selection dialogs.
// Because thes are static, one should explicitely call wxGetTranslation
// to display them translated.
const wxString ProjectFileWildcard( _( "KiCad project files (*.pro)|*.pro" ) ); const wxString ProjectFileWildcard( _( "KiCad project files (*.pro)|*.pro" ) );
const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) ); const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) );
const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) ); const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
const wxString PcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) ); const wxString PcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) );
const wxString FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) );
const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) ); const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) );
const wxString MacrosFileWildcard( _( "KiCad recorded macros (*.mcr)|*.mcr" ) ); const wxString MacrosFileWildcard( _( "KiCad recorded macros (*.mcr)|*.mcr" ) );
const wxString AllFilesWildcard( _( "All files (*)|*" ) ); const wxString AllFilesWildcard( _( "All files (*)|*" ) );
@ -59,3 +66,4 @@ const wxString ComponentFileWildcard( _( "KiCad cmp/footprint link files (*.cmp)
const wxString DrillFileWildcard( _( "Drill files (*.drl)|*.drl;*.DRL" ) ); const wxString DrillFileWildcard( _( "Drill files (*.drl)|*.drl;*.DRL" ) );
const wxString ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" ); const wxString ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" );
const wxString FootprintPlaceFileWildcard = _( "Footprint place files (*.pos)|*.pos" ); const wxString FootprintPlaceFileWildcard = _( "Footprint place files (*.pos)|*.pos" );
const wxString VrmlFileWildcard( _( "Vrml files (*.wrl)|*.wrl" ) );

View File

@ -240,13 +240,8 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
if( m_modified ) if( m_modified )
{ {
unsigned ii; wxString msg = _( "Component to Footprint links modified.\nSave before exit ?" );
wxMessageDialog dialog( this, int ii = DisplayExitDialog( this, msg );
_( "Component to Footprint links modified.\nSave before exit ?" ),
_( "Confirmation" ),
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );
ii = dialog.ShowModal();
switch( ii ) switch( ii )
{ {

View File

@ -299,7 +299,7 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
if( (event.GetId() == ID_ADD_LIB) || (event.GetId() == ID_INSERT_LIB) ) if( (event.GetId() == ID_ADD_LIB) || (event.GetId() == ID_INSERT_LIB) )
{ {
list = m_ListLibr; list = m_ListLibr;
wildcard = ModuleFileWildcard; wildcard = FootprintLibFileWildcard;
} }
wxArrayInt selections; wxArrayInt selections;

View File

@ -19,6 +19,7 @@
#include <class_DisplayFootprintsFrame.h> #include <class_DisplayFootprintsFrame.h>
#include <richio.h> #include <richio.h>
#include <filter_reader.h> #include <filter_reader.h>
#include <wildcards_and_files_ext.h>
/** /**
@ -42,7 +43,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& CmpName )
for( ii = 0; ii < parent->m_ModuleLibNames.GetCount(); ii++ ) for( ii = 0; ii < parent->m_ModuleLibNames.GetCount(); ii++ )
{ {
fn = parent->m_ModuleLibNames[ii]; fn = parent->m_ModuleLibNames[ii];
fn.SetExt( ModuleFileExtension ); fn.SetExt( FootprintLibFileExtension );
tmp = wxGetApp().FindLibraryPath( fn ); tmp = wxGetApp().FindLibraryPath( fn );

View File

@ -78,6 +78,7 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData,
// Adjust the height of the dialog to prevent controls from being hidden when // Adjust the height of the dialog to prevent controls from being hidden when
// switching between the find and find/replace modes of the dialog. This ignores // switching between the find and find/replace modes of the dialog. This ignores
// the users preferred height if any of the controls would be hidden. // the users preferred height if any of the controls would be hidden.
GetSizer()->SetSizeHints( this );
wxSize size = aSize; wxSize size = aSize;
if( aSize != wxDefaultSize ) if( aSize != wxDefaultSize )

View File

@ -31,6 +31,7 @@
#include <gr_basic.h> #include <gr_basic.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <gestfich.h> #include <gestfich.h>
#include <confirm.h>
#include <general.h> #include <general.h>
#include <protos.h> #include <protos.h>
@ -422,12 +423,13 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
if( SheetList.IsModified() ) if( SheetList.IsModified() )
{ {
wxMessageDialog dialog( this, wxString msg;
_( "Schematic modified, Save before exit?" ), msg.Printf( _("Save the changes in\n<%s>\nbefore closing?"),
_( "Confirmation" ), wxYES_NO | wxCANCEL | GetChars( g_RootSheet->GetScreen()->GetFileName() ) );
wxICON_EXCLAMATION | wxYES_DEFAULT );
switch( dialog.ShowModal() ) int ii = DisplayExitDialog( this, msg );
switch( ii )
{ {
case wxID_CANCEL: case wxID_CANCEL:
aEvent.Veto(); aEvent.Veto();

View File

@ -8,6 +8,21 @@
#ifndef __INCLUDE__CONFIRM_H__ #ifndef __INCLUDE__CONFIRM_H__
#define __INCLUDE__CONFIRM_H__ 1 #define __INCLUDE__CONFIRM_H__ 1
/**
* Function DisplayExitDialog
* displays a dialog with 3 buttons:
* Save and Exit
* Cancel
* Exit without save
*
* @param aParent = the parent window
* @param aMessage = the main message to put in dialog
* If empty, the standard message will be shown:
* Save the changes before closing?
* @return wxID_YES, wxID_CANCEL, wxID_NO.
*/
int DisplayExitDialog( wxWindow* aParent, const wxString& aMessage );
/** /**
* Function DisplayError * Function DisplayError

View File

@ -35,12 +35,6 @@ extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
extern DISPLAY_OPTIONS DisplayOpt; extern DISPLAY_OPTIONS DisplayOpt;
extern wxString NetExtBuffer;
extern wxString NetCmpExtBuffer;
extern const wxString ModuleFileExtension;
extern const wxString ModuleFileWildcard;
extern int g_CurrentVersionPCB; extern int g_CurrentVersionPCB;
extern int g_RotationAngle; extern int g_RotationAngle;

View File

@ -41,11 +41,13 @@
* that they cannot be changed. * that they cannot be changed.
* Mainly wild cards are most of time translated when displayed * Mainly wild cards are most of time translated when displayed
*/ */
extern const wxString VrmlFileExtension;
extern const wxString ProjectFileExtension; extern const wxString ProjectFileExtension;
extern const wxString SchematicFileExtension; extern const wxString SchematicFileExtension;
extern const wxString NetlistFileExtension; extern const wxString NetlistFileExtension;
extern const wxString GerberFileExtension; extern const wxString GerberFileExtension;
extern const wxString PcbFileExtension; extern const wxString PcbFileExtension;
extern const wxString FootprintLibFileExtension;
extern const wxString PdfFileExtension; extern const wxString PdfFileExtension;
extern const wxString MacrosFileExtension; extern const wxString MacrosFileExtension;
extern const wxString ComponentFileExtension; extern const wxString ComponentFileExtension;
@ -67,5 +69,8 @@ extern const wxString ComponentFileWildcard;
extern const wxString DrillFileWildcard; extern const wxString DrillFileWildcard;
extern const wxString ReportFileWildcard; extern const wxString ReportFileWildcard;
extern const wxString FootprintPlaceFileWildcard; extern const wxString FootprintPlaceFileWildcard;
extern const wxString VrmlFileWildcard;
extern const wxString DocModulesFileName;
extern const wxString FootprintLibFileWildcard;
#endif // INCLUDE_WILDCARDS_AND_FILES_EXT_H_ #endif // INCLUDE_WILDCARDS_AND_FILES_EXT_H_

View File

@ -17,6 +17,7 @@
#include <class_text_mod.h> #include <class_text_mod.h>
#include <dialog_edit_module_for_BoardEditor.h> #include <dialog_edit_module_for_BoardEditor.h>
#include <wildcards_and_files_ext.h>
DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent, DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent,
@ -404,18 +405,16 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
{ {
wxString fullfilename, shortfilename; wxString fullfilename, shortfilename;
wxString fullpath; wxString fullpath;
wxString mask = wxT( "*" );
fullpath = wxGetApp().ReturnLastVisitedLibraryPath( LIB3D_PATH ); fullpath = wxGetApp().ReturnLastVisitedLibraryPath( LIB3D_PATH );
mask += g_Shapes3DExtBuffer;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
fullpath.Replace( wxT( "/" ), wxT( "\\" ) ); fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
#endif #endif
fullfilename = EDA_FileSelector( _( "3D Shape:" ), fullfilename = EDA_FileSelector( _( "3D Shape:" ),
fullpath, fullpath,
wxEmptyString, wxEmptyString,
g_Shapes3DExtBuffer, VrmlFileExtension,
mask, wxGetTranslation( VrmlFileWildcard ),
this, this,
wxFD_OPEN, wxFD_OPEN,
true true

View File

@ -16,6 +16,7 @@
#include <class_text_mod.h> #include <class_text_mod.h>
#include <module_editor_frame.h> #include <module_editor_frame.h>
#include <dialog_edit_module_for_Modedit.h> #include <dialog_edit_module_for_Modedit.h>
#include <wildcards_and_files_ext.h>
DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* aParent, DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* aParent,
@ -259,18 +260,16 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
{ {
wxString fullfilename, shortfilename; wxString fullfilename, shortfilename;
wxString fullpath; wxString fullpath;
wxString mask = wxT( "*" );
fullpath = wxGetApp().ReturnLastVisitedLibraryPath( LIB3D_PATH ); fullpath = wxGetApp().ReturnLastVisitedLibraryPath( LIB3D_PATH );
mask += g_Shapes3DExtBuffer;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
fullpath.Replace( wxT( "/" ), wxT( "\\" ) ); fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
#endif #endif
fullfilename = EDA_FileSelector( _( "3D Shape:" ), fullfilename = EDA_FileSelector( _( "3D Shape:" ),
fullpath, fullpath,
wxEmptyString, wxEmptyString,
g_Shapes3DExtBuffer, VrmlFileExtension,
mask, wxGetTranslation( VrmlFileWildcard ),
this, this,
wxFD_OPEN, wxFD_OPEN,
true true

View File

@ -29,7 +29,7 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC )
if( !fn.FileExists() ) if( !fn.FileExists() )
{ {
fn = GetScreen()->GetFileName(); fn = GetScreen()->GetFileName();
fn.SetExt( NetExtBuffer ); fn.SetExt( NetlistFileExtension );
lastNetlistName = fn.GetFullPath(); lastNetlistName = fn.GetFullPath();
} }
@ -102,7 +102,7 @@ void DIALOG_NETLIST::OnOpenNelistClick( wxCommandEvent& event )
void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event )
{ {
wxFileName fn = m_NetlistFilenameCtrl->GetValue(); wxFileName fn = m_NetlistFilenameCtrl->GetValue();
fn.SetExt( NetCmpExtBuffer ); fn.SetExt( ComponentFileExtension );
m_Parent->ReadPcbNetlist( m_NetlistFilenameCtrl->GetValue(), m_Parent->ReadPcbNetlist( m_NetlistFilenameCtrl->GetValue(),
fn.GetFullPath(), m_MessageWindow, fn.GetFullPath(), m_MessageWindow,

View File

@ -43,6 +43,7 @@
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <dialog_pcbnew_config_libs_and_paths.h> #include <dialog_pcbnew_config_libs_and_paths.h>
#include <wildcards_and_files_ext.h>
void PCB_EDIT_FRAME::InstallConfigFrame( ) void PCB_EDIT_FRAME::InstallConfigFrame( )
@ -271,7 +272,8 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
libpath = wxGetApp().ReturnLastVisitedLibraryPath(); libpath = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog FilesDialog( this, _( "Footprint library files:" ), libpath, wxFileDialog FilesDialog( this, _( "Footprint library files:" ), libpath,
wxEmptyString, g_FootprintLibFileWildcard, wxEmptyString,
wxGetTranslation( FootprintLibFileWildcard ),
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE ); wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
if( FilesDialog.ShowModal() != wxID_OK ) if( FilesDialog.ShowModal() != wxID_OK )

View File

@ -22,6 +22,7 @@
#include <pcbnew.h> #include <pcbnew.h>
#include <class_footprint_library.h> #include <class_footprint_library.h>
#include <module_editor_frame.h> #include <module_editor_frame.h>
#include <wildcards_and_files_ext.h>
/* /*
@ -151,7 +152,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule, bool aCreateSysLib )
return; return;
fn.SetName( aModule->m_LibRef ); fn.SetName( aModule->m_LibRef );
fn.SetExt( aCreateSysLib ? ModuleFileExtension : ModExportFileExtension ); fn.SetExt( aCreateSysLib ? FootprintLibFileExtension : ModExportFileExtension );
if( aCreateSysLib ) if( aCreateSysLib )
path = wxGetApp().ReturnLastVisitedLibraryPath(); path = wxGetApp().ReturnLastVisitedLibraryPath();
@ -160,8 +161,9 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule, bool aCreateSysLib )
fn.SetPath( path ); fn.SetPath( path );
title = aCreateSysLib ? _( "Create New Library" ) : _( "Export Module" ); title = aCreateSysLib ? _( "Create New Library" ) : _( "Export Module" );
wildcard = aCreateSysLib ? ModuleFileWildcard : ModExportFileWildcard; wildcard = aCreateSysLib ? FootprintLibFileWildcard : ModExportFileWildcard;
wxFileDialog dlg( this, msg, fn.GetPath(), fn.GetFullName(), wildcard, wxFileDialog dlg( this, msg, fn.GetPath(), fn.GetFullName(),
wxGetTranslation( wildcard ),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
@ -369,7 +371,8 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( const wxString& aLibName, bool aNewM
if( aLibName.IsEmpty() ) if( aLibName.IsEmpty() )
{ {
wxFileDialog dlg( this, _( "Library" ), path, wxFileDialog dlg( this, _( "Library" ), path,
wxEmptyString, ModuleFileWildcard, wxEmptyString,
wxGetTranslation( FootprintLibFileWildcard ),
wxFD_SAVE ); wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
@ -730,7 +733,8 @@ void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return; return;
wxFileName fileName = wxFileName( wxEmptyString, dlg.GetTextSelection(), ModuleFileExtension ); wxFileName fileName = wxFileName( wxEmptyString, dlg.GetTextSelection(),
FootprintLibFileExtension );
fileName = wxGetApp().FindLibraryPath( fileName ); fileName = wxGetApp().FindLibraryPath( fileName );
if( fileName.IsOk() && fileName.FileExists() ) if( fileName.IsOk() && fileName.FileExists() )

View File

@ -49,6 +49,7 @@
#include <class_footprint_library.h> #include <class_footprint_library.h>
#include <dialog_get_component.h> #include <dialog_get_component.h>
#include <modview_frame.h> #include <modview_frame.h>
#include <wildcards_and_files_ext.h>
static void DisplayCmpDoc( wxString& Name ); static void DisplayCmpDoc( wxString& Name );
@ -272,7 +273,7 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename,
if( one_lib ) if( one_lib )
fn = aLibraryFullFilename; fn = aLibraryFullFilename;
else else
fn = wxFileName( wxEmptyString, g_LibraryNames[ii], ModuleFileExtension ); fn = wxFileName( wxEmptyString, g_LibraryNames[ii], FootprintLibFileExtension );
tmp = wxGetApp().FindLibraryPath( fn ); tmp = wxGetApp().FindLibraryPath( fn );

View File

@ -27,6 +27,7 @@
#include <collectors.h> #include <collectors.h>
#include <dialog_edit_module_for_Modedit.h> #include <dialog_edit_module_for_Modedit.h>
#include <wildcards_and_files_ext.h>
// Functions defined in block_module_editor, but used here // Functions defined in block_module_editor, but used here
// These 2 functions are used in modedit to rotate or mirror the whole footprint // These 2 functions are used in modedit to rotate or mirror the whole footprint
@ -247,7 +248,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_DELETE_PART: case ID_MODEDIT_DELETE_PART:
{ {
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension ); wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, FootprintLibFileExtension );
wxString full_libraryfilename = wxGetApp().FindLibraryPath( fn ); wxString full_libraryfilename = wxGetApp().FindLibraryPath( fn );
if( wxFileName::FileExists( full_libraryfilename ) ) if( wxFileName::FileExists( full_libraryfilename ) )
@ -287,7 +288,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
{ {
wxFileName fn; wxFileName fn;
fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension ); fn = wxFileName( wxEmptyString, m_CurrentLib, FootprintLibFileExtension );
wxString full_filename = wxGetApp().FindLibraryPath( fn ); wxString full_filename = wxGetApp().FindLibraryPath( fn );
Save_Module_In_Library( full_filename, GetBoard()->m_Modules, true, true ); Save_Module_In_Library( full_filename, GetBoard()->m_Modules, true, true );
GetScreen()->ClrModify(); GetScreen()->ClrModify();
@ -415,7 +416,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( !m_CurrentLib.IsEmpty() ) if( !m_CurrentLib.IsEmpty() )
{ {
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension ); wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, FootprintLibFileExtension );
full_libraryfilename = wxGetApp().FindLibraryPath( fn ); full_libraryfilename = wxGetApp().FindLibraryPath( fn );
} }

View File

@ -45,6 +45,7 @@
#include <pcbnew_id.h> #include <pcbnew_id.h>
#include <hotkeys.h> #include <hotkeys.h>
#include <module_editor_frame.h> #include <module_editor_frame.h>
#include <wildcards_and_files_ext.h>
static PCB_SCREEN* s_screenModule; // the PCB_SCREEN used by the footprint editor static PCB_SCREEN* s_screenModule; // the PCB_SCREEN used by the footprint editor
@ -492,7 +493,7 @@ void FOOTPRINT_EDIT_FRAME::UpdateTitle()
} }
else else
{ {
wxFileName fileName = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension ); wxFileName fileName = wxFileName( wxEmptyString, m_CurrentLib, FootprintLibFileExtension );
fileName = wxGetApp().FindLibraryPath( fileName ); fileName = wxGetApp().FindLibraryPath( fileName );
if( !fileName.IsOk() || !fileName.FileExists() ) if( !fileName.IsOk() || !fileName.FileExists() )

View File

@ -17,6 +17,7 @@
#include <pcbnew.h> #include <pcbnew.h>
#include <pcbnew_id.h> #include <pcbnew_id.h>
#include <modview_frame.h> #include <modview_frame.h>
#include <wildcards_and_files_ext.h>
#define NEXT_PART 1 #define NEXT_PART 1
@ -109,7 +110,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event )
*/ */
void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
{ {
wxString libname = m_libraryName + wxT(".") + ModuleFileExtension; wxString libname = m_libraryName + wxT(".") + FootprintLibFileExtension;
MODULE* oldmodule = GetBoard()->m_Modules; MODULE* oldmodule = GetBoard()->m_Modules;
MODULE * module = Load_Module_From_Library( libname, false ); MODULE * module = Load_Module_From_Library( libname, false );
if( module ) if( module )
@ -160,7 +161,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
SetCurItem( NULL ); SetCurItem( NULL );
// Delete the current footprint // Delete the current footprint
GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll();
GetModuleLibrary( m_libraryName + wxT(".") + ModuleFileExtension, GetModuleLibrary( m_libraryName + wxT(".") + FootprintLibFileExtension,
m_footprintName, true ); m_footprintName, true );
Update3D_Frame(); Update3D_Frame();
} }

View File

@ -44,6 +44,7 @@
#include <footprint_info.h> #include <footprint_info.h>
#include <hotkeys.h> #include <hotkeys.h>
#include <wildcards_and_files_ext.h>
/** /**
@ -188,7 +189,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* s
// If a footprint was previsiously loaded, reload it // If a footprint was previsiously loaded, reload it
if( !m_libraryName.IsEmpty() && !m_footprintName.IsEmpty() ) if( !m_libraryName.IsEmpty() && !m_footprintName.IsEmpty() )
GetModuleLibrary( m_libraryName + wxT(".") + ModuleFileExtension, GetModuleLibrary( m_libraryName + wxT(".") + FootprintLibFileExtension,
m_footprintName, false ); m_footprintName, false );
@ -436,7 +437,7 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
SetCurItem( NULL ); SetCurItem( NULL );
// Delete the current footprint // Delete the current footprint
GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll();
GetModuleLibrary( m_libraryName + wxT(".") + ModuleFileExtension, GetModuleLibrary( m_libraryName + wxT(".") + FootprintLibFileExtension,
m_footprintName, true ); m_footprintName, true );
DisplayLibInfos(); DisplayLibInfos();
Zoom_Automatique( false ); Zoom_Automatique( false );

View File

@ -461,13 +461,11 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
if( GetScreen()->IsModify() ) if( GetScreen()->IsModify() )
{ {
unsigned ii; wxString msg;
wxMessageDialog dialog( this, _( "Board modified, Save before exit ?" ), msg.Printf( _("Save the changes in\n<%s>\nbefore closing?"),
_( "Confirmation" ), GetChars( GetScreen()->GetFileName() ) );
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );
ii = dialog.ShowModal();
int ii = DisplayExitDialog( this, msg );
switch( ii ) switch( ii )
{ {
case wxID_CANCEL: case wxID_CANCEL:

View File

@ -73,9 +73,6 @@ int g_MagneticTrackOption = capture_cursor_in_track_tool;
wxPoint g_Offset_Module; /* Distance to offset module trace when moving. */ wxPoint g_Offset_Module; /* Distance to offset module trace when moving. */
// Wildcard for footprint libraries filesnames
const wxString g_FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) );
/* Name of the document footprint list /* Name of the document footprint list
* usually located in share/modules/footprints_doc * usually located in share/modules/footprints_doc
* this is of the responsibility to users to create this file * this is of the responsibility to users to create this file

View File

@ -40,6 +40,14 @@
/* Flag to force the SKETCH mode to display items (.m_Flags member) */ /* Flag to force the SKETCH mode to display items (.m_Flags member) */
#define FORCE_SKETCH ( IS_DRAGGED | IN_EDIT ) #define FORCE_SKETCH ( IS_DRAGGED | IN_EDIT )
/* Name of the document footprint list
* usually located in share/modules/footprints_doc
* this is of the responsibility to users to create this file
* if they want to have a list of footprints
* default is "footprints_doc/footprints.pdf"
*/
extern wxString g_DocModulesFileName;
/* variables */ /* variables */
extern bool Drc_On; extern bool Drc_On;
extern bool g_AutoDeleteOldTrack; extern bool g_AutoDeleteOldTrack;
@ -47,15 +55,9 @@ extern bool g_Drag_Pistes_On;
extern bool g_Show_Module_Ratsnest; extern bool g_Show_Module_Ratsnest;
extern bool g_Show_Pads_Module_in_Move; extern bool g_Show_Pads_Module_in_Move;
extern bool g_Raccord_45_Auto; extern bool g_Raccord_45_Auto;
extern const wxString g_FootprintLibFileWildcard; // Wildcard for footprint libraries filesnames
extern bool g_Track_45_Only_Allowed; extern bool g_Track_45_Only_Allowed;
extern bool g_Alternate_Track_Posture; extern bool g_Alternate_Track_Posture;
extern bool Segments_45_Only; extern bool Segments_45_Only;
extern wxString g_Shapes3DExtBuffer;
extern wxString g_DocModulesFileName;
/* Layer pair for auto routing and switch layers by hotkey */ /* Layer pair for auto routing and switch layers by hotkey */
extern int Route_Layer_TOP; extern int Route_Layer_TOP;

View File

@ -16,6 +16,7 @@
#include <pcbnew.h> #include <pcbnew.h>
#include <dialog_exchange_modules_base.h> #include <dialog_exchange_modules_base.h>
#include <ar_protos.h> #include <ar_protos.h>
#include <wildcards_and_files_ext.h>
static char* quiet_gcc_4_4_3; // GCC 4.4.3 and next .. static char* quiet_gcc_4_4_3; // GCC 4.4.3 and next ..
@ -160,7 +161,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
/* Build CMP file name by changing the extension of NetList filename */ /* Build CMP file name by changing the extension of NetList filename */
fn = m_Parent->GetScreen()->GetFileName(); fn = m_Parent->GetScreen()->GetFileName();
fn.SetExt( NetCmpExtBuffer ); fn.SetExt( ComponentFileExtension );
FichCmp = wxFopen( fn.GetFullPath(), wxT( "rt" ) ); FichCmp = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
@ -598,8 +599,8 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
/* Calculation file name by changing the extension name to NetList */ /* Calculation file name by changing the extension name to NetList */
fn = GetScreen()->GetFileName(); fn = GetScreen()->GetFileName();
fn.SetExt( NetCmpExtBuffer ); fn.SetExt( ComponentFileExtension );
wildcard = _( "Component files (." ) + NetCmpExtBuffer + wxT( ")|*." ) + NetCmpExtBuffer; wildcard = wxGetTranslation( ComponentFileWildcard );
wxFileDialog dlg( this, _( "Save Component Files" ), wxGetCwd(), wxFileDialog dlg( this, _( "Save Component Files" ), wxGetCwd(),
fn.GetFullName(), wildcard, fn.GetFullName(), wildcard,