Commit acf03b7d authored by CHARRAS's avatar CHARRAS

Global labels problems fixed (see changelog)

parent 9086e68d
......@@ -5,6 +5,13 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Feb-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema
Fixed bug in getpart.cpp:
eeschema crashed when aborting a new component place command
Global Symbols now have their shapes
Bad global label shape fixed when reading a schematic file
2008-Feb-20 UPDATE Dick Hollenbeck <dick@softplc.com>
......
/* XPM */
static const char *lang_chinese_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 16 1",
". c #E42814",
"X c #DC1A1C",
"& c #FCFE04",
"; c #EC6A14",
"% c #FCF20C",
"# c #EC5E14",
"$ c #F4B20C",
"+ c #DB031C",
"@ c #F4A60C",
"o c #DC0D1C",
"O c #E43E14",
"* c #F49A0C",
"- c #E45214",
" c #DC1519",
"= c #EC7A0C",
": c #E44614",
/* pixels */
" .. . X",
"X oO+ o@#+ ",
" ++$ ++o+@o . X",
"X.%&&*o o= ",
" +.&&+ + + . X",
"Xo-+O oo& ",
" o o#.++. X",
" X ;: . ",
" . . oo X",
"X . . ",
" . . . X",
"X ",
" . . . . . X",
"XX X X",
"X X X X X X",
"XXXXXXXXXXXXXXXX"
};
......@@ -47,6 +47,7 @@
#include "Lang_Ko.xpm"
#include "Lang_Ru.xpm"
#include "Lang_Catalan.xpm"
#include "Lang_chinese.xpm"
#endif
......@@ -572,7 +573,7 @@ wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
item = new wxMenuItem( m_Language_Menu, ID_LANGUAGE_CHINESE_SIMPLIFIED,
_( "Chinese simplified" ), wxEmptyString, wxITEM_CHECK );
//SETBITMAPS( lang_chinese_simplified_xpm );
SETBITMAPS( lang_chinese_xpm );
m_Language_Menu->Append( item );
}
......
......@@ -16,71 +16,6 @@
#define NB_MAX_SHEET 500
/* Type des labels sur sheet (Labels sur hierarchie) et forme des Global-Labels*/
typedef enum {
NET_INPUT,
NET_OUTPUT,
NET_BIDI,
NET_TRISTATE,
NET_UNSPECIFIED,
NET_TMAX /* Derniere valeur: fin de tableau */
} TypeSheetLabel;
/* Messages correspondants aux types ou forme des labels */
#ifdef MAIN
const char* SheetLabelType[] =
{
"Input",
"Output",
"BiDi",
"3State",
"UnSpc",
"?????"
};
#else
extern const char* SheetLabelType[];
#endif
/* Description du graphisme des icones associes aux types des Global_Labels */
#ifdef MAIN
int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
int TemplateIN_UP[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
int TemplateOUT_BOTTOM[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
int TemplateOUT_UP[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
int TemplateUNSPC_UP[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int TemplateBIDI_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int Template3STATE_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int* TemplateShape[5][4] =
{
{ TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM },
{ TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM },
{ TemplateBIDI_HN, TemplateBIDI_UP, TemplateBIDI_HI, TemplateBIDI_BOTTOM },
{ Template3STATE_HN, Template3STATE_UP, Template3STATE_HI, Template3STATE_BOTTOM },
{ TemplateUNSPC_HN, TemplateUNSPC_UP, TemplateUNSPC_HI, TemplateUNSPC_BOTTOM }
};
#else
extern int* TemplateShape[5][4];
#endif
/* Forward declarations */
class DrawSheetStruct;
extern DrawSheetStruct* g_RootSheet;
......
This diff is collapsed.
/********************************************/
/* Definitions for the EESchema program: */
/********************************************/
#ifndef CLASS_TEXT_LABEL_H
#define CLASS_TEXT_LABEL_H
#ifndef eda_global
#define eda_global extern
#endif
#include "macros.h"
#include "base_struct.h"
/* Type des labels sur sheet (Labels sur hierarchie) et forme des Global-Labels*/
typedef enum {
NET_INPUT,
NET_OUTPUT,
NET_BIDI,
NET_TRISTATE,
NET_UNSPECIFIED,
NET_TMAX /* Derniere valeur: fin de tableau */
} TypeSheetLabel;
/* Messages correspondants aux types ou forme des labels */
#ifdef MAIN
const char* SheetLabelType[] =
{
"Input",
"Output",
"BiDi",
"3State",
"UnSpc",
"?????"
};
#else
extern const char* SheetLabelType[];
#endif
/* Description du graphisme des icones associes aux types des Global_Labels */
#ifdef MAIN
int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
int TemplateIN_UP[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
int TemplateOUT_BOTTOM[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
int TemplateOUT_UP[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
int TemplateUNSPC_UP[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int TemplateBIDI_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
int Template3STATE_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
int* TemplateShape[5][4] =
{
{ TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM },
{ TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM },
{ TemplateBIDI_HN, TemplateBIDI_UP, TemplateBIDI_HI, TemplateBIDI_BOTTOM },
{ Template3STATE_HN, Template3STATE_UP, Template3STATE_HI, Template3STATE_BOTTOM },
{ TemplateUNSPC_HN, TemplateUNSPC_UP, TemplateUNSPC_HI, TemplateUNSPC_BOTTOM }
};
#else
extern int* TemplateShape[5][4];
#endif
class DrawTextStruct : public EDA_BaseStruct
, public EDA_TextStruct
{
public:
int m_Layer;
int m_Shape;
bool m_IsDangling; // TRUE si non connect�
public:
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
KICAD_T aType = DRAW_TEXT_STRUCT_TYPE );
~DrawTextStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawText" );
}
DrawTextStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
void SwapData( DrawTextStruct* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
};
class DrawLabelStruct : public DrawTextStruct
{
public:
DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
~DrawLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawLabel" );
}
};
class DrawGlobalLabelStruct : public DrawTextStruct
{
public:
DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
~DrawGlobalLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawGlobalLabel" );
}
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size > 20)
* @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/
void CreateGraphicShape( int* corner_list, const wxPoint & Pos );
};
class DrawHierLabelStruct : public DrawTextStruct
{
public:
DrawHierLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
~DrawHierLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawHierLabel" );
}
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size >= 14)
* @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/
void CreateGraphicShape( int* corner_list, const wxPoint & Pos );
};
#endif /* CLASS_TEXT_LABEL_H */
......@@ -321,6 +321,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
if( DrawLibItem->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
{
DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 );
DrawLibItem->m_Flags = 0;
SAFE_DELETE( DrawLibItem );
}
else if( DrawLibItem ) /* Deplacement ancien composant en cours */
......@@ -335,9 +336,9 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
memcpy( DrawLibItem->m_Transform, OldTransMat, sizeof(OldTransMat) );
DrawLibItem->Draw( Panel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawLibItem->m_Flags = 0;
}
DrawLibItem->m_Flags = 0;
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
Panel->m_Parent->GetScreen()->SetCurItem( NULL );
......
......@@ -389,6 +389,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
Struct = (EDA_BaseStruct*) TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient;
TextStruct->m_Shape = NET_INPUT;
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
TextStruct->m_Shape = NET_OUTPUT;
if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 )
......@@ -399,12 +400,13 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
TextStruct->m_Shape = NET_UNSPECIFIED;
}
else if( (Name1[0] == 'H') || (Name1[0] == 'G' && version == '1'))
{ //in sschematic file version 1, glabels were actually hierarchal labels.
{ //in schematic file version 1, glabels were actually hierarchal labels.
DrawHierLabelStruct* TextStruct =
new DrawHierLabelStruct(pos, CONV_FROM_UTF8( text ) );
Struct = (EDA_BaseStruct*) TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient;
TextStruct->m_Shape = NET_INPUT;
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
TextStruct->m_Shape = NET_OUTPUT;
if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 )
......
This diff is collapsed.
......@@ -14,6 +14,7 @@
#include "component_class.h"
#include "class_screen.h"
#include "class_text-label.h"
#define DRAWJUNCTION_SIZE 16 /* Rayon du symbole connexion */
#define DRAWMARKER_SIZE 16 /* Rayon du symbole marqueur */
......@@ -234,77 +235,6 @@ public:
};
class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct
{
public:
int m_Layer;
int m_Shape;
bool m_IsDangling; // TRUE si non connect�
public:
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
KICAD_T aType = DRAW_TEXT_STRUCT_TYPE );
~DrawTextStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawText" );
}
DrawTextStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
void SwapData( DrawTextStruct* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
};
class DrawLabelStruct : public DrawTextStruct
{
public:
DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
~DrawLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawLabel" );
}
};
class DrawGlobalLabelStruct : public DrawTextStruct
{
public:
DrawGlobalLabelStruct(const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString);
~DrawGlobalLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawGlobalLabel" );
}
};
class DrawHierLabelStruct : public DrawTextStruct
{
public:
DrawHierLabelStruct(const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString);
~DrawHierLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawHierLabel" );
}
};
#define MAX_LAYERS 44
class LayerStruct
......
......@@ -269,7 +269,7 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave)
Failed = TRUE;
break;
case DRAW_HIER_LABEL_STRUCT_TYPE: /* Its a Global label item. */
case DRAW_HIER_LABEL_STRUCT_TYPE: /* Its a Hierarchical label item. */
#undef STRUCT
#define STRUCT ((DrawHierLabelStruct *) Phead)
shape = STRUCT->m_Shape;
......
/*
* File: printing.h
* Purpose: Printing demo for wxWindows class library
*/
#ifdef __GNUG__
#pragma interface
#endif
// Define a new application
class MyApp: public wxApp
{
public:
MyApp() ;
bool OnInit();
int OnExit();
wxFont* m_testFont;
};
DECLARE_APP(MyApp)
class MyCanvas;
// Define a new canvas and frame
class MyFrame: public wxFrame
{
public:
MyCanvas *canvas;
MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
void Draw(wxDC& dc);
void OnSize(wxSizeEvent& event);
void OnPrint(wxCommandEvent& event);
void OnPrintPreview(wxCommandEvent& event);
void OnPrintSetup(wxCommandEvent& event);
void OnPageSetup(wxCommandEvent& event);
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
void OnPrintPS(wxCommandEvent& event);
void OnPrintPreviewPS(wxCommandEvent& event);
void OnPrintSetupPS(wxCommandEvent& event);
void OnPageSetupPS(wxCommandEvent& event);
#endif
void OnExit(wxCommandEvent& event);
void OnPrintAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
// Define a new canvas which can receive some events
class MyCanvas: public wxScrolledWindow
{
public:
MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED);
~MyCanvas() ;
virtual void OnDraw(wxDC& dc);
void OnEvent(wxMouseEvent& event);
DECLARE_EVENT_TABLE()
};
class MyPrintout: public wxPrintout
{
public:
MyPrintout(char *title = "My printout"):wxPrintout(title) {}
bool OnPrintPage(int page);
bool HasPage(int page);
bool OnBeginDocument(int startPage, int endPage);
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
void DrawPageOne(wxDC *dc);
void DrawPageTwo(wxDC *dc);
};
#define WXPRINT_QUIT 100
#define WXPRINT_PRINT 101
#define WXPRINT_PRINT_SETUP 102
#define WXPRINT_PAGE_SETUP 103
#define WXPRINT_PREVIEW 104
#define WXPRINT_PRINT_PS 105
#define WXPRINT_PRINT_SETUP_PS 106
#define WXPRINT_PAGE_SETUP_PS 107
#define WXPRINT_PREVIEW_PS 108
#define WXPRINT_ABOUT 109
No preview for this file type
This diff is collapsed.
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