Display grid in mils or mm in popup menus

This commit is contained in:
CHARRAS 2007-08-27 08:07:44 +00:00
parent 7e8d0a953b
commit 077a570bc0
9 changed files with 2331 additions and 2293 deletions

View File

@ -4,6 +4,11 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================

View File

@ -314,11 +314,13 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
curpos = m_CurrentScreen->m_Curseur;
break;
case EDA_ZOOM_IN_FROM_MOUSE:
case WXK_F1:
OnZoom( ID_ZOOM_PLUS_KEY );
curpos = m_CurrentScreen->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
case WXK_F2:
OnZoom( ID_ZOOM_MOINS_KEY );
curpos = m_CurrentScreen->m_Curseur;
@ -328,6 +330,7 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
OnZoom( ID_ZOOM_REDRAW_KEY );
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
case WXK_F4:
OnZoom( ID_ZOOM_CENTER_KEY );
curpos = m_CurrentScreen->m_Curseur;

View File

@ -13,23 +13,24 @@
#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_LEFTSHIFT 0x20000000 /* left shift key depressed */
#define GR_KB_CTRL 0x40000000 /* CTRL depressed */
#define GR_KB_ALT 0x80000000 /* ALT depressed */
#define GR_KB_SHIFT (GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT)
#define GR_KB_SHIFTCTRL (GR_KB_SHIFT | GR_KB_CTRL)
#define MOUSE_MIDDLE 0x10000 /* flag indiquant bouton central souris */
/* Pseudo key codes for commands liske panning */
#define MOUSE_MIDDLE 0x08000000 /* Middle button mouse flag for block commands */
/* Pseudo key codes for command panning */
enum pseudokeys {
EDA_PANNING_UP_KEY = 2000,
EDA_PANNING_UP_KEY = 1,
EDA_PANNING_DOWN_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
@ -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_VERT 900

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -280,11 +280,13 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
curpos = m_CurrentScreen->m_Curseur;
break;
case EDA_ZOOM_IN_FROM_MOUSE:
case WXK_F1:
OnZoom( ID_ZOOM_PLUS_KEY );
oldpos = curpos = GetScreen()->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
case WXK_F2:
OnZoom( ID_ZOOM_MOINS_KEY );
oldpos = curpos = GetScreen()->m_Curseur;
@ -294,6 +296,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
OnZoom( ID_ZOOM_REDRAW_KEY );
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
case WXK_F4:
OnZoom( ID_ZOOM_CENTER_KEY );
oldpos = curpos = GetScreen()->m_Curseur;

View File

@ -108,14 +108,12 @@ END_EVENT_TABLE()
const int UNITS_MILS = 1000;
const int H_SIZE = 640;
const int V_SIZE = 430;
/********************************************************************/
WinEDA_PlotFrame::WinEDA_PlotFrame(WinEDA_BasePcbFrame * parent):
wxDialog(parent, -1, _("Plot"),
wxPoint(-1,-1), wxSize(H_SIZE, V_SIZE),
wxPoint(-1,-1), wxDefaultSize,
wxDEFAULT_DIALOG_STYLE)
/********************************************************************/
{

View File

@ -755,7 +755,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
else if( event.ControlDown() )
localkey = EDA_PANNING_LEFT_KEY;
else
localkey = WXK_F1;
localkey = EDA_ZOOM_IN_FROM_MOUSE;
}
else
{
@ -764,7 +764,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
else if( event.ControlDown() )
localkey = EDA_PANNING_RIGHT_KEY;
else
localkey = WXK_F2;
localkey = EDA_ZOOM_OUT_FROM_MOUSE;
}
}
@ -833,7 +833,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
{ // The middle button has been relached, with no block command:
// We use it for a zoom center command
g_KeyPressed = localkey = WXK_F4;
g_KeyPressed = localkey = EDA_ZOOM_CENTER_FROM_MOUSE;
}

View File

@ -307,9 +307,8 @@ void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent& event )
class grid_list_struct
{
public:
int m_value;
int m_id;
const wxChar* m_msg;
int m_Value;
int m_Id;
};
@ -325,36 +324,36 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
wxSize grid;
int zoom_value;
wxString zoom_msg = _( "Zoom: " );
wxString grid_msg = _( "Grid:" ), msg;
wxString grid_msg = _( "Grid: " ), msg;
int ii;
wxString line;
static const grid_list_struct grid_list_pcb[] =
{
{ 1000, ID_POPUP_GRID_LEVEL_1000, wxT( " 100" ) },
{ 500, ID_POPUP_GRID_LEVEL_500, wxT( " 50" ) },
{ 250, ID_POPUP_GRID_LEVEL_250, wxT( " 25" ) },
{ 200, ID_POPUP_GRID_LEVEL_200, wxT( " 20" ) },
{ 100, ID_POPUP_GRID_LEVEL_100, wxT( " 10" ) },
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 5" ) },
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 2.5" ) },
{ 20, ID_POPUP_GRID_LEVEL_20, wxT( " 2" ) },
{ 10, ID_POPUP_GRID_LEVEL_10, wxT( " 1" ) },
{ 5, ID_POPUP_GRID_LEVEL_5, wxT( " 0.5" ) },
{ 2, ID_POPUP_GRID_LEVEL_2, wxT( " 0.2" ) },
{ 1, ID_POPUP_GRID_LEVEL_1, wxT( " 0.1" ) },
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) }
{ 1000, ID_POPUP_GRID_LEVEL_1000 },
{ 500, ID_POPUP_GRID_LEVEL_500 },
{ 250, ID_POPUP_GRID_LEVEL_250 },
{ 200, ID_POPUP_GRID_LEVEL_200 },
{ 100, ID_POPUP_GRID_LEVEL_100 },
{ 50, ID_POPUP_GRID_LEVEL_50 },
{ 25, ID_POPUP_GRID_LEVEL_25 },
{ 20, ID_POPUP_GRID_LEVEL_20 },
{ 10, ID_POPUP_GRID_LEVEL_10 },
{ 5, ID_POPUP_GRID_LEVEL_5 },
{ 2, ID_POPUP_GRID_LEVEL_2 },
{ 1, ID_POPUP_GRID_LEVEL_1 },
{ 0, ID_POPUP_GRID_USER }
};
static const grid_list_struct grid_list_schematic[] =
{
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 50" ) },
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 25" ) },
{ 10, ID_POPUP_GRID_LEVEL_10, wxT( " 10" ) },
{ 5, ID_POPUP_GRID_LEVEL_5, wxT( " 5" ) },
{ 2, ID_POPUP_GRID_LEVEL_2, wxT( " 2" ) },
{ 1, ID_POPUP_GRID_LEVEL_1, wxT( " 1" ) },
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) }
{ 50, ID_POPUP_GRID_LEVEL_50 },
{ 25, ID_POPUP_GRID_LEVEL_25 },
{ 10, ID_POPUP_GRID_LEVEL_10 },
{ 5, ID_POPUP_GRID_LEVEL_5 },
{ 2, ID_POPUP_GRID_LEVEL_2 },
{ 1, ID_POPUP_GRID_LEVEL_1 },
{ 0, ID_POPUP_GRID_USER }
};
@ -387,39 +386,57 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
grid = m_Parent->m_CurrentScreen->GetGrid();
// Create grid list
switch( m_Parent->m_Ident )
{
case MODULE_EDITOR_FRAME:
case GERBER_FRAME:
case PCB_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;
grid_choice->Append( grid_list_pcb[ii].m_id, msg, wxEmptyString, TRUE );
if( grid_list_pcb[ii].m_value <= 0 )
if ( grid_list_pcb[ii].m_Value )
{
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 )
grid_choice->Check( grid_list_pcb[ii].m_id, TRUE );
grid_choice->Check( grid_list_pcb[ii].m_Id, TRUE );
break;
}
if( grid.x == grid_list_pcb[ii].m_value )
grid_choice->Check( grid_list_pcb[ii].m_id, TRUE );
if( grid.x == grid_list_pcb[ii].m_Value )
grid_choice->Check( grid_list_pcb[ii].m_Id, TRUE );
}
break;
case SCHEMATIC_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;
msg = grid_msg + grid_list_schematic[ii].m_msg;
grid_choice->Append( grid_list_schematic[ii].m_id,
double grid_value = To_User_Unit(g_UnitMetric, grid_list_schematic[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);
msg = grid_msg + line;
grid_choice->Append( grid_list_schematic[ii].m_Id,
msg, wxEmptyString, TRUE );
if( grid.x == grid_list_schematic[ii].m_value )
grid_choice->Check( grid_list_schematic[ii].m_id, TRUE );
if( grid.x == grid_list_schematic[ii].m_Value )
grid_choice->Check( grid_list_schematic[ii].m_Id, TRUE );
}
break;