Commit f34be930 authored by charras's avatar charras

Ensure graphic and footprint texts have a sufficient size to be seen on screen.(bug 1909165).

parent 58c7bafe
...@@ -5,6 +5,12 @@ Started 2007-June-11 ...@@ -5,6 +5,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Mar-24 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew
Ensure graphic and footprint texts have a sufficient size to be seen on screen.
(bug 1909165, due to text on edge layer with a 0 value for X size)
2008-Mar-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Mar-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew +pcbnew
......
/******************************************************************/ /***************************************************************/
/* drawpanel.cpp - fonctions des classes du type WinEDA_DrawPanel */ /* base_screen.cpp - fonctions des classes du type BASE_SCREEN */
/******************************************************************/ /***************************************************************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
...@@ -49,17 +49,17 @@ BASE_SCREEN::~BASE_SCREEN() ...@@ -49,17 +49,17 @@ BASE_SCREEN::~BASE_SCREEN()
void BASE_SCREEN::InitDatas() void BASE_SCREEN::InitDatas()
/*******************************/ /*******************************/
{ {
m_ScreenNumber = m_NumberOfScreen = 1; /* gestion hierarchie: Root: ScreenNumber = 1 */ m_ScreenNumber = m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */
m_Zoom = 32; m_Zoom = 32;
m_Grid = wxSize( 50, 50 ); /* pas de la grille */ m_Grid = wxSize( 50, 50 ); /* Default grid size */
m_UserGrid = g_UserGrid; /* pas de la grille "utilisateur" */ m_UserGrid = g_UserGrid; /* User Default grid size */
m_UserGridIsON = FALSE; m_UserGridIsON = FALSE;
m_UserGridUnit = g_UserGrid_Unit; m_UserGridUnit = g_UserGrid_Unit;
m_Diviseur_Grille = 1; m_Diviseur_Grille = 1;
m_Center = TRUE; m_Center = TRUE;
/* offsets pour tracer le circuit sur l'ecran */ /* Init draw offset and default page size */
switch( m_Type ) // Init taille sheet par defaut switch( m_Type )
{ {
case SCHEMATIC_FRAME: case SCHEMATIC_FRAME:
m_Center = FALSE; m_Center = FALSE;
...@@ -100,9 +100,9 @@ void BASE_SCREEN::InitDatas() ...@@ -100,9 +100,9 @@ void BASE_SCREEN::InitDatas()
SetCurItem( NULL ); SetCurItem( NULL );
/* indicateurs divers */ /* indicateurs divers */
m_FlagRefreshReq = 0; /* indique que l'ecran doit redessine */ m_FlagRefreshReq = 0; /* Redraw screen requste flag */
m_FlagModified = 0; // indique modif du PCB,utilise pour eviter une sortie sans sauvegarde m_FlagModified = 0; // Set when any change is made on borad
m_FlagSave = 1; // indique sauvegarde auto faite m_FlagSave = 1; // Used in auto save: set when an auto save is made
} }
...@@ -148,8 +148,8 @@ int BASE_SCREEN::GetInternalUnits() ...@@ -148,8 +148,8 @@ int BASE_SCREEN::GetInternalUnits()
wxSize BASE_SCREEN::ReturnPageSize() wxSize BASE_SCREEN::ReturnPageSize()
/*****************************************/ /*****************************************/
/* Retourne en unites internes la taille de la feuille de dessin /* Return in internal units the page size
* (la taille de la feuille est connue en 1/1000 ") * Note: the page size is handled in 1/1000 ", not in internal units
*/ */
{ {
wxSize PageSize; wxSize PageSize;
...@@ -208,7 +208,6 @@ void BASE_SCREEN::SetZoomList( const int* zoomlist ) ...@@ -208,7 +208,6 @@ void BASE_SCREEN::SetZoomList( const int* zoomlist )
/***********************************/ /***********************************/
void BASE_SCREEN::SetFirstZoom() void BASE_SCREEN::SetFirstZoom()
/***********************************/ /***********************************/
/* ajuste le coeff de zoom a 1*/
{ {
m_Zoom = 1; m_Zoom = 1;
} }
...@@ -225,7 +224,6 @@ int BASE_SCREEN::GetZoom() const ...@@ -225,7 +224,6 @@ int BASE_SCREEN::GetZoom() const
/***********************************/ /***********************************/
void BASE_SCREEN::SetZoom( int coeff ) void BASE_SCREEN::SetZoom( int coeff )
/***********************************/ /***********************************/
/* ajuste le coeff de zoom a coeff */
{ {
m_Zoom = coeff; m_Zoom = coeff;
if( m_Zoom < 1 ) if( m_Zoom < 1 )
......
...@@ -559,7 +559,7 @@ void EDA_TextStruct::CreateDrawData() ...@@ -559,7 +559,7 @@ void EDA_TextStruct::CreateDrawData()
/* lorsque les chars sont trop petits pour etre dessines, /* lorsque les chars sont trop petits pour etre dessines,
* le texte est symbolise par une barre */ * le texte est symbolise par une barre */
m_ZoomLevelDrawable = m_Size.x / 3; m_ZoomLevelDrawable = MAX( ABS(m_Size.x), ABS(m_Size.y) ) / 3;
dx = (espacement * nbchar) / 2; dx = (espacement * nbchar) / 2;
dy = size_v / 2; /* Decalage du debut du texte / centre */ dy = size_v / 2; /* Decalage du debut du texte / centre */
......
No preview for this file type
This diff is collapsed.
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include "3d_struct.h" #include "3d_struct.h"
#include "protos.h" #include "protos.h"
#define MAX_WIDTH 10000 // Epaisseur (en 1/10000 ") max raisonnable des traits, textes...
/*********************************************************************************/ /*********************************************************************************/
void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int dim_ancre, int draw_mode ) int dim_ancre, int draw_mode )
...@@ -738,11 +736,16 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -738,11 +736,16 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
ReadDelimitedText( BufLine, Line, sizeof(BufLine) ); ReadDelimitedText( BufLine, Line, sizeof(BufLine) );
DrawText->m_Text = CONV_FROM_UTF8( BufLine ); DrawText->m_Text = CONV_FROM_UTF8( BufLine );
// Controle d'epaisseur raisonnable: // Test for a reasonnable width:
if( DrawText->m_Width <= 1 ) if( DrawText->m_Width <= 1 )
DrawText->m_Width = 1; DrawText->m_Width = 1;
if( DrawText->m_Width > MAX_WIDTH ) if( DrawText->m_Width > TEXTS_MAX_WIDTH )
DrawText->m_Width = MAX_WIDTH; DrawText->m_Width = TEXTS_MAX_WIDTH;
// Test for a reasonnable size:
if ( DrawText->m_Size.x < TEXTS_MIN_SIZE )
DrawText->m_Size.x = TEXTS_MIN_SIZE;
if ( DrawText->m_Size.y < TEXTS_MIN_SIZE )
DrawText->m_Size.y = TEXTS_MIN_SIZE;
break; break;
case 'D': /* lecture du contour */ case 'D': /* lecture du contour */
......
...@@ -93,6 +93,9 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum ) ...@@ -93,6 +93,9 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum )
sscanf( Line + 2, " %d %d %d %d %d %d", sscanf( Line + 2, " %d %d %d %d %d %d",
&m_Pos.x, &m_Pos.y, &m_Size.x, &m_Size.y, &m_Pos.x, &m_Pos.y, &m_Size.x, &m_Size.y,
&m_Width, &m_Orient ); &m_Width, &m_Orient );
// Ensure the text has minimal size to see this text on screen:
if ( m_Size.x < 5 ) m_Size.x = 5;
if ( m_Size.y < 5 ) m_Size.y = 5;
continue; continue;
} }
if( strncmp( Line, "De", 2 ) == 0 ) if( strncmp( Line, "De", 2 ) == 0 )
......
This diff is collapsed.
...@@ -260,7 +260,7 @@ static PARAM_CFG_INT TextePcbDimVCfg ...@@ -260,7 +260,7 @@ static PARAM_CFG_INT TextePcbDimVCfg
wxT( "TxtPcbV" ), /* Keyword */ wxT( "TxtPcbV" ), /* Keyword */
&g_DesignSettings.m_PcbTextSize.y, /* Parameter address */ &g_DesignSettings.m_PcbTextSize.y, /* Parameter address */
600, /* Default value */ 600, /* Default value */
10, 2000 /* Valeurs extremes */ TEXTS_MIN_SIZE, TEXTS_MAX_SIZE /* Valeurs extremes */
); );
static PARAM_CFG_INT TextePcbDimHCfg static PARAM_CFG_INT TextePcbDimHCfg
...@@ -268,7 +268,7 @@ static PARAM_CFG_INT TextePcbDimHCfg ...@@ -268,7 +268,7 @@ static PARAM_CFG_INT TextePcbDimHCfg
wxT( "TxtPcbH" ), /* Keyword */ wxT( "TxtPcbH" ), /* Keyword */
&g_DesignSettings.m_PcbTextSize.x, /* Parameter address */ &g_DesignSettings.m_PcbTextSize.x, /* Parameter address */
600, /* Default value */ 600, /* Default value */
10, 2000 /* Valeurs extremes */ TEXTS_MIN_SIZE, TEXTS_MAX_SIZE /* Valeurs extremes */
); );
static PARAM_CFG_SETCOLOR ColorLayer0Cfg // CU Layer Color static PARAM_CFG_SETCOLOR ColorLayer0Cfg // CU Layer Color
...@@ -556,7 +556,7 @@ static PARAM_CFG_INT TexteModDimVCfg ...@@ -556,7 +556,7 @@ static PARAM_CFG_INT TexteModDimVCfg
wxT( "TxtModV" ), /* Keyword */ wxT( "TxtModV" ), /* Keyword */
&ModuleTextSize.y, /* Parameter address */ &ModuleTextSize.y, /* Parameter address */
500, /* Default value */ 500, /* Default value */
1, 20000 /* Valeurs extremes */ TEXTS_MIN_SIZE, TEXTS_MAX_SIZE /* Valeurs extremes */
); );
static PARAM_CFG_INT TexteModDimHCfg static PARAM_CFG_INT TexteModDimHCfg
...@@ -564,7 +564,7 @@ static PARAM_CFG_INT TexteModDimHCfg ...@@ -564,7 +564,7 @@ static PARAM_CFG_INT TexteModDimHCfg
wxT( "TxtModH" ), /* Keyword */ wxT( "TxtModH" ), /* Keyword */
&ModuleTextSize.x, /* Parameter address */ &ModuleTextSize.x, /* Parameter address */
500, /* Default value */ 500, /* Default value */
1, 20000 /* Valeurs extremes */ TEXTS_MIN_SIZE, TEXTS_MAX_SIZE /* Valeurs extremes */
); );
static PARAM_CFG_INT TexteModWidthCfg static PARAM_CFG_INT TexteModWidthCfg
...@@ -572,7 +572,7 @@ static PARAM_CFG_INT TexteModWidthCfg ...@@ -572,7 +572,7 @@ static PARAM_CFG_INT TexteModWidthCfg
wxT( "TxtModW" ), /* Keyword */ wxT( "TxtModW" ), /* Keyword */
&ModuleTextWidth, /* Parameter address */ &ModuleTextWidth, /* Parameter address */
100, /* Default value */ 100, /* Default value */
1, 10000 /* Valeurs extremes */ 1, TEXTS_MAX_WIDTH /* Valeurs extremes */
); );
static PARAM_CFG_SETCOLOR ColorAncreModCfg static PARAM_CFG_SETCOLOR ColorAncreModCfg
......
...@@ -27,7 +27,11 @@ ...@@ -27,7 +27,11 @@
#define END 1 #define END 1
#define DIM_ANCRE_MODULE 3 /* Anchor size (footprint centre) */ #define DIM_ANCRE_MODULE 3 /* Anchor size (footprint centre) */
#define DIM_ANCRE_TEXTE 2 /* nchor size (Text centre) */ #define DIM_ANCRE_TEXTE 2 /* Anchor size (Text centre) */
#define TEXTS_MIN_SIZE 50 // Min size in pcbnew units value (50 * 0.0001 mils)
#define TEXTS_MAX_SIZE 100000 // Min size in pcbnew units value (1 inch) )
#define TEXTS_MAX_WIDTH 5000 // Max width in pcbnew units value (0.5 inches)
/* Used in Zoom menu */ /* Used in Zoom menu */
#define ZOOM_PLUS -1 #define ZOOM_PLUS -1
......
...@@ -202,6 +202,17 @@ void WinEDA_TextPCBPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (eve ...@@ -202,6 +202,17 @@ void WinEDA_TextPCBPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (eve
void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event ) void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event )
/**************************************************************************************/ /**************************************************************************************/
{ {
// test for acceptable values for parameters:
wxSize newsize = m_TxtSizeCtrl->GetValue();
if ( newsize.x < TEXTS_MIN_SIZE )
newsize.x = TEXTS_MIN_SIZE;
if ( newsize.y < TEXTS_MIN_SIZE )
newsize.y = TEXTS_MIN_SIZE;
if ( newsize.x > TEXTS_MAX_WIDTH )
newsize.x = TEXTS_MAX_WIDTH;
if ( newsize.y > TEXTS_MAX_WIDTH )
newsize.y = TEXTS_MAX_WIDTH;
if( m_DC ) // Effacement ancien texte if( m_DC ) // Effacement ancien texte
{ {
CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, wxPoint( 0, 0 ), GR_XOR ); CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, wxPoint( 0, 0 ), GR_XOR );
...@@ -212,12 +223,18 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event ) ...@@ -212,12 +223,18 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event )
CurrentTextPCB->m_Text = m_Name->GetValue(); CurrentTextPCB->m_Text = m_Name->GetValue();
} }
CurrentTextPCB->m_Pos = m_TxtPosCtrl->GetValue(); CurrentTextPCB->m_Pos = m_TxtPosCtrl->GetValue();
CurrentTextPCB->m_Size = m_TxtSizeCtrl->GetValue(); CurrentTextPCB->m_Size = newsize;
CurrentTextPCB->m_Width = m_TxtWidthCtlr->GetValue(); CurrentTextPCB->m_Width = m_TxtWidthCtlr->GetValue();
// test for acceptable values for parameters:
if ( CurrentTextPCB->m_Width > TEXTS_MAX_WIDTH)
CurrentTextPCB->m_Width = TEXTS_MAX_WIDTH;
CurrentTextPCB->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0; CurrentTextPCB->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0;
CurrentTextPCB->m_Orient = m_Orient->GetSelection() * 900; CurrentTextPCB->m_Orient = m_Orient->GetSelection() * 900;
CurrentTextPCB->SetLayer( m_SelLayerBox->GetChoice() ); CurrentTextPCB->SetLayer( m_SelLayerBox->GetChoice() );
CurrentTextPCB->CreateDrawData(); CurrentTextPCB->CreateDrawData();
if( m_DC ) // Affichage nouveau texte if( m_DC ) // Affichage nouveau texte
{ {
/* Redessin du Texte */ /* Redessin du Texte */
......
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