Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
3b246ca4
Commit
3b246ca4
authored
Jul 26, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pl_Editor: add undo/redo commands.
parent
1ef311cd
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
278 additions
and
221 deletions
+278
-221
class_undoredo_container.cpp
common/class_undoredo_container.cpp
+1
-1
page_layout_reader.cpp
common/page_layout/page_layout_reader.cpp
+22
-0
base_struct.h
include/base_struct.h
+5
-0
worksheet_shape_builder.h
include/worksheet_shape_builder.h
+13
-1
CMakeLists.txt
pagelayout_editor/CMakeLists.txt
+1
-0
class_pl_editor_screen.cpp
pagelayout_editor/class_pl_editor_screen.cpp
+21
-3
design_tree_frame.cpp
pagelayout_editor/design_tree_frame.cpp
+3
-0
properties_frame_base.cpp
pagelayout_editor/dialogs/properties_frame_base.cpp
+7
-10
properties_frame_base.fbp
pagelayout_editor/dialogs/properties_frame_base.fbp
+91
-172
properties_frame_base.h
pagelayout_editor/dialogs/properties_frame_base.h
+2
-3
events_functions.cpp
pagelayout_editor/events_functions.cpp
+48
-11
files.cpp
pagelayout_editor/files.cpp
+1
-0
hotkeys.cpp
pagelayout_editor/hotkeys.cpp
+13
-3
onleftclick.cpp
pagelayout_editor/onleftclick.cpp
+1
-2
page_layout_writer.cpp
pagelayout_editor/page_layout_writer.cpp
+10
-2
pl_editor_frame.cpp
pagelayout_editor/pl_editor_frame.cpp
+4
-12
pl_editor_frame.h
pagelayout_editor/pl_editor_frame.h
+29
-0
properties_frame.cpp
pagelayout_editor/properties_frame.cpp
+6
-1
No files found.
common/class_undoredo_container.cpp
View file @
3b246ca4
...
...
@@ -102,7 +102,7 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
{
case
UR_UNSPECIFIED
:
if
(
show_error_message
)
wxMessageBox
(
wxT
(
"Clear
UndoORRedoList
() error: UR_UNSPECIFIED command type"
)
);
wxMessageBox
(
wxT
(
"Clear
ListAndDeleteItems
() error: UR_UNSPECIFIED command type"
)
);
show_error_message
=
false
;
break
;
...
...
common/page_layout/page_layout_reader.cpp
View file @
3b246ca4
...
...
@@ -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,
...
...
include/base_struct.h
View file @
3b246ca4
...
...
@@ -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
};
...
...
include/worksheet_shape_builder.h
View file @
3b246ca4
...
...
@@ -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
...
...
pagelayout_editor/CMakeLists.txt
View file @
3b246ca4
...
...
@@ -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
...
...
pagelayout_editor/class_pl_editor_screen.cpp
View file @
3b246ca4
...
...
@@ -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
}
}
pagelayout_editor/design_tree_frame.cpp
View file @
3b246ca4
...
...
@@ -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
();
...
...
pagelayout_editor/dialogs/properties_frame_base.cpp
View file @
3b246ca4
...
...
@@ -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
);
}
pagelayout_editor/dialogs/properties_frame_base.fbp
View file @
3b246ca4
This diff is collapsed.
Click to expand it.
pagelayout_editor/dialogs/properties_frame_base.h
View file @
3b246ca4
...
...
@@ -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
,
7
39
),
long
style
=
wxTAB_TRAVERSAL
);
PANEL_PROPERTIES_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
315
,
7
82
),
long
style
=
wxTAB_TRAVERSAL
);
~
PANEL_PROPERTIES_BASE
();
};
...
...
pagelayout_editor/events_functions.cpp
View file @
3b246ca4
...
...
@@ -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)
*/
...
...
pagelayout_editor/files.cpp
View file @
3b246ca4
...
...
@@ -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
;
}
...
...
pagelayout_editor/hotkeys.cpp
View file @
3b246ca4
...
...
@@ -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
);
...
...
pagelayout_editor/onleftclick.cpp
View file @
3b246ca4
...
...
@@ -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
;
}
...
...
pagelayout_editor/page_layout_writer.cpp
View file @
3b246ca4
...
...
@@ -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
)
...
...
pagelayout_editor/pl_editor_frame.cpp
View file @
3b246ca4
...
...
@@ -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
();
...
...
pagelayout_editor/pl_editor_frame.h
View file @
3b246ca4
...
...
@@ -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
()
};
...
...
pagelayout_editor/properties_frame.cpp
View file @
3b246ca4
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment