Loading gerbview/tracepcb.cpp +109 −104 Original line number Original line Diff line number Diff line Loading @@ -3,8 +3,9 @@ /*****************************************/ /*****************************************/ /* fichier TRACEPCB.CPP */ /* fichier TRACEPCB.CPP */ /* /* Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ... * Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ... */ */ #include "fctsys.h" #include "fctsys.h" Loading @@ -29,8 +30,10 @@ void WinEDA_DrawPanel::PrintPage(wxDC *DC, bool Print_Sheet_Ref, int printmaskla DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt; save_opt = DisplayOpt; save_opt = DisplayOpt; if( printmasklayer & ALL_CU_LAYERS ) DisplayOpt.DisplayPadFill = FILLED; if( printmasklayer & ALL_CU_LAYERS ) else DisplayOpt.DisplayPadFill = SKETCH; DisplayOpt.DisplayPadFill = FILLED; else DisplayOpt.DisplayPadFill = SKETCH; DisplayOpt.DisplayPadNum = 0; DisplayOpt.DisplayPadNum = 0; DisplayOpt.DisplayPadNoConn = 0; DisplayOpt.DisplayPadNoConn = 0; DisplayOpt.DisplayPadIsol = 0; DisplayOpt.DisplayPadIsol = 0; Loading @@ -49,19 +52,23 @@ DISPLAY_OPTIONS save_opt; DisplayOpt = save_opt; DisplayOpt = save_opt; } } /*******************************************************************/ /*******************************************************************/ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) /*******************************************************************/ /*******************************************************************/ /* Trace le PCB, et les elements complementaires ( axes, grille .. ) /* Trace le PCB, et les elements complementaires ( axes, grille .. ) */ */ { { PCB_SCREEN* screen = GetScreen(); PCB_SCREEN* screen = GetScreen(); if ( ! m_Pcb ) return; if( !m_Pcb ) return; ActiveScreen = screen; ActiveScreen = screen; GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY ); if ( EraseBg ) DrawPanel->EraseScreen(DC); if( EraseBg ) DrawPanel->EraseScreen( DC ); DrawPanel->DrawBackGround( DC ); DrawPanel->DrawBackGround( DC ); Loading @@ -75,13 +82,14 @@ PCB_SCREEN * screen = GetScreen(); DrawPanel->Trace_Curseur( DC ); DrawPanel->Trace_Curseur( DC ); } } /********************************************************/ /********************************************************/ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int mode ) void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int mode ) /********************************************************/ /********************************************************/ /* Trace l'ensemble des elements du PCB sur l'ecran actif*/ /* Trace l'ensemble des elements du PCB sur l'ecran actif*/ { { if( !m_Pcb ) if ( ! m_Pcb ) return; return; // Draw tracks and flashes // Draw tracks and flashes Trace_Pistes( DrawPanel, DC, m_Pcb, mode ); Trace_Pistes( DrawPanel, DC, m_Pcb, mode ); Loading Loading @@ -138,6 +146,3 @@ void WinEDA_GerberFrame::Trace_Gerber(wxDC * DC, int mode) GetScreen()->ClrRefreshReq(); GetScreen()->ClrRefreshReq(); } } share/drawframe.cpp +625 −563 Original line number Original line Diff line number Diff line Loading @@ -65,12 +65,13 @@ wxSize minsize; m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch // nombre d'unites internes pour 1 pouce // nombre d'unites internes pour 1 pouce // = 1000 pour schema, = 10000 pour PCB // = 1000 pour schema, = 10000 pour PCB m_InternalUnits = EESCHEMA_INTERNAL_UNIT; m_InternalUnits = EESCHEMA_INTERNAL_UNIT; if( (m_Ident == PCB_FRAME) || (m_Ident == GERBER_FRAME) || if( (m_Ident == PCB_FRAME) || (m_Ident == GERBER_FRAME) (m_Ident == CVPCB_DISPLAY_FRAME) || || (m_Ident == CVPCB_DISPLAY_FRAME) (m_Ident == MODULE_EDITOR_FRAME) || (m_Ident == MODULE_EDITOR_FRAME) ) ) m_InternalUnits = PCB_INTERNAL_UNIT; m_InternalUnits = PCB_INTERNAL_UNIT; Loading @@ -83,13 +84,14 @@ wxSize minsize; SetSize( 0, 0, minsize.x, minsize.y ); SetSize( 0, 0, minsize.x, minsize.y ); // Creation de la ligne de status // Creation de la ligne de status int dims[6] = { -1, 60, 130, 130, 40, 100}; static const int dims[6] = { -1, 60, 130, 130, 40, 100 }; CreateStatusBar( 6 ); CreateStatusBar( 6 ); SetStatusWidths( 6, dims ); SetStatusWidths( 6, dims ); // Create child subwindows. // Create child subwindows. GetClientSize( &m_FrameSize.x, &m_FrameSize.y );/* dimx, dimy = dimensions utiles de la GetClientSize( &m_FrameSize.x, &m_FrameSize.y );/* dimx, dimy = dimensions utiles de la zone utilisateur de la fenetre principale */ * zone utilisateur de la fenetre principale */ m_FramePos.x = m_FramePos.y = 0; m_FramePos.x = m_FramePos.y = 0; m_FrameSize.y -= m_MsgFrameHeight; m_FrameSize.y -= m_MsgFrameHeight; Loading @@ -102,9 +104,9 @@ int dims[6] = { -1, 60, 130, 130, 40, 100}; ColorRefs[LIGHTGRAY].m_Green, ColorRefs[LIGHTGRAY].m_Green, ColorRefs[LIGHTGRAY].m_Blue ) ); ColorRefs[LIGHTGRAY].m_Blue ) ); } } } } /****************************************/ /****************************************/ WinEDA_DrawFrame::~WinEDA_DrawFrame( void ) WinEDA_DrawFrame::~WinEDA_DrawFrame( void ) /****************************************/ /****************************************/ Loading @@ -117,10 +119,12 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame(void) /****************************************************************/ /****************************************************************/ void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu ) void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu ) /*****************************************************************/ /*****************************************************************/ /* create the submenu for fonte selection and setup fonte size /* create the submenu for fonte selection and setup font size */ */ { { wxMenu* fontmenu = new wxMenu(); wxMenu* fontmenu = new wxMenu(); ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_DIALOG, _( "font for dialog boxes" ), ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_DIALOG, _( "font for dialog boxes" ), fonts_xpm ); fonts_xpm ); ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_INFOSCREEN, _( "font for info display" ), ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_INFOSCREEN, _( "font for info display" ), Loading @@ -133,6 +137,7 @@ wxMenu * fontmenu = new wxMenu(); fonts_xpm ); fonts_xpm ); } } /********************************************************************/ /********************************************************************/ void WinEDA_DrawFrame::ProcessFontPreferences( wxCommandEvent& event ) void WinEDA_DrawFrame::ProcessFontPreferences( wxCommandEvent& event ) /********************************************************************/ /********************************************************************/ Loading @@ -142,14 +147,12 @@ wxFont font; switch( id ) switch( id ) { { case ID_PREFERENCES_FONT: case ID_PREFERENCES_FONT: case ID_PREFERENCES_FONT_DIALOG: case ID_PREFERENCES_FONT_DIALOG: case ID_PREFERENCES_FONT_STATUS: case ID_PREFERENCES_FONT_STATUS: WinEDA_BasicFrame::ProcessFontPreferences( id ); WinEDA_BasicFrame::ProcessFontPreferences( id ); break; break; case ID_PREFERENCES_FONT_INFOSCREEN: case ID_PREFERENCES_FONT_INFOSCREEN: { { font = wxGetFontFromUser( this, *g_MsgFont ); font = wxGetFontFromUser( this, *g_MsgFont ); Loading @@ -161,26 +164,32 @@ wxFont font; } } break; break; } } default: DisplayError(this, wxT("WinEDA_DrawFrame::ProcessFontPreferences Internal Error") ); default: DisplayError( this, wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) ); break; break; } } } } /**************************************************************/ /**************************************************************/ void WinEDA_DrawFrame::Affiche_Message( const wxString& message ) void WinEDA_DrawFrame::Affiche_Message( const wxString& message ) /**************************************************************/ /**************************************************************/ /* /* Affiche un message en bas de l'ecran * Affiche un message en bas de l'ecran */ */ { { SetStatusText( message ); SetStatusText( message ); } } /****************************************/ /****************************************/ void WinEDA_DrawFrame::EraseMsgBox( void ) void WinEDA_DrawFrame::EraseMsgBox( void ) /****************************************/ /****************************************/ { { if ( MsgPanel ) MsgPanel->EraseMsgBox(); if( MsgPanel ) MsgPanel->EraseMsgBox(); } } Loading @@ -200,7 +209,8 @@ void WinEDA_DrawFrame::OnActivate(wxActivateEvent& event) void WinEDA_DrawFrame::OnMenuOpen( wxMenuEvent& event ) void WinEDA_DrawFrame::OnMenuOpen( wxMenuEvent& event ) /****************************************************/ /****************************************************/ { { if ( DrawPanel ) DrawPanel->m_CanStartBlock = -1; if( DrawPanel ) DrawPanel->m_CanStartBlock = -1; event.Skip(); event.Skip(); } } Loading @@ -211,12 +221,14 @@ void WinEDA_DrawFrame::ReCreateAuxiliaryToolbar(void) // fonction virtuelle { { } } /********************************************/ /********************************************/ void WinEDA_DrawFrame::ReCreateMenuBar( void ) // fonction virtuelle void WinEDA_DrawFrame::ReCreateMenuBar( void ) // fonction virtuelle /********************************************/ /********************************************/ { { } } /****************************************************/ /****************************************************/ void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey, void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ) // fonction virtuelle EDA_BaseStruct* DrawStruct ) // fonction virtuelle Loading @@ -225,21 +237,23 @@ void WinEDA_DrawFrame::OnHotKey(wxDC * DC, int hotkey, } } /**************************************************************/ /**************************************************************/ void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event ) // fonction virtuelle void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event ) // fonction virtuelle /**************************************************************/ /**************************************************************/ { { } } /********************************************************/ /********************************************************/ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event ) // fonction virtuelle void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event ) // fonction virtuelle /********************************************************/ /********************************************************/ { { if ( m_SelGridBox == NULL ) return; //Ne devrait pas se produire! if( m_SelGridBox == NULL ) return; //Ne devrait pas se produire! int id = m_SelGridBox->GetChoice(); int id = m_SelGridBox->GetChoice(); if ( id < 0 ) return; if( id < 0 ) return; m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); wxSize grid = m_CurrentScreen->GetGrid(); wxSize grid = m_CurrentScreen->GetGrid(); Loading @@ -254,34 +268,40 @@ wxSize newgrid = m_CurrentScreen->GetGrid(); /**************************************************************/ /**************************************************************/ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) /**************************************************************/ /**************************************************************/ /* Fonction virtuelle /* Fonction virtuelle traitement des touches de fonctions utilisees ds tous les menus * traitement des touches de fonctions utilisees ds tous les menus Zoom * Zoom Redessin d'ecran * Redessin d'ecran Cht Unites * Cht Unites Cht couches * Cht couches Remise a 0 de l'origine des coordonnees relatives * Remise a 0 de l'origine des coordonnees relatives */ */ { { } } #endif #endif /********************************************************/ /********************************************************/ void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtuelle void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtuelle /********************************************************/ /********************************************************/ /* Set the zoom when selected by the Zoom List Box /* Set the zoom when selected by the Zoom List Box Note: * Note: position 0 = Fit in Page * position 0 = Fit in Page position >= 1 = zoom (1 to zoom max) * position >= 1 = zoom (1 to zoom max) last position : special zoom * last position : special zoom */ */ { { if ( m_SelZoomBox == NULL ) return; //Ne devrait pas se produire! if( m_SelZoomBox == NULL ) return; //Ne devrait pas se produire! int id = m_SelZoomBox->GetChoice(); int id = m_SelZoomBox->GetChoice(); if ( id < 0 ) return; // No selection if( id < 0 ) return; // No selection if( id == 0 ) // Auto zoom (Fit in Page) if( id == 0 ) // Auto zoom (Fit in Page) { { Loading @@ -293,14 +313,17 @@ int id = m_SelZoomBox->GetChoice(); { { id--; id--; int zoom = 1 << id; int zoom = 1 << id; if ( zoom > m_ZoomMaxValue ) zoom = m_ZoomMaxValue; if( zoom > m_ZoomMaxValue ) if ( m_CurrentScreen->GetZoom() == zoom) return; zoom = m_ZoomMaxValue; if( m_CurrentScreen->GetZoom() == zoom ) return; m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); m_CurrentScreen->SetZoom( zoom ); m_CurrentScreen->SetZoom( zoom ); Recadre_Trace( FALSE ); Recadre_Trace( FALSE ); } } } } /********************************************************/ /********************************************************/ void WinEDA_DrawFrame::OnMouseEvent( wxMouseEvent& event ) void WinEDA_DrawFrame::OnMouseEvent( wxMouseEvent& event ) /********************************************************/ /********************************************************/ Loading @@ -309,15 +332,15 @@ void WinEDA_DrawFrame::OnMouseEvent(wxMouseEvent& event) } } /***********************************************************************/ /***********************************************************************/ // Virtuelle // Virtuelle void WinEDA_DrawFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_DrawFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) /***********************************************************************/ /***********************************************************************/ { { } } /***************************************/ /***************************************/ void WinEDA_DrawFrame::SetToolbars( void ) void WinEDA_DrawFrame::SetToolbars( void ) /***************************************/ /***************************************/ Loading @@ -325,6 +348,7 @@ void WinEDA_DrawFrame::SetToolbars(void) DisplayUnitsMsg(); DisplayUnitsMsg(); } } /********************************************************/ /********************************************************/ void WinEDA_DrawFrame::DisplayToolMsg( const wxString msg ) void WinEDA_DrawFrame::DisplayToolMsg( const wxString msg ) /********************************************************/ /********************************************************/ Loading @@ -332,9 +356,11 @@ void WinEDA_DrawFrame::DisplayToolMsg(const wxString msg) SetStatusText( msg, 5 ); SetStatusText( msg, 5 ); } } /*******************************************/ /*******************************************/ void WinEDA_DrawFrame::DisplayUnitsMsg( void ) void WinEDA_DrawFrame::DisplayUnitsMsg( void ) /********************************************/ /********************************************/ /* Display current unit Selection on Statusbar /* Display current unit Selection on Statusbar */ */ { { Loading @@ -345,9 +371,11 @@ wxString msg; case INCHES: case INCHES: msg = _( "Inch" ); msg = _( "Inch" ); break; break; case MILLIMETRE: case MILLIMETRE: msg += _( "mm" ); msg += _( "mm" ); break; break; default: default: msg += _( "??" ); msg += _( "??" ); break; break; Loading @@ -356,20 +384,25 @@ wxString msg; SetStatusText( msg, 4 ); SetStatusText( msg, 4 ); } } /***************************************/ /***************************************/ void WinEDA_DrawFrame::ReDrawPanel( void ) void WinEDA_DrawFrame::ReDrawPanel( void ) /***************************************/ /***************************************/ { { if ( DrawPanel == NULL ) return; if( DrawPanel == NULL ) return; wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel ); DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->ReDraw( &dc ); DrawPanel->ReDraw( &dc ); } } /**************************************************/ /**************************************************/ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv ) void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv ) /**************************************************/ /**************************************************/ /* recalcule les dimensions des toolbars et du panel d'affichage /* recalcule les dimensions des toolbars et du panel d'affichage */ */ { { Loading Loading @@ -438,18 +471,20 @@ wxSize Auxtoolbar_size; SizeEv.Skip(); SizeEv.Skip(); } } /*************************************************************************/ /*************************************************************************/ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, const wxString& title ) const wxString& title ) /*************************************************************************/ /*************************************************************************/ /* /* Active l'icone de l'outil selectionne dans le toolbar Vertical * Active l'icone de l'outil selectionne dans le toolbar Vertical ( ou l'outil par defaut ID_NO_SELECT_BUTT si pas de nouvelle selection ) * ( ou l'outil par defaut ID_NO_SELECT_BUTT si pas de nouvelle selection ) if ( id >= 0 ) * if ( id >= 0 ) Met a jour toutes les variables associees: * Met a jour toutes les variables associees: message, m_ID_current_state, curseur * message, m_ID_current_state, curseur si ( id < 0 ) * si ( id < 0 ) Met a jour seulement les variables message et curseur * Met a jour seulement les variables message et curseur */ */ { { // Change Cursor // Change Cursor Loading @@ -461,31 +496,40 @@ si ( id < 0 ) SetCursor( wxCURSOR_ARROW ); SetCursor( wxCURSOR_ARROW ); DisplayToolMsg( title ); DisplayToolMsg( title ); if ( id < 0 ) return; if( id < 0 ) return; // Old Tool Inactif ou ID_NO_SELECT_BUTT actif si pas de nouveau Tool // Old Tool Inactif ou ID_NO_SELECT_BUTT actif si pas de nouveau Tool if( m_ID_current_state ) if( m_ID_current_state ) { { if ( m_VToolBar ) m_VToolBar->ToggleTool(m_ID_current_state, FALSE); if( m_VToolBar ) if ( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool(m_ID_current_state, FALSE); m_VToolBar->ToggleTool( m_ID_current_state, FALSE ); if( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE ); } } else else { { if( id ) if( id ) { { if ( m_VToolBar ) m_VToolBar->ToggleTool(ID_NO_SELECT_BUTT, FALSE); if( m_VToolBar ) if ( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool(m_ID_current_state, FALSE); m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, FALSE ); if( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE ); } } else if ( m_VToolBar ) m_VToolBar->ToggleTool(ID_NO_SELECT_BUTT, TRUE); else if( m_VToolBar ) m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE ); } } // New Tool Actif // New Tool Actif if( id ) if( id ) { { if ( m_VToolBar ) m_VToolBar->ToggleTool(id, TRUE); if( m_VToolBar ) if ( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool(id, TRUE); m_VToolBar->ToggleTool( id, TRUE ); if( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool( id, TRUE ); } } else if ( m_VToolBar ) m_VToolBar->ToggleTool(ID_NO_SELECT_BUTT, TRUE); else if( m_VToolBar ) m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE ); m_ID_current_state = id; m_ID_current_state = id; } } Loading @@ -496,12 +540,13 @@ void WinEDA_DrawFrame::OnZoom(int zoom_type) /********************************************/ /********************************************/ /* Fonction de traitement du zoom /* Fonction de traitement du zoom Modifie le facteur de zoom et reaffiche l'ecran * Modifie le facteur de zoom et reaffiche l'ecran Pour les commandes par menu Popup ou par le clavier, le curseur est * Pour les commandes par menu Popup ou par le clavier, le curseur est replac au centre de l'ecran * replac au centre de l'ecran */ */ { { if ( DrawPanel == NULL ) return; if( DrawPanel == NULL ) return; bool move_mouse_cursor = FALSE; bool move_mouse_cursor = FALSE; int x, y; int x, y; Loading @@ -515,6 +560,7 @@ wxPoint old_pos; case ID_POPUP_ZOOM_PLUS: case ID_POPUP_ZOOM_PLUS: case ID_ZOOM_PLUS_KEY: case ID_ZOOM_PLUS_KEY: move_mouse_cursor = TRUE; move_mouse_cursor = TRUE; case ID_ZOOM_PLUS_BUTT: case ID_ZOOM_PLUS_BUTT: if( zoom_type == ID_ZOOM_PLUS_BUTT ) if( zoom_type == ID_ZOOM_PLUS_BUTT ) m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); Loading @@ -525,6 +571,7 @@ wxPoint old_pos; case ID_POPUP_ZOOM_MOINS: case ID_POPUP_ZOOM_MOINS: case ID_ZOOM_MOINS_KEY: case ID_ZOOM_MOINS_KEY: move_mouse_cursor = TRUE; move_mouse_cursor = TRUE; case ID_ZOOM_MOINS_BUTT: case ID_ZOOM_MOINS_BUTT: if( zoom_type == ID_ZOOM_MOINS_BUTT ) if( zoom_type == ID_ZOOM_MOINS_BUTT ) m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); Loading Loading @@ -567,32 +614,38 @@ wxPoint old_pos; break; break; default: wxMessageBox( wxT("WinEDA_DrawFrame::OnZoom switch Error") ); default: wxMessageBox( wxT( "WinEDA_DrawFrame::OnZoom switch Error" ) ); break; break; } } Affiche_Status_Box(); Affiche_Status_Box(); } } /**********************************************/ /**********************************************/ void WinEDA_DrawFrame::OnPanning( int direction ) void WinEDA_DrawFrame::OnPanning( int direction ) /**********************************************/ /**********************************************/ /* Fonction de traitement du zoom /* Fonction de traitement du zoom Modifie le facteur de zoom et reaffiche l'ecran * Modifie le facteur de zoom et reaffiche l'ecran Pour les commandes par menu Popup ou par le clavier, le curseur est * Pour les commandes par menu Popup ou par le clavier, le curseur est replac au centre de l'ecran * replac au centre de l'ecran */ */ { { if ( DrawPanel == NULL ) return; if( DrawPanel == NULL ) return; int delta; int delta; wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel ); int x, y; int x, y; DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->GetViewStart( &x, &y ); // x and y are in scroll unit, not in pixels DrawPanel->GetViewStart( &x, &y ); // x and y are in scroll unit, not in pixels delta = DrawPanel->m_ScrollButt_unit; delta = DrawPanel->m_ScrollButt_unit; switch( direction ) switch( direction ) { { case ID_ZOOM_PANNING_UP: case ID_ZOOM_PANNING_UP: Loading @@ -611,7 +664,8 @@ int x,y; x += delta; x += delta; break; break; default: wxMessageBox( wxT("WinEDA_DrawFrame::OnPanning Error") ); default: wxMessageBox( wxT( "WinEDA_DrawFrame::OnPanning Error" ) ); break; break; } } Loading @@ -630,29 +684,31 @@ void WinEDA_DrawFrame::OnGrid(int grid_type) { { } } int WinEDA_DrawFrame::ReturnBlockCommand( int key ) int WinEDA_DrawFrame::ReturnBlockCommand( int key ) { { return 0; return 0; } } void WinEDA_DrawFrame::InitBlockPasteInfos() void WinEDA_DrawFrame::InitBlockPasteInfos() { { GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL; } } void WinEDA_DrawFrame::HandleBlockPlace( wxDC* DC ) void WinEDA_DrawFrame::HandleBlockPlace( wxDC* DC ) { { } } int WinEDA_DrawFrame::HandleBlockEnd( wxDC* DC ) int WinEDA_DrawFrame::HandleBlockEnd( wxDC* DC ) { { return 0; return 0; } } /*********************************************/ /*********************************************/ void WinEDA_DrawFrame::AdjustScrollBars( void ) void WinEDA_DrawFrame::AdjustScrollBars( void ) /*********************************************/ /*********************************************/ Loading @@ -663,8 +719,10 @@ wxPoint scrollbar_pos; int zoom = m_CurrentScreen->GetZoom(); int zoom = m_CurrentScreen->GetZoom(); int xUnit, yUnit; int xUnit, yUnit; if ( m_CurrentScreen == NULL) return; if( m_CurrentScreen == NULL ) if ( DrawPanel == NULL ) return; return; if( DrawPanel == NULL ) return; draw_size = m_CurrentScreen->ReturnPageSize(); draw_size = m_CurrentScreen->ReturnPageSize(); Loading Loading @@ -700,8 +758,10 @@ int xUnit, yUnit; xUnit = yUnit = DrawPanel->m_Scroll_unit; xUnit = yUnit = DrawPanel->m_Scroll_unit; if (xUnit <= 1 ) xUnit = 1; if( xUnit <= 1 ) if (yUnit <= 1 ) yUnit = 1; xUnit = 1; if( yUnit <= 1 ) yUnit = 1; xUnit *= zoom; yUnit *= zoom; xUnit *= zoom; yUnit *= zoom; // Calcul de la position, curseur place au centre d'ecran // Calcul de la position, curseur place au centre d'ecran Loading @@ -713,8 +773,10 @@ int xUnit, yUnit; scrollbar_pos.x -= panel_size.x / 2; scrollbar_pos.x -= panel_size.x / 2; scrollbar_pos.y -= panel_size.y / 2; scrollbar_pos.y -= panel_size.y / 2; if ( scrollbar_pos.x < 0 ) scrollbar_pos.x = 0; if( scrollbar_pos.x < 0 ) if ( scrollbar_pos.y < 0 ) scrollbar_pos.y = 0; scrollbar_pos.x = 0; if( scrollbar_pos.y < 0 ) scrollbar_pos.y = 0; scrollbar_pos.x /= xUnit; scrollbar_pos.x /= xUnit; scrollbar_pos.y /= yUnit; scrollbar_pos.y /= yUnit; Loading @@ -727,20 +789,20 @@ int xUnit, yUnit; m_CurrentScreen->m_ScrollbarNumber.y, m_CurrentScreen->m_ScrollbarNumber.y, m_CurrentScreen->m_ScrollbarPos.x, m_CurrentScreen->m_ScrollbarPos.x, m_CurrentScreen->m_ScrollbarPos.y, TRUE ); m_CurrentScreen->m_ScrollbarPos.y, TRUE ); } } /****************************************************/ /****************************************************/ void WinEDA_DrawFrame::SetDrawBgColor( int color_num ) void WinEDA_DrawFrame::SetDrawBgColor( int color_num ) /****************************************************/ /****************************************************/ /* met a jour la couleur de fond pour les tracs /* met a jour la couleur de fond pour les tracs seules les couleurs BLACK ou WHITE sont autorises * seules les couleurs BLACK ou WHITE sont autorises le parametre XorMode est mis a jour selon la couleur du fond * le parametre XorMode est mis a jour selon la couleur du fond */ */ { { if ( (color_num != WHITE) && (color_num != BLACK) ) color_num = BLACK; if( (color_num != WHITE) && (color_num != BLACK) ) color_num = BLACK; g_DrawBgColor = color_num; g_DrawBgColor = color_num; if( color_num == WHITE ) if( color_num == WHITE ) { { Loading @@ -757,7 +819,6 @@ void WinEDA_DrawFrame::SetDrawBgColor(int color_num) DrawPanel->SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red, DrawPanel->SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red, ColorRefs[g_DrawBgColor].m_Green, ColorRefs[g_DrawBgColor].m_Green, ColorRefs[g_DrawBgColor].m_Blue ) ); ColorRefs[g_DrawBgColor].m_Blue ) ); } } Loading @@ -775,13 +836,15 @@ int id = event.GetId(); /***********************************************/ /***********************************************/ void WinEDA_DrawFrame::Affiche_Status_Box( void ) void WinEDA_DrawFrame::Affiche_Status_Box( void ) /***********************************************/ /***********************************************/ /* Routine d'affichage du zoom et des coord curseur. /* Routine d'affichage du zoom et des coord curseur. */ */ { { wxString Line; wxString Line; int dx, dy; int dx, dy; if (GetScreen() == NULL ) return; if( GetScreen() == NULL ) return; /* affichage Zoom et coordonnees absolues */ /* affichage Zoom et coordonnees absolues */ Line.Printf( wxT( "Z %d" ), GetScreen()->GetZoom() ); Line.Printf( wxT( "Z %d" ), GetScreen()->GetZoom() ); Loading @@ -808,8 +871,10 @@ int dx, dy; if( DisplayOpt.DisplayPolarCood ) /* Display coordonnee polaire */ if( DisplayOpt.DisplayPolarCood ) /* Display coordonnee polaire */ { { double theta, ro; double theta, ro; if ( (dx == 0) && (dy == 0) ) theta = 0.0; if( (dx == 0) && (dy == 0) ) else theta = atan2( (double) - dy , (double) dx ); theta = 0.0; else theta = atan2( (double) -dy, (double) dx ); theta = theta * 180 / M_PI; theta = theta * 180 / M_PI; ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ); ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ); Loading @@ -820,6 +885,3 @@ int dx, dy; } } #endif #endif } } share/drawpanel.cpp +44 −33 Original line number Original line Diff line number Diff line Loading @@ -2,6 +2,7 @@ /* drawpanel.cpp - fonctions des classes du type WinEDA_DrawPanel */ /* drawpanel.cpp - fonctions des classes du type WinEDA_DrawPanel */ /******************************************************************/ /******************************************************************/ #ifdef __GNUG__ #ifdef __GNUG__ #pragma implementation #pragma implementation #endif #endif Loading @@ -12,12 +13,12 @@ #include "macros.h" #include "macros.h" #include "id.h" #include "id.h" /* defines locaux */ // defines locaux #define CURSOR_SIZE 12 /* taille de la croix du curseur PCB */ #define CURSOR_SIZE 12 // taille de la croix du curseur PCB /* Variables locales */ // Variables locales /* table des evenements captes par un WinEDA_DrawPanel */ // table des evenements captes par un WinEDA_DrawPanel BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) EVT_LEAVE_WINDOW(WinEDA_DrawPanel::OnMouseLeaving) EVT_LEAVE_WINDOW(WinEDA_DrawPanel::OnMouseLeaving) EVT_MOUSE_EVENTS(WinEDA_DrawPanel::OnMouseEvent) EVT_MOUSE_EVENTS(WinEDA_DrawPanel::OnMouseEvent) Loading @@ -31,12 +32,8 @@ BEGIN_EVENT_TABLE(WinEDA_DrawPanel, EDA_DRAW_PANEL) EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE, EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE, WinEDA_DrawPanel::Process_Popup_Zoom) WinEDA_DrawPanel::Process_Popup_Zoom) END_EVENT_TABLE() END_EVENT_TABLE() /***********************************************************/ /***********************************************************/ /* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */ /* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */ /***********************************************************/ /***********************************************************/ Loading Loading @@ -73,6 +70,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel(WinEDA_DrawFrame *parent, int id, m_CursorLevel = 0; m_CursorLevel = 0; } } /*********************************************************************************/ /*********************************************************************************/ void WinEDA_DrawPanel::Trace_Curseur(wxDC * DC, int color) void WinEDA_DrawPanel::Trace_Curseur(wxDC * DC, int color) /*********************************************************************************/ /*********************************************************************************/ Loading Loading @@ -109,6 +107,7 @@ wxPoint Cursor = GetScreen()->m_Curseur; } } } } /*******************************************************************/ /*******************************************************************/ void WinEDA_DrawPanel::CursorOff(wxDC * DC) void WinEDA_DrawPanel::CursorOff(wxDC * DC) /*******************************************************************/ /*******************************************************************/ Loading @@ -120,6 +119,7 @@ void WinEDA_DrawPanel::CursorOff(wxDC * DC) --m_CursorLevel; --m_CursorLevel; } } /*******************************************************************/ /*******************************************************************/ void WinEDA_DrawPanel::CursorOn(wxDC * DC) void WinEDA_DrawPanel::CursorOn(wxDC * DC) /*******************************************************************/ /*******************************************************************/ Loading @@ -142,6 +142,7 @@ int WinEDA_DrawPanel::GetZoom(void) return GetScreen()->GetZoom(); return GetScreen()->GetZoom(); } } /***************************************/ /***************************************/ void WinEDA_DrawPanel::SetZoom(int zoom) void WinEDA_DrawPanel::SetZoom(int zoom) /***************************************/ /***************************************/ Loading @@ -149,6 +150,7 @@ void WinEDA_DrawPanel::SetZoom(int zoom) GetScreen()->SetZoom(zoom); GetScreen()->SetZoom(zoom); } } /************************************/ /************************************/ wxSize WinEDA_DrawPanel::GetGrid(void) wxSize WinEDA_DrawPanel::GetGrid(void) /************************************/ /************************************/ Loading Loading @@ -211,6 +213,7 @@ wxPoint curpos; return curpos; return curpos; } } /********************************************************/ /********************************************************/ bool WinEDA_DrawPanel::IsPointOnDisplay(wxPoint ref_pos) bool WinEDA_DrawPanel::IsPointOnDisplay(wxPoint ref_pos) /********************************************************/ /********************************************************/ Loading Loading @@ -262,6 +265,7 @@ wxPoint curpos = GetScreen()->m_Curseur; return curpos; return curpos; } } /*********************************************************/ /*********************************************************/ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition(void) wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition(void) /*********************************************************/ /*********************************************************/ Loading Loading @@ -292,6 +296,7 @@ wxPoint Mouse = CursorScreenPosition(); MouseTo(Mouse); MouseTo(Mouse); } } /****************************************************/ /****************************************************/ void WinEDA_DrawPanel::MouseTo(const wxPoint & Mouse) void WinEDA_DrawPanel::MouseTo(const wxPoint & Mouse) /****************************************************/ /****************************************************/ Loading Loading @@ -472,9 +477,12 @@ void WinEDA_DrawPanel::ReDraw(wxDC * DC, bool erasebg) { { BASE_SCREEN * Screen = GetScreen(); BASE_SCREEN * Screen = GetScreen(); if ( Screen == NULL ) return; if( Screen == NULL ) return; if( (g_DrawBgColor != WHITE) && (g_DrawBgColor != BLACK) ) g_DrawBgColor = BLACK; if ( (g_DrawBgColor != WHITE) && (g_DrawBgColor != BLACK) ) g_DrawBgColor = BLACK; if( g_DrawBgColor == WHITE ) if( g_DrawBgColor == WHITE ) { { g_XorMode = GR_NXOR; g_XorMode = GR_NXOR; Loading @@ -492,8 +500,9 @@ double f_scale = 1.0/(double)zoom; DC->SetUserScale(f_scale, f_scale); DC->SetUserScale(f_scale, f_scale); #endif #endif if(erasebg) PrepareGraphicContext(DC); if(erasebg) PrepareGraphicContext(DC); DC->SetFont( *g_StdFont ); DC->SetFont( *g_StdFont ); SetBackgroundColour( wxColour(ColorRefs[g_DrawBgColor].m_Red, SetBackgroundColour( wxColour(ColorRefs[g_DrawBgColor].m_Red, Loading @@ -507,6 +516,7 @@ double f_scale = 1.0/(double)zoom; m_Parent->RedrawActiveWindow( DC, erasebg ); m_Parent->RedrawActiveWindow( DC, erasebg ); } } /***********************************************/ /***********************************************/ void WinEDA_DrawPanel::DrawBackGround(wxDC * DC) void WinEDA_DrawPanel::DrawBackGround(wxDC * DC) /***********************************************/ /***********************************************/ Loading Loading @@ -622,6 +632,7 @@ BASE_SCREEN * screen = GetScreen(); 0, Color ); 0, Color ); } } /*******************************************************/ /*******************************************************/ void WinEDA_DrawPanel::OnRightClick(wxMouseEvent& event) void WinEDA_DrawPanel::OnRightClick(wxMouseEvent& event) /*******************************************************/ /*******************************************************/ Loading Loading @@ -721,7 +732,6 @@ static WinEDA_DrawPanel * LastPanel; if( event.MiddleDown()) localbutt = GR_M_MIDDLE_DOWN; if( event.MiddleDown()) localbutt = GR_M_MIDDLE_DOWN; if( event.ButtonDClick(2)) {}; // Unused if( event.ButtonDClick(2)) {}; // Unused localrealbutt |= localbutt; /* compensation defaut wxGTK */ localrealbutt |= localbutt; /* compensation defaut wxGTK */ /* Compute absolute m_MousePosition in pixel units: */ /* Compute absolute m_MousePosition in pixel units: */ Loading Loading @@ -919,7 +929,11 @@ BASE_SCREEN * Screen = GetScreen(); ForceCloseManageCurseur(this, &DC); ForceCloseManageCurseur(this, &DC); SetCursor(m_PanelCursor = m_PanelDefaultCursor); SetCursor(m_PanelCursor = m_PanelDefaultCursor); } } else m_Parent->SetToolID(0, m_PanelCursor = m_PanelDefaultCursor = wxCURSOR_ARROW, wxEmptyString); else { m_PanelCursor = m_PanelDefaultCursor = wxCURSOR_ARROW; m_Parent->SetToolID(0, m_PanelCursor, wxEmptyString); } } } m_Parent->GeneralControle(&DC, Screen->m_MousePositionInPixels); m_Parent->GeneralControle(&DC, Screen->m_MousePositionInPixels); Loading @@ -928,6 +942,3 @@ BASE_SCREEN * Screen = GetScreen(); event.Skip(); // Allow menu shortcut processing event.Skip(); // Allow menu shortcut processing #endif #endif } } Loading
gerbview/tracepcb.cpp +109 −104 Original line number Original line Diff line number Diff line Loading @@ -3,8 +3,9 @@ /*****************************************/ /*****************************************/ /* fichier TRACEPCB.CPP */ /* fichier TRACEPCB.CPP */ /* /* Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ... * Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ... */ */ #include "fctsys.h" #include "fctsys.h" Loading @@ -29,8 +30,10 @@ void WinEDA_DrawPanel::PrintPage(wxDC *DC, bool Print_Sheet_Ref, int printmaskla DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt; save_opt = DisplayOpt; save_opt = DisplayOpt; if( printmasklayer & ALL_CU_LAYERS ) DisplayOpt.DisplayPadFill = FILLED; if( printmasklayer & ALL_CU_LAYERS ) else DisplayOpt.DisplayPadFill = SKETCH; DisplayOpt.DisplayPadFill = FILLED; else DisplayOpt.DisplayPadFill = SKETCH; DisplayOpt.DisplayPadNum = 0; DisplayOpt.DisplayPadNum = 0; DisplayOpt.DisplayPadNoConn = 0; DisplayOpt.DisplayPadNoConn = 0; DisplayOpt.DisplayPadIsol = 0; DisplayOpt.DisplayPadIsol = 0; Loading @@ -49,19 +52,23 @@ DISPLAY_OPTIONS save_opt; DisplayOpt = save_opt; DisplayOpt = save_opt; } } /*******************************************************************/ /*******************************************************************/ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) /*******************************************************************/ /*******************************************************************/ /* Trace le PCB, et les elements complementaires ( axes, grille .. ) /* Trace le PCB, et les elements complementaires ( axes, grille .. ) */ */ { { PCB_SCREEN* screen = GetScreen(); PCB_SCREEN* screen = GetScreen(); if ( ! m_Pcb ) return; if( !m_Pcb ) return; ActiveScreen = screen; ActiveScreen = screen; GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY ); if ( EraseBg ) DrawPanel->EraseScreen(DC); if( EraseBg ) DrawPanel->EraseScreen( DC ); DrawPanel->DrawBackGround( DC ); DrawPanel->DrawBackGround( DC ); Loading @@ -75,13 +82,14 @@ PCB_SCREEN * screen = GetScreen(); DrawPanel->Trace_Curseur( DC ); DrawPanel->Trace_Curseur( DC ); } } /********************************************************/ /********************************************************/ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int mode ) void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int mode ) /********************************************************/ /********************************************************/ /* Trace l'ensemble des elements du PCB sur l'ecran actif*/ /* Trace l'ensemble des elements du PCB sur l'ecran actif*/ { { if( !m_Pcb ) if ( ! m_Pcb ) return; return; // Draw tracks and flashes // Draw tracks and flashes Trace_Pistes( DrawPanel, DC, m_Pcb, mode ); Trace_Pistes( DrawPanel, DC, m_Pcb, mode ); Loading Loading @@ -138,6 +146,3 @@ void WinEDA_GerberFrame::Trace_Gerber(wxDC * DC, int mode) GetScreen()->ClrRefreshReq(); GetScreen()->ClrRefreshReq(); } }
share/drawframe.cpp +625 −563 Original line number Original line Diff line number Diff line Loading @@ -65,12 +65,13 @@ wxSize minsize; m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch // nombre d'unites internes pour 1 pouce // nombre d'unites internes pour 1 pouce // = 1000 pour schema, = 10000 pour PCB // = 1000 pour schema, = 10000 pour PCB m_InternalUnits = EESCHEMA_INTERNAL_UNIT; m_InternalUnits = EESCHEMA_INTERNAL_UNIT; if( (m_Ident == PCB_FRAME) || (m_Ident == GERBER_FRAME) || if( (m_Ident == PCB_FRAME) || (m_Ident == GERBER_FRAME) (m_Ident == CVPCB_DISPLAY_FRAME) || || (m_Ident == CVPCB_DISPLAY_FRAME) (m_Ident == MODULE_EDITOR_FRAME) || (m_Ident == MODULE_EDITOR_FRAME) ) ) m_InternalUnits = PCB_INTERNAL_UNIT; m_InternalUnits = PCB_INTERNAL_UNIT; Loading @@ -83,13 +84,14 @@ wxSize minsize; SetSize( 0, 0, minsize.x, minsize.y ); SetSize( 0, 0, minsize.x, minsize.y ); // Creation de la ligne de status // Creation de la ligne de status int dims[6] = { -1, 60, 130, 130, 40, 100}; static const int dims[6] = { -1, 60, 130, 130, 40, 100 }; CreateStatusBar( 6 ); CreateStatusBar( 6 ); SetStatusWidths( 6, dims ); SetStatusWidths( 6, dims ); // Create child subwindows. // Create child subwindows. GetClientSize( &m_FrameSize.x, &m_FrameSize.y );/* dimx, dimy = dimensions utiles de la GetClientSize( &m_FrameSize.x, &m_FrameSize.y );/* dimx, dimy = dimensions utiles de la zone utilisateur de la fenetre principale */ * zone utilisateur de la fenetre principale */ m_FramePos.x = m_FramePos.y = 0; m_FramePos.x = m_FramePos.y = 0; m_FrameSize.y -= m_MsgFrameHeight; m_FrameSize.y -= m_MsgFrameHeight; Loading @@ -102,9 +104,9 @@ int dims[6] = { -1, 60, 130, 130, 40, 100}; ColorRefs[LIGHTGRAY].m_Green, ColorRefs[LIGHTGRAY].m_Green, ColorRefs[LIGHTGRAY].m_Blue ) ); ColorRefs[LIGHTGRAY].m_Blue ) ); } } } } /****************************************/ /****************************************/ WinEDA_DrawFrame::~WinEDA_DrawFrame( void ) WinEDA_DrawFrame::~WinEDA_DrawFrame( void ) /****************************************/ /****************************************/ Loading @@ -117,10 +119,12 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame(void) /****************************************************************/ /****************************************************************/ void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu ) void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu ) /*****************************************************************/ /*****************************************************************/ /* create the submenu for fonte selection and setup fonte size /* create the submenu for fonte selection and setup font size */ */ { { wxMenu* fontmenu = new wxMenu(); wxMenu* fontmenu = new wxMenu(); ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_DIALOG, _( "font for dialog boxes" ), ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_DIALOG, _( "font for dialog boxes" ), fonts_xpm ); fonts_xpm ); ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_INFOSCREEN, _( "font for info display" ), ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_INFOSCREEN, _( "font for info display" ), Loading @@ -133,6 +137,7 @@ wxMenu * fontmenu = new wxMenu(); fonts_xpm ); fonts_xpm ); } } /********************************************************************/ /********************************************************************/ void WinEDA_DrawFrame::ProcessFontPreferences( wxCommandEvent& event ) void WinEDA_DrawFrame::ProcessFontPreferences( wxCommandEvent& event ) /********************************************************************/ /********************************************************************/ Loading @@ -142,14 +147,12 @@ wxFont font; switch( id ) switch( id ) { { case ID_PREFERENCES_FONT: case ID_PREFERENCES_FONT: case ID_PREFERENCES_FONT_DIALOG: case ID_PREFERENCES_FONT_DIALOG: case ID_PREFERENCES_FONT_STATUS: case ID_PREFERENCES_FONT_STATUS: WinEDA_BasicFrame::ProcessFontPreferences( id ); WinEDA_BasicFrame::ProcessFontPreferences( id ); break; break; case ID_PREFERENCES_FONT_INFOSCREEN: case ID_PREFERENCES_FONT_INFOSCREEN: { { font = wxGetFontFromUser( this, *g_MsgFont ); font = wxGetFontFromUser( this, *g_MsgFont ); Loading @@ -161,26 +164,32 @@ wxFont font; } } break; break; } } default: DisplayError(this, wxT("WinEDA_DrawFrame::ProcessFontPreferences Internal Error") ); default: DisplayError( this, wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) ); break; break; } } } } /**************************************************************/ /**************************************************************/ void WinEDA_DrawFrame::Affiche_Message( const wxString& message ) void WinEDA_DrawFrame::Affiche_Message( const wxString& message ) /**************************************************************/ /**************************************************************/ /* /* Affiche un message en bas de l'ecran * Affiche un message en bas de l'ecran */ */ { { SetStatusText( message ); SetStatusText( message ); } } /****************************************/ /****************************************/ void WinEDA_DrawFrame::EraseMsgBox( void ) void WinEDA_DrawFrame::EraseMsgBox( void ) /****************************************/ /****************************************/ { { if ( MsgPanel ) MsgPanel->EraseMsgBox(); if( MsgPanel ) MsgPanel->EraseMsgBox(); } } Loading @@ -200,7 +209,8 @@ void WinEDA_DrawFrame::OnActivate(wxActivateEvent& event) void WinEDA_DrawFrame::OnMenuOpen( wxMenuEvent& event ) void WinEDA_DrawFrame::OnMenuOpen( wxMenuEvent& event ) /****************************************************/ /****************************************************/ { { if ( DrawPanel ) DrawPanel->m_CanStartBlock = -1; if( DrawPanel ) DrawPanel->m_CanStartBlock = -1; event.Skip(); event.Skip(); } } Loading @@ -211,12 +221,14 @@ void WinEDA_DrawFrame::ReCreateAuxiliaryToolbar(void) // fonction virtuelle { { } } /********************************************/ /********************************************/ void WinEDA_DrawFrame::ReCreateMenuBar( void ) // fonction virtuelle void WinEDA_DrawFrame::ReCreateMenuBar( void ) // fonction virtuelle /********************************************/ /********************************************/ { { } } /****************************************************/ /****************************************************/ void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey, void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ) // fonction virtuelle EDA_BaseStruct* DrawStruct ) // fonction virtuelle Loading @@ -225,21 +237,23 @@ void WinEDA_DrawFrame::OnHotKey(wxDC * DC, int hotkey, } } /**************************************************************/ /**************************************************************/ void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event ) // fonction virtuelle void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event ) // fonction virtuelle /**************************************************************/ /**************************************************************/ { { } } /********************************************************/ /********************************************************/ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event ) // fonction virtuelle void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event ) // fonction virtuelle /********************************************************/ /********************************************************/ { { if ( m_SelGridBox == NULL ) return; //Ne devrait pas se produire! if( m_SelGridBox == NULL ) return; //Ne devrait pas se produire! int id = m_SelGridBox->GetChoice(); int id = m_SelGridBox->GetChoice(); if ( id < 0 ) return; if( id < 0 ) return; m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); wxSize grid = m_CurrentScreen->GetGrid(); wxSize grid = m_CurrentScreen->GetGrid(); Loading @@ -254,34 +268,40 @@ wxSize newgrid = m_CurrentScreen->GetGrid(); /**************************************************************/ /**************************************************************/ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) /**************************************************************/ /**************************************************************/ /* Fonction virtuelle /* Fonction virtuelle traitement des touches de fonctions utilisees ds tous les menus * traitement des touches de fonctions utilisees ds tous les menus Zoom * Zoom Redessin d'ecran * Redessin d'ecran Cht Unites * Cht Unites Cht couches * Cht couches Remise a 0 de l'origine des coordonnees relatives * Remise a 0 de l'origine des coordonnees relatives */ */ { { } } #endif #endif /********************************************************/ /********************************************************/ void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtuelle void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtuelle /********************************************************/ /********************************************************/ /* Set the zoom when selected by the Zoom List Box /* Set the zoom when selected by the Zoom List Box Note: * Note: position 0 = Fit in Page * position 0 = Fit in Page position >= 1 = zoom (1 to zoom max) * position >= 1 = zoom (1 to zoom max) last position : special zoom * last position : special zoom */ */ { { if ( m_SelZoomBox == NULL ) return; //Ne devrait pas se produire! if( m_SelZoomBox == NULL ) return; //Ne devrait pas se produire! int id = m_SelZoomBox->GetChoice(); int id = m_SelZoomBox->GetChoice(); if ( id < 0 ) return; // No selection if( id < 0 ) return; // No selection if( id == 0 ) // Auto zoom (Fit in Page) if( id == 0 ) // Auto zoom (Fit in Page) { { Loading @@ -293,14 +313,17 @@ int id = m_SelZoomBox->GetChoice(); { { id--; id--; int zoom = 1 << id; int zoom = 1 << id; if ( zoom > m_ZoomMaxValue ) zoom = m_ZoomMaxValue; if( zoom > m_ZoomMaxValue ) if ( m_CurrentScreen->GetZoom() == zoom) return; zoom = m_ZoomMaxValue; if( m_CurrentScreen->GetZoom() == zoom ) return; m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); m_CurrentScreen->SetZoom( zoom ); m_CurrentScreen->SetZoom( zoom ); Recadre_Trace( FALSE ); Recadre_Trace( FALSE ); } } } } /********************************************************/ /********************************************************/ void WinEDA_DrawFrame::OnMouseEvent( wxMouseEvent& event ) void WinEDA_DrawFrame::OnMouseEvent( wxMouseEvent& event ) /********************************************************/ /********************************************************/ Loading @@ -309,15 +332,15 @@ void WinEDA_DrawFrame::OnMouseEvent(wxMouseEvent& event) } } /***********************************************************************/ /***********************************************************************/ // Virtuelle // Virtuelle void WinEDA_DrawFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_DrawFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) /***********************************************************************/ /***********************************************************************/ { { } } /***************************************/ /***************************************/ void WinEDA_DrawFrame::SetToolbars( void ) void WinEDA_DrawFrame::SetToolbars( void ) /***************************************/ /***************************************/ Loading @@ -325,6 +348,7 @@ void WinEDA_DrawFrame::SetToolbars(void) DisplayUnitsMsg(); DisplayUnitsMsg(); } } /********************************************************/ /********************************************************/ void WinEDA_DrawFrame::DisplayToolMsg( const wxString msg ) void WinEDA_DrawFrame::DisplayToolMsg( const wxString msg ) /********************************************************/ /********************************************************/ Loading @@ -332,9 +356,11 @@ void WinEDA_DrawFrame::DisplayToolMsg(const wxString msg) SetStatusText( msg, 5 ); SetStatusText( msg, 5 ); } } /*******************************************/ /*******************************************/ void WinEDA_DrawFrame::DisplayUnitsMsg( void ) void WinEDA_DrawFrame::DisplayUnitsMsg( void ) /********************************************/ /********************************************/ /* Display current unit Selection on Statusbar /* Display current unit Selection on Statusbar */ */ { { Loading @@ -345,9 +371,11 @@ wxString msg; case INCHES: case INCHES: msg = _( "Inch" ); msg = _( "Inch" ); break; break; case MILLIMETRE: case MILLIMETRE: msg += _( "mm" ); msg += _( "mm" ); break; break; default: default: msg += _( "??" ); msg += _( "??" ); break; break; Loading @@ -356,20 +384,25 @@ wxString msg; SetStatusText( msg, 4 ); SetStatusText( msg, 4 ); } } /***************************************/ /***************************************/ void WinEDA_DrawFrame::ReDrawPanel( void ) void WinEDA_DrawFrame::ReDrawPanel( void ) /***************************************/ /***************************************/ { { if ( DrawPanel == NULL ) return; if( DrawPanel == NULL ) return; wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel ); DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->ReDraw( &dc ); DrawPanel->ReDraw( &dc ); } } /**************************************************/ /**************************************************/ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv ) void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv ) /**************************************************/ /**************************************************/ /* recalcule les dimensions des toolbars et du panel d'affichage /* recalcule les dimensions des toolbars et du panel d'affichage */ */ { { Loading Loading @@ -438,18 +471,20 @@ wxSize Auxtoolbar_size; SizeEv.Skip(); SizeEv.Skip(); } } /*************************************************************************/ /*************************************************************************/ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, const wxString& title ) const wxString& title ) /*************************************************************************/ /*************************************************************************/ /* /* Active l'icone de l'outil selectionne dans le toolbar Vertical * Active l'icone de l'outil selectionne dans le toolbar Vertical ( ou l'outil par defaut ID_NO_SELECT_BUTT si pas de nouvelle selection ) * ( ou l'outil par defaut ID_NO_SELECT_BUTT si pas de nouvelle selection ) if ( id >= 0 ) * if ( id >= 0 ) Met a jour toutes les variables associees: * Met a jour toutes les variables associees: message, m_ID_current_state, curseur * message, m_ID_current_state, curseur si ( id < 0 ) * si ( id < 0 ) Met a jour seulement les variables message et curseur * Met a jour seulement les variables message et curseur */ */ { { // Change Cursor // Change Cursor Loading @@ -461,31 +496,40 @@ si ( id < 0 ) SetCursor( wxCURSOR_ARROW ); SetCursor( wxCURSOR_ARROW ); DisplayToolMsg( title ); DisplayToolMsg( title ); if ( id < 0 ) return; if( id < 0 ) return; // Old Tool Inactif ou ID_NO_SELECT_BUTT actif si pas de nouveau Tool // Old Tool Inactif ou ID_NO_SELECT_BUTT actif si pas de nouveau Tool if( m_ID_current_state ) if( m_ID_current_state ) { { if ( m_VToolBar ) m_VToolBar->ToggleTool(m_ID_current_state, FALSE); if( m_VToolBar ) if ( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool(m_ID_current_state, FALSE); m_VToolBar->ToggleTool( m_ID_current_state, FALSE ); if( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE ); } } else else { { if( id ) if( id ) { { if ( m_VToolBar ) m_VToolBar->ToggleTool(ID_NO_SELECT_BUTT, FALSE); if( m_VToolBar ) if ( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool(m_ID_current_state, FALSE); m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, FALSE ); if( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE ); } } else if ( m_VToolBar ) m_VToolBar->ToggleTool(ID_NO_SELECT_BUTT, TRUE); else if( m_VToolBar ) m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE ); } } // New Tool Actif // New Tool Actif if( id ) if( id ) { { if ( m_VToolBar ) m_VToolBar->ToggleTool(id, TRUE); if( m_VToolBar ) if ( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool(id, TRUE); m_VToolBar->ToggleTool( id, TRUE ); if( m_AuxVToolBar ) m_AuxVToolBar->ToggleTool( id, TRUE ); } } else if ( m_VToolBar ) m_VToolBar->ToggleTool(ID_NO_SELECT_BUTT, TRUE); else if( m_VToolBar ) m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE ); m_ID_current_state = id; m_ID_current_state = id; } } Loading @@ -496,12 +540,13 @@ void WinEDA_DrawFrame::OnZoom(int zoom_type) /********************************************/ /********************************************/ /* Fonction de traitement du zoom /* Fonction de traitement du zoom Modifie le facteur de zoom et reaffiche l'ecran * Modifie le facteur de zoom et reaffiche l'ecran Pour les commandes par menu Popup ou par le clavier, le curseur est * Pour les commandes par menu Popup ou par le clavier, le curseur est replac au centre de l'ecran * replac au centre de l'ecran */ */ { { if ( DrawPanel == NULL ) return; if( DrawPanel == NULL ) return; bool move_mouse_cursor = FALSE; bool move_mouse_cursor = FALSE; int x, y; int x, y; Loading @@ -515,6 +560,7 @@ wxPoint old_pos; case ID_POPUP_ZOOM_PLUS: case ID_POPUP_ZOOM_PLUS: case ID_ZOOM_PLUS_KEY: case ID_ZOOM_PLUS_KEY: move_mouse_cursor = TRUE; move_mouse_cursor = TRUE; case ID_ZOOM_PLUS_BUTT: case ID_ZOOM_PLUS_BUTT: if( zoom_type == ID_ZOOM_PLUS_BUTT ) if( zoom_type == ID_ZOOM_PLUS_BUTT ) m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); Loading @@ -525,6 +571,7 @@ wxPoint old_pos; case ID_POPUP_ZOOM_MOINS: case ID_POPUP_ZOOM_MOINS: case ID_ZOOM_MOINS_KEY: case ID_ZOOM_MOINS_KEY: move_mouse_cursor = TRUE; move_mouse_cursor = TRUE; case ID_ZOOM_MOINS_BUTT: case ID_ZOOM_MOINS_BUTT: if( zoom_type == ID_ZOOM_MOINS_BUTT ) if( zoom_type == ID_ZOOM_MOINS_BUTT ) m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); Loading Loading @@ -567,32 +614,38 @@ wxPoint old_pos; break; break; default: wxMessageBox( wxT("WinEDA_DrawFrame::OnZoom switch Error") ); default: wxMessageBox( wxT( "WinEDA_DrawFrame::OnZoom switch Error" ) ); break; break; } } Affiche_Status_Box(); Affiche_Status_Box(); } } /**********************************************/ /**********************************************/ void WinEDA_DrawFrame::OnPanning( int direction ) void WinEDA_DrawFrame::OnPanning( int direction ) /**********************************************/ /**********************************************/ /* Fonction de traitement du zoom /* Fonction de traitement du zoom Modifie le facteur de zoom et reaffiche l'ecran * Modifie le facteur de zoom et reaffiche l'ecran Pour les commandes par menu Popup ou par le clavier, le curseur est * Pour les commandes par menu Popup ou par le clavier, le curseur est replac au centre de l'ecran * replac au centre de l'ecran */ */ { { if ( DrawPanel == NULL ) return; if( DrawPanel == NULL ) return; int delta; int delta; wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel ); int x, y; int x, y; DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->GetViewStart( &x, &y ); // x and y are in scroll unit, not in pixels DrawPanel->GetViewStart( &x, &y ); // x and y are in scroll unit, not in pixels delta = DrawPanel->m_ScrollButt_unit; delta = DrawPanel->m_ScrollButt_unit; switch( direction ) switch( direction ) { { case ID_ZOOM_PANNING_UP: case ID_ZOOM_PANNING_UP: Loading @@ -611,7 +664,8 @@ int x,y; x += delta; x += delta; break; break; default: wxMessageBox( wxT("WinEDA_DrawFrame::OnPanning Error") ); default: wxMessageBox( wxT( "WinEDA_DrawFrame::OnPanning Error" ) ); break; break; } } Loading @@ -630,29 +684,31 @@ void WinEDA_DrawFrame::OnGrid(int grid_type) { { } } int WinEDA_DrawFrame::ReturnBlockCommand( int key ) int WinEDA_DrawFrame::ReturnBlockCommand( int key ) { { return 0; return 0; } } void WinEDA_DrawFrame::InitBlockPasteInfos() void WinEDA_DrawFrame::InitBlockPasteInfos() { { GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL; } } void WinEDA_DrawFrame::HandleBlockPlace( wxDC* DC ) void WinEDA_DrawFrame::HandleBlockPlace( wxDC* DC ) { { } } int WinEDA_DrawFrame::HandleBlockEnd( wxDC* DC ) int WinEDA_DrawFrame::HandleBlockEnd( wxDC* DC ) { { return 0; return 0; } } /*********************************************/ /*********************************************/ void WinEDA_DrawFrame::AdjustScrollBars( void ) void WinEDA_DrawFrame::AdjustScrollBars( void ) /*********************************************/ /*********************************************/ Loading @@ -663,8 +719,10 @@ wxPoint scrollbar_pos; int zoom = m_CurrentScreen->GetZoom(); int zoom = m_CurrentScreen->GetZoom(); int xUnit, yUnit; int xUnit, yUnit; if ( m_CurrentScreen == NULL) return; if( m_CurrentScreen == NULL ) if ( DrawPanel == NULL ) return; return; if( DrawPanel == NULL ) return; draw_size = m_CurrentScreen->ReturnPageSize(); draw_size = m_CurrentScreen->ReturnPageSize(); Loading Loading @@ -700,8 +758,10 @@ int xUnit, yUnit; xUnit = yUnit = DrawPanel->m_Scroll_unit; xUnit = yUnit = DrawPanel->m_Scroll_unit; if (xUnit <= 1 ) xUnit = 1; if( xUnit <= 1 ) if (yUnit <= 1 ) yUnit = 1; xUnit = 1; if( yUnit <= 1 ) yUnit = 1; xUnit *= zoom; yUnit *= zoom; xUnit *= zoom; yUnit *= zoom; // Calcul de la position, curseur place au centre d'ecran // Calcul de la position, curseur place au centre d'ecran Loading @@ -713,8 +773,10 @@ int xUnit, yUnit; scrollbar_pos.x -= panel_size.x / 2; scrollbar_pos.x -= panel_size.x / 2; scrollbar_pos.y -= panel_size.y / 2; scrollbar_pos.y -= panel_size.y / 2; if ( scrollbar_pos.x < 0 ) scrollbar_pos.x = 0; if( scrollbar_pos.x < 0 ) if ( scrollbar_pos.y < 0 ) scrollbar_pos.y = 0; scrollbar_pos.x = 0; if( scrollbar_pos.y < 0 ) scrollbar_pos.y = 0; scrollbar_pos.x /= xUnit; scrollbar_pos.x /= xUnit; scrollbar_pos.y /= yUnit; scrollbar_pos.y /= yUnit; Loading @@ -727,20 +789,20 @@ int xUnit, yUnit; m_CurrentScreen->m_ScrollbarNumber.y, m_CurrentScreen->m_ScrollbarNumber.y, m_CurrentScreen->m_ScrollbarPos.x, m_CurrentScreen->m_ScrollbarPos.x, m_CurrentScreen->m_ScrollbarPos.y, TRUE ); m_CurrentScreen->m_ScrollbarPos.y, TRUE ); } } /****************************************************/ /****************************************************/ void WinEDA_DrawFrame::SetDrawBgColor( int color_num ) void WinEDA_DrawFrame::SetDrawBgColor( int color_num ) /****************************************************/ /****************************************************/ /* met a jour la couleur de fond pour les tracs /* met a jour la couleur de fond pour les tracs seules les couleurs BLACK ou WHITE sont autorises * seules les couleurs BLACK ou WHITE sont autorises le parametre XorMode est mis a jour selon la couleur du fond * le parametre XorMode est mis a jour selon la couleur du fond */ */ { { if ( (color_num != WHITE) && (color_num != BLACK) ) color_num = BLACK; if( (color_num != WHITE) && (color_num != BLACK) ) color_num = BLACK; g_DrawBgColor = color_num; g_DrawBgColor = color_num; if( color_num == WHITE ) if( color_num == WHITE ) { { Loading @@ -757,7 +819,6 @@ void WinEDA_DrawFrame::SetDrawBgColor(int color_num) DrawPanel->SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red, DrawPanel->SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red, ColorRefs[g_DrawBgColor].m_Green, ColorRefs[g_DrawBgColor].m_Green, ColorRefs[g_DrawBgColor].m_Blue ) ); ColorRefs[g_DrawBgColor].m_Blue ) ); } } Loading @@ -775,13 +836,15 @@ int id = event.GetId(); /***********************************************/ /***********************************************/ void WinEDA_DrawFrame::Affiche_Status_Box( void ) void WinEDA_DrawFrame::Affiche_Status_Box( void ) /***********************************************/ /***********************************************/ /* Routine d'affichage du zoom et des coord curseur. /* Routine d'affichage du zoom et des coord curseur. */ */ { { wxString Line; wxString Line; int dx, dy; int dx, dy; if (GetScreen() == NULL ) return; if( GetScreen() == NULL ) return; /* affichage Zoom et coordonnees absolues */ /* affichage Zoom et coordonnees absolues */ Line.Printf( wxT( "Z %d" ), GetScreen()->GetZoom() ); Line.Printf( wxT( "Z %d" ), GetScreen()->GetZoom() ); Loading @@ -808,8 +871,10 @@ int dx, dy; if( DisplayOpt.DisplayPolarCood ) /* Display coordonnee polaire */ if( DisplayOpt.DisplayPolarCood ) /* Display coordonnee polaire */ { { double theta, ro; double theta, ro; if ( (dx == 0) && (dy == 0) ) theta = 0.0; if( (dx == 0) && (dy == 0) ) else theta = atan2( (double) - dy , (double) dx ); theta = 0.0; else theta = atan2( (double) -dy, (double) dx ); theta = theta * 180 / M_PI; theta = theta * 180 / M_PI; ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ); ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ); Loading @@ -820,6 +885,3 @@ int dx, dy; } } #endif #endif } }
share/drawpanel.cpp +44 −33 Original line number Original line Diff line number Diff line Loading @@ -2,6 +2,7 @@ /* drawpanel.cpp - fonctions des classes du type WinEDA_DrawPanel */ /* drawpanel.cpp - fonctions des classes du type WinEDA_DrawPanel */ /******************************************************************/ /******************************************************************/ #ifdef __GNUG__ #ifdef __GNUG__ #pragma implementation #pragma implementation #endif #endif Loading @@ -12,12 +13,12 @@ #include "macros.h" #include "macros.h" #include "id.h" #include "id.h" /* defines locaux */ // defines locaux #define CURSOR_SIZE 12 /* taille de la croix du curseur PCB */ #define CURSOR_SIZE 12 // taille de la croix du curseur PCB /* Variables locales */ // Variables locales /* table des evenements captes par un WinEDA_DrawPanel */ // table des evenements captes par un WinEDA_DrawPanel BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) EVT_LEAVE_WINDOW(WinEDA_DrawPanel::OnMouseLeaving) EVT_LEAVE_WINDOW(WinEDA_DrawPanel::OnMouseLeaving) EVT_MOUSE_EVENTS(WinEDA_DrawPanel::OnMouseEvent) EVT_MOUSE_EVENTS(WinEDA_DrawPanel::OnMouseEvent) Loading @@ -31,12 +32,8 @@ BEGIN_EVENT_TABLE(WinEDA_DrawPanel, EDA_DRAW_PANEL) EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE, EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE, WinEDA_DrawPanel::Process_Popup_Zoom) WinEDA_DrawPanel::Process_Popup_Zoom) END_EVENT_TABLE() END_EVENT_TABLE() /***********************************************************/ /***********************************************************/ /* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */ /* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */ /***********************************************************/ /***********************************************************/ Loading Loading @@ -73,6 +70,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel(WinEDA_DrawFrame *parent, int id, m_CursorLevel = 0; m_CursorLevel = 0; } } /*********************************************************************************/ /*********************************************************************************/ void WinEDA_DrawPanel::Trace_Curseur(wxDC * DC, int color) void WinEDA_DrawPanel::Trace_Curseur(wxDC * DC, int color) /*********************************************************************************/ /*********************************************************************************/ Loading Loading @@ -109,6 +107,7 @@ wxPoint Cursor = GetScreen()->m_Curseur; } } } } /*******************************************************************/ /*******************************************************************/ void WinEDA_DrawPanel::CursorOff(wxDC * DC) void WinEDA_DrawPanel::CursorOff(wxDC * DC) /*******************************************************************/ /*******************************************************************/ Loading @@ -120,6 +119,7 @@ void WinEDA_DrawPanel::CursorOff(wxDC * DC) --m_CursorLevel; --m_CursorLevel; } } /*******************************************************************/ /*******************************************************************/ void WinEDA_DrawPanel::CursorOn(wxDC * DC) void WinEDA_DrawPanel::CursorOn(wxDC * DC) /*******************************************************************/ /*******************************************************************/ Loading @@ -142,6 +142,7 @@ int WinEDA_DrawPanel::GetZoom(void) return GetScreen()->GetZoom(); return GetScreen()->GetZoom(); } } /***************************************/ /***************************************/ void WinEDA_DrawPanel::SetZoom(int zoom) void WinEDA_DrawPanel::SetZoom(int zoom) /***************************************/ /***************************************/ Loading @@ -149,6 +150,7 @@ void WinEDA_DrawPanel::SetZoom(int zoom) GetScreen()->SetZoom(zoom); GetScreen()->SetZoom(zoom); } } /************************************/ /************************************/ wxSize WinEDA_DrawPanel::GetGrid(void) wxSize WinEDA_DrawPanel::GetGrid(void) /************************************/ /************************************/ Loading Loading @@ -211,6 +213,7 @@ wxPoint curpos; return curpos; return curpos; } } /********************************************************/ /********************************************************/ bool WinEDA_DrawPanel::IsPointOnDisplay(wxPoint ref_pos) bool WinEDA_DrawPanel::IsPointOnDisplay(wxPoint ref_pos) /********************************************************/ /********************************************************/ Loading Loading @@ -262,6 +265,7 @@ wxPoint curpos = GetScreen()->m_Curseur; return curpos; return curpos; } } /*********************************************************/ /*********************************************************/ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition(void) wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition(void) /*********************************************************/ /*********************************************************/ Loading Loading @@ -292,6 +296,7 @@ wxPoint Mouse = CursorScreenPosition(); MouseTo(Mouse); MouseTo(Mouse); } } /****************************************************/ /****************************************************/ void WinEDA_DrawPanel::MouseTo(const wxPoint & Mouse) void WinEDA_DrawPanel::MouseTo(const wxPoint & Mouse) /****************************************************/ /****************************************************/ Loading Loading @@ -472,9 +477,12 @@ void WinEDA_DrawPanel::ReDraw(wxDC * DC, bool erasebg) { { BASE_SCREEN * Screen = GetScreen(); BASE_SCREEN * Screen = GetScreen(); if ( Screen == NULL ) return; if( Screen == NULL ) return; if( (g_DrawBgColor != WHITE) && (g_DrawBgColor != BLACK) ) g_DrawBgColor = BLACK; if ( (g_DrawBgColor != WHITE) && (g_DrawBgColor != BLACK) ) g_DrawBgColor = BLACK; if( g_DrawBgColor == WHITE ) if( g_DrawBgColor == WHITE ) { { g_XorMode = GR_NXOR; g_XorMode = GR_NXOR; Loading @@ -492,8 +500,9 @@ double f_scale = 1.0/(double)zoom; DC->SetUserScale(f_scale, f_scale); DC->SetUserScale(f_scale, f_scale); #endif #endif if(erasebg) PrepareGraphicContext(DC); if(erasebg) PrepareGraphicContext(DC); DC->SetFont( *g_StdFont ); DC->SetFont( *g_StdFont ); SetBackgroundColour( wxColour(ColorRefs[g_DrawBgColor].m_Red, SetBackgroundColour( wxColour(ColorRefs[g_DrawBgColor].m_Red, Loading @@ -507,6 +516,7 @@ double f_scale = 1.0/(double)zoom; m_Parent->RedrawActiveWindow( DC, erasebg ); m_Parent->RedrawActiveWindow( DC, erasebg ); } } /***********************************************/ /***********************************************/ void WinEDA_DrawPanel::DrawBackGround(wxDC * DC) void WinEDA_DrawPanel::DrawBackGround(wxDC * DC) /***********************************************/ /***********************************************/ Loading Loading @@ -622,6 +632,7 @@ BASE_SCREEN * screen = GetScreen(); 0, Color ); 0, Color ); } } /*******************************************************/ /*******************************************************/ void WinEDA_DrawPanel::OnRightClick(wxMouseEvent& event) void WinEDA_DrawPanel::OnRightClick(wxMouseEvent& event) /*******************************************************/ /*******************************************************/ Loading Loading @@ -721,7 +732,6 @@ static WinEDA_DrawPanel * LastPanel; if( event.MiddleDown()) localbutt = GR_M_MIDDLE_DOWN; if( event.MiddleDown()) localbutt = GR_M_MIDDLE_DOWN; if( event.ButtonDClick(2)) {}; // Unused if( event.ButtonDClick(2)) {}; // Unused localrealbutt |= localbutt; /* compensation defaut wxGTK */ localrealbutt |= localbutt; /* compensation defaut wxGTK */ /* Compute absolute m_MousePosition in pixel units: */ /* Compute absolute m_MousePosition in pixel units: */ Loading Loading @@ -919,7 +929,11 @@ BASE_SCREEN * Screen = GetScreen(); ForceCloseManageCurseur(this, &DC); ForceCloseManageCurseur(this, &DC); SetCursor(m_PanelCursor = m_PanelDefaultCursor); SetCursor(m_PanelCursor = m_PanelDefaultCursor); } } else m_Parent->SetToolID(0, m_PanelCursor = m_PanelDefaultCursor = wxCURSOR_ARROW, wxEmptyString); else { m_PanelCursor = m_PanelDefaultCursor = wxCURSOR_ARROW; m_Parent->SetToolID(0, m_PanelCursor, wxEmptyString); } } } m_Parent->GeneralControle(&DC, Screen->m_MousePositionInPixels); m_Parent->GeneralControle(&DC, Screen->m_MousePositionInPixels); Loading @@ -928,6 +942,3 @@ BASE_SCREEN * Screen = GetScreen(); event.Skip(); // Allow menu shortcut processing event.Skip(); // Allow menu shortcut processing #endif #endif } }