Commit 4d12bd3e authored by charras's avatar charras

Solved problems with mirrored texts. cleaning obsolete files

parent af048ff2
......@@ -11,4 +11,4 @@ libbitmaps.a: $(OBJECTS)
clean:
# rm -f *.o
" rm -f *.a
# rm -f *.a
......@@ -166,7 +166,7 @@ EDA_TextStruct::EDA_TextStruct( const wxString& text )
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; /* XY size of font */
m_Orient = 0; /* Orient in 0.1 degrees */
m_Attributs = 0;
m_Miroir = 0; // display mirror if 1
m_Mirror = false; // display mirror if true
m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER; /* Justifications Horiz et Vert du texte */
m_Width = 0; /* thickness */
......@@ -301,10 +301,13 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( aDisplayMode == SKETCH )
width = -width;
wxSize size = m_Size;
if ( m_Mirror )
size.x = -size.x;
DrawGraphicText( aPanel, aDC,
aOffset + m_Pos, aColor, m_Text,
m_Orient, m_Size,
m_Orient, size,
m_HJustify, m_VJustify, width, m_Italic );
}
......
......@@ -61,6 +61,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
int ox, oy; // Draw coordinates for the current char
int coord[100]; // Buffer coordinate used to draw polylines (char shapes)
bool sketch_mode = false;
bool italic_reverse = false; // true for mirrored texts with m_Size.x < 0
if ( aPanel )
zoom = aPanel->GetZoom();
......@@ -76,6 +77,8 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
sketch_mode = TRUE;
}
int thickness = aWidth;
if ( aSize.x < 0 ) // text is mirrored using size.x < 0 (mirror / Y axis)
italic_reverse = true;
kk = 0;
ptr = 0; /* ptr = text index */
......@@ -289,7 +292,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
k2 = (k2 * size_h) / 9;
// To simulate an italic font, add a x offset depending on the y offset
if ( aItalic )
k2 -= k1/8;
k2 -= italic_reverse ? - k1/8 : k1/8;
dx = k2 + ox; dy = k1 + oy;
RotatePoint( &dx, &dy, cX, cY, aOrient );
......
......@@ -51,7 +51,7 @@ void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem )
EXCHG( m_Size, copyitem->m_Size );
EXCHG( m_Width, copyitem->m_Width );
EXCHG( m_Orient, copyitem->m_Orient );
EXCHG( m_Miroir, copyitem->m_Miroir );
EXCHG( m_Mirror, copyitem->m_Mirror );
EXCHG( m_Attributs, copyitem->m_Attributs );
EXCHG( m_Italic, copyitem->m_Italic );
EXCHG( m_HJustify, copyitem->m_HJustify );
......
......@@ -8,7 +8,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
../polygon)
set(GERBVIEW_SRCS
affiche.cpp
block.cpp
controle.cpp
dcode.cpp
......
/**********************************************************/
/* Routines d'affichage de parametres et caracteristiques */
/**********************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
/* Routines locales */
/****************************************************************************/
void Affiche_Infos_PCB_Texte( WinEDA_BasePcbFrame* frame, TEXTE_PCB* pt_texte )
/****************************************************************************/
/* Affiche en bas d'ecran les caract du texte sur PCB
* Entree :
* pointeur de la description du texte
*/
{
wxString Line;
frame->MsgPanel->EraseMsgBox();
if( pt_texte->Type() == TYPE_COTATION )
Affiche_1_Parametre( frame, 1, _( "COTATION" ), pt_texte->m_Text, DARKGREEN );
else
Affiche_1_Parametre( frame, 1, _( "PCB Text" ), pt_texte->m_Text, DARKGREEN );
Line = _( "Layer " );
Line << pt_texte->GetLayer() + 1;
Affiche_1_Parametre( frame, 28, _( "Layer:" ), Line,
g_DesignSettings.m_LayerColor[pt_texte->GetLayer()] );
Affiche_1_Parametre( frame, 36, _( "Mirror" ), wxEmptyString, GREEN );
if( (pt_texte->m_Miroir & 1) )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "No" ), DARKGREEN );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN );
Line.Printf( wxT( "%.1f" ), (float) pt_texte->m_Orient / 10 );
Affiche_1_Parametre( frame, 43, _( "Orient" ), Line, DARKGREEN );
valeur_param( pt_texte->m_Width, Line );
Affiche_1_Parametre( frame, 50, _( "Width" ), Line, MAGENTA );
valeur_param( pt_texte->m_Size.x, Line );
Affiche_1_Parametre( frame, 60, _( "H Size" ), Line, RED );
valeur_param( pt_texte->m_Size.y, Line );
Affiche_1_Parametre( frame, 70, _( "V Size" ), Line, RED );
}
......@@ -30,7 +30,6 @@ OBJECTS= \
set_color.o \
gerbview_config.o \
class_marker.o \
affiche.o \
tracepcb.o \
class_pcb_text.o\
trpiste.o \
......
This diff is collapsed.
/******************************************/
/** cfg.cpp : configuration pour Gerbview */
/******************************************/
/* lit ou met a jour la configuration de PCBNEW */
#include "fctsys.h"
#include "common.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "cfg.h"
#include "id.h"
#include "hotkeys_basic.h"
#include "hotkeys.h"
#include "protos.h"
/* Local functions */
static bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose );
/* Variables locales */
#define HOTKEY_FILENAME wxT("gerbview")
/*************************************************************/
void WinEDA_GerberFrame::Process_Config(wxCommandEvent& event)
/*************************************************************/
{
int id = event.GetId();
wxPoint pos;
wxString FullFileName;
pos = GetPosition();
pos.x += 20; pos.y += 20;
switch( id )
{
case ID_COLORS_SETUP :
DisplayColorSetupFrame(this, pos);
break;
case ID_CONFIG_REQ : // Creation de la fenetre de configuration
{
InstallConfigFrame(pos);
break;
}
case ID_PCB_TRACK_SIZE_SETUP:
case ID_PCB_LOOK_SETUP:
case ID_OPTIONS_SETUP:
InstallPcbOptionsFrame(pos, id);
break;
case ID_CONFIG_SAVE:
Update_config();
break;
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_Gerbview_Hokeys_Descr, true);
break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
Read_Hotkey_Config( this, true);
break;
default:
DisplayError(this, wxT("WinEDA_GerberFrame::Process_Config internal error"));
}
}
/*****************************************************/
bool Read_Config()
/*****************************************************/
/* lit la configuration, si elle n'a pas deja etee lue
1 - lit gerbview.cnf
2 - si non trouve lit <chemin de gerbview.exe>/gerbview.cnf
3 - si non trouve: init des variables aux valeurs par defaut
Retourne un pointeur su le message d'erreur a afficher
*/
{
g_Prj_Config_Filename_ext = wxT(".cnf");
EDA_Appl->ReadProjectConfig( wxT("gerbview"), GROUP, ParamCfgList, FALSE);
/* Inits autres variables */
if (ScreenPcb) ScreenPcb->SetGrid(TmpGrid);
if ( g_PhotoFilenameExt.IsEmpty() ) g_PhotoFilenameExt = wxT(".pho");
if ( g_DrillFilenameExt.IsEmpty() ) g_DrillFilenameExt = wxT(".drl");
if ( g_PenFilenameExt.IsEmpty() ) g_PenFilenameExt = wxT(".pen");
return TRUE;
}
/******************************************/
void WinEDA_GerberFrame::Update_config()
/******************************************/
/*
creation du fichier de config
*/
{
wxString FullFileName;
wxString mask( wxT("*") ),
g_Prj_Config_Filename_ext = wxT(".cnf";)
mask += g_Prj_Config_Filename_ext;
FullFileName = wxT("gerbview");
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector(_("Save config file"),
wxEmptyString, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_SAVE,
TRUE
);
if ( FullFileName.IsEmpty() ) return;
/* ecriture de la configuration */
EDA_Appl->WriteProjectConfig(FullFileName, GROUP, ParamCfgList);
}
/***************************************************************/
bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose )
/***************************************************************/
/*
* Read the hotkey files config for pcbnew and module_edit
*/
{
wxString FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile(FullFileName, s_Gerbview_Hokeys_Descr, verbose);
}
......@@ -494,7 +494,7 @@ public:
wxSize m_Size; /* XY size of text */
int m_Width; /* text width */
int m_Orient; /* Orient in 0.1 degrees */
int m_Miroir; // Display Normal / mirror
bool m_Mirror; // Display Normal / mirror
int m_Attributs; /* flags (visible...) */
bool m_Italic; /* true to simulate an italic font... */
GRTextHorizJustifyType m_HJustify; /* Horiz Justify */
......
......@@ -891,7 +891,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
INVERT_ANGLE( STRUCT->m_Orient );
if( (STRUCT->GetLayer() == COPPER_LAYER_N) || (STRUCT->GetLayer() == CMP_N) )
{
STRUCT->m_Miroir ^= 1; /* inverse miroir */
STRUCT->m_Mirror = not STRUCT->m_Mirror; /* inverse miroir */
}
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
break;
......
......@@ -120,12 +120,14 @@ bool COTATION::ReadCotationDescr( FILE* File, int* LineNum )
if( Line[0] == 'P' )
{
int normal_display = 1;
sscanf( Line + 2, " %d %d %d %d %d %d %d",
&m_Text->m_Pos.x, &m_Text->m_Pos.y,
&m_Text->m_Size.x, &m_Text->m_Size.y,
&m_Text->m_Width, &m_Text->m_Orient,
&m_Text->m_Miroir );
&normal_display );
m_Text->m_Mirror = normal_display ? false : true;
m_Pos = m_Text->m_Pos;
continue;
}
......@@ -325,7 +327,7 @@ bool COTATION::Save( FILE* aFile ) const
m_Text->m_Pos.x, m_Text->m_Pos.y,
m_Text->m_Size.x, m_Text->m_Size.y,
m_Text->m_Width, m_Text->m_Orient,
m_Text->m_Miroir );
m_Text->m_Mirror ? 0 : 1 );
fprintf( aFile, "Sb %d %d %d %d %d %d\n", S_SEGMENT,
Barre_ox, Barre_oy,
......
......@@ -33,7 +33,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
{
m_Parent = source->m_Parent;
Pback = Pnext = NULL;
m_Miroir = source->m_Miroir;
m_Mirror = source->m_Mirror;
m_Size = source->m_Size;
m_Orient = source->m_Orient;
m_Pos = source->m_Pos;
......@@ -78,8 +78,12 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum )
if( strncmp( Line, "De", 2 ) == 0 )
{
style[0] = 0;
sscanf( Line + 2, " %d %d %lX %s\n", &m_Layer, &m_Miroir,
int normal_display = 1;
sscanf( Line + 2, " %d %d %lX %s\n", &m_Layer, &normal_display,
&m_TimeStamp, style );
m_Mirror = normal_display ? false : true;
if( m_Layer < FIRST_COPPER_LAYER )
m_Layer = FIRST_COPPER_LAYER;
if( m_Layer > LAST_NO_COPPER_LAYER )
......@@ -116,7 +120,9 @@ bool TEXTE_PCB::Save( FILE* aFile ) const
fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( m_Text ) );
fprintf( aFile, "Po %d %d %d %d %d %d\n",
m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Width, m_Orient );
fprintf( aFile, "De %d %d %lX %s\n", m_Layer, m_Miroir, m_TimeStamp, style );
fprintf( aFile, "De %d %d %lX %s\n", m_Layer,
m_Mirror ? 0 : 1,
m_TimeStamp, style );
if( fprintf( aFile, "$EndTEXTPCB\n" ) != sizeof("$EndTEXTPCB\n")-1 )
goto out;
......@@ -177,7 +183,7 @@ void TEXTE_PCB::Display_Infos( WinEDA_DrawFrame* frame )
g_DesignSettings.m_LayerColor[m_Layer] & MASKCOLOR );
Affiche_1_Parametre( frame, 36, _( "Mirror" ), wxEmptyString, GREEN );
if( m_Miroir & 1 )
if( ! m_Mirror )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "No" ), DARKGREEN );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN );
......
......@@ -114,7 +114,7 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame*
m_Mirror = new wxRadioBox( this, -1, _( "Display" ),
wxDefaultPosition, wxSize( -1, -1 ), 2, display_msg,
1, wxRA_SPECIFY_COLS );
if( !Cotation->m_Text->m_Miroir )
if( Cotation->m_Text->m_Mirror )
m_Mirror->SetSelection( 1 );;
RightBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 );
......@@ -173,7 +173,7 @@ void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event )
CurrentCotation->m_Text->m_Size = m_TxtSizeCtrl->GetValue();
CurrentCotation->m_Text->m_Width = CurrentCotation->m_Width =
m_TxtWidthCtrl->GetValue();
CurrentCotation->m_Text->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0;
CurrentCotation->m_Text->m_Mirror = (m_Mirror->GetSelection() == 1) ? true : false;
CurrentCotation->SetLayer( m_SelLayerBox->GetChoice() + FIRST_NO_COPPER_LAYER );
CurrentCotation->m_Text->SetLayer( m_SelLayerBox->GetChoice() + FIRST_NO_COPPER_LAYER );
......@@ -254,7 +254,6 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC )
Cotation->FlecheD2_ox = Cotation->FlecheD2_fx = pos.x;
Cotation->FlecheD2_oy = Cotation->FlecheD2_fy = pos.y;
Cotation->m_Text->m_Miroir = 1;
Cotation->m_Text->m_Size = g_DesignSettings.m_PcbTextSize;
Cotation->m_Text->m_Width = g_DesignSettings.m_PcbTextWidth;
......
......@@ -166,7 +166,7 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p
m_Mirror = new wxRadioBox( this, -1, _( "Display" ),
wxDefaultPosition, wxSize( -1, -1 ), 2, display_msg,
1, wxRA_SPECIFY_COLS );
if( !TextPCB->m_Miroir )
if( TextPCB->m_Mirror )
m_Mirror->SetSelection( 1 );
MiddleBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 );
......@@ -227,7 +227,7 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event )
if ( CurrentTextPCB->m_Width > max_tickness)
CurrentTextPCB->m_Width = max_tickness;
CurrentTextPCB->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0;
CurrentTextPCB->m_Mirror = (m_Mirror->GetSelection() == 1) ? true : false;
CurrentTextPCB->m_Orient = m_Orient->GetSelection() * 900;
CurrentTextPCB->SetLayer( m_SelLayerBox->GetChoice() );
CurrentTextPCB->m_Italic = m_Style->GetSelection() ? 1 : 0;
......
......@@ -138,9 +138,9 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
/* Mise a jour des caracteristiques */
TextePcb->m_Flags = IS_NEW;
TextePcb->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
TextePcb->m_Miroir = 1;
TextePcb->m_Mirror = false;
if( TextePcb->GetLayer() == COPPER_LAYER_N )
TextePcb->m_Miroir = 0;
TextePcb->m_Mirror = true;
TextePcb->m_Size = g_DesignSettings.m_PcbTextSize;
TextePcb->m_Pos = GetScreen()->m_Curseur;
......
......@@ -421,7 +421,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_texte->m_Pos.y = -pt_texte->m_Pos.y;
pt_texte->m_Pos.y += Module->m_Pos.y;
pt_texte->m_Pos0.y = pt_texte->m_Pos0.y;
pt_texte->m_Miroir = 1;
pt_texte->m_Miroir = false;
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
pt_texte->SetLayer( Module->GetLayer() );
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
......@@ -434,7 +434,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
if( (Module->GetLayer() == SILKSCREEN_N_CU)
|| (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == COPPER_LAYER_N) )
pt_texte->m_Miroir = 0;
pt_texte->m_Miroir = true;
/* Inversion miroir de la Valeur et mise en miroir : */
pt_texte = Module->m_Value;
......@@ -442,7 +442,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_texte->m_Pos.y = -pt_texte->m_Pos.y;
pt_texte->m_Pos.y += Module->m_Pos.y;
pt_texte->m_Pos0.y = pt_texte->m_Pos0.y;
pt_texte->m_Miroir = 1;
pt_texte->m_Miroir = false;
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
pt_texte->SetLayer( Module->GetLayer() );
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
......@@ -455,7 +455,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
if( (Module->GetLayer() == SILKSCREEN_N_CU)
|| (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == COPPER_LAYER_N) )
pt_texte->m_Miroir = 0;
pt_texte->m_Miroir = true;
/* Inversion miroir des dessins de l'empreinte : */
PtStruct = Module->m_Drawings;
......@@ -489,7 +489,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_texte->m_Pos.y = -pt_texte->m_Pos.y;
pt_texte->m_Pos.y += Module->m_Pos.y;
pt_texte->m_Pos0.y = pt_texte->m_Pos0.y;
pt_texte->m_Miroir = 1;
pt_texte->m_Miroir = false;
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
pt_texte->SetLayer( Module->GetLayer() );
......@@ -505,7 +505,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
|| Module->GetLayer() == ADHESIVE_N_CU
|| Module->GetLayer() == COPPER_LAYER_N )
{
pt_texte->m_Miroir = 0;
pt_texte->m_Miroir = true;
}
break;
......
......@@ -563,7 +563,7 @@ void PlotTextePcb( TEXTE_PCB* pt_texte, int format_plot, int masque_layer )
/****************************************************************************/
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules */
{
int no_miroir, orient, thickness;
int orient, thickness;
wxPoint pos;
wxSize size;
......@@ -576,10 +576,9 @@ void PlotTextePcb( TEXTE_PCB* pt_texte, int format_plot, int masque_layer )
size = pt_texte->m_Size;
pos = pt_texte->m_Pos;
orient = pt_texte->m_Orient;
no_miroir = pt_texte->m_Miroir & 1;
thickness = pt_texte->m_Width;
if( no_miroir == FALSE )
if( pt_texte->m_Mirror )
size.x = -size.x;
Plot_1_texte( format_plot, pt_texte->m_Text, orient,
......
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