Print functions and display zoom level modified to use the new zoom implementation
Comments added in some functions.
This commit is contained in:
parent
ee3b95007d
commit
5813a12ebb
|
@ -5,6 +5,12 @@ Started 2007-June-11
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
email address.
|
||||
|
||||
2009-jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
================================================================================
|
||||
++All:
|
||||
Print functions and display zoom level modified to use the new zoom implementation
|
||||
Comments adde in some functions.
|
||||
|
||||
2009-Jan-29 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
|
||||
================================================================================
|
||||
++All
|
||||
|
|
|
@ -105,13 +105,13 @@ wxSize BASE_SCREEN::ReturnPageSize( void )
|
|||
/******************************************************************/
|
||||
wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
|
||||
/******************************************************************/
|
||||
/** Function CursorRealPosition
|
||||
* @return the position in user units of location ScreenPos
|
||||
* @param ScreenPos = the screen (in pixel) position co convert
|
||||
*/
|
||||
{
|
||||
wxPoint curpos = ScreenPos;
|
||||
Unscale( curpos );
|
||||
// D(printf("curpos=%d,%d GetZoom=%d, mDrawOrg=%d,%d\n", curpos.x, curpos.y, GetZoom(), m_DrawOrg.x, m_DrawOrg.y );)
|
||||
|
||||
// curpos.x = Unscale( ScreenPos.x );
|
||||
// curpos.y = Unscale( ScreenPos.y );
|
||||
|
||||
curpos += m_DrawOrg;
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ void WinEDA_DrawFrame::SetToolbars()
|
|||
|
||||
|
||||
/********************************************************/
|
||||
void WinEDA_DrawFrame::DisplayToolMsg( const wxString msg )
|
||||
void WinEDA_DrawFrame::DisplayToolMsg( const wxString& msg )
|
||||
/********************************************************/
|
||||
{
|
||||
SetStatusText( msg, 5 );
|
||||
|
@ -695,10 +695,14 @@ void WinEDA_DrawFrame::Affiche_Status_Box()
|
|||
if( !screen )
|
||||
return;
|
||||
|
||||
/* affichage Zoom et coordonnees absolues */
|
||||
Line.Printf( wxT( "Z %d" ), screen->GetZoom() );
|
||||
/* Display Zoom level: zoom = zoom_coeff/ZoomScalar */
|
||||
if ( (screen->GetZoom() % screen->m_ZoomScalar) == 0 )
|
||||
Line.Printf( wxT( "Z %d" ),screen->GetZoom() / screen->m_ZoomScalar );
|
||||
else
|
||||
Line.Printf( wxT( "Z %.1f" ), (float)screen->GetZoom() / screen->m_ZoomScalar );
|
||||
SetStatusText( Line, 1 );
|
||||
|
||||
/* Display absolute coordinates: */
|
||||
Line.Printf( g_UnitMetric ? wxT( "X %.3f Y %.3f" ) : wxT( "X %.4f Y %.4f" ),
|
||||
To_User_Unit( g_UnitMetric, screen->m_Curseur.x,
|
||||
m_InternalUnits ),
|
||||
|
@ -706,7 +710,7 @@ void WinEDA_DrawFrame::Affiche_Status_Box()
|
|||
m_InternalUnits ) );
|
||||
SetStatusText( Line, 2 );
|
||||
|
||||
/* affichage des coordonnees relatives */
|
||||
/* Display relative coordinates: */
|
||||
dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
|
||||
dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC )
|
|||
GRResetPenAndBrush( DC );
|
||||
DC->SetBackgroundMode( wxTRANSPARENT );
|
||||
#ifdef WX_ZOOM
|
||||
double scale = 1.0 / (double) GetZoom();
|
||||
double scale = GetScreen()->GetScalingFactor( );
|
||||
DC->SetUserScale( scale, scale );
|
||||
DoPrepareDC( *DC );
|
||||
#endif
|
||||
|
@ -306,8 +306,8 @@ void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition )
|
|||
wxPoint WinEDA_DrawPanel::CursorScreenPosition()
|
||||
/********************************************************/
|
||||
|
||||
/** CursorScreenPosition
|
||||
* @return the curseur position in pixels in the panel draw area on screen )
|
||||
/** Function CursorScreenPosition
|
||||
* @return the curseur current position in pixels in the screen draw area
|
||||
*/
|
||||
{
|
||||
wxPoint pos = GetScreen()->m_Curseur;
|
||||
|
@ -609,7 +609,7 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
|
|||
}
|
||||
|
||||
#ifdef WX_ZOOM
|
||||
double scale = 1.0 / (double) GetZoom();
|
||||
double scale = Screen->GetScalingFactor( );
|
||||
DC->SetUserScale( scale, scale );
|
||||
#endif
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
|||
/****************************************************************************************************/
|
||||
|
||||
/** Function DrawGraphicText
|
||||
* Draw a graphic text (like module texts)
|
||||
* Draw a graphic text (like module texts)
|
||||
* @param aPanel = the current DrawPanel. NULL if draw within a 3D GL Canvas
|
||||
* @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
|
||||
|
|
|
@ -226,7 +226,11 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
|
|||
/* Populate zoom submenu. */
|
||||
for( i = 0; i < (size_t) maxZoomIds; i++ )
|
||||
{
|
||||
msg.Printf( wxT( "%u" ), GetScreen()->m_ZoomList[i] );
|
||||
if ( (GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar) == 0 )
|
||||
msg.Printf( wxT( "%u" ), GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar);
|
||||
else
|
||||
msg.Printf(wxT("%.1f"),(float)GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar );
|
||||
|
||||
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
|
||||
wxEmptyString, wxITEM_CHECK );
|
||||
if( zoom == GetScreen()->m_ZoomList[i] )
|
||||
|
|
|
@ -18,10 +18,6 @@
|
|||
|
||||
WX_DEFINE_OBJARRAY( ArrayOfSheetLists );
|
||||
|
||||
/***************************/
|
||||
/* class SCH_COMPONENT */
|
||||
/***************************/
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
|
||||
|
|
|
@ -17,22 +17,25 @@
|
|||
|
||||
#include "protos.h"
|
||||
|
||||
/**************************************************************/
|
||||
SCH_ITEM * WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool IncludePin )
|
||||
/**************************************************************/
|
||||
/**************************************************************************************/
|
||||
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool IncludePin )
|
||||
/**************************************************************************************/
|
||||
|
||||
/* Routine de localisation et d'affichage des caract (si utile )
|
||||
* de l'element pointe par la souris ou par le curseur pcb
|
||||
* - marqueur
|
||||
/** Function SchematicGeneralLocateAndDisplay
|
||||
* Overlayed function
|
||||
* Find the schematic item at cursor position
|
||||
* the priority order is:
|
||||
* - marker
|
||||
* - noconnect
|
||||
* - jonction
|
||||
* - junction
|
||||
* - wire/bus/entry
|
||||
* - label
|
||||
* - composant
|
||||
* - pin
|
||||
* retourne
|
||||
* un pointeur sur le composant
|
||||
* Null sinon
|
||||
* - component
|
||||
* @return an EDA_BaseStruct pointer on the item or NULL if no item found
|
||||
* @param IncludePin = true to search for pins, fase to ignore them
|
||||
*
|
||||
* For some items, caracteristics are displayed on the screen.
|
||||
*/
|
||||
{
|
||||
SCH_ITEM* DrawStruct;
|
||||
|
@ -55,7 +58,7 @@ SCH_ITEM * WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Includ
|
|||
case DRAW_PART_TEXT_STRUCT_TYPE:
|
||||
case COMPONENT_FIELD_DRAW_TYPE:
|
||||
LibItem = (SCH_COMPONENT*) DrawStruct->GetParent();
|
||||
SendMessageToPCBNEW( DrawStruct,LibItem );
|
||||
SendMessageToPCBNEW( DrawStruct, LibItem );
|
||||
break;
|
||||
|
||||
case TYPE_SCH_COMPONENT:
|
||||
|
@ -81,8 +84,8 @@ SCH_ITEM * WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Includ
|
|||
Pin->Display_Infos( this );
|
||||
if( LibItem )
|
||||
Affiche_1_Parametre( this, 1,
|
||||
LibItem->GetRef(GetSheet()),
|
||||
LibItem->GetField(VALUE)->m_Text,
|
||||
LibItem->GetRef( GetSheet() ),
|
||||
LibItem->GetField( VALUE )->m_Text,
|
||||
CYAN );
|
||||
|
||||
// Cross probing:2 - pin found, and send a locate pin command to pcbnew (hightlight net)
|
||||
|
@ -92,11 +95,14 @@ SCH_ITEM * WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Includ
|
|||
}
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
|
||||
/************************************************************************************/
|
||||
/********************************************************************************************/
|
||||
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
|
||||
bool IncludePin )
|
||||
/********************************************************************************************/
|
||||
|
||||
/* Find the schematic item at position "refpoint"
|
||||
/** Function SchematicGeneralLocateAndDisplay
|
||||
* Overlayed function
|
||||
* Find the schematic item at a given position
|
||||
* the priority order is:
|
||||
* - marker
|
||||
* - noconnect
|
||||
|
@ -105,9 +111,9 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
|
|||
* - label
|
||||
* - pin
|
||||
* - component
|
||||
* return:
|
||||
* an EDA_BaseStruct pointer on the item
|
||||
* a Null pointer if no item found
|
||||
* @return an EDA_BaseStruct pointer on the item or NULL if no item found
|
||||
* @param refpoint = the wxPoint loaction where to search
|
||||
* @param IncludePin = true to search for pins, fase to ignore them
|
||||
*
|
||||
* For some items, caracteristics are displayed on the screen.
|
||||
*/
|
||||
|
@ -147,7 +153,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
|
|||
}
|
||||
|
||||
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), WIREITEM | BUSITEM | RACCORDITEM );
|
||||
if( DrawStruct ) // Search for a pin
|
||||
if( DrawStruct ) // We have found a wire: Search for a connected pin at the same location
|
||||
{
|
||||
Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
|
||||
if( Pin )
|
||||
|
@ -155,8 +161,8 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
|
|||
Pin->Display_Infos( this );
|
||||
if( LibItem )
|
||||
Affiche_1_Parametre( this, 1,
|
||||
LibItem->GetRef(GetSheet()),
|
||||
LibItem->GetField(VALUE)->m_Text,
|
||||
LibItem->GetRef( GetSheet() ),
|
||||
LibItem->GetField( VALUE )->m_Text,
|
||||
CYAN );
|
||||
}
|
||||
else
|
||||
|
@ -181,8 +187,8 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
|
|||
Pin->Display_Infos( this );
|
||||
if( LibItem )
|
||||
Affiche_1_Parametre( this, 1,
|
||||
LibItem->GetRef(GetSheet()),
|
||||
LibItem->GetField(VALUE)->m_Text,
|
||||
LibItem->GetRef( GetSheet() ),
|
||||
LibItem->GetField( VALUE )->m_Text,
|
||||
CYAN );
|
||||
if( IncludePin == TRUE )
|
||||
return LibItem;
|
||||
|
@ -191,13 +197,13 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
|
|||
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), LIBITEM );
|
||||
if( DrawStruct )
|
||||
{
|
||||
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
|
||||
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*) GetScreen() );
|
||||
LibItem = (SCH_COMPONENT*) DrawStruct;
|
||||
LibItem->Display_Infos( this );
|
||||
return DrawStruct;
|
||||
}
|
||||
|
||||
DrawStruct = (SCH_ITEM*)PickStruct( refpoint, GetScreen(), SHEETITEM );
|
||||
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SHEETITEM );
|
||||
if( DrawStruct )
|
||||
{
|
||||
( (DrawSheetStruct*) DrawStruct )->Display_Infos( this );
|
||||
|
@ -205,7 +211,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
|
|||
}
|
||||
|
||||
// Recherche des autres elements
|
||||
DrawStruct = (SCH_ITEM*)PickStruct( refpoint, GetScreen(), SEARCHALL );
|
||||
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SEARCHALL );
|
||||
if( DrawStruct )
|
||||
{
|
||||
return DrawStruct;
|
||||
|
@ -305,7 +311,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
|
|||
OnHotKey( DC, hotkey, NULL );
|
||||
}
|
||||
|
||||
Affiche_Status_Box(); /* Affichage des coord curseur */
|
||||
Affiche_Status_Box(); /* Display cursor coordintes info */
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
@ -403,6 +409,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
|
|||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
|
||||
wxPoint MousePositionInPixels )
|
||||
|
|
|
@ -219,7 +219,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
|
|||
SheetSize.x *= m_Parent->m_InternalUnits / 1000;
|
||||
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels
|
||||
|
||||
screen->SetZoom( 1 );
|
||||
screen->SetScalingFactor( 1.0 );
|
||||
dpi = (float) SheetSize.x * 25.4 / m_ImageXSize_mm;
|
||||
|
||||
WinEDA_DrawPanel* panel = m_Parent->DrawPanel;
|
||||
|
|
|
@ -404,7 +404,7 @@ void EDA_Printout::DrawPage()
|
|||
double scaleX, scaleY, scale;
|
||||
wxPoint old_org;
|
||||
wxPoint DrawOffset; // Offset de trace
|
||||
int DrawZoom = 1;
|
||||
double DrawZoom = 1;
|
||||
wxDC* dc = GetDC();
|
||||
|
||||
wxBusyCursor dummy;
|
||||
|
@ -416,7 +416,7 @@ void EDA_Printout::DrawPage()
|
|||
tmpzoom = ActiveScreen->GetZoom();
|
||||
old_org = ActiveScreen->m_DrawOrg;
|
||||
/* Change draw scale and offset to draw the whole page */
|
||||
ActiveScreen->SetZoom( DrawZoom );
|
||||
ActiveScreen->SetScalingFactor( DrawZoom );
|
||||
ActiveScreen->m_DrawOrg.x = ActiveScreen->m_DrawOrg.y = 0;
|
||||
ActiveScreen->m_StartVisu.x = ActiveScreen->m_StartVisu.y = 0;
|
||||
|
||||
|
|
|
@ -115,7 +115,16 @@ public:
|
|||
bool OnRightClick( wxMouseEvent& event );
|
||||
void OnPopupGridSelect( wxCommandEvent& event );
|
||||
void Process_Special_Functions( wxCommandEvent& event );
|
||||
|
||||
/** Function CursorRealPosition
|
||||
* @return the position in user units of location ScreenPos
|
||||
* @param ScreenPos = the screen (in pixel) position co convert
|
||||
*/
|
||||
wxPoint CursorRealPosition( const wxPoint& ScreenPos );
|
||||
|
||||
/** Function CursorScreenPosition
|
||||
* @return the curseur current position in pixels in the screen draw area
|
||||
*/
|
||||
wxPoint CursorScreenPosition();
|
||||
|
||||
/**
|
||||
|
@ -303,6 +312,10 @@ public:
|
|||
wxSize ReturnPageSize( void );
|
||||
virtual int GetInternalUnits( void );
|
||||
|
||||
/** Function CursorRealPosition
|
||||
* @return the position in user units of location ScreenPos
|
||||
* @param ScreenPos = the screen (in pixel) position co convert
|
||||
*/
|
||||
wxPoint CursorRealPosition( const wxPoint& ScreenPos );
|
||||
|
||||
/* general Undo/Redo command control */
|
||||
|
@ -326,9 +339,27 @@ public:
|
|||
|
||||
//----<zoom stuff>----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Function GetZoom
|
||||
* returns the current zoom factor
|
||||
/** Function GetScalingFactor
|
||||
* @return the the current scale used to draw items on screen
|
||||
* draw coordinates are user coordinates * GetScalingFactor( )
|
||||
*/
|
||||
double GetScalingFactor( )
|
||||
{
|
||||
return (double) m_ZoomScalar / GetZoom();
|
||||
}
|
||||
|
||||
/** Function SetScalingFactor
|
||||
* @param the the current scale used to draw items on screen
|
||||
* draw coordinates are user coordinates * GetScalingFactor( )
|
||||
*/
|
||||
void SetScalingFactor(double aScale )
|
||||
{
|
||||
SetZoom( (int) round(aScale * m_ZoomScalar) );
|
||||
}
|
||||
/** Function GetZoom
|
||||
* @return the current zoom factor
|
||||
* Note: the zoom factor is NOT the scaling factor
|
||||
* the scaling factor is m_ZoomScalar * GetZoom()
|
||||
*/
|
||||
int GetZoom() const;
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ public:
|
|||
*/
|
||||
wxString GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition );
|
||||
|
||||
void DisplayToolMsg( const wxString msg );
|
||||
void DisplayToolMsg( const wxString& msg );
|
||||
void Process_Zoom( wxCommandEvent& event );
|
||||
void Process_Grid( wxCommandEvent& event );
|
||||
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
|
||||
|
|
|
@ -363,6 +363,9 @@ void WinEDA_BasePcbFrame::SetToolID( int id, int new_cursor_id,
|
|||
}
|
||||
|
||||
void WinEDA_BasePcbFrame::Affiche_Status_Box()
|
||||
/*
|
||||
* Update the status bar information.
|
||||
*/
|
||||
{
|
||||
wxString Line;
|
||||
int dx, dy;
|
||||
|
|
|
@ -238,7 +238,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
|
|||
SheetSize.x *= m_Parent->m_InternalUnits / 1000;
|
||||
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels
|
||||
|
||||
screen->SetZoom( 1 );
|
||||
screen->SetScalingFactor( 1.0 );
|
||||
dpi = (float) SheetSize.x * 25.4 / m_ImageXSize_mm;
|
||||
|
||||
WinEDA_DrawPanel* panel = m_Parent->DrawPanel;
|
||||
|
|
|
@ -564,7 +564,7 @@ void EDA_Printout::DrawPage()
|
|||
wxPoint old_org;
|
||||
wxPoint DrawOffset; // Offset de trace
|
||||
double userscale;
|
||||
int DrawZoom = 1;
|
||||
double DrawZoom = 1;
|
||||
wxDC* dc = GetDC();
|
||||
|
||||
s_PrintMirror = m_PrintFrame->IsMirrored();
|
||||
|
@ -578,7 +578,7 @@ void EDA_Printout::DrawPage()
|
|||
tmpzoom = ActiveScreen->GetZoom();
|
||||
old_org = ActiveScreen->m_DrawOrg;
|
||||
/* Change draw scale and offset to draw the whole page */
|
||||
ActiveScreen->SetZoom( DrawZoom );
|
||||
ActiveScreen->SetScalingFactor( DrawZoom );
|
||||
ActiveScreen->m_DrawOrg.x = ActiveScreen->m_DrawOrg.y = 0;
|
||||
ActiveScreen->m_StartVisu.x = ActiveScreen->m_StartVisu.y = 0;
|
||||
|
||||
|
|
|
@ -592,7 +592,14 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
|
|||
for( int i = 0; i < (int)GetScreen()->m_ZoomList.GetCount(); i++ )
|
||||
{
|
||||
msg = _( "Zoom " );
|
||||
msg << GetScreen()->m_ZoomList[i];
|
||||
if ( (GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar) == 0 )
|
||||
msg << GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar;
|
||||
else
|
||||
{
|
||||
wxString value;
|
||||
value.Printf(wxT("%.1f"),(float)GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar );
|
||||
msg += value;
|
||||
}
|
||||
m_SelZoomBox->Append( msg );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue