Commit 28cd9963 authored by jean-pierre charras's avatar jean-pierre charras

Pl_Editor: add some hot keys. Fix some rounding issues.

parent 99535864
......@@ -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;
if( m_RB_Corner.y < pos.y || m_LT_Corner.y > pos.y )
return false;
pos = GetEndPos( ii );
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.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 );
}
return true;
}
......
......@@ -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
......
......@@ -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;
......
/**
* @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 <vector2d.h>
#include <eda_text.h>
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 )
......
......@@ -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 );
}
......@@ -7479,6 +7479,94 @@
<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>
......
......@@ -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:
......
......@@ -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 );
......
......@@ -32,7 +32,10 @@
#include <class_drawpanel.h>
#include <pl_editor_frame.h>
#include <design_tree_frame.h>
#include <class_worksheet_dataitem.h>
#include <hotkeys.h>
#include <pl_editor_id.h>
/* 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;
}
}
/**
* 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 <hotkeys_basic.h>
......@@ -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_
......@@ -38,6 +38,7 @@
#include <menus_helpers.h>
#include <worksheet_shape_builder.h>
#include <class_worksheet_dataitem.h>
#include <hotkeys.h>
/* 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();
}
}
......
......@@ -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];
}
......
......@@ -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 )
{
......
......@@ -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
......
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