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
Please add newer entries at the top, list the date and your name with
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>
================================================================================
+pcbnew
......
/******************************************************************/
/* drawpanel.cpp - fonctions des classes du type WinEDA_DrawPanel */
/******************************************************************/
/***************************************************************/
/* base_screen.cpp - fonctions des classes du type BASE_SCREEN */
/***************************************************************/
#ifdef __GNUG__
#pragma implementation
......@@ -49,17 +49,17 @@ BASE_SCREEN::~BASE_SCREEN()
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_Grid = wxSize( 50, 50 ); /* pas de la grille */
m_UserGrid = g_UserGrid; /* pas de la grille "utilisateur" */
m_Grid = wxSize( 50, 50 ); /* Default grid size */
m_UserGrid = g_UserGrid; /* User Default grid size */
m_UserGridIsON = FALSE;
m_UserGridUnit = g_UserGrid_Unit;
m_Diviseur_Grille = 1;
m_Center = TRUE;
/* offsets pour tracer le circuit sur l'ecran */
switch( m_Type ) // Init taille sheet par defaut
/* Init draw offset and default page size */
switch( m_Type )
{
case SCHEMATIC_FRAME:
m_Center = FALSE;
......@@ -100,9 +100,9 @@ void BASE_SCREEN::InitDatas()
SetCurItem( NULL );
/* indicateurs divers */
m_FlagRefreshReq = 0; /* indique que l'ecran doit redessine */
m_FlagModified = 0; // indique modif du PCB,utilise pour eviter une sortie sans sauvegarde
m_FlagSave = 1; // indique sauvegarde auto faite
m_FlagRefreshReq = 0; /* Redraw screen requste flag */
m_FlagModified = 0; // Set when any change is made on borad
m_FlagSave = 1; // Used in auto save: set when an auto save is made
}
......@@ -148,8 +148,8 @@ int BASE_SCREEN::GetInternalUnits()
wxSize BASE_SCREEN::ReturnPageSize()
/*****************************************/
/* Retourne en unites internes la taille de la feuille de dessin
* (la taille de la feuille est connue en 1/1000 ")
/* Return in internal units the page size
* Note: the page size is handled in 1/1000 ", not in internal units
*/
{
wxSize PageSize;
......@@ -208,7 +208,6 @@ void BASE_SCREEN::SetZoomList( const int* zoomlist )
/***********************************/
void BASE_SCREEN::SetFirstZoom()
/***********************************/
/* ajuste le coeff de zoom a 1*/
{
m_Zoom = 1;
}
......@@ -225,7 +224,6 @@ int BASE_SCREEN::GetZoom() const
/***********************************/
void BASE_SCREEN::SetZoom( int coeff )
/***********************************/
/* ajuste le coeff de zoom a coeff */
{
m_Zoom = coeff;
if( m_Zoom < 1 )
......
......@@ -559,7 +559,7 @@ void EDA_TextStruct::CreateDrawData()
/* lorsque les chars sont trop petits pour etre dessines,
* 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;
dy = size_v / 2; /* Decalage du debut du texte / centre */
......
No preview for this file type
This diff is collapsed.
......@@ -23,8 +23,6 @@
#include "3d_struct.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,
int dim_ancre, int draw_mode )
......@@ -738,11 +736,16 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
ReadDelimitedText( BufLine, Line, sizeof(BufLine) );
DrawText->m_Text = CONV_FROM_UTF8( BufLine );
// Controle d'epaisseur raisonnable:
// Test for a reasonnable width:
if( DrawText->m_Width <= 1 )
DrawText->m_Width = 1;
if( DrawText->m_Width > MAX_WIDTH )
DrawText->m_Width = MAX_WIDTH;
if( DrawText->m_Width > TEXTS_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;
case 'D': /* lecture du contour */
......
......@@ -93,6 +93,9 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum )
sscanf( Line + 2, " %d %d %d %d %d %d",
&m_Pos.x, &m_Pos.y, &m_Size.x, &m_Size.y,
&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;
}
if( strncmp( Line, "De", 2 ) == 0 )
......
This diff is collapsed.
......@@ -260,7 +260,7 @@ static PARAM_CFG_INT TextePcbDimVCfg
wxT( "TxtPcbV" ), /* Keyword */
&g_DesignSettings.m_PcbTextSize.y, /* Parameter address */
600, /* Default value */
10, 2000 /* Valeurs extremes */
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE /* Valeurs extremes */
);
static PARAM_CFG_INT TextePcbDimHCfg
......@@ -268,7 +268,7 @@ static PARAM_CFG_INT TextePcbDimHCfg
wxT( "TxtPcbH" ), /* Keyword */
&g_DesignSettings.m_PcbTextSize.x, /* Parameter address */
600, /* Default value */
10, 2000 /* Valeurs extremes */
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE /* Valeurs extremes */
);
static PARAM_CFG_SETCOLOR ColorLayer0Cfg // CU Layer Color
......@@ -556,7 +556,7 @@ static PARAM_CFG_INT TexteModDimVCfg
wxT( "TxtModV" ), /* Keyword */
&ModuleTextSize.y, /* Parameter address */
500, /* Default value */
1, 20000 /* Valeurs extremes */
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE /* Valeurs extremes */
);
static PARAM_CFG_INT TexteModDimHCfg
......@@ -564,7 +564,7 @@ static PARAM_CFG_INT TexteModDimHCfg
wxT( "TxtModH" ), /* Keyword */
&ModuleTextSize.x, /* Parameter address */
500, /* Default value */
1, 20000 /* Valeurs extremes */
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE /* Valeurs extremes */
);
static PARAM_CFG_INT TexteModWidthCfg
......@@ -572,7 +572,7 @@ static PARAM_CFG_INT TexteModWidthCfg
wxT( "TxtModW" ), /* Keyword */
&ModuleTextWidth, /* Parameter address */
100, /* Default value */
1, 10000 /* Valeurs extremes */
1, TEXTS_MAX_WIDTH /* Valeurs extremes */
);
static PARAM_CFG_SETCOLOR ColorAncreModCfg
......
......@@ -27,7 +27,11 @@
#define END 1
#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 */
#define ZOOM_PLUS -1
......
......@@ -202,6 +202,17 @@ void WinEDA_TextPCBPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (eve
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
{
CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, wxPoint( 0, 0 ), GR_XOR );
......@@ -212,12 +223,18 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event )
CurrentTextPCB->m_Text = m_Name->GetValue();
}
CurrentTextPCB->m_Pos = m_TxtPosCtrl->GetValue();
CurrentTextPCB->m_Size = m_TxtSizeCtrl->GetValue();
CurrentTextPCB->m_Size = newsize;
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_Orient = m_Orient->GetSelection() * 900;
CurrentTextPCB->SetLayer( m_SelLayerBox->GetChoice() );
CurrentTextPCB->CreateDrawData();
if( m_DC ) // Affichage nouveau 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