Loading pcbnew/files.cpp +29 −28 Original line number Diff line number Diff line /***************************************************/ /* Files.cpp: Lecture / Sauvegarde des fichiers PCB */ /***************************************************/ /***************************************/ /* files.cpp: read / write board files */ /***************************************/ #include "fctsys.h" Loading @@ -14,7 +14,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) /****************************************************/ /* Gestion generale des commandes de lecture de fichiers /* Handle the read/write file commands */ { int id = event.GetId(); Loading @@ -23,7 +23,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) DrawPanel->PrepareGraphicContext( &dc ); // Arret des commandes en cours // If an edition is in progress, stop it if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) { DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); Loading Loading @@ -125,11 +125,10 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bool Append ) /******************************************************************************************/ /* * Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s * retourne: * 0 si fichier non lu ( annulation de commande ... ) * 1 si OK /** * Read a board file * @param FullFileName = file name. If empty, a file name will be asked * @return 0 if fails or abort, 1 if OK */ { int ii; Loading Loading @@ -250,10 +249,10 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName ) /************************************************************/ /* Sauvegarde du fichier PCB en format ASCII /* Write the board file */ { wxString old_name; wxString BackupFileName; wxString FullFileName; wxString upperTxt; wxString lowerTxt; Loading Loading @@ -283,38 +282,40 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName ) else GetScreen()->m_FileName = FileName; /* mise a jour date si modifications */ /* If changes are made, update the board date */ if( GetScreen()->IsModify() ) { GetScreen()->m_Date = GenDate(); } /* Calcul du nom du fichier a creer */ /* Get the filename */ FullFileName = MakeFileName( wxEmptyString, GetScreen()->m_FileName, PcbExtBuffer ); /* Calcul du nom du fichier de sauvegarde */ old_name = FullFileName; ChangeFileNameExt( old_name, wxT( ".000" ) ); /* Get the backup file name */ BackupFileName = FullFileName; ChangeFileNameExt( BackupFileName, wxT( ".000" ) ); /* Changement du nom de l'ancien fichier s'il existe */ /* If an old backup file exists, delete it. if an old board file existes, rename it to the backup file name */ if( wxFileExists( FullFileName ) ) { /* conversion en *.000 de l'ancien fichier */ wxRemoveFile( old_name ); /* S'il y a une ancienne sauvegarde */ if( !wxRenameFile( FullFileName, old_name ) ) /* rename the "old" file" from xxx.brd to xxx.000 */ wxRemoveFile( BackupFileName ); /* Remove the old file xxx.000 (if exists) */ if( !wxRenameFile( FullFileName, BackupFileName ) ) { msg = _( "Warning: unable to create bakfile " ) + old_name; msg = _( "Warning: unable to create bakfile " ) + BackupFileName; DisplayError( this, msg, 15 ); saveok = FALSE; } } else { old_name = wxEmptyString; BackupFileName = wxEmptyString; saveok = FALSE; } /* Sauvegarde de l'ancien fichier */ /* Create the file */ dest = wxFopen( FullFileName, wxT( "wt" ) ); if( dest == 0 ) { Loading @@ -332,12 +333,12 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName ) fclose( dest ); } /* Affichage des fichiers crees: */ /* Display the file names: */ MsgPanel->EraseMsgBox(); if( saveok ) { upperTxt = _( "Backup file: " ) + old_name; upperTxt = _( "Backup file: " ) + BackupFileName; } if( dest ) Loading @@ -348,7 +349,7 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName ) Affiche_1_Parametre( this, 1, upperTxt, lowerTxt, CYAN ); g_SaveTime = time( NULL ); /* Reset delai pour sauvegarde automatique */ g_SaveTime = time( NULL ); /* Reset timer for the automatic saving */ GetScreen()->ClrModify(); return TRUE; Loading share/zoom.cpp +14 −19 Original line number Diff line number Diff line Loading @@ -34,28 +34,24 @@ #include "id.h" /* Fonctions locales: */ /**************************************************/ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse ) /**************************************************/ /* Calcule les offsets de trace. * Les offsets sont ajusts a un multiple du pas de grille * si ToMouse == TRUE, le curseur souris (curseur "systeme") est replace * en position curseur graphique (curseur kicad) /** Compute draw offset (scroll bars and draw parameters) * in order to have the current graphic cursor position at the screen center * @param ToMouse if TRUE, the mouse cursor is moved * to the graphic cursor position (which is usually on grid) * * Note: Mac OS ** does not ** allow moving mouse cursor by program. */ { /* decalages a apporter au trace en coordonnees ecran */ PutOnGrid( &m_CurrentScreen->m_Curseur ); AdjustScrollBars(); ReDrawPanel(); /* Place le curseur souris sur le curseur SCHEMA*/ /* Move the mouse cursor to the on grid graphic cursor position */ if( ToMouse == TRUE ) DrawPanel->MouseToCursorSchema(); } Loading @@ -64,7 +60,9 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse ) /************************************************/ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) /************************************************/ /* retourne la valeur de la coordonnee coord sur le point de grille le plus proche */ /** Adjust the coordinate to the nearest grig value * @param coord = coordinate to adjust */ { double ftmp; Loading Loading @@ -102,8 +100,7 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) void WinEDA_DrawFrame::Zoom_Automatique( bool move_mouse_cursor ) /**************************************************************/ /* Affiche le Schema au meilleur zoom au meilleur centrage pour le dessin * de facon a avoir toute la feuille affichee a l'ecran /** Redraw the screen with the zoom level which shows all the page or the board */ { int bestzoom; Loading @@ -118,8 +115,9 @@ void WinEDA_DrawFrame::Zoom_Automatique( bool move_mouse_cursor ) void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect ) /*************************************************/ /* Compute the zoom factor and the new draw offset to draw the /** Compute the zoom factor and the new draw offset to draw the * selected area (Rect) in full window screen * @param Rect = selected area th show after zooming */ { int ii, jj; Loading @@ -146,12 +144,10 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect ) void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent& event ) /*****************************************************************/ /* Gere les commandes de zoom appeles par le menu Popup * Toute autre commande est transmise a Parent->Process_Special_Functions(event) /* Handle only the Popup command zoom and grid level */ { int id = event.GetId(); wxClientDC dc( this ); switch( id ) { Loading Loading @@ -454,9 +450,8 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) void WinEDA_DrawFrame::Process_Zoom( wxCommandEvent& event ) /**********************************************************/ /* fonction de traitement des boutons de Zoom. * Appelle simplement la fonction de traitement du Zoom de la * fenetre active. /* Handle the Zoom commands from the zoom tools in the main toolbar. * Calls the active window Zoom function */ { int id = event.GetId(); Loading Loading
pcbnew/files.cpp +29 −28 Original line number Diff line number Diff line /***************************************************/ /* Files.cpp: Lecture / Sauvegarde des fichiers PCB */ /***************************************************/ /***************************************/ /* files.cpp: read / write board files */ /***************************************/ #include "fctsys.h" Loading @@ -14,7 +14,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) /****************************************************/ /* Gestion generale des commandes de lecture de fichiers /* Handle the read/write file commands */ { int id = event.GetId(); Loading @@ -23,7 +23,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) DrawPanel->PrepareGraphicContext( &dc ); // Arret des commandes en cours // If an edition is in progress, stop it if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) { DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); Loading Loading @@ -125,11 +125,10 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bool Append ) /******************************************************************************************/ /* * Lecture d'un fichier PCB, le nom etant dans PcbNameBuffer.s * retourne: * 0 si fichier non lu ( annulation de commande ... ) * 1 si OK /** * Read a board file * @param FullFileName = file name. If empty, a file name will be asked * @return 0 if fails or abort, 1 if OK */ { int ii; Loading Loading @@ -250,10 +249,10 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName ) /************************************************************/ /* Sauvegarde du fichier PCB en format ASCII /* Write the board file */ { wxString old_name; wxString BackupFileName; wxString FullFileName; wxString upperTxt; wxString lowerTxt; Loading Loading @@ -283,38 +282,40 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName ) else GetScreen()->m_FileName = FileName; /* mise a jour date si modifications */ /* If changes are made, update the board date */ if( GetScreen()->IsModify() ) { GetScreen()->m_Date = GenDate(); } /* Calcul du nom du fichier a creer */ /* Get the filename */ FullFileName = MakeFileName( wxEmptyString, GetScreen()->m_FileName, PcbExtBuffer ); /* Calcul du nom du fichier de sauvegarde */ old_name = FullFileName; ChangeFileNameExt( old_name, wxT( ".000" ) ); /* Get the backup file name */ BackupFileName = FullFileName; ChangeFileNameExt( BackupFileName, wxT( ".000" ) ); /* Changement du nom de l'ancien fichier s'il existe */ /* If an old backup file exists, delete it. if an old board file existes, rename it to the backup file name */ if( wxFileExists( FullFileName ) ) { /* conversion en *.000 de l'ancien fichier */ wxRemoveFile( old_name ); /* S'il y a une ancienne sauvegarde */ if( !wxRenameFile( FullFileName, old_name ) ) /* rename the "old" file" from xxx.brd to xxx.000 */ wxRemoveFile( BackupFileName ); /* Remove the old file xxx.000 (if exists) */ if( !wxRenameFile( FullFileName, BackupFileName ) ) { msg = _( "Warning: unable to create bakfile " ) + old_name; msg = _( "Warning: unable to create bakfile " ) + BackupFileName; DisplayError( this, msg, 15 ); saveok = FALSE; } } else { old_name = wxEmptyString; BackupFileName = wxEmptyString; saveok = FALSE; } /* Sauvegarde de l'ancien fichier */ /* Create the file */ dest = wxFopen( FullFileName, wxT( "wt" ) ); if( dest == 0 ) { Loading @@ -332,12 +333,12 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName ) fclose( dest ); } /* Affichage des fichiers crees: */ /* Display the file names: */ MsgPanel->EraseMsgBox(); if( saveok ) { upperTxt = _( "Backup file: " ) + old_name; upperTxt = _( "Backup file: " ) + BackupFileName; } if( dest ) Loading @@ -348,7 +349,7 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName ) Affiche_1_Parametre( this, 1, upperTxt, lowerTxt, CYAN ); g_SaveTime = time( NULL ); /* Reset delai pour sauvegarde automatique */ g_SaveTime = time( NULL ); /* Reset timer for the automatic saving */ GetScreen()->ClrModify(); return TRUE; Loading
share/zoom.cpp +14 −19 Original line number Diff line number Diff line Loading @@ -34,28 +34,24 @@ #include "id.h" /* Fonctions locales: */ /**************************************************/ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse ) /**************************************************/ /* Calcule les offsets de trace. * Les offsets sont ajusts a un multiple du pas de grille * si ToMouse == TRUE, le curseur souris (curseur "systeme") est replace * en position curseur graphique (curseur kicad) /** Compute draw offset (scroll bars and draw parameters) * in order to have the current graphic cursor position at the screen center * @param ToMouse if TRUE, the mouse cursor is moved * to the graphic cursor position (which is usually on grid) * * Note: Mac OS ** does not ** allow moving mouse cursor by program. */ { /* decalages a apporter au trace en coordonnees ecran */ PutOnGrid( &m_CurrentScreen->m_Curseur ); AdjustScrollBars(); ReDrawPanel(); /* Place le curseur souris sur le curseur SCHEMA*/ /* Move the mouse cursor to the on grid graphic cursor position */ if( ToMouse == TRUE ) DrawPanel->MouseToCursorSchema(); } Loading @@ -64,7 +60,9 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse ) /************************************************/ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) /************************************************/ /* retourne la valeur de la coordonnee coord sur le point de grille le plus proche */ /** Adjust the coordinate to the nearest grig value * @param coord = coordinate to adjust */ { double ftmp; Loading Loading @@ -102,8 +100,7 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) void WinEDA_DrawFrame::Zoom_Automatique( bool move_mouse_cursor ) /**************************************************************/ /* Affiche le Schema au meilleur zoom au meilleur centrage pour le dessin * de facon a avoir toute la feuille affichee a l'ecran /** Redraw the screen with the zoom level which shows all the page or the board */ { int bestzoom; Loading @@ -118,8 +115,9 @@ void WinEDA_DrawFrame::Zoom_Automatique( bool move_mouse_cursor ) void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect ) /*************************************************/ /* Compute the zoom factor and the new draw offset to draw the /** Compute the zoom factor and the new draw offset to draw the * selected area (Rect) in full window screen * @param Rect = selected area th show after zooming */ { int ii, jj; Loading @@ -146,12 +144,10 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect ) void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent& event ) /*****************************************************************/ /* Gere les commandes de zoom appeles par le menu Popup * Toute autre commande est transmise a Parent->Process_Special_Functions(event) /* Handle only the Popup command zoom and grid level */ { int id = event.GetId(); wxClientDC dc( this ); switch( id ) { Loading Loading @@ -454,9 +450,8 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) void WinEDA_DrawFrame::Process_Zoom( wxCommandEvent& event ) /**********************************************************/ /* fonction de traitement des boutons de Zoom. * Appelle simplement la fonction de traitement du Zoom de la * fenetre active. /* Handle the Zoom commands from the zoom tools in the main toolbar. * Calls the active window Zoom function */ { int id = event.GetId(); Loading