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
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: kicad\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-03-22 20:45+0100\n"
"PO-Revision-Date: 2008-03-22 21:33+0100\n"
"POT-Creation-Date: 2008-03-23 20:53+0100\n"
"PO-Revision-Date: 2008-03-23 21:06+0100\n"
"Last-Translator: \n"
"Language-Team: kicad team <jean-pierre.charras@ujf-grenoble.fr>\n"
"MIME-Version: 1.0\n"
......@@ -156,12 +156,10 @@ msgid "Spot min"
msgstr "Spot min"
#: pcbnew/pcbplot.cpp:209
#, fuzzy
msgid "Pen size"
msgstr "Diam plume"
#: pcbnew/pcbplot.cpp:214
#, fuzzy
msgid "Pen speed (cm/s)"
msgstr "Vitesse plume (cm/s)"
......@@ -170,7 +168,6 @@ msgid "Set pen speed in cm/s"
msgstr "Ajuster Vitesse plume en centimetres par seconde"
#: pcbnew/pcbplot.cpp:220
#, fuzzy
msgid "Pen ovr"
msgstr "Recouvrement"
......@@ -179,12 +176,10 @@ msgid "Set plot overlay for filling"
msgstr "Ajuste recouvrement des tracés pour les remplissages"
#: pcbnew/pcbplot.cpp:226
#, fuzzy
msgid "Lines width"
msgstr "Epaiss. lignes"
#: pcbnew/pcbplot.cpp:230
#, fuzzy
msgid "Set width for lines in line plot mode"
msgstr "Ajuster l'épaisseur des traits en Mode tracé filaire"
......@@ -197,12 +192,10 @@ msgid "Auxiliary axis"
msgstr "Axe Auxiliaire"
#: pcbnew/pcbplot.cpp:237
#, fuzzy
msgid "Plot origin"
msgstr "Origine des coord de tracé"
#: pcbnew/pcbplot.cpp:257
#, fuzzy
msgid "X scale adjust"
msgstr "Ajustage Echelle X"
......@@ -211,7 +204,6 @@ msgid "Set X scale adjust for exact scale plotting"
msgstr "Ajuster échelle X pour traçage à l'échelle exacte"
#: pcbnew/pcbplot.cpp:262
#, fuzzy
msgid "Y scale adjust"
msgstr "Ajustage Echelle Y"
......@@ -220,12 +212,10 @@ msgid "Set Y scale adjust for exact scale plotting"
msgstr "Ajuster échelle Y pour traçage à l'échelle exacte"
#: pcbnew/pcbplot.cpp:266
#, fuzzy
msgid "Plot negative"
msgstr "Tracé en Negatif"
#: pcbnew/pcbplot.cpp:276
#, fuzzy
msgid "Save Options"
msgstr "Sauver options"
......@@ -238,32 +228,26 @@ msgid "Close"
msgstr "Fermer"
#: pcbnew/pcbplot.cpp:328
#, fuzzy
msgid "Exclude Edges_Pcb layer"
msgstr "Exclure Couche Contours PCB"
#: pcbnew/pcbplot.cpp:332
#, fuzzy
msgid "Exclude contents of Edges_Pcb layer from all other layers"
msgstr "Exclure les tracés contour PCB des autres couches"
#: pcbnew/pcbplot.cpp:338
#, fuzzy
msgid "Print sheet ref"
msgstr "Imprimer cartouche"
#: pcbnew/pcbplot.cpp:348
#, fuzzy
msgid "Print pads on silkscreen"
msgstr "Pads sur Sérigraphie"
#: pcbnew/pcbplot.cpp:353
#, fuzzy
msgid "Enable/disable print/plot pads on silkscreen layers"
msgstr "Active/désactive tracé des pastilles sur les couches de sérigraphie"
#: pcbnew/pcbplot.cpp:357
#, fuzzy
msgid "Always print pads"
msgstr "Toujour tracer pads"
......@@ -272,47 +256,38 @@ msgid "Force print/plot pads on ALL layers"
msgstr "Force le tracé des pastilles sur TOUTES les couches"
#: pcbnew/pcbplot.cpp:365
#, fuzzy
msgid "Print module value"
msgstr "Imprimer Valeur Module"
#: pcbnew/pcbplot.cpp:369
#, fuzzy
msgid "Enable/disable print/plot module value on silkscreen layers"
msgstr "Active/désactive le tracé des textes valeurs des modules sur couches de sérigraphie"
#: pcbnew/pcbplot.cpp:372
#, fuzzy
msgid "Print module reference"
msgstr "Imprimer Référence Module"
#: pcbnew/pcbplot.cpp:376
#, fuzzy
msgid "Enable/disable print/plot module reference on silkscreen layers"
msgstr "Active/désactive le tracé des textes référence des modules sur couches de sérigraphie"
#: pcbnew/pcbplot.cpp:380
#, fuzzy
msgid "Print other module texts"
msgstr "Imprimer autres textes module"
#: pcbnew/pcbplot.cpp:384
#, fuzzy
msgid "Enable/disable print/plot module field texts on silkscreen layers"
msgstr "Active/désactive le tracé des textes des champs des modules sur couches de sérigraphie"
#: pcbnew/pcbplot.cpp:389
#, fuzzy
msgid "Force print invisible texts"
msgstr "Force tracé textes invisibles"
#: pcbnew/pcbplot.cpp:393
#, fuzzy
msgid "Force print/plot module invisible texts on silkscreen layers"
msgstr "Force le tracé des textes invisibles sur couches de sérigraphie"
#: pcbnew/pcbplot.cpp:397
#, fuzzy
msgid "No drill mark"
msgstr "Pas de marque"
......@@ -321,7 +296,6 @@ msgid "Small mark"
msgstr "Petite marque"
#: pcbnew/pcbplot.cpp:397
#, fuzzy
msgid "Real drill"
msgstr "Perçage réel"
......@@ -370,12 +344,10 @@ msgid "Plot Mode"
msgstr "Mode de Tracé"
#: pcbnew/pcbplot.cpp:425
#, fuzzy
msgid "Plot mirror"
msgstr "Tracé Miroir"
#: pcbnew/pcbplot.cpp:431
#, fuzzy
msgid "Vias on mask"
msgstr "Vias sur masque"
......@@ -1498,47 +1470,44 @@ msgid "Display Warnings"
msgstr "Affiche warnings"
#: pcbnew/dialog_netlist.cpp:200
#, fuzzy
msgid "Remove Extra Footprints"
msgstr "Sel et Dépl.t module"
msgstr "Supprimer empreintes suppl."
#: pcbnew/dialog_netlist.cpp:203
msgid ""
"Remove footprints found on the Board but not in netlist\n"
"Note: only not locked footprints will be removed"
msgstr ""
"Supprimer lse empreintes trouvées sur le C.I. mais non en netliste\n"
"Note: seuls les empreintes non verrouillées seront supprimées"
#: pcbnew/dialog_netlist.cpp:211
#, fuzzy
msgid "Browse Netlist Files"
msgstr "&Examen Fichiers"
msgstr "Examen Fichiers Netlistes"
#: pcbnew/dialog_netlist.cpp:215
#, fuzzy
msgid "Read Current Netlist"
msgstr "Lire Netliste"
msgstr "Lire Netliste Courante"
#: pcbnew/dialog_netlist.cpp:219
#, fuzzy
msgid "Footprints Test"
msgstr "Empreinte: "
msgstr "Test Empreintes"
#: pcbnew/dialog_netlist.cpp:221
msgid "Read the current neltist file and list missing and extra footprints"
msgstr ""
msgstr "Lire la netliste courante et lister les empreintes manquantes et supplémentaires"
#: pcbnew/dialog_netlist.cpp:225
msgid "Rebuild Board Connectivity"
msgstr ""
msgstr "Recalculer les connexions du C.I."
#: pcbnew/dialog_netlist.cpp:227
msgid "Rebuild the full ratsnest (usefull after a manual pad netname edition)"
msgstr ""
msgstr "Recalculer le chevelu complet ( utile après une edition manuelle de nom de net sur pad)"
#: pcbnew/dialog_netlist.cpp:231
#, fuzzy
msgid "Netlist File:"
msgstr "Fichiers Netlist:"
msgstr "Fichier Netliste:"
#: pcbnew/dialog_netlist.cpp:248
msgid "&Close"
......@@ -3293,9 +3262,8 @@ msgid "Read Netlist "
msgstr "Lire Netliste"
#: pcbnew/netlist.cpp:347
#, fuzzy
msgid "Ok to delete footprints not in netlist ?"
msgstr "Ok pour effacer la LISTE des filtres de modules"
msgstr "Ok pour effacer les empreintes non en netliste"
#: pcbnew/netlist.cpp:497
#, c-format
......@@ -4256,7 +4224,7 @@ msgstr "Forme via inconnue: \"%s\""
#: pcbnew/specctra_import.cpp:339
msgid "Session file is missing the \"session\" section"
msgstr ""
msgstr "Session file is missing the \"session\" section"
#: pcbnew/specctra_import.cpp:342
msgid "Session file is missing the \"placement\" section"
......@@ -4273,7 +4241,7 @@ msgstr ""
#: pcbnew/specctra_import.cpp:378
#, c-format
msgid "Session file has 'reference' to non-existent component \"%s\""
msgstr ""
msgstr "Le fichier Session a une 'reference' a un composant non existant \"%s\""
#: pcbnew/specctra_import.cpp:522
#, c-format
......@@ -4642,7 +4610,7 @@ msgstr "Erreur. Vous devez choisir une équipotentielle"
#: pcbnew/dialog_freeroute_exchange.cpp:187
#: pcbnew/_dialog_freeroute_exchange.cpp:177
msgid "Export a Specctra Design (*.dsn) File"
msgstr ""
msgstr "Exporter un fichier de conception Specctra (*.dsn)"
#: pcbnew/dialog_freeroute_exchange.cpp:189
#: pcbnew/_dialog_freeroute_exchange.cpp:179
......@@ -4656,7 +4624,7 @@ msgstr "Lancer FreeRouter via Java Web Start"
#: pcbnew/dialog_freeroute_exchange.cpp:194
msgid "Use Java Web Start function to run FreeRouter via Internet (or your Browser if not found)"
msgstr ""
msgstr "Utiliser Java Web Start function pour lancer FreeRouter via Internet (ou votre Navigateur si non trouvé)"
#: pcbnew/dialog_freeroute_exchange.cpp:197
#: pcbnew/_dialog_freeroute_exchange.cpp:187
......@@ -5179,9 +5147,8 @@ msgid "Place the pin sheet (imported hierarchical label from sheet)"
msgstr "Placer la pin hiérarchique ( Importer un label hiérarchique vers la feuille)"
#: eeschema/tool_sch.cpp:223
#, fuzzy
msgid "Place the hierachical pin to sheet"
msgstr "Addition de pins de hierarchie dans les symboles de hierarchie"
msgstr "Place une pin de hierarchie dans la feuille"
#: eeschema/tool_sch.cpp:228
msgid "Place the graphic line or polygon"
......@@ -6487,9 +6454,8 @@ msgid "Imported hierarchical label"
msgstr "Importer label hiérarchique"
#: eeschema/menubar.cpp:326
#, fuzzy
msgid "Hierarchical pin to sheet"
msgstr "Addition de pins de hierarchie dans les symboles de hierarchie"
msgstr "Ppins de hierarchie vers feuille"
#: eeschema/menubar.cpp:327
msgid "Place the hierarchical pin to sheet"
......@@ -7028,12 +6994,11 @@ msgstr "Ok pour nettoyer cette feuille"
#: eeschema/class_drawsheet.cpp:486
#, c-format
msgid "A Sub Hierarchy named %s exists, Use it (The data in this sheet will be replaced)?"
msgstr ""
msgstr "Une sous Hiérarchie nommée %s existe, L'utiliser (Les données de cette page seront remplacées)?"
#: eeschema/class_drawsheet.cpp:490
#, fuzzy
msgid "Sheet Filename Renaming Aborted"
msgstr "Pas de Nom de Fichier! Abandon"
msgstr " Renommage de Fichier de Feuille Abandonné"
#: eeschema/class_drawsheet.cpp:498
#, c-format
......@@ -7046,7 +7011,7 @@ msgstr "Cette feuille utilise des données partagées dans une hiérarchie compl
#: eeschema/class_drawsheet.cpp:515
msgid "Do we convert it in a simple hierarchical sheet (otherwise delete current sheet data)"
msgstr ""
msgstr "Doit on la convertir en une feuille de hiérarchie simple (autrement supprimer les données courantes)"
#: eeschema/class_drawsheet.cpp:776
#, c-format
......@@ -7377,23 +7342,23 @@ msgid "Failed to open file "
msgstr "Erreur ouverture "
#: eeschema/dialog_build_BOM.cpp:806
#, fuzzy, c-format
#, c-format
msgid ""
"\n"
"#Global, Hierarchical Labels and PinSheets ( order = Sheet Number ) count = %d\n"
msgstr ""
"\n"
"#Glob labels ( ordre = Numéro de feuiller ) nombre = %d\n"
"#Labels globaux, hiérarchiques et pins de feuille ( ordre = Numéro de feuiller ) nombre = %d\n"
#: eeschema/dialog_build_BOM.cpp:817
#, fuzzy, c-format
#, c-format
msgid ""
"\n"
"#Global, Hierarchical Labels and PinSheets ( order = Alphab. ) count = %d\n"
"\n"
msgstr ""
"\n"
"#Glob labels ( ordre = Alphab. ) nombre = %d\n"
"##Labels globaux, hiérarchiques et pins de feuille ( ordre = Alphab. ) nombre = %d\n"
#: eeschema/dialog_build_BOM.cpp:824
msgid ""
......@@ -7435,9 +7400,9 @@ msgid "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n"
msgstr "> %-28.28s %s (Feuille %s) pos: %3.3f, %3.3f\n"
#: eeschema/dialog_build_BOM.cpp:1421
#, fuzzy, c-format
#, c-format
msgid "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n"
msgstr "> %-28.28s Sheet %-7.7s (Feuillet %s) pos: %3.3f, %3.3f\n"
msgstr "> %-28.28s PinSheet %-7.7s (Feuillet %s) pos: %3.3f, %3.3f\n"
#: eeschema/dialog_build_BOM.cpp:1436
msgid "#End labels\n"
......@@ -7759,12 +7724,8 @@ msgid "No Filename! Aborted"
msgstr "Pas de Nom de Fichier! Abandon"
#: eeschema/sheet.cpp:305
#, fuzzy
msgid "Changing a Filename can change all the schematic structure and cannot be undone"
msgstr ""
"\n"
"\n"
"Cette opération changera l'annotation actuelle et ne pourra être annulée."
msgstr "Cette opération changera l'annotation actuelle et ne pourra être annulée."
#: eeschema/sheet.cpp:307
msgid "Ok to continue renaming?"
......@@ -9772,9 +9733,8 @@ msgid "Color Print:"
msgstr "Impression Couleurs:"
#: share/dialog_print.cpp:190
#, fuzzy
msgid "1 Page per Layer"
msgstr "1 page par couche"
msgstr "1 Page par couche"
#: share/dialog_print.cpp:191
msgid "Single Page"
......@@ -9912,9 +9872,8 @@ msgid "DRC Control"
msgstr "Controle ERC"
#: pcbnew/dialog_netlist.h:54
#, fuzzy
msgid "Netlist Dialog"
msgstr "Fichiers Netlist "
msgstr "Dialogue Netliste"
#: pcbnew/dialog_zones_by_polygon.h:53
msgid "Fill Zones Options"
......
......@@ -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 )
......
/////////////////////////////////////////////////////////////////////////////
// Name: edtxtmod.cpp
// Purpose:
// Author: jean-pierre Charras
......@@ -11,7 +12,7 @@
// Generated by DialogBlocks (unregistered), 09/02/2006 18:17:15
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
#pragma implementation "edtxtmod.h"
#endif
......@@ -43,18 +44,19 @@ extern wxPoint MoveVector; // Move vector for move edge, imported from dialog_ed
////@end XPM images
/***************************************************************************/
void WinEDA_BasePcbFrame::InstallTextModOptionsFrame(TEXTE_MODULE * TextMod,
wxDC * DC, const wxPoint & pos)
void WinEDA_BasePcbFrame::InstallTextModOptionsFrame( TEXTE_MODULE* TextMod,
wxDC* DC, const wxPoint& pos )
/***************************************************************************/
{
DrawPanel->m_IgnoreMouseEvents = TRUE;
WinEDA_TextModPropertiesFrame * frame = new WinEDA_TextModPropertiesFrame(this,
TextMod, DC);
WinEDA_TextModPropertiesFrame* frame = new WinEDA_TextModPropertiesFrame( this,
TextMod, DC );
frame->ShowModal(); frame->Destroy();
DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE;
}
/*!
* WinEDA_TextModPropertiesFrame type definition
*/
......@@ -68,9 +70,9 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_TextModPropertiesFrame, wxDialog )
BEGIN_EVENT_TABLE( WinEDA_TextModPropertiesFrame, wxDialog )
////@begin WinEDA_TextModPropertiesFrame event table entries
EVT_BUTTON( wxID_OK, WinEDA_TextModPropertiesFrame::OnOkClick )
EVT_BUTTON( wxID_OK, WinEDA_TextModPropertiesFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_TextModPropertiesFrame::OnCancelClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_TextModPropertiesFrame::OnCancelClick )
////@end WinEDA_TextModPropertiesFrame event table entries
......@@ -80,33 +82,43 @@ END_EVENT_TABLE()
* WinEDA_TextModPropertiesFrame constructors
*/
WinEDA_TextModPropertiesFrame::WinEDA_TextModPropertiesFrame( )
WinEDA_TextModPropertiesFrame::WinEDA_TextModPropertiesFrame()
{
}
WinEDA_TextModPropertiesFrame::WinEDA_TextModPropertiesFrame( WinEDA_BasePcbFrame* parent,
TEXTE_MODULE * TextMod,wxDC * DC,
wxWindowID id, const wxString& caption, const wxPoint& pos,
const wxSize& size, long style )
TEXTE_MODULE* TextMod,
wxDC* DC,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
m_Parent = parent;
m_DC = DC;
m_Module = NULL;
m_CurrentTextMod = TextMod;
if ( m_CurrentTextMod )
if( m_CurrentTextMod )
{
m_Module = (MODULE*)m_CurrentTextMod->m_Parent;
m_Module = (MODULE*) m_CurrentTextMod->m_Parent;
}
Create(parent, id, caption, pos, size, style);
Create( parent, id, caption, pos, size, style );
}
/*!
* WinEDA_TextModPropertiesFrame creator
*/
bool WinEDA_TextModPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
bool WinEDA_TextModPropertiesFrame::Create( wxWindow* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{
////@begin WinEDA_TextModPropertiesFrame member initialisation
m_ModuleInfoText = NULL;
......@@ -124,113 +136,160 @@ bool WinEDA_TextModPropertiesFrame::Create( wxWindow* parent, wxWindowID id, con
m_TxtWidthCtlr = NULL;
m_Orient = NULL;
m_Show = NULL;
////@end WinEDA_TextModPropertiesFrame member initialisation
////@begin WinEDA_TextModPropertiesFrame creation
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
Centre();
////@end WinEDA_TextModPropertiesFrame creation
return true;
}
/*!
* Control creation for WinEDA_TextModPropertiesFrame
*/
void WinEDA_TextModPropertiesFrame::CreateControls()
{
SetFont(*g_DialogFont);
SetFont( *g_DialogFont );
////@begin WinEDA_TextModPropertiesFrame content construction
// Generated by DialogBlocks, 09/02/2006 19:51:49 (unregistered)
WinEDA_TextModPropertiesFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);
m_ModuleInfoText = new wxStaticText( itemDialog1, wxID_STATIC, _("Module %s (%s) orient %.1f"), wxDefaultPosition, wxDefaultSize, 0 );
m_ModuleInfoText->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer2->Add(m_ModuleInfoText, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxADJUST_MINSIZE, 5);
wxStaticLine* itemStaticLine4 = new wxStaticLine( itemDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
itemBoxSizer2->Add(itemStaticLine4, 0, wxGROW|wxALL, 5);
m_TextDataTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Reference:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add(m_TextDataTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_Name = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add(m_Name, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer7->Add(itemBoxSizer8, 0, wxGROW|wxALL, 5);
m_SizeXTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Size X"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add(m_SizeXTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_TxtSizeCtrlX = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add(m_TxtSizeCtrlX, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
m_SizeYTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Size Y"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add(m_SizeYTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_TxtSizeCtrlY = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add(m_TxtSizeCtrlY, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
itemBoxSizer8->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_PosXTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Offset X"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add(m_PosXTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_TxtPosCtrlX = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add(m_TxtPosCtrlX, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
m_PosYTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Offset Y"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add(m_PosYTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_TxtPosCtrlY = new wxTextCtrl( itemDialog1, ID_TEXTCTRL4, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add(m_TxtPosCtrlY, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer7->Add(itemBoxSizer18, 0, wxGROW|wxALL, 5);
m_WidthTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Width"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer18->Add(m_WidthTitle, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_TxtWidthCtlr = new wxTextCtrl( itemDialog1, ID_TEXTCTRL5, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer18->Add(m_TxtWidthCtlr, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer7->Add(itemBoxSizer21, 0, wxGROW|wxALL, 5);
wxButton* itemButton22 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton22->SetForegroundColour(wxColour(198, 0, 0));
itemBoxSizer21->Add(itemButton22, 0, wxGROW|wxALL, 5);
wxButton* itemButton23 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton23->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer21->Add(itemButton23, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
itemDialog1->SetSizer( itemBoxSizer2 );
m_ModuleInfoText = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Module %s (%s) orient %.1f" ), wxDefaultPosition, wxDefaultSize, 0 );
m_ModuleInfoText->SetForegroundColour( wxColour( 0, 0, 255 ) );
itemBoxSizer2->Add( m_ModuleInfoText,
0,
wxALIGN_CENTER_HORIZONTAL | wxALL | wxADJUST_MINSIZE,
5 );
wxStaticLine* itemStaticLine4 = new wxStaticLine( itemDialog1,
wxID_STATIC,
wxDefaultPosition,
wxDefaultSize,
wxLI_HORIZONTAL );
itemBoxSizer2->Add( itemStaticLine4, 0, wxGROW | wxALL, 5 );
m_TextDataTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Reference:" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add( m_TextDataTitle,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_Name = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add( m_Name, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
wxBoxSizer* itemBoxSizer7 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxBoxSizer* itemBoxSizer8 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer7->Add( itemBoxSizer8, 0, wxGROW | wxALL, 5 );
m_SizeXTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Size X" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add( m_SizeXTitle,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_TxtSizeCtrlX = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add( m_TxtSizeCtrlX, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
m_SizeYTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Size Y" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add( m_SizeYTitle,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_TxtSizeCtrlY = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add( m_TxtSizeCtrlY, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
itemBoxSizer8->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
m_PosXTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Offset X" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add( m_PosXTitle,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_TxtPosCtrlX = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add( m_TxtPosCtrlX, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
m_PosYTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Offset Y" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add( m_PosYTitle,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_TxtPosCtrlY = new wxTextCtrl( itemDialog1, ID_TEXTCTRL4, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer8->Add( m_TxtPosCtrlY, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
wxBoxSizer* itemBoxSizer18 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer7->Add( itemBoxSizer18, 0, wxGROW | wxALL, 5 );
m_WidthTitle = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Width" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer18->Add( m_WidthTitle,
0,
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
5 );
m_TxtWidthCtlr = new wxTextCtrl( itemDialog1, ID_TEXTCTRL5, _T(
"" ), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer18->Add( m_TxtWidthCtlr, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
wxBoxSizer* itemBoxSizer21 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer7->Add( itemBoxSizer21, 0, wxGROW | wxALL, 5 );
wxButton* itemButton22 = new wxButton( itemDialog1, wxID_OK, _(
"&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
itemButton22->SetForegroundColour( wxColour( 198, 0, 0 ) );
itemBoxSizer21->Add( itemButton22, 0, wxGROW | wxALL, 5 );
wxButton* itemButton23 = new wxButton( itemDialog1, wxID_CANCEL, _(
"&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
itemButton23->SetForegroundColour( wxColour( 0, 0, 255 ) );
itemBoxSizer21->Add( itemButton23, 0, wxGROW | wxALL, 5 );
wxString m_OrientStrings[] = {
_("horiz"),
_("vertical")
_( "horiz" ),
_( "vertical" )
};
m_Orient = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Orientation"), wxDefaultPosition, wxDefaultSize, 2, m_OrientStrings, 1, wxRA_SPECIFY_COLS );
itemBoxSizer21->Add(m_Orient, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_Orient = new wxRadioBox( itemDialog1, ID_RADIOBOX, _(
"Orientation" ), wxDefaultPosition, wxDefaultSize, 2, m_OrientStrings, 1,
wxRA_SPECIFY_COLS );
itemBoxSizer21->Add( m_Orient, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxString m_ShowStrings[] = {
_("show"),
_("no show")
_( "show" ),
_( "no show" )
};
m_Show = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Display"), wxDefaultPosition, wxDefaultSize, 2, m_ShowStrings, 1, wxRA_SPECIFY_COLS );
itemBoxSizer21->Add(m_Show, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_Show = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _(
"Display" ), wxDefaultPosition, wxDefaultSize, 2, m_ShowStrings, 1, wxRA_SPECIFY_COLS );
itemBoxSizer21->Add( m_Show, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
////@end WinEDA_TextModPropertiesFrame content construction
......@@ -238,15 +297,17 @@ void WinEDA_TextModPropertiesFrame::CreateControls()
SetDisplayValue();
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void WinEDA_TextModPropertiesFrame::OnOkClick( wxCommandEvent& event )
{
TextModPropertiesAccept(event);
TextModPropertiesAccept( event );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
......@@ -256,9 +317,11 @@ void WinEDA_TextModPropertiesFrame::OnCancelClick( wxCommandEvent& event )
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_TextModPropertiesFrame.
// Before editing this code, remove the block markers.
event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_TextModPropertiesFrame.
}
/*!
* Should we show tooltips?
*/
......@@ -268,6 +331,7 @@ bool WinEDA_TextModPropertiesFrame::ShowToolTips()
return true;
}
/*!
* Get bitmap resources
*/
......@@ -276,11 +340,13 @@ wxBitmap WinEDA_TextModPropertiesFrame::GetBitmapResource( const wxString& name
{
// Bitmap retrieval
////@begin WinEDA_TextModPropertiesFrame bitmap retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullBitmap;
////@end WinEDA_TextModPropertiesFrame bitmap retrieval
}
/*!
* Get icon resources
*/
......@@ -289,102 +355,120 @@ wxIcon WinEDA_TextModPropertiesFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_TextModPropertiesFrame icon retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullIcon;
////@end WinEDA_TextModPropertiesFrame icon retrieval
}
/********************************************************/
void WinEDA_TextModPropertiesFrame::SetDisplayValue()
/********************************************************/
{
wxString msg;
wxString msg;
if ( m_Module )
if( m_Module )
{
wxString format = m_ModuleInfoText->GetLabel();
msg.Printf( format,
m_Module->m_Reference->m_Text.GetData(),
m_Module->m_Value->m_Text.GetData(),
(float)(m_Module->m_Orient/10) );
m_ModuleInfoText->SetLabel(msg);
(float) (m_Module->m_Orient / 10) );
m_ModuleInfoText->SetLabel( msg );
}
if(m_CurrentTextMod->m_Type == TEXT_is_VALUE) m_TextDataTitle->SetLabel(_("Value:"));
else if(m_CurrentTextMod->m_Type == TEXT_is_DIVERS) m_TextDataTitle->SetLabel(_("Text:"));
else if(m_CurrentTextMod->m_Type != TEXT_is_REFERENCE) m_TextDataTitle->SetLabel(wxT("???"));
if( m_CurrentTextMod->m_Type == TEXT_is_VALUE )
m_TextDataTitle->SetLabel( _( "Value:" ) );
else if( m_CurrentTextMod->m_Type == TEXT_is_DIVERS )
m_TextDataTitle->SetLabel( _( "Text:" ) );
else if( m_CurrentTextMod->m_Type != TEXT_is_REFERENCE )
m_TextDataTitle->SetLabel( wxT( "???" ) );
m_Name->SetValue(m_CurrentTextMod->m_Text);
m_Name->SetValue( m_CurrentTextMod->m_Text );
AddUnitSymbol(*m_SizeXTitle);
PutValueInLocalUnits(*m_TxtSizeCtrlX, m_CurrentTextMod->m_Size.x,
m_Parent->m_InternalUnits);
AddUnitSymbol( *m_SizeXTitle );
PutValueInLocalUnits( *m_TxtSizeCtrlX, m_CurrentTextMod->m_Size.x,
m_Parent->m_InternalUnits );
AddUnitSymbol(*m_SizeYTitle);
PutValueInLocalUnits(*m_TxtSizeCtrlY, m_CurrentTextMod->m_Size.y,
m_Parent->m_InternalUnits);
AddUnitSymbol( *m_SizeYTitle );
PutValueInLocalUnits( *m_TxtSizeCtrlY, m_CurrentTextMod->m_Size.y,
m_Parent->m_InternalUnits );
AddUnitSymbol(*m_PosXTitle);
PutValueInLocalUnits(*m_TxtPosCtrlX, m_CurrentTextMod->m_Pos0.x,
m_Parent->m_InternalUnits);
AddUnitSymbol( *m_PosXTitle );
PutValueInLocalUnits( *m_TxtPosCtrlX, m_CurrentTextMod->m_Pos0.x,
m_Parent->m_InternalUnits );
AddUnitSymbol(*m_PosYTitle);
PutValueInLocalUnits(*m_TxtPosCtrlY, m_CurrentTextMod->m_Pos0.y,
m_Parent->m_InternalUnits);
AddUnitSymbol( *m_PosYTitle );
PutValueInLocalUnits( *m_TxtPosCtrlY, m_CurrentTextMod->m_Pos0.y,
m_Parent->m_InternalUnits );
AddUnitSymbol(*m_WidthTitle);
PutValueInLocalUnits(*m_TxtWidthCtlr, m_CurrentTextMod->m_Width,
m_Parent->m_InternalUnits);
AddUnitSymbol( *m_WidthTitle );
PutValueInLocalUnits( *m_TxtWidthCtlr, m_CurrentTextMod->m_Width,
m_Parent->m_InternalUnits );
if ( (m_CurrentTextMod->m_Orient != 0) && (m_CurrentTextMod->m_Orient != 1800) &&
(m_CurrentTextMod->m_Orient != -1800) )
m_Orient->SetSelection(1);;
if( (m_CurrentTextMod->m_Orient != 0) && (m_CurrentTextMod->m_Orient != 1800)
&& (m_CurrentTextMod->m_Orient != -1800) )
m_Orient->SetSelection( 1 );;
if ( m_CurrentTextMod->m_NoShow ) m_Show->SetSelection(1);;
if( m_CurrentTextMod->m_NoShow )
m_Show->SetSelection( 1 );;
}
/*********************************************************************************/
void WinEDA_TextModPropertiesFrame::TextModPropertiesAccept(wxCommandEvent& event)
void WinEDA_TextModPropertiesFrame::TextModPropertiesAccept( wxCommandEvent& event )
/*********************************************************************************/
{
wxString msg;
wxString msg;
m_Parent->SaveCopyInUndoList(m_Parent->m_Pcb->m_Modules);
if ( m_DC ) // Effacement ancien texte
m_Parent->SaveCopyInUndoList( m_Parent->m_Pcb->m_Modules );
if( m_DC ) // Effacement ancien texte
{
m_CurrentTextMod->Draw(m_Parent->DrawPanel, m_DC,
(m_CurrentTextMod->m_Flags & IS_MOVED) ? MoveVector : wxPoint(0,0), GR_XOR );
m_CurrentTextMod->Draw( m_Parent->DrawPanel, m_DC,
(m_CurrentTextMod->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ), GR_XOR );
}
m_CurrentTextMod->m_Text = m_Name->GetValue();
msg = m_TxtPosCtrlX->GetValue();
m_CurrentTextMod->m_Pos0.x = ReturnValueFromString(g_UnitMetric, msg,
m_Parent->m_InternalUnits);
m_CurrentTextMod->m_Pos0.x = ReturnValueFromString( g_UnitMetric, msg,
m_Parent->m_InternalUnits );
msg = m_TxtPosCtrlY->GetValue();
m_CurrentTextMod->m_Pos0.y = ReturnValueFromString(g_UnitMetric, msg,
m_Parent->m_InternalUnits);
m_CurrentTextMod->m_Pos0.y = ReturnValueFromString( g_UnitMetric, msg,
m_Parent->m_InternalUnits );
msg = m_TxtSizeCtrlX->GetValue();
m_CurrentTextMod->m_Size.x = ReturnValueFromString(g_UnitMetric, msg,
m_Parent->m_InternalUnits);
m_CurrentTextMod->m_Size.x = ReturnValueFromString( g_UnitMetric, msg,
m_Parent->m_InternalUnits );
msg = m_TxtSizeCtrlY->GetValue();
m_CurrentTextMod->m_Size.y = ReturnValueFromString(g_UnitMetric, msg,
m_Parent->m_InternalUnits);
m_CurrentTextMod->m_Size.y = ReturnValueFromString( g_UnitMetric, msg,
m_Parent->m_InternalUnits );
// Test for a reasonnable size:
if( m_CurrentTextMod->m_Size.x< TEXTS_MIN_SIZE )
m_CurrentTextMod->m_Size.x = TEXTS_MIN_SIZE;
if( m_CurrentTextMod->m_Size.y< TEXTS_MIN_SIZE )
m_CurrentTextMod->m_Size.y = TEXTS_MIN_SIZE;
msg = m_TxtWidthCtlr->GetValue();
m_CurrentTextMod->SetWidth( ReturnValueFromString(g_UnitMetric, msg,
m_Parent->m_InternalUnits) );
int width = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
// Test for a reasonnable width:
if( width <= 1 )
width = 1;
if( width > TEXTS_MAX_WIDTH )
width = TEXTS_MAX_WIDTH;
m_CurrentTextMod->SetWidth( width );
m_CurrentTextMod->m_NoShow = (m_Show->GetSelection() == 0) ? 0 : 1;
m_CurrentTextMod->m_Orient = (m_Orient->GetSelection() == 0) ? 0 : 900;
m_CurrentTextMod->SetDrawCoord();
if ( m_DC ) // Affichage nouveau texte
if( m_DC ) // Display new text
{
m_CurrentTextMod->Draw(m_Parent->DrawPanel, m_DC,
(m_CurrentTextMod->m_Flags & IS_MOVED) ? MoveVector : wxPoint(0,0), GR_XOR );
m_CurrentTextMod->Draw( m_Parent->DrawPanel, m_DC,
(m_CurrentTextMod->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ), GR_XOR );
}
m_Parent->GetScreen()->SetModify();
((MODULE*)m_CurrentTextMod->m_Parent)->m_LastEdit_Time = time(NULL);
Close(TRUE);
( (MODULE*) m_CurrentTextMod->m_Parent )->m_LastEdit_Time = time( NULL );
Close( TRUE );
}
......@@ -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