Pl_Editor: add undo/redo commands.
This commit is contained in:
parent
1ef311cd01
commit
3b246ca483
|
@ -102,7 +102,7 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
|
|||
{
|
||||
case UR_UNSPECIFIED:
|
||||
if( show_error_message )
|
||||
wxMessageBox( wxT( "ClearUndoORRedoList() error: UR_UNSPECIFIED command type" ) );
|
||||
wxMessageBox( wxT( "ClearListAndDeleteItems() error: UR_UNSPECIFIED command type" ) );
|
||||
|
||||
show_error_message = false;
|
||||
break;
|
||||
|
|
|
@ -638,6 +638,28 @@ void WORKSHEET_LAYOUT::SetDefaultLayout()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the list from a S expr description stored in a string
|
||||
* @param aPageLayout = the S expr string
|
||||
*/
|
||||
void WORKSHEET_LAYOUT::SetPageLayout( const char* aPageLayout, bool Append )
|
||||
{
|
||||
if( ! Append )
|
||||
ClearList();
|
||||
|
||||
PAGE_LAYOUT_READER_PARSER lp_parser( aPageLayout, wxT( "Sexpr_string" ) );
|
||||
|
||||
try
|
||||
{
|
||||
lp_parser.Parse( this );
|
||||
SetDefaultDescrFlag( true );
|
||||
}
|
||||
catch( IO_ERROR ioe )
|
||||
{
|
||||
wxLogMessage( ioe.errorText );
|
||||
}
|
||||
}
|
||||
|
||||
#include <wx/file.h>
|
||||
|
||||
// SetLayout() try to load a custom layout file,
|
||||
|
|
|
@ -134,6 +134,11 @@ enum KICAD_T {
|
|||
*/
|
||||
TYPE_GERBER_DRAW_ITEM,
|
||||
|
||||
/*
|
||||
* for Pl_Editor, in undo/redo commands
|
||||
*/
|
||||
TYPE_PL_EDITOR_LAYOUT,
|
||||
|
||||
// End value
|
||||
MAX_STRUCT_TYPE_ID
|
||||
};
|
||||
|
|
|
@ -531,11 +531,17 @@ public:
|
|||
void ClearList();
|
||||
|
||||
/**
|
||||
* Function Save:
|
||||
* Save the description in a file
|
||||
* @param aFullFileName the filename of the file to created
|
||||
*/
|
||||
void Save( const wxString& aFullFileName );
|
||||
|
||||
/**
|
||||
* Save the description in a buffer
|
||||
* @param aOutputString = a wxString to store the S expr string
|
||||
*/
|
||||
void SaveInString( wxString& aOutputString );
|
||||
|
||||
/**
|
||||
* Add an item to the list of items
|
||||
*/
|
||||
|
@ -591,6 +597,12 @@ public:
|
|||
void SetPageLayout( const wxString& aFullFileName = wxEmptyString,
|
||||
bool Append = false );
|
||||
|
||||
/**
|
||||
* Populates the list from a S expr description stored in a string
|
||||
* @param aPageLayout = the S expr string
|
||||
*/
|
||||
void SetPageLayout( const char* aPageLayout, bool Append = false );
|
||||
|
||||
/**
|
||||
* @return a short filename from a full filename:
|
||||
* if the path is the current path, or if the path
|
||||
|
|
|
@ -33,6 +33,7 @@ set(PL_EDITOR_SRCS
|
|||
pl_editor.cpp
|
||||
pl_editor_config.cpp
|
||||
pl_editor_frame.cpp
|
||||
pl_editor_undo_redo.cpp
|
||||
properties_frame.cpp
|
||||
hotkeys.cpp
|
||||
menubar.cpp
|
||||
|
|
|
@ -86,9 +86,27 @@ int PL_EDITOR_SCREEN::MilsToIuScalar()
|
|||
|
||||
/* Virtual function needed by classes derived from BASE_SCREEN
|
||||
* this is a virtual pure function in BASE_SCREEN
|
||||
* do nothing in GerbView
|
||||
* could be removed later
|
||||
*/
|
||||
void PL_EDITOR_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int )
|
||||
void PL_EDITOR_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList,
|
||||
int aItemCount )
|
||||
{
|
||||
if( aItemCount == 0 )
|
||||
return;
|
||||
|
||||
unsigned icnt = aList.m_CommandsList.size();
|
||||
|
||||
if( aItemCount > 0 )
|
||||
icnt = aItemCount;
|
||||
|
||||
for( unsigned ii = 0; ii < icnt; ii++ )
|
||||
{
|
||||
if( aList.m_CommandsList.size() == 0 )
|
||||
break;
|
||||
|
||||
PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
|
||||
aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
|
||||
|
||||
curr_cmd->ClearListAndDeleteItems();
|
||||
delete curr_cmd; // Delete command
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <wx/imaglist.h>
|
||||
#include <wx/wupdlock.h>
|
||||
#include <fctsys.h>
|
||||
#include <worksheet_shape_builder.h>
|
||||
#include <class_worksheet_dataitem.h>
|
||||
|
@ -172,6 +173,8 @@ wxSize DESIGN_TREE_FRAME::GetMinSize() const
|
|||
|
||||
void DESIGN_TREE_FRAME::ReCreateDesignTree()
|
||||
{
|
||||
wxWindowUpdateLocker dummy(this); // Avoid flicker when rebuilding the tree
|
||||
|
||||
DeleteAllItems();
|
||||
|
||||
const WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
||||
|
|
|
@ -68,8 +68,8 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
|
|||
m_staticTextText->Wrap( -1 );
|
||||
m_SizerTextOptions->Add( m_staticTextText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_textCtrlText = new wxTextCtrl( m_swItemProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizerTextOptions->Add( m_textCtrlText, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
m_textCtrlText = new wxTextCtrl( m_swItemProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
m_SizerTextOptions->Add( m_textCtrlText, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerFontOpt;
|
||||
bSizerFontOpt = new wxBoxSizer( wxVERTICAL );
|
||||
|
@ -515,6 +515,9 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
|
|||
|
||||
bSizerGeneralOpts->Add( bSizerGeneralOpts1, 0, 0, 5 );
|
||||
|
||||
m_buttonDefault = new wxButton( m_swGeneralOpts, wxID_ANY, _("Set to Default"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerGeneralOpts->Add( m_buttonDefault, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticline9 = new wxStaticLine( m_swGeneralOpts, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerGeneralOpts->Add( m_staticline9, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
@ -592,16 +595,10 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
|
|||
|
||||
bSizerGeneralOpts->Add( bSizerGeneraMargins, 0, 0, 5 );
|
||||
|
||||
m_staticline10 = new wxStaticLine( m_swGeneralOpts, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerGeneralOpts->Add( m_staticline10, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_buttonGeneralOptsOK = new wxButton( m_swGeneralOpts, wxID_ANY, _("Accept"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonGeneralOptsOK->SetDefault();
|
||||
bSizerGeneralOpts->Add( m_buttonGeneralOptsOK, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_buttonDefault = new wxButton( m_swGeneralOpts, wxID_ANY, _("Set to Default"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerGeneralOpts->Add( m_buttonDefault, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_swGeneralOpts->SetSizer( bSizerGeneralOpts );
|
||||
m_swGeneralOpts->Layout();
|
||||
|
@ -616,15 +613,15 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
|
|||
|
||||
// Connect Events
|
||||
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this );
|
||||
m_buttonGeneralOptsOK->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 );
|
||||
}
|
||||
|
||||
PANEL_PROPERTIES_BASE::~PANEL_PROPERTIES_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PROPERTIES_BASE::OnAcceptPrms ), NULL, this );
|
||||
m_buttonGeneralOptsOK->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 );
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<property name="minimum_size"></property>
|
||||
<property name="name">PANEL_PROPERTIES_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">315,739</property>
|
||||
<property name="size">315,782</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
|
@ -802,7 +802,7 @@
|
|||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
|
@ -849,7 +849,7 @@
|
|||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="style">wxTE_MULTILINE</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
|
@ -6373,6 +6373,94 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</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">Set to Default</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_buttonDefault</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">OnSetDefaultValues</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">wxEXPAND | wxALL</property>
|
||||
|
@ -7310,87 +7398,6 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</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_staticline10</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="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">wxALL|wxEXPAND</property>
|
||||
|
@ -7479,94 +7486,6 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</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">Set to Default</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_buttonDefault</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">OnSetDefaultValues</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>
|
||||
|
|
|
@ -113,6 +113,7 @@ class PANEL_PROPERTIES_BASE : public wxPanel
|
|||
wxTextCtrl* m_textCtrlDefaultLineWidth;
|
||||
wxStaticText* m_staticText22;
|
||||
wxTextCtrl* m_textCtrlDefaultTextThickness;
|
||||
wxButton* m_buttonDefault;
|
||||
wxStaticLine* m_staticline9;
|
||||
wxStaticText* m_staticTextMargins;
|
||||
wxStaticText* m_staticTextLeftMargin;
|
||||
|
@ -123,9 +124,7 @@ class PANEL_PROPERTIES_BASE : public wxPanel
|
|||
wxTextCtrl* m_textCtrlTopMargin;
|
||||
wxStaticText* m_staticTextBottomMargin;
|
||||
wxTextCtrl* m_textCtrlDefaultBottomMargin;
|
||||
wxStaticLine* m_staticline10;
|
||||
wxButton* m_buttonGeneralOptsOK;
|
||||
wxButton* m_buttonDefault;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnAcceptPrms( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
@ -134,7 +133,7 @@ class PANEL_PROPERTIES_BASE : public wxPanel
|
|||
|
||||
public:
|
||||
|
||||
PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 315,739 ), long style = wxTAB_TRAVERSAL );
|
||||
PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 315,782 ), long style = wxTAB_TRAVERSAL );
|
||||
~PANEL_PROPERTIES_BASE();
|
||||
|
||||
};
|
||||
|
|
|
@ -61,8 +61,8 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU( wxID_ABOUT, EDA_DRAW_FRAME::GetKicadAbout )
|
||||
|
||||
EVT_TOOL( wxID_CUT, PL_EDITOR_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( wxID_UNDO, PL_EDITOR_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( wxID_REDO, PL_EDITOR_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( wxID_UNDO, PL_EDITOR_FRAME::GetLayoutFromUndoList )
|
||||
EVT_TOOL( wxID_REDO, PL_EDITOR_FRAME::GetLayoutFromRedoList )
|
||||
EVT_TOOL( wxID_PRINT, PL_EDITOR_FRAME::ToPrinter )
|
||||
EVT_TOOL( wxID_PREVIEW, PL_EDITOR_FRAME::ToPrinter )
|
||||
EVT_TOOL( ID_SHEET_SET, PL_EDITOR_FRAME::Process_Special_Functions )
|
||||
|
@ -99,7 +99,6 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
{
|
||||
case ID_NO_TOOL_SELECTED:
|
||||
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_SELECT_PAGE_NUMBER:
|
||||
m_canvas->Refresh();
|
||||
|
@ -129,6 +128,7 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
if( item == NULL )
|
||||
break;
|
||||
|
||||
SaveCopyInUndoList();
|
||||
idx = pglayout.GetItemIndex( item );
|
||||
pglayout.Remove( item );
|
||||
RebuildDesignTree();
|
||||
|
@ -147,10 +147,12 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_ITEM_ADD_LINE:
|
||||
SaveCopyInUndoList();
|
||||
idx = m_treePagelayout->GetSelectedItemIndex();
|
||||
item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_SEGMENT, idx );
|
||||
if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
|
||||
{
|
||||
RemoveLastCommandInUndoList();
|
||||
pglayout.Remove( item );
|
||||
RebuildDesignTree();
|
||||
item = NULL;
|
||||
|
@ -159,10 +161,12 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_ITEM_ADD_RECT:
|
||||
SaveCopyInUndoList();
|
||||
idx = m_treePagelayout->GetSelectedItemIndex();
|
||||
item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_RECT, idx );
|
||||
if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
|
||||
{
|
||||
RemoveLastCommandInUndoList();
|
||||
pglayout.Remove( item );
|
||||
RebuildDesignTree();
|
||||
item = NULL;
|
||||
|
@ -171,10 +175,12 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_ITEM_ADD_TEXT:
|
||||
SaveCopyInUndoList();
|
||||
idx = m_treePagelayout->GetSelectedItemIndex();
|
||||
item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_TEXT, idx );
|
||||
if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
|
||||
{
|
||||
RemoveLastCommandInUndoList();
|
||||
pglayout.Remove( item );
|
||||
RebuildDesignTree();
|
||||
item = NULL;
|
||||
|
@ -189,8 +195,7 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_ITEM_PLACE:
|
||||
item = GetScreen()->GetCurItem();
|
||||
m_canvas->SetMouseCapture( NULL, NULL );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
PlaceItem( item );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ITEM_PLACE_CANCEL:
|
||||
|
@ -245,19 +250,19 @@ static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositio
|
|||
WORKSHEET_DATAITEM *item = screen->GetCurItem();
|
||||
|
||||
wxCHECK_RET( (item != NULL), wxT( "Cannot move NULL item." ) );
|
||||
|
||||
wxPoint newpos = screen->GetCrossHairPosition()
|
||||
wxPoint position = screen->GetCrossHairPosition()
|
||||
- ( initialCursorPosition - initialPositionUi );
|
||||
|
||||
if( (item->GetFlags() & LOCATE_STARTPOINT) )
|
||||
item->MoveStartPointToUi( newpos );
|
||||
item->MoveStartPointToUi( position );
|
||||
else if( (item->GetFlags() & LOCATE_ENDPOINT) )
|
||||
item->MoveEndPointToUi( newpos );
|
||||
item->MoveEndPointToUi( position );
|
||||
else
|
||||
item->MoveToUi( newpos );
|
||||
item->MoveToUi( position );
|
||||
|
||||
// Draw the item item at it's new position.
|
||||
aPanel->Refresh();
|
||||
if( aPanel )
|
||||
aPanel->Refresh();
|
||||
}
|
||||
|
||||
static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||
|
@ -312,6 +317,38 @@ void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
|
|||
GetScreen()->SetCurItem( aItem );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save in Undo list the layout, and place an item being moved.
|
||||
* @param aItem is the item moved
|
||||
*/
|
||||
void PL_EDITOR_FRAME::PlaceItem( WORKSHEET_DATAITEM* aItem )
|
||||
{
|
||||
DPOINT currStartPos = aItem->GetStartPos();
|
||||
DPOINT currEndPos = aItem->GetEndPos();
|
||||
|
||||
// Save the curren layout before changes
|
||||
if( (aItem->GetFlags() & LOCATE_STARTPOINT) )
|
||||
{
|
||||
aItem->MoveStartPointTo( initialPosition );
|
||||
}
|
||||
else if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
|
||||
{
|
||||
aItem->MoveEndPointTo( initialPosition );
|
||||
}
|
||||
else
|
||||
aItem->MoveTo( initialPosition );
|
||||
|
||||
SaveCopyInUndoList();
|
||||
|
||||
// Re-place the item
|
||||
aItem->MoveStartPointTo( currStartPos );
|
||||
aItem->MoveEndPointTo( currEndPos );
|
||||
|
||||
m_canvas->SetMouseCapture( NULL, NULL );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
}
|
||||
|
||||
|
||||
/* called when the user select one of the 4 page corner as corner
|
||||
* reference (or the left top paper corner)
|
||||
*/
|
||||
|
|
|
@ -233,6 +233,7 @@ bool PL_EDITOR_FRAME::InsertPageLayoutDescrFile( const wxString& aFullFileName )
|
|||
if( wxFileExists( aFullFileName ) )
|
||||
{
|
||||
const bool append = true;
|
||||
SaveCopyInUndoList();
|
||||
WORKSHEET_LAYOUT::GetTheInstance().SetPageLayout( aFullFileName, append );
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -75,8 +75,8 @@ static EDA_HOTKEY HkDeleteItem( wxT( "Move Item" ), HK_DELETE_ITEM, WXK_DELET
|
|||
ID_POPUP_ITEM_DELETE );
|
||||
|
||||
// Undo Redo
|
||||
//static EDA_HOTKEY HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
|
||||
//static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
|
||||
static EDA_HOTKEY HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
|
||||
static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
|
||||
|
||||
// List of common hotkey descriptors
|
||||
EDA_HOTKEY* s_Common_Hotkey_List[] =
|
||||
|
@ -84,13 +84,15 @@ EDA_HOTKEY* s_Common_Hotkey_List[] =
|
|||
&HkHelp,
|
||||
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
|
||||
&HkZoomAuto, &HkResetLocalCoord,
|
||||
&HkUndo, &HkRedo,
|
||||
NULL
|
||||
};
|
||||
|
||||
EDA_HOTKEY* s_PlEditor_Hotkey_List[] =
|
||||
{
|
||||
&HkMoveItem, &HkMoveStartPoint,
|
||||
&HkMoveEndPoint, &HkDeleteItem
|
||||
&HkMoveEndPoint, &HkDeleteItem,
|
||||
NULL
|
||||
};
|
||||
|
||||
// list of sections and corresponding hotkey list for Pl_Editor
|
||||
|
@ -144,6 +146,14 @@ void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
|
|||
DisplayHotkeyList( this, s_PlEditor_Hokeys_Descr );
|
||||
break;
|
||||
|
||||
case HK_UNDO:
|
||||
case HK_REDO:
|
||||
if( busy )
|
||||
break;
|
||||
cmd.SetId( HK_Descr->m_IdMenuEvent );
|
||||
GetEventHandler()->ProcessEvent( cmd );
|
||||
break;
|
||||
|
||||
case HK_ZOOM_IN:
|
||||
cmd.SetId( ID_POPUP_ZOOM_IN );
|
||||
GetEventHandler()->ProcessEvent( cmd );
|
||||
|
|
|
@ -49,9 +49,8 @@ void PL_EDITOR_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
|
||||
if( item ) // An item is currently in edit: place it
|
||||
{
|
||||
PlaceItem( item );
|
||||
m_propertiesPagelayout->CopyPrmsFromItemToPanel( item );
|
||||
m_canvas->SetMouseCapture( NULL, NULL );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
m_canvas->Refresh();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -137,8 +137,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Function Save: aFullFileName = the filename of the file to created
|
||||
/*
|
||||
* Save the description in a file
|
||||
*/
|
||||
void WORKSHEET_LAYOUT::Save( const wxString& aFullFileName )
|
||||
{
|
||||
|
@ -146,6 +146,14 @@ void WORKSHEET_LAYOUT::Save( const wxString& aFullFileName )
|
|||
writer.Format( this );
|
||||
}
|
||||
|
||||
/* Save the description in a buffer
|
||||
*/
|
||||
void WORKSHEET_LAYOUT::SaveInString( wxString& aOutputString )
|
||||
{
|
||||
WORKSHEET_LAYOUT_STRINGIO writer( aOutputString );
|
||||
writer.Format( this );
|
||||
}
|
||||
|
||||
|
||||
void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_DATAITEM* aItem, int aNestLevel ) const
|
||||
throw( IO_ERROR )
|
||||
|
|
|
@ -408,31 +408,22 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
|
|||
double dXpos = To_User_Unit( g_UserUnit, coord.x*Xsign );
|
||||
double dYpos = To_User_Unit( g_UserUnit, coord.y*Ysign );
|
||||
|
||||
wxString pagesizeformatter;
|
||||
wxString absformatter;
|
||||
wxString locformatter;
|
||||
wxString pagesizeformatter = wxT( "Page size: width %.4g height %.4g" );
|
||||
wxString absformatter = wxT( "X %.4g Y %.4g" );
|
||||
wxString locformatter = wxT( "dx %.4g dy %.4g" );
|
||||
|
||||
switch( g_UserUnit )
|
||||
{
|
||||
case INCHES: // Should not be used in page layout editor
|
||||
SetStatusText( _("inches"), 5 );
|
||||
pagesizeformatter = wxT( "Page size: width %4g height %4g" );
|
||||
absformatter = wxT( "X %.4g Y %.4g" );
|
||||
locformatter = wxT( "dx %.4g dy %.4g" );
|
||||
break;
|
||||
|
||||
case MILLIMETRES:
|
||||
SetStatusText( _("mm"), 5 );
|
||||
pagesizeformatter = wxT( "Page size: width %3g height %3g" );
|
||||
absformatter = wxT( "X %.3g Y %.3g" );
|
||||
locformatter = wxT( "dx %.3g dy %.3g" );
|
||||
break;
|
||||
|
||||
case UNSCALED_UNITS:
|
||||
SetStatusText( wxEmptyString, 5 );
|
||||
pagesizeformatter = wxT( "Page size: width %g height %g" );
|
||||
absformatter = wxT( "X %g Y %g" );
|
||||
locformatter = wxT( "dx %g dy %g" );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -687,6 +678,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
|
|||
*/
|
||||
void PL_EDITOR_FRAME::OnNewPageLayout()
|
||||
{
|
||||
GetScreen()->ClearUndoRedoList();
|
||||
GetScreen()->ClrModify();
|
||||
m_propertiesPagelayout->CopyPrmsFromGeneralToPanel();
|
||||
RebuildDesignTree();
|
||||
|
|
|
@ -326,6 +326,12 @@ public:
|
|||
*/
|
||||
void MoveItem( WORKSHEET_DATAITEM* aItem );
|
||||
|
||||
/**
|
||||
* Save in Undo list the layout, and place an item being moved.
|
||||
* @param aItem is the item moved
|
||||
*/
|
||||
void PlaceItem( WORKSHEET_DATAITEM* aItem );
|
||||
|
||||
/**
|
||||
* Must be called after a change
|
||||
* in order to set the "modify" flag of the current screen
|
||||
|
@ -335,6 +341,29 @@ public:
|
|||
GetScreen()->SetModify();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a copy of the description (in a S expr string)
|
||||
* for Undo/redo commands
|
||||
*/
|
||||
void SaveCopyInUndoList();
|
||||
|
||||
/** Redo the last edition:
|
||||
* - Place the current edited layout in undo list
|
||||
* - Get the previous version of the current edited layput
|
||||
*/
|
||||
void GetLayoutFromRedoList( wxCommandEvent& event );
|
||||
|
||||
/** Undo the last edition:
|
||||
* - Place the current layout in Redo list
|
||||
* - Get the previous version of the current edited layout
|
||||
*/
|
||||
void GetLayoutFromUndoList( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Remove the last command in Undo List.
|
||||
* Used to clean the Undo stack after a cancel command
|
||||
*/
|
||||
void RemoveLastCommandInUndoList();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
|
|
@ -194,7 +194,9 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
|
|||
m_SizerTextIncrementLabel->Show( true );
|
||||
|
||||
WORKSHEET_DATAITEM_TEXT* item = (WORKSHEET_DATAITEM_TEXT*) aItem;
|
||||
m_textCtrlText->SetValue( item->m_TextBase );
|
||||
wxString text = item->m_TextBase;
|
||||
text.Replace(wxT("\\n"), wxT("\n") );
|
||||
m_textCtrlText->SetValue( text );
|
||||
|
||||
msg.Printf( wxT("%d"), item->m_IncrementLabel );
|
||||
m_textCtrlTextIncrement->SetValue( msg );
|
||||
|
@ -279,6 +281,8 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
|
|||
// Event function called by clicking on the OK button
|
||||
void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
|
||||
{
|
||||
m_parent->SaveCopyInUndoList();
|
||||
|
||||
WORKSHEET_DATAITEM* item = m_parent->GetSelectedItem();
|
||||
if( item )
|
||||
CopyPrmsFromPanelToItem( item );
|
||||
|
@ -388,6 +392,7 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
|
|||
WORKSHEET_DATAITEM_TEXT* item = (WORKSHEET_DATAITEM_TEXT*) aItem;
|
||||
|
||||
item->m_TextBase = m_textCtrlText->GetValue();
|
||||
item->m_TextBase.Replace( wxT("\n"), wxT("\\n") );
|
||||
|
||||
msg = m_textCtrlTextIncrement->GetValue();
|
||||
msg.ToLong( &itmp );
|
||||
|
|
Loading…
Reference in New Issue