Minor code cleaning and minor enhancement.

This commit is contained in:
jean-pierre charras 2011-05-22 21:08:34 +02:00
parent a3ec2e24a2
commit 0b91eb30b2
33 changed files with 107 additions and 108 deletions

View File

@ -2,12 +2,6 @@
// Name: 3d_aux.cpp
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif
#include "fctsys.h"
#if !wxUSE_GLCANVAS
@ -17,8 +11,6 @@
#include "common.h"
#include "trigo.h"
#include "bitmaps.h"
#include "3d_viewer.h"
#include "trackball.h"

View File

@ -1,7 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_canvas.cpp
/////////////////////////////////////////////////////////////////////////////
/**
* @file 3d_canvas.cpp
*/
#include "fctsys.h"
#include "trigo.h"
@ -20,9 +19,6 @@
#include "3d_viewer.h"
#include "trackball.h"
/* Tool and button Bitmaps */
#include "bitmaps.h"
// -----------------
// helper function (from wxWidgets, opengl/cube.cpp sample

View File

@ -2,12 +2,6 @@
// Name: 3d_class.cpp
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif
#include "fctsys.h"
#include "3d_viewer.h"

View File

@ -1,7 +1,6 @@
//////////////////////////////////////
// Name: 3d_draw.cpp
//////////////////////////////////////
/**
* @file 3d_draw.cpp
*/
#include "fctsys.h"
#include "common.h"

View File

@ -2,13 +2,6 @@
// Name: 3d_frame.cpp
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif
#include "fctsys.h"
#include "appl_wxstruct.h"
@ -16,8 +9,6 @@
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
#endif
#include "bitmaps.h"
#include "3d_viewer.h"
#include "trackball.h"
@ -292,7 +283,7 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_MOVE3D_DOWN:
m_Canvas->SetView3D( WXK_DOWN );
return;
case ID_ORTHO:
m_Canvas->ToggleOrtho();
return;

View File

@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_read_mesh.cpp
/////////////////////////////////////////////////////////////////////////////
/**
* @file 3d_read_mesh.cpp
*/
#include "fctsys.h"
#include "common.h"

View File

@ -135,7 +135,7 @@ set(BITMAP_SRCS
fill_zone.xpm
find_xpm.xpm
Flag.xpm
Fonts.xpm
Fonts.xpmr
Footprint_Text.xpm
gbr_select_mode0.xpm
gbr_select_mode1.xpm
@ -362,8 +362,8 @@ set(BITMAP_SRCS
Rotate_Module-.xpm
Rotate_Module+.xpm
Rotate_Pin.xpm
Rotate-.xpm
Rotate+.xpm
Rotate_CCW.xpm
Rotate_CW.xpm
rotate-x.xpm
rotate+x.xpm
rotate-y.xpm

View File

@ -1,9 +1,5 @@
/* XPM */
#ifndef XPMMAIN
extern const char *rotate_neg_xpm[];
#else
const char * rotate_neg_xpm[] = {
const char *rotate_CCW_xpm[] = {
"16 16 93 2",
" c None",
". c #202020",
@ -114,4 +110,3 @@ const char * rotate_neg_xpm[] = {
" % % X B $ % % ",
" Y Z ` % ",
" .% "};
#endif

View File

@ -1,9 +1,6 @@
/* XPM */
#ifndef XPMMAIN
extern const char *rotate_pos_xpm[];
#else
const char * rotate_pos_xpm[] = {
const char *rotate_CW_xpm[] = {
"16 16 96 2",
" c None",
". c #000000",
@ -117,4 +114,3 @@ const char * rotate_pos_xpm[] = {
" 1 .C 8 1 1 1 1 1 1 ",
" ..+.@.1 1 1 1 ",
" e ` "};
#endif

View File

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -291,11 +291,12 @@ void LIB_ARC::DoMirrorVertical( const wxPoint& aCenter )
EXCHG( m_ArcStart, m_ArcEnd );
}
void LIB_ARC::DoRotate( const wxPoint& aCenter )
void LIB_ARC::DoRotate( const wxPoint& aCenter, bool aRotateCCW )
{
RotatePoint( &m_Pos, aCenter, -900 );
RotatePoint( &m_ArcStart, aCenter, -900 );
RotatePoint( &m_ArcEnd, aCenter, -900 );
int rot_angle = aRotateCCW ? -900 : 900;
RotatePoint( &m_Pos, aCenter, rot_angle );
RotatePoint( &m_ArcStart, aCenter, rot_angle );
RotatePoint( &m_ArcEnd, aCenter, rot_angle );
}

View File

@ -142,7 +142,7 @@ protected:
virtual wxPoint DoGetPosition() const { return m_Pos; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter );
virtual void DoMirrorVertical( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter, bool aRotateCCW = true );
virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Width; }

View File

@ -210,19 +210,20 @@ void LIB_BEZIER::DoMirrorVertical( const wxPoint& aCenter )
}
}
void LIB_BEZIER::DoRotate( const wxPoint& aCenter )
void LIB_BEZIER::DoRotate( const wxPoint& aCenter, bool aRotateCCW )
{
size_t i, imax = m_PolyPoints.size();
int rot_angle = aRotateCCW ? -900 : 900;
size_t i, imax = m_PolyPoints.size();
for( i = 0; i < imax; i++ )
{
RotatePoint( &m_PolyPoints[i], aCenter, -900 );
RotatePoint( &m_PolyPoints[i], aCenter, rot_angle );
}
imax = m_BezierPoints.size();
for( i = 0; i < imax; i++ )
{
RotatePoint( &m_BezierPoints[i], aCenter, -900 );
RotatePoint( &m_BezierPoints[i], aCenter, rot_angle );
}
}

View File

@ -94,7 +94,7 @@ protected:
virtual wxPoint DoGetPosition() const { return m_PolyPoints[0]; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter );
virtual void DoMirrorVertical( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter, bool aRotateCCW = true );
virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Width; }

View File

@ -169,9 +169,11 @@ void LIB_CIRCLE::DoMirrorVertical( const wxPoint& aCenter )
m_Pos.y += aCenter.y;
}
void LIB_CIRCLE::DoRotate( const wxPoint& aCenter )
void LIB_CIRCLE::DoRotate( const wxPoint& aCenter, bool aRotateCCW )
{
RotatePoint( &m_Pos, aCenter, -900 );
int rot_angle = aRotateCCW ? -900 : 900;
RotatePoint( &m_Pos, aCenter, rot_angle );
}

View File

@ -110,7 +110,7 @@ protected:
virtual wxPoint DoGetPosition() const { return m_Pos; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter );
virtual void DoMirrorVertical( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter, bool aRotateCCW = true );
virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Width; }

View File

@ -312,7 +312,7 @@ public:
/**
* Rotate about a point.
*
* @param aCenter - Point to mirror around.
* @param aCenter - Point to rotate around.
*/
void Rotate( const wxPoint& aCenter )
{
@ -398,7 +398,7 @@ protected:
virtual wxPoint DoGetPosition() const = 0;
virtual void DoMirrorHorizontal( const wxPoint& aCenter ) = 0;
virtual void DoMirrorVertical( const wxPoint& aCenter ) = 0;
virtual void DoRotate( const wxPoint& aCenter ) = 0;
virtual void DoRotate( const wxPoint& aCenter, bool aRotateCCW = true ) = 0;
virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) = 0;
virtual int DoGetWidth() const = 0;

View File

@ -483,9 +483,11 @@ void LIB_FIELD::DoMirrorVertical( const wxPoint& center )
m_Pos.y += center.y;
}
void LIB_FIELD::DoRotate( const wxPoint& center )
void LIB_FIELD::DoRotate( const wxPoint& center, bool aRotateCCW )
{
RotatePoint( &m_Pos, center, -900 );
int rot_angle = aRotateCCW ? -900 : 900;
RotatePoint( &m_Pos, center, rot_angle );
m_Orient = m_Orient ? 0 : 900;
}

View File

@ -246,7 +246,7 @@ protected:
virtual wxPoint DoGetPosition( void ) const { return m_Pos; }
virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoMirrorVertical( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter, bool aRotateCCW = true );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const TRANSFORM& aTransform );
virtual int DoGetWidth( void ) const { return m_Thickness; }

View File

@ -1685,26 +1685,51 @@ void LIB_PIN::DoMirrorVertical( const wxPoint& center )
m_orientation = PIN_UP;
}
void LIB_PIN::DoRotate( const wxPoint& center )
void LIB_PIN::DoRotate( const wxPoint& center, bool aRotateCCW )
{
RotatePoint( &m_position, center, -900 );
int rot_angle = aRotateCCW ? -900 : 900;
switch( m_orientation )
RotatePoint( &m_position, center, rot_angle );
if( aRotateCCW )
{
case PIN_RIGHT:
m_orientation = PIN_UP;
break;
switch( m_orientation )
{
case PIN_RIGHT:
m_orientation = PIN_UP;
break;
case PIN_UP:
m_orientation = PIN_LEFT;
break;
case PIN_LEFT:
m_orientation = PIN_DOWN;
break;
case PIN_UP:
m_orientation = PIN_LEFT;
break;
case PIN_LEFT:
m_orientation = PIN_DOWN;
break;
case PIN_DOWN:
m_orientation = PIN_RIGHT;
break;
case PIN_DOWN:
m_orientation = PIN_RIGHT;
break;
}
}
else
{
switch( m_orientation )
{
case PIN_RIGHT:
m_orientation = PIN_DOWN;
break;
case PIN_UP:
m_orientation = PIN_RIGHT;
break;
case PIN_LEFT:
m_orientation = PIN_UP;
break;
case PIN_DOWN:
m_orientation = PIN_LEFT;
break;
}
}
}

View File

@ -473,7 +473,7 @@ protected:
virtual wxPoint DoGetPosition() const { return m_position; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter );
virtual void DoMirrorVertical( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter, bool aRotateCCW = true );
virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_width; }

View File

@ -189,13 +189,15 @@ void LIB_POLYLINE::DoMirrorVertical( const wxPoint& aCenter )
}
}
void LIB_POLYLINE::DoRotate( const wxPoint& aCenter )
void LIB_POLYLINE::DoRotate( const wxPoint& aCenter, bool aRotateCCW )
{
int rot_angle = aRotateCCW ? -900 : 900;
size_t i, imax = m_PolyPoints.size();
for( i = 0; i < imax; i++ )
{
RotatePoint( &m_PolyPoints[i], aCenter, -900 );
RotatePoint( &m_PolyPoints[i], aCenter, rot_angle );
}
}

View File

@ -127,7 +127,7 @@ protected:
virtual wxPoint DoGetPosition() const { return m_PolyPoints[0]; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter );
virtual void DoMirrorVertical( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter, bool aRotateCCW = true );
virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Width; }

View File

@ -142,10 +142,11 @@ void LIB_RECTANGLE::DoMirrorVertical( const wxPoint& aCenter )
m_End.y += aCenter.y;
}
void LIB_RECTANGLE::DoRotate( const wxPoint& aCenter )
void LIB_RECTANGLE::DoRotate( const wxPoint& aCenter, bool aRotateCCW )
{
RotatePoint( &m_Pos, aCenter, -900 );
RotatePoint( &m_End, aCenter, -900 );
int rot_angle = aRotateCCW ? -900 : 900;
RotatePoint( &m_Pos, aCenter, rot_angle );
RotatePoint( &m_End, aCenter, rot_angle );
}

View File

@ -117,7 +117,7 @@ protected:
virtual wxPoint DoGetPosition() const { return m_Pos; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter );
virtual void DoMirrorVertical( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter, bool aRotateCCW = true );
virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Width; }

View File

@ -271,9 +271,11 @@ void LIB_TEXT::DoMirrorVertical( const wxPoint& center )
m_Pos.y += center.y;
}
void LIB_TEXT::DoRotate( const wxPoint& center )
void LIB_TEXT::DoRotate( const wxPoint& center, bool aRotateCCW )
{
RotatePoint( &m_Pos, center, -900 );
int rot_angle = aRotateCCW ? -900 : 900;
RotatePoint( &m_Pos, center, rot_angle );
m_Orient = m_Orient ? 0 : 900;
}

View File

@ -142,7 +142,7 @@ protected:
virtual wxPoint DoGetPosition() const { return m_Pos; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter );
virtual void DoMirrorVertical( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter, bool aRotateCCW = true );
virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Thickness; }

View File

@ -6,7 +6,7 @@
*/
#include "fctsys.h"
#include "gr_basic.h"
//#include "gr_basic.h"
#include "common.h"
#include "macros.h"
#include "confirm.h"
@ -300,7 +300,7 @@ void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame )
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), mirror_H_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ), mirror_V_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), rotate_pos_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), rotate_CCW_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm );
}
}

View File

@ -248,8 +248,8 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
wxMenu* orientmenu = new wxMenu;
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE, msg, rotate_pos_xpm );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, _( "Rotate -" ), rotate_neg_xpm );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE, msg, rotate_CCW_xpm );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, _( "Rotate -" ), rotate_CW_xpm );
msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_MIROR_X_CMP, msg, mirror_V_xpm );
msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT );
@ -407,7 +407,7 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button );
}
msg = AddHotkeyName( _( "Rotate Label" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_pos_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_CCW_xpm );
msg = AddHotkeyName( _( "Edit Label" ), s_Schematic_Hokeys_Descr, HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm );
msg = AddHotkeyName( _( "Delete Label" ), s_Schematic_Hokeys_Descr, HK_DELETE );
@ -441,7 +441,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
}
msg = AddHotkeyName( _( "Rotate Text" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_pos_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_CCW_xpm );
msg = AddHotkeyName( _( "Edit Text" ), s_Schematic_Hokeys_Descr, HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm );
msg = AddHotkeyName( _( "Delete Text" ), s_Schematic_Hokeys_Descr, HK_DELETE );
@ -644,7 +644,7 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), mirror_H_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ), mirror_V_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), rotate_pos_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), rotate_CCW_xpm );
#if 0
#ifdef __WINDOWS__

View File

@ -356,8 +356,8 @@ extern const char* rotate_glabel_xpm[];
extern const char* rotate_module_neg_xpm[];
extern const char* rotate_module_pos_xpm[];
extern const char* rotate_pin_xpm[];
extern const char* rotate_neg_xpm[];
extern const char* rotate_pos_xpm[];
extern const char* rotate_CW_xpm[];
extern const char* rotate_CCW_xpm[];
extern const char* rotate_neg_X_xpm[];
extern const char* rotate_pos_X_xpm[];
extern const char* rotate_neg_Y_xpm[];

View File

@ -228,7 +228,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
mirror_H_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK,
_( "Rotate Block (ctrl + drag mouse)" ),
rotate_pos_xpm );
rotate_CCW_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK,
_( "Delete Block (shift+ctrl + drag mouse)" ),
delete_xpm );

View File

@ -379,7 +379,7 @@ void PCB_EDIT_FRAME::createPopUpBlockMenu( wxMenu* menu )
ADD_MENUITEM( menu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm );
ADD_MENUITEM( menu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm );
ADD_MENUITEM( menu, ID_POPUP_FLIP_BLOCK, _( "Flip Block" ), invert_module_xpm );
ADD_MENUITEM( menu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block" ), rotate_pos_xpm );
ADD_MENUITEM( menu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block" ), rotate_CCW_xpm );
ADD_MENUITEM( menu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm );
}
@ -780,7 +780,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
msg, move_text_xpm );
}
msg = AddHotkeyName( _( "Rotate" ), g_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM );
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, msg, rotate_pos_xpm );
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, msg, rotate_CCW_xpm );
msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB, msg, edit_text_xpm );
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_RESET_TEXT_SIZE,