Commit e29d89c7 authored by charras's avatar charras

minor changes and cleanup

parent e574a1b0
......@@ -5,10 +5,11 @@ COMMON = ../include/colors.h
OBJECTS= \
confirm.o \
about_kicad.o\
base_struct.o\
copy_to_clipboard.o\
basicframe.o\
confirm.o \
copy_to_clipboard.o\
class_drawpickedstruct.o\
common_plot_functions.o\
common_plotPS_functions.o\
......@@ -16,7 +17,7 @@ OBJECTS= \
dlist.o \
hotkeys_basic.o\
drawtxt.o \
about_kicad.o\
drawpanel.o\
wxwineda.o \
string.o \
gr_basic.o\
......
......@@ -25,7 +25,6 @@ OBJECTS = $(TARGET).o \
class_cotation.o\
class_mire.o\
displayframe.o\
drawpanel.o \
init.o\
readschematicnetlist.o\
loadcmp.o\
......@@ -60,9 +59,6 @@ displayframe.o: displayframe.cpp
listboxes.o: listboxes.cpp
drawpanel.o: ../share/drawpanel.cpp
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
drawframe.o: ../share/drawframe.cpp
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
......
......@@ -35,7 +35,6 @@ OBJECTS = eeschema.o\
drawframe.o\
schframe.o\
viewlib_frame.o\
drawpanel.o\
wxprint.o\
lib_export.o \
busentry.o \
......@@ -149,9 +148,6 @@ zoom.o: ../share/zoom.cpp $(DEPEND)
treeprj.o: ../share/treeprj.cpp $(DEPEND)
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
drawpanel.o: ../share/drawpanel.cpp $(DEPEND)
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
mdiframe.o: ../share/mdiframe.cpp $(DEPEND)
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
......
......@@ -28,7 +28,6 @@ OBJECTS= \
class_drc_item.o \
class_board_connected_item.o\
drawframe.o\
drawpanel.o\
set_color.o \
gerbview_config.o \
class_marker.o \
......@@ -59,9 +58,6 @@ OBJECTS= \
setpage.o: ../share/setpage.cpp
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
drawpanel.o: ../share/drawpanel.cpp
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
drawframe.o: ../share/drawframe.cpp
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
......
......@@ -718,9 +718,9 @@ public:
/* Micro waves functions */
void Edit_Gap( wxDC* DC, MODULE* Module );
MODULE* Create_MuWaveBasicShape( wxDC* DC, const wxString& name, int pad_count );
MODULE* Create_MuWaveComponent( wxDC* DC, int shape_type );
MODULE* Create_MuWavePolygonShape( wxDC* DC );
MODULE* Create_MuWaveBasicShape( const wxString& name, int pad_count );
MODULE* Create_MuWaveComponent( int shape_type );
MODULE* Create_MuWavePolygonShape( );
void Begin_Self( wxDC* DC );
MODULE* Genere_Self( wxDC* DC );
......
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -172,7 +172,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
MODULE* Module;
D_PAD* PtPad;
int ii, ll, lextbrin;
float fcoeff;
double fcoeff;
bool abort = FALSE;
wxString msg;
......@@ -502,7 +502,7 @@ static EDGE_MODULE* gen_arc( EDGE_MODULE* PtSegm, int cX, int cY, int angle )
*/
{
int ii, nb_seg;
float alpha, beta, fsin, fcos;
double alpha, beta, fsin, fcos;
int x0, xr0, y0, yr0;
EDGE_MODULE* newedge;
......@@ -517,7 +517,7 @@ static EDGE_MODULE* gen_arc( EDGE_MODULE* PtSegm, int cX, int cY, int angle )
nb_seg = ( abs( angle ) ) / 225; if( nb_seg == 0 )
nb_seg = 1;
alpha = ( (float) angle * 3.14159 / 1800 ) / nb_seg;
alpha = ( (double) angle * 3.14159 / 1800 ) / nb_seg;
for( ii = 1; ii <= nb_seg; ii++ )
{
......
......@@ -61,7 +61,6 @@ OBJECTS= $(TARGET).o classpcb.o\
class_zone.o\
class_zone_setting.o\
drawframe.o\
drawpanel.o\
track.o \
set_color.o \
set_grid.o \
......@@ -134,15 +133,9 @@ OBJECTS= $(TARGET).o classpcb.o\
gpcb_exchange.o
PolyLine.o: ../polygon/PolyLine.cpp ../polygon/PolyLine.h
$(CXX) -c $(EDACPPFLAGS) -o $@ ../polygon/$*.cpp
setpage.o: ../share/setpage.cpp
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
drawpanel.o: ../share/drawpanel.cpp
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
drawframe.o: ../share/drawframe.cpp
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
......
......@@ -2,40 +2,37 @@
/* Gestion des composants specifiques aux microndes */
/****************************************************/
/* Fichier MUONDE.CPP */
/* File MUONDE.CPP */
#include "fctsys.h"
#include "gr_basic.h"
//#include "gr_basic.h"
#include "common.h"
#include "trigo.h"
#include "pcbnew.h"
#include "autorout.h"
//#include "autorout.h"
#include "drag.h"
//#include "drag.h"
#include <string.h>
//#include <string.h>
#include "protos.h"
/* fonctions importees */
/* Fonctions locales */
//static void Exit_Muonde(WinEDA_DrawFrame * frame, wxDC *DC);
/* Variables locales : */
#define COEFF_COUNT 6
double* PolyEdges;
int PolyEdgesCount;
double ShapeScaleX, ShapeScaleY;
wxSize ShapeSize;
int PolyShapeType;
static double* PolyEdges;
static int PolyEdgesCount;
static double ShapeScaleX, ShapeScaleY;
static wxSize ShapeSize;
static int PolyShapeType;
#include "gen_self.h"
/***************************************************************************/
MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( wxDC* DC,
const wxString& name, int pad_count )
MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( const wxString& name, int pad_count )
/***************************************************************************/
/* Create a footprint with pad_count pads for micro wave applications
......@@ -47,7 +44,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( wxDC* DC,
int pad_num = 1;
wxString Line;
Module = Create_1_Module( DC, name );
Module = Create_1_Module( NULL, name );
if( Module == NULL )
return NULL;
......@@ -75,9 +72,6 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( wxDC* DC,
pad->SetPadName( Line );
pad_num++;
}
if( DC )
Module->Draw( DrawPanel, DC, GR_OR );
return Module;
}
......@@ -112,7 +106,7 @@ static void Exit_Muonde( WinEDA_DrawFrame* frame, wxDC* DC )
/***************************************************************************/
MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type )
MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
/***************************************************************************/
/* Create a module "GAP" or "STUB"
......@@ -124,14 +118,14 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type )
{
int gap_size, oX, ii;
float fcoeff;
D_PAD* pt_pad;
D_PAD* pad;
MODULE* Module;
wxString msg, cmp_name;
int pad_count = 2;
int angle = 0;
bool abort;
/* Entree de la longueur desiree du gap*/
/* Enter the size of the gap or stub*/
gap_size = g_DesignSettings.m_CurrentTrackWidth; // Valeur raisonnable
switch( shape_type )
......@@ -164,15 +158,14 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type )
fcoeff = 10000.0 / 25.4;
value.Printf( wxT( "%2.4f" ), gap_size / fcoeff );
msg += _( " (mm):" );
abort = Get_Message( msg, _("Create microwave module"), value, this );
}
else
{
fcoeff = 10000.0;
value.Printf( wxT( "%2.3f" ), gap_size / fcoeff );
msg += _( " (inch):" );
abort = Get_Message( msg, _("Create microwave module"), value, this );
}
abort = Get_Message( msg, _("Create microwave module"), value, this );
double fval;
if( !value.ToDouble( &fval ) )
......@@ -204,32 +197,32 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type )
return NULL;
}
Module = Create_MuWaveBasicShape( NULL, cmp_name, pad_count );
pt_pad = Module->m_Pads;
Module = Create_MuWaveBasicShape( cmp_name, pad_count );
pad = Module->m_Pads;
switch( shape_type )
{
case 0: //Gap :
oX = pt_pad->m_Pos0.x = -(gap_size + pt_pad->m_Size.x) / 2;
pt_pad->m_Pos.x += pt_pad->m_Pos0.x;
oX = pad->m_Pos0.x = -(gap_size + pad->m_Size.x) / 2;
pad->m_Pos.x += pad->m_Pos0.x;
pt_pad = (D_PAD*) pt_pad->Next();
pt_pad->m_Pos0.x = oX + gap_size + pt_pad->m_Size.x;
pt_pad->m_Pos.x += pt_pad->m_Pos0.x;
pad = pad->Next();
pad->m_Pos0.x = oX + gap_size + pad->m_Size.x;
pad->m_Pos.x += pad->m_Pos0.x;
break;
case 1: //Stub :
pt_pad->SetPadName( wxT( "1" ) );
pt_pad = (D_PAD*) pt_pad->Next();
pt_pad->m_Pos0.y = -(gap_size + pt_pad->m_Size.y) / 2;
pt_pad->m_Size.y = gap_size;
pt_pad->m_Pos.y += pt_pad->m_Pos0.y;
pad->SetPadName( wxT( "1" ) );
pad = pad->Next();
pad->m_Pos0.y = -(gap_size + pad->m_Size.y) / 2;
pad->m_Size.y = gap_size;
pad->m_Pos.y += pad->m_Pos0.y;
break;
case 2: //Arc Stub :
case 2: //Arc Stub created by a polygonal approach:
{
EDGE_MODULE* edge; int* ptr, theta;
ii = angle / 50;
ii = angle / 50; // Note : angles are in 0.1 degrees
edge = new EDGE_MODULE( Module );
Module->m_Drawings.PushFront( edge );
......@@ -239,7 +232,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type )
edge->m_PolyCount = ii + 3;
edge->m_PolyList = (int*) MyMalloc( edge->m_PolyCount * 2 * sizeof(int) );
ptr = edge->m_PolyList;
edge->m_Start0.y = -pt_pad->m_Size.y / 2;
edge->m_Start0.y = -pad->m_Size.y / 2;
*ptr = 0; ptr++;
*ptr = 0; ptr++;
......@@ -255,6 +248,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type )
theta = angle / 2;
}
// Close the polygon:
*ptr = edge->m_PolyList[0]; ptr++;
*ptr = edge->m_PolyList[1];
break;
......@@ -265,8 +259,6 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type )
}
Module->Set_Rectangle_Encadrement();
Module->Draw( DrawPanel, DC, GR_OR );
DrawPanel->MouseToCursorSchema();
m_Pcb->m_Status_Pcb = 0;
GetScreen()->SetModify();
return Module;
......@@ -506,7 +498,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
/*************************************************************/
MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( wxDC* DC )
MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
/*************************************************************/
{
D_PAD* pad1, * pad2;
......@@ -548,7 +540,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( wxDC* DC )
cmp_name = wxT( "POLY" );
Module = Create_MuWaveBasicShape( NULL, cmp_name, pad_count );
Module = Create_MuWaveBasicShape( cmp_name, pad_count );
pad1 = Module->m_Pads;
pad1->m_Pos0.x = -ShapeSize.x / 2;
......@@ -637,7 +629,6 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( wxDC* DC )
PolyEdges = NULL;
Module->Set_Rectangle_Encadrement();
Module->Draw( DrawPanel, DC, GR_OR );
m_Pcb->m_Status_Pcb = 0;
GetScreen()->SetModify();
return Module;
......
......@@ -4,8 +4,6 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
......@@ -82,6 +80,7 @@ wxClientDC dc(DrawPanel);
void WinEDA_PcbFrame::MuWaveCommand(wxDC * DC, const wxPoint& MousePos)
/***************************************************************************/
{
MODULE* module = NULL;
switch ( m_ID_current_state )
{
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
......@@ -89,19 +88,19 @@ void WinEDA_PcbFrame::MuWaveCommand(wxDC * DC, const wxPoint& MousePos)
break;
case ID_PCB_MUWAVE_TOOL_GAP_CMD:
Create_MuWaveComponent(DC, 0);
module = Create_MuWaveComponent( 0);
break;
case ID_PCB_MUWAVE_TOOL_STUB_CMD:
Create_MuWaveComponent(DC, 1);
module = Create_MuWaveComponent( 1);
break;
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
Create_MuWaveComponent(DC, 2);
module = Create_MuWaveComponent( 2);
break;
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
Create_MuWavePolygonShape(DC);
module = Create_MuWavePolygonShape();
break;
default :
......@@ -110,5 +109,11 @@ void WinEDA_PcbFrame::MuWaveCommand(wxDC * DC, const wxPoint& MousePos)
SetToolID(0, wxCURSOR_ARROW,wxEmptyString);
break;
}
if ( module )
{
StartMove_Module( module, DC );
}
DrawPanel->MouseToCursorSchema();
}
......@@ -230,21 +230,20 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
wxSize GridSize( 500, 500 );
wxConfig * config = NULL;
if( m_Parent && m_Parent->m_EDA_Config )
{
long SizeX, SizeY;
config = m_Parent->m_EDA_Config;
if( m_Parent->m_EDA_Config->Read( wxT( "PcbEditGrid_X" ), &SizeX )
&& m_Parent->m_EDA_Config->Read( wxT( "PcbEditGrid_Y" ), &SizeY ) )
if( config->Read( wxT( "PcbEditGrid_X" ), &SizeX )
&& config->Read( wxT( "PcbEditGrid_Y" ), &SizeY ) )
{
GridSize.x = SizeX;
GridSize.y = SizeY;
}
m_Parent->m_EDA_Config->Read( wxT( "PcbMagPadOpt" ),
&g_MagneticPadOption );
m_Parent->m_EDA_Config->Read( wxT( "PcbMagTrackOpt" ),
&g_MagneticTrackOption );
config->Read( wxT( "PcbMagPadOpt" ), &g_MagneticPadOption );
config->Read( wxT( "PcbMagTrackOpt" ), &g_MagneticTrackOption );
}
GetScreen()->SetGrid( GridSize );
......@@ -254,6 +253,13 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
ReCreateHToolbar();
ReCreateAuxiliaryToolbar();
ReCreateVToolbar();
if( config )
{
long display_microwave_tools = 0;
config->Read( wxT( "ShowMicrowaveTools" ), &display_microwave_tools );
if ( display_microwave_tools )
ReCreateAuxVToolbar();
}
ReCreateOptToolbar();
}
......@@ -325,17 +331,15 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
SetBaseScreen( ActiveScreen = ScreenPcb );
SaveSettings();
if( m_Parent && m_Parent->m_EDA_Config )
if( m_Parent && m_Parent->m_EDA_Config )
{
wxConfig * config = m_Parent->m_EDA_Config;
wxSize GridSize = GetScreen()->GetGrid();
m_Parent->m_EDA_Config->Write( wxT( "PcbEditGrid_X" ),
(long) GridSize.x );
m_Parent->m_EDA_Config->Write( wxT( "PcbEditGrid_Y" ),
(long) GridSize.y );
m_Parent->m_EDA_Config->Write( wxT( "PcbMagPadOpt" ),
(long) g_MagneticPadOption );
m_Parent->m_EDA_Config->Write( wxT( "PcbMagTrackOpt" ),
(long) g_MagneticTrackOption );
config->Write( wxT( "PcbEditGrid_X" ), (long) GridSize.x );
config->Write( wxT( "PcbEditGrid_Y" ), (long) GridSize.y );
config->Write( wxT( "PcbMagPadOpt" ), (long) g_MagneticPadOption );
config->Write( wxT( "PcbMagTrackOpt" ), (long) g_MagneticTrackOption );
config->Write( wxT( "ShowMicrowaveTools" ), (long) m_AuxVToolBar ? 1 : 0 );
}
Destroy();
}
......@@ -472,6 +476,7 @@ void WinEDA_PcbFrame::SetToolbars()
DisplayOpt.ContrastModeDisplay ?
_( "Normal Contrast Mode Display" ) :
_( "Hight Contrast Mode Display" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_AuxVToolBar ? true : false );
}
if( m_AuxiliaryToolBar )
......
......@@ -395,7 +395,7 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
wxEmptyString,
wxBitmap( mw_toolbar_xpm ),
_( "Display auxiliary vertical toolbar (tools for micro wave applications)\n This is a very experimental feature (under development)" ),
_( "Display/remove auxiliary vertical toolbar (tools for micro wave applications)\n This is a experimental feature (under development)" ),
wxITEM_CHECK );
#endif
......@@ -539,7 +539,6 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar()
m_AuxVToolBar->Realize();
D(printf("ReCreateAuxVToolbar\n");)
SetToolbars();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment