diff --git a/change_log.txt b/change_log.txt index 8c190dc62e..0150744342 100644 --- a/change_log.txt +++ b/change_log.txt @@ -4,6 +4,23 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2007-June-13 RELEASE Jean-Pierre Charras +================================================================================ ++All: + merging my development with svn version + ++ pcbnew: + bug fix (problem in postscript generation due to the internationalization + of floating point number notation ) + added tool to select layer pair and monitor active layer + ++ eeschema + bug fix: + crash libedit when loading certain components (linux only) + incomplete generation of erc file list + + + 2007-June-13 UPDATE Richard A Burton ================================================================================ + build: diff --git a/common/eda_doc.cpp b/common/eda_doc.cpp index 0a053ea5c8..b3050fd013 100644 --- a/common/eda_doc.cpp +++ b/common/eda_doc.cpp @@ -117,14 +117,20 @@ bool success = FALSE; fullfilename.Replace(WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP); #endif + wxString mask(wxT("*")), extension; +#ifdef __WINDOWS__ + mask += wxT(".*"); + extension = wxT(".*"); +#endif + if ( wxIsWild(fullfilename) ) { fullfilename = EDA_FileSelector(_("Doc Files"), /* Titre de la fenetre */ wxPathOnly(fullfilename), /* Chemin par defaut */ fullfilename, /* nom fichier par defaut */ - wxEmptyString, /* extension par defaut */ - wxEmptyString, /* Masque d'affichage */ + extension, /* extension par defaut */ + mask, /* Masque d'affichage */ frame, /* parent frame */ wxFD_OPEN, /* wxSAVE, wxFD_OPEN ..*/ TRUE, /* true = ne change pas le repertoire courant */ diff --git a/common/edaappl.cpp b/common/edaappl.cpp index 35ed8ddd68..6c46e54f72 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -77,9 +77,6 @@ WinEDA_App::WinEDA_App(void) m_Locale = NULL; m_PdfBrowserIsDefault = TRUE; - - /* Init de variables globales d'interet general: */ - g_FloatSeparator = '.'; // Nombres flottants = 0.1 par exemple } /*****************************/ @@ -161,9 +158,6 @@ bool succes = SetLanguage(TRUE); { } - if ( atof("0,1") ) g_FloatSeparator = ','; // Nombres flottants = 0,1 - else g_FloatSeparator = '.'; - #ifdef KICAD_PYTHON PyHandler::GetInstance()->SetAppName( name ); #endif @@ -380,9 +374,6 @@ wxString dic_path; SetLanguageList(NULL); - if ( atof("0,1") ) g_FloatSeparator = ','; // Nombres flottants = 0,1 - else g_FloatSeparator = '.'; - return m_Locale->IsOk(); } diff --git a/common/gestfich.cpp b/common/gestfich.cpp index 78bc4e99e9..4bcb010fc9 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -39,6 +39,7 @@ static wxString s_HelpPathList[] = { wxT("d:/kicad/help/"), #else wxT("/usr/local/kicad/help/"), + wxT("/usr/share/doc/kicad/help"), wxT("/usr/share/doc/kicad/"), #endif wxT("end_list") // End of list symbol, do not change diff --git a/common/string.cpp b/common/string.cpp index 9c9515d5f2..f76f4377c2 100644 --- a/common/string.cpp +++ b/common/string.cpp @@ -289,7 +289,7 @@ void ChangeSpaces(char * Text, int NewChar) char * to_point(char * Text) /**************************/ /* convertit les , en . dans une chaine. utilisé pour compenser -l'internalisation imbecile de la fct printf +l'internalisationde la fct printf qui genere les flottants avec une virgule au lieu du point */ { @@ -297,7 +297,9 @@ char * line = Text; if ( Text == NULL ) return NULL; for ( ; *Text != 0; Text++ ) - if (*Text == g_FloatSeparator) *Text = '.'; + { + if (*Text == ',') *Text = '.'; + } return line; } diff --git a/eeschema/eelibs1.cpp b/eeschema/eelibs1.cpp deleted file mode 100644 index 59f7817483..0000000000 --- a/eeschema/eelibs1.cpp +++ /dev/null @@ -1,1150 +0,0 @@ -/***********************************************************/ -/* Module to handle libraries (first part - file and io). */ -/***********************************************************/ - -#include "fctsys.h" -#include "gr_basic.h" - -#include "common.h" -#include "trigo.h" -#include "program.h" -#include "libcmp.h" -#include "general.h" - -#include "protos.h" - -/* Variables Locales */ - -/* Fonctions locales */ -/* pour librairies de composants */ -static LibEDA_BaseStruct *GetDrawEntry(WinEDA_DrawFrame * frame, FILE *f, - char *Line, int *LineNum); -static bool GetLibEntryField(EDA_LibComponentStruct *LibEntry, char * line); -static bool AddAliasNames(EDA_LibComponentStruct *LibEntry, char * line); -static void InsertAlias(PriorQue ** PQ, - EDA_LibComponentStruct *LibEntry, int *NumOfParts); -static bool ReadLibEntryDateAndTime(EDA_LibComponentStruct * LibEntry, char * Line); -static int AddFootprintFilterList(EDA_LibComponentStruct *LibEntryLibEntry, - FILE * f, char * Line, int *LineNum); - -/* pour doc librairies */ - - - /****************************************************/ - /* Routines de lecture des librairies de composants */ - /****************************************************/ - - -/***************************************************************************** -* Routine to load the given library name. FullLibName should hold full path * -* of file name to open, while LibName should hold only its name. * -* IF library already exists, it is NOT reloaded. * -* return: new lib or NULL * -*****************************************************************************/ -LibraryStruct * LoadLibraryName(WinEDA_DrawFrame * frame, - const wxString & FullLibName, const wxString & LibName) -{ -int NumOfParts; -FILE *f; -LibraryStruct *NewLib; -PriorQue *Entries; -wxString FullFileName; - - if ( (NewLib = FindLibrary(LibName)) != NULL) - { - if ( NewLib->m_FullFileName == FullLibName ) - return NewLib; - FreeCmpLibrary(frame, LibName); - } - - NewLib = NULL; - - f = wxFopen(FullLibName, wxT("rt") ); - if (f == NULL) - { - wxString msg; - msg.Printf( _("Library <%s> not found"), FullLibName.GetData()); - DisplayError(frame, msg); - return NULL; - } - - NewLib = new LibraryStruct(LIBRARY_TYPE_EESCHEMA, LibName, FullLibName); - Entries = LoadLibraryAux(frame, NewLib, f, &NumOfParts); - if ( Entries != NULL) - { - NewLib->m_Entries = Entries; - NewLib->m_NumOfParts = NumOfParts; - - if ( g_LibraryList == NULL ) g_LibraryList = NewLib; - else - { - LibraryStruct *tmplib = g_LibraryList; - while ( tmplib->m_Pnext ) tmplib = tmplib->m_Pnext; - tmplib->m_Pnext = NewLib; - } - - FullFileName = FullLibName; - ChangeFileNameExt(FullFileName, DOC_EXT); - LoadDocLib(frame, FullFileName, NewLib->m_Name); - } - else delete NewLib; - - fclose(f); - return NewLib; -} - - -/******************************************/ -void LoadLibraries(WinEDA_DrawFrame * frame) -/******************************************/ -/* Delete toutes les librairies chargees et recree toutes les librairies -donnes dans la liste g_LibName_List -*/ -{ -wxString FullLibName, msg; -wxString LibName; -unsigned ii, iimax = g_LibName_List.GetCount(); - - frame->PrintMsg( _("Start loading schematic libs")); - - // Free the unwanted libraries (i.e. not in list) but keep the .cache lib -LibraryStruct *nextlib, *lib = g_LibraryList; - for (; lib != NULL; lib = nextlib ) - { - nextlib = lib->m_Pnext; - if ( lib->m_IsLibCache ) continue; - - wxString libname = lib->m_Name; - - // is this library in "wanted list" g_LibName_List ? - int test = g_LibName_List.Index(libname); - if ( test == wxNOT_FOUND ) FreeCmpLibrary(frame, libname); - } - - // Load missing libraries (if any) - for ( ii = 0 ; ii < iimax; ii++) - { - LibName = g_LibName_List[ii]; - - if( LibName.IsEmpty() ) continue; - FullLibName = MakeFileName(g_RealLibDirBuffer, LibName, g_LibExtBuffer); - msg = wxT("Loading ") + FullLibName; - if ( LoadLibraryName(frame, FullLibName, LibName) ) - msg += wxT(" OK"); - else - msg += wxT(" ->Error"); - frame->PrintMsg( msg ); - } - - // reorder the linked list to match the order filename list: - int NumOfLibs; - for (NumOfLibs = 0, lib = g_LibraryList; lib != NULL; lib = lib->m_Pnext) - { - lib->m_Flags = 0; - NumOfLibs++; - } - if ( NumOfLibs == 0 ) return; - - LibraryStruct ** libs = - (LibraryStruct **) MyZMalloc(sizeof(LibraryStruct *) * (NumOfLibs + 2)); - - int jj = 0; - for (ii = 0; ii < g_LibName_List.GetCount(); ii++) - { - if ( jj >= NumOfLibs ) break; - lib = FindLibrary(g_LibName_List[ii]); - if ( lib ) - { - lib->m_Flags = 1; - libs[jj++] = lib; - } - } - /* Put lib cache at end of list */ - for (lib = g_LibraryList; lib != NULL; lib = lib->m_Pnext) - { - if ( lib->m_Flags == 0 ) libs[jj++] = lib; - } - libs[jj] = NULL; - - /* Change the linked list pointers */ - for (ii = 0; libs[ii] != NULL; ii++) - libs[ii]->m_Pnext = libs[ii+1]; - - g_LibraryList = libs[0]; - - MyFree(libs); - - for (lib = g_LibraryList; lib != NULL; lib = lib->m_Pnext) - lib->m_Flags = 0; -} - -/***************************************************************************** -* Routine to free a library from the current loaded libraries. * -*****************************************************************************/ -void FreeCmpLibrary(wxWindow * frame, const wxString & LibName) -{ -int NumOfLibs = NumOfLibraries(); -LibraryStruct *Lib, *TempLib; - - if (NumOfLibs == 0) - { - DisplayError(frame, wxT("No libraries are loaded"),20); - return; - } - - /* Search for this library name: */ - for (Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext) - { - if (LibName == Lib->m_Name) break; - } - - if (Lib == NULL) return; - - if ( Lib == g_LibraryList) g_LibraryList = Lib->m_Pnext; - else - { - for( TempLib = g_LibraryList; TempLib->m_Pnext != Lib; TempLib=TempLib->m_Pnext); - TempLib->m_Pnext = TempLib->m_Pnext->m_Pnext; - } - - delete Lib; - - /* La librairie supprimee est peut etre celle selectee dans libedit */ - if ( Lib == CurrentLib ) CurrentLib = NULL; -} - -/******************************/ -const wxChar **GetLibNames(void) -/******************************/ -/* Routine to return pointers to all library names. - User is responsible to deallocate memory -*/ -{ -int ii, NumOfLibs = NumOfLibraries(); -const wxChar **Names; -LibraryStruct *Lib; - - Names = (const wxChar **) MyZMalloc(sizeof(wxChar *) * (NumOfLibs + 1)); - for (ii = 0, Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext, ii++) - { - Names[ii] = Lib->m_Name.GetData(); - } - Names[ii] = NULL; - - return Names; -} - - -/***************************************************************************** -* Routine to compare two EDA_LibComponentStruct for the PriorQue module. * -* Comparison (insensitive case) is based on Part name. * -*****************************************************************************/ -int LibraryEntryCompare(EDA_LibComponentStruct *LE1, EDA_LibComponentStruct *LE2) -{ - return LE1->m_Name.m_Text.CmpNoCase(LE2->m_Name.m_Text); -} - -/***************************************************************************** -* Routine to load a library from given open file. * -*****************************************************************************/ -PriorQue *LoadLibraryAux(WinEDA_DrawFrame * frame, LibraryStruct * Library, FILE *libfile, int *NumOfParts) -{ -int LineNum = 0; -char Line[1024]; -PriorQue *PQ = NULL; -EDA_LibComponentStruct *LibEntry; -wxString msg; - -wxBusyCursor ShowWait; // Display a Busy Cursor.. - - *NumOfParts = 0; - - if ( GetLine(libfile, Line, &LineNum, sizeof(Line) ) == NULL) - { - msg = _("File <") + Library->m_Name + _("> is empty!"); - DisplayError(frame, msg); - return NULL; - } - - if( strnicmp(Line, LIBFILE_IDENT, 10) != 0) - { - msg = _("File <") + Library->m_Name + _("> is NOT EESCHEMA library!"); - DisplayError(frame, msg); - return NULL; - } - - if ( Library ) Library->m_Header = CONV_FROM_UTF8(Line); - - PQInit(&PQ); - PQCompFunc((PQCompFuncType) LibraryEntryCompare); - - while (GetLine(libfile, Line, &LineNum, sizeof(Line)) ) - { - if (strnicmp(Line, "$HEADER", 7) == 0) - { - if ( Library ) - { - if ( ! Library->ReadHeader(libfile, &LineNum) ) - { - msg = _("Library <") + Library->m_Name + _("> header read error"); - DisplayError(frame, msg, 30); - } - } - continue; - } - - if (strnicmp(Line, "DEF", 3) == 0) - { - /* Read one DEF/ENDDEF part entry from library: */ - LibEntry = Read_Component_Definition(frame, Line, libfile, &LineNum); - if ( LibEntry ) - { - /* If we are here, this part is O.k. - put it in: */ - ++*NumOfParts; - PQInsert(&PQ, LibEntry); - InsertAlias(&PQ, LibEntry, NumOfParts); - } - } - } - - return PQ; -} - - -/*********************************************************************************************/ -EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, char * Line, - FILE *f, int *LineNum) -/*********************************************************************************************/ -/* Routine to Read a DEF/ENDDEF part entry from given open file. -*/ -{ -int unused; -char *p, *Name, *Prefix = NULL; -EDA_LibComponentStruct *LibEntry = NULL; -bool Res; -wxString Msg; - - p = strtok(Line, " \t\r\n"); - - if (strcmp(p, "DEF") != 0) - { - Msg.Printf( wxT("DEF command expected in line %d, aborted."), *LineNum); - DisplayError(frame, Msg); - return NULL; - } - - /* Read DEF line: */ - char drawnum = 0, drawname = 0; - LibEntry = new EDA_LibComponentStruct( NULL); - - if ((Name = strtok(NULL, " \t\n")) == NULL || /* Part name: */ - (Prefix = strtok(NULL, " \t\n")) == NULL || /* Prefix name: */ - (p = strtok(NULL, " \t\n")) == NULL || /* NumOfPins: */ - sscanf(p, "%d", &unused) != 1 || - (p = strtok(NULL, " \t\n")) == NULL || /* TextInside: */ - sscanf(p, "%d", &LibEntry->m_TextInside) != 1 || - (p = strtok(NULL, " \t\n")) == NULL || /* DrawNums: */ - sscanf(p, "%c", &drawnum) != 1 || - (p = strtok(NULL, " \t\n")) == NULL || /* DrawNums: */ - sscanf(p, "%c", &drawname) != 1 || - (p = strtok(NULL, " \t\n")) == NULL || /* m_UnitCount: */ - sscanf(p, "%d", &LibEntry->m_UnitCount) != 1 ) - { - Msg.Printf( wxT("Wrong DEF format in line %d, skipped."),*LineNum); - DisplayError(frame, Msg); - while (GetLine(f, Line, LineNum, 1024) ) - { - p = strtok(Line, " \t\n"); - if (stricmp(p, "ENDDEF") == 0) break; - } - return NULL; - } - - else /* Mise a jour des infos de la ligne "DEF" */ - { - LibEntry->m_DrawPinNum = (drawnum == 'N') ? FALSE : TRUE; - LibEntry->m_DrawPinName = (drawname == 'N') ? FALSE : TRUE; - /* Copy part name and prefix. */ - strupper(Name); - if(Name[0] != '~') LibEntry->m_Name.m_Text = CONV_FROM_UTF8(Name); - else - { - LibEntry->m_Name.m_Text = CONV_FROM_UTF8(&Name[1]); - LibEntry->m_Name.m_Attributs |= TEXT_NO_VISIBLE; - } - - if (strcmp(Prefix, "~") == 0) - { - LibEntry->m_Prefix.m_Text.Empty(); - LibEntry->m_Prefix.m_Attributs |= TEXT_NO_VISIBLE; - } - else LibEntry->m_Prefix.m_Text = CONV_FROM_UTF8(Prefix); - - // Copy optional infos - if ( (p = strtok(NULL, " \t\n")) != NULL ) // m_UnitSelectionLocked param - { - if ( *p == 'L') LibEntry->m_UnitSelectionLocked = TRUE; - } - if ( (p = strtok(NULL, " \t\n")) != NULL ) /* Type Of Component */ - { - if ( *p == 'P') LibEntry->m_Options = ENTRY_POWER; - } - } - - /* Analyse lignes suivantes */ - while (GetLine(f, Line, LineNum, 1024) ) - { - p = strtok(Line, " \t\n"); - Res = TRUE; /* Pour test d'erreur (Res = FALSE = erreur) */ - - if( (Line[0] == 'T') && (Line[1] == 'i') ) - { - Res = ReadLibEntryDateAndTime(LibEntry, Line); - } - - else if(Line[0] == 'F') - { - Res = GetLibEntryField(LibEntry, Line); - } - - else if (strcmp(p, "ENDDEF") == 0) - { - break; - } - - else if (strcmp(p, "DRAW") == 0) - { - LibEntry->m_Drawings = GetDrawEntry(frame, f, Line, LineNum); - } - - else if(strncmp(p, "ALIAS", 5) == 0 ) - { - p = strtok(NULL, "\r\n"); - Res = AddAliasNames(LibEntry, p); - } - - else if(strncmp(p, "$FPLIST", 5) == 0 ) - { - Res = AddFootprintFilterList(LibEntry, f, Line, LineNum); - } - - else - { - Msg.Printf( wxT("Undefined command \"%s\" in line %d, skipped."), p, * LineNum); - frame->PrintMsg(Msg); - } - - /* Fin analyse de la ligne ou block: test de l'info lue */ - if (!Res) - { /* Something went wrong there. */ - Msg.Printf( wxT(" Error Line %d, Library not loaded"), *LineNum); - DisplayError(frame, Msg); - delete LibEntry; - return NULL; - } - } - - /* If we are here, this part is O.k. - put it in: */ - LibEntry->SortDrawItems(); - return LibEntry; -} - - - -/***************************************************************************** -* Routine to load a DRAW definition from given file. Note "DRAW" line has * -* been read already. Reads upto and include ENDDRAW, or an error (NULL ret). * -*****************************************************************************/ - -static LibEDA_BaseStruct *GetDrawEntry(WinEDA_DrawFrame * frame, FILE *f, char *Line, int *LineNum) -{ -int i = 0, jj, ll, Unit, Convert, size1, size2; -char *p, Buffer[1024], BufName[256], - PinNum[256], - chartmp[256], chartmp1[256]; -int ctmp; -wxString MsgLine; -bool Error = FALSE; -LibEDA_BaseStruct *Tail = NULL, - *New = NULL, - *Head = NULL; - - while (TRUE) - { - if (GetLine(f, Line, LineNum, 1024 ) == NULL) - { - DisplayError(frame, wxT("File ended prematurely")); - return Head; - } - - if (strncmp(Line, "ENDDRAW", 7) == 0) - { - break; - } - - New = NULL; - - switch (Line[0]) - { - case 'A': /* Arc */ - { - int startx, starty, endx, endy; - LibDrawArc * Arc = new LibDrawArc(); - New = Arc; - ll = 0; - int nbarg = sscanf(&Line[2], "%d %d %d %d %d %d %d %d %c %d %d %d %d", - &Arc->m_Pos.x, &Arc->m_Pos.y, &Arc->m_Rayon, - &Arc->t1, &Arc->t2, &Unit, &Convert, - &Arc->m_Width, &ctmp, &startx, &starty, &endx, &endy); - if ( nbarg < 8 ) Error = TRUE; - Arc->m_Unit = Unit; Arc->m_Convert = Convert; - if ( ctmp == 'F') Arc->m_Fill = FILLED_SHAPE; - if ( ctmp == 'f') Arc->m_Fill = FILLED_WITH_BG_BODYCOLOR; - - NORMALIZE_ANGLE(Arc->t1); - NORMALIZE_ANGLE(Arc->t2); - - if ( nbarg >= 13 ) // Coord reelles des extremites de l'arc lues - { - Arc->m_Start.x = startx; Arc->m_Start.y = starty; - Arc->m_End.x = endx; Arc->m_End.y = endy; - } - else - { - Arc->m_Start.x = Arc->m_Rayon; Arc->m_Start.y = 0; - Arc->m_End.x = Arc->m_Rayon; Arc->m_End.y = 0; - RotatePoint( &Arc->m_Start.x, &Arc->m_Start.y, -Arc->t1); - Arc->m_Start.x += Arc->m_Pos.x; Arc->m_Start.y +=Arc->m_Pos.y; - RotatePoint( &Arc->m_End.x, &Arc->m_End.y, -Arc->t2); - Arc->m_End.x += Arc->m_Pos.x; Arc->m_End.y +=Arc->m_Pos.y; - } - } - break; - - case 'C': /* Circle */ - { - LibDrawCircle * Circle = new LibDrawCircle(); - New = Circle; ll = 0; - Error = sscanf(&Line[2], "%d %d %d %d %d %d %c", - &Circle->m_Pos.x, &Circle->m_Pos.y, &Circle->m_Rayon, - &Unit, &Convert,&Circle->m_Width, &ctmp) < 6; - Circle->m_Unit = Unit; - Circle->m_Convert = Convert; - if ( ctmp == 'F') Circle->m_Fill = FILLED_SHAPE; - if ( ctmp == 'f') Circle->m_Fill = FILLED_WITH_BG_BODYCOLOR; - } - break; - - case 'T': /* Text */ - { - LibDrawText * Text = new LibDrawText(); - New = Text; - Buffer[0] = 0; - Error = sscanf(&Line[2], "%d %d %d %d %d %d %d %s", - &Text->m_Horiz, - &Text->m_Pos.x, &Text->m_Pos.y, - &Text->m_Size.x, &Text->m_Type, - &Unit, &Convert, Buffer) != 8; - - Text->m_Unit = Unit; Text->m_Convert = Convert; - Text->m_Size.y = Text->m_Size.x; - if (!Error) - { /* Convert '~' to spaces. */ - Text->m_Text = CONV_FROM_UTF8(Buffer); - Text->m_Text.Replace(wxT("~"), wxT(" ")); // Les espaces sont restitués - } - } - break; - - case 'S': /* Square */ - { - LibDrawSquare * Square = new LibDrawSquare(); - New = Square; ll = 0; - Error = sscanf(&Line[2], "%d %d %d %d %d %d %d %s", - &Square->m_Start.x, &Square->m_Start.y, - &Square->m_End.x, &Square->m_End.y, - &Unit, &Convert,&Square->m_Width, &ctmp) < 7; - Square->m_Unit = Unit; Square->m_Convert = Convert; - if ( ctmp == 'F') Square->m_Fill = FILLED_SHAPE; - if ( ctmp == 'f') Square->m_Fill = FILLED_WITH_BG_BODYCOLOR; - } - break; - - case 'X': /* Pin Description */ - { - *Buffer = 0; - LibDrawPin * Pin = new LibDrawPin(); - New = Pin; - i = sscanf(Line+2, "%s %s %d %d %d %s %d %d %d %d %s %s", - BufName, PinNum, - &Pin->m_Pos.x, &Pin->m_Pos.y, - &ll, chartmp1, - &size1, &size2, - &Unit, &Convert, chartmp, Buffer); - - Pin->m_SizeNum = size1; /* Parametres type short */ - Pin->m_SizeName = size2; - Pin->m_PinLen = ll; - Pin->m_Orient = chartmp1[0] & 255; - - Pin->m_Unit = Unit; Pin->m_Convert = Convert; - strncpy((char*)&Pin->m_PinNum, PinNum, 4); - Error = (i != 11 && i != 12); - - Pin->m_PinName = CONV_FROM_UTF8(BufName); - - jj = *chartmp & 255; - switch(jj) - { - case 'I': - Pin->m_PinType = PIN_INPUT; break; - case 'O': - Pin->m_PinType = PIN_OUTPUT; break; - case 'B': - Pin->m_PinType = PIN_BIDI; break; - case 'T': - Pin->m_PinType = PIN_TRISTATE; break; - case 'P': - Pin->m_PinType = PIN_PASSIVE; break; - case 'U': - Pin->m_PinType = PIN_UNSPECIFIED; break; - case 'W': - Pin->m_PinType = PIN_POWER_IN; break; - case 'w': - Pin->m_PinType = PIN_POWER_OUT; break; - case 'C': - Pin->m_PinType = PIN_OPENCOLLECTOR; break; - case 'E': - Pin->m_PinType = PIN_OPENEMITTER; break; - default: - MsgLine.Printf( wxT("Unknown Pin Type [%c] line %d"), - jj, *LineNum); - DisplayError(frame, MsgLine); - } - if( i == 12 ) /* Special Symbole defined */ - for( jj = strlen(Buffer); jj > 0 ; ) - { - switch(Buffer[--jj]) - { - case '~': break; - case 'N': Pin->m_Attributs |= PINNOTDRAW; break; - case 'I': Pin->m_PinShape |= INVERT; break; - case 'C': Pin->m_PinShape |= CLOCK; break; - case 'L': Pin->m_PinShape |= LOWLEVEL_IN; break; - case 'V': Pin->m_PinShape |= LOWLEVEL_OUT; break; - default: - MsgLine.Printf( wxT("Unknown Pin Shape [%c] line %d"), - Buffer[jj], *LineNum); - DisplayError(frame, MsgLine); break; - } - } - } - break; - - case 'P': /* Polyline */ - { - LibDrawPolyline * Polyl = new LibDrawPolyline(); - New = Polyl; - - if (sscanf(&Line[2], "%d %d %d %d", - &Polyl->n, &Unit, &Convert, - &Polyl->m_Width) == 4 && - Polyl->n > 0) - { - Polyl->m_Unit = Unit; Polyl->m_Convert = Convert; - - Polyl->PolyList = (int *) - MyZMalloc(sizeof(int) * Polyl->n * 2); - - p = strtok(&Line[2], " \t\n"); - p = strtok(NULL, " \t\n"); - p = strtok(NULL, " \t\n"); - p = strtok(NULL, " \t\n"); - - for (i = 0; i < Polyl->n * 2 && !Error; i++) - { - p = strtok(NULL, " \t\n"); - Error = sscanf(p, "%d", &Polyl->PolyList[i]) != 1; - } - Polyl->m_Fill = NO_FILL; - if ( (p = strtok(NULL, " \t\n")) != NULL ) - { - if ( p[0] == 'F') Polyl->m_Fill = FILLED_SHAPE; - if ( p[0] == 'f') - Polyl->m_Fill = FILLED_WITH_BG_BODYCOLOR; - } - } - - else Error = TRUE; - } - break; - - default: - MsgLine.Printf( wxT("Undefined DRAW command in line %d, aborted."), - *LineNum); - DisplayError(frame, MsgLine); - return Head; - } - - if (Error) - { - MsgLine.Printf( wxT("Error in %c DRAW command in line %d, aborted."), - Line[0], *LineNum); - DisplayError(frame, MsgLine); - delete New; - /* FLush till end of draw: */ - do { - if (GetLine(f, Line, LineNum, 1024 ) == NULL) - { - DisplayError(frame, wxT("File ended prematurely") ); - return Head; - } - } while (strncmp(Line, "ENDDRAW", 7) != 0); - return (Head); - } - - else - { - if (Head == NULL) Head = Tail = New; - else - { - Tail->Pnext = New; Tail = New; - } - } - } - - return Head; -} - - -/***************************************************************************** -* Routine to find the library given its name. * -*****************************************************************************/ -LibraryStruct *FindLibrary(const wxString & Name) -{ -LibraryStruct *Lib = g_LibraryList; - - while (Lib) - { - if (Lib->m_Name == Name ) return Lib; - Lib = Lib->m_Pnext; - } - return NULL; -} - -/***************************************************************************** -* Routine to find the number of libraries currently loaded. * -*****************************************************************************/ -int NumOfLibraries(void) -{ -int ii; -LibraryStruct *Lib = g_LibraryList; - - for (ii = 0; Lib != NULL; Lib = Lib->m_Pnext) ii++; - return ii; -} - - -/*****************************************************************************/ -static bool GetLibEntryField(EDA_LibComponentStruct *LibEntry, char * line) -/*****************************************************************************/ -/* Analyse la ligne de description du champ de la forme: - Fn "CA3130" 150 -200 50 H V - ou n = 0 (REFERENCE), 1 (VALUE) , 2 .. 11 = autres champs, facultatifs -*/ -{ -int posx, posy, size, orient, hjustify, vjustify; -bool draw; -char *Text, - Char1[256], Char2[256], - Char3[256], Char4[256], - FieldUserName[1024]; -int NumOfField, nbparam; -LibDrawField * Field = NULL; - - if( sscanf(line+1, "%d", &NumOfField) != 1) return(0); - - /* Recherche du debut des donnees (debut du texte suivant) */ - while(*line != 0) line++; - while(*line == 0) line++; - - /* recherche du texte */ - while ( *line && (*line != '"') ) line++; - if ( *line == 0 ) return(0); - line ++; Text = line; - - /* recherche fin de texte */ - while ( *line && (*line != '"') ) line++; - if ( *line == 0 ) return(0); - *line = 0; line++; - - FieldUserName[0] = 0; - nbparam = sscanf(line, " %d %d %d %c %c %c %c", - &posx, &posy, &size, Char1, Char2, Char3, Char4); - orient = TEXT_ORIENT_HORIZ; if(Char1[0] == 'V') orient = TEXT_ORIENT_VERT; - draw = TRUE; if(Char2[0] == 'I') draw = FALSE; - hjustify = GR_TEXT_HJUSTIFY_CENTER; - vjustify = GR_TEXT_VJUSTIFY_CENTER; - if ( nbparam >= 6 ) - { - if ( *Char3 == 'L' ) hjustify = GR_TEXT_HJUSTIFY_LEFT; - else if ( *Char3 == 'R' ) hjustify = GR_TEXT_HJUSTIFY_RIGHT; - if ( *Char4 == 'B' ) vjustify = GR_TEXT_VJUSTIFY_BOTTOM; - else if ( *Char4 == 'T' ) vjustify = GR_TEXT_VJUSTIFY_TOP; - } - switch(NumOfField) - { - case REFERENCE: - Field = &LibEntry->m_Prefix; - Field->m_FieldId = REFERENCE; - break; - - case VALUE: - Field = &LibEntry->m_Name; - Field->m_FieldId = VALUE; - break; - - default: - if(NumOfField >= NUMBER_OF_FIELDS ) break; - Field = new LibDrawField(NumOfField); - Field->Pnext = LibEntry->Fields; - LibEntry->Fields = Field; - break; - } - - if ( Field == NULL ) return FALSE; - - Field->m_Pos.x = posx; Field->m_Pos.y = posy; - Field->m_Orient = orient; - if( draw == FALSE ) Field->m_Attributs |= TEXT_NO_VISIBLE; - Field->m_Size.x = Field->m_Size.y = size; - Field->m_Text = CONV_FROM_UTF8(Text); - if ( NumOfField >= FIELD1 ) - { - ReadDelimitedText(FieldUserName,line, sizeof(FieldUserName) ); - Field->m_Name = CONV_FROM_UTF8(FieldUserName); - } - Field->m_HJustify = hjustify; - Field->m_VJustify = vjustify; - return(TRUE); -} - - -/********************************************************************/ -static bool AddAliasNames(EDA_LibComponentStruct *LibEntry, char * line) -/********************************************************************/ -/* Read the alias names (in buffer line) and add them in alias list - names are separated by spaces -*/ -{ -char * text; -wxString name; - text = strtok(line, " \t\r\n"); - - while ( text ) - { - name = CONV_FROM_UTF8(text); - LibEntry->m_AliasList.Add(name); - text = strtok(NULL, " \t\r\n"); - } - return( TRUE ); -} - -/********************************************************************/ -static void InsertAlias(PriorQue ** PQ, EDA_LibComponentStruct *LibEntry, - int *NumOfParts) -/********************************************************************/ -/* create in library (in list PQ) aliases of the "root" component LibEntry*/ -{ -EDA_LibCmpAliasStruct *AliasEntry; -unsigned ii; - - if(LibEntry->m_AliasList.GetCount() == 0) - return; /* No alias for this component */ - - for( ii = 0; ii < LibEntry->m_AliasList.GetCount(); ii++ ) - { - AliasEntry = new EDA_LibCmpAliasStruct(LibEntry->m_AliasList[ii], - LibEntry->m_Name.m_Text.GetData()); - ++*NumOfParts; - PQInsert(PQ, AliasEntry); - } -} - - /*******************************************************/ - /* Routines de lecture des Documentation de composants */ - /*******************************************************/ - -/**********************************************************************************************/ -int LoadDocLib(WinEDA_DrawFrame * frame, const wxString & FullDocLibName, const wxString & Libname) -/**********************************************************************************************/ -/* Routine to load a library from given open file.*/ -{ -int LineNum = 0; -char Line[1024], *Name, *Text; -EDA_LibComponentStruct * Entry; -FILE * f; -wxString msg; - - f = wxFopen(FullDocLibName, wxT("rt") ); - if (f == NULL) return(0); - - if ( GetLine(f, Line, &LineNum, sizeof(Line) ) == NULL) - { /* pas de lignes utiles */ - fclose(f); - return 0; - } - - if( strnicmp(Line, DOCFILE_IDENT, 10) != 0) - { - DisplayError(frame, wxT("File is NOT EESCHEMA doclib!") ); - fclose(f); - return 0; - } - - while (GetLine(f, Line, &LineNum, sizeof(Line)) ) - { - if (strncmp(Line, "$CMP",4) != 0) - { - msg.Printf( wxT("$CMP command expected in line %d, aborted."), LineNum); - DisplayError(frame, msg); - fclose(f); - return 0; - } - - /* Read one $CMP/$ENDCMP part entry from library: */ - Name = strtok(Line + 5,"\n\r"); - wxString cmpname; cmpname = CONV_FROM_UTF8(Name); - Entry = FindLibPart(cmpname.GetData(),Libname,FIND_ALIAS); - while( GetLine(f, Line, &LineNum, sizeof(Line)) ) - { - if( strncmp(Line, "$ENDCMP",7) == 0) break; - Text = strtok(Line + 2,"\n\r"); - switch ( Line[0] ) - { - case 'D': - if(Entry) Entry->m_Doc = CONV_FROM_UTF8(Text); - break; - - case 'K': - if(Entry) Entry->m_KeyWord = CONV_FROM_UTF8(Text); - break; - - case 'F': - if(Entry) Entry->m_DocFile = CONV_FROM_UTF8(Text); - break; - } - } - } - fclose(f); - return 1; -} - - -/*********************************************************************************/ -static bool ReadLibEntryDateAndTime(EDA_LibComponentStruct * LibEntry, char * Line) -/*********************************************************************************/ -/* lit date et time de modif composant sous le format: - "Ti yy/mm/jj hh:mm:ss" -*/ -{ -int year,mon,day,hour,min,sec; -char * text; - - year = mon = day = hour = min = sec = 0; - text = strtok(Line," \r\t\n"); - text = strtok(NULL," \r\t\n"); // text pointe donnees utiles - - sscanf(Line,"%d/%d/%d %d:%d:%d",&year,&mon,&day,&hour,&min,&sec); - - LibEntry->m_LastDate = (sec & 63) - + ((min & 63) << 6) - + ((hour & 31) << 12) - + ((day & 31) << 17) - + ((mon & 15) << 22) - + ((year-1990) << 26); - - return TRUE; -} - -/*******************************************/ -static int SortItemsFct(const void * ref, const void * item); -void EDA_LibComponentStruct::SortDrawItems(void) -/*******************************************/ -/* Trie les éléments graphiques d'un composant lib pour améliorer -le tracé: -items remplis en premier, pins en dernier -En cas de superposition d'items, c'est plus lisible -*/ -{ -LibEDA_BaseStruct ** Bufentry, ** BufentryBase, *Entry = m_Drawings; -int ii, nbitems; - - if(Entry == NULL ) return; /* Pas d'alias pour ce composant */ - /* calcul du nombre d'items */ - for( nbitems = 0; Entry != NULL; Entry = Entry->Next()) nbitems++; - - BufentryBase = - (LibEDA_BaseStruct **) MyZMalloc( (nbitems+1) * sizeof(LibEDA_BaseStruct *)); - /* memorisation du chainage : */ - for( Entry = m_Drawings, ii = 0; Entry != NULL; Entry = Entry->Next()) - BufentryBase[ii++] = Entry; - - /* Tri du chainage */ - qsort(BufentryBase, nbitems, sizeof(LibEDA_BaseStruct *), SortItemsFct); - - /* Mise a jour du chainage. Remarque: - le dernier element de BufEntryBase (BufEntryBase[nbitems]) est NULL*/ - m_Drawings = * BufentryBase; - Bufentry = BufentryBase; - for (ii = 0 ; ii < nbitems; ii++) - { - (* Bufentry)->Pnext = * (Bufentry+1); - Bufentry++; - } - - MyFree(BufentryBase); -} - -int SortItemsFct(const void * ref, const void * item) -{ -#define Ref (*(LibEDA_BaseStruct **)(ref)) -#define Item (*(LibEDA_BaseStruct **)(item)) -#define BEFORE -1 -#define AFTER 1 - -int fill_ref = 0, fill_item = 0; - - switch (Ref->m_StructType) - { - case COMPONENT_ARC_DRAW_TYPE: - { - const LibDrawArc * draw = (const LibDrawArc *) Ref; - fill_ref = draw->m_Fill; - break; - } - - case COMPONENT_CIRCLE_DRAW_TYPE: - { - const LibDrawCircle * draw = (const LibDrawCircle *) Ref; - fill_ref = draw->m_Fill; - break; - } - - case COMPONENT_RECT_DRAW_TYPE: - { - const LibDrawSquare * draw = (const LibDrawSquare *) Ref; - fill_ref = draw->m_Fill; - break; - } - - case COMPONENT_POLYLINE_DRAW_TYPE: - { - const LibDrawPolyline * draw = (const LibDrawPolyline *) Ref; - fill_ref = draw->m_Fill; - break; - } - - case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: - if ( Item->m_StructType == COMPONENT_PIN_DRAW_TYPE ) return BEFORE; - if ( Item->m_StructType == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) return 0; - return 1; - break; - - case COMPONENT_PIN_DRAW_TYPE: - if ( Item->m_StructType == COMPONENT_PIN_DRAW_TYPE ) - { - int ii; - // We sort the pins by orientation - ii = ((LibDrawPin *) Ref)->m_Orient - ((LibDrawPin *) Item)->m_Orient; - if ( ii ) return ii; - - /* We sort the pins by position (x or y). - note: at this point, most of pins have same x pos or y pos, - because they are sorted by orientation and generally are vertically or - horizontally aligned */ - wxPoint pos_ref, pos_tst; - pos_ref = ((LibDrawPin *) Ref)->m_Pos; - pos_tst = ((LibDrawPin *) Item)->m_Pos; - if ( (ii = pos_ref.x - pos_tst.x) ) return ii; - ii = pos_ref.y - pos_tst.y; - return ii; - } - else return AFTER; - break; - } - - /* Test de l'item */ - switch (Item->m_StructType) - { - case COMPONENT_ARC_DRAW_TYPE: - { - const LibDrawArc * draw = (const LibDrawArc *) Item; - fill_item = draw->m_Fill; - break; - } - - case COMPONENT_CIRCLE_DRAW_TYPE: - { - const LibDrawCircle * draw = (const LibDrawCircle *) Item; - fill_item = draw->m_Fill; - break; - } - - case COMPONENT_RECT_DRAW_TYPE: - { - const LibDrawSquare * draw = (const LibDrawSquare *) Item; - fill_item = draw->m_Fill; - break; - } - - case COMPONENT_POLYLINE_DRAW_TYPE: - { - const LibDrawPolyline * draw = (const LibDrawPolyline *) Item; - fill_item = draw->m_Fill; - break; - } - - case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: - return BEFORE; - break; - - case COMPONENT_PIN_DRAW_TYPE: - return BEFORE; - break; - } - - if ( fill_ref & fill_item ) return 0; - if ( fill_ref ) return BEFORE; - return AFTER; -} - - -/*****************************************************************************/ -int AddFootprintFilterList(EDA_LibComponentStruct *LibEntryLibEntry, FILE * f, - char * Line, int *LineNum) -/******************************************************************************/ -/* read the FootprintFilter List stating with: - FPLIST - and ending with: - ENDFPLIST -*/ -{ - for ( ; ; ) - { - if (GetLine(f, Line, LineNum, 1024 ) == NULL) - { - DisplayError(NULL, wxT("File ended prematurely")); - return 0; - } - - if ( stricmp(Line, "$ENDFPLIST") == 0 ) - { - break; /*normal exit on end of list */ - } - - LibEntryLibEntry->m_FootprintList.Add(CONV_FROM_UTF8(Line+1)); - } - - return 1; -} diff --git a/eeschema/eelibs2.cpp b/eeschema/eelibs2.cpp deleted file mode 100644 index f2d101c7a6..0000000000 --- a/eeschema/eelibs2.cpp +++ /dev/null @@ -1,974 +0,0 @@ - /********************************************************/ - /* Module to handle libraries (second part - drawing ). */ - /********************************************************/ - -#include "fctsys.h" -#include "gr_basic.h" - -#include "common.h" -#include "program.h" -#include "libcmp.h" -#include "component_class.h" -#include "general.h" -#include "trigo.h" -#include "protos.h" - -#define UNVISIBLE_COLOR DARKGRAY - -//#define DRAW_ARC_WITH_ANGLE // pour trace arc avec routine utilsant les angles - - -/* Fonctions locales */ - -/* Description du composant utilisé lorsque des composants non trouvés -en librarie doivent etre dessinés */ -/* -ce composant est un rectangle de 400 mils de coté avec le texte ?? au centre -DEF DUMMY U 0 40 Y Y 1 0 N -F0 "U" 0 -350 60 H V -F1 "DUMMY" 0 350 60 H V -DRAW -T 0 0 0 150 0 0 0 ?? -S -200 200 200 -200 0 1 0 -ENDDRAW -ENDDEF -*/ - -static int s_ItemSelectColor = BROWN; - -static EDA_LibComponentStruct * DummyCmp; -static int * Buf_Poly_Drawings, Buf_Poly_Size; // Used fo polyline drawings -static void DrawLibPartAux(WinEDA_DrawPanel * panel, wxDC * DC, - EDA_SchComponentStruct *Component, - EDA_LibComponentStruct *Entry, - const wxPoint & Pos, - int TransMat[2][2], - int Multi, int convert, - int DrawMode, int Color = -1, bool DrawPinText = TRUE); - -/******************************/ -static void CreateDummyCmp(void) -/******************************/ -{ - DummyCmp = new EDA_LibComponentStruct( NULL); - - LibDrawSquare * Square = new LibDrawSquare(); - Square->m_Start = wxPoint(- 200,200); - Square->m_End = wxPoint(200, - 200); - Square->m_Width = 4; - - LibDrawText * Text = new LibDrawText(); - Text->m_Size.x = Text->m_Size.y = 150; - Text->m_Text = wxT("??"); - - DummyCmp->m_Drawings = Square; - Square->Pnext = Text; -} - - -/*************************************************************/ -void DrawLibEntry(WinEDA_DrawPanel * panel,wxDC * DC, - EDA_LibComponentStruct *LibEntry, - int posX, int posY, - int Multi, int convert, - int DrawMode, int Color) -/**************************************************************/ -/* Routine de dessin d'un composant d'une librairie - LibEntry = pointeur sur la description en librairie - posX, posY = position du composant - DrawMode = GrOR .. - Color = 0 : dessin en vraies couleurs, sinon couleur = Color - - Une croix symbolise le point d'accrochage (ref position) du composant - - Le composant est toujours trace avec orientation 0 -*/ -{ -int color; -int TransMat[2][2]; -wxString Prefix; -LibDrawField * Field; -wxPoint text_pos; - - /* Orientation normale */ - TransMat[0][0] = 1; TransMat[1][1] = -1; - TransMat[1][0] = TransMat[0][1] = 0; - - DrawLibPartAux(panel, DC, NULL, LibEntry, wxPoint(posX, posY), - TransMat, Multi, - convert, DrawMode, Color); - - /* Trace des 2 champs ref et value (Attention aux coord: la matrice - de transformation change de signe les coord Y */ - - GRSetDrawMode(DC, DrawMode); - - if( LibEntry->m_Prefix.m_Attributs & TEXT_NO_VISIBLE ) - { - if( Color >= 0 ) color = Color; - else color = UNVISIBLE_COLOR; - } - - else { - if( Color >= 0) color = Color; - else color = ReturnLayerColor(LAYER_REFERENCEPART); - } - - if (LibEntry->m_UnitCount > 1) - Prefix.Printf( wxT("%s?%c"),LibEntry->m_Prefix.m_Text.GetData(),Multi + 'A' - 1); - else Prefix = LibEntry->m_Prefix.m_Text + wxT("?"); - - text_pos.x = LibEntry->m_Prefix.m_Pos.x + posX; - text_pos.y = posY - LibEntry->m_Prefix.m_Pos.y; - DrawGraphicText(panel, DC, text_pos, - color,LibEntry->m_Prefix.m_Text.GetData(), - LibEntry->m_Prefix.m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - LibEntry->m_Prefix.m_Size, - LibEntry->m_Prefix.m_HJustify, LibEntry->m_Prefix.m_VJustify); - - if( LibEntry->m_Name.m_Attributs & TEXT_NO_VISIBLE ) - { - if( Color >= 0) color = Color; - else color = UNVISIBLE_COLOR; - } - - else { - if( Color >= 0 ) color = Color; - else color = ReturnLayerColor(LAYER_VALUEPART); - } - - text_pos.x = LibEntry->m_Name.m_Pos.x + posX; - text_pos.y = posY - LibEntry->m_Name.m_Pos.y; - DrawGraphicText(panel, DC, text_pos, - color, LibEntry->m_Name.m_Text.GetData(), - LibEntry->m_Name.m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - LibEntry->m_Name.m_Size, - LibEntry->m_Name.m_HJustify, LibEntry->m_Name.m_VJustify); - - for( Field = LibEntry->Fields; Field != NULL; Field = (LibDrawField *)Field->Pnext ) - { - if( Field->m_Text.IsEmpty() ) return; - if( Field->m_Attributs & TEXT_NO_VISIBLE ) - { - if( Color >= 0) color = Color; - else color = UNVISIBLE_COLOR; - } - else { - if( Color >= 0) color = Color; - else color = ReturnLayerColor(LAYER_FIELDS); - } - - text_pos.x = Field->m_Pos.x + posX; - text_pos.y = posY - Field->m_Pos.y; - DrawGraphicText(panel, DC, text_pos, - color, Field->m_Text, - Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - Field->m_Size, - Field->m_HJustify, Field->m_VJustify); - } - - // Tracé de l'ancre - int len = 3 * panel->GetZoom(); - GRLine(&panel->m_ClipBox, DC, posX, posY - len, posX, posY + len, color); - GRLine(&panel->m_ClipBox, DC, posX - len, posY, posX + len, posY, color); - -} - -/***************************************************************************** -* Routine to draw the given part at given position, transformed/mirror as * -* specified, and in the given drawing mode. Only this one is visible... * -*****************************************************************************/ -void EDA_SchComponentStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, - const wxPoint & offset, int DrawMode, int Color) -{ -EDA_LibComponentStruct *Entry; -int ii; -bool dummy = FALSE; - - if( (Entry = FindLibPart(m_ChipName.GetData(),wxEmptyString,FIND_ROOT)) == NULL) - { /* composant non trouvé, on affiche un composant "dummy" */ - dummy = TRUE; - if( DummyCmp == NULL ) CreateDummyCmp(); - Entry = DummyCmp; - } - - DrawLibPartAux(panel, DC, this, Entry, m_Pos + offset, - m_Transform, - dummy ? 0 : m_Multi, - dummy ? 0 : m_Convert, - DrawMode); - - /* Trace des champs, avec placement et orientation selon orient. du - composant - */ - - if( ((m_Field[REFERENCE].m_Attributs & TEXT_NO_VISIBLE) == 0) - && ! (m_Field[REFERENCE].m_Flags & IS_MOVED) ) - { - if ( Entry->m_UnitCount > 1 ) - DrawTextField(panel, DC, &m_Field[REFERENCE],1,DrawMode); - else - DrawTextField(panel, DC, &m_Field[REFERENCE],0,DrawMode); - } - - for( ii = VALUE; ii < NUMBER_OF_FIELDS; ii++ ) - { - if (m_Field[ii].m_Flags & IS_MOVED) continue; - DrawTextField(panel, DC, &m_Field[ii],0,DrawMode); - } -} - -/***********************************************************/ -void DrawTextField(WinEDA_DrawPanel * panel,wxDC * DC, - PartTextStruct * Field, int IsMulti, int DrawMode) -/***********************************************************/ -/* Routine de trace des textes type Field du composant. - entree: - IsMulti: flag Non Null si il y a plusieurs parts par boitier. - n'est utile que pour le champ reference pour ajouter a celui ci - l'identification de la part ( A, B ... ) - DrawMode: mode de trace -*/ -{ -int orient, color; -wxPoint pos; /* Position des textes */ -EDA_SchComponentStruct *DrawLibItem = (EDA_SchComponentStruct *) Field->m_Parent; -int hjustify, vjustify; - - if( Field->m_Attributs & TEXT_NO_VISIBLE ) return; - if( Field->IsVoid() ) return; - - GRSetDrawMode(DC, DrawMode); - - /* Calcul de la position des textes, selon orientation du composant */ - orient = Field->m_Orient; - hjustify = Field->m_HJustify; vjustify = Field->m_VJustify; - pos.x = Field->m_Pos.x - DrawLibItem->m_Pos.x; - pos.y = Field->m_Pos.y - DrawLibItem->m_Pos.y; - - pos = DrawLibItem->GetScreenCoord(pos); - pos.x += DrawLibItem->m_Pos.x; - pos.y += DrawLibItem->m_Pos.y; - - /* Y a t-il rotation (pour l'orientation, la justification)*/ - if(DrawLibItem->m_Transform[0][1]) // Rotation du composant de 90deg - { - if ( orient == TEXT_ORIENT_HORIZ) orient = TEXT_ORIENT_VERT; - else orient = TEXT_ORIENT_HORIZ; - /* Y a t-il rotation, miroir (pour les justifications)*/ - EXCHG(hjustify, vjustify); - if (DrawLibItem->m_Transform[1][0] < 0 ) vjustify = - vjustify; - if (DrawLibItem->m_Transform[1][0] > 0 ) hjustify = - hjustify; - } - else - { /* Texte horizontal: Y a t-il miroir (pour les justifications)*/ - if (DrawLibItem->m_Transform[0][0] < 0 ) - hjustify = - hjustify; - if (DrawLibItem->m_Transform[1][1] > 0 ) - vjustify = - vjustify; - } - - if( Field->m_FieldId == REFERENCE ) - color = ReturnLayerColor(LAYER_REFERENCEPART); - else if( Field->m_FieldId == VALUE ) - color = ReturnLayerColor(LAYER_VALUEPART); - else color = ReturnLayerColor(LAYER_FIELDS); - if( !IsMulti || (Field->m_FieldId != REFERENCE) ) - { - DrawGraphicText(panel, DC, pos, color, Field->m_Text.GetData(), - orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - Field->m_Size, - hjustify, vjustify); - } - - else /* Le champ est la reference, et il y a plusieurs parts par boitier */ - {/* On ajoute alors A ou B ... a la reference */ - wxString fulltext = Field->m_Text; - fulltext.Append('A' - 1 + DrawLibItem->m_Multi); - DrawGraphicText(panel, DC, pos, color, fulltext.GetData(), - orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, - Field->m_Size, - hjustify, vjustify); - } -} - - -/********************************************************************************/ -EDA_LibComponentStruct *FindLibPart(const wxChar *Name, const wxString & LibName, int Alias) -/********************************************************************************/ -/* - Routine to find a part in one of the libraries given its name. - Name = Name of part. - LibName = Name of Lib; if "": seach in all libs - Alias = Flag: si flag != 0, retourne un pointeur sur une part ou un alias - si flag = 0, retourne un pointeur sur une part meme si le nom - correspond a un alias - Alias = FIND_ROOT, ou Alias = FIND_ALIAS -*/ -{ -EDA_LibComponentStruct *Entry; -static EDA_LibComponentStruct DummyEntry(wxEmptyString); /* Used only to call PQFind. */ -LibraryStruct *Lib = g_LibraryList; - - DummyEntry.m_Drawings = NULL; /* Used only to call PQFind. */ - DummyEntry.m_Name.m_Text = Name; - - PQCompFunc((PQCompFuncType) LibraryEntryCompare); - - Entry = NULL; FindLibName.Empty(); - while (Lib) - { - if( ! LibName.IsEmpty() ) - { - if( Lib->m_Name != LibName ) - { - Lib = Lib->m_Pnext; continue ; - } - } - if( Lib == NULL ) break; - Entry = (EDA_LibComponentStruct*)PQFind(Lib->m_Entries, &DummyEntry); - if( Entry != NULL) - { - FindLibName = Lib->m_Name; - break; - } - Lib = Lib->m_Pnext; - } - - /* Si le nom est un alias, recherche du vrai composant */ - if( Entry ) - { - if( (Entry->Type != ROOT ) && (Alias == FIND_ROOT) ) - Entry = FindLibPart( ((EDA_LibCmpAliasStruct*)Entry)->m_RootName.GetData() , - Lib->m_Name, FIND_ROOT); - } - - return (Entry); -} - -/***************************************************************************** -* Routine to draw the given part at given position, transformed/mirror as -* specified, and in the given drawing mode. -* if Color < 0: Draw in normal color -* else draw in color = Color -*****************************************************************************/ -/* DrawMode = GrXOR, GrOR ..*/ -void DrawLibPartAux(WinEDA_DrawPanel * panel,wxDC * DC, - EDA_SchComponentStruct *Component, - EDA_LibComponentStruct *Entry, - const wxPoint & Pos, - int TransMat[2][2], - int Multi, int convert, int DrawMode, - int Color, bool DrawPinText) -{ -int i, x1, y1, x2, y2, t1, t2, orient; -LibEDA_BaseStruct *DEntry = NULL; -int CharColor; -int fill_option; -int SetHightColor; -//#define GETCOLOR(l) Color < 0 ? (ReturnLayerColor(l)| SetHightColor) : Color; -#define GETCOLOR(l) Color < 0 ? SetHightColor ? s_ItemSelectColor : (ReturnLayerColor(l)| SetHightColor) : Color; - - if (Entry->m_Drawings == NULL) return; - GRSetDrawMode(DC, DrawMode); - - for( DEntry = Entry->m_Drawings; DEntry != NULL;DEntry = DEntry->Next()) - { - /* Elimination des elements non relatifs a l'unite */ - if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) ) continue; - if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) ) - continue; - - if ( DEntry->m_Flags & IS_MOVED ) continue; // Element en deplacement non trace - SetHightColor = (DEntry->m_Selected & IS_SELECTED) ? HIGHT_LIGHT_FLAG : 0; - switch (DEntry->m_StructType) - { - case COMPONENT_ARC_DRAW_TYPE: - { - int xc,yc, x2, y2; - LibDrawArc * Arc = (LibDrawArc *) DEntry; - CharColor = GETCOLOR(LAYER_DEVICE); - xc = Pos.x + TransMat[0][0] * Arc->m_Pos.x + - TransMat[0][1] * Arc->m_Pos.y; - yc = Pos.y + TransMat[1][0] * Arc->m_Pos.x + - TransMat[1][1] * Arc->m_Pos.y; - x2 = Pos.x + TransMat[0][0] * Arc->m_Start.x + - TransMat[0][1] * Arc->m_Start.y;; - y2 = Pos.y + TransMat[1][0] * Arc->m_Start.x + - TransMat[1][1] * Arc->m_Start.y; - x1 = Pos.x + TransMat[0][0] * Arc->m_End.x + - TransMat[0][1] * Arc->m_End.y;; - y1 = Pos.y + TransMat[1][0] * Arc->m_End.x + - TransMat[1][1] * Arc->m_End.y; - t1 = Arc->t1; t2 = Arc->t2; - bool swap = MapAngles(&t1, &t2, TransMat); - if ( swap ) { EXCHG(x1,x2); EXCHG(y1, y2) } - fill_option = Arc->m_Fill & (~g_PrintFillMask); - if ( Color < 0 ) // Normal Color Layer - { - if ( (fill_option == FILLED_WITH_BG_BODYCOLOR) && ! g_IsPrinting ) - GRFilledArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, - Arc->m_Rayon, CharColor, - ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); - else if ( fill_option == FILLED_SHAPE) - GRFilledArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, - Arc->m_Rayon, CharColor, CharColor); -#ifdef DRAW_ARC_WITH_ANGLE - else GRArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, - Arc->m_Rayon, CharColor); -#else - else GRArc1(&panel->m_ClipBox, DC, x1, y1, x2, y2, - xc, yc , CharColor); -#endif - } -#ifdef DRAW_ARC_WITH_ANGLE - else GRArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, - Arc->m_Rayon, CharColor); -#else - else GRArc1(&panel->m_ClipBox, DC, x1, y1, x2, y2, - xc, yc, CharColor); -#endif - } - break; - - case COMPONENT_CIRCLE_DRAW_TYPE: - { - LibDrawCircle * Circle = (LibDrawCircle *) DEntry; - CharColor = GETCOLOR(LAYER_DEVICE); - x1 = Pos.x + TransMat[0][0] * Circle->m_Pos.x + - TransMat[0][1] * Circle->m_Pos.y; - y1 = Pos.y + TransMat[1][0] * Circle->m_Pos.x + - TransMat[1][1] * Circle->m_Pos.y; - fill_option = Circle->m_Fill & (~g_PrintFillMask); - if ( Color < 0 ) - { - if ( (fill_option == FILLED_WITH_BG_BODYCOLOR) && ! g_IsPrinting ) - GRFilledCircle(&panel->m_ClipBox, DC, x1, y1, - Circle->m_Rayon, CharColor, - ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); - else if ( fill_option == FILLED_SHAPE) - GRFilledCircle(&panel->m_ClipBox, DC, x1, y1, - Circle->m_Rayon, CharColor, CharColor); - else GRCircle(&panel->m_ClipBox, DC, x1, y1, - Circle->m_Rayon, CharColor); - } - else GRCircle(&panel->m_ClipBox, DC, x1, y1, - Circle->m_Rayon, CharColor); - } - break; - - case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: - { - LibDrawText * Text = (LibDrawText *) DEntry; - CharColor = GETCOLOR(LAYER_DEVICE); - - /* The text orientation may need to be flipped if the - transformation matrix cuases xy axes to be flipped. */ - t1 = (TransMat[0][0] != 0) ^ (Text->m_Horiz != 0); - x1 = Pos.x + TransMat[0][0] * Text->m_Pos.x - + TransMat[0][1] * Text->m_Pos.y; - y1 = Pos.y + TransMat[1][0] * Text->m_Pos.x - + TransMat[1][1] * Text->m_Pos.y; - PutTextInfo(panel, DC, t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, - wxPoint(x1, y1), - Text->m_Size, - Text->m_Text, DrawMode,CharColor); - } - break; - - case COMPONENT_RECT_DRAW_TYPE: - { - LibDrawSquare * Square = (LibDrawSquare *) DEntry; - CharColor = GETCOLOR(LAYER_DEVICE); - - x1 = Pos.x + TransMat[0][0] * Square->m_Start.x - + TransMat[0][1] * Square->m_Start.y; - y1 = Pos.y + TransMat[1][0] * Square->m_Start.x - + TransMat[1][1] * Square->m_Start.y; - x2 = Pos.x + TransMat[0][0] * Square->m_End.x - + TransMat[0][1] * Square->m_End.y; - y2 = Pos.y + TransMat[1][0] * Square->m_End.x - + TransMat[1][1] * Square->m_End.y; - fill_option = Square->m_Fill & (~g_PrintFillMask); - if ( Color < 0 ) - { - if ( (fill_option == FILLED_WITH_BG_BODYCOLOR) && ! g_IsPrinting ) - GRFilledRect(&panel->m_ClipBox, DC, x1, y1, x2, y2, - CharColor, - ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); - else if ( fill_option == FILLED_SHAPE) - GRFilledRect(&panel->m_ClipBox, DC, x1, y1, x2, y2, - CharColor, CharColor); - else GRRect(&panel->m_ClipBox, DC, x1, y1, x2, y2, - CharColor); - } - else GRRect(&panel->m_ClipBox, DC, x1, y1, x2, y2, - CharColor); - } - break; - - case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */ - { - LibDrawPin * Pin = (LibDrawPin *) DEntry; - if(Pin->m_Attributs & PINNOTDRAW) - { - if( (ActiveScreen->m_Type == SCHEMATIC_FRAME) && - !g_ShowAllPins ) - break; - } - /* Calcul de l'orientation reelle de la Pin */ - orient = Pin->ReturnPinDrawOrient(TransMat); - - /* Calcul de la position du point de reference */ - x2 = Pos.x + (TransMat[0][0] * Pin->m_Pos.x) - + (TransMat[0][1] * Pin->m_Pos.y); - y2 = Pos.y + (TransMat[1][0] * Pin->m_Pos.x) - + (TransMat[1][1] * Pin->m_Pos.y); - - /* Dessin de la pin et du symbole special associe */ - CharColor = GETCOLOR(LAYER_PIN); - DrawPinSymbol(panel, DC, x2, y2, Pin->m_PinLen, orient, - Pin->m_PinShape, DrawMode, - CharColor ); - - if ( DrawPinText ) - { - wxPoint pinpos(x2,y2); - CharColor = SetHightColor ? s_ItemSelectColor : Color; - Pin->DrawPinTexts(panel, DC, pinpos, orient, - Entry->m_TextInside, - Entry->m_DrawPinNum,Entry->m_DrawPinName, - CharColor, DrawMode); - } - } - break; - - case COMPONENT_POLYLINE_DRAW_TYPE: - { - LibDrawPolyline * polyline = (LibDrawPolyline *) DEntry; - CharColor = GETCOLOR(LAYER_DEVICE); - if ( Buf_Poly_Drawings == NULL ) - { - Buf_Poly_Size = polyline->n; - Buf_Poly_Drawings = (int *) MyMalloc(sizeof(int) * 2 * Buf_Poly_Size); - } - else if ( Buf_Poly_Size < polyline->n ) - { - Buf_Poly_Size = polyline->n; - Buf_Poly_Drawings = (int *) realloc(Buf_Poly_Drawings, - sizeof(int) * 2 * Buf_Poly_Size); - } - for (i = 0; i < polyline->n; i++) - { - Buf_Poly_Drawings[i * 2] = Pos.x + - TransMat[0][0] * polyline->PolyList[i * 2] + - TransMat[0][1] * polyline->PolyList[i * 2 + 1]; - Buf_Poly_Drawings[i * 2 + 1] = Pos.y + - TransMat[1][0] * polyline->PolyList[i * 2] + - TransMat[1][1] * polyline->PolyList[i * 2 + 1]; - } - fill_option = polyline->m_Fill & (~g_PrintFillMask); - if ( Color < 0 ) - { - if ( (fill_option == FILLED_WITH_BG_BODYCOLOR) && ! g_IsPrinting ) - GRPoly(&panel->m_ClipBox, DC, polyline->n, - Buf_Poly_Drawings, 1, CharColor, - ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); - else if ( fill_option == FILLED_SHAPE) - GRPoly(&panel->m_ClipBox, DC, polyline->n, - Buf_Poly_Drawings, 1, CharColor, CharColor); - else GRPoly(&panel->m_ClipBox, DC, polyline->n, - Buf_Poly_Drawings, 0, CharColor, CharColor); - } - else GRPoly(&panel->m_ClipBox, DC, polyline->n, - Buf_Poly_Drawings, 0, CharColor, CharColor); - } - break; - - default: - wxBell(); - break; - } /* Fin Switch */ - } /* Fin Boucle de dessin */ - if ( g_DebugLevel > 4 ) /* Draw the component boundary box */ - { - EDA_Rect BoundaryBox; - if ( Component ) BoundaryBox = Component->GetBoundaryBox(); - else BoundaryBox = Entry->GetBoundaryBox(Multi, convert); - x1 = BoundaryBox.GetX(); - y1 = BoundaryBox.GetY(); - x2 = BoundaryBox.GetRight(); - y2 = BoundaryBox.GetBottom(); - GRRect(&panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN); - BoundaryBox = Component->m_Field[REFERENCE].GetBoundaryBox(); - x1 = BoundaryBox.GetX(); - y1 = BoundaryBox.GetY(); - x2 = BoundaryBox.GetRight(); - y2 = BoundaryBox.GetBottom(); - GRRect(&panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN); - BoundaryBox = Component->m_Field[VALUE].GetBoundaryBox(); - x1 = BoundaryBox.GetX(); - y1 = BoundaryBox.GetY(); - x2 = BoundaryBox.GetRight(); - y2 = BoundaryBox.GetBottom(); - GRRect(&panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN); - } -} - - -/*******************************************************/ -void DrawPinSymbol(WinEDA_DrawPanel * panel, wxDC * DC, - int posX, int posY, int len, int orient, - int Shape, int DrawMode, int Color) -/*******************************************************/ - -/* Dessine la pin du symbole en cours de trace - si Color != 0 dessin en couleur Color, sinon en couleurs standard. -*/ -{ -int MapX1, MapY1, x1, y1; -int color; - - if( Color >= 0) color = Color; - else color = ReturnLayerColor(LAYER_PIN); - GRSetDrawMode(DC, DrawMode); - - - MapX1 = MapY1 = 0; x1 = posX; y1 = posY; - switch ( orient ) - { - case PIN_UP: - y1 = posY - len; MapY1 = 1; - break; - case PIN_DOWN: - y1 = posY + len; MapY1 = -1; - break; - case PIN_LEFT: - x1 = posX - len, MapX1 = 1; - break; - case PIN_RIGHT: - x1 = posX + len; MapX1 = -1; - break; - } - - if( Shape & INVERT) - { - GRCircle(&panel->m_ClipBox, DC, MapX1 * INVERT_PIN_RADIUS + x1, - MapY1 * INVERT_PIN_RADIUS + y1, - INVERT_PIN_RADIUS, color); - - GRMoveTo(MapX1 * INVERT_PIN_RADIUS * 2 + x1, - MapY1 * INVERT_PIN_RADIUS * 2 + y1); - GRLineTo(&panel->m_ClipBox, DC, posX, posY, color); - } - - else - { - GRMoveTo(x1, y1); - GRLineTo(&panel->m_ClipBox, DC, posX, posY, color); - } - - if(Shape & CLOCK) - { - if(MapY1 == 0 ) /* MapX1 = +- 1 */ - { - GRMoveTo(x1, y1 + CLOCK_PIN_DIM); - GRLineTo(&panel->m_ClipBox, DC, x1 - MapX1 * CLOCK_PIN_DIM, y1, color); - GRLineTo(&panel->m_ClipBox, DC, x1, y1 - CLOCK_PIN_DIM, color); - } - else /* MapX1 = 0 */ - { - GRMoveTo(x1 + CLOCK_PIN_DIM, y1 ); - GRLineTo(&panel->m_ClipBox, DC, x1, y1 - MapY1 * CLOCK_PIN_DIM, color); - GRLineTo(&panel->m_ClipBox, DC, x1 - CLOCK_PIN_DIM, y1, color); - } - } - - if(Shape & LOWLEVEL_IN) /* IEEE symbol "Active Low Input" */ - { - if(MapY1 == 0 ) /* MapX1 = +- 1 */ - { - GRMoveTo(x1 + MapX1 * IEEE_SYMBOL_PIN_DIM*2, y1); - GRLineTo(&panel->m_ClipBox, DC, x1 + MapX1 * IEEE_SYMBOL_PIN_DIM*2, - y1 - IEEE_SYMBOL_PIN_DIM, color); - GRLineTo(&panel->m_ClipBox, DC, x1, y1, color); - } - else /* MapX1 = 0 */ - { - GRMoveTo(x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM*2); - GRLineTo(&panel->m_ClipBox, DC, x1 - IEEE_SYMBOL_PIN_DIM, - y1 + MapY1 * IEEE_SYMBOL_PIN_DIM*2, color); - GRLineTo(&panel->m_ClipBox, DC, x1 , y1, color); - } - } - - - if(Shape & LOWLEVEL_OUT) /* IEEE symbol "Active Low Output" */ - { - if(MapY1 == 0 ) /* MapX1 = +- 1 */ - { - GRMoveTo(x1, y1 - IEEE_SYMBOL_PIN_DIM); - GRLineTo(&panel->m_ClipBox, DC, x1 + MapX1 * IEEE_SYMBOL_PIN_DIM*2, y1, color); - } - else /* MapX1 = 0 */ - { - GRMoveTo(x1 - IEEE_SYMBOL_PIN_DIM, y1); - GRLineTo(&panel->m_ClipBox, DC, x1 , y1 + MapY1 * IEEE_SYMBOL_PIN_DIM*2, color); - } - } - - /* Draw the pin end target (active end of the pin) */ - if ( ! g_IsPrinting ) // Draw but do not print the pin end target */ - GRCircle(&panel->m_ClipBox, DC, posX,posY,TARGET_PIN_DIAM, color); -} - - -/***************************************************************************** -* Routine to rotate the given angular direction by the given Transformation. * -* Input (and output) angles must be as follows: * -* Unit is 0.1 degre * -* Angle1 in [0..3600], Angle2 > Angle1 in [0..7200]. Arc is assumed to be less * -* than 180.0 degrees. * -* Algorithm: * -* Map the angles to a point on the unit circle which is mapped using the * -* transform (only mirror and rotate so it remains on the unit circle) to * -* a new point which is used to detect new angle. * -*****************************************************************************/ -bool MapAngles(int *Angle1, int *Angle2, int TransMat[2][2]) -{ -int Angle, Delta; -double x, y, t; -bool swap = FALSE; - - Delta = *Angle2 - *Angle1; - if ( Delta >= 1800 ) - { - *Angle1 -=1; - *Angle2 +=1; - } - - x = cos(*Angle1 * M_PI / 1800.0); - y = sin(*Angle1 * M_PI / 1800.0); - t = x * TransMat[0][0] + y * TransMat[0][1]; - y = x * TransMat[1][0] + y * TransMat[1][1]; - x = t; - *Angle1 = (int) (atan2(y, x) * 1800.0 / M_PI + 0.5); - - x = cos(*Angle2 * M_PI / 1800.0); - y = sin(*Angle2 * M_PI / 1800.0); - t = x * TransMat[0][0] + y * TransMat[0][1]; - y = x * TransMat[1][0] + y * TransMat[1][1]; - x = t; - *Angle2 = (int) (atan2(y, x) * 1800.0 / M_PI + 0.5); - - NORMALIZE_ANGLE(*Angle1); - NORMALIZE_ANGLE(*Angle2); - if (*Angle2 < *Angle1) *Angle2 += 3600; - - if (*Angle2 - *Angle1 > 1800) - { /* Need to swap the two angles. */ - Angle = (*Angle1); - *Angle1 = (*Angle2); - *Angle2 = Angle; - - NORMALIZE_ANGLE(*Angle1); - NORMALIZE_ANGLE(*Angle2); - if (*Angle2 < *Angle1) *Angle2 += 3600; - swap = TRUE; - } - - if ( Delta >= 1800 ) - { - *Angle1 +=1; - *Angle2 -=1; - } - - return swap; -} - - -/***************************************************************************** -* Routine to display an outline version of given library entry. * -* This routine is applied by the PlaceLibItem routine above. * -*****************************************************************************/ -void DrawingLibInGhost(WinEDA_DrawPanel * panel, wxDC * DC, - EDA_LibComponentStruct *LibEntry, - EDA_SchComponentStruct *DrawLibItem, int PartX, int PartY, - int multi, int convert, int Color, bool DrawPinText) -{ -int DrawMode = g_XorMode; - - DrawLibPartAux(panel, DC, DrawLibItem, LibEntry, wxPoint(PartX, PartY), - DrawLibItem->m_Transform, - multi, convert, DrawMode, Color, DrawPinText); - -} - -/************************************************************/ -/* Routine to draw One LibraryDrawStruct at given position, */ -/* matrice de transformation 1 0 0 -1 (normale) */ -/* DrawMode = GrXOR, GrOR .. */ -/************************************************************/ -/* Utilise en LibEdit et Lib Browse */ -void DrawLibraryDrawStruct(WinEDA_DrawPanel * panel, wxDC * DC, - EDA_LibComponentStruct *LibEntry, - int PartX, int PartY, - LibEDA_BaseStruct *DrawItem, int Multi, - int DrawMode, int Color) -{ -int i, x1, y1, x2, y2, t1, t2, orient; -int CharColor; -int TransMat[2][2]; -int fill_option; - -#undef GETCOLOR -#define GETCOLOR(l) Color < 0 ? ReturnLayerColor(l) : Color; - - Multi = 0; /* unused */ - /* Trace de la structure */ - CharColor = GETCOLOR(LAYER_DEVICE); - GRSetDrawMode(DC, DrawMode); - - TransMat[0][0] = 1; - TransMat[0][1] = TransMat[1][0] = 0; - TransMat[1][1] = -1; - - switch (DrawItem->m_StructType) - { - case COMPONENT_ARC_DRAW_TYPE: - { - int xc,yc, x2,y2; - LibDrawArc * Arc = (LibDrawArc *) DrawItem; - t1 = Arc->t1; t2 = Arc->t2; - bool swap = MapAngles(&t1, &t2, TransMat); - xc = PartX + Arc->m_Pos.x; - yc = PartY - Arc->m_Pos.y; - x2 = PartX + Arc->m_Start.x; - y2 = PartY - Arc->m_Start.y; - x1 = PartX + Arc->m_End.x; - y1 = PartY - Arc->m_End.y; - - if ( swap ) { EXCHG(x1,x2); EXCHG(y1, y2)} - fill_option = Arc->m_Fill & (~g_PrintFillMask); - if ( (Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR) && ! g_IsPrinting ) - GRFilledArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, - Arc->m_Rayon, CharColor, - ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); - else if ( Arc->m_Fill == FILLED_SHAPE) - GRFilledArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, - Arc->m_Rayon, CharColor, CharColor); -#ifdef DRAW_ARC_WITH_ANGLE - else GRArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, - Arc->m_Rayon, CharColor); -#else - else GRArc1(&panel->m_ClipBox, DC, x1, y1, x2, y2, - xc, yc, CharColor); -#endif - } - break; - - case COMPONENT_CIRCLE_DRAW_TYPE: - { - LibDrawCircle * Circle = (LibDrawCircle *) DrawItem; - x1 = PartX + Circle->m_Pos.x; - y1 = PartY - Circle->m_Pos.y; - fill_option = Circle->m_Fill & (~g_PrintFillMask); - if ( (fill_option == FILLED_WITH_BG_BODYCOLOR) && ! g_IsPrinting ) - GRFilledCircle(&panel->m_ClipBox, DC, x1, y1, - Circle->m_Rayon, CharColor, - ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); - else if ( fill_option == FILLED_SHAPE) - GRFilledCircle(&panel->m_ClipBox, DC, x1, y1, - Circle->m_Rayon, CharColor, CharColor); - else GRCircle(&panel->m_ClipBox, DC, x1, y1, - Circle->m_Rayon, CharColor); - } - break; - - case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: - { - LibDrawText * Text = (LibDrawText *) DrawItem; - x1 = PartX + Text->m_Pos.x; - y1 = PartY - Text->m_Pos.y; - PutTextInfo(panel, DC, Text->m_Horiz, wxPoint(x1, y1), - Text->m_Size, Text->m_Text, - DrawMode,CharColor); - } - break; - - case COMPONENT_RECT_DRAW_TYPE: - { - LibDrawSquare * Square = (LibDrawSquare *) DrawItem; - x1 = PartX + Square->m_Start.x; - y1 = PartY - Square->m_Start.y; - x2 = PartX + Square->m_End.x; - y2 = PartY - Square->m_End.y; - fill_option = Square->m_Fill & (~g_PrintFillMask); - if ( (fill_option == FILLED_WITH_BG_BODYCOLOR) && ! g_IsPrinting ) - GRFilledRect(&panel->m_ClipBox, DC, x1, y1, x2, y2, - CharColor, - ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); - else if ( fill_option == FILLED_SHAPE) - GRFilledRect(&panel->m_ClipBox, DC, x1, y1, x2, y2, - CharColor, CharColor); - else GRRect(&panel->m_ClipBox, DC, x1, y1, x2, y2, - CharColor); - } - break; - - case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */ - { - LibDrawPin * Pin = (LibDrawPin *) DrawItem; - x2 = PartX + Pin->m_Pos.x; - y2 = PartY - Pin->m_Pos.y; - /* Compute the real pin orientation, i.e. pin orient + component orient */ - orient = Pin->ReturnPinDrawOrient(TransMat); - - /* Dessin de la pin et du symbole special associe */ - if( Pin->m_Attributs & PINNOTDRAW) CharColor = DARKGRAY; - else CharColor = -1; - - DrawPinSymbol(panel, DC, x2, y2, Pin->m_PinLen, orient, - Pin->m_PinShape, DrawMode); - wxPoint pinpos(x2,y2); - Pin->DrawPinTexts(panel, DC, pinpos, orient, - LibEntry->m_TextInside, - LibEntry->m_DrawPinNum,LibEntry->m_DrawPinName, - CharColor, DrawMode); - } - break; - - case COMPONENT_POLYLINE_DRAW_TYPE: - { - LibDrawPolyline * polyline = (LibDrawPolyline *) DrawItem; - if ( Buf_Poly_Drawings == NULL ) - { - Buf_Poly_Size = polyline->n; - Buf_Poly_Drawings = (int *) MyMalloc(sizeof(int) * 2 * Buf_Poly_Size); - } - else if ( Buf_Poly_Size < polyline->n ) - { - Buf_Poly_Size = polyline->n; - Buf_Poly_Drawings = (int *) realloc(Buf_Poly_Drawings, - sizeof(int) * 2 * Buf_Poly_Size); - } - for (i = 0; i < polyline->n; i++) - { - Buf_Poly_Drawings[i * 2] = PartX + polyline->PolyList[i * 2]; - Buf_Poly_Drawings[i * 2 + 1] = PartY - polyline->PolyList[i * 2 + 1]; - } - fill_option = polyline->m_Fill & (~g_PrintFillMask); - if ( (fill_option == FILLED_WITH_BG_BODYCOLOR) && ! g_IsPrinting ) - GRPoly(&panel->m_ClipBox, DC, polyline->n, - Buf_Poly_Drawings, 1, CharColor, - ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); - else if ( fill_option == FILLED_SHAPE) - GRPoly(&panel->m_ClipBox, DC, polyline->n, - Buf_Poly_Drawings, 1, CharColor, CharColor); - else GRPoly(&panel->m_ClipBox, DC, polyline->n, - Buf_Poly_Drawings, 0, CharColor, CharColor); - break; - } - } -} - diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index 2ecde4e447..88a75156da 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -161,8 +161,7 @@ void InstallErcFrame(WinEDA_SchematicFrame *parent, wxPoint & pos) /*********************************************/ void WinEDA_ErcFrame::ReBuildMatrixPanel(void) /*********************************************/ -/* construit ou reconstruit le panel d'affichage de la matrice de -controle ERC +/* Build or rebuild the panel showing the ERC matrix */ { int ii, jj, event_id, text_height; @@ -666,10 +665,9 @@ int ref_elect_type, jj, erc = OK, local_minconn; /********************************************************/ static bool WriteDiagnosticERC(const wxString & FullFileName) /*********************************************************/ -/* Genere le fichier des diagnostics +/* Create the Diagnostic file (.erc file) */ { -SCH_SCREEN * Window; EDA_BaseStruct * DrawStruct; DrawMarkerStruct * Marker; char Line[256]; @@ -683,22 +681,22 @@ wxString msg; msg = _("ERC control"); fprintf( OutErc, "%s (%s)\n", CONV_TO_UTF8(msg), Line); - for( Window = ScreenSch; Window != NULL; Window = (SCH_SCREEN*)Window->Pnext ) - { - Sheet = (DrawSheetStruct *) Window->m_Parent; - + EDA_ScreenList ScreenList(NULL); + for ( SCH_SCREEN * Screen = ScreenList.GetFirst(); Screen != NULL; Screen = ScreenList.GetNext() ) + { + Sheet = (DrawSheetStruct*) Screen; msg.Printf( _("\n***** Sheet %d (%s)\n"), - Window->m_SheetNumber, - Sheet ? Sheet->m_SheetName.GetData() : _("Root")); + Sheet->m_SheetNumber, + Screen == ScreenSch ? _("Root") : Sheet->m_SheetName.GetData()); fprintf( OutErc, "%s", CONV_TO_UTF8(msg)); - DrawStruct = Window->EEDrawList; + DrawStruct = Screen->EEDrawList; for ( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext) - { + { if(DrawStruct->m_StructType != DRAW_MARKER_STRUCT_TYPE ) continue; - /* Marqueur trouve */ + /* Marqueur trouve */ Marker = (DrawMarkerStruct * ) DrawStruct; if( Marker->m_Type != MARQ_ERC ) continue; /* Write diag marqueur */ @@ -707,8 +705,8 @@ wxString msg; (float)Marker->m_Pos.x / 1000, (float)Marker->m_Pos.y / 1000); fprintf( OutErc, "%s", CONV_TO_UTF8(msg)); - } } + } msg.Printf( _("\n >> Errors ERC: %d\n"), g_EESchemaVar.NbErrorErc); fprintf( OutErc, "%s", CONV_TO_UTF8(msg)); fclose ( OutErc ); diff --git a/eeschema/netlist_control.cpp b/eeschema/netlist_control.cpp index 85944d8c9c..851b8b6df0 100644 --- a/eeschema/netlist_control.cpp +++ b/eeschema/netlist_control.cpp @@ -174,7 +174,7 @@ void InstallNetlistFrame(WinEDA_SchematicFrame *parent, wxPoint & pos) } #define H_SIZE 370 -#define V_SIZE 260 +#define V_SIZE 300 /*************************************************************************************/ WinEDA_NetlistFrame::WinEDA_NetlistFrame(WinEDA_SchematicFrame *parent, wxPoint& framepos): diff --git a/eeschema/plothpgl.cpp b/eeschema/plothpgl.cpp index df13d986e2..f84237b81d 100644 --- a/eeschema/plothpgl.cpp +++ b/eeschema/plothpgl.cpp @@ -528,8 +528,10 @@ int margin; PlotFileName = MakeFileName(dirbuf, ShortFileName, wxT(".plt")); else PlotFileName = MakeFileName(dirbuf, g_DefaultSchematicFileName, wxT(".plt")); + setlocale(LC_NUMERIC, "C"); InitPlotParametresHPGL(PlotOffset, g_PlotScaleX, g_PlotScaleY); Plot_1_Page_HPGL(PlotFileName,screen); + setlocale(LC_NUMERIC, ""); screen = (BASE_SCREEN*)screen->Pnext; if ( Select_PlotAll == FALSE ) break; } diff --git a/eeschema/plotps.cpp b/eeschema/plotps.cpp index 4ca152d8a2..95ae47885f 100644 --- a/eeschema/plotps.cpp +++ b/eeschema/plotps.cpp @@ -391,6 +391,7 @@ wxPoint StartPos, EndPos; return ; } + setlocale(LC_NUMERIC, "C"); Line.Printf(_("Plot: %s\n"), FileName.GetData()) ; m_MsgBox->AppendText(Line); @@ -507,6 +508,7 @@ wxPoint StartPos, EndPos; /* fin */ CloseFilePS(PlotOutput); + setlocale(LC_NUMERIC, ""); m_MsgBox->AppendText( wxT("Ok\n")); } diff --git a/eeschema/tool_lib.cpp b/eeschema/tool_lib.cpp index ce5db1dcd5..001ba070ce 100644 --- a/eeschema/tool_lib.cpp +++ b/eeschema/tool_lib.cpp @@ -233,12 +233,14 @@ int ii; /* Update the part selection box */ int jj = 1; if( CurrentLibEntry ) jj = CurrentLibEntry->m_UnitCount; - for ( ii = 0; ii < jj ; ii ++ ) - { - wxString msg; - msg.Printf(_("Part %c"), 'A' + ii); - m_SelpartBox->Append(msg); - } + if ( jj > 1 ) + for ( ii = 0; ii < jj ; ii ++ ) + { + wxString msg; + msg.Printf(_("Part %c"), 'A' + ii); + m_SelpartBox->Append(msg); + } + else m_SelpartBox->Append( wxEmptyString ); m_SelpartBox->SetSelection( ( CurrentUnit > 0 ) ? CurrentUnit-1 : 0); if( CurrentLibEntry) diff --git a/eeschema/xx.cpp b/eeschema/xx.cpp deleted file mode 100644 index b3bfcf0114..0000000000 --- a/eeschema/xx.cpp +++ /dev/null @@ -1,139 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: xx.cpp -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 02/03/2006 09:16:35 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 02/03/2006 09:16:35 - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "xx.h" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -////@begin includes -////@end includes - -#include "xx.h" - -////@begin XPM images - -////@end XPM images - -/*! - * xx type definition - */ - -IMPLEMENT_DYNAMIC_CLASS( xx, wxDialog ) - -/*! - * xx event table definition - */ - -BEGIN_EVENT_TABLE( xx, wxDialog ) - -////@begin xx event table entries -////@end xx event table entries - -END_EVENT_TABLE() - -/*! - * xx constructors - */ - -xx::xx( ) -{ -} - -xx::xx( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ - Create(parent, id, caption, pos, size, style); -} - -/*! - * xx creator - */ - -bool xx::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ -////@begin xx member initialisation -////@end xx member initialisation - -////@begin xx creation - SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); - wxDialog::Create( parent, id, caption, pos, size, style ); - - CreateControls(); - GetSizer()->Fit(this); - GetSizer()->SetSizeHints(this); - Centre(); -////@end xx creation - return true; -} - -/*! - * Control creation for xx - */ - -void xx::CreateControls() -{ -////@begin xx content construction - // Generated by DialogBlocks, 02/03/2006 09:16:35 (unregistered) - - xx* itemDialog1 = this; - - wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); - itemDialog1->SetSizer(itemBoxSizer2); - -////@end xx content construction -} - -/*! - * Should we show tooltips? - */ - -bool xx::ShowToolTips() -{ - return true; -} - -/*! - * Get bitmap resources - */ - -wxBitmap xx::GetBitmapResource( const wxString& name ) -{ - // Bitmap retrieval -////@begin xx bitmap retrieval - wxUnusedVar(name); - return wxNullBitmap; -////@end xx bitmap retrieval -} - -/*! - * Get icon resources - */ - -wxIcon xx::GetIconResource( const wxString& name ) -{ - // Icon retrieval -////@begin xx icon retrieval - wxUnusedVar(name); - return wxNullIcon; -////@end xx icon retrieval -} diff --git a/eeschema/xx.h b/eeschema/xx.h deleted file mode 100644 index c0afb85f90..0000000000 --- a/eeschema/xx.h +++ /dev/null @@ -1,95 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: xx.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 02/03/2006 09:16:35 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 02/03/2006 09:16:35 - -#ifndef _XX_H_ -#define _XX_H_ - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "xx.h" -#endif - -/*! - * Includes - */ - -////@begin includes -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define ID_DIALOG 10015 -#define SYMBOL_XX_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX -#define SYMBOL_XX_TITLE _("xx") -#define SYMBOL_XX_IDNAME ID_DIALOG -#define SYMBOL_XX_SIZE wxSize(400, 300) -#define SYMBOL_XX_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * Compatibility - */ - -#ifndef wxCLOSE_BOX -#define wxCLOSE_BOX 0x1000 -#endif - -/*! - * xx class declaration - */ - -class xx: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( xx ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - xx( ); - xx( wxWindow* parent, wxWindowID id = SYMBOL_XX_IDNAME, const wxString& caption = SYMBOL_XX_TITLE, const wxPoint& pos = SYMBOL_XX_POSITION, const wxSize& size = SYMBOL_XX_SIZE, long style = SYMBOL_XX_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_XX_IDNAME, const wxString& caption = SYMBOL_XX_TITLE, const wxPoint& pos = SYMBOL_XX_POSITION, const wxSize& size = SYMBOL_XX_SIZE, long style = SYMBOL_XX_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin xx event handler declarations -////@end xx event handler declarations - -////@begin xx member function declarations - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end xx member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - -////@begin xx member variables -////@end xx member variables -}; - -#endif - // _XX_H_ diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index ce930a1319..438007115e 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -69,7 +69,6 @@ char text[1024]; fprintf(File,"$SETUP\n"); sprintf(text, "InternalUnit %f INCH\n", 1.0/PCB_INTERNAL_UNIT); - to_point(text); fprintf(File, text); Pcb->m_BoardSettings->m_CopperLayerCount = g_DesignSettings.m_CopperLayerCount; diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index c4b44241b1..c2091ad11b 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -109,7 +109,6 @@ bool WinEDA_GerberFrame::Read_GERBER_File(wxDC * DC, /* Lecture de 1 fichier gerber. Format Imperial - 2.3 Absolu fin de bloc = * CrLf apres chaque commande @@ -148,6 +147,7 @@ int error = 0; wxSetWorkingDirectory(wxPathOnly(GERBER_FullFileName)); wxBusyCursor show_wait; + setlocale(LC_NUMERIC, "C"); while( TRUE ) { @@ -237,6 +237,8 @@ wxBusyCursor show_wait; } fclose(gerber_layer->m_Current_File) ; + setlocale(LC_NUMERIC, ""); + /* Init tableau des DCodes et Lecture fichier DCODES */ if ( !gerber_layer->m_As_DCode ) { @@ -266,7 +268,6 @@ wxBusyCursor show_wait; } } - return TRUE; } diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index aca620768b..a02d3616bc 100644 --- a/gerbview/rs274x.cpp +++ b/gerbview/rs274x.cpp @@ -101,17 +101,14 @@ char buf[256], * ptchar; ptchar = buf; while ( text && *text == ' ' ) text++; // Skip blanks before number while ( text && *text) - { + { if ( IsNumber(*text) ) - { + { * ptchar = * text; - - if ( * ptchar =='.' || *ptchar == ',' ) * ptchar = g_FloatSeparator; - text++; ptchar ++; - } - else break; } + else break; + } *ptchar = 0; nb = atof(buf); diff --git a/include/build_version.h b/include/build_version.h index e4b2481d61..c79138d562 100644 --- a/include/build_version.h +++ b/include/build_version.h @@ -5,7 +5,7 @@ COMMON_GLOBL wxString g_BuildVersion #ifdef EDA_BASE - (wxT("(2007-05-25)")) + (wxT("(2007-06-12)")) #endif ; diff --git a/include/common.h b/include/common.h index a34e837d3b..6ad95c9fcb 100644 --- a/include/common.h +++ b/include/common.h @@ -273,7 +273,6 @@ COMMON_GLOBL wxString g_UserLibDirBuffer; // Chemin des librairies de module don /* variables globales generales */ -COMMON_GLOBL int g_FloatSeparator; // = '.' ou = ',' selon locale pour l'ecriture des nombres flotttant COMMON_GLOBL int g_DebugLevel; // 0= Pas de debug */ COMMON_GLOBL int g_MouseOldButtons; COMMON_GLOBL int g_KeyPressed; @@ -352,7 +351,7 @@ class WinEDA_DrawPanel; /* COMMON.CPP */ -wxString ReturnPcbLayerName(int layer_number, bool is_filename = FALSE); +wxString ReturnPcbLayerName(int layer_number, bool is_filename = FALSE, bool is_gui = FALSE); /* Return the name of the layer number "layer_number". if "is_filename" == TRUE, the name can be used for a file name (not internatinalized, no space)*/ diff --git a/include/id.h b/include/id.h index b3a78d65eb..0bc9401897 100644 --- a/include/id.h +++ b/include/id.h @@ -698,7 +698,7 @@ enum main_id { ID_AUX_TOOLBAR_PCB_VIA_SIZE, ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, - ID_AUX_TOOLBAR_PCB_UNUSED1, + ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, ID_AUX_TOOLBAR_PCB_UNUSED2, ID_AUX_TOOLBAR_PCB_UNUSED3, ID_AUX_TOOLBAR_PCB_UNUSED4, diff --git a/include/wxstruct.h b/include/wxstruct.h index c7dd8bdcc6..074eb4c34e 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -479,6 +479,7 @@ public: // Gestion des layers: int SelectLayer(int default_layer, int min_layer, int max_layer); void SelectLayerPair(void); + void SwitchLayer(wxDC *DC, int layer); // divers void AddHistory(int value, DrawStructureType type); // Add value in data list history @@ -528,6 +529,7 @@ public: void ReCreateOptToolbar(void); void ReCreateMenuBar(void); WinEDAChoiceBox * ReCreateLayerBox( WinEDA_Toolbar * parent); + void PrepareLayerIndicator(void); void OnLeftClick(wxDC * DC, const wxPoint& MousePos); void OnLeftDClick(wxDC * DC, const wxPoint& MousePos); void OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu); @@ -627,6 +629,7 @@ public: void Start_MoveOneNodeOrSegment(TRACK * track, wxDC * DC, int command); bool PlaceDraggedTrackSegment(TRACK * Track, wxDC * DC); void Start_DragTrackSegmentAndKeepSlope(TRACK * track, wxDC * DC); + void SwitchLayer(wxDC *DC, int layer); // Edition des zones EDGE_ZONE * Del_SegmEdgeZone(wxDC * DC, EDGE_ZONE * edge_zone); diff --git a/pcbnew/cleaningoptions_dialog.cpp b/pcbnew/cleaningoptions_dialog.cpp new file mode 100644 index 0000000000..1f6c26eccb --- /dev/null +++ b/pcbnew/cleaningoptions_dialog.cpp @@ -0,0 +1,255 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: cleaningoptions_dialog.cpp +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 25/05/2007 14:24:54 +// RCS-ID: +// Copyright: GNU License +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 25/05/2007 14:24:54 + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "cleaningoptions_dialog.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +////@begin includes +////@end includes + +#include "cleaningoptions_dialog.h" + +////@begin XPM images +////@end XPM images + + +/*! + * WinEDA_CleaningOptionsFrame type definition + */ + +IMPLEMENT_DYNAMIC_CLASS( WinEDA_CleaningOptionsFrame, wxDialog ) + + +/*! + * WinEDA_CleaningOptionsFrame event table definition + */ + +BEGIN_EVENT_TABLE( WinEDA_CleaningOptionsFrame, wxDialog ) + +////@begin WinEDA_CleaningOptionsFrame event table entries + EVT_CLOSE( WinEDA_CleaningOptionsFrame::OnCloseWindow ) + + EVT_BUTTON( ID_BUTTON_EXECUTE, WinEDA_CleaningOptionsFrame::OnButtonExecuteClick ) + +////@end WinEDA_CleaningOptionsFrame event table entries + +END_EVENT_TABLE() + + +/*! + * WinEDA_CleaningOptionsFrame constructors + */ + +WinEDA_CleaningOptionsFrame::WinEDA_CleaningOptionsFrame() +{ + Init(); +} + +WinEDA_CleaningOptionsFrame::WinEDA_CleaningOptionsFrame( WinEDA_PcbFrame* parent, wxDC * DC, wxWindowID id, + const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ + Init(); + m_Parent = parent; + m_DC = DC; + Create(parent, id, caption, pos, size, style); +} + + +/*! + * WinEDA_CleaningOptionsFrame creator + */ + +bool WinEDA_CleaningOptionsFrame::Create( wxWindow * parent, wxWindowID id, + const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ +////@begin WinEDA_CleaningOptionsFrame creation + SetExtraStyle(wxWS_EX_BLOCK_EVENTS); + wxDialog::Create( parent, id, caption, pos, size, style ); + + CreateControls(); + if (GetSizer()) + { + GetSizer()->SetSizeHints(this); + } + Centre(); +////@end WinEDA_CleaningOptionsFrame creation + return true; +} + + +/*! + * WinEDA_CleaningOptionsFrame destructor + */ + +WinEDA_CleaningOptionsFrame::~WinEDA_CleaningOptionsFrame() +{ +////@begin WinEDA_CleaningOptionsFrame destruction +////@end WinEDA_CleaningOptionsFrame destruction +} + + +/*! + * Member initialisation + */ + +void WinEDA_CleaningOptionsFrame::Init() +{ + m_Parent = NULL; +////@begin WinEDA_CleaningOptionsFrame member initialisation + m_CleanViasOpt = NULL; + m_MergetSegmOpt = NULL; + m_DeleteunconnectedOpt = NULL; + m_ConnectToPadsOpt = NULL; +////@end WinEDA_CleaningOptionsFrame member initialisation +} + + +/*! + * Control creation for WinEDA_CleaningOptionsFrame + */ + +void WinEDA_CleaningOptionsFrame::CreateControls() +{ +////@begin WinEDA_CleaningOptionsFrame content construction + // Generated by DialogBlocks, 28/05/2007 19:08:46 (unregistered) + + WinEDA_CleaningOptionsFrame* itemDialog1 = this; + + wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); + itemDialog1->SetSizer(itemBoxSizer2); + + wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); + itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Static")); + wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL); + itemBoxSizer3->Add(itemStaticBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_CleanViasOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX_CLEAN_VIAS, _("Delete redundant vias"), wxDefaultPosition, wxDefaultSize, 0 ); + m_CleanViasOpt->SetValue(false); + itemStaticBoxSizer4->Add(m_CleanViasOpt, 0, wxALIGN_LEFT|wxALL, 5); + + m_MergetSegmOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX_MERGE_SEGMENTS, _("Merge segments"), wxDefaultPosition, wxDefaultSize, 0 ); + m_MergetSegmOpt->SetValue(false); + itemStaticBoxSizer4->Add(m_MergetSegmOpt, 0, wxALIGN_LEFT|wxALL, 5); + + m_DeleteunconnectedOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Delete unconnected tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DeleteunconnectedOpt->SetValue(false); + itemStaticBoxSizer4->Add(m_DeleteunconnectedOpt, 0, wxALIGN_LEFT|wxALL, 5); + + m_ConnectToPadsOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Connect stubs to Pads"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ConnectToPadsOpt->SetValue(false); + itemStaticBoxSizer4->Add(m_ConnectToPadsOpt, 0, wxALIGN_LEFT|wxALL, 5); + + wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer3->Add(itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxButton* itemButton10 = new wxButton( itemDialog1, ID_BUTTON_EXECUTE, _("Clean pcb"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton10->SetDefault(); + itemBoxSizer9->Add(itemButton10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + // Set validators + m_CleanViasOpt->SetValidator( wxGenericValidator(& s_CleanVias) ); + m_MergetSegmOpt->SetValidator( wxGenericValidator(& s_MergeSegments) ); + m_DeleteunconnectedOpt->SetValidator( wxGenericValidator(& s_DeleteUnconnectedSegm) ); +////@end WinEDA_CleaningOptionsFrame content construction +} + + +/*! + * Should we show tooltips? + */ + +bool WinEDA_CleaningOptionsFrame::ShowToolTips() +{ + return true; +} + +/*! + * Get bitmap resources + */ + +wxBitmap WinEDA_CleaningOptionsFrame::GetBitmapResource( const wxString& name ) +{ + // Bitmap retrieval +////@begin WinEDA_CleaningOptionsFrame bitmap retrieval + wxUnusedVar(name); + return wxNullBitmap; +////@end WinEDA_CleaningOptionsFrame bitmap retrieval +} + +/*! + * Get icon resources + */ + +wxIcon WinEDA_CleaningOptionsFrame::GetIconResource( const wxString& name ) +{ + // Icon retrieval +////@begin WinEDA_CleaningOptionsFrame icon retrieval + wxUnusedVar(name); + return wxNullIcon; +////@end WinEDA_CleaningOptionsFrame icon retrieval +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_EXECUTE + */ + +void WinEDA_CleaningOptionsFrame::OnButtonExecuteClick( wxCommandEvent& event ) +{ + s_CleanVias = m_CleanViasOpt->GetValue(); + s_MergeSegments = m_MergetSegmOpt->GetValue(); + s_DeleteUnconnectedSegm = m_DeleteunconnectedOpt->GetValue(); + s_ConnectToPads = m_ConnectToPadsOpt->GetValue(); + + Clean_Pcb_Items(m_Parent, m_DC ); + + Close(TRUE); +} + + + + + + + + + + +/*! + * wxEVT_CLOSE_WINDOW event handler for ID_WIN_EDA_CLEANINGOPTIONSFRAME + */ + +void WinEDA_CleaningOptionsFrame::OnCloseWindow( wxCloseEvent& event ) +{ + s_CleanVias = m_CleanViasOpt->GetValue(); + s_MergeSegments = m_MergetSegmOpt->GetValue(); + s_DeleteUnconnectedSegm = m_DeleteunconnectedOpt->GetValue(); + s_ConnectToPads = m_ConnectToPadsOpt->GetValue(); + + event.Skip(); +} + diff --git a/pcbnew/cleaningoptions_dialog.h b/pcbnew/cleaningoptions_dialog.h new file mode 100644 index 0000000000..23478ecb87 --- /dev/null +++ b/pcbnew/cleaningoptions_dialog.h @@ -0,0 +1,115 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: cleaningoptions_dialog.h +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 25/05/2007 14:24:54 +// RCS-ID: +// Copyright: GNU License +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 25/05/2007 14:24:54 + +#ifndef _CLEANINGOPTIONS_DIALOG_H_ +#define _CLEANINGOPTIONS_DIALOG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "cleaningoptions_dialog.h" +#endif + +/*! + * Includes + */ + +////@begin includes +#include "wx/valgen.h" +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define ID_WIN_EDA_CLEANINGOPTIONSFRAME 10000 +#define ID_CHECKBOX_CLEAN_VIAS 10001 +#define ID_CHECKBOX_MERGE_SEGMENTS 10003 +#define ID_CHECKBOX1 10005 +#define ID_CHECKBOX 10004 +#define ID_BUTTON_EXECUTE 10006 +#define SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX +#define SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_TITLE _("Cleaning options") +#define SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_IDNAME ID_WIN_EDA_CLEANINGOPTIONSFRAME +#define SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_SIZE wxSize(400, 300) +#define SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_POSITION wxDefaultPosition +////@end control identifiers + + +/*! + * WinEDA_CleaningOptionsFrame class declaration + */ + +class WinEDA_CleaningOptionsFrame: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( WinEDA_CleaningOptionsFrame ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + WinEDA_CleaningOptionsFrame(); + WinEDA_CleaningOptionsFrame( WinEDA_PcbFrame * parent, wxDC * DC, + wxWindowID id = SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_SIZE, long style = SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_SIZE, long style = SYMBOL_WINEDA_CLEANINGOPTIONSFRAME_STYLE ); + + /// Destructor + ~WinEDA_CleaningOptionsFrame(); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + +////@begin WinEDA_CleaningOptionsFrame event handler declarations + + /// wxEVT_CLOSE_WINDOW event handler for ID_WIN_EDA_CLEANINGOPTIONSFRAME + void OnCloseWindow( wxCloseEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_EXECUTE + void OnButtonExecuteClick( wxCommandEvent& event ); + +////@end WinEDA_CleaningOptionsFrame event handler declarations + +////@begin WinEDA_CleaningOptionsFrame member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end WinEDA_CleaningOptionsFrame member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin WinEDA_CleaningOptionsFrame member variables + wxCheckBox* m_CleanViasOpt; + wxCheckBox* m_MergetSegmOpt; + wxCheckBox* m_DeleteunconnectedOpt; + wxCheckBox* m_ConnectToPadsOpt; +////@end WinEDA_CleaningOptionsFrame member variables + WinEDA_PcbFrame * m_Parent; + wxDC * m_DC; +}; + +#endif + // _CLEANINGOPTIONS_DIALOG_H_ diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index 371bdae6b8..dcd78be830 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -134,7 +134,13 @@ int CurrentTime = time(NULL); { wxString tmpFileName = GetScreen()->m_FileName; wxString filename = g_SaveFileName + PcbExtBuffer; + bool flgmodify = GetScreen()->IsModify(); ((WinEDA_PcbFrame*)this)->SavePcbFile(filename); + if( flgmodify ) // Set the flags m_Modify cleared by SavePcbFile() + { + GetScreen()->SetModify(); + GetScreen()->SetSave();// Set the flags m_FlagSave cleared by SetModify() + } GetScreen()->m_FileName = tmpFileName; SetTitle(GetScreen()->m_FileName); } @@ -355,19 +361,19 @@ int CurrentTime = time(NULL); OnHotKey(DC, hotkey, NULL); } } + /****************************************************************/ void WinEDA_BasePcbFrame::SwitchLayer(wxDC *DC, int layer) /*****************************************************************/ { - //overridden in WinEDA_PcbFrame; + //Note: overridden in WinEDA_PcbFrame; int preslayer = GetScreen()->m_Active_Layer; //if there is only one layer, don't switch. if ( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1) - return; - //otherwise, must be at least 2 layers..see if it is possible. - if(layer != LAYER_CUIVRE_N || layer != LAYER_CMP_N || - layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount-1) - return; + layer = LAYER_CUIVRE_N; // Of course we select the copper layer + //otherwise, we select the requested layer only if it is possible + if( layer != LAYER_CMP_N && layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount-1 ) + return; if(preslayer == layer) return; diff --git a/pcbnew/dialog_clean_pcb.pjd b/pcbnew/dialog_clean_pcb.pjd new file mode 100644 index 0000000000..49842c0d69 --- /dev/null +++ b/pcbnew/dialog_clean_pcb.pjd @@ -0,0 +1,703 @@ + + +
+ 0 + "" + "" + "" + "" + "" + 0 + 0 + 0 + 1 + 1 + 0 + "jean-pierre Charras" + "GNU License" + "" + 0 + 0 + "<All platforms>" + "2.8.3" + "///////////////////////////////////////////////////////////////////////////// +// Name: %HEADER-FILENAME% +// Purpose: +// Author: %AUTHOR% +// Modified by: +// Created: %DATE% +// RCS-ID: +// Copyright: %COPYRIGHT% +// Licence: +///////////////////////////////////////////////////////////////////////////// + +" + "///////////////////////////////////////////////////////////////////////////// +// Name: %SOURCE-FILENAME% +// Purpose: +// Author: %AUTHOR% +// Modified by: +// Created: %DATE% +// RCS-ID: +// Copyright: %COPYRIGHT% +// Licence: +///////////////////////////////////////////////////////////////////////////// + +" + "///////////////////////////////////////////////////////////////////////////// +// Name: %SYMBOLS-FILENAME% +// Purpose: Symbols file +// Author: %AUTHOR% +// Modified by: +// Created: %DATE% +// RCS-ID: +// Copyright: %COPYRIGHT% +// Licence: +///////////////////////////////////////////////////////////////////////////// + +" + "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "%HEADER-FILENAME%" +#endif + +" + "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "%HEADER-FILENAME%" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +" + " /// %BODY% +" + " +/*! + * %BODY% + */ + +" + "app_resources.h" + "app_resources.cpp" + "AppResources" + "app.h" + "app.cpp" + "Application" + 0 + "" + "<None>" + "iso-8859-1" + "utf-8" + "utf-8" + "" + 0 + 0 + 4 + " " + "" + 0 + 0 + 1 + 1 + 1 + 0 + 1 +
+ + + "" + "data-document" + "" + "" + 0 + 1 + 0 + 0 + + "Configurations" + "config-data-document" + "" + "" + 0 + 1 + 0 + 0 + "" + 1 + "" + "Debug" + "ANSI" + "Static" + "Modular" + "GUI" + "wxMSW" + "Dynamic" + "Yes" + "No" + "No" + "%WXVERSION%" + "%EXECUTABLE%" + "" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + "%AUTO%" + + + + + + + "Projects" + "root-document" + "" + "project" + 1 + 1 + 0 + 1 + + "Windows" + "html-document" + "" + "dialogsfolder" + 1 + 1 + 0 + 1 + + "Cleaning options" + "dialog-document" + "" + "dialog" + 0 + 1 + 0 + 0 + "25/5/2007" + "wbDialogProxy" + 10000 + 0 + "" + 0 + "" + 0 + "wxEVT_CLOSE_WINDOW|OnCloseWindow|NONE||" + "ID_WIN_EDA_CLEANINGOPTIONSFRAME" + 10000 + "WinEDA_CleaningOptionsFrame" + "wxDialog" + "wxDialog" + "cleaningoptions_dialog.cpp" + "cleaningoptions_dialog.h" + "" + "Cleaning options" + 1 + "" + 0 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + "" + 0 + 1 + -1 + -1 + 400 + 300 + 0 + "" + + "wxBoxSizer V" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "wbBoxSizerProxy" + "Vertical" + "" + 0 + 0 + 0 + "<Any platform>" + + "wxBoxSizer H" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "25/5/2007" + "wbBoxSizerProxy" + "Horizontal" + "" + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "<Any platform>" + + "wxStaticBoxSizer V" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "25/5/2007" + "wbStaticBoxSizerProxy" + "wxID_ANY" + -1 + "Static" + "" + "" + "" + "" + 0 + 1 + "wxStaticBox" + "Vertical" + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "<Any platform>" + + "wxCheckBox: ID_CHECKBOX_CLEAN_VIAS" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "25/5/2007" + "wbCheckBoxProxy" + "ID_CHECKBOX_CLEAN_VIAS" + 10001 + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "m_CleanViasOpt" + "Delete redundant vias" + 0 + "" + "" + "s_CleanVias" + "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Left" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxCheckBox: ID_CHECKBOX_MERGE_SEGMENTS" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "25/5/2007" + "wbCheckBoxProxy" + "ID_CHECKBOX_MERGE_SEGMENTS" + 10003 + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "m_MergetSegmOpt" + "Merge segments" + 0 + "" + "" + "s_MergeSegments" + "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Left" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxCheckBox: ID_CHECKBOX1" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "25/5/2007" + "wbCheckBoxProxy" + "ID_CHECKBOX1" + 10005 + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "m_DeleteunconnectedOpt" + "Delete unconnected tracks" + 0 + "" + "" + "s_DeleteUnconnectedSegm" + "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Left" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxCheckBox: ID_CHECKBOX" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "25/5/2007" + "wbCheckBoxProxy" + "ID_CHECKBOX" + 10004 + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "m_ConnectToPadsOpt" + "Connect to Pads" + 0 + "" + "" + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Left" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + + "wxBoxSizer V" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "25/5/2007" + "wbBoxSizerProxy" + "Vertical" + "" + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "<Any platform>" + + "wxButton: ID_BUTTON_EXECUTE" + "dialog-control-document" + "" + "dialogcontrol" + 0 + 1 + 0 + 0 + "25/5/2007" + "wbButtonProxy" + "wxEVT_COMMAND_BUTTON_CLICKED|OnButtonExecuteClick|NONE||" + "ID_BUTTON_EXECUTE" + 10006 + "wxButton" + "wxButton" + 1 + 0 + "" + "" + "" + "Clean pcb" + 1 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + + + + + + "Sources" + "html-document" + "" + "sourcesfolder" + 1 + 1 + 0 + 1 + + "dialog_clean_pcb.rc" + "source-editor-document" + "dialog_clean_pcb.rc" + "source-editor" + 0 + 0 + 1 + 0 + "25/5/2007" + "" + + + + "Images" + "html-document" + "" + "bitmapsfolder" + 1 + 1 + 0 + 1 + + + + +
diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 9729d0ed3f..4eac3a04da 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -869,6 +869,10 @@ int itmp; DrawPanel->MouseToCursorSchema(); break; + case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: + SelectLayerPair(); + break; + case ID_POPUP_PCB_SELECT_NO_CU_LAYER: itmp = SelectLayer(GetScreen()->m_Active_Layer, CMP_N+1, -1); if ( itmp >= 0 ) GetScreen()->m_Active_Layer = itmp; diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 55cc42b69a..36c941b7f3 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -17,7 +17,7 @@ static void Exit_Editrack(WinEDA_DrawPanel * panel, wxDC *DC); void ShowNewTrackWhenMovingCursor(WinEDA_DrawPanel * panel, wxDC * DC, bool erase); -static int Met_Coude_a_45(WinEDA_BasePcbFrame * frame, wxDC * DC, +static int Add_45_degrees_Segment(WinEDA_BasePcbFrame * frame, wxDC * DC, TRACK * ptfinsegment); static void ComputeBreakPoint( TRACK * track, int n ); static TRACK * DeleteNullTrackSegments(BOARD * pcb, TRACK * track, int * segmcount); @@ -188,7 +188,7 @@ wxPoint pos = GetScreen()->m_Curseur; if( g_Raccord_45_Auto ) { - if( Met_Coude_a_45(this, DC, g_CurrentTrackSegment) != 0 ) + if( Add_45_degrees_Segment(this, DC, g_CurrentTrackSegment) != 0 ) g_TrackSegmentCount++; } Track = g_CurrentTrackSegment->Copy(); @@ -221,7 +221,7 @@ wxPoint pos = GetScreen()->m_Curseur; /**************************************************************************/ -int Met_Coude_a_45(WinEDA_BasePcbFrame * frame, wxDC * DC, TRACK * pt_segm) +int Add_45_degrees_Segment(WinEDA_BasePcbFrame * frame, wxDC * DC, TRACK * pt_segm) /***************************************************************************/ /* rectifie un virage a 90 et le modifie par 2 coudes a 45 n'opere que sur des segments horizontaux ou verticaux. @@ -476,6 +476,15 @@ PCB_SCREEN * screen = (PCB_SCREEN *) panel->GetScreen(); /* dessin de la nouvelle piste : mise a jour du point d'arrivee */ g_CurrentTrackSegment->m_Layer = screen->m_Active_Layer; g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth; + if ( g_TwoSegmentTrackBuild ) + { + TRACK * previous_track = (TRACK *)g_CurrentTrackSegment->Pback; + if ( previous_track && (previous_track->m_StructType == TYPETRACK) ) + { + previous_track->m_Layer = screen->m_Active_Layer; + previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth; + } + } if (Track_45_Only) { diff --git a/pcbnew/locate.cpp b/pcbnew/locate.cpp index 6f241ceda7..44f5e04200 100644 --- a/pcbnew/locate.cpp +++ b/pcbnew/locate.cpp @@ -135,8 +135,11 @@ EDA_BaseStruct * item; } /* Search for a footprint text */ + // First search: locate texts for footprints on copper or component layer + // Priority to the active layer (component or copper. + // this is useful for small smd components when 2 texts overlap but are not on the same layer if ( (LayerSearch == LAYER_CUIVRE_N) || (LayerSearch == CMP_N )) - { // Search texts for footprints on copper or component layer only + { for (module = m_Pcb->m_Modules; module != NULL; module = (MODULE*)module->Pnext) { TEXTE_MODULE * pt_texte; @@ -149,17 +152,16 @@ EDA_BaseStruct * item; } } } - else // Search footprint texts on all layers + + // Now Search footprint texts on all layers + module = NULL; { - module = NULL; + TEXTE_MODULE * pt_texte; + pt_texte = LocateTexteModule(m_Pcb, &module, typeloc); + if( pt_texte != NULL ) { - TEXTE_MODULE * pt_texte; - pt_texte = LocateTexteModule(m_Pcb, &module, typeloc); - if( pt_texte != NULL ) - { - Affiche_Infos_E_Texte(this, module, pt_texte); - return pt_texte; - } + Affiche_Infos_E_Texte(this, module, pt_texte); + return pt_texte; } } @@ -170,6 +172,7 @@ EDA_BaseStruct * item; return module; } + /* Search for zones */ if( (TrackLocate = Locate_Zone((TRACK*)m_Pcb->m_Zone, GetScreen()->m_Active_Layer,typeloc)) != NULL ) { diff --git a/pcbnew/makefile.include b/pcbnew/makefile.include index c844e200da..7df3a2ef96 100644 --- a/pcbnew/makefile.include +++ b/pcbnew/makefile.include @@ -233,7 +233,7 @@ drc.o: drc.cpp dialog_drc.cpp dialog_drc.h autorout.h $(COMMON) block.o: block.cpp $(COMMON) -clean.o: clean.cpp $(COMMON) +clean.o: clean.cpp cleaningoptions_dialog.cpp cleaningoptions_dialog.h $(COMMON) pcbplot.o: pcbplot.cpp pcbplot.h $(COMMON) diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 607bc15623..6c6c58af08 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -869,9 +869,16 @@ wxPoint OldPos = m_Parent->m_CurrentScreen->m_Curseur; { if( (ii == 0) || ( ref->m_LibName != cmp->m_LibName) ) { /* Nouveau Module a charger */ - Module = m_Parent->Get_Librairie_Module(this, wxEmptyString, cmp->m_LibName, TRUE ); + Module = m_Parent->Get_Librairie_Module(this, wxEmptyString, cmp->m_LibName, FALSE ); ref = cmp; - if ( Module == NULL ) continue; + if ( Module == NULL ) + { + wxString msg; + msg.Printf(_("Component [%s]: footprint <%s> not found"), + cmp->m_CmpName.GetData(), cmp->m_LibName.GetData()); + DisplayError(this, msg); + continue; + } m_Parent->Place_Module(Module, DC); /* mise a jour des reperes ( nom et ref "Time Stamp") si module charge */ diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index b11a56a575..151f1ae414 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -109,6 +109,7 @@ BEGIN_EVENT_TABLE(WinEDA_PcbFrame, wxFrame) EVT_TOOL(ID_FIND_ITEMS, WinEDA_PcbFrame::Process_Special_Functions) EVT_TOOL(ID_GET_NETLIST, WinEDA_PcbFrame::Process_Special_Functions) EVT_TOOL(ID_DRC_CONTROL, WinEDA_PcbFrame::Process_Special_Functions) + EVT_TOOL(ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, WinEDA_PcbFrame::Process_Special_Functions) EVT_KICAD_CHOICEBOX(ID_TOOLBARH_PCB_SELECT_LAYER, WinEDA_PcbFrame::Process_Special_Functions) EVT_KICAD_CHOICEBOX(ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, @@ -159,7 +160,7 @@ BEGIN_EVENT_TABLE(WinEDA_PcbFrame, wxFrame) EVT_MENU_RANGE(ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, WinEDA_PcbFrame::Process_Special_Functions ) - // PopUp Menus pour Zooms trait�s dans drawpanel.cpp + // PopUp Menus pour Zooms traites dans drawpanel.cpp END_EVENT_TABLE() @@ -178,7 +179,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame(wxWindow * father, WinEDA_App *parent, m_FrameName = wxT("PcbFrame"); m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Grid = g_ShowGrid; // TRUE pour avoir la grille dessinee - m_Draw_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche dessin� + m_Draw_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche dessine m_Draw_Auxiliary_Axis = TRUE; m_SelTrackWidthBox = NULL; m_SelViaSizeBox = NULL; @@ -275,7 +276,7 @@ PCB_SCREEN * screen; } /* Reselection de l'ecran de base, - pour les evenements de refresh g�n�r�s par wxWindows */ + pour les evenements de refresh generes par wxWindows */ m_CurrentScreen = ActiveScreen = ScreenPcb; SaveSettings(); @@ -483,6 +484,7 @@ int ii, jj; } ReCreateLayerBox(NULL); + PrepareLayerIndicator(); DisplayUnitsMsg(); } diff --git a/pcbnew/plotgerb.cpp b/pcbnew/plotgerb.cpp index cc308064a9..140ca929d5 100644 --- a/pcbnew/plotgerb.cpp +++ b/pcbnew/plotgerb.cpp @@ -66,11 +66,6 @@ int tracevia = 1; g_PlotOffset = m_Auxiliary_Axis_Position; } - InitPlotParametresGERBER(g_PlotOffset, scale_x, scale_y); - - /* Clear the memory used for handle the D_CODE (aperture) list */ - Init_ApertureList(); - dest = wxFopen(FullFileName, wxT("wt")); if (dest == NULL) { @@ -78,6 +73,13 @@ int tracevia = 1; DisplayError(this, msg); return ; } + setlocale(LC_NUMERIC, "C"); + + InitPlotParametresGERBER(g_PlotOffset, scale_x, scale_y); + + /* Clear the memory used for handle the D_CODE (aperture) list */ + Init_ApertureList(); + Affiche_1_Parametre(this, 0, _("File"),FullFileName,CYAN) ; Init_Trace_GERBER(this, dest) ; @@ -124,6 +126,7 @@ int tracevia = 1; } Fin_Trace_GERBER(this, dest) ; + setlocale(LC_NUMERIC, ""); } diff --git a/pcbnew/plothpgl.cpp b/pcbnew/plothpgl.cpp index 3d4c86e1ab..94dec875e8 100644 --- a/pcbnew/plothpgl.cpp +++ b/pcbnew/plothpgl.cpp @@ -67,6 +67,8 @@ bool Center = FALSE; return ; } + setlocale(LC_NUMERIC, "C"); + Affiche_1_Parametre(this, 0,_("File"),FullFileName,CYAN) ; PrintHeaderHPGL(dest, g_HPGL_Pen_Speed,g_HPGL_Pen_Num); @@ -168,6 +170,8 @@ bool Center = FALSE; } /* fin */ CloseFileHPGL(dest) ; + setlocale(LC_NUMERIC, ""); + } diff --git a/pcbnew/plotps.cpp b/pcbnew/plotps.cpp index 15ae87163e..f4e4a5c5d1 100644 --- a/pcbnew/plotps.cpp +++ b/pcbnew/plotps.cpp @@ -48,6 +48,8 @@ int PlotMarge_in_mils = 0; DisplayError(this, msg); return ; } + setlocale(LC_NUMERIC, "C"); + Affiche_1_Parametre(this, 0,_("File"),FullFileName,CYAN) ; if( g_PlotScaleOpt != 1 ) Center = TRUE; // Echelle != 1 donc trace centree du PCB @@ -201,6 +203,7 @@ int PlotMarge_in_mils = 0; } /* fin */ CloseFilePS(dest) ; + setlocale(LC_NUMERIC, ""); } diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 26ed71c07f..31c2d6021b 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -187,6 +187,7 @@ void WinEDA_BasePcbFrame::SelectLayerPair(void) new WinEDA_SelLayerPairFrame(this); frame->ShowModal(); frame->Destroy(); DrawPanel->MouseToCursorSchema(); + SetToolbars(); } diff --git a/pcbnew/set_color.cpp b/pcbnew/set_color.cpp index d6f4072066..b15fb0e1c3 100644 --- a/pcbnew/set_color.cpp +++ b/pcbnew/set_color.cpp @@ -729,7 +729,6 @@ int w = BUTT_SIZE_X, h = BUTT_SIZE_Y; iconDC.SelectObject( ButtBitmap ); int buttcolor = *laytool_list[ii]->m_Color; wxBrush Brush; - iconDC.SelectObject( ButtBitmap ); iconDC.SetPen(*wxBLACK_PEN); Brush.SetColour( ColorRefs[buttcolor].m_Red, diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 48142e6715..3e5f916f6b 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -46,6 +46,127 @@ #include "general_ratsnet.xpm" #include "add_cotation.xpm" + +/* Data to build the layer pair indicator button */ +static wxBitmap * LayerPairBitmap = NULL; +static char s_BitmapLayerIcon[16][16] = { + {0,0,0,0,0,0,0,3,3,3,1,1,1,1,0,0}, + {0,0,0,0,0,0,3,3,3,3,3,1,1,0,0,0}, + {0,0,0,0,0,3,3,0,1,1,3,3,0,0,0,0}, + {2,2,2,2,3,3,0,1,1,1,1,3,3,2,2,2}, + {2,2,2,2,3,3,1,1,1,0,0,3,3,2,2,2}, + {2,2,2,2,3,3,1,1,1,1,0,3,3,2,2,2}, + {0,0,0,0,0,3,3,1,1,0,3,3,0,0,0,0}, + {0,0,0,0,0,1,3,3,3,3,3,0,0,0,0,0}, + {0,0,0,0,0,1,1,3,3,3,0,0,0,0,0,0}, + {0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0}, + {0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0}, + {0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0}, + {0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0}, + {0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0}, + {0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0}, + {0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0} +}; +/************************************************************/ +void WinEDA_PcbFrame::PrepareLayerIndicator(void) +/************************************************************/ +/* Draw the icon for the "Select layet pair" bitmap tool +*/ +{ +int ii, jj; +static int previous_active_layer_color, previous_Route_Layer_TOP_color, + previous_Route_Layer_BOTTOM_color, previous_via_color; +int active_layer_color, Route_Layer_TOP_color, + Route_Layer_BOTTOM_color, via_color; +bool change = false; + + /* get colors, and redraw bitmap button only on changes */ + active_layer_color = g_DesignSettings.m_LayerColor[GetScreen()->m_Active_Layer]; + if ( previous_active_layer_color != active_layer_color ) + { + previous_active_layer_color = active_layer_color; + change = TRUE; + } + Route_Layer_TOP_color = g_DesignSettings.m_LayerColor[GetScreen()->m_Route_Layer_TOP]; + if ( previous_Route_Layer_TOP_color != Route_Layer_TOP_color ) + { + previous_Route_Layer_TOP_color = Route_Layer_TOP_color; + change = TRUE; + } + Route_Layer_BOTTOM_color = g_DesignSettings.m_LayerColor[GetScreen()->m_Route_Layer_BOTTOM]; + if ( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color ) + { + previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color; + change = TRUE; + } + via_color = g_DesignSettings.m_ViaColor[g_DesignSettings.m_CurrentViaType ]; + if ( previous_via_color != via_color ) + { + previous_via_color = via_color; + change = TRUE; + } + + if ( ! change && (LayerPairBitmap != NULL) ) return; + + + /* Creat the bitmap too and its Memory DC, if not already made */ + if ( LayerPairBitmap == NULL ) + { + LayerPairBitmap = new wxBitmap(16, 16); + } + + /* Draw the icon, witj colors according to the active layer and layer pairs for + via command (change layer) */ +wxMemoryDC iconDC; + iconDC.SelectObject( *LayerPairBitmap ); + int buttcolor = -1; + wxPen pen; + for ( ii = 0; ii < 16; ii++ ) + { + for ( jj = 0; jj < 16; jj++ ) + { + if ( s_BitmapLayerIcon[ii][jj] != buttcolor ) + { + buttcolor = s_BitmapLayerIcon[ii][jj]; + int color; + switch ( buttcolor ) + { + default: + case 0: + color = active_layer_color; + break; + case 1: + color = Route_Layer_TOP_color; + break; + case 2: + color = Route_Layer_BOTTOM_color; + break; + case 3: + color = via_color; + break; + } + color &= MASKCOLOR; + pen.SetColour( + ColorRefs[color].m_Red, + ColorRefs[color].m_Green, + ColorRefs[color].m_Blue + ); + iconDC.SetPen(pen); + } + iconDC.DrawPoint(jj,ii); + } + } + /* Deselect the Tool Bitmap from DC, + in order to delete the MemoryDC safely without deleting the bitmap */ + iconDC.SelectObject( wxNullBitmap ); + + if ( ! m_HToolBar ) return; + { + m_HToolBar->SetToolNormalBitmap(ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap); + } +} + + /******************************************/ void WinEDA_PcbFrame::ReCreateHToolbar(void) /******************************************/ @@ -122,6 +243,9 @@ int ii; m_HToolBar->AddSeparator(); ReCreateLayerBox(m_HToolBar); + PrepareLayerIndicator(); // Initialise the bitmap with current active layer colors for the next tool + m_HToolBar->AddTool(ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString, * LayerPairBitmap, + _("Show active layer selections\nand select layer pair for route and place via")); m_HToolBar->AddSeparator(); m_HToolBar->AddTool(ID_TOOLBARH_PCB_AUTOPLACE, wxEmptyString, BITMAP(mode_module_xpm), @@ -409,9 +533,9 @@ wxString msg; } -/**********************************************************************/ +/**************************************************************************/ WinEDAChoiceBox * WinEDA_PcbFrame::ReCreateLayerBox(WinEDA_Toolbar * parent) -/**********************************************************************/ +/**************************************************************************/ { int ii, jj, ll; bool rebuild = FALSE; @@ -425,7 +549,7 @@ long current_mask_layer; parent->AddControl(m_SelLayerBox); } - // Test si reconstruction de la liste n�cessaire + // Test si reconstruction de la liste necessaire current_mask_layer = 0; int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount-1]; Masque_Layer |= ALL_NO_CU_LAYERS; diff --git a/pcbnew/win_eda_cleaningoptionsframe.cpp b/pcbnew/win_eda_cleaningoptionsframe.cpp new file mode 100644 index 0000000000..dbd1b98053 --- /dev/null +++ b/pcbnew/win_eda_cleaningoptionsframe.cpp @@ -0,0 +1,220 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: win_eda_cleaningoptionsframe.cpp +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 25/05/2007 13:39:29 +// RCS-ID: +// Copyright: GNU License +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 25/05/2007 13:39:29 + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "win_eda_cleaningoptionsframe.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +////@begin includes +////@end includes + +#include "win_eda_cleaningoptionsframe.h" + +////@begin XPM images +////@end XPM images + + +/*! + * Win_EDA_CleaningOptionsFrame type definition + */ + +IMPLEMENT_DYNAMIC_CLASS( Win_EDA_CleaningOptionsFrame, wxDialog ) + + +/*! + * Win_EDA_CleaningOptionsFrame event table definition + */ + +BEGIN_EVENT_TABLE( Win_EDA_CleaningOptionsFrame, wxDialog ) + +////@begin Win_EDA_CleaningOptionsFrame event table entries +////@end Win_EDA_CleaningOptionsFrame event table entries + +END_EVENT_TABLE() + + +/*! + * Win_EDA_CleaningOptionsFrame constructors + */ + +Win_EDA_CleaningOptionsFrame::Win_EDA_CleaningOptionsFrame() +{ + Init(); +} + +Win_EDA_CleaningOptionsFrame::Win_EDA_CleaningOptionsFrame( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ + Init(); + Create(parent, id, caption, pos, size, style); +} + + +/*! + * Win_EDA_CleaningOptionsFrame creator + */ + +bool Win_EDA_CleaningOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ +////@begin Win_EDA_CleaningOptionsFrame creation + SetExtraStyle(wxWS_EX_BLOCK_EVENTS); + wxDialog::Create( parent, id, caption, pos, size, style ); + + CreateControls(); + if (GetSizer()) + { + GetSizer()->SetSizeHints(this); + } + Centre(); +////@end Win_EDA_CleaningOptionsFrame creation + return true; +} + + +/*! + * Win_EDA_CleaningOptionsFrame destructor + */ + +Win_EDA_CleaningOptionsFrame::~Win_EDA_CleaningOptionsFrame() +{ +////@begin Win_EDA_CleaningOptionsFrame destruction +////@end Win_EDA_CleaningOptionsFrame destruction +} + + +/*! + * Member initialisation + */ + +void Win_EDA_CleaningOptionsFrame::Init() +{ +////@begin Win_EDA_CleaningOptionsFrame member initialisation + m_CleanViasOpt = NULL; + m_MergetSegmOpt = NULL; + m_DeleteNullSegmOpt = NULL; + m_DeleteunconnectedOpt = NULL; + m_ConnectToPadsOpt = NULL; +////@end Win_EDA_CleaningOptionsFrame member initialisation +} + + +/*! + * Control creation for Win_EDA_CleaningOptionsFrame + */ + +void Win_EDA_CleaningOptionsFrame::CreateControls() +{ +////@begin Win_EDA_CleaningOptionsFrame content construction + // Generated by DialogBlocks, 25/05/2007 13:58:52 (unregistered) + + Win_EDA_CleaningOptionsFrame* itemDialog1 = this; + + wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); + itemDialog1->SetSizer(itemBoxSizer2); + + wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); + itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Static")); + wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL); + itemBoxSizer3->Add(itemStaticBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_CleanViasOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX_CLEAN_VIAS, _("Delete redundant vias"), wxDefaultPosition, wxDefaultSize, 0 ); + m_CleanViasOpt->SetValue(true); + itemStaticBoxSizer4->Add(m_CleanViasOpt, 0, wxALIGN_LEFT|wxALL, 5); + + m_MergetSegmOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX_MERGE_SEGMENTS, _("Merge segments"), wxDefaultPosition, wxDefaultSize, 0 ); + m_MergetSegmOpt->SetValue(true); + itemStaticBoxSizer4->Add(m_MergetSegmOpt, 0, wxALIGN_LEFT|wxALL, 5); + + m_DeleteNullSegmOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX_DELETE_NULL_SEGM, _("Delete 0 lenght segments"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DeleteNullSegmOpt->SetValue(true); + itemStaticBoxSizer4->Add(m_DeleteNullSegmOpt, 0, wxALIGN_LEFT|wxALL, 5); + + m_DeleteunconnectedOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Delete unconnected tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DeleteunconnectedOpt->SetValue(true); + itemStaticBoxSizer4->Add(m_DeleteunconnectedOpt, 0, wxALIGN_LEFT|wxALL, 5); + + m_ConnectToPadsOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Connect to Pads"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ConnectToPadsOpt->SetValue(false); + itemStaticBoxSizer4->Add(m_ConnectToPadsOpt, 0, wxALIGN_LEFT|wxALL, 5); + + wxStaticBox* itemStaticBoxSizer10Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Static")); + wxStaticBoxSizer* itemStaticBoxSizer10 = new wxStaticBoxSizer(itemStaticBoxSizer10Static, wxVERTICAL); + itemBoxSizer3->Add(itemStaticBoxSizer10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxButton* itemButton11 = new wxButton( itemDialog1, ID_BUTTON_EXECUTE, _("Clean pcb"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton11->SetDefault(); + itemStaticBoxSizer10->Add(itemButton11, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + itemBoxSizer2->Add(5, 5, 0, wxGROW|wxALL, 5); + + wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("Infos:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer2->Add(itemStaticText13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + + wxTextCtrl* itemTextCtrl14 = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxSize(-1, 120), wxTE_MULTILINE ); + itemBoxSizer2->Add(itemTextCtrl14, 0, wxGROW|wxALL, 5); + + // Set validators + m_CleanViasOpt->SetValidator( wxGenericValidator(& s_CleanVias) ); + m_MergetSegmOpt->SetValidator( wxGenericValidator(& s_MergeSegments) ); + m_DeleteNullSegmOpt->SetValidator( wxGenericValidator(& s_Delete0lenSegm) ); + m_DeleteunconnectedOpt->SetValidator( wxGenericValidator(& s_DeleteUnconnectedSegm) ); +////@end Win_EDA_CleaningOptionsFrame content construction +} + + +/*! + * Should we show tooltips? + */ + +bool Win_EDA_CleaningOptionsFrame::ShowToolTips() +{ + return true; +} + +/*! + * Get bitmap resources + */ + +wxBitmap Win_EDA_CleaningOptionsFrame::GetBitmapResource( const wxString& name ) +{ + // Bitmap retrieval +////@begin Win_EDA_CleaningOptionsFrame bitmap retrieval + wxUnusedVar(name); + return wxNullBitmap; +////@end Win_EDA_CleaningOptionsFrame bitmap retrieval +} + +/*! + * Get icon resources + */ + +wxIcon Win_EDA_CleaningOptionsFrame::GetIconResource( const wxString& name ) +{ + // Icon retrieval +////@begin Win_EDA_CleaningOptionsFrame icon retrieval + wxUnusedVar(name); + return wxNullIcon; +////@end Win_EDA_CleaningOptionsFrame icon retrieval +} diff --git a/pcbnew/win_eda_cleaningoptionsframe.h b/pcbnew/win_eda_cleaningoptionsframe.h new file mode 100644 index 0000000000..b6dc0e0506 --- /dev/null +++ b/pcbnew/win_eda_cleaningoptionsframe.h @@ -0,0 +1,109 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: win_eda_cleaningoptionsframe.h +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 25/05/2007 13:39:29 +// RCS-ID: +// Copyright: GNU License +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 25/05/2007 13:39:29 + +#ifndef _WIN_EDA_CLEANINGOPTIONSFRAME_H_ +#define _WIN_EDA_CLEANINGOPTIONSFRAME_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "win_eda_cleaningoptionsframe.h" +#endif + +/*! + * Includes + */ + +////@begin includes +#include "wx/valgen.h" +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define ID_WIN_EDA_CLEANINGOPTIONSFRAME 10000 +#define ID_CHECKBOX_CLEAN_VIAS 10001 +#define ID_CHECKBOX_MERGE_SEGMENTS 10003 +#define ID_CHECKBOX_DELETE_NULL_SEGM 10002 +#define ID_CHECKBOX1 10005 +#define ID_CHECKBOX 10004 +#define ID_BUTTON_EXECUTE 10006 +#define ID_TEXTCTRL1 10007 +#define SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX +#define SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_TITLE _("Cleaning options") +#define SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_IDNAME ID_WIN_EDA_CLEANINGOPTIONSFRAME +#define SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_SIZE wxSize(400, 300) +#define SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_POSITION wxDefaultPosition +////@end control identifiers + + +/*! + * Win_EDA_CleaningOptionsFrame class declaration + */ + +class Win_EDA_CleaningOptionsFrame: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( Win_EDA_CleaningOptionsFrame ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + Win_EDA_CleaningOptionsFrame(); + Win_EDA_CleaningOptionsFrame( wxWindow* parent, wxWindowID id = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_IDNAME, const wxString& caption = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_TITLE, const wxPoint& pos = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_POSITION, const wxSize& size = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_SIZE, long style = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_IDNAME, const wxString& caption = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_TITLE, const wxPoint& pos = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_POSITION, const wxSize& size = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_SIZE, long style = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_STYLE ); + + /// Destructor + ~Win_EDA_CleaningOptionsFrame(); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + +////@begin Win_EDA_CleaningOptionsFrame event handler declarations + +////@end Win_EDA_CleaningOptionsFrame event handler declarations + +////@begin Win_EDA_CleaningOptionsFrame member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end Win_EDA_CleaningOptionsFrame member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin Win_EDA_CleaningOptionsFrame member variables + wxCheckBox* m_CleanViasOpt; + wxCheckBox* m_MergetSegmOpt; + wxCheckBox* m_DeleteNullSegmOpt; + wxCheckBox* m_DeleteunconnectedOpt; + wxCheckBox* m_ConnectToPadsOpt; +////@end Win_EDA_CleaningOptionsFrame member variables +}; + +#endif + // _WIN_EDA_CLEANINGOPTIONSFRAME_H_