Commit 5e8c38d2 authored by jean-pierre charras's avatar jean-pierre charras

Kicad template selector dialog: add an info line showing the template path in...

Kicad template selector dialog: add an info line showing the template path in use. Fix very minor bug #1185462
parents 5560cb54 da6f4024
......@@ -28,10 +28,12 @@
#include <wx/settings.h>
TEMPLATE_SELECTION_PANEL::TEMPLATE_SELECTION_PANEL( wxWindow* aParent ) :
TEMPLATE_SELECTION_PANEL::TEMPLATE_SELECTION_PANEL( wxWindow* aParent,
const wxString& aPath ) :
TEMPLATE_SELECTION_PANEL_BASE( aParent )
{
parent = aParent;
m_templatesPath = aPath;
}
......@@ -127,6 +129,14 @@ void DIALOG_TEMPLATE_SELECTOR::onNotebookResize(wxSizeEvent& event)
event.Skip();
}
void DIALOG_TEMPLATE_SELECTOR::OnPageChange( wxNotebookEvent& event )
{
int page = m_notebook->GetSelection();
if( page != wxNOT_FOUND && (unsigned)page < m_panels.size() )
m_textCtrlTemplatePath->SetValue( m_panels[page]->GetPath() );
}
DIALOG_TEMPLATE_SELECTOR::DIALOG_TEMPLATE_SELECTOR( wxWindow* aParent ) :
DIALOG_TEMPLATE_SELECTOR_BASE( aParent )
......@@ -186,15 +196,19 @@ void DIALOG_TEMPLATE_SELECTOR::AddPage( const wxString& aTitle, wxFileName& aPat
wxNotebookPage* newPage = new wxNotebookPage( m_notebook, wxID_ANY );
m_notebook->AddPage( newPage, aTitle );
TEMPLATE_SELECTION_PANEL* p = new TEMPLATE_SELECTION_PANEL( newPage );
m_panels.push_back( p );
wxString path = aPath.GetFullPath(); // caller ensures this ends with file separator.
TEMPLATE_SELECTION_PANEL* tpanel = new TEMPLATE_SELECTION_PANEL( newPage, path );
m_panels.push_back( tpanel );
if( m_notebook->GetPageCount() == 1 )
m_textCtrlTemplatePath->SetValue( path );
// Get a list of files under the template path to include as choices...
wxArrayString files;
wxDir dir;
wxString path = aPath.GetFullPath(); // caller ensures this ends with file separator.
if( dir.Open( path ) )
{
wxDir sub_dir;
......
This diff is collapsed.
......@@ -60,13 +60,16 @@ class TEMPLATE_SELECTION_PANEL : public TEMPLATE_SELECTION_PANEL_BASE
{
protected:
wxWindow* parent;
wxString m_templatesPath;
public:
/**
* @param aParent The window creating the dialog
*/
TEMPLATE_SELECTION_PANEL( wxWindow* aParent );
TEMPLATE_SELECTION_PANEL( wxWindow* aParent, const wxString& aPath );
~TEMPLATE_SELECTION_PANEL();
const wxString& GetPath() { return m_templatesPath; }
};
class DIALOG_TEMPLATE_SELECTOR : public DIALOG_TEMPLATE_SELECTOR_BASE
......@@ -81,15 +84,15 @@ public:
~DIALOG_TEMPLATE_SELECTOR();
/**
* Add a new page with \a aTitle, populated with templates from \a aPath - All directories
* directories under the path are treated as templates
* Add a new page with \a aTitle, populated with templates from \a aPath
* - All directories under the path are treated as templates
*/
void AddPage( const wxString& aTitle, wxFileName& aPath );
void SetHtml( wxFileName aFilename );
TEMPLATE_WIDGET* GetWidget();
void SetWidget( TEMPLATE_WIDGET* aWidget );
void onNotebookResize(wxSizeEvent& event);
void onNotebookResize( wxSizeEvent& event );
void OnPageChange( wxNotebookEvent& event );
};
#endif
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -13,34 +13,47 @@ DIALOG_TEMPLATE_SELECTOR_BASE::DIALOG_TEMPLATE_SELECTOR_BASE( wxWindow* parent,
{
this->SetSizeHints( wxSize( 640,480 ), wxDefaultSize );
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bmainSizer;
bmainSizer = new wxBoxSizer( wxVERTICAL );
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer1->Add( m_notebook, 0, wxEXPAND | wxALL, 3 );
bmainSizer->Add( m_notebook, 0, wxEXPAND | wxALL, 3 );
m_htmlWin = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxHW_SCROLLBAR_AUTO );
bSizer1->Add( m_htmlWin, 1, wxALL|wxEXPAND, 3 );
bmainSizer->Add( m_htmlWin, 1, wxALL|wxEXPAND, 3 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_staticTextTpath = new wxStaticText( this, wxID_ANY, wxT("Templates path"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTpath->Wrap( -1 );
bmainSizer->Add( m_staticTextTpath, 0, wxRIGHT|wxLEFT, 5 );
bSizer1->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 3 );
m_textCtrlTemplatePath = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bmainSizer->Add( m_textCtrlTemplatePath, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
this->SetSizer( bSizer1 );
bmainSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 3 );
this->SetSizer( bmainSizer );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_TEMPLATE_SELECTOR_BASE::OnPageChange ), NULL, this );
}
DIALOG_TEMPLATE_SELECTOR_BASE::~DIALOG_TEMPLATE_SELECTOR_BASE()
{
// Disconnect Events
m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_TEMPLATE_SELECTOR_BASE::OnPageChange ), NULL, this );
}
TEMPLATE_SELECTION_PANEL_BASE::TEMPLATE_SELECTION_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -10,6 +10,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/gdicmn.h>
#include <wx/notebook.h>
......@@ -18,6 +20,8 @@
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/html/htmlwin.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
......@@ -27,7 +31,6 @@
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/stattext.h>
///////////////////////////////////////////////////////////////////////////
......@@ -42,9 +45,15 @@ class DIALOG_TEMPLATE_SELECTOR_BASE : public DIALOG_SHIM
protected:
wxNotebook* m_notebook;
wxHtmlWindow* m_htmlWin;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
wxStaticText* m_staticTextTpath;
wxTextCtrl* m_textCtrlTemplatePath;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnPageChange( wxNotebookEvent& event ) { event.Skip(); }
public:
......
......@@ -208,7 +208,7 @@ TEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText )
// Set the mirrored option for layers on the BACK side of the board
if( layer == LAYER_N_BACK || layer == SILKSCREEN_N_BACK ||
layer == SOLDERPASTE_N_BACK || layer == SOLDERMASK_N_FRONT ||
layer == SOLDERPASTE_N_BACK || layer == SOLDERMASK_N_BACK ||
layer == ADHESIVE_N_BACK
)
textePcb->SetMirrored( true );
......@@ -241,12 +241,12 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
if( TextePcb == NULL )
return;
/* Erase previous text. */
// Erase previous text:
TextePcb->Draw( m_canvas, DC, GR_XOR );
TextePcb->SetOrientation( TextePcb->GetOrientation() + angle );
/* Redraw text in new position. */
// Redraw text in new position:
TextePcb->Draw( m_canvas, DC, GR_XOR );
SetMsgPanel( TextePcb );
......@@ -276,7 +276,7 @@ void PCB_EDIT_FRAME::FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC )
if( aTextePcb->GetFlags() == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( aTextePcb, UR_FLIPPED, aTextePcb->GetTextPosition() );
else // set flag edit, to show it was a complex command
else // set edit flag, for the current command
aTextePcb->SetFlags( IN_EDIT );
OnModify();
......
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