Commit 3097b919 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Added grid origin patch from Lorenzo Marcantonio. Converted set...

Pcbnew:   Added grid origin patch from Lorenzo Marcantonio.   Converted set grid dialog from DialogBlocks to wxFormBuilder,  and added in this dialog the grid origin parameters settings.
parent f18fdd10
......@@ -4,6 +4,13 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-jul-12, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew:
Added grid origin patch from Lorenzo Marcantonio.
Converted set grid dialog from DialogBlocks to wxFormBuilder,
and added in this dialog the grid origin parameters settings.
2010-jun-24 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++EESchema component library and hierarchical sheet label object improvements.
......
......@@ -142,6 +142,7 @@ set(BITMAP_SRCS
Global_Options_Pad.xpm
green.xpm
grid_select.xpm
grid_select_axis.xpm
grid.xpm
hammer.xpm
help.xpm
......
/* PM */
const char *grid_select_axis_xpm[] = {
/* columns rows colors const chars-per-pixel */
"16 16 4 1",
" c None",
"o c #000000",
"+ c #FF0000",
". c #600000",
/* pixels */
" + ",
"oo +. oo oo ",
"oo +. oo oo ",
" +. ",
" +. ",
"oo +. oo oo ",
"oo +. oo oo ",
" +. ",
" +. ",
"+++++++++++++++ ",
" ...+...........",
" +. ",
" +. ",
"oo +. oo oo ",
"oo +. oo oo ",
" . "
};
......@@ -478,6 +478,12 @@ GRID_TYPE BASE_SCREEN::GetGrid()
return m_Grid;
}
/*********************************/
const wxPoint& BASE_SCREEN::GetGridOrigin()
/*********************************/
{
return m_GridOrigin;
}
wxRealPoint BASE_SCREEN::GetGridSize()
{
......
......@@ -72,6 +72,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
m_Draw_Sheet_Ref = FALSE; // TRUE to display reference sheet.
m_Print_Sheet_Ref = TRUE; // TRUE to print reference sheet.
m_Draw_Auxiliary_Axis = FALSE; // TRUE draw auxilary axis.
m_Draw_Grid_Axis = FALSE; // TRUE to draw the grid axis
m_CursorShape = 0;
m_LastGridSizeId = 0;
m_DrawGrid = true; // hide/Show grid. default = show
......
......@@ -739,6 +739,9 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
if( m_Parent->m_Draw_Auxiliary_Axis )
DrawAuxiliaryAxis( DC, GR_COPY );
if( m_Parent->m_Draw_Grid_Axis )
DrawGridAxis( DC, GR_COPY );
}
......@@ -916,6 +919,36 @@ void WinEDA_DrawPanel::DrawAuxiliaryAxis( wxDC* DC, int drawmode )
0, Color );
}
/********************************************************************/
void WinEDA_DrawPanel::DrawGridAxis( wxDC* DC, int drawmode )
/********************************************************************/
{
BASE_SCREEN* screen = GetScreen();
if( !m_Parent->m_Draw_Grid_Axis
|| ( screen->m_GridOrigin.x == 0
&& screen->m_GridOrigin.y == 0 ) )
return;
int Color = m_Parent->GetGridColor();
GRSetDrawMode( DC, drawmode );
/* Draw the Y axis */
GRDashedLine( &m_ClipBox, DC,
screen->m_GridOrigin.x,
-screen->ReturnPageSize().y,
screen->m_GridOrigin.x,
screen->ReturnPageSize().y,
0, Color );
/* Draw the X axis */
GRDashedLine( &m_ClipBox, DC,
-screen->ReturnPageSize().x,
screen->m_GridOrigin.y,
screen->ReturnPageSize().x,
screen->m_GridOrigin.y,
0, Color );
}
/** Build and display a Popup menu on a right mouse button click
* @return true if a popup menu is shown, or false
......
......@@ -52,13 +52,16 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
{
wxRealPoint grid_size = GetBaseScreen()->GetGridSize();
if( !GetBaseScreen()->m_UserGridIsON )
if( !GetBaseScreen()->m_UserGridIsON ) // XXX UNUSED VARIABLE???
{
int tmp = wxRound( (double) coord->x / grid_size.x );
coord->x = wxRound( (double) tmp * grid_size.x );
tmp = wxRound( (double) coord->y / grid_size.y );
coord->y = wxRound( (double) tmp * grid_size.y );
const wxPoint& grid_origin = GetBaseScreen()->GetGridOrigin();
double offset = fmod(grid_origin.x, grid_size.x);
int tmp = wxRound( (coord->x - offset) / grid_size.x );
coord->x = wxRound( tmp * grid_size.x + offset );
offset = fmod(grid_origin.y, grid_size.y);
tmp = wxRound( (coord->y - offset) / grid_size.y );
coord->y = wxRound ( tmp * grid_size.y + offset );
}
}
......
......@@ -134,6 +134,7 @@ extern const char* glabel2text_xpm[];
extern const char* gl_change_xpm[];
extern const char* global_options_pad_xpm[];
extern const char* green_xpm[];
extern const char* grid_select_axis_xpm[];
extern const char* grid_select_xpm[];
extern const char* grid_xpm[];
extern const char* hammer_xpm[];
......
......@@ -130,6 +130,7 @@ private:
/* Grid and zoom values. */
public:
wxPoint m_GridOrigin;
GridArray m_GridList;
bool m_UserGridIsON;
......@@ -321,6 +322,7 @@ public:
*/
GRID_TYPE GetGrid();
const wxPoint &GetGridOrigin();
void SetGrid( const wxRealPoint& size );
void SetGrid( int id );
void SetGridList( GridArray& sizelist );
......
......@@ -107,6 +107,8 @@ public:
* @param DC = current Device Context
*/
void DrawAuxiliaryAxis( wxDC* DC, int drawmode );
void DrawGridAxis( wxDC* DC, int drawmode );
void OnEraseBackground( wxEraseEvent& event );
void OnActivate( wxActivateEvent& event );
......
......@@ -169,6 +169,7 @@ public:
// for PCBnew and Gerbview
bool m_Draw_Axis; // TRUE to show X and Y axis
bool m_Draw_Grid_Axis; /* TRUE to show grid axis. */
bool m_Draw_Sheet_Ref; // TRUE to show frame references
bool m_Print_Sheet_Ref; // TRUE to print frame references
......
......@@ -85,6 +85,7 @@ set(PCBNEW_SRCS
dialog_mask_clearance_base.cpp
dialog_SVG_print.cpp
dialog_SVG_print_base.cpp
dialog_set_grid_base.cpp
dist.cpp
dragsegm.cpp
drc.cpp
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_set_grid_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbLeftSizer;
sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Grid Size") ), wxVERTICAL );
wxString m_UnitGridChoices[] = { _("Inches"), _("mm") };
int m_UnitGridNChoices = sizeof( m_UnitGridChoices ) / sizeof( wxString );
m_UnitGrid = new wxRadioBox( this, wxID_ANY, _("Grid Size Units"), wxDefaultPosition, wxDefaultSize, m_UnitGridNChoices, m_UnitGridChoices, 1, wxRA_SPECIFY_COLS );
m_UnitGrid->SetSelection( 0 );
sbLeftSizer->Add( m_UnitGrid, 0, wxALL|wxEXPAND, 5 );
sbLeftSizer->Add( 10, 10, 0, 0, 5 );
m_staticTextSizeX = new wxStaticText( this, wxID_ANY, _("User Grid Size X"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeX->Wrap( -1 );
sbLeftSizer->Add( m_staticTextSizeX, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptGridSizeX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbLeftSizer->Add( m_OptGridSizeX, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextSizeY = new wxStaticText( this, wxID_ANY, _("User Grid Size Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeY->Wrap( -1 );
sbLeftSizer->Add( m_staticTextSizeY, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptGridSizeY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbLeftSizer->Add( m_OptGridSizeY, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bUpperSizer->Add( sbLeftSizer, 1, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbRightSizer;
sbRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Grid Origin") ), wxVERTICAL );
wxFlexGridSizer* fgSizerGridOrigin;
fgSizerGridOrigin = new wxFlexGridSizer( 2, 3, 0, 0 );
fgSizerGridOrigin->AddGrowableCol( 1 );
fgSizerGridOrigin->SetFlexibleDirection( wxBOTH );
fgSizerGridOrigin->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextGridPosX = new wxStaticText( this, wxID_ANY, _("Grid origin X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridPosX->Wrap( -1 );
fgSizerGridOrigin->Add( m_staticTextGridPosX, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_GridOriginXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerGridOrigin->Add( m_GridOriginXCtrl, 0, wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_TextPosXUnits = new wxStaticText( this, wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPosXUnits->Wrap( -1 );
fgSizerGridOrigin->Add( m_TextPosXUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextGridPosY = new wxStaticText( this, wxID_ANY, _("Grid origin Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridPosY->Wrap( -1 );
fgSizerGridOrigin->Add( m_staticTextGridPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_GridOriginYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerGridOrigin->Add( m_GridOriginYCtrl, 0, wxEXPAND|wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_TextPosYUnits = new wxStaticText( this, wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPosYUnits->Wrap( -1 );
fgSizerGridOrigin->Add( m_TextPosYUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
sbRightSizer->Add( fgSizerGridOrigin, 0, wxALL|wxEXPAND, 5 );
m_buttonReset = new wxButton( this, wxID_ANY, _("Reset Grid Origin"), wxDefaultPosition, wxDefaultSize, 0 );
sbRightSizer->Add( m_buttonReset, 0, wxALL|wxEXPAND, 5 );
bUpperSizer->Add( sbRightSizer, 2, wxEXPAND|wxALL, 5 );
bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bSizerMain->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM, 5 );
this->SetSizer( bSizerMain );
this->Layout();
// Connect Events
m_buttonReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnResetGridOrgClick ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this );
}
DIALOG_SET_GRID_BASE::~DIALOG_SET_GRID_BASE()
{
// Disconnect Events
m_buttonReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnResetGridOrgClick ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_set_grid_base__
#define __dialog_set_grid_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SET_GRID_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SET_GRID_BASE : public wxDialog
{
private:
protected:
wxRadioBox* m_UnitGrid;
wxStaticText* m_staticTextSizeX;
wxTextCtrl* m_OptGridSizeX;
wxStaticText* m_staticTextSizeY;
wxTextCtrl* m_OptGridSizeY;
wxStaticText* m_staticTextGridPosX;
wxTextCtrl* m_GridOriginXCtrl;
wxStaticText* m_TextPosXUnits;
wxStaticText* m_staticTextGridPosY;
wxTextCtrl* m_GridOriginYCtrl;
wxStaticText* m_TextPosYUnits;
wxButton* m_buttonReset;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnResetGridOrgClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
public:
DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Grid Origin and User Grid Size"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 374,267 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SET_GRID_BASE();
};
#endif //__dialog_set_grid_base__
......@@ -251,6 +251,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Zero" ) );
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Grid Origin" ) );
break;
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT:
......
......@@ -458,6 +458,10 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
SetToolID( id, wxCURSOR_PENCIL, _( "Place anchor" ) );
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust Grid Origin" ) );
break;
case ID_NO_SELECT_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
......
......@@ -149,6 +149,13 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
}
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
DrawPanel->DrawGridAxis( DC, GR_XOR );
GetScreen()->m_GridOrigin = GetScreen()->m_Curseur;
DrawPanel->DrawGridAxis( DC, GR_COPY );
GetScreen()->SetModify();
break;
case ID_PCB_ADD_TEXT_BUTT:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
CreateTextModule( GetBoard()->m_Modules, DC );
......
......@@ -99,6 +99,8 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_PLACE_GRID_COORD_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
// Vertical toolbar (right click):
EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD,
......@@ -157,6 +159,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
m_FrameName = wxT( "ModEditFrame" );
m_Draw_Sheet_Ref = false; // true to show the frame references
m_Draw_Axis = true; // true to show X and Y axis on screen
m_Draw_Grid_Axis = true; // show the grid origin axis
m_HotkeysZoomAndGridList = s_Module_Editor_Hokeys_Descr;
// Give an icon
......
......@@ -374,6 +374,13 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
OnModify();
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
DrawPanel->DrawGridAxis( DC, GR_XOR );
GetScreen()->m_GridOrigin = GetScreen()->m_Curseur;
DrawPanel->DrawGridAxis( DC, GR_COPY );
GetScreen()->SetModify();
break;
default:
DrawPanel->SetCursor( wxCURSOR_ARROW );
DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() id error" ) );
......
......@@ -215,6 +215,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
WinEDA_PcbFrame::ProcessMuWaveFunctions )
EVT_TOOL( ID_PCB_PLACE_GRID_COORD_BUTT,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL_RCLICKED( ID_TRACK_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
......@@ -222,6 +224,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_DIMENSION_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_PLACE_GRID_COORD_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE,
ID_POPUP_PCB_AUTOPLACE_END_RANGE,
......@@ -257,6 +260,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_Draw_Sheet_Ref = true; // true to display sheet references
m_Draw_Axis = false; // true to display X and Y axis
m_Draw_Auxiliary_Axis = true;
m_Draw_Grid_Axis = true;
m_SelTrackWidthBox = NULL;
m_SelViaSizeBox = NULL;
m_SelLayerBox = NULL;
......
......@@ -22,6 +22,7 @@ enum pcbnew_ids
ID_PCB_MIRE_BUTT,
ID_PCB_SHOW_1_RATSNEST_BUTT,
ID_PCB_PLACE_OFFSET_COORD_BUTT,
ID_PCB_PLACE_GRID_COORD_BUTT,
ID_PCB_MASK_CLEARANCE,
ID_PCB_LAYERS_SETUP,
ID_PCB_ADD_LINE_BUTT,
......
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////////
// Name: set_grid.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 26/02/2006 17:24:12
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 26/02/2006 17:24:12
#ifndef _SET_GRID_H_
#define _SET_GRID_H_
/*!
* Includes
*/
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_RADIOBOX 10001
#define ID_TEXTCTRL 10002
#define ID_TEXTCTRL1 10003
#define SYMBOL_WINEDA_PCBGRIDFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_PCBGRIDFRAME_TITLE _("User Grid Size")
#define SYMBOL_WINEDA_PCBGRIDFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_PCBGRIDFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_PCBGRIDFRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
/*!
* WinEDA_PcbGridFrame class declaration
*/
class WinEDA_PcbGridFrame: public wxDialog
{
DECLARE_DYNAMIC_CLASS( WinEDA_PcbGridFrame )
DECLARE_EVENT_TABLE()
public:
/// Constructors
WinEDA_PcbGridFrame( );
WinEDA_PcbGridFrame( WinEDA_BasePcbFrame* parent,
const wxPoint& pos = SYMBOL_WINEDA_PCBGRIDFRAME_POSITION,
wxWindowID id = SYMBOL_WINEDA_PCBGRIDFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PCBGRIDFRAME_TITLE, const wxSize& size = SYMBOL_WINEDA_PCBGRIDFRAME_SIZE, long style = SYMBOL_WINEDA_PCBGRIDFRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PCBGRIDFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PCBGRIDFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PCBGRIDFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PCBGRIDFRAME_SIZE, long style = SYMBOL_WINEDA_PCBGRIDFRAME_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin WinEDA_PcbGridFrame event handler declarations
////@end WinEDA_PcbGridFrame event handler declarations
////@begin WinEDA_PcbGridFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_PcbGridFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin WinEDA_PcbGridFrame member variables
wxRadioBox* m_UnitGrid;
wxTextCtrl* m_OptGridSizeX;
wxTextCtrl* m_OptGridSizeY;
////@end WinEDA_PcbGridFrame member variables
void SetGridUnits( int units );
int GetGridUnits();
void SetGridSize( const wxRealPoint& grid );
wxRealPoint GetGridSize();
};
#endif
// _SET_GRID_H_
This diff is collapsed.
#include "wx/msw/wx.rc"
......@@ -181,6 +181,11 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar()
wxBitmap( delete_body_xpm ),
_( "Delete items" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_PLACE_GRID_COORD_BUTT, wxEmptyString,
wxBitmap( grid_select_axis_xpm ),
_( "Set the origin point for the grid" ),
wxITEM_CHECK );
m_VToolBar->Realize();
SetToolbars();
......
......@@ -41,6 +41,10 @@ void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
OnConfigurePcbOptions( event );
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
InstallGridFrame( wxDefaultPosition );
break;
default:
break;
}
......
......@@ -463,6 +463,11 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
_( "Offset adjust for drill and place files" ),
wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_PLACE_GRID_COORD_BUTT, wxEmptyString,
wxBitmap( grid_select_axis_xpm ),
_( "Set the origin point for the grid" ),
wxITEM_CHECK );
m_VToolBar->Realize();
SetToolbars();
}
......@@ -638,7 +643,7 @@ an existing track use its width\notherwise, use current width setting" ),
m_InternalUnits );
if( grid.m_Id != ID_POPUP_GRID_USER )
{
switch( g_UserUnit )
switch( g_UserUnit )
{
case INCHES:
msg.Printf( format.GetData(), value * 1000 );
......
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