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

All: added a standard exit dialog called by int DisplayExitDialog( wxWindow*...

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)
parent 5e5ec6f1
......@@ -15,6 +15,7 @@ set(COMMON_ABOUT_DLG_SRCS
dialog_about/dialog_about.cpp
dialog_about/dialog_about_base.cpp
dialogs/dialog_display_info_HTML_base.cpp
dialogs/dialog_exit_base.cpp
dialogs/dialog_image_editor.cpp
dialogs/dialog_image_editor_base.cpp
dialogs/dialog_get_component.cpp
......
......@@ -8,7 +8,35 @@
#include <wx/wx.h>
#include <wx/html/htmlwin.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 )
{
......
///////////////////////////////////////////////////////////////////////////
// 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 );
}
<?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>
///////////////////////////////////////////////////////////////////////////
// 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__
/*
* 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) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
......
......@@ -22,6 +22,7 @@
#include <class_pad.h>
#include <class_module.h>
#include <wildcards_and_files_ext.h>
/* 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++ )
{
filename = aFootprintsLibNames[ii];
filename.SetExt( ModuleFileExtension );
filename.SetExt( FootprintLibFileExtension );
libname = wxGetApp().FindLibraryPath( filename );
......
......@@ -81,15 +81,6 @@ int g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
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_AnchorColor = BLUE;
......
......@@ -32,9 +32,12 @@
* file extensions and wildcards used in kicad.
*/
const wxString VrmlFileExtension( wxT( "wrl" ) );
const wxString ProjectFileExtension( wxT( "pro" ) );
const wxString SchematicFileExtension( wxT( "sch" ) );
const wxString NetlistFileExtension( wxT( "net" ) );
const wxString FootprintLibFileExtension( wxT( "mod" ) );
const wxString ComponentFileExtension( wxT( "cmp" ) );
const wxString GerberFileExtension( wxT( "pho" ) );
const wxString PcbFileExtension( wxT( "brd" ) );
......@@ -44,11 +47,15 @@ const wxString DrillFileExtension( wxT( "drl" ) );
const wxString ReportFileExtension( wxT( "rpt" ) );
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 SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) );
const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
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 MacrosFileWildcard( _( "KiCad recorded macros (*.mcr)|*.mcr" ) );
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 ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" );
const wxString FootprintPlaceFileWildcard = _( "Footprint place files (*.pos)|*.pos" );
const wxString VrmlFileWildcard( _( "Vrml files (*.wrl)|*.wrl" ) );
......@@ -240,13 +240,8 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
if( m_modified )
{
unsigned ii;
wxMessageDialog dialog( this,
_( "Component to Footprint links modified.\nSave before exit ?" ),
_( "Confirmation" ),
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );
ii = dialog.ShowModal();
wxString msg = _( "Component to Footprint links modified.\nSave before exit ?" );
int ii = DisplayExitDialog( this, msg );
switch( ii )
{
......
......@@ -299,7 +299,7 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
if( (event.GetId() == ID_ADD_LIB) || (event.GetId() == ID_INSERT_LIB) )
{
list = m_ListLibr;
wildcard = ModuleFileWildcard;
wildcard = FootprintLibFileWildcard;
}
wxArrayInt selections;
......
......@@ -19,6 +19,7 @@
#include <class_DisplayFootprintsFrame.h>
#include <richio.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++ )
{
fn = parent->m_ModuleLibNames[ii];
fn.SetExt( ModuleFileExtension );
fn.SetExt( FootprintLibFileExtension );
tmp = wxGetApp().FindLibraryPath( fn );
......
......@@ -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
// 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.
GetSizer()->SetSizeHints( this );
wxSize size = aSize;
if( aSize != wxDefaultSize )
......
......@@ -31,6 +31,7 @@
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <gestfich.h>
#include <confirm.h>
#include <general.h>
#include <protos.h>
......@@ -422,12 +423,13 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
if( SheetList.IsModified() )
{
wxMessageDialog dialog( this,
_( "Schematic modified, Save before exit?" ),
_( "Confirmation" ), wxYES_NO | wxCANCEL |
wxICON_EXCLAMATION | wxYES_DEFAULT );
wxString msg;
msg.Printf( _("Save the changes in\n<%s>\nbefore closing?"),
GetChars( g_RootSheet->GetScreen()->GetFileName() ) );
switch( dialog.ShowModal() )
int ii = DisplayExitDialog( this, msg );
switch( ii )
{
case wxID_CANCEL:
aEvent.Veto();
......
......@@ -8,6 +8,21 @@
#ifndef __INCLUDE__CONFIRM_H__
#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
......
......@@ -35,12 +35,6 @@ extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
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_RotationAngle;
......
......@@ -41,11 +41,13 @@
* that they cannot be changed.
* Mainly wild cards are most of time translated when displayed
*/
extern const wxString VrmlFileExtension;
extern const wxString ProjectFileExtension;
extern const wxString SchematicFileExtension;
extern const wxString NetlistFileExtension;
extern const wxString GerberFileExtension;
extern const wxString PcbFileExtension;
extern const wxString FootprintLibFileExtension;
extern const wxString PdfFileExtension;
extern const wxString MacrosFileExtension;
extern const wxString ComponentFileExtension;
......@@ -67,5 +69,8 @@ extern const wxString ComponentFileWildcard;
extern const wxString DrillFileWildcard;
extern const wxString ReportFileWildcard;
extern const wxString FootprintPlaceFileWildcard;
extern const wxString VrmlFileWildcard;
extern const wxString DocModulesFileName;
extern const wxString FootprintLibFileWildcard;
#endif // INCLUDE_WILDCARDS_AND_FILES_EXT_H_
......@@ -17,6 +17,7 @@
#include <class_text_mod.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,
......@@ -404,18 +405,16 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
{
wxString fullfilename, shortfilename;
wxString fullpath;
wxString mask = wxT( "*" );
fullpath = wxGetApp().ReturnLastVisitedLibraryPath( LIB3D_PATH );
mask += g_Shapes3DExtBuffer;
#ifdef __WINDOWS__
fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
#endif
fullfilename = EDA_FileSelector( _( "3D Shape:" ),
fullpath,
wxEmptyString,
g_Shapes3DExtBuffer,
mask,
VrmlFileExtension,
wxGetTranslation( VrmlFileWildcard ),
this,
wxFD_OPEN,
true
......
......@@ -16,6 +16,7 @@
#include <class_text_mod.h>
#include <module_editor_frame.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,
......@@ -259,18 +260,16 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
{
wxString fullfilename, shortfilename;
wxString fullpath;
wxString mask = wxT( "*" );
fullpath = wxGetApp().ReturnLastVisitedLibraryPath( LIB3D_PATH );
mask += g_Shapes3DExtBuffer;
#ifdef __WINDOWS__
fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
#endif
fullfilename = EDA_FileSelector( _( "3D Shape:" ),
fullpath,
wxEmptyString,
g_Shapes3DExtBuffer,
mask,
VrmlFileExtension,
wxGetTranslation( VrmlFileWildcard ),
this,
wxFD_OPEN,
true
......
......@@ -29,7 +29,7 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC )
if( !fn.FileExists() )
{
fn = GetScreen()->GetFileName();
fn.SetExt( NetExtBuffer );
fn.SetExt( NetlistFileExtension );
lastNetlistName = fn.GetFullPath();
}
......@@ -102,7 +102,7 @@ void DIALOG_NETLIST::OnOpenNelistClick( wxCommandEvent& event )
void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event )
{
wxFileName fn = m_NetlistFilenameCtrl->GetValue();
fn.SetExt( NetCmpExtBuffer );
fn.SetExt( ComponentFileExtension );
m_Parent->ReadPcbNetlist( m_NetlistFilenameCtrl->GetValue(),
fn.GetFullPath(), m_MessageWindow,
......
......@@ -43,6 +43,7 @@
#include <wildcards_and_files_ext.h>
#include <dialog_pcbnew_config_libs_and_paths.h>
#include <wildcards_and_files_ext.h>
void PCB_EDIT_FRAME::InstallConfigFrame( )
......@@ -271,7 +272,8 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
libpath = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog FilesDialog( this, _( "Footprint library files:" ), libpath,
wxEmptyString, g_FootprintLibFileWildcard,
wxEmptyString,
wxGetTranslation( FootprintLibFileWildcard ),
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
if( FilesDialog.ShowModal() != wxID_OK )
......
......@@ -22,6 +22,7 @@
#include <pcbnew.h>
#include <class_footprint_library.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;
fn.SetName( aModule->m_LibRef );
fn.SetExt( aCreateSysLib ? ModuleFileExtension : ModExportFileExtension );
fn.SetExt( aCreateSysLib ? FootprintLibFileExtension : ModExportFileExtension );
if( aCreateSysLib )
path = wxGetApp().ReturnLastVisitedLibraryPath();
......@@ -160,8 +161,9 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule, bool aCreateSysLib )
fn.SetPath( path );
title = aCreateSysLib ? _( "Create New Library" ) : _( "Export Module" );
wildcard = aCreateSysLib ? ModuleFileWildcard : ModExportFileWildcard;
wxFileDialog dlg( this, msg, fn.GetPath(), fn.GetFullName(), wildcard,
wildcard = aCreateSysLib ? FootprintLibFileWildcard : ModExportFileWildcard;
wxFileDialog dlg( this, msg, fn.GetPath(), fn.GetFullName(),
wxGetTranslation( wildcard ),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
......@@ -369,7 +371,8 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( const wxString& aLibName, bool aNewM
if( aLibName.IsEmpty() )
{
wxFileDialog dlg( this, _( "Library" ), path,
wxEmptyString, ModuleFileWildcard,
wxEmptyString,
wxGetTranslation( FootprintLibFileWildcard ),
wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL )
......@@ -730,7 +733,8 @@ void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
if( dlg.ShowModal() != wxID_OK )
return;
wxFileName fileName = wxFileName( wxEmptyString, dlg.GetTextSelection(), ModuleFileExtension );
wxFileName fileName = wxFileName( wxEmptyString, dlg.GetTextSelection(),
FootprintLibFileExtension );
fileName = wxGetApp().FindLibraryPath( fileName );
if( fileName.IsOk() && fileName.FileExists() )
......
......@@ -49,6 +49,7 @@
#include <class_footprint_library.h>
#include <dialog_get_component.h>
#include <modview_frame.h>
#include <wildcards_and_files_ext.h>
static void DisplayCmpDoc( wxString& Name );
......@@ -272,7 +273,7 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename,
if( one_lib )
fn = aLibraryFullFilename;
else
fn = wxFileName( wxEmptyString, g_LibraryNames[ii], ModuleFileExtension );
fn = wxFileName( wxEmptyString, g_LibraryNames[ii], FootprintLibFileExtension );
tmp = wxGetApp().FindLibraryPath( fn );
......
......@@ -27,6 +27,7 @@
#include <collectors.h>
#include <dialog_edit_module_for_Modedit.h>
#include <wildcards_and_files_ext.h>
// Functions defined in block_module_editor, but used here
// 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:
{
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, FootprintLibFileExtension );
wxString full_libraryfilename = wxGetApp().FindLibraryPath( fn );
if( wxFileName::FileExists( full_libraryfilename ) )
......@@ -287,7 +288,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
{
wxFileName fn;
fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
fn = wxFileName( wxEmptyString, m_CurrentLib, FootprintLibFileExtension );
wxString full_filename = wxGetApp().FindLibraryPath( fn );
Save_Module_In_Library( full_filename, GetBoard()->m_Modules, true, true );
GetScreen()->ClrModify();
......@@ -415,7 +416,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( !m_CurrentLib.IsEmpty() )
{
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, FootprintLibFileExtension );
full_libraryfilename = wxGetApp().FindLibraryPath( fn );
}
......
......@@ -45,6 +45,7 @@
#include <pcbnew_id.h>
#include <hotkeys.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
......@@ -492,7 +493,7 @@ void FOOTPRINT_EDIT_FRAME::UpdateTitle()
}
else
{
wxFileName fileName = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
wxFileName fileName = wxFileName( wxEmptyString, m_CurrentLib, FootprintLibFileExtension );
fileName = wxGetApp().FindLibraryPath( fileName );
if( !fileName.IsOk() || !fileName.FileExists() )
......
......@@ -17,6 +17,7 @@
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <modview_frame.h>
#include <wildcards_and_files_ext.h>
#define NEXT_PART 1
......@@ -109,7 +110,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( 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 * module = Load_Module_From_Library( libname, false );
if( module )
......@@ -160,7 +161,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
SetCurItem( NULL );
// Delete the current footprint
GetBoard()->m_Modules.DeleteAll();
GetModuleLibrary( m_libraryName + wxT(".") + ModuleFileExtension,
GetModuleLibrary( m_libraryName + wxT(".") + FootprintLibFileExtension,
m_footprintName, true );
Update3D_Frame();
}
......
......@@ -44,6 +44,7 @@
#include <footprint_info.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( !m_libraryName.IsEmpty() && !m_footprintName.IsEmpty() )
GetModuleLibrary( m_libraryName + wxT(".") + ModuleFileExtension,
GetModuleLibrary( m_libraryName + wxT(".") + FootprintLibFileExtension,
m_footprintName, false );
......@@ -436,7 +437,7 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
SetCurItem( NULL );
// Delete the current footprint
GetBoard()->m_Modules.DeleteAll();
GetModuleLibrary( m_libraryName + wxT(".") + ModuleFileExtension,
GetModuleLibrary( m_libraryName + wxT(".") + FootprintLibFileExtension,
m_footprintName, true );
DisplayLibInfos();
Zoom_Automatique( false );
......
......@@ -461,13 +461,11 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
if( GetScreen()->IsModify() )
{
unsigned ii;
wxMessageDialog dialog( this, _( "Board modified, Save before exit ?" ),
_( "Confirmation" ),
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );
ii = dialog.ShowModal();
wxString msg;
msg.Printf( _("Save the changes in\n<%s>\nbefore closing?"),
GetChars( GetScreen()->GetFileName() ) );
int ii = DisplayExitDialog( this, msg );
switch( ii )
{
case wxID_CANCEL:
......
......@@ -73,9 +73,6 @@ int g_MagneticTrackOption = capture_cursor_in_track_tool;
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
* usually located in share/modules/footprints_doc
* this is of the responsibility to users to create this file
......
......@@ -40,6 +40,14 @@
/* Flag to force the SKETCH mode to display items (.m_Flags member) */
#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 */
extern bool Drc_On;
extern bool g_AutoDeleteOldTrack;
......@@ -47,15 +55,9 @@ extern bool g_Drag_Pistes_On;
extern bool g_Show_Module_Ratsnest;
extern bool g_Show_Pads_Module_in_Move;
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_Alternate_Track_Posture;
extern bool Segments_45_Only;
extern wxString g_Shapes3DExtBuffer;
extern wxString g_DocModulesFileName;
/* Layer pair for auto routing and switch layers by hotkey */
extern int Route_Layer_TOP;
......
......@@ -16,6 +16,7 @@
#include <pcbnew.h>
#include <dialog_exchange_modules_base.h>
#include <ar_protos.h>
#include <wildcards_and_files_ext.h>
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 */
fn = m_Parent->GetScreen()->GetFileName();
fn.SetExt( NetCmpExtBuffer );
fn.SetExt( ComponentFileExtension );
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 */
fn = GetScreen()->GetFileName();
fn.SetExt( NetCmpExtBuffer );
wildcard = _( "Component files (." ) + NetCmpExtBuffer + wxT( ")|*." ) + NetCmpExtBuffer;
fn.SetExt( ComponentFileExtension );
wildcard = wxGetTranslation( ComponentFileWildcard );
wxFileDialog dlg( this, _( "Save Component Files" ), wxGetCwd(),
fn.GetFullName(), wildcard,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment