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 \
......
/****************************************/
/* traitement des textes sur empreintes */
/****************************************/
#include "fctsys.h"
#include "common.h"
#include "gerbview.h"
#include "protos.h"
#define L_MIN_DESSIN 1 /* seuil de largeur des segments pour trace autre que filaire */
/* Fonctions externe: */
/* Routines Locales */
static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, int flag );
static void Exit_Texte_Pcb( WinEDA_DrawFrame* frame, wxDC* DC );
/* variables exportees */
int Angle_Rot_Fin = 50;/* Valeur par defaut de l'angle de rotation fine */
/* Variables locales : */
static int LocalOrient;
static int LocalDimH;
static int LocalDimV;
static int LocalWidth;
static wxPoint old_pos; // position originelle du texte selecte
/**************************************/
/* void Exit_Texte_Pcb(COMMAND * Cmd) */
/**************************************/
/*
* Routine de sortie du menu edit texte Pcb
* Si un texte est selectionne, ses coord initiales sont regenerees
*/
void Exit_Texte_Pcb( WinEDA_DrawFrame* frame, wxDC* DC )
{
TEXTE_PCB* TextePcb;
TextePcb = (TEXTE_PCB*) frame->CurrentScreen->m_CurrentPcbItem;
if( TextePcb )
{
Trace_1_texte_pcb( frame->DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
TextePcb->m_Pos = old_pos;
Trace_1_texte_pcb( frame->DrawPanel, DC, TextePcb, 0, 0, GR_OR );
}
frame->CurrentScreen->ManageCurseur = NULL;
frame->CurrentScreen->ForceCloseManageCurseur = NULL;
frame->CurrentScreen->m_CurrentPcbItem = NULL;
}
/******************************************/
/* void Place_Texte_Pcb(MTOOL_EDA * Menu) */
/******************************************/
/* Routine de placement du texte en cours de deplacement
*/
void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
{
if( TextePcb == NULL )
return;
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
TextePcb->m_Layer = CurrentScreen->m_Active_Layer;
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_OR );
CurrentScreen->ManageCurseur = NULL;
CurrentScreen->ForceCloseManageCurseur = NULL;
CurrentScreen->m_CurrentPcbItem = NULL;
CurrentScreen->SetModify();
}
/*****************************************/
/* void StartMoveTextePcb(COMMAND * Cmd) */
/*****************************************/
/* Routine de preparation du deplacement d'un texte
*/
void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
{
if( TextePcb == NULL )
return;
old_pos = TextePcb->m_Pos;
Affiche_Infos_PCB_Texte( this, TextePcb );
CurrentScreen->ManageCurseur = Move_Texte_Pcb;
CurrentScreen->ForceCloseManageCurseur = Exit_Texte_Pcb;
CurrentScreen->m_CurrentPcbItem = TextePcb;
}
/*****************************/
/* void Move_Texte_Pcb() */
/*****************************/
/* Routine deplacant le texte PCB suivant le curseur de la souris */
static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, int flag )
{
TEXTE_PCB* TextePcb = (TEXTE_PCB*)
panel->m_Parent->CurrentScreen->m_CurrentPcbItem;
if( TextePcb == NULL )
return;
/* effacement du texte : */
if( flag == CURSEUR_MOVED )
Trace_1_texte_pcb( panel, DC, TextePcb, 0, 0, GR_XOR );
TextePcb->m_Pos = panel->m_Parent->CurrentScreen->m_Curseur;
TextePcb->m_Layer = panel->m_Parent->CurrentScreen->m_Active_Layer;
/* Redessin du Texte */
Trace_1_texte_pcb( panel, DC, TextePcb, 0, 0, GR_XOR );
}
/********************************/
/* void Delete_Texte_Pcb(COMMAND * Cmd) */
/********************************/
void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
{
if( TextePcb == NULL )
return;
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
/* Suppression du texte en Memoire*/
TextePcb->DeleteStructure();
CurrentScreen->ManageCurseur = NULL;
CurrentScreen->ForceCloseManageCurseur = NULL;
CurrentScreen->m_CurrentPcbItem = NULL;
}
/****************************/
/* void Add_Texte_Pcb(COMMAND * Cmd) */
/****************************/
TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
{
char buf_new_texte[256];
TEXTE_PCB* TextePcb;
buf_new_texte[0] = 0;
Get_Message( "Texte:", buf_new_texte, this );
if( *buf_new_texte <=' ' )
return NULL;
CurrentScreen->SetModify();
/* placement du texte en memoire */
TextePcb = new TEXTE_PCB( pt_pcb );
/* Chainage de la nouvelle structure en debut de liste */
TextePcb->Pnext = pt_pcb->m_Drawings;
TextePcb->Pback = (EDA_BaseStruct*) pt_pcb;
if( pt_pcb->m_Drawings )
pt_pcb->m_Drawings->Pback = (EDA_BaseStruct*) TextePcb;
pt_pcb->m_Drawings = (EDA_BaseStruct*) TextePcb;
/* Mise a jour des caracteristiques */
TextePcb->m_Layer = CurrentScreen->m_Active_Layer;
TextePcb->m_Miroir = 1;
if( CurrentScreen->m_Active_Layer == COPPER_LAYER_N )
TextePcb->m_Miroir = 0;
TextePcb->m_Size.y = Texte_Pcb_DimV;
TextePcb->m_Size.x = Texte_Pcb_DimH;
TextePcb->m_Pos = CurrentScreen->m_Curseur;
TextePcb->m_Width = Texte_Segment_Largeur;
TextePcb->m_Layer = CurrentScreen->m_Active_Layer;
/* Copie du texte */
TextePcb->SetText( buf_new_texte );
/* Dessin du Texte */
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
Affiche_Infos_PCB_Texte( this, TextePcb );
StartMoveTextePcb( TextePcb, DC );
return TextePcb;
}
/*******************************/
/* void Rotate_Texte_Pcb(COMMAND * Cmd) */
/*******************************/
void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
{
int angle = 900;
int drawmode = GR_XOR;
if( TextePcb == NULL )
return;
/* effacement du texte : */
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
TextePcb->m_Orient += angle;
if( TextePcb->m_Orient >= 3600 )
TextePcb->m_Orient -= 3600;
if( TextePcb->m_Orient < 0 )
TextePcb->m_Orient += 3600;
/* Redessin du Texte */
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, drawmode );
Affiche_Infos_PCB_Texte( this, TextePcb );
CurrentScreen->SetModify();
}
/***************************************************************/
/* void Trace_1_texte(char * ptr,int ox,int oy),int mode_color */
/***************************************************************/
/*
* Trace de 1 texte :
* ptr = pointeur sur le debut de la description du texte
* ox, oy = Offsets de trace
* mode_color = GR_OR, GR_XOR..
*/
void Trace_1_texte_pcb( WinEDA_DrawPanel* panel, wxDC* DC,
TEXTE_PCB* pt_texte, int ox, int oy, int DrawMode )
{
int zoom = panel->m_Parent->CurrentScreen->GetZoom();
int cX, cY;
int screen_epais, gcolor;
int size_h, size_v, width;
char* ptr;
int orient;
if( pt_texte->GetText() == NULL )
return;
/* lecture des caracteristiques du texte */
size_h = pt_texte->m_Size.x; size_v = pt_texte->m_Size.y;
orient = pt_texte->m_Orient;
width = pt_texte->m_Width;
screen_epais = width / zoom;
if( (DisplayOpt.DisplayDrawItems == FILAIRE) || ( screen_epais < L_MIN_DESSIN) )
width = 0;
/* calcul de la position du texte */
cX = pt_texte->m_Pos.x - ox;
cY = pt_texte->m_Pos.y - oy;
if( pt_texte->m_Miroir == 0 )
size_h = -size_h;
/* choix de la couleur du texte : */
gcolor = color_layer[pt_texte->m_Layer];
ptr = pt_texte->GetText(); /* ptr pointe 1er caractere du texte */
GRSetDrawMode( DC, DrawMode );
/* trace ancre du texte */
if( (E_ancre_color & ITEM_NON_VISIBLE) == 0 )
{
GRLine( panel, DC, cX - (2 * zoom), cY,
cX + (2 * zoom), cY, E_ancre_color );
GRLine( panel, DC, cX, cY - (2 * zoom),
cX, cY + (2 * zoom), E_ancre_color );
}
/* trace du texte */
Display_1_Texte( panel, DC, ptr, strlen( ptr ), cX, cY,
size_h, size_v, width, orient, gcolor );
}
/*********************************************/
/* void InstallEditCaractMenu(COMMAND * Cmd) */
/*********************************************/
static void InstallEditCaractMenu( COMMAND* Cmd )
{
#if 0
TEXTE_PCB* TextePcb = PtTextePcbSelecte;
wxDC* DC = Cmd->DC;
if( TextePcb == NULL )
{
TextePcb = (TEXTE_PCB*) pt_pcb->Drawings;
while( ( TextePcb = Locate_Texte_Pcb( TextePcb, CURSEUR_OFF_GRILLE ) ) != 0 )
{
if( TextePcb->Layer == CurrentScreen->Active_Layer )
break;
// le Texte n'est pas sur la couche active
TextePcb = (TEXTE_PCB*) TextePcb->Pnext;
}
}
TextePcbEdite = TextePcb;
if( TextePcb == NULL )
{
DisplayError( "Texte non trouve sur cette couche", 10 );
Cmd->Menu->State = WAIT; DisplayMenu( DC, Cmd->Menu, NULL, ON );
return;
}
Affiche_Infos_PCB_Texte( Cmd, TextePcb );
if( TextePcb->orient >= 3600 )
TextePcb->orient -= 3600;
if( TextePcb->orient < 0 )
TextePcb->orient += 3600;
/* Init des variables */
strncpy( BufNameTxt.s, TextePcb->GetText(), sizeof(BufNameTxt.s) - 1 );
if( TextePcb->miroir )
Texte_Pcb_Miroir_Item.State = WAIT;
else
Texte_Pcb_Miroir_Item.State = RUN;
*(int*) Param_OrientText.param = TextePcb->orient;
*(int*) Param_DimHText.param = TextePcb->Size.x;
*(int*) Param_DimVText.param = TextePcb->Size.y;
*(int*) Param_EpaisText.param = TextePcb->width;
InstallNewList( Cmd );
#endif
}
/*****************************************/
/* void ChangeCaractTexte(COMMAND * Cmd) */
/*****************************************/
/* Change les caracteristiques du texte en cours d'edition
*/
void WinEDA_PcbFrame::EditTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
{
int drawmode = GR_OR;
char buf_new_texte[1024];
if( TextePcb == NULL )
return;
if( PtTextePcbSelecte )
drawmode = GR_XOR;
buf_new_texte[0] = 0;
Get_Message( "Texte:", buf_new_texte, this );
if( *buf_new_texte <=' ' )
return;
/* effacement du texte : */
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, GR_XOR );
if( strcmp( TextePcb->GetText(), buf_new_texte ) && strlen( buf_new_texte ) )
{
TextePcb->SetText( buf_new_texte );
CurrentScreen->SetModify();
}
while( LocalOrient >= 3600 )
LocalOrient -= 3600;
while( LocalOrient < 0 )
LocalOrient += 3600;
if( CurrentScreen->m_Active_Layer != TextePcb->m_Layer )
{
TextePcb->m_Layer = CurrentScreen->m_Active_Layer;
CurrentScreen->SetModify();
}
if( LocalOrient != TextePcb->m_Orient )
{
TextePcb->m_Orient = LocalOrient;
CurrentScreen->SetModify();
}
if( LocalDimV != TextePcb->m_Size.y )
{
TextePcb->m_Size.y = LocalDimV;
CurrentScreen->SetModify();
}
if( LocalDimH != TextePcb->m_Size.x )
{
TextePcb->m_Size.x = LocalDimH;
CurrentScreen->SetModify();
}
if( LocalWidth != TextePcb->m_Width )
{
TextePcb->m_Width = LocalWidth;
CurrentScreen->SetModify();
}
/* if( (Texte_Pcb_Miroir_Item.State == WAIT) && (TextePcb->miroir == 0) )
* {
* TextePcb->miroir = 1;
* CurrentScreen->SetModify();
* }
*
* if( (Texte_Pcb_Miroir_Item.State == RUN) && TextePcb->miroir )
* {
* TextePcb->miroir = 0;
* CurrentScreen->SetModify();
* }
*/
/* Redessin du Texte */
Trace_1_texte_pcb( DrawPanel, DC, TextePcb, 0, 0, drawmode );
Affiche_Infos_PCB_Texte( this, TextePcb );
}
/******************************************/
/** 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