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