diff --git a/common/page_layout/class_worksheet_dataitem.cpp b/common/page_layout/class_worksheet_dataitem.cpp index bf013e54a5..b372f43d69 100644 --- a/common/page_layout/class_worksheet_dataitem.cpp +++ b/common/page_layout/class_worksheet_dataitem.cpp @@ -293,19 +293,16 @@ bool WORKSHEET_DATAITEM::IsInsidePage( int ii ) const { DPOINT pos = GetStartPos( ii ); - if( m_RB_Corner.x < pos.x || m_LT_Corner.x > pos.x ) - return false; + for( int kk = 0; kk < 1; kk++ ) + { + if( m_RB_Corner.x < pos.x || m_LT_Corner.x > pos.x ) + return false; - if( m_RB_Corner.y < pos.y || m_LT_Corner.y > pos.y ) - return false; + if( m_RB_Corner.y < pos.y || m_LT_Corner.y > pos.y ) + return false; - pos = GetEndPos( ii ); - - if( m_RB_Corner.x < pos.x || m_LT_Corner.x > pos.x ) - return false; - - if( m_RB_Corner.y < pos.y || m_LT_Corner.y > pos.y ) - return false; + pos = GetEndPos( ii ); + } return true; } diff --git a/common/page_layout/page_layout_default_description.cpp b/common/page_layout/page_layout_default_description.cpp index 18b6c8202d..8e5d2ae283 100644 --- a/common/page_layout/page_layout_default_description.cpp +++ b/common/page_layout/page_layout_default_description.cpp @@ -27,48 +27,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/* keyword used in page layout description are (see page_layout_reader.keywords) - * page_layout - * setup - * linewidth - * textlinewidth - * textsize - * comment - * option - * page1only - * notonpage1 - * line - * rect - * polygon - * tbtext - * ltcorner - * lbcorner - * rbcorner - * rtcorner - * name - * pos - * start - * end - * pts - * xy - * maxlen - * maxheight - * font - * bold - * italic - * size - * justify - * left - * center - * right - * top - * bottom - * rotate - * repeat - * incrx - * incry - * incrlabel +/* keyword used in page layout description are listed + * in page_layout_reader.keywords file */ + /* * Items use coordinates. * A coordinate is defined relative to a page corner diff --git a/common/page_layout/title_block_shapes.cpp b/common/page_layout/title_block_shapes.cpp index 0dd6a3ef35..d5d14411d2 100644 --- a/common/page_layout/title_block_shapes.cpp +++ b/common/page_layout/title_block_shapes.cpp @@ -108,15 +108,15 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( // Left top corner position DPOINT lt_corner; - lt_corner.x = m_LTmargin.x; - lt_corner.y = m_LTmargin.y; - WORKSHEET_DATAITEM::m_LT_Corner = lt_corner * milsTomm; + lt_corner.x = pglayout.GetLeftMargin(); + lt_corner.y = pglayout.GetTopMargin(); + WORKSHEET_DATAITEM::m_LT_Corner = lt_corner; // Right bottom corner position DPOINT rb_corner; - rb_corner.x = m_pageSize.x - m_RBmargin.x; - rb_corner.y = m_pageSize.y - m_RBmargin.y; - WORKSHEET_DATAITEM::m_RB_Corner = rb_corner * milsTomm; + rb_corner.x = (m_pageSize.x*milsTomm) - pglayout.GetRightMargin(); + rb_corner.y = (m_pageSize.y*milsTomm) - pglayout.GetBottomMargin(); + WORKSHEET_DATAITEM::m_RB_Corner = rb_corner; WS_DRAW_ITEM_TEXT* gtext; int pensize; diff --git a/include/class_worksheet_dataitem.h b/include/class_worksheet_dataitem.h index 1ecc0ecd7a..6a7d399407 100644 --- a/include/class_worksheet_dataitem.h +++ b/include/class_worksheet_dataitem.h @@ -1,5 +1,5 @@ /** - * @file class_worksheet_data_item.h + * @file class_worksheet_dataitem.h * @brief description of graphic items and texts to build a title block */ @@ -9,14 +9,14 @@ #include #include -class WS_DRAW_ITEM_TEXT; // Forward declaration +class WS_DRAW_ITEM_TEXT; // Forward declaration -#define TB_DEFAULT_TEXTSIZE 1.5 // default worksheet text size in mm +#define TB_DEFAULT_TEXTSIZE 1.5 // default worksheet text size in mm // Text attributes set in m_flags (ORed bits) -#define USE_BOLD 1 // has meaning for texts -#define USE_THICK_LINE 1 // equivalent to bold for lines -#define USE_ITALIC (1<<1) // has meaning for texts +#define USE_BOLD 1 // has meaning for texts +#define USE_THICK_LINE 1 // equivalent to bold for lines +#define USE_ITALIC (1<<1) // has meaning for texts #define USE_ALT_COLOR (1<<2) #define SELECTED_STATE (1<<3) // When set, use the hight light color to draw item #define LOCATE_STARTPOINT (1<<4) // Used in locate function:set by locate function @@ -143,6 +143,12 @@ public: void SetFlags( int aMask ) { m_flags |= aMask; } void ClearFlags( int aMask ) { m_flags &= ~aMask; } + /** + * @return true if the item has a end point (segment; rect) + * of false (text, polugon) + */ + virtual bool HasEndPoint() { return true; } + /** * @return 0 if the item has no specific option for page 1 * 1 if the item is only on page 1 @@ -276,6 +282,11 @@ public: return KiROUND( m_LineWidth * m_WSunits2Iu ); } + /** + * @return false (no end point) + */ + virtual bool HasEndPoint() { return false; }; + /** * add a corner in corner list * @param aCorner: the item to append @@ -360,6 +371,11 @@ public: public: WORKSHEET_DATAITEM_TEXT( const wxChar* aTextBase ); + /** + * @return false (no end point) + */ + virtual bool HasEndPoint() { return false; }; + virtual int GetPenSizeUi() { if( m_LineWidth ) diff --git a/pagelayout_editor/dialogs/properties_frame_base.cpp b/pagelayout_editor/dialogs/properties_frame_base.cpp index ff81de7ce5..ccf1dab360 100644 --- a/pagelayout_editor/dialogs/properties_frame_base.cpp +++ b/pagelayout_editor/dialogs/properties_frame_base.cpp @@ -599,6 +599,9 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c 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(); @@ -614,6 +617,7 @@ 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 ); } PANEL_PROPERTIES_BASE::~PANEL_PROPERTIES_BASE() @@ -621,5 +625,6 @@ 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 ); } diff --git a/pagelayout_editor/dialogs/properties_frame_base.fbp b/pagelayout_editor/dialogs/properties_frame_base.fbp index f847f4c6f4..8247da5d23 100644 --- a/pagelayout_editor/dialogs/properties_frame_base.fbp +++ b/pagelayout_editor/dialogs/properties_frame_base.fbp @@ -7479,6 +7479,94 @@ + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Set to Default + + 0 + + + 0 + + 1 + m_buttonDefault + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnSetDefaultValues + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pagelayout_editor/dialogs/properties_frame_base.h b/pagelayout_editor/dialogs/properties_frame_base.h index ce30d14e4f..6615712902 100644 --- a/pagelayout_editor/dialogs/properties_frame_base.h +++ b/pagelayout_editor/dialogs/properties_frame_base.h @@ -125,9 +125,11 @@ class PANEL_PROPERTIES_BASE : public wxPanel 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(); } + virtual void OnSetDefaultValues( wxCommandEvent& event ) { event.Skip(); } public: diff --git a/pagelayout_editor/events_functions.cpp b/pagelayout_editor/events_functions.cpp index 793ea3aa7a..d76f73edfe 100644 --- a/pagelayout_editor/events_functions.cpp +++ b/pagelayout_editor/events_functions.cpp @@ -200,13 +200,17 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_ITEM_MOVE_START_POINT: item = m_treePagelayout->GetPageLayoutSelectedItem(); + // Ensure flags are properly set item->ClearFlags( LOCATE_ENDPOINT ); + item->SetFlags( LOCATE_STARTPOINT ); MoveItem( item ); break; case ID_POPUP_ITEM_MOVE_END_POINT: item = m_treePagelayout->GetPageLayoutSelectedItem(); + // Ensure flags are properly set item->ClearFlags( LOCATE_STARTPOINT ); + item->SetFlags( LOCATE_ENDPOINT ); MoveItem( item ); break; @@ -292,9 +296,16 @@ void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem ) if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) ) { GetScreen()->SetCrossHairPosition( initialPositionUi, false ); - m_canvas->MoveCursorToCrossHair(); initialCursorPosition = GetScreen()->GetCrossHairPosition(); - m_canvas->Refresh(); + if( m_canvas->IsPointOnDisplay( initialCursorPosition ) ) + { + m_canvas->MoveCursorToCrossHair(); + m_canvas->Refresh(); + } + else + { + RedrawScreen( initialCursorPosition, true ); + } } m_canvas->SetMouseCapture( moveItem, abortMoveItem ); diff --git a/pagelayout_editor/hotkeys.cpp b/pagelayout_editor/hotkeys.cpp index 84e4acd8a8..6bc2aa4cc9 100644 --- a/pagelayout_editor/hotkeys.cpp +++ b/pagelayout_editor/hotkeys.cpp @@ -32,7 +32,10 @@ #include #include +#include +#include #include +#include /* How to add a new hotkey: @@ -56,28 +59,49 @@ /* Hotkey list: */ static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' ); -static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME ); -static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); -static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); -static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); -static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); +static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE ); +static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4, + ID_POPUP_ZOOM_CENTER ); +static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW ); +static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_POPUP_ZOOM_OUT ); +static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_POPUP_ZOOM_IN ); static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); +static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M', ID_POPUP_ITEM_MOVE ); +static EDA_HOTKEY HkMoveStartPoint( wxT( "Move Start Point" ), HK_MOVE_START_POINT, 'S', + ID_POPUP_ITEM_MOVE_START_POINT ); +static EDA_HOTKEY HkMoveEndPoint( wxT( "Move End Point" ), HK_MOVE_END_POINT, 'E', + ID_POPUP_ITEM_MOVE_END_POINT ); +static EDA_HOTKEY HkDeleteItem( wxT( "Move Item" ), HK_DELETE_ITEM, WXK_DELETE, + 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 ); // List of common hotkey descriptors -EDA_HOTKEY* s_PlEditor_Hotkey_List[] = { +EDA_HOTKEY* s_Common_Hotkey_List[] = +{ &HkHelp, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &HkResetLocalCoord, NULL }; +EDA_HOTKEY* s_PlEditor_Hotkey_List[] = +{ + &HkMoveItem, &HkMoveStartPoint, + &HkMoveEndPoint, &HkDeleteItem +}; + +// list of sections and corresponding hotkey list for Pl_Editor +// (used to create an hotkey config file) +wxString s_PlEditorSectionTag( wxT( "[pl_editor]" ) ); -// list of sections and corresponding hotkey list for GerbView (used to create an hotkey -// config file) struct EDA_HOTKEY_CONFIG s_PlEditor_Hokeys_Descr[] = { - { &g_CommonSectionTag, s_PlEditor_Hotkey_List, NULL }, - { NULL, NULL, NULL } + { &g_CommonSectionTag, s_Common_Hotkey_List, L"Common keys" }, + { &s_PlEditorSectionTag, s_PlEditor_Hotkey_List, L"pl_editor keys" }, + { NULL, NULL, NULL } }; @@ -92,6 +116,7 @@ struct EDA_HOTKEY_CONFIG s_PlEditor_Hokeys_Descr[] = void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem ) { + bool busy = GetScreen()->GetCurItem() != NULL; wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetEventObject( this ); @@ -102,12 +127,16 @@ void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_PlEditor_Hotkey_List ); + if( HK_Descr == NULL ) + HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_Common_Hotkey_List ); + if( HK_Descr == NULL ) return; + WORKSHEET_DATAITEM* item; + switch( HK_Descr->m_Idcommand ) { - default: case HK_NOT_FOUND: return; @@ -140,13 +169,33 @@ void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, GetEventHandler()->ProcessEvent( cmd ); break; - case HK_RESET_LOCAL_COORD: /*Reset the relative coord */ + case HK_RESET_LOCAL_COORD: // Reset the relative coord GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition(); break; - case HK_SWITCH_UNITS: - g_UserUnit = (g_UserUnit == INCHES ) ? MILLIMETRES : INCHES; + case HK_MOVE_ITEM: + case HK_MOVE_START_POINT: + case HK_MOVE_END_POINT: + case HK_DELETE_ITEM: + if( busy ) + break; + + if( (item = Locate( aPosition )) == NULL ) + break; + + // Only rect and lines have a end point. + if( HK_Descr->m_Idcommand == HK_MOVE_END_POINT && !item->HasEndPoint() ) + break; + + if( m_treePagelayout->GetPageLayoutSelectedItem() != item ) + m_treePagelayout->SelectCell( item ); + + cmd.SetId( HK_Descr->m_IdMenuEvent ); + GetEventHandler()->ProcessEvent( cmd ); break; + default: + wxMessageBox( wxT("Unknown hotkey") ); + return; } } diff --git a/pagelayout_editor/hotkeys.h b/pagelayout_editor/hotkeys.h index f3f2b39e8d..1b86ccf2b0 100644 --- a/pagelayout_editor/hotkeys.h +++ b/pagelayout_editor/hotkeys.h @@ -1,9 +1,9 @@ /** - * gerbview/hotkeys.h + * @file pagelayout_editor/hotkeys.h */ -#ifndef GERBVIEW_KOTKEYS_H_ -#define GERBVIEW_KOTKEYS_H_ +#ifndef PL_EDITOR_KOTKEYS_H_ +#define PL_EDITOR_KOTKEYS_H_ #include @@ -12,12 +12,13 @@ // for shared hotkeys id enum hotkey_id_commnand { HK_SWITCH_UNITS = HK_COMMON_END, - HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, - HK_SWITCH_LAYER_TO_NEXT, - HK_SWITCH_LAYER_TO_PREVIOUS + HK_MOVE_ITEM, + HK_MOVE_START_POINT, + HK_MOVE_END_POINT, + HK_DELETE_ITEM }; -// List of hotkey descriptors for GerbView. +// List of hotkey descriptors for PlEditor. extern struct EDA_HOTKEY_CONFIG s_PlEditor_Hokeys_Descr[]; -#endif // GERBVIEW_KOTKEYS_H_ +#endif // PL_EDITOR_KOTKEYS_H_ diff --git a/pagelayout_editor/onrightclick.cpp b/pagelayout_editor/onrightclick.cpp index d816549c56..6a343094df 100644 --- a/pagelayout_editor/onrightclick.cpp +++ b/pagelayout_editor/onrightclick.cpp @@ -38,6 +38,7 @@ #include #include #include +#include /* Prepare the right-click pullup menu. @@ -46,36 +47,47 @@ bool PL_EDITOR_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu ) { bool busy = GetScreen()->GetCurItem() != NULL; + wxString msg; if( ! busy ) // No item currently edited { - WORKSHEET_DATAITEM* item = m_treePagelayout->GetPageLayoutSelectedItem(); - WORKSHEET_DATAITEM* newitem = Locate( aPosition ); + WORKSHEET_DATAITEM* old_item = m_treePagelayout->GetPageLayoutSelectedItem(); + WORKSHEET_DATAITEM* item = Locate( aPosition ); - if( newitem && newitem != item ) + if( item && old_item != item ) { - item = newitem; m_treePagelayout->SelectCell( item ); m_canvas->Refresh(); } // Add menus to edit and delete the item - if( newitem ) + if( item ) { - if( (newitem->GetFlags() & LOCATE_STARTPOINT) ) - AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE_START_POINT, _( "Move Start Point" ), + if( (item->GetFlags() & LOCATE_STARTPOINT) ) + { + msg = AddHotkeyName( _( "Move Start Point" ), s_PlEditor_Hokeys_Descr, + HK_MOVE_START_POINT ); + AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE_START_POINT, msg, KiBitmap( move_xpm ) ); + } if( (item->GetFlags() & LOCATE_ENDPOINT ) ) - AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE_END_POINT, _( "Move End Point" ), + { + msg = AddHotkeyName( _( "Move End Point" ), s_PlEditor_Hokeys_Descr, + HK_MOVE_END_POINT ); + AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE_END_POINT, msg, KiBitmap( move_xpm ) ); + } - AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE, _( "Move" ), + msg = AddHotkeyName( _( "Move Item" ), s_PlEditor_Hokeys_Descr, + HK_MOVE_ITEM ); + AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE, msg, KiBitmap( move_xpm ) ); aPopMenu->AppendSeparator(); - AddMenuItem( aPopMenu, ID_POPUP_ITEM_DELETE, _( "Delete" ), - KiBitmap( delete_xpm ) ); + msg = AddHotkeyName( _( "Delete" ), s_PlEditor_Hokeys_Descr, + HK_DELETE_ITEM ); + AddMenuItem( aPopMenu, ID_POPUP_ITEM_DELETE, msg, KiBitmap( delete_xpm ) ); aPopMenu->AppendSeparator(); } } diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index e10dc55e4b..84b5adc451 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -408,6 +408,7 @@ 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; @@ -415,23 +416,36 @@ void PL_EDITOR_FRAME::UpdateStatusBar() { 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; } wxString line; + + // Display page size + #define milsTomm (25.4/1000) + DSIZE size = GetPageSettings().GetSizeMils(); + size = size * milsTomm; + line.Printf( pagesizeformatter, size.x, size.y ); + SetStatusText( line, 0 ); + + // Display abs coordinates line.Printf( absformatter, dXpos, dYpos ); SetStatusText( line, 2 ); @@ -620,6 +634,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition ) { wxArrayString choices; wxString text; + wxPoint cursPos = screen->GetCrossHairPosition(); for( unsigned ii = 0; ii < list.size(); ++ii ) { @@ -650,6 +665,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition ) if( selection < 0 ) return NULL; + screen->SetCrossHairPosition( cursPos ); m_canvas->MoveCursorToCrossHair(); drawitem = list[selection]; } diff --git a/pagelayout_editor/properties_frame.cpp b/pagelayout_editor/properties_frame.cpp index e0d4374857..d9db9c4475 100644 --- a/pagelayout_editor/properties_frame.cpp +++ b/pagelayout_editor/properties_frame.cpp @@ -289,6 +289,19 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event ) m_parent->GetCanvas()->Refresh(); } +void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event ) +{ + WORKSHEET_DATAITEM::m_DefaultTextSize = + DSIZE( TB_DEFAULT_TEXTSIZE, TB_DEFAULT_TEXTSIZE ); + // default thickness in mm + WORKSHEET_DATAITEM::m_DefaultLineWidth = 0.15; + WORKSHEET_DATAITEM::m_DefaultTextThickness = 0.15; + + CopyPrmsFromGeneralToPanel(); + m_parent->GetCanvas()->Refresh(); +} + + // Data transfert from properties frame to item parameters bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem ) { diff --git a/pagelayout_editor/properties_frame.h b/pagelayout_editor/properties_frame.h index befb80efe5..e603cac5e8 100644 --- a/pagelayout_editor/properties_frame.h +++ b/pagelayout_editor/properties_frame.h @@ -47,7 +47,9 @@ public: PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ); ~PROPERTIES_FRAME(); + // Event functions void OnAcceptPrms( wxCommandEvent& event ); + void OnSetDefaultValues( wxCommandEvent& event ); // Data transfert from general properties to widgets