Commit 077a570b authored by CHARRAS's avatar CHARRAS

Display grid in mils or mm in popup menus

parent 7e8d0a95
...@@ -4,6 +4,11 @@ Started 2007-June-11 ...@@ -4,6 +4,11 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-aug-27 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ all
Display grid size in mils or mm in popup menu according to the current unit choice
2007-Aug-24 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Aug-24 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
......
...@@ -314,11 +314,13 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -314,11 +314,13 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
break; break;
case EDA_ZOOM_IN_FROM_MOUSE:
case WXK_F1: case WXK_F1:
OnZoom( ID_ZOOM_PLUS_KEY ); OnZoom( ID_ZOOM_PLUS_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
break; break;
case EDA_ZOOM_OUT_FROM_MOUSE:
case WXK_F2: case WXK_F2:
OnZoom( ID_ZOOM_MOINS_KEY ); OnZoom( ID_ZOOM_MOINS_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
...@@ -328,6 +330,7 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -328,6 +330,7 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
OnZoom( ID_ZOOM_REDRAW_KEY ); OnZoom( ID_ZOOM_REDRAW_KEY );
break; break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
case WXK_F4: case WXK_F4:
OnZoom( ID_ZOOM_CENTER_KEY ); OnZoom( ID_ZOOM_CENTER_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
......
...@@ -13,23 +13,24 @@ ...@@ -13,23 +13,24 @@
#endif #endif
/* Etat des touches speciales du clavier */ /* Flag for special keys */
#define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right shift key depressed */ #define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right shift key depressed */
#define GR_KB_LEFTSHIFT 0x20000000 /* left shift key depressed */ #define GR_KB_LEFTSHIFT 0x20000000 /* left shift key depressed */
#define GR_KB_CTRL 0x40000000 /* CTRL depressed */ #define GR_KB_CTRL 0x40000000 /* CTRL depressed */
#define GR_KB_ALT 0x80000000 /* ALT depressed */ #define GR_KB_ALT 0x80000000 /* ALT depressed */
#define GR_KB_SHIFT (GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT) #define GR_KB_SHIFT (GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT)
#define GR_KB_SHIFTCTRL (GR_KB_SHIFT | GR_KB_CTRL) #define GR_KB_SHIFTCTRL (GR_KB_SHIFT | GR_KB_CTRL)
#define MOUSE_MIDDLE 0x10000 /* flag indiquant bouton central souris */ #define MOUSE_MIDDLE 0x08000000 /* Middle button mouse flag for block commands */
/* Pseudo key codes for commands liske panning */
/* Pseudo key codes for command panning */
enum pseudokeys { enum pseudokeys {
EDA_PANNING_UP_KEY = 2000, EDA_PANNING_UP_KEY = 1,
EDA_PANNING_DOWN_KEY, EDA_PANNING_DOWN_KEY,
EDA_PANNING_LEFT_KEY, EDA_PANNING_LEFT_KEY,
EDA_PANNING_RIGHT_KEY EDA_PANNING_RIGHT_KEY,
EDA_ZOOM_IN_FROM_MOUSE,
EDA_ZOOM_OUT_FROM_MOUSE,
EDA_ZOOM_CENTER_FROM_MOUSE
}; };
#define ESC 27 #define ESC 27
...@@ -57,7 +58,7 @@ enum pseudokeys { ...@@ -57,7 +58,7 @@ enum pseudokeys {
/* Orientation des textes graphiques en 0.1 degre*/ /* Graphic Texts Orientation in 0.1 degree*/
#define TEXT_ORIENT_HORIZ 0 #define TEXT_ORIENT_HORIZ 0
#define TEXT_ORIENT_VERT 900 #define TEXT_ORIENT_VERT 900
......
No preview for this file type
This diff is collapsed.
...@@ -280,11 +280,13 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -280,11 +280,13 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
break; break;
case EDA_ZOOM_IN_FROM_MOUSE:
case WXK_F1: case WXK_F1:
OnZoom( ID_ZOOM_PLUS_KEY ); OnZoom( ID_ZOOM_PLUS_KEY );
oldpos = curpos = GetScreen()->m_Curseur; oldpos = curpos = GetScreen()->m_Curseur;
break; break;
case EDA_ZOOM_OUT_FROM_MOUSE:
case WXK_F2: case WXK_F2:
OnZoom( ID_ZOOM_MOINS_KEY ); OnZoom( ID_ZOOM_MOINS_KEY );
oldpos = curpos = GetScreen()->m_Curseur; oldpos = curpos = GetScreen()->m_Curseur;
...@@ -294,6 +296,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -294,6 +296,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
OnZoom( ID_ZOOM_REDRAW_KEY ); OnZoom( ID_ZOOM_REDRAW_KEY );
break; break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
case WXK_F4: case WXK_F4:
OnZoom( ID_ZOOM_CENTER_KEY ); OnZoom( ID_ZOOM_CENTER_KEY );
oldpos = curpos = GetScreen()->m_Curseur; oldpos = curpos = GetScreen()->m_Curseur;
......
...@@ -108,14 +108,12 @@ END_EVENT_TABLE() ...@@ -108,14 +108,12 @@ END_EVENT_TABLE()
const int UNITS_MILS = 1000; const int UNITS_MILS = 1000;
const int H_SIZE = 640;
const int V_SIZE = 430;
/********************************************************************/ /********************************************************************/
WinEDA_PlotFrame::WinEDA_PlotFrame(WinEDA_BasePcbFrame * parent): WinEDA_PlotFrame::WinEDA_PlotFrame(WinEDA_BasePcbFrame * parent):
wxDialog(parent, -1, _("Plot"), wxDialog(parent, -1, _("Plot"),
wxPoint(-1,-1), wxSize(H_SIZE, V_SIZE), wxPoint(-1,-1), wxDefaultSize,
wxDEFAULT_DIALOG_STYLE) wxDEFAULT_DIALOG_STYLE)
/********************************************************************/ /********************************************************************/
{ {
......
...@@ -755,7 +755,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -755,7 +755,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
else if( event.ControlDown() ) else if( event.ControlDown() )
localkey = EDA_PANNING_LEFT_KEY; localkey = EDA_PANNING_LEFT_KEY;
else else
localkey = WXK_F1; localkey = EDA_ZOOM_IN_FROM_MOUSE;
} }
else else
{ {
...@@ -764,7 +764,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -764,7 +764,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
else if( event.ControlDown() ) else if( event.ControlDown() )
localkey = EDA_PANNING_RIGHT_KEY; localkey = EDA_PANNING_RIGHT_KEY;
else else
localkey = WXK_F2; localkey = EDA_ZOOM_OUT_FROM_MOUSE;
} }
} }
...@@ -833,7 +833,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -833,7 +833,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) ) if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
{ // The middle button has been relached, with no block command: { // The middle button has been relached, with no block command:
// We use it for a zoom center command // We use it for a zoom center command
g_KeyPressed = localkey = WXK_F4; g_KeyPressed = localkey = EDA_ZOOM_CENTER_FROM_MOUSE;
} }
......
...@@ -307,9 +307,8 @@ void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent& event ) ...@@ -307,9 +307,8 @@ void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent& event )
class grid_list_struct class grid_list_struct
{ {
public: public:
int m_value; int m_Value;
int m_id; int m_Id;
const wxChar* m_msg;
}; };
...@@ -325,36 +324,36 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) ...@@ -325,36 +324,36 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
wxSize grid; wxSize grid;
int zoom_value; int zoom_value;
wxString zoom_msg = _( "Zoom: " ); wxString zoom_msg = _( "Zoom: " );
wxString grid_msg = _( "Grid:" ), msg; wxString grid_msg = _( "Grid: " ), msg;
int ii; int ii;
wxString line; wxString line;
static const grid_list_struct grid_list_pcb[] = static const grid_list_struct grid_list_pcb[] =
{ {
{ 1000, ID_POPUP_GRID_LEVEL_1000, wxT( " 100" ) }, { 1000, ID_POPUP_GRID_LEVEL_1000 },
{ 500, ID_POPUP_GRID_LEVEL_500, wxT( " 50" ) }, { 500, ID_POPUP_GRID_LEVEL_500 },
{ 250, ID_POPUP_GRID_LEVEL_250, wxT( " 25" ) }, { 250, ID_POPUP_GRID_LEVEL_250 },
{ 200, ID_POPUP_GRID_LEVEL_200, wxT( " 20" ) }, { 200, ID_POPUP_GRID_LEVEL_200 },
{ 100, ID_POPUP_GRID_LEVEL_100, wxT( " 10" ) }, { 100, ID_POPUP_GRID_LEVEL_100 },
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 5" ) }, { 50, ID_POPUP_GRID_LEVEL_50 },
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 2.5" ) }, { 25, ID_POPUP_GRID_LEVEL_25 },
{ 20, ID_POPUP_GRID_LEVEL_20, wxT( " 2" ) }, { 20, ID_POPUP_GRID_LEVEL_20 },
{ 10, ID_POPUP_GRID_LEVEL_10, wxT( " 1" ) }, { 10, ID_POPUP_GRID_LEVEL_10 },
{ 5, ID_POPUP_GRID_LEVEL_5, wxT( " 0.5" ) }, { 5, ID_POPUP_GRID_LEVEL_5 },
{ 2, ID_POPUP_GRID_LEVEL_2, wxT( " 0.2" ) }, { 2, ID_POPUP_GRID_LEVEL_2 },
{ 1, ID_POPUP_GRID_LEVEL_1, wxT( " 0.1" ) }, { 1, ID_POPUP_GRID_LEVEL_1 },
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) } { 0, ID_POPUP_GRID_USER }
}; };
static const grid_list_struct grid_list_schematic[] = static const grid_list_struct grid_list_schematic[] =
{ {
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 50" ) }, { 50, ID_POPUP_GRID_LEVEL_50 },
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 25" ) }, { 25, ID_POPUP_GRID_LEVEL_25 },
{ 10, ID_POPUP_GRID_LEVEL_10, wxT( " 10" ) }, { 10, ID_POPUP_GRID_LEVEL_10 },
{ 5, ID_POPUP_GRID_LEVEL_5, wxT( " 5" ) }, { 5, ID_POPUP_GRID_LEVEL_5 },
{ 2, ID_POPUP_GRID_LEVEL_2, wxT( " 2" ) }, { 2, ID_POPUP_GRID_LEVEL_2 },
{ 1, ID_POPUP_GRID_LEVEL_1, wxT( " 1" ) }, { 1, ID_POPUP_GRID_LEVEL_1 },
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) } { 0, ID_POPUP_GRID_USER }
}; };
...@@ -387,39 +386,57 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) ...@@ -387,39 +386,57 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
grid = m_Parent->m_CurrentScreen->GetGrid(); grid = m_Parent->m_CurrentScreen->GetGrid();
// Create grid list
switch( m_Parent->m_Ident ) switch( m_Parent->m_Ident )
{ {
case MODULE_EDITOR_FRAME: case MODULE_EDITOR_FRAME:
case GERBER_FRAME: case GERBER_FRAME:
case PCB_FRAME: case PCB_FRAME:
case CVPCB_DISPLAY_FRAME: case CVPCB_DISPLAY_FRAME:
for( ii = 0; ; ii++ ) // Create grid list for( ii = 0; ; ii++ )
{ {
msg = grid_msg + grid_list_pcb[ii].m_msg; if ( grid_list_pcb[ii].m_Value )
grid_choice->Append( grid_list_pcb[ii].m_id, msg, wxEmptyString, TRUE ); {
if( grid_list_pcb[ii].m_value <= 0 ) double grid_value = To_User_Unit(g_UnitMetric, grid_list_pcb[ii].m_Value,
((WinEDA_DrawFrame*)m_Parent)->m_InternalUnits);
if ( g_UnitMetric == 0) // inches
line.Printf(wxT("%g mils"), grid_value*1000);
else
line.Printf(wxT("%g mm"), grid_value);
}
else line = _("grid user");
msg = grid_msg + line;
grid_choice->Append( grid_list_pcb[ii].m_Id, msg, wxEmptyString, TRUE );
if( grid_list_pcb[ii].m_Value <= 0 )
{ {
if( m_Parent->m_CurrentScreen->m_UserGridIsON ) if( m_Parent->m_CurrentScreen->m_UserGridIsON )
grid_choice->Check( grid_list_pcb[ii].m_id, TRUE ); grid_choice->Check( grid_list_pcb[ii].m_Id, TRUE );
break; break;
} }
if( grid.x == grid_list_pcb[ii].m_value ) if( grid.x == grid_list_pcb[ii].m_Value )
grid_choice->Check( grid_list_pcb[ii].m_id, TRUE ); grid_choice->Check( grid_list_pcb[ii].m_Id, TRUE );
} }
break; break;
case SCHEMATIC_FRAME: case SCHEMATIC_FRAME:
case LIBEDITOR_FRAME: case LIBEDITOR_FRAME:
for( ii = 0; ; ii++ ) // Create zoom choice 256 .. 1024 for( ii = 0; ; ii++ )
{ {
if( grid_list_schematic[ii].m_value <= 0 ) if( grid_list_schematic[ii].m_Value <= 0 )
break; break;
msg = grid_msg + grid_list_schematic[ii].m_msg; double grid_value = To_User_Unit(g_UnitMetric, grid_list_schematic[ii].m_Value,
grid_choice->Append( grid_list_schematic[ii].m_id, ((WinEDA_DrawFrame*)m_Parent)->m_InternalUnits);
if ( g_UnitMetric == 0) // inches
line.Printf(wxT("%g mils"), grid_value*1000);
else
line.Printf(wxT("%g mm"), grid_value);
msg = grid_msg + line;
grid_choice->Append( grid_list_schematic[ii].m_Id,
msg, wxEmptyString, TRUE ); msg, wxEmptyString, TRUE );
if( grid.x == grid_list_schematic[ii].m_value ) if( grid.x == grid_list_schematic[ii].m_Value )
grid_choice->Check( grid_list_schematic[ii].m_id, TRUE ); grid_choice->Check( grid_list_schematic[ii].m_Id, TRUE );
} }
break; break;
......
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