Pl_editor: add a small help about variable texts in text properties.

This commit is contained in:
jean-pierre charras 2021-09-12 11:02:17 +02:00
parent 83d7c731d3
commit 4be8ebafbc
5 changed files with 121 additions and 6 deletions

View File

@ -35,6 +35,9 @@
#include "pl_editor_frame.h"
#include "tools/pl_selection_tool.h"
#include <dialogs/html_messagebox.h>
PROPERTIES_FRAME::PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ) :
PANEL_PROPERTIES_BASE( aParent ),
m_scintillaTricks( nullptr ),
@ -299,6 +302,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
m_SizerItemProperties->Show( true );
m_SizerTextOptions->Show( aItem->GetType() == DS_DATA_ITEM::DS_TEXT );
m_buttonHelp->Show( aItem->GetType() == DS_DATA_ITEM::DS_TEXT );
m_sbSizerEndPosition->Show( aItem->GetType() == DS_DATA_ITEM::DS_SEGMENT
|| aItem->GetType() == DS_DATA_ITEM::DS_RECT );
@ -542,3 +546,33 @@ void PROPERTIES_FRAME::onScintillaCharAdded( wxStyledTextEvent &aEvent )
m_scintillaTricks->DoAutocomplete( partial, autocompleteTokens );
m_stcText->SetFocus();
}
void PROPERTIES_FRAME::onHelp( wxCommandEvent& aEvent )
{
// Show the system variables for worksheet text:
HTML_MESSAGE_BOX dlg( this, _( "Predefined Keywords" ) );
wxString message;
message << _( "Texts can include keywords." ) << "<br>";
message << _( "Keyword notation is ${keyword}" ) << "<br>";
message << _( "Keywords are replaced by they actual value in strings" ) << "<br><br>";
message << _( "These build-in keywords are always available:" ) << "<br><br>";
dlg.AddHTML_Text( message );
message = "KICAD_VERSION\n";
message << "# " << _( "(sheet number)" ) << "\n";
message << "## " << _( "(sheet count)" ) << "\n";
message << "COMMENT1 … COMMENT9\n";
message << "COMPANY\n";
message << "FILENAME\n";
message << "ISSUE_DATE\n";
message << "LAYER\n";
message << "PAPER " << _( "(paper size)" ) << "\n";
message << "REVISION\n";
message << "SHEETNAME\n";
message << "TITLE\n";
dlg.ListSet( message );
dlg.ShowModal();
}

View File

@ -83,6 +83,7 @@ public:
void OnAcceptPrms( wxCommandEvent& event ) override;
void OnSetDefaultValues( wxCommandEvent& event ) override;
void onScintillaCharAdded( wxStyledTextEvent &aEvent );
void onHelp( wxCommandEvent& aEvent ) override;
// Data transfer from general properties to widgets
void CopyPrmsFromGeneralToPanel();

View File

@ -28,6 +28,9 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
bSizerButt->Add( m_staticTextType, 1, wxALL|wxALIGN_CENTER_VERTICAL, 4 );
m_buttonHelp = new wxButton( m_swItemProperties, wxID_ANY, _("Help"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
bSizerButt->Add( m_buttonHelp, 0, wxALL, 5 );
wxString m_choicePageOptChoices[] = { _("Show on all pages"), _("First page only"), _("Subsequent pages only") };
int m_choicePageOptNChoices = sizeof( m_choicePageOptChoices ) / sizeof( wxString );
m_choicePageOpt = new wxChoice( m_swItemProperties, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choicePageOptNChoices, m_choicePageOptChoices, 0 );
@ -579,6 +582,7 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
// Connect Events
m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_PROPERTIES_BASE::OnPageChanged ), NULL, this );
m_buttonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::onHelp ), NULL, this );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this );
m_buttonDefault->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnSetDefaultValues ), NULL, this );
m_buttonGeneralOptsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this );
@ -588,6 +592,7 @@ PANEL_PROPERTIES_BASE::~PANEL_PROPERTIES_BASE()
{
// Disconnect Events
m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_PROPERTIES_BASE::OnPageChanged ), NULL, this );
m_buttonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::onHelp ), NULL, this );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this );
m_buttonDefault->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnSetDefaultValues ), NULL, this );
m_buttonGeneralOptsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this );

View File

@ -43,7 +43,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">309,888</property>
<property name="size">333,888</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
@ -244,6 +244,79 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</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="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="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></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="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Help</property>
<property name="margins"></property>
<property name="markup">0</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_buttonHelp</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="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxBU_EXACTFIT</property>
<property name="subclass">; ; forward_declare</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">onHelp</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">4</property>
<property name="flag">wxALL|wxEXPAND</property>

View File

@ -16,6 +16,10 @@
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/stc/stc.h>
@ -24,10 +28,6 @@
#include <wx/combobox.h>
#include <wx/statbox.h>
#include <wx/gbsizer.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/scrolwin.h>
#include <wx/notebook.h>
#include <wx/panel.h>
@ -46,6 +46,7 @@ class PANEL_PROPERTIES_BASE : public wxPanel
wxScrolledWindow* m_swItemProperties;
wxBoxSizer* m_SizerItemProperties;
wxStaticText* m_staticTextType;
wxButton* m_buttonHelp;
wxChoice* m_choicePageOpt;
wxBoxSizer* m_SizerTextOptions;
wxStyledTextCtrl* m_stcText;
@ -136,13 +137,14 @@ class PANEL_PROPERTIES_BASE : public wxPanel
// Virtual event handlers, overide them in your derived class
virtual void OnPageChanged( wxNotebookEvent& event ) { event.Skip(); }
virtual void onHelp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAcceptPrms( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetDefaultValues( wxCommandEvent& event ) { event.Skip(); }
public:
PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 309,888 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 333,888 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_PROPERTIES_BASE();
};